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";
52  constexpr const char* const ADTF_REMOTE_CONTROL_URL = "ADTF_REMOTE_CONTROL_URL";
53 
55  constexpr const char* const THIS_OBJECT_NAME = "THIS_OBJECT_NAME";
57  constexpr const char* const THIS_OBJECT_PARENT = "THIS_OBJECT_PARENT";
59  constexpr const char* const THIS_OBJECT_FULL_NAME = "THIS_OBJECT_FULL_NAME";
60 }
61 
62 
63 namespace ant
64 {
77  {
78  public:
80  ADTF_IID(IMacroResolver, "macroresolver.ant.base.adtf.iid");
81 
82  public:
83 
88  {
89  MRF_None = 0x00,
90  MRF_Overwrite = 0x01
91  };
92 
93  public:
107  virtual tResult ResolveMacros(const char* strSource,
108  base::IString&& strResolvedString) = 0;
109 
118  virtual tResult RegisterMacro(const char* strMacro,
119  const char* strMacroSol,
120  uint32_t ui32Flags = 0) = 0;
121 
128  virtual tResult UnregisterMacro(const char* strMacro) = 0;
129 
134  virtual void Clear() = 0;
135  };
136 
147  inline adtf::util::cString adtf_resolve_macros(const char* strString)
148  {
150  if (_runtime)
151  {
152  _runtime->GetObject(pResolver);
153  }
154  adtf::util::cString strLocalString;
155  if (pResolver)
156  {
157  pResolver->ResolveMacros(strString, adtf_string_intf(strLocalString));
158  }
159  else
160  {
161  adtf::util::cMacroResolver oLocalResolver;
162  strLocalString = oLocalResolver.Resolve(adtf::util::cString(strString));
163  }
164  return strLocalString;
165  }
166 
177  inline void adtf_register_macro(const char* strMacro, const char* strMacroString)
178  {
180  if (_runtime)
181  {
182  _runtime->GetObject(pResolver);
183  }
184  if (pResolver)
185  {
186  pResolver->RegisterMacro(strMacro, strMacroString, IMacroResolver::tMacroResolverFlags::MRF_Overwrite);
187  }
188  else
189  {
190  adtf::util::cSystem::SetEnvVariable(strMacro, strMacroString);
191  }
192  }
193 
194 } //namespace ant
195 
196 
197 namespace thor
198 {
199 
204  {
205  public:
207  ADTF_IID(IMacroResolver, "macroresolver.thor.base.adtf.iid");
208 
215  virtual void ListMacros(bool bIncludeEnvironmentVariables, const ucom::nitro::ifunction<void(const char*, const char*, bool)>& fnCallback) const = 0;
216  };
217 
218 } //namespace thor
219 
220 
224 
225 } //namespace services
226 } // 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_REMOTE_CONTROL_URL
The ADTF_REMOTE_CONTROL_URL is resolved to the given RPC endpoint of the current ADTF system.
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