13 #ifndef MAC_LAUNCH_SERVICES_H
14 #define MAC_LAUNCH_SERVICES_H
18 #if defined(__APPLE__)
21 #include <ApplicationServices/ApplicationServices.h>
35 LSRoleViewer = kLSRolesViewer,
36 LSRoleEditor = kLSRolesEditor,
37 LSRoleShell = kLSRolesShell,
38 LSRoleAll = LSRoleViewer | LSRoleEditor | LSRoleShell
43 LSLaunchNewInstance = 1 << 0
59 static bool openDocument(
const std::string &doc,
LSRoles role = LSRoleAll,
const std::string &app = std::string());
61 static bool openDocument(
const std::string &doc,
const std::string &app) {
62 return openDocument(doc, LSRoleAll, app);
72 static bool openApplication(
const std::string &app,
const std::list<std::string> &docs,
const std::list<std::string> &argv,
const std::map<std::string,std::string> &environment,
LSLaunchFlags flags =
static_cast<LSLaunchFlags>(0));
75 return openApplication(app, docs, argv, {}, flags);
79 return openApplication(app, docs, {}, environment, flags);
83 return openApplication(app, {}, {}, environment, flags);
87 return openApplication(app, docs, {}, {}, flags);
93 return openApplication(app, {}, {}, {}, flags);
Finder / Launch services encapsulation.
static bool isApplicationOpen(const std::string &id)
Return 'true' if application is already open (UTF8)
static bool openApplication(const std::string &app, const std::list< std::string > &docs, const std::list< std::string > &argv, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
static bool openApplication(const std::string &app, const std::string &doc, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
static bool openApplication(const std::string &app, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
LSLaunchFlags
Specify how to launch the application.
static bool openApplication(const std::string &app, const std::map< std::string, std::string > &environment, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
static bool openApplication(const std::string &app, const std::list< std::string > &docs, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
static std::string getApplicationWithName(const std::string &appName)
Return bundle location for bundle with given name, e.g. "iCal.app" (UTF8)
static bool openDocument(const std::string &doc, const std::string &app)
This is an overloaded member function, provided for convenience.
LSRoles
Specify the desired role or roles for an application to claim with respect to an item.
static std::string getApplicationWithId(const std::string &id)
Return bundle location for bundle with given id, e.g. "de.mevis.MeVisLab" (UTF8)
static bool registerApplication(const std::string &app, bool forceUpdate=true)
Add the bundle's document and URL claims to the Launch Services database (UTF8)
static bool openApplication(const std::string &app, const std::list< std::string > &docs, const std::map< std::string, std::string > &environment, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
This is an overloaded member function, provided for convenience.
static bool openApplication(const std::string &app, const std::list< std::string > &docs, const std::list< std::string > &argv, const std::map< std::string, std::string > &environment, LSLaunchFlags flags=static_cast< LSLaunchFlags >(0))
Launches the specified application (UTF8)
static bool openDocument(const std::string &doc, LSRoles role=LSRoleAll, const std::string &app=std::string())
Open given document in given application (or the default application) using the given role (UTF8)
#define OSXSUPPORT_PUBLIC_API
Symbol visibility macros.