16 #include "boost/spirit/include/classic.hpp"
18 namespace boost {
namespace spirit {
namespace classic { } } }
using namespace boost::spirit::classic;
20 using namespace boost::spirit;
24 void operator() (
char const* str,
char const*
end)
const
26 ddlVector_->do_makeDouble(str, end);
38 void operator() (
char const* str,
char const*
end)
const
40 ddlVector_->do_makeString(str, end);
55 ((+(anychar_p -
','))[makeDouble]
56 >> *(
',' >> (+(anychar_p -
','))[makeDouble]))
66 ((+(anychar_p -
','))[makeString]
67 >> *(
',' >> (+(anychar_p -
','))[makeString]))
90 DCOUT_V(
'P',
"DDLVector::processElement started");
93 bool isNumVec((atts.find(
"type") == atts.end()
94 || atts.find(
"type")->second ==
"numeric")
96 bool isStringVec((!isNumVec && atts.find(
"type") != atts.end()
97 && atts.find(
"type")->second ==
"string")
101 if (tTextToParse.size() == 0) {
110 else if (isStringVec) {
116 errorOut(
"Unexpected std::vector type. Only \"numeric\" and \"string\" are allowed.");
129 else if (isStringVec) {
133 size_t expNEntries = 0;
134 if (atts.find(
"nEntries") != atts.end()) {
135 std::string nEntries = atts.find(
"nEntries")->second;
138 if ( (isNumVec &&
pVector.size() != expNEntries)
139 || (isStringVec &&
pStrVector.size() != expNEntries) )
141 std::string msg (
"Number of entries found in Vector text does not match number in attribute nEntries.");
142 msg +=
"\n\tnEntries = " + atts.find(
"nEntries")->second;
143 msg +=
"\n------------------text---------\n";
145 msg +=
"\n------------------text---------\n";
149 else if (
parent() ==
"ConstantsSection" ||
parent() ==
"DDDefinition")
151 if (atts.find(
"type") == atts.end() || atts.find(
"type")->second ==
"numeric") {
159 DCOUT_V(
'P',
"DDLVector::processElement completed");
194 e+=
"\n as a Vector element (comma separated list).";
std::vector< double > pVector
Evaluator * parse(const T &text)
DDLVector handles Rotation and ReflectionRotation elements.
DDLVector(DDLElementRegistry *myreg)
ReadMapType< std::vector< std::string > > & getMapOfStrVectors()
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.
const std::string & parent(void) const
access to parent element name
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsStrVector> ...
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
type of data representation of DDCompactView
void do_makeDouble(char const *str, char const *end)
std::map< std::string, std::string > DDXMLAttribute
ReadMapType< std::vector< double > > & getMapOfVectors()
void do_makeString(char const *str, char const *end)
void errorOut(const char *str) const
static value_type & instance()
bool parse_strings(char const *str) const
a std::map<std::string,YourType> that offers a const operator[key]; if key is not stored in the std::...
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
std::vector< std::string > pStrVector
ReadMapType< std::vector< double > > pVecMap
#define DCOUT_V(M_v_Y, M_v_S)
bool parse_numbers(char const *str) const
This is a base class for processing XML elements in the DDD.
ReadMapType< std::vector< std::string > > pStrVecMap
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
const std::string getText(size_t tindex=0) const
retrieve the text blob.