本文整理汇总了C++中MeiElement::removeChild方法的典型用法代码示例。如果您正苦于以下问题:C++ MeiElement::removeChild方法的具体用法?C++ MeiElement::removeChild怎么用?C++ MeiElement::removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeiElement
的用法示例。
在下文中一共展示了MeiElement::removeChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeiElement
TEST(TestMeiElement, TestRemoveChild) {
MeiElement *p = new MeiElement("note");
MeiElement *c1 = new Accid();
p->addChild(c1);
ASSERT_TRUE(p->hasChildren("accid"));
ASSERT_EQ(1, p->getChildren().size());
p->removeChild(c1);
ASSERT_FALSE(p->hasChildren("accid"));
ASSERT_EQ(0, p->getChildren().size());
}
示例2: staffnum
//.........这里部分代码省略.........
//handle events for each row
code_t event_type = scribe_data.GetCodes()->get_code_type(eventit->code);//codes->get_code_type(eventit->code);
//foster parent will change roles according to child elements that need to be added
MeiElement* foster = syllable;
switch (event_type)
{
case code_t::ineume:
{
#ifdef IGNOREGAPS
Ineume* ineume = new Ineume;
//ineume->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(ineume);
foster = ineume;
#else //this needs work, hence excluded
if (!eventit->preceding_gap || foster->getChildren().empty())
{
Ineume* ineume = new Ineume;
//ineume->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(ineume);
foster = ineume;
}
else
{
MeiElement* lastNeume = foster->getChildren().back();
if (lastNeume->getName() == "ineume")
{
Ineume* newNeume = new Ineume(*dynamic_cast<Ineume*>(lastNeume));
/*for (std::vector<MeiElement*>::const_iterator child = lastNeume->getChildren().begin(); child!=lastNeume->getChildren().end(); child++ ) {
MeiElement* clone = new MeiElement(**child);
newNeume->addChild(clone);
}*/
foster->removeChild(lastNeume);
foster->addChild(newNeume);
//delete lastNeume;
foster = newNeume;
}
else
foster = lastNeume;
}
#endif
goto do_note;
break;
}
case code_t::uneume:
{
Uneume* uneume = new Uneume;
uneume->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(uneume);
foster = uneume;
goto do_note;
break;
}
case code_t::ligature:
{
Ligature* ligature = new Ligature; //mensural.h
ligature->addAttribute("name", scribe_data.GetCodes()->code_to_name(eventit->code));
foster->addChild(ligature);
foster = ligature;
if (current_color!=coloration_type::full_black)
{
switch (current_color) {
case full_red:
ligature->addAttribute("color", "red");
break;