first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / configuration / application_configuration.h
1 #ifndef APPLICATION_CONFIGURATION_GROUP
2 #define APPLICATION_CONFIGURATION_GROUP
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : path configuration definitions                                    *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 2000-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 #include <basis/astring.h>
19 #include <basis/definitions.h>
20 #include <structures/version_record.h>
21
22 namespace configuration {
23
24 //! Defines installation-specific locations in the file system.
25
26 class application_configuration : public virtual basis::root_object
27 {
28 public:
29   virtual ~application_configuration() {}
30
31   // these methods are mainly about the application itself.
32
33   static basis::astring application_name();
34     //!< returns the full name of the current application.
35
36   static basis::astring application_directory();
37     //!< returns the directory name where this application is running from.
38
39   static basis::un_int process_id();
40     //!< returns the process id for this task, if that's relevant on the OS.
41
42   // these interface with the operating system.
43
44   static structures::version get_OS_version();
45     //!< returns the operating system's version information.
46     /*!< for linux, this has: major/minor/release/revision as components.
47     for ms-windows, this has: major/minor/platform_ID/build_number. */
48
49   static basis::astring current_directory();
50     //!< returns the current directory as reported by the operating system.
51
52   // the following are more about the installation than this application...
53
54   static const char *software_product_name();
55     //!< This global function is available to the system at large for branding info.
56
57 //  static basis::astring installation_root();
58     //!< returns the top-level directory of this installation.
59     /*!< returns the folder containing the application directory (usually) as
60     well as the other folders of configuration information and fonts and
61     such needed by this installation. */
62
63   static const char *APPLICATION_CONFIGURATION_FILENAME();
64     //!< the configuration file provides a set of paths needed here.
65     /*!< this file stores paths that the low-level libraries need for
66     proper operation.  this is just the base filename; the fully qualified
67     path to the path configuration file is provided below. */
68
69   static basis::astring application_configuration_file();
70     //!< the fully specified path to the main path configuration file.
71     /*!< the location of this file is determined by the directory where this
72     executable is running.  this is the only configuration file that should
73     reside there, given the itchy vista compliance needs. */
74
75 ////  static basis::astring core_bin_directory();
76     //!< retrieves the core binary directory location from paths.ini.
77
78   static basis::astring get_logging_directory();
79     //!< returns the directory where log files will be stored.
80
81   // the following are key names within the main configuration file.
82
83   static const basis::astring &GLOBAL_SECTION_NAME();
84     //!< the root section name for our configuration items in the main ini file.
85     /*!< within the configuration file, there is a section named as above.
86     this section should only be used to define path configuration entries that
87     affect the general operation of the system.  entries that are specific
88     to particular programs or subsystems should be contained in their own
89     section. */
90
91 ///  static const basis::astring &LOCAL_FOLDER_NAME();
92     //!< entry name in the config file that points at the installation root.
93     /*!< this is where all files for this product are stored on "this" machine. */
94
95   static const basis::astring &LOGGING_FOLDER_NAME();
96     //!< the location where the log files for the system are stored.
97     /*!< this is always considered to be a directory under the local folder.
98     the make_logfile_name() function (see below) can be used to create a
99     properly formed filename for logging. */
100
101   // helper methods.
102
103   static basis::astring read_item(const basis::astring &key_name);
104     //!< returns the entry listed under the "key_name".
105     /*!< if the "key_name" is valid for the root configuration file, then this
106     should always return an appropriate value.  a failure is denoted by return
107     of an empty string. */
108
109   static basis::astring make_logfile_name(const basis::astring &base_name);
110     //!< generates an installation appropriate log file name from "base_name".
111     /*!< creates and returns a full path name for a log file with the
112     "base_name" specified, using the LOGGING_FOLDER_NAME() entry as the
113     directory name.  if the logging directory does not exist, it is created if
114     that is possible.  the returned name is suitable for logging mechanisms that
115     need a filename.  an empty string is returned on failure to create the
116     directory. */
117
118 #ifdef __UNIX__
119   #ifdef __APPLE__
120     static basis::astring get_cmdline_for_apple();
121   #endif
122   static basis::astring get_cmdline_from_proc();
123     //!< retrieves the command line from the /proc hierarchy on linux.
124   static basis::astring query_for_process_info();
125     //!< seeks out process info for a particular process.
126 #endif
127 };
128
129 } // namespace.
130
131 #endif
132