本文整理汇总了C++中MeiDocument类的典型用法代码示例。如果您正苦于以下问题:C++ MeiDocument类的具体用法?C++ MeiDocument怎么用?C++ MeiDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MeiDocument类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(TestMeiElement, TestPrintElement) {
MeiElement *m = new MeiElement("mei");
MeiElement *music = new MeiElement("music");
MeiElement *body = new MeiElement("body");
MeiElement *staff = new MeiElement("staff");
Note *note = new Note();
Note *note2 = new Note();
MeiDocument *doc = new MeiDocument();
doc->setRootElement(m);
m->addChild(music);
music->addChild(body);
body->addChild(staff);
staff->addChild(note);
staff->addChild(note2);
note->m_NoteVis.setHeadshape("diamond");
note->m_Pitch.setPname("c");
note2->m_Pitch.setPname("d");
m->printElement();
/*
The printElement method does not return anything, so the value of it can't really be tested.
This test simply ensures that it is capable of being called without failing.
So we just assert that everything's OK here if we haven't segfaulted by now.
*/
ASSERT_TRUE(true);
}
示例2: TEST
TEST(TestMeiDocument, RootElement) {
MeiDocument *doc = new MeiDocument();
Mei *m = new Mei();
doc->setRootElement(m);
ASSERT_EQ(m, doc->getRootElement());
}
示例3: TEST
TEST(TestMeiDocument, SetsCorrectMeiVersion) {
MeiDocument *doc = new MeiDocument();
ASSERT_EQ(*--MEI_VERSION.end(), doc->getVersion());
MeiDocument *doc2 = new MeiDocument("2012");
ASSERT_EQ("2012", doc2->getVersion());
}
示例4: TEST
TEST(CmnModuleTest, TestTieMembership) {
MeiDocument* doc = createMeiDocument();
MeiElement* layer = doc->getElementById("id-layer");
MeiElement* measure = doc->getElementById("id-measure");
Note* n1 = new Note();
Note* n2 = new Note();
Note* n3 = new Note();
Note* n4 = new Note();
layer->addChild(n1);
layer->addChild(n2);
layer->addChild(n3);
layer->addChild(n4);
Tie* t1 = new Tie();
measure->addChild(t1);
t1->m_Startid.setStartid(n1->getId());
t1->m_Startendid.setEndid(n4->getId());
t1->m_Staffident.setStaff("staffname");
vector<MeiElement*> members = t1->getMembers();
ASSERT_EQ(4, members.size());
}
示例5: xmlHasProp
void XmlImportImpl::init() {
// get mei version from document
xmlAttrPtr meiversAttr = xmlHasProp(this->rootXmlNode, (const xmlChar*)"meiversion");
string meiVersion = string((const char*)meiversAttr->children->content);
MeiDocument *doc = new MeiDocument(meiVersion);
this->meiDocument = doc;
this->rootMeiElement = this->xmlNodeToMeiElement(this->rootXmlNode);
doc->setRootElement(this->rootMeiElement);
}
示例6: wxLogError
bool MusMeiOutput::ExportFile( )
{
if ( m_doc->GetMeiDocument() == NULL) {
wxLogError("Unable to export a new document to MEI. Please import first");
return false;
}
MeiDocument *doc = m_doc->GetMeiDocument();
string fname = m_filename.mb_str();
doc->setDocName(fname);
doc->WriteToXml(doc);
return true;
}
示例7: 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;
}