#include <expandlib-expandable.h>
Collaboration diagram for expander::expandable< StringType >:
Expand Commands | |
A list of all the commands this expandable will support This list should be updated every time a command is added. The friend declarations are used because all these classes need access to protected members of this class (primarily the expand function). The expand function could probably be public, but it wasn't meant that way, so for now this should do fine. | |
expcmd_abbr< StringType > | cmd_abbr |
expcmd_bpad< StringType > | cmd_bpad |
expcmd_btrunc< StringType > | cmd_btrunc |
expcmd_fpad< StringType > | cmd_fpad |
expcmd_ftrunc< StringType > | cmd_ftrunc |
expcmd_if< StringType > | cmd_if |
expcmd_knownvars< StringType > | cmd_knownvars |
expcmd_lower< StringType > | cmd_lower |
expcmd_ltrim< StringType > | cmd_ltrim |
expcmd_numvars< StringType > | cmd_numvars |
expcmd_rtrim< StringType > | cmd_rtrim |
expcmd_trim< StringType > | cmd_trim |
expcmd_unknownvars< StringType > | cmd_unknownvars |
expcmd_upper< StringType > | cmd_upper |
class | expandcmd< StringType > |
This is needed because of the RegisterWith in expandcmd. | |
class | expcmd_abbr< StringType > |
class | expcmd_bpad< StringType > |
class | expcmd_btrunc< StringType > |
class | expcmd_fpad< StringType > |
class | expcmd_ftrunc< StringType > |
class | expcmd_if< StringType > |
class | expcmd_knownvars< StringType > |
class | expcmd_lower< StringType > |
class | expcmd_ltrim< StringType > |
class | expcmd_numvars< StringType > |
class | expcmd_rtrim< StringType > |
class | expcmd_trim< StringType > |
class | expcmd_unknownvars< StringType > |
class | expcmd_upper< StringType > |
Public Types | |
typedef ::std::vector< StringType > | FParamVectorType |
The type used for the parameter vectors (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done). | |
typedef ::std::map< StringType, ::expander::expandvartype< StringType > * > | FVarMapType |
The type used for the map of variables (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done). | |
typedef ::std::map< StringType, ::expander::expandcmd< StringType > * > | FCmdMapType |
The type used for the map of commands (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done). | |
Public Methods | |
expandable (const StringType &value=StringType(_T("")), const bool iee=true, const bool ige=false) | |
Constructor, initializes expstr to value and the cmdmap with a default set of commands. | |
bool | expandto (StringType &dest, FVarMapType &vars, ExpandResultsType &results) |
Will call expandable::expand, passing the parameters, as well as expandable::expstr (as source string). | |
void | set_expstr (const StringType &value) |
This will set the expandable string. | |
StringType | get_expstr () |
This will return the expandable string. | |
Protected Methods | |
bool | expand (StringType &dest, const StringType &src, const FVarMapType &vars, ExpandResultsType &results) |
Will expand this expandable into dest, using vars and putting the results in results. | |
const StringType::value_type | ConvHexToChar (const StringType &h) |
A function to convert from a hexadecimal string to a char (used by expandable::expand). | |
Protected Attributes | |
const bool | InlineExpandErrors |
Boolean determining what to do with expand errors. | |
const bool | InlineGeneralErrors |
Boolean determining what to do with general errors. | |
StringType | expstr |
The expandable string. | |
FCmdMapType | cmdmap |
The map of commands. |
This class holds (among other things) the expandable string and is used for calls to expand. It also holds a map of commands that can be used with this expandable string. The template has one parameter, StringType, normally this would be std::string, but it can be anything you want, as long as it is compatible (perhaps std::wstring)
Definition at line 123 of file expandlib-expandable.h.
|
The type used for the map of commands (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).
Definition at line 127 of file expandlib-expandable.h. |
|
The type used for the parameter vectors (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).
Definition at line 125 of file expandlib-expandable.h. |
|
The type used for the map of variables (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).
Definition at line 126 of file expandlib-expandable.h. |
|
Constructor, initializes expstr to value and the cmdmap with a default set of commands.
Definition at line 215 of file expandlib-expandable.h. |
|
A function to convert from a hexadecimal string to a char (used by expandable::expand).
Definition at line 185 of file expandlib-expandable.h. Referenced by expander::expandable< StringType >::expand(). |
|
Will expand this expandable into dest, using vars and putting the results in results. This function iterates through the expandable string (src), using a const_iterator, and uses a mode system for keeping track of what to do. If it's in the searching mode, it will check wether the current char is one of the delimiter chars, if it isn't it will add the current char to the destination string (dest). If it is one of the delimiting chars it will go into the mode corresponding to the char, or rather one of the 'chk' modes, which will first check wether the input is legal and then decide wether to go in this mode or return to the searching mode (and add the delimiter char, as well as the chars that were processed by the chk mode). The twocharvar mode converts the two hexadecimal digits it has read to a char and adds that to dest. The twocharvar mode doesn't check wether the digits were legal, but the expandable::ConvHexToChar function does. The other "delimiter" modes (command and realvar)work in essentially the same way, only checking for their own delimiters and filling other strings. When they encounter parameters, delimited by '(' and ')', they will go to the corresponding 'params' mode. The parameters are seperated by comma's, which can be escaped by a backslash. The parameters are first written into the 'param' variable, and than put into the 'params' vector. If the parameters contain commands or variables with parameters those parameters will be "escaped", the variable 'level' is incremented everytime a '(' is found inside a parameter and decreased when a ')' is found, if level>0 just about anything is simply written into 'param'. The escaping works by having a variable 'quotemode' that is set to 'backslash' whenever a backslash is found (except when level>0). When quotemode==backslash the normal parsing routine isn't performed, the current char is outputted directly to the current string (pointed to by curstring).
Definition at line 321 of file expandlib-expandable.h. References expander::CommandDelimiter, expander::expandable< StringType >::ConvHexToChar(), expander::expandresults::FoundVars, expander::expandresults::MissedVars, expander::ParamsCloseChar, expander::ParamsOpenChar, expander::ParamsSeperator, expander::RealVarDelimiter, expander::TwoCharVarDelimiter, expander::VarnameCloseChar, and expander::VarnameOpenChar. Referenced by expander::expandable< StringType >::expandto(). |
|
Will call expandable::expand, passing the parameters, as well as expandable::expstr (as source string).
Definition at line 249 of file expandlib-expandable.h. References expander::expandable< StringType >::expand(). |
|
This will return the expandable string.
Definition at line 255 of file expandlib-expandable.h. |
|
This will set the expandable string.
Definition at line 252 of file expandlib-expandable.h. |
|
This is needed because of the RegisterWith in expandcmd.
Definition at line 150 of file expandlib-expandable.h. |
|
Definition at line 151 of file expandlib-expandable.h. |
|
Definition at line 153 of file expandlib-expandable.h. |
|
Definition at line 155 of file expandlib-expandable.h. |
|
Definition at line 157 of file expandlib-expandable.h. |
|
Definition at line 159 of file expandlib-expandable.h. |
|
Definition at line 161 of file expandlib-expandable.h. |
|
Definition at line 163 of file expandlib-expandable.h. |
|
Definition at line 165 of file expandlib-expandable.h. |
|
Definition at line 167 of file expandlib-expandable.h. |
|
Definition at line 169 of file expandlib-expandable.h. |
|
Definition at line 171 of file expandlib-expandable.h. |
|
Definition at line 173 of file expandlib-expandable.h. |
|
Definition at line 175 of file expandlib-expandable.h. |
|
Definition at line 177 of file expandlib-expandable.h. |
|
Definition at line 152 of file expandlib-expandable.h. |
|
Definition at line 154 of file expandlib-expandable.h. |
|
Definition at line 156 of file expandlib-expandable.h. |
|
Definition at line 158 of file expandlib-expandable.h. |
|
Definition at line 160 of file expandlib-expandable.h. |
|
Definition at line 162 of file expandlib-expandable.h. |
|
Definition at line 164 of file expandlib-expandable.h. |
|
Definition at line 166 of file expandlib-expandable.h. |
|
Definition at line 168 of file expandlib-expandable.h. |
|
Definition at line 170 of file expandlib-expandable.h. |
|
Definition at line 172 of file expandlib-expandable.h. |
|
Definition at line 174 of file expandlib-expandable.h. |
|
Definition at line 176 of file expandlib-expandable.h. |
|
Definition at line 178 of file expandlib-expandable.h. |
|
The map of commands.
Definition at line 140 of file expandlib-expandable.h. Referenced by expander::expandcmd< StringType >::Register(). |
|
The expandable string.
Definition at line 137 of file expandlib-expandable.h. |
|
Boolean determining what to do with expand errors.
Definition at line 131 of file expandlib-expandable.h. |
|
Boolean determining what to do with general errors.
Definition at line 134 of file expandlib-expandable.h. |