Imported Upstream version 1.8.15
[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   /*! Writes a the differences between the current configuration and the
55    *  template configuration to stream \a t.
56    */
57   void compareDoxyfile(FTextStream &t);
58
59   /*! Parses a configuration file with name \a fn.
60    *  \returns TRUE if successful, FALSE if the file could not be
61    *  opened or read.
62    */
63   bool parse(const char *fileName,bool update=FALSE);
64
65   /*! Post processed the parsed data. Replaces raw string values by the actual values.
66    *  and replaces environment variables.
67    *  \param clearHeaderAndFooter set to TRUE when writing header and footer templates.
68    */
69   void postProcess(bool clearHeaderAndFooter, bool compare = FALSE);
70
71   /*! Check the validity of the parsed options and correct or warn the user where needed. */
72   void checkAndCorrect();
73
74   /*! Clean up any data */
75   void deinit();
76 }
77
78 #endif