ConfigurationManager.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include "../DgnPlatform.h"
11 #include "../DgnHost.h"
12 
13 typedef struct mdlDesc* MdlDescP;
14 
16 
27 /*=================================================================================**/
31 {
32 public:
35  virtual void _VariableChanged (WCharCP variableName) = 0;
36 
41  virtual void _VariableRootChanged (WCharCP variableName, WCharCP rootVariableName) = 0;
42 
45  virtual void _VariableUndefined (WCharCP variableName) = 0;
46 
51  virtual void _VariableRootUndefined (WCharCP variableName, WCharCP rootVariableName) = 0;
52 
57  virtual void _MonitorStopped (WCharCP variableName) = 0;
58 };
59 
60 /*=================================================================================**/
64  {
66 
67 public:
68  DGNPLATFORM_EXPORT virtual void _VariableChanged (WCharCP variableName) override;
69  DGNPLATFORM_EXPORT virtual void _VariableRootChanged (WCharCP variableName, WCharCP rootVariableName) override;
70  DGNPLATFORM_EXPORT virtual void _VariableUndefined (WCharCP variableName) override;
71  DGNPLATFORM_EXPORT virtual void _VariableRootUndefined (WCharCP variableName, WCharCP rootVariableName) override;
72  DGNPLATFORM_EXPORT virtual void _MonitorStopped (WCharCP variableName) override;
73 
75  virtual void _UpdateState (WCharCP variableName) = 0;
76  };
77 
80  {
82  virtual void EachConfigVariable (WCharCP name, WCharCP value, ConfigurationVariableLevel level, bool locked) = 0;
83  };
84 
85 
86 
87 /*=================================================================================**/
103 // ***
104 // *** NB: The ConfigurationManager functions must call the s_GetAdminFunc function pointer every time a config
105 // *** variable is needed. The admin object that it returns must *not* be cached.
106 // ***
108 {
109 public:
112  DGNPLATFORM_EXPORT static BeFileNameCR GetLocalTempDirectoryBaseName ();
113 
118  DGNPLATFORM_EXPORT static BentleyStatus GetLocalTempDirectory (BeFileNameR tempDir, WCharCP subDirName);
119 
126  DGNPLATFORM_EXPORT static BentleyStatus GetNameForTempFile (BeFileNameR tempFileName, WCharCP partialPathName, WCharCP prefixString);
127 
131  DGNPLATFORM_EXPORT static bool IsVariableDefined (WCharCP cfgVarName);
132 
136  DGNPLATFORM_EXPORT static bool IsVariableDefinedAndTrue (WCharCP cfgVarName);
137 
142  DGNPLATFORM_EXPORT static bool IsVariableDefinedAndFalse (WCharCP cfgVarName);
143 
150  DGNPLATFORM_EXPORT static BentleyStatus GetVariable (WStringR cfgValue, WCharCP cfgVarName, ConfigurationVariableLevel level=ConfigurationVariableLevel::User);
151 
157  DGNPLATFORM_EXPORT static BentleyStatus DefineVariable (WCharCP cfgVarName, WCharCP cfgValue, ConfigurationVariableLevel level=ConfigurationVariableLevel::User);
158 
163  DGNPLATFORM_EXPORT static BentleyStatus UndefineVariable (WCharCP cfgVarName);
164 
168  DGNPLATFORM_EXPORT static BentleyStatus IterateThroughVariables (IConfigVariableIteratorDelegate *delegate);
169 
175  DGNPLATFORM_EXPORT static BentleyStatus MonitorVariable (WCharCP cfgVarName, IVariableMonitorR monitor);
176 
182  DGNPLATFORM_EXPORT static BentleyStatus RemoveMonitor (WCharCP cfgVarName, IVariableMonitorR monitor);
183 
196  DGNPLATFORM_EXPORT static bool MonitorBoolean (IVariableMonitorP& monitor, bool& value, WCharCP cfgVarName, bool defaultValue);
197 
210  DGNPLATFORM_EXPORT static int MonitorInteger (IVariableMonitorP& monitor, int& value, WCharCP cfgVarName, int defaultValue, int minimumValue, int maximumValue);
211 
221  DGNPLATFORM_EXPORT static WCharCP MonitorString (IVariableMonitorP& monitor, WStringR string, WCharCP cfgVarName);
222 
223 
224 
225 };
226 
229 
struct Bentley::BeFileName const & BeFileNameCR
Definition: Bentley.h:242
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
wchar_t const * WCharCP
Definition: Bentley.h:224
The ConfigurationManager supplies methods that allow users and applications to customize the behavior...
Definition: ConfigurationManager.h:107
The IVariableMonitor interface is implemented by classes that need to be informed when a Configuratio...
Definition: ConfigurationManager.h:30
ConfigurationVariableLevel
Definition: DgnPlatform.h:684
BentleyStatus
Definition: Bentley.h:208
Provide a delegate mechanism for iterating through all configuration variables.
Definition: ConfigurationManager.h:79
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
struct mdlDesc * MdlDescP
Definition: ConfigurationManager.h:13
struct Bentley::BeFileName & BeFileNameR
Definition: Bentley.h:242
The SimpleConfiguraionVariableMonitor class implements IVariableMonitor and provides only one callbac...
Definition: ConfigurationManager.h:63
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.