Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
main.hh
Go to the documentation of this file.
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 struct InitSettings {
00019   static bool  autonomous()    { return sis->m_autonomous; } 
00020   static uint  test_codes()    { return sis->m_test_codes; } // internal test flags
00021 protected:
00022   static const InitSettings *sis;
00023   bool m_autonomous;
00024   uint m_test_codes;
00025 };
00026 
00027 bool    arg_parse_option        (uint         argc,
00028                                  char       **argv,
00029                                  size_t      *i,
00030                                  const char  *arg);
00031 bool    arg_parse_string_option (uint         argc,
00032                                  char       **argv,
00033                                  size_t      *i,
00034                                  const char  *arg,
00035                                  const char **strp);
00036 int     arg_parse_collapse      (int         *argcp,
00037                                  char       **argv);
00038 
00039 // === process info ===
00040 String       program_file       ();
00041 String       program_ident      ();
00042 String       program_cwd        ();
00043 
00044 // === initialization hooks ===
00045 class InitHook : protected NonCopyable {
00046   typedef void (*InitHookFunc) (const StringVector &args);
00047   InitHook    *next;
00048   InitHookFunc hook;
00049   const String m_name;
00050 protected:
00051   static void  invoke_hooks (const String&, int*, char**, const StringVector&);
00052 public:
00053   String       name () const { return m_name; }
00054   StringVector main_args () const;
00055   explicit     InitHook (const String &fname, InitHookFunc func);
00056 };
00057 
00058 } // Rapicorn
00059 
00060 #endif /* __RAPICORN_MAIN_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines