Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
00001 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __RAPICORN_MAIN_HH__ 00003 #define __RAPICORN_MAIN_HH__ 00004 00005 #include <rcore/utilities.hh> 00006 00007 #if !defined __RAPICORN_CORE_HH__ && !defined __RAPICORN_BUILD__ 00008 #error Only <rapicorn-core.hh> can be included directly. 00009 #endif 00010 00011 namespace Rapicorn { 00012 00013 // == initialization == 00014 void init_core (const String &app_ident, 00015 int *argcp, 00016 char **argv, 00017 const StringVector &args = StringVector()); 00018 bool init_core_initialized (); 00019 00020 class InitSettings { 00021 static const InitSettings &is; 00022 protected: 00023 uint64 test_codes_; 00024 bool autonomous_; 00025 public: 00026 static bool autonomous() { return is.autonomous_; } 00027 static uint64 test_codes() { return is.test_codes_; } 00028 }; 00029 00030 bool arg_parse_option (uint argc, 00031 char **argv, 00032 size_t *i, 00033 const char *arg); 00034 bool arg_parse_string_option (uint argc, 00035 char **argv, 00036 size_t *i, 00037 const char *arg, 00038 const char **strp); 00039 int arg_parse_collapse (int *argcp, 00040 char **argv); 00041 String rapicorn_version (); 00042 String rapicorn_buildid (); 00043 00044 // == locale == 00045 00047 class ScopedLocale { 00048 locale_t locale_; 00049 /*copy*/ ScopedLocale (const ScopedLocale&) = delete; 00050 ScopedLocale& operator= (const ScopedLocale&) = delete; 00051 protected: 00052 explicit ScopedLocale (locale_t scope_locale); 00053 public: 00054 // explicit ScopedLocale (const String &locale_name = ""); // not supported 00055 /*dtor*/ ~ScopedLocale (); 00056 }; 00057 00059 class ScopedPosixLocale : public ScopedLocale { 00060 public: 00061 explicit ScopedPosixLocale (); 00062 static locale_t posix_locale (); 00063 }; 00064 00065 // == process info == 00066 String program_file (); 00067 String program_alias (); 00068 String program_ident (); 00069 String program_cwd (); 00070 00071 // == initialization hooks == 00072 class InitHook { 00073 typedef void (*InitHookFunc) (const StringVector &args); 00074 InitHook *next; 00075 InitHookFunc hook; 00076 const String name_; 00077 RAPICORN_CLASS_NON_COPYABLE (InitHook); 00078 protected: 00079 static void invoke_hooks (const String&, int*, char**, const StringVector&); 00080 public: 00081 String name () const { return name_; } 00082 StringVector main_args () const; 00083 explicit InitHook (const String &fname, InitHookFunc func); 00084 }; 00085 00086 } // Rapicorn 00087 00088 #endif /* __RAPICORN_MAIN_HH__ */