本文整理汇总了C++中Section::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::addChild方法的具体用法?C++ Section::addChild怎么用?C++ Section::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::addChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sectionBegin
void Profiler::sectionBegin(const string &name ){
Section *childSection= currSection->getChild(name);
if(childSection==NULL){
childSection= new Section(name);
currSection->addChild(childSection);
childSection->setParent(currSection);
}
currSection= childSection;
childSection->start();
}
示例2: xml_file_name
void CScribeToNeoScribeXML::SegmentScribe2MEIXML(const CScribeReaderVisitable& scribe_data)
{
std::unordered_set<std::string> rep_no_record;
for (std::vector<scribe_part>::const_iterator part = scribe_data.GetScribeParts().begin(); part != scribe_data.GetScribeParts().end(); part++)
{
int i = 0;
//save record of first part
scribe_part first_part = *part;
//create an instance of XML doc representation, etc.
delete doc;
doc = new MeiDocument();
Mei *mei = new Mei;
doc->setRootElement(mei);
/*
MEI
- <meiHead>
- FileDescription
- EncodingDescription
- Work Description
- Revision Description
*/
//create MEIhead to contain file, encoding, work and revision description
MeiHead* mei_head = new MeiHead;
mei->addChild(mei_head);
AltId* altId = new AltId;
mei_head->addChild(altId);
if (scribe_data.GetType()==scribe_type::trecento)
{
altId->addAttribute("type", "repnum");
altId->setValue(part->rep_num);
} else if (scribe_data.GetType()==scribe_type::trecento)
{
altId->addAttribute("type", "cao");
altId->setValue(std::to_string(part->cao_num));
}
//Create and link fileDesc
FileDesc* fileDesc = Scribe2MEIFileDesc();
mei_head->addChild(fileDesc);
//Create and link encodingDesc
EncodingDesc* encodingDesc = Scribe2MEIEncoderDesc();
mei_head->addChild(encodingDesc);
//Create and link workDesc
WorkDesc* workDesc = Scribe2MEIWorkDesc();
mei_head->addChild(workDesc);
//</meiHead> - not really at this stage - other elements completed in main routine
//music - contains all music data
Music* music = new Music;
mei->addChild(music);
Mdiv* mdiv = new Mdiv; //for chant source this needs to be specified repeatedly, with n and type attributes
music->addChild(mdiv);
Score* score = new Score;
mdiv->addChild(score);
//start adding score definitions - child of score
ScoreDef* scoredef = new ScoreDef;
score->addChild(scoredef);
StaffGrp* staffgrp = new StaffGrp;
scoredef->addChild(staffgrp);
staffgrp->setId("all");
//skip along and collect parts - all have the same REPNUM
std::string xml_file_name("");
if (scribe_data.GetType()==scribe_type::trecento)
{
do
{
++i;
if (i==1)
{
Scribe2MEIXMLFileData(fileDesc, *part);
Scribe2MEIXMLWorkData(workDesc, *part);
}
//add section - child of score
Section* section = new Section;
score->addChild(section);
//handle staff and link to section
Staff* staff = Scribe2MEIXMLStaff(scribe_data, *part, staffgrp, i);
section->addChild(staff); //or TiXmlElement* layer;?
part++;
} while ( part->rep_num==first_part.rep_num && part != scribe_data.GetScribeParts().end());
part--; // step back to last part in piece
xml_file_name = first_part.rep_num;
//.........这里部分代码省略.........
示例3: Section
MeiDocument* CScribeToNeoScribeXML::Scribe2MEIXML(const CScribeReaderVisitable& scribe_data)
{
Mei* mei = new Mei;
doc->setRootElement(mei);
//create MEIhead to contain file, encoding, work and revision description
MeiHead* mei_head = new MeiHead; //"meiHead"
mei->addChild(mei_head);
//Create and link fileDesc
FileDesc* fileDesc = Scribe2MEIFileDesc();
mei_head->addChild(fileDesc);
//Create and link encodingDesc
EncodingDesc* encodingDesc = Scribe2MEIEncoderDesc();
mei_head->addChild(encodingDesc);
//Create and link workDesc
WorkDesc* workDesc = Scribe2MEIWorkDesc();
mei_head->addChild(workDesc);
//</meiHead> - not really at this stage - other elements completed in main routine
//music - contains all music data
Music* music = new Music;
mei->addChild(music);
Mdiv* mdiv = new Mdiv; //for chant source this needs to be specified repeatedly, with n and type attributes
music->addChild(mdiv);
Score* score = new Score;
mdiv->addChild(score);
//start adding score definitions - child of score
ScoreDef* scoredef = new ScoreDef;
score->addChild(scoredef);
StaffGrp* staffgrp = new StaffGrp;
scoredef->addChild(staffgrp);
staffgrp->setId("all");
int i=0;
for (std::vector<scribe_part>::const_iterator partit = scribe_data.GetScribeParts().begin(); partit!=scribe_data.GetScribeParts().end(); partit++)
{
++i;
if (i==1)
{
Scribe2MEIXMLFileData(fileDesc, *partit);
Scribe2MEIXMLWorkData(workDesc, *partit);
}
//add section - child of score
Section* section = new Section();
score->addChild(section);
//handle staff and link to section
Staff* staff = Scribe2MEIXMLStaff(scribe_data, *partit, staffgrp, i);
section->addChild(staff);
}
return doc;
}