Blender  V2.93
AppConfig.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <algorithm>
25 #include <string>
26 
27 #include "../system/Precision.h"
28 
29 #ifdef WITH_CXX_GUARDEDALLOC
30 # include "MEM_guardedalloc.h"
31 #endif
32 
33 using namespace std;
34 
35 namespace Freestyle {
36 
37 namespace Config {
38 
39 class Path {
40  protected:
41  static Path *_pInstance;
42  string _ProjectDir;
43  string _ModelsPath;
44  string _PatternsPath;
45  string _BrushesPath;
46  string _EnvMapDir;
47  string _MapsDir;
48  string _HomeDir;
49 
50  public:
51  Path();
52  virtual ~Path();
53  static Path *getInstance();
54 
55  void setRootDir(const string &iRootDir);
56  void setHomeDir(const string &iHomeDir);
57 
58  const string &getProjectDir() const
59  {
60  return _ProjectDir;
61  }
62  const string &getModelsPath() const
63  {
64  return _ModelsPath;
65  }
66  const string &getPatternsPath() const
67  {
68  return _PatternsPath;
69  }
70  const string &getBrushesPath() const
71  {
72  return _BrushesPath;
73  }
74  const string &getEnvMapDir() const
75  {
76  return _EnvMapDir;
77  }
78  const string &getMapsDir() const
79  {
80  return _MapsDir;
81  }
82  const string &getHomeDir() const
83  {
84  return _HomeDir;
85  }
86 
87  static string getEnvVar(const string &iEnvVarName);
88 
89 #ifdef WITH_CXX_GUARDEDALLOC
90  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Config:Path")
91 #endif
92 };
93 
94 //
95 // Configuration, default values
96 //
98 
99 // Application
100 static const string APPLICATION_NAME("APPNAME");
101 static const string APPLICATION_VERSION("APPVERSION");
102 
103 // ViewMap
104 static const string VIEWMAP_EXTENSION("vm");
105 static const string VIEWMAP_MAGIC("ViewMap File");
106 static const string VIEWMAP_VERSION("1.9");
107 
108 // Style modules
109 static const string STYLE_MODULE_EXTENSION("py");
110 static const string STYLE_MODULES_LIST_EXTENSION("sml");
111 
112 // Options
113 static const string OPTIONS_DIR("." + APPLICATION_NAME);
114 static const string OPTIONS_FILE("options.xml");
115 static const string OPTIONS_CURRENT_DIRS_FILE("current_dirs.xml");
116 static const string OPTIONS_QGLVIEWER_FILE("qglviewer.xml");
117 
118 // Default options
119 static const real DEFAULT_SPHERE_RADIUS = 1.0;
120 static const real DEFAULT_DKR_EPSILON = 0.0;
121 
122 } // namespace Config
123 
124 } /* namespace Freestyle */
#define DEFAULT_DKR_EPSILON
#define DEFAULT_SPHERE_RADIUS
Read Guarded memory(de)allocation.
const string & getPatternsPath() const
Definition: AppConfig.h:66
const string & getBrushesPath() const
Definition: AppConfig.h:70
const string & getEnvMapDir() const
Definition: AppConfig.h:74
const string & getModelsPath() const
Definition: AppConfig.h:62
const string & getProjectDir() const
Definition: AppConfig.h:58
const string & getMapsDir() const
Definition: AppConfig.h:78
const string & getHomeDir() const
Definition: AppConfig.h:82
static Path * _pInstance
Definition: AppConfig.h:41
static const string VIEWMAP_EXTENSION("vm")
static const string OPTIONS_DIR("."+APPLICATION_NAME)
static const string OPTIONS_QGLVIEWER_FILE("qglviewer.xml")
static const string OPTIONS_CURRENT_DIRS_FILE("current_dirs.xml")
static const string STYLE_MODULE_EXTENSION("py")
static const string STYLE_MODULES_LIST_EXTENSION("sml")
static const string OPTIONS_FILE("options.xml")
static const string VIEWMAP_VERSION("1.9")
static const string VIEWMAP_MAGIC("ViewMap File")
static const string APPLICATION_NAME("APPNAME")
static const string APPLICATION_VERSION("APPVERSION")
inherits from class Rep
Definition: AppCanvas.cpp:32
double real
Definition: Precision.h:26