15 using namespace boost::spirit::classic;
88 DCOUT_V(
'P',
"DDLMap::processElement started");
90 std::string tTextToParse =
getText();
92 std::string tName = atts.find(
"name")->second;
94 if (tTextToParse.size() == 0)
96 errorOut(
"No std::string to parse!");
100 if (atts.find(
"type") != atts.end() && atts.find(
"type")->second ==
"string")
102 errorOut(
"Map of type std::string is not supported yet.");
112 errorOut(
"Does not conform to name=value, name=value... etc. of ddl Map element.");
119 else if (
parent() ==
"ConstantsSection" ||
parent() ==
"DDDefinition")
122 for (std::map<std::string, double>::const_iterator it =
pMap.begin(); it !=
pMap.end(); ++it)
124 (*tMap)[it->first] = it->second;
131 std::string nEntries = atts.find(
"nEntries")->second;
135 errorOut(
"Number of entries found in Map text does not match number in attribute nEntries.");
139 DCOUT_V(
'P',
"DDLMap::processElement completed");
151 pName = std::string(str, end);
157 std::string ts(str, end);
164 std::string
msg(
"\nDDLMap: Failed to parse the following: \n");
165 msg+= std::string(str);
166 msg+=
"\n as a Map element (comma separated list of name=value).";
ReadMapType< std::map< std::string, double > > pMapMap
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
void operator()(char const *str, char const *end) const
DDLMap(DDLElementRegistry *myreg)
Evaluator * parse(const T &text)
ReadMapType< double > dd_map_type
simply a std::map<std::string,double> supporting an addional operator[] const
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
ReadMapType< std::map< std::string, double > > & getMapOfMaps(void)
const std::string & parent(void) const
access to parent element name
type of data representation of DDCompactView
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
std::map< std::string, std::string > DDXMLAttribute
static value_type & instance()
definition(Mapper const &self)
void do_makeName(char const *str, char const *end)
void operator()(char const *str, char const *end) const
void do_pair(char const *str, char const *end)
#define DCOUT_V(M_v_Y, M_v_S)
DDLMap handles Map container.
This is a base class for processing XML elements in the DDD.
void errorOut(const char *str)
rule< ScannerT > const & start() const
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
void do_makeDouble(char const *str, char const *end)
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
void operator()(char const *str, char const *end) const
const std::string getText(size_t tindex=0) const
retrieve the text blob.