ADTF  3.18.2
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 tChar* const ADTF_DIR = "ADTF_DIR";
20  constexpr const tChar* const ADTF_SESSION_DIR = "ADTF_SESSION_DIR";
22  constexpr const tChar* const ADTF_SESSION_FILE_NAME = "ADTF_SESSION_FILE_NAME";
24  constexpr const tChar* const ADTF_SESSION_FILE_NAME_NOEXT = "ADTF_SESSION_FILE_NAME_NOEXT";
27  constexpr const tChar* const ADTF_SESSION_DATA_DIR = "ADTF_SESSION_DATA_DIR";
29  constexpr const tChar* const ADTF_SYSTEM_DIR = "ADTF_SYSTEM_DIR";
31  constexpr const tChar* const ADTF_SYSTEM_FILE_NAME = "ADTF_SYSTEM_FILE_NAME";
33  constexpr const tChar* const ADTF_SYSTEM_FILE_NAME_NOEXT = "ADTF_SYSTEM_FILE_NAME_NOEXT";
35  constexpr const tChar* const ADTF_GRAPH_DIR = "ADTF_GRAPH_DIR";
37  constexpr const tChar* const ADTF_GRAPH_FILE_NAME = "ADTF_GRAPH_FILE_NAME";
39  constexpr const tChar* const ADTF_GRAPH_FILE_NAME_NOEXT = "ADTF_GRAPH_FILE_NAME_NOEXT";
40 
42  constexpr const tChar* const ADTF_PLAYBACK_FILE_NAMES = "ADTF_PLAYBACK_FILE_NAMES";
44  constexpr const tChar* const ADTF_PLAYBACK_FILE_NAMES_NOEXT = "ADTF_PLAYBACK_FILE_NAMES_NOEXT";
46  constexpr const tChar* const ADTF_PLAYBACK_FILE_BASENAMES = "ADTF_PLAYBACK_FILE_BASENAMES";
48  constexpr const tChar* const ADTF_PLAYBACK_FILE_BASENAMES_NOEXT = "ADTF_PLAYBACK_FILE_BASENAMES_NOEXT";
50  constexpr const tChar* const ADTF_PLAYBACK_DIRS = "ADTF_PLAYBACK_DIRS";
51 
53  constexpr const tChar* const THIS_OBJECT_NAME = "THIS_OBJECT_NAME";
55  constexpr const tChar* const THIS_OBJECT_PARENT = "THIS_OBJECT_PARENT";
57  constexpr const tChar* const THIS_OBJECT_FULL_NAME = "THIS_OBJECT_FULL_NAME";
58 }
59 
60 namespace ant
61 {
74  {
75  public:
77  ADTF_IID(IMacroResolver, "macroresolver.ant.base.adtf.iid");
78 
79  public:
80 
85  {
86  MRF_None = 0x00,
87  MRF_Overwrite = 0x01
88  };
89 
90  public:
104  virtual tResult ResolveMacros(const char* strSource,
105  base::IString&& strResolvedString) = 0;
106 
115  virtual tResult RegisterMacro(const char* strMacro,
116  const char* strMacroSol,
117  uint32_t ui32Flags = 0) = 0;
118 
125  virtual tResult UnregisterMacro(const char* strMacro) = 0;
126 
131  virtual void Clear() = 0;
132  };
133 
144  inline adtf::util::cString adtf_resolve_macros(const char* strString)
145  {
147  if (_runtime)
148  {
149  _runtime->GetObject(pResolver);
150  }
151  adtf::util::cString strLocalString;
152  if (pResolver)
153  {
154  pResolver->ResolveMacros(strString, adtf_string_intf(strLocalString));
155  }
156  else
157  {
158  adtf::util::cMacroResolver oLocalResolver;
159  strLocalString = oLocalResolver.Resolve(adtf::util::cString(strString));
160  }
161  return strLocalString;
162  }
163 
174  inline void adtf_register_macro(const char* strMacro, const char* strMacroString)
175  {
177  if (_runtime)
178  {
179  _runtime->GetObject(pResolver);
180  }
181  if (pResolver)
182  {
183  pResolver->RegisterMacro(strMacro, strMacroString, IMacroResolver::tMacroResolverFlags::MRF_Overwrite);
184  }
185  else
186  {
187  adtf::util::cSystem::SetEnvVariable(strMacro, strMacroString);
188  }
189  }
190 
191 } //namespace ant
192 
193 
194 using ant::IMacroResolver;
197 
198 } //namespace base
199 } // namespace adtf
Copyright © Audi Electronics Venture GmbH.
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
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.
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
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:2778
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 tChar *const ADTF_PLAYBACK_DIRS
The ADTF_PLAYBACK_DIRS is resolved to the directories that the currently opened playback files reside...
constexpr const tChar *const ADTF_PLAYBACK_FILE_NAMES
The ADTF_PLAYBACK_FILE_NAMES is resolved to the filenames of the currently opened playback files,...
constexpr const tChar *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 tChar *const ADTF_SYSTEM_FILE_NAME
The ADTF_SYSTEM_FILE_NAME is resolved to the current .adtfsystem file loaded without path (if loaded ...
constexpr const tChar *const ADTF_SESSION_DATA_DIR
The ADTF_SESSION_DATA_DIR points to directory of the current session data (if loaded via adtfsession)...
constexpr const tChar *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 tChar *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 tChar *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 tChar *const THIS_OBJECT_NAME
The THIS_OBJECT_NAME is a scoped macro to resolve the current name of an object.
constexpr const tChar *const ADTF_DIR
The ADTF_DIR points to your ADTF installation directory.
constexpr const tChar *const ADTF_GRAPH_DIR
The ADTF_GRAPH_DIR points to directory of the current .adtfgraph file loaded (if loaded via adtfgraph...
constexpr const tChar *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 tChar *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 tChar *const ADTF_PLAYBACK_FILE_BASENAMES
The ADTF_PLAYBACK_FILE_BASENAMES is resolved to the basenames (filenames without directory components...
constexpr const tChar *const ADTF_SESSION_FILE_NAME
The ADTF_SESSION_FILE_NAME is resolved to the current .adtfsession file loaded without path (if loade...
constexpr const tChar *const ADTF_PLAYBACK_FILE_BASENAMES_NOEXT
The ADTF_PLAYBACK_FILE_BASENAMES_NOEXT is resolved to the basenames (filenames without directory comp...
constexpr const tChar *const ADTF_SESSION_DIR
The ADTF_SESSION_DIR points to directory of the current .adtfsession file loaded (if loaded via adtfs...
constexpr const tChar *const ADTF_SYSTEM_DIR
The ADTF_SYSTEM_DIR points to directory of the current .adtfsystem file loaded (if loaded via adtfsys...
constexpr const tChar *const THIS_OBJECT_PARENT
The THIS_OBJECT_PARENT is a scoped macro to resolve the current fully path name of an objects parent ...
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