本文整理汇总了C++中XMLAttributes类的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes类的具体用法?C++ XMLAttributes怎么用?C++ XMLAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: tripleRequired
/** @cond doxygenLibsbmlInternal */
void
LayoutSBMLDocumentPlugin::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes&)
{
// for now don't read the required flag for L2 models
if (getSBMLDocument() != NULL && getSBMLDocument()->getLevel() < 3) return;
unsigned int numErrs = getErrorLog()->getNumErrors();
XMLTriple tripleRequired("required", mURI, getPrefix());
bool assigned = attributes.readInto(tripleRequired, mRequired);
if (assigned == false)
{
if (getErrorLog()->getNumErrors() == numErrs + 1 &&
getErrorLog()->contains(XMLAttributeTypeMismatch))
{
getErrorLog()->remove(XMLAttributeTypeMismatch);
getErrorLog()->logPackageError("layout", LayoutAttributeRequiredMustBeBoolean,
getPackageVersion(), getLevel(), getVersion());
}
else
{
getErrorLog()->logPackageError("layout", LayoutAttributeRequiredMissing,
getPackageVersion(), getLevel(), getVersion());
}
}
else
{
mIsSetRequired = true;
/* LOG ERROR RELATING TO EXPECTED VALUE */
if (mRequired == true)
{
getErrorLog()->logPackageError("layout", LayoutRequiredFalse,
getPackageVersion(), getLevel(), getVersion());
}
}
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:37,代码来源:LayoutSBMLDocumentPlugin.cpp
示例2: getLevel
/*
* Subclasses should override this method to read values from the given
* XMLAttributes set into their specific fields. Be sure to call your
* parents implementation of this method as well.
*/
void
OntologyTerm::readAttributes (const XMLAttributes& attributes)
{
NMBase::readAttributes(attributes);
const unsigned int level = getLevel ();
const unsigned int version = getVersion();
std::vector<std::string> expectedAttributes;
expectedAttributes.clear();
expectedAttributes.push_back("metaid");
expectedAttributes.push_back("id");
expectedAttributes.push_back("term");
expectedAttributes.push_back("sourceTermId");
expectedAttributes.push_back("ontologyURI");
// check that all attributes are expected
for (int i = 0; i < attributes.getLength(); i++)
{
std::vector<std::string>::const_iterator end = expectedAttributes.end();
std::vector<std::string>::const_iterator begin = expectedAttributes.begin();
std::string name = attributes.getName(i);
if (std::find(begin, end, name) == end)
{
logUnknownAttribute(name, level, version, "<ontologyTerm>");
}
}
const string id = "id";
bool assigned = attributes.readInto(id, mId, getErrorLog(), true);
if (assigned && mId.size() == 0)
{
logEmptyString(id, level, version, "<ontologyTerm>");
}
if (!SyntaxChecker::isValidSBMLSId(mId)) logError(NUMLInvalidIdSyntax);
attributes.readInto("term", mTerm);
attributes.readInto("sourceTermId", mSourceTermId);
attributes.readInto("ontologyURI", mOntologyURI);
}
开发者ID:TheCoSMoCompany,项目名称:biopredyn,代码行数:46,代码来源:OntologyTerm.cpp
示例3: startElement
void plotXMLVisitor::startElement (const char * name, const XMLAttributes &atts)
{
current_element = name;
for (int i=0; i<atts.size();i++) {
if (string(atts.getName(i)) == string("axis")) {
if (string(atts.getValue(i)) == string("x")) axis = eX;
else if (string(atts.getValue(i)) == string("y2")) axis = eY2;
else axis = eY;
} else {
cerr << "Unknown attribute " << atts.getName(i) << " encountered." << endl;
exit (-1);
}
if (i == 1) {
cerr << "Too many attributes. Offending attribute (item:" << i << ") is " << atts.getName(i) << endl;
exit (-1);
}
}
if (!first_element_read) {
if (current_element != string("plotset")) {
cerr << endl << " This is not a valid plotset description (" << current_element << ")" << endl;
exit (-1);
} else {
first_element_read = true;
}
}
if (current_element == "page") {
vPages.push_back(Page());
inPage = true;
} else if (current_element == "plot") {
if (!inPage) {
vPlots.push_back(Plots());
} else {
vPages.back().vPlots.push_back(Plots());
}
}
}
开发者ID:8W9aG,项目名称:jsbsim,代码行数:38,代码来源:plotXMLVisitor.cpp
示例4: elementImageStart
//----------------------------------------------------------------------------//
void Imageset_xmlHandler::elementImageStart(const XMLAttributes& attributes)
{
if (!d_imageset)
throw InvalidRequestException("Imageset_xmlHandler::elementImageStart: "
"Attempt to access null object.");
const String name(attributes.getValueAsString(ImageNameAttribute));
Rect rect;
rect.d_left =
static_cast<float>(attributes.getValueAsInteger(ImageXPosAttribute));
rect.d_top =
static_cast<float>(attributes.getValueAsInteger(ImageYPosAttribute));
rect.setWidth(
static_cast<float>(attributes.getValueAsInteger(ImageWidthAttribute)));
rect.setHeight(
static_cast<float>(attributes.getValueAsInteger(ImageHeightAttribute)));
const Point offset(
static_cast<float>(attributes.getValueAsInteger(ImageXOffsetAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYOffsetAttribute, 0)));
d_imageset->defineImage(name, rect, offset);
}
开发者ID:Ocerus,项目名称:Ocerus,代码行数:25,代码来源:CEGUIImageset_xmlHandler.cpp
示例5: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
Dimension::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
unsigned int numErrs;
/* look to see whether an unknown attribute error was logged
* during the read of the listOfDimensions - which will have
* happened immediately prior to this read
*/
if (getErrorLog() != NULL &&
static_cast<ListOfDimensions*>(getParentSBMLObject())->size() < 2)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("arrays", ArraysUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("arrays", ArraysUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
SBase::readAttributes(attributes, expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("arrays", ArraysUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("arrays", ArraysUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
bool assigned = false;
//
// id SId ( use = "optional" )
//
assigned = attributes.readInto("id", mId);
if (assigned == true)
{
// check string is not empty and correct syntax
if (mId.empty() == true)
{
logEmptyString(mId, getLevel(), getVersion(), "<Dimension>");
}
else if (SyntaxChecker::isValidSBMLSId(mId) == false && getErrorLog() != NULL)
{
getErrorLog()->logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute id='" + mId + "' does not conform.");
}
}
//
// name string ( use = "optional" )
//
assigned = attributes.readInto("name", mName);
if (assigned == true)
{
// check string is not empty
//.........这里部分代码省略.........
开发者ID:TheCoSMoCompany,项目名称:biopredyn,代码行数:101,代码来源:Dimension.cpp
示例6: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
FbcModelPlugin::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
unsigned int numErrs;
SBasePlugin::readAttributes(attributes, expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = (int)numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("fbc", FbcUnknown,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("fbc", FbcUnknown,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
}
}
//
// strict bool ( use = "required" )
//
numErrs = getErrorLog()->getNumErrors();
mIsSetStrict = attributes.readInto("strict", mStrict);
if (mIsSetStrict == false && getPackageVersion() > 1)
{
if (getErrorLog() != NULL)
{
if (getErrorLog()->getNumErrors() == numErrs + 1 &&
getErrorLog()->contains(XMLAttributeTypeMismatch))
{
getErrorLog()->remove(XMLAttributeTypeMismatch);
getErrorLog()->logPackageError("fbc", FbcModelStrictMustBeBoolean,
getPackageVersion(), sbmlLevel, sbmlVersion, "", getLine(), getColumn());
}
else
{
std::string message = "Fbc attribute 'strict' is missing from <Model> object.";
getErrorLog()->logPackageError("fbc", FbcModelMustHaveStrict,
getPackageVersion(), sbmlLevel, sbmlVersion, message, getLine(), getColumn());
}
}
}
}
开发者ID:sbmlteam,项目名称:python-libsbml,代码行数:66,代码来源:FbcModelPlugin.cpp
示例7: if
void
TerrainData_xmlHandler::startElement(const String& element, const XMLAttributes& attrs)
{
if (element == "Terrain")
{
mData->mName = attrs.getValueAs<String>("name", Ogre::StringUtil::BLANK);
mData->mXSize = attrs.getValueAs<uint>("xsize");
mData->mZSize = attrs.getValueAs<uint>("zsize");
mData->mTileSize = attrs.getValueAs<uint>("tileSize");
}
else if (element == "scale")
{
mData->mScale = Ogre::Vector3(attrs.getValueAs<Real>("x"),
attrs.getValueAs<Real>("y"),
attrs.getValueAs<Real>("z"));
if (mData->mScale.x <= 0 || mData->mScale.y <= 0 || mData->mScale.z <= 0)
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate scale definition in terrain file",
"TerrainData_xmlHandler::startElement");
}
mData->mPosition = Ogre::Vector3(- mData->mScale.x * mData->mXSize / 2,
0,
- mData->mScale.z * mData->mZSize / 2);
}
else if (element == "size")
{
mData->mScale = Ogre::Vector3(attrs.getValueAs<Real>("x") / mData->mXSize,
attrs.getValueAs<Real>("y"),
attrs.getValueAs<Real>("z") / mData->mZSize);
if (mData->mScale.x <= 0 || mData->mScale.y <= 0 || mData->mScale.z <= 0)
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate size definition in terrain file",
"TerrainData_xmlHandler::startElement");
}
mData->mPosition = Ogre::Vector3(- mData->mScale.x * mData->mXSize / 2,
0,
- mData->mScale.z * mData->mZSize / 2);
}
else if (element == "position")
{
mData->mPosition = Ogre::Vector3(attrs.getValueAs<Real>("x"),
attrs.getValueAs<Real>("y"),
attrs.getValueAs<Real>("z"));
}
else if (element == "centre" || element == "center")
{
mData->mPosition = Ogre::Vector3(attrs.getValueAs<Real>("x") - mData->mScale.x * mData->mXSize / 2,
attrs.getValueAs<Real>("y"),
attrs.getValueAs<Real>("z") - mData->mScale.z * mData->mZSize / 2);
}
else if (element == "heightmap")
{
const String& type = attrs.getValueAs<String>("type", "standard");
const String& filename = attrs.getValue("filename");
if (type != "image" && type != "standard" && type != "raw")
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate height data type",
"TerrainData_xmlHandler::startElement");
}
mData->mHeightmapType = type;
mData->mHeightmapFilename = filename;
if (mData->mHeightmapFilename.empty())
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate height data filename",
"TerrainData_xmlHandler::startElement");
}
}
else if (element == "gridInfo")
{
const String& type = attrs.getValueAs<String>("type", "standard");
const String& filename = attrs.getValue("filename");
if (type != "standard")
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate height info type",
"TerrainData_xmlHandler::startElement");
}
mData->mGridInfoFilename = filename;
if (mData->mGridInfoFilename.empty())
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalidate grid info filename",
"TerrainData_xmlHandler::startElement");
}
}
else if (element == "lightmap")
{
const String& type = attrs.getValueAs<String>("type", "standard");
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:TerrainDataSerializer.cpp
示例8: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
AnalyticVolume::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
unsigned int numErrs;
/* look to see whether an unknown attribute error was logged
* during the read of the listOfAnalyticVolumes - which will have
* happened immediately prior to this read
*/
if (getErrorLog() != NULL &&
static_cast<ListOfAnalyticVolumes*>(getParentSBMLObject())->size() < 2)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
}
}
SBase::readAttributes(attributes, expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
}
}
}
bool assigned = false;
//
// id SId ( use = "required" )
//
assigned = attributes.readInto("id", mId);
if (assigned == true)
{
// check string is not empty and correct syntax
if (mId.empty() == true)
{
logEmptyString(mId, getLevel(), getVersion(), "<AnalyticVolume>");
}
else if (SyntaxChecker::isValidSBMLSId(mId) == false && getErrorLog() != NULL)
{
getErrorLog()->logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute id='" + mId + "' does not conform.", getLine(), getColumn());
}
}
else
{
std::string message = "Spatial attribute 'id' is missing from 'analyticVolume' object.";
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, message, getLine(), getColumn());
}
//
// functionType enum ( use = "required" )
//
//.........这里部分代码省略.........
开发者ID:kirichoi,项目名称:roadrunner,代码行数:101,代码来源:AnalyticVolume.cpp
示例9: handleDefaultCursorElement
//----------------------------------------------------------------------------//
void Config_xmlHandler::handleDefaultCursorElement(const XMLAttributes& attr)
{
d_defaultPointerImage = attr.getValueAsString(ImageAttribute, "");
}
开发者ID:OpenTechEngine-Libraries,项目名称:CEGUI,代码行数:5,代码来源:Config_xmlHandler.cpp
示例10: handleXMLParserElement
//----------------------------------------------------------------------------//
void Config_xmlHandler::handleXMLParserElement(const XMLAttributes& attr)
{
d_xmlParserName = attr.getValueAsString(NameAttribute, "");
}
开发者ID:OpenTechEngine-Libraries,项目名称:CEGUI,代码行数:5,代码来源:Config_xmlHandler.cpp
示例11: if
/*
* Reads the expected attributes into the member data variables
*/
void
CoordinateComponent::readAttributes(const XMLAttributes& attributes,
const ExpectedAttributes&
expectedAttributes)
{
unsigned int level = getLevel();
unsigned int version = getVersion();
unsigned int pkgVersion = getPackageVersion();
unsigned int numErrs;
bool assigned = false;
SBMLErrorLog* log = getErrorLog();
if (static_cast<ListOfCoordinateComponents*>(getParentSBMLObject())->size() <
2)
{
numErrs = log->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownPackageAttribute);
log->logPackageError("spatial",
SpatialGeometryLOCoordinateComponentsAllowedAttributes, pkgVersion,
level, version, details);
}
else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownCoreAttribute);
log->logPackageError("spatial",
SpatialGeometryLOCoordinateComponentsAllowedCoreAttributes, pkgVersion,
level, version, details);
}
}
}
SBase::readAttributes(attributes, expectedAttributes);
numErrs = log->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownPackageAttribute);
log->logPackageError("spatial",
SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version,
details);
}
else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownCoreAttribute);
log->logPackageError("spatial",
SpatialCoordinateComponentAllowedCoreAttributes, pkgVersion, level,
version, details);
}
}
//
// id SId (use = "required" )
//
assigned = attributes.readInto("id", mId);
if (assigned == true)
{
if (mId.empty() == true)
{
logEmptyString(mId, level, version, "<CoordinateComponent>");
}
else if (SyntaxChecker::isValidSBMLSId(mId) == false)
{
logError(SpatialIdSyntaxRule, level, version, "The id '" + mId + "' does "
"not conform to the syntax.");
}
}
else
{
std::string message = "Spatial attribute 'id' is missing from the "
"<CoordinateComponent> element.";
log->logPackageError("spatial",
SpatialCoordinateComponentAllowedAttributes, pkgVersion, level, version,
message);
}
//
// type enum (use = "required" )
//
std::string type;
assigned = attributes.readInto("type", type);
if (assigned == true)
{
if (type.empty() == true)
//.........这里部分代码省略.........
开发者ID:hovo1990,项目名称:deviser,代码行数:101,代码来源:CoordinateComponent.cpp
示例12: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
Objective::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
// look to see whether an unknown attribute error was logged
// during the read of the listOfFluxBounds - which will have
// happened immediately prior to this read
if (getErrorLog() != NULL &&
static_cast<ListOfObjectives*>(getParentSBMLObject())->size() < 2)
{
unsigned int numErrs = getErrorLog()->getNumErrors();
for (int n = (int)numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("fbc", FbcLOObjectivesAllowedAttributes,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("fbc", FbcLOObjectivesAllowedAttributes,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
SBase::readAttributes(attributes,expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
unsigned int numErrs = getErrorLog()->getNumErrors();
for (int n = (int)numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("fbc", FbcObjectiveRequiredAttributes,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError((unsigned int)n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("fbc", FbcObjectiveAllowedL3Attributes,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
//
// Reads an attribute "id" (optional)
//
bool assigned = attributes.readInto("id", mId);
if (assigned)
{
// "id" attribute is set to this fbc element
if (mId.empty())
{
//
// Logs an error if the "id" attribute is empty.
//
logEmptyString(mId, sbmlLevel, sbmlVersion, "<fbc>");
}
else if (!SyntaxChecker::isValidSBMLSId(mId))
{
//
// Logs an error if the "id" attribute doesn't
// conform to the SBML type SId.
//
getErrorLog()->logPackageError("fbc", FbcSBMLSIdSyntax,
getPackageVersion(), sbmlLevel, sbmlVersion);
}
}
else
{
std::string message = "Fbc attribute 'id' is missing.";
getErrorLog()->logPackageError("fbc", FbcObjectiveRequiredAttributes,
getPackageVersion(), sbmlLevel, sbmlVersion, message);
}
attributes.readInto("name", mName);
//.........这里部分代码省略.........
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:101,代码来源:Objective.cpp
示例13: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
InteriorPoint::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
unsigned int numErrs;
/* look to see whether an unknown attribute error was logged
* during the read of the listOfInteriorPoints - which will have
* happened immediately prior to this read
*/
if (getErrorLog() != NULL &&
static_cast<ListOfInteriorPoints*>(getParentSBMLObject())->size() < 2)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
SBase::readAttributes(attributes, expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
bool assigned = false;
//
// coord1 double ( use = "required" )
//
numErrs = getErrorLog()->getNumErrors();
mIsSetCoord1 = attributes.readInto("coord1", mCoord1);
if (mIsSetCoord1 == false)
{
if (getErrorLog() != NULL)
{
if (getErrorLog()->getNumErrors() == numErrs + 1 &&
getErrorLog()->contains(XMLAttributeTypeMismatch))
{
getErrorLog()->remove(XMLAttributeTypeMismatch);
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion);
}
else
{
std::string message = "Spatial attribute 'coord1' is missing.";
getErrorLog()->logPackageError("spatial", SpatialUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, message);
}
}
}
//
// coord2 double ( use = "optional" )
//
//.........这里部分代码省略.........
开发者ID:kirichoi,项目名称:roadrunner,代码行数:101,代码来源:InteriorPoint.cpp
示例14: if
/*
* Subclasses should override this method to read values from the given
* XMLAttributes set into their specific fields. Be sure to call your
* parents implementation of this method as well.
*/
void
Rule::readL1Attributes (const XMLAttributes& attributes)
{
const unsigned int level = getLevel ();
const unsigned int version = getVersion();
//
// formula: string { use="required" } (L1v1, L1v2)
//
attributes.readInto("formula", mFormula, getErrorLog(), true, getLine(), getColumn());
//
// type { use="optional" default="scalar" } (L1v1, L1v2)
//
// This attribute is handled by ListOfRules::createObject();
//
if ( isSpeciesConcentration() )
{
//
// specie : SName { use="required" } (L1v1)
// species: SName { use="required" } (L1v2)
//
const string s = (level == 1 && version == 1) ? "specie" : "species";
bool assigned = attributes.readInto(s, mVariable, getErrorLog(), true, getLine(), getColumn());
if (assigned && mVariable.size() == 0)
{
logEmptyString(s, level, version, "<rule>");
}
if (!SyntaxChecker::isValidInternalSId(mVariable))
logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute " + s + "='" + mVariable + "' does not conform.");
}
else if ( isCompartmentVolume() )
{
//
// compartment: SName { use="required" } (L1v1, L1v2)
//
bool assigned = attributes.readInto("compartment", mVariable, getErrorLog(), true, getLine(), getColumn());
if (assigned && mVariable.size() == 0)
{
logEmptyString("compartment", level, version, "<rule>");
}
if (!SyntaxChecker::isValidInternalSId(mVariable))
logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute compartment='" + mVariable + "' does not conform.");
}
else if ( isParameter() )
{
//
// name: SName { use="required" } (L1v1, L1v2)
//
bool assigned = attributes.readInto("name", mVariable, getErrorLog(), true, getLine(), getColumn());
if (assigned && mVariable.size() == 0)
{
logEmptyString("name", level, version, "<rule>");
}
if (!SyntaxChecker::isValidInternalSId(mVariable))
logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute name='" + mVariable + "' does not conform.");
//
// units { use="optional" } (L1v1, L1v2);
//
attributes.readInto("units", mUnits, getErrorLog(), false, getLine(), getColumn());
}
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:73,代码来源:Rule.cpp
示例15: processScheme
void UserSettingsParser::processScheme(SchemeLoaderState* pState, const XMLAttributes& atts)
{
LPCTSTR pName = atts.getValue(_T("name"));
if(pName && ((int)_tcslen(pName) > 0))
{
if(!m_loadingPreset)
{
CT2CA schemeName(pName);
m_pCurScheme = new SchemeDetails(schemeName);
}
else
{
CT2CA schemeName(pName);
SchemeDetailsMap::iterator iScheme = pState->m_SchemeDetails.find(std::string(schemeName));
if(iScheme != pState->m_SchemeDetails.end())
{
m_pCurScheme = (*iScheme).second;
}
else
{
m_pCurScheme = NULL;
}
}
if(m_pCurScheme == NULL)
return;
//pScheme = new CustomisedScheme;
m_SchemeName = pName;
pState->m_State = US_SCHEME;
LPCTSTR temp = atts.getValue(_T("ovtabs"));
if(temp != NULL && _tcslen(temp) > 0)
{
m_pCurScheme->CustomFlagFlags |= schOverrideTabs;
if(SZTRUE(temp))
// Signal that we definitely want to override the tab use.
m_pCurScheme->CustomFlags |= schOverrideTabs;
temp = atts.getValue(_T("usetabs"));
if(temp != NULL && _tcslen(temp) > 0)
{
m_pCurScheme->CustomFlagFlags |= schUseTabs;
if(SZTRUE(temp))
m_pCurScheme->CustomFlags |= schUseTabs;
}
}
temp = atts.getValue(_T("tabwidth"));
if(temp != NULL && _tcslen(temp) > 0)
{
m_pCurScheme->CustomFlagFlags |= schOverrideTabSize;
m_pCurScheme->CustomFlags |= schOverrideTabSize;
m_pCurScheme->CustomTabWidth = _ttoi(temp);
}
}
#ifdef _DEBUG
else
{
LOG(_T("UserSettingsParser::processScheme(): Scheme section without name attribute.\n"));
}
#endif
}
开发者ID:ALPHAMARIOX,项目名称:pn,代码行数:67,代码来源:StylesUserSettings.cpp
示例16: if
/*
* Read values from the given XMLAttributes set into their specific fields.
*/
void
SpeciesFeatureValue::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
unsigned int numErrs;
/* look to see whether an unknown attribute error was logged
* during the read of the listOfSpeciesFeatureValues - which will have
* happened immediately prior to this read
*/
if (getErrorLog() != NULL &&
static_cast<ListOfSpeciesFeatureValues*>(getParentSBMLObject())->size() < 2)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("multi", MultiUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("multi", MultiUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
SBase::readAttributes(attributes, expectedAttributes);
// look to see whether an unknown attribute error was logged
if (getErrorLog() != NULL)
{
numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownPackageAttribute);
getErrorLog()->logPackageError("multi", MultiUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details =
getErrorLog()->getError(n)->getMessage();
getErrorLog()->remove(UnknownCoreAttribute);
getErrorLog()->logPackageError("multi", MultiUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, details);
}
}
}
bool assigned = false;
//
// value SIdRef ( use = "required" )
//
assigned = attributes.readInto("value", mValue);
if (assigned == true)
{
// check string is not empty and correct syntax
if (mValue.empty() == true)
{
logEmptyString(mValue, getLevel(), getVersion(), "<SpeciesFeatureValue>");
}
else if (SyntaxChecker::isValidSBMLSId(mValue) == false && getErrorLog() != NULL)
{
getErrorLog()->logError(InvalidIdSyntax, getLevel(), getVersion(),
"The syntax of the attribute value='" + mValue + "' does not conform.");
}
}
else
{
std::string message = "Multi attribute 'value' is missing.";
getErrorLog()->logPackageError("multi", MultiUnknownError,
getPackageVersion(), sbmlLevel, sbmlVersion, message);
}
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:98,代码来源:SpeciesFeatureValue.cpp
示例17: if
/** @cond doxygenLibsbmlInternal */
void
Port::readAttributes (const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
const unsigned int sbmlLevel = getLevel ();
const unsigned int sbmlVersion = getVersion();
// look to see whether an unknown attribute error was logged
// during the read of the ListOfPorts - which will have
// happened immediately prior to this read
if (getErrorLog() != NULL &&
static_cast<ListOfPorts*>(getParentSBMLObject())->size() < 2)
{
unsigned int numErrs = getErrorLog()->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details =
|
请发表评论