本文整理汇总了C++中XMLToken::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLToken::getAttributes方法的具体用法?C++ XMLToken::getAttributes怎么用?C++ XMLToken::getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLToken
的用法示例。
在下文中一共展示了XMLToken::getAttributes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Sets the type of an ASTNode based on the given MathML <cn> element.
* Errors will be logged in the stream's SBMLErrorLog object.
*/
static void
setTypeCN (ASTNode& node, const XMLToken& element, XMLInputStream& stream)
{
string type = "real";
element.getAttributes().readInto("type", type);
// here is the only place we might encounter the sbml:units attribute
string units = "";
element.getAttributes().readInto("units", units);
if (type == "real")
{
double value = 0;
istringstream isreal;
isreal.str( stream.next().getCharacters() );
isreal >> value;
node.setValue(value);
if (isreal.fail()
|| node.isInfinity()
|| node.isNegInfinity()
)
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(FailedMathMLReadOfDouble,
stream.getSBMLNamespaces()->getLevel(),
stream.getSBMLNamespaces()->getVersion());
}
}
示例2: if
/**
* Sets the type of an ASTNode based on the given MathML <ci> element.
* Errors will be logged in the stream's SBMLErrorLog object.
*/
static void
setTypeCI (ASTNode& node, const XMLToken& element, XMLInputStream& stream)
{
if (element.getName() == "csymbol")
{
string url;
element.getAttributes().readInto("definitionURL", url);
if ( url == URL_DELAY ) node.setType(AST_FUNCTION_DELAY);
else if ( url == URL_TIME ) node.setType(AST_NAME_TIME);
else if ( url == URL_AVOGADRO ) node.setType(AST_NAME_AVOGADRO);
else
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(BadCsymbolDefinitionURLValue,
stream.getSBMLNamespaces()->getLevel(),
stream.getSBMLNamespaces()->getVersion());
}
}
else if (element.getName() == "ci")
{
node.setDefinitionURL(element.getAttributes());
}
const string name = trim( stream.next().getCharacters() );
node.setName( name.c_str() );
}
示例3: addExpectedAttributes
bool
ASTCnBase::read(XMLInputStream& stream, const std::string& )
{
bool read = false;
const XMLToken element = stream.next ();
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
read = readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
string prefix;
if (isSetUnits() == true)
{
prefix = element.getAttrPrefix(
element.getAttrIndex("units", stream.getSBMLNamespaces()->getURI()));
setUnitsPrefix(prefix);
}
//return ASTBase::read(stream, reqd_prefix);
return read;
}
示例4: determineNumChildren
bool
ArraysASTPlugin::readMatrixRow(XMLInputStream& stream, const std::string& reqd_prefix,
const XMLToken& currentElement)
{
bool read = false;
stream.skipText();
const XMLToken nextElement = stream.peek();
const string& nextName = nextElement.getName();
unsigned int numChildren = determineNumChildren(stream, "matrixrow");
mVector = new ASTArraysVectorFunctionNode(AST_LINEAR_ALGEBRA_MATRIXROW_CONSTRUCTOR);
mVector->setExpectedNumChildren(numChildren);
// read attributes on this element here since we have already consumed
// the element
ExpectedAttributes expectedAttributes;
mVector->addExpectedAttributes(expectedAttributes, stream);
read = mVector->ASTBase::readAttributes(currentElement.getAttributes(),
expectedAttributes, stream, currentElement);
if (read == false)
{
mVector = NULL;
}
else
{
read = mVector->read(stream, reqd_prefix);
}
return read;
}
示例5: addExpectedAttributes
bool
ASTCiNumberNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.next ();
const string& nameE = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (nameE != "ci")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
read = readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
const string name = trim( stream.next().getCharacters() );
setName((name));
ASTBase::setType(AST_NAME);
if (read == true)
stream.skipPastEnd(element);
return read;
}
示例6: readAttributes
bool
ASTBase::read(XMLInputStream& stream, const std::string& )
{
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
const XMLToken element = stream.next ();
return readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
}
示例7: setReal
bool
ASTCnRealNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type = "real";
element.getAttributes().readInto("type", type);
if (type == "real")
{
double value = 0;
istringstream isreal;
isreal.str( stream.next().getCharacters() );
isreal >> value;
setReal(value);
ASTBase::setType(AST_REAL);
if (isreal.fail()
|| (util_isInf(getValue()) > 0)
|| (util_isInf(getValue()) < 0)
)
{
logError(stream, element, FailedMathMLReadOfDouble);
}
read = true;
}
示例8: mTriple
/*
* Copy constructor; creates a copy of this XMLToken.
*/
XMLToken::XMLToken(const XMLToken& orig)
: mTriple()
, mAttributes()
, mNamespaces()
, mChars (orig.mChars)
, mIsStart (orig.mIsStart)
, mIsEnd (orig.mIsEnd)
, mIsText (orig.mIsText)
, mLine (orig.mLine)
, mColumn (orig.mColumn)
{
if (!orig.mTriple.isEmpty())
mTriple = XMLTriple(orig.getName(), orig.getURI(), orig.getPrefix());
if (!orig.mAttributes.isEmpty())
mAttributes = XMLAttributes(orig.getAttributes());
if (!orig.mNamespaces.isEmpty())
mNamespaces = XMLNamespaces(orig.getNamespaces());
}
示例9: if
bool
ASTCnIntegerNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
cout << "HELP\n";
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type;
element.getAttributes().readInto("type", type);
if (type == "integer")
{
int value = 0;
istringstream isint;
isint.str( stream.next().getCharacters() );
isint >> value;
if (isint.fail())
{
logError(stream, element, FailedMathMLReadOfInteger);
}
else if ( sizeof(int) > 4 && ( (value > SBML_INT_MAX) || (value < SBML_INT_MIN) ) )
{
logError(stream, element, FailedMathMLReadOfInteger);
}
setInteger(value);
ASTBase::setType(AST_INTEGER);
read = true;
}
示例10:
bool
ASTCnExponentialNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type;
element.getAttributes().readInto("type", type);
if (type == "e-notation")
{
double mantissa = 0;
long exponent = 0;
istringstream ismantissa;
istringstream isexponent;
ismantissa.str( stream.next().getCharacters() );
ismantissa >> mantissa;
if (stream.peek().getName() == "sep")
{
stream.next();
isexponent.str( stream.next().getCharacters() );
isexponent >> exponent;
}