e86e9500f52ca42fe6dba1d8de6424b921e5fa7c
[platform/upstream/doxygen.git] / src / config.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2015 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  */
15
16 #ifndef CONFIG_H
17 #define CONFIG_H
18
19 class FTextStream;
20
21 // note: this header file is generated from config.xml
22 #include "configvalues.h"
23
24 //! @{
25 //! some convenience macros for accessing the config options
26 //! mainly done like this for backward compatibility
27 #if DYNAMIC_LOOKUP // for debug purposes
28 #define Config_getString(val) (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item)
29 #define Config_getBool(val)   (ConfigValues::instance().*((ConfigValues::InfoBool*)ConfigValues::instance().get(#val))->item)
30 #define Config_getInt(val)    (ConfigValues::instance().*((ConfigValues::InfoInt*)ConfigValues::instance().get(#val))->item)
31 #define Config_getEnum(val)   (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item)
32 #define Config_getList(val)   (ConfigValues::instance().*((ConfigValues::InfoList*)ConfigValues::instance().get(#val))->item)
33 #else // direct access
34 #define Config_getString(val) (ConfigValues::instance().val)
35 #define Config_getBool(val)   (ConfigValues::instance().val)
36 #define Config_getInt(val)    (ConfigValues::instance().val)
37 #define Config_getEnum(val)   (ConfigValues::instance().val)
38 #define Config_getList(val)   (ConfigValues::instance().val)
39 #endif
40 //! @}
41
42 /** \brief Public function to deal with the configuration file. */
43 namespace Config
44 {
45   /*! Initialize configuration variables to their default value */
46   void init();
47
48   /*! Writes a template configuration to stream \a t. If \a shortList
49    *  is \c TRUE the description of each configuration option will
50    *  be omitted.
51    */
52   void writeTemplate(FTextStream &t,bool shortList,bool updateOnly=FALSE);
53
54   /*! Parses a configuration file with name \a fn.
55    *  \returns TRUE if successful, FALSE if the file could not be
56    *  opened or read.
57    */
58   bool parse(const char *fileName,bool update=FALSE);
59
60   /*! Post processed the parsed data. Replaces raw string values by the actual values.
61    *  and replaces environment variables.
62    *  \param clearHeaderAndFooter set to TRUE when writing header and footer templates.
63    */
64   void postProcess(bool clearHeaderAndFooter);
65
66   /*! Check the validity of the parsed options and correct or warn the user where needed. */
67   void checkAndCorrect();
68
69   /*! Clean up any data */
70   void deinit();
71 }
72
73 #endif