ADTF  v2.14.3
cMacroResolver Class Reference

Class for resolving macros inside a string. More...

Public Member Functions

 cMacroResolver ()
 Constructor that initializes an empty cMacroResolver object.
 
virtual ~cMacroResolver ()
 Destructor.
 
tResult SetValues (const cStringMap &mapValues)
 Set string map to be used for macro replacement. More...
 
tResult SetValue (const cString &strKey, const cString &strValue)
 Set specific macro value. More...
 
cString GetValue (const cString &strKey)
 Get specific macro value. More...
 
cString Resolve (const cString &strSource)
 Resolve macros. More...
 

Protected Attributes

cStringMap m_mapValues
 Internally used string map.
 

Detailed Description

Class for resolving macros inside a string.

This class implements basic macro resolving functionality.

Macros can be defined as "$(MACRO)" or $MACRO$.

The available macros are listed here: Overview of the available macros in ADTF



This implementation tries to resolve environment variables while the Macro is not one of the above mentioned or within your user specific setttings (SetValues or SetValue).

Definition at line 37 of file macroresolver.h.

Member Function Documentation

cString GetValue ( const cString strKey)

Get specific macro value.

Parameters
strKey[in] Name of macro value.
Returns
Returns a string containing the macro value.
cString Resolve ( const cString strSource)

Resolve macros.

This method resolves all macros inside a string. Macros can be specified as or $name$. The $ can be escaped by a double $ ($$). If a macro cannot be resolved, the macro string is removed. See class description for a list of standard macros.

Note
While Windows XP environment variables are not case sensitive, linux environment variables are. Variables added with cMacroResolver::SetValue and cMacroResolver SetValues are case sensitive, too.
Parameters
strSource[in] String map containing all macro values.
Returns
Returns a string with all macros replaced.
tResult SetValue ( const cString strKey,
const cString strValue 
)

Set specific macro value.

Note
strKey and strValue will be handled as case sensitive by cMacroResolver::Resolve
Parameters
strKey[in] Name of macro value.
strValue[in] Value of macro.
Returns
Always returns ERR_NOERROR
tResult SetValues ( const cStringMap mapValues)

Set string map to be used for macro replacement.

This method defines a list of macro values to be used for macro replacement. In addition to these values, system or user environment variables are used as macro values.

Parameters
mapValues[in] String map containing all macro values.
Returns
Always returns ERR_NOERROR

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)