ADTF
macroresolver_intf.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include <adtfucom3/adtf_ucom3.h>
9 #include "string_intf.h"
10 
11 namespace adtf
12 {
13 namespace services
14 {
15 namespace macro
16 {
18  constexpr const char* const ADTF_DIR = "ADTF_DIR";
20  constexpr const char* const ADTF_SESSION_DIR = "ADTF_SESSION_DIR";
22  constexpr const char* const ADTF_SESSION_FILE_NAME = "ADTF_SESSION_FILE_NAME";
24  constexpr const char* const ADTF_SESSION_FILE_NAME_NOEXT = "ADTF_SESSION_FILE_NAME_NOEXT";
27  constexpr const char* const ADTF_SESSION_DATA_DIR = "ADTF_SESSION_DATA_DIR";
29  constexpr const char* const ADTF_SYSTEM_DIR = "ADTF_SYSTEM_DIR";
31  constexpr const char* const ADTF_SYSTEM_FILE_NAME = "ADTF_SYSTEM_FILE_NAME";
33  constexpr const char* const ADTF_SYSTEM_FILE_NAME_NOEXT = "ADTF_SYSTEM_FILE_NAME_NOEXT";
35  constexpr const char* const ADTF_GRAPH_DIR = "ADTF_GRAPH_DIR";
37  constexpr const char* const ADTF_GRAPH_FILE_NAME = "ADTF_GRAPH_FILE_NAME";
39  constexpr const char* const ADTF_GRAPH_FILE_NAME_NOEXT = "ADTF_GRAPH_FILE_NAME_NOEXT";
40 
42  constexpr const char* const ADTF_PLAYBACK_FILE_NAMES = "ADTF_PLAYBACK_FILE_NAMES";
44  constexpr const char* const ADTF_PLAYBACK_FILE_NAMES_NOEXT = "ADTF_PLAYBACK_FILE_NAMES_NOEXT";
46  constexpr const char* const ADTF_PLAYBACK_FILE_BASENAMES = "ADTF_PLAYBACK_FILE_BASENAMES";
48  constexpr const char* const ADTF_PLAYBACK_FILE_BASENAMES_NOEXT = "ADTF_PLAYBACK_FILE_BASENAMES_NOEXT";
50  constexpr const char* const ADTF_PLAYBACK_DIRS = "ADTF_PLAYBACK_DIRS";
51 
53  constexpr const char* const THIS_OBJECT_NAME = "THIS_OBJECT_NAME";
55  constexpr const char* const THIS_OBJECT_PARENT = "THIS_OBJECT_PARENT";
57  constexpr const char* const THIS_OBJECT_FULL_NAME = "THIS_OBJECT_FULL_NAME";
58 }
59 
60 
61 namespace ant
62 {
75  {
76  public:
78  ADTF_IID(IMacroResolver, "macroresolver.ant.base.adtf.iid");
79 
80  public:
81 
86  {
87  MRF_None = 0x00,
88  MRF_Overwrite = 0x01
89  };
90 
91  public:
105  virtual tResult ResolveMacros(const char* strSource,
106  base::IString&& strResolvedString) = 0;
107 
116  virtual tResult RegisterMacro(const char* strMacro,
117  const char* strMacroSol,
118  uint32_t ui32Flags = 0) = 0;
119 
126  virtual tResult UnregisterMacro(const char* strMacro) = 0;
127 
132  virtual void Clear() = 0;
133  };
134 
145  inline adtf::util::cString adtf_resolve_macros(const char* strString)
146  {
148  if (_runtime)
149  {
150  _runtime->GetObject(pResolver);
151  }
152  adtf::util::cString strLocalString;
153  if (pResolver)
154  {
155  pResolver->ResolveMacros(strString, adtf_string_intf(strLocalString));
156  }
157  else
158  {
159  adtf::util::cMacroResolver oLocalResolver;
160  strLocalString = oLocalResolver.Resolve(adtf::util::cString(strString));
161  }
162  return strLocalString;
163  }
164 
175  inline void adtf_register_macro(const char* strMacro, const char* strMacroString)
176  {
178  if (_runtime)
179  {
180  _runtime->GetObject(pResolver);
181  }
182  if (pResolver)
183  {
184  pResolver->RegisterMacro(strMacro, strMacroString, IMacroResolver::tMacroResolverFlags::MRF_Overwrite);
185  }
186  else
187  {
188  adtf::util::cSystem::SetEnvVariable(strMacro, strMacroString);
189  }
190  }
191 
192 } //namespace ant
193 
194 
195 namespace thor
196 {
197 
202  {
203  public:
205  ADTF_IID(IMacroResolver, "macroresolver.thor.base.adtf.iid");
206 
213  virtual void ListMacros(bool bIncludeEnvironmentVariables, const ucom::nitro::ifunction<void(const char*, const char*, bool)>& fnCallback) const = 0;
214  };
215 
216 } //namespace thor
217 
218 
222 
223 } //namespace services
224 } // namespace adtf
Copyright © Audi Electronics Venture GmbH.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition: string_intf.h:28
The IMacroResolver interface provides methods for resolving macros in strings.
tMacroResolverFlags
Enumerations used for the Macro Resolver (see RegisterMacro function).
@ MRF_Overwrite
overwrites an existing macro
virtual tResult UnregisterMacro(const char *strMacro)=0
Unregisters an existing macro.
ADTF_IID(IMacroResolver, "macroresolver.ant.base.adtf.iid")
defintion of interace id
virtual tResult ResolveMacros(const char *strSource, base::IString &&strResolvedString)=0
Resolve macros.
virtual void Clear()=0
Clears all registered macros.
virtual tResult RegisterMacro(const char *strMacro, const char *strMacroSol, uint32_t ui32Flags=0)=0
Register a new macro.
ADTF_IID(IMacroResolver, "macroresolver.thor.base.adtf.iid")
defintion of interace id
virtual void ListMacros(bool bIncludeEnvironmentVariables, const ucom::nitro::ifunction< void(const char *, const char *, bool)> &fnCallback) const =0
List all macros and environment variables.
Base class for every interface type within the uCOM.
Definition: object_intf.h:31
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
Interface for functions that can be passed via IObject interfaces.
Definition: function_ptr.h:28
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2784
void adtf_register_macro(const char *strMacro, const char *strMacroString)
Registers a macro within the IMacroResolver.
adtf::util::cString adtf_resolve_macros(const char *strString)
Resolves the macro within a string and returns the result.
constexpr const char *const ADTF_DIR
The ADTF_DIR points to your ADTF installation directory.
constexpr const char *const ADTF_SESSION_DATA_DIR
The ADTF_SESSION_DATA_DIR points to directory of the current session data (if loaded via adtfsession)...
constexpr const char *const ADTF_SYSTEM_FILE_NAME_NOEXT
The ADTF_SYSTEM_FILE_NAME_NOEXT is resolved to the current .adtfsystem file loaded without path and w...
constexpr const char *const ADTF_SYSTEM_DIR
The ADTF_SYSTEM_DIR points to directory of the current .adtfsystem file loaded (if loaded via adtfsys...
constexpr const char *const ADTF_SYSTEM_FILE_NAME
The ADTF_SYSTEM_FILE_NAME is resolved to the current .adtfsystem file loaded without path (if loaded ...
constexpr const char *const ADTF_SESSION_DIR
The ADTF_SESSION_DIR points to directory of the current .adtfsession file loaded (if loaded via adtfs...
constexpr const char *const THIS_OBJECT_PARENT
The THIS_OBJECT_PARENT is a scoped macro to resolve the current fully path name of an objects parent ...
constexpr const char *const ADTF_PLAYBACK_DIRS
The ADTF_PLAYBACK_DIRS is resolved to the directories that the currently opened playback files reside...
constexpr const char *const ADTF_GRAPH_DIR
The ADTF_GRAPH_DIR points to directory of the current .adtfgraph file loaded (if loaded via adtfgraph...
constexpr const char *const ADTF_SESSION_FILE_NAME_NOEXT
The ADTF_SESSION_FILE_NAME_NOEXT is resolved to the current .adtfsession file loaded without path and...
constexpr const char *const ADTF_GRAPH_FILE_NAME_NOEXT
The ADTF_GRAPH_FILE_NAME_NOEXT is resolved to the current .adtfgraph file loaded without path and wit...
constexpr const char *const ADTF_GRAPH_FILE_NAME
The ADTF_GRAPH_FILE_NAME is resolved to the current .adtfgraph file loaded without path (if loaded vi...
constexpr const char *const ADTF_PLAYBACK_FILE_NAMES_NOEXT
The ADTF_PLAYBACK_FILE_NAMES_NOEXT is resolved to the filenames without the extension of the currentl...
constexpr const char *const THIS_OBJECT_NAME
The THIS_OBJECT_NAME is a scoped macro to resolve the current name of an object.
constexpr const char *const ADTF_PLAYBACK_FILE_BASENAMES
The ADTF_PLAYBACK_FILE_BASENAMES is resolved to the basenames (filenames without directory components...
constexpr const char *const THIS_OBJECT_FULL_NAME
The THIS_OBJECT_FULL_NAME is a scoped macro to resolve the current fully path name of an objects (....
constexpr const char *const ADTF_PLAYBACK_FILE_BASENAMES_NOEXT
The ADTF_PLAYBACK_FILE_BASENAMES_NOEXT is resolved to the basenames (filenames without directory comp...
constexpr const char *const ADTF_PLAYBACK_FILE_NAMES
The ADTF_PLAYBACK_FILE_NAMES is resolved to the filenames of the currently opened playback files,...
constexpr const char *const ADTF_SESSION_FILE_NAME
The ADTF_SESSION_FILE_NAME is resolved to the current .adtfsession file loaded without path (if loade...
Namespace for entire ADTF SDK.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
Copyright © Audi Electronics Venture GmbH.
#define adtf_string_intf(__string__)
The adtf_string_intf Macro helps to easily create a rvalue reference of a adtf::util::cString.
Definition: string_intf.h:371