本文整理汇总了C++中ModelHistory::addModifiedDate方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelHistory::addModifiedDate方法的具体用法?C++ ModelHistory::addModifiedDate怎么用?C++ ModelHistory::addModifiedDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelHistory
的用法示例。
在下文中一共展示了ModelHistory::addModifiedDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModelHistory
END_TEST
START_TEST (test_RDFAnnotation2_modelWithHistoryAndMultipleModifiedDates)
{
ModelHistory * h = new ModelHistory();
ModelCreator *c = new ModelCreator();
c->setFamilyName("Keating");
c->setGivenName("Sarah");
h->addCreator(c);
Date * d = new Date(2005, 2, 2, 14, 56, 11);
h->setCreatedDate(d);
h->addModifiedDate(d);
h->addModifiedDate(d);
m2->unsetModelHistory();
m2->setModelHistory(h);
XMLNode *ann = RDFAnnotationParser::parseModelHistory(m2);
const char * expected =
"<annotation>\n"
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n"
" <rdf:Description rdf:about=\"#_000001\">\n"
" <dc:creator rdf:parseType=\"Resource\">\n"
" <rdf:Bag>\n"
" <rdf:li rdf:parseType=\"Resource\">\n"
" <vCard:N rdf:parseType=\"Resource\">\n"
" <vCard:Family>Keating</vCard:Family>\n"
" <vCard:Given>Sarah</vCard:Given>\n"
" </vCard:N>\n"
" </rdf:li>\n"
" </rdf:Bag>\n"
" </dc:creator>\n"
" <dcterms:created rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:created>\n"
" <dcterms:modified rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:modified>\n"
" <dcterms:modified rdf:parseType=\"Resource\">\n"
" <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n"
" </dcterms:modified>\n"
" </rdf:Description>\n"
" </rdf:RDF>\n"
"</annotation>";
fail_unless( equals(expected, ann->toXMLString().c_str()) );
delete c;
delete d;
delete h;
delete ann;
}
示例2: if
ModelHistory*
RDFAnnotationParser::parseRDFAnnotation(const XMLNode * annotation)
{
const string& name = annotation->getName();
const XMLNode* RDFTop = NULL;
ModelHistory * history = NULL;
ModelCreator* creator = NULL;
Date * modified = NULL;
Date * created = NULL;
unsigned int n = 0;
// need to find the RDF description opening annotation
if (!name.empty())
{
if (name == "annotation" && annotation->getNumChildren() > 0)
{
while (n < annotation->getNumChildren())
{
const string &name1 = annotation->getChild(n).getName();
if (!name1.empty())
{
if (name1 == "RDF")
{
if (annotation->getChild(n).getNumChildren() > 0)
{
RDFTop = &(annotation->getChild(n).getChild(0));
break;
}
}
}
n++;
}
}
}
// find creation nodes and create history
n = 0;
if (RDFTop)
{
history = new ModelHistory();
while (n < RDFTop->getNumChildren())
{
const string &prefix = RDFTop->getChild(n).getPrefix();
if (!prefix.empty())
{
if (prefix == "dc")
{
// this should be the Bag node containing the list of creators
const XMLNode *creatorNode = &(RDFTop->getChild(n).getChild(0));
for (unsigned int c = 0; c < creatorNode->getNumChildren(); c++)
{
creator = new ModelCreator(creatorNode->getChild(c));
history->addCreator(creator);
delete creator;
}
}
else if (prefix == "dcterms")
{
const string &name2 = RDFTop->getChild(n).getName();
if (!name2.empty())
{
if (RDFTop->getChild(n).getNumChildren() > 0
&& RDFTop->getChild(n).getChild(0).getNumChildren() > 0)
{
if (name2 == "created")
{
created = new Date(RDFTop->getChild(n).getChild(0).
getChild(0).getCharacters());
history->setCreatedDate(created);
delete created;
}
else if (name2 == "modified")
{
modified = new Date(RDFTop->getChild(n).getChild(0).
getChild(0).getCharacters());
history->addModifiedDate(modified);
delete modified;
}
}
}
}
}
n++;
}
}
return history;
}
示例3: ModelHistory
ModelHistory*
RDFAnnotationParser::deriveHistoryFromAnnotation(
const XMLNode * annotation)
{
ModelHistory * history = NULL;
if (annotation == NULL)
return history;
// the annotation passed in may have a toplevel annotation tag BUT
// it may not be- so need to check
// if it isnt then it must be RDF or we do not have an rdf annotation
bool topLevelIsAnnotation = false;
if (annotation->getName() == "annotation")
{
topLevelIsAnnotation = true;
}
const XMLNode* RDFDesc = NULL;
if (topLevelIsAnnotation == true)
{
RDFDesc = &(annotation->getChild("RDF").getChild("Description"));
}
else
{
if (annotation->getName() == "RDF")
{
RDFDesc = &(annotation->getChild("Description"));
}
}
ModelCreator* creator = NULL;
Date * modified = NULL;
Date * created = NULL;
static const XMLNode outOfRange;
// find creation nodes and create history
if (RDFDesc != NULL)
{
history = new ModelHistory();
const XMLNode *creatorNode = &(RDFDesc->getChild("creator").getChild("Bag"));
if (creatorNode->equals(outOfRange) == false)
{
for (unsigned int c = 0; c < creatorNode->getNumChildren(); c++)
{
creator = new ModelCreator(creatorNode->getChild(c));
history->addCreator(creator);
delete creator;
}
}
const XMLNode *createdNode = &(RDFDesc->getChild("created").getChild("W3CDTF"));
if (createdNode->equals(outOfRange) == false)
{
if (createdNode->getChild(0).isText() == true)
{
created = new Date(createdNode->getChild(0).getCharacters());
history->setCreatedDate(created);
delete created;
}
}
/* there are possibly more than one modified elements */
for (unsigned int n = 0; n < RDFDesc->getNumChildren(); n++)
{
if (RDFDesc->getChild(n).getName() == "modified")
{
const XMLNode *modifiedNode = &(RDFDesc->getChild(n).getChild("W3CDTF"));
if (modifiedNode->equals(outOfRange) == false)
{
if (modifiedNode->getChild(0).isText() == true)
{
modified = new Date(modifiedNode->getChild(0).getCharacters());
history->addModifiedDate(modified);
delete modified;
}
}
}
}
history->resetModifiedFlags();
}
return history;
}