当前位置: 首页>>代码示例>>C++>>正文


C++ MeiDocument类代码示例

本文整理汇总了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);
}
开发者ID:annplaksin,项目名称:libmei,代码行数:31,代码来源:test_meielement.cpp

示例2: TEST

TEST(TestMeiDocument, RootElement) {
    MeiDocument *doc = new MeiDocument();
    Mei *m = new Mei();
    doc->setRootElement(m);

    ASSERT_EQ(m, doc->getRootElement());
}
开发者ID:Breakend,项目名称:libmei,代码行数:7,代码来源:test_meidocument.cpp

示例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());
}
开发者ID:annplaksin,项目名称:libmei,代码行数:7,代码来源:test_meidocument.cpp

示例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());
}
开发者ID:Breakend,项目名称:libmei,代码行数:26,代码来源:test_cmn.cpp

示例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);
}
开发者ID:Breakend,项目名称:libmei,代码行数:11,代码来源:xmlimport.cpp

示例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;
}
开发者ID:DDMAL,项目名称:aruspix,代码行数:12,代码来源:musiomei2.cpp

示例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;
}
开发者ID:DDMAL,项目名称:aruspix,代码行数:48,代码来源:musiomei2.cpp


注:本文中的MeiDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。