本文整理汇总了C++中MeiDocument::getRootElement方法的典型用法代码示例。如果您正苦于以下问题:C++ MeiDocument::getRootElement方法的具体用法?C++ MeiDocument::getRootElement怎么用?C++ MeiDocument::getRootElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeiDocument
的用法示例。
在下文中一共展示了MeiDocument::getRootElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeiDocument
TEST(TestMeiDocument, RootElement) {
MeiDocument *doc = new MeiDocument();
Mei *m = new Mei();
doc->setRootElement(m);
ASSERT_EQ(m, doc->getRootElement());
}
示例2: MeiElement
TEST(TestMeiElement, TestSetDocument) {
MeiElement *m = new MeiElement("mei");
MeiDocument *doc = new MeiDocument();
ASSERT_THROW(m->setDocument(doc), mei::DocumentRootNotSetException);
doc->setRootElement(m);
ASSERT_EQ(doc->getRootElement(), m);
}
示例3: ImportFile
bool MusMeiInput::ImportFile( )
{
string encoding = "utf-8";
string fname = m_filename.mb_str();
MeiDocument *doc = MeiDocument::ReadFromXml(fname, encoding);
m_doc->SetMeiDocument(doc);
// When importing MEI, the first step is to load one single page and to load everything in one system
MusPage *page = new MusPage();
page->defin = 20;
//m_doc->m_pages.Add( page ); // ax2
// To simplify accessibility, we keep a pointer on that pages
//m_page = & m_doc->m_pages[0]; // ax2
MeiElement *root_element = doc->getRootElement();
if (!ReadElement(root_element)) {
wxLogError(_("An error occurred while importing '%s'"), m_doc->m_fname.c_str() );
}
m_doc->CheckIntegrity();
// adjust the page size - this is very temporary, we need something better
// we also have to see what to do if we have a scoredef
// for now, it just adjust the page size for the content (GetMaxXY)
wxArrayPtrVoid params; // tableau de pointeurs pour parametres
MusStaffFunctor getMaxXY( &MusLaidOutStaff::GetMaxXY );
wxArrayPtrVoid staffParams; // idem for staff functor
int max_x = -1;
int max_y = 0;
staffParams.Add( &max_x );
staffParams.Add( &max_y );
m_page->Process( &getMaxXY, staffParams );
// change the staff width
// m_page->lrg_lign = max_x / 10; // ax2
// add the space at the bottom - so far in max_y we have the top corner of the last staff
/*
if (m_page->m_staves.GetCount() > 0 ) {
max_y += max((unsigned short)(&m_page->m_staves.Last())->portNbLine,(&m_page->m_staves.Last())->ecart);
}
*/ // ax2
max_y *= m_page->defin; // transform this into coord.
// update the page size
m_doc->m_parameters.pageFormatHor = max_x / 10 + (2 * m_doc->m_parameters.MargeGAUCHEIMPAIRE);
m_doc->m_parameters.pageFormatVer = max_y / 10 + (2 * m_doc->m_parameters.MargeSOMMET);
return true;
}
示例4: MeiDocument
TEST(TestMeiElement, TestRemoveManyChildren) {
MeiDocument *doc = new MeiDocument();
MeiElement *mei = new MeiElement("mei");
MeiElement *sd1 = new MeiElement("staffDef");
MeiElement *sd2 = new MeiElement("staffDef");
MeiElement *sd3 = new MeiElement("staffDef");
MeiElement *sd4 = new MeiElement("staffDef");
MeiElement *sd5 = new MeiElement("staffDef");
MeiElement *sd6 = new MeiElement("staffDef");
doc->setRootElement(mei);
MeiElement *music = new mei::MeiElement("music");
MeiElement *scoreDef = new mei::MeiElement("scoreDef");
mei->addChild(music);
music->addChild(scoreDef);
scoreDef->addChild(sd1);
scoreDef->addChild(sd2);
scoreDef->addChild(sd3);
scoreDef->addChild(sd4);
scoreDef->addChild(sd5);
scoreDef->addChild(sd6);
sd1->addAttribute("n", "1");
sd2->addAttribute("n", "2");
sd3->addAttribute("n", "3");
sd4->addAttribute("n", "4");
sd5->addAttribute("n", "5");
sd6->addAttribute("n", "6");
vector<MeiElement*> scoreDefs = doc->getRootElement()->getDescendantsByName("scoreDef");
vector<MeiElement*> staffDefs = doc->getRootElement()->getDescendantsByName("staffDef");
for (vector<MeiElement*>::iterator iter = staffDefs.begin(); iter != staffDefs.end(); ++iter) {
if ((*iter)->getAttribute("n")->getValue() == "3" || (*iter)->getAttribute("n")->getValue() == "6") {
(*iter)->getParent()->removeChild((*iter));
}
}
ASSERT_EQ(4, music->getDescendantsByName("staffDef").size());
}