MeVisLabToolboxReference
MeVis/Foundation/Sources/OSXSupport/macAuthorization.h
Go to the documentation of this file.
00001 // **InsertLicense** code author="Felix Ritter" version="1.0"
00002 
00006 
00007 #ifndef __macAuthorization_H
00008 #define __macAuthorization_H
00009 #if defined(__APPLE__)
00010 
00011 #include <string>
00012 #include <list>
00013 
00014 namespace macx {
00015   
00016   class AuthorizationPrivate;
00017 
00019   class Authorization
00020   {
00021   public:
00022     
00024     enum AuthorizationError {
00025       ErrAuthorizationUnknown              = -1,  
00026       ErrAuthorizationSuccess              =  0,  
00027       ErrAuthorizationCanceled             =  1,  
00028       ErrAuthorizationDenied               =  2,  
00029       ErrAuthorizationToolExecuteFailure   =  3,  
00030       ErrAuthorizationToolEnvironmentError =  4   
00031     };
00032     
00034     Authorization();
00035     
00037     ~Authorization();
00038     
00040 
00042     void setPrompt(const std::string &prompt);
00043 
00045 
00050     bool executeWithPrivileges(const std::string &cmd, const std::list<std::string> &argv, const std::string &prompt = std::string(), AuthorizationError *error = NULL);
00051     
00053     const std::string &getCommandOutput() const;
00054     
00055   private:
00056       
00057     AuthorizationPrivate *_priv;
00058   };
00059 
00060 }
00061 
00062 #endif  // __APPLE__
00063 #endif  // __macAuthorization_H