本文整理汇总了C++中ImoDocument类的典型用法代码示例。如果您正苦于以下问题:C++ ImoDocument类的具体用法?C++ ImoDocument怎么用?C++ ImoDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImoDocument类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_FIXTURE
TEST_FIXTURE(MxlCompilerTestFixture, MxlCompilerFromString_001)
{
//001 - compile from string
Document doc(m_libraryScope);
MxlCompiler compiler(m_libraryScope, &doc);
string src =
"<score-partwise version='3.0'><part-list>"
"<score-part id='P1'><part-name>Music</part-name></score-part>"
"</part-list><part id='P1'>"
"<measure number='1'>"
"<attributes>"
"<divisions>1</divisions><key><fifths>0</fifths></key>"
"<time><beats>4</beats><beat-type>4</beat-type></time>"
"<clef><sign>G</sign><line>2</line></clef>"
"</attributes>"
"<note><pitch><step>C</step><octave>4</octave></pitch><duration>4</duration><type>whole</type></note>"
"</measure>"
"</part></score-partwise>";
ImoObj* pRoot = compiler.compile_string(src);
CHECK( compiler.get_file_locator() == "string:" );
ImoDocument* pDoc = dynamic_cast<ImoDocument*>(pRoot);
CHECK( pDoc && pDoc->get_version() == "0.0" );
CHECK( pDoc && pDoc->get_num_content_items() == 1 );
ImoScore* pScore = dynamic_cast<ImoScore*>( pDoc->get_content_item(0) );
CHECK( pScore != nullptr );
CHECK( pScore && pScore->get_num_instruments() == 1 );
CHECK( pScore && pScore->get_staffobjs_table() != nullptr );
if (pRoot && !pRoot->is_document()) delete pRoot;
}
示例2: TEST_FIXTURE
TEST_FIXTURE(TableLayouterTestFixture, table_determine_grid_size_2)
{
SpDocument spDoc( new Document(m_libraryScope) );
spDoc->from_string("(lenmusdoc (vers 0.0) "
"(content (table "
"(tableHead "
" (tableRow (tableCell (txt \"Cell 1,1\"))"
" (tableCell (colspan 2)(txt \"Cell 1,2\")) )"
")"
"(tableBody "
" (tableRow (tableCell (txt \"Cell 1,1\"))"
" (tableCell (txt \"Cell 1,2\"))"
" (tableCell (txt \"Cell 1,3\")) )"
" (tableRow (tableCell (txt \"Cell 2,1\"))"
" (tableCell (txt \"Cell 2,2\"))"
" (tableCell (txt \"Cell 2,3\")) )"
")"
")) )");
ImoDocument* pDoc = spDoc->get_im_root();
ImoStyles* pStyles = pDoc->get_styles();
ImoTable* pTable = static_cast<ImoTable*>( pDoc->get_content_item(0) );
GraphicModel model;
MyTableLayouter lyt(pTable, &model, m_libraryScope, pStyles);
lyt.prepare_to_start_layout();
// cout << "head rows=" << lyt.my_get_num_head_rows() << endl;
// cout << "body rows=" << lyt.my_get_num_body_rows() << endl;
// cout << "cols=" << lyt.my_get_num_cols() << endl;
CHECK( lyt.my_get_num_head_rows() == 1 );
CHECK( lyt.my_get_num_body_rows() == 2 );
CHECK( lyt.my_get_num_cols() == 3 );
}
示例3: TEST_FIXTURE
TEST_FIXTURE(LmdCompilerTestFixture, LmdCompilerCreateEmpty)
{
Document doc(m_libraryScope);
LmdCompiler compiler(m_libraryScope, &doc);
InternalModel* pIModel = compiler.create_empty();
ImoDocument* pDoc = dynamic_cast<ImoDocument*>(pIModel->get_root());
CHECK( pDoc->get_version() == "0.0" );
CHECK( pDoc->get_num_content_items() == 0 );
delete pIModel;
}
示例4: build_model
//=======================================================================================
// ModelBuilder implementation
//=======================================================================================
ImoDocument* ModelBuilder::build_model(InternalModel* IModel)
{
ImoDocument* pDoc = static_cast<ImoDocument*>( IModel->get_root() );
if (pDoc)
{
VisitorForStructurizables v(this);
pDoc->accept_visitor(v);
}
return pDoc;
}
示例5: add_cursor
//---------------------------------------------------------------------------------------
ImoObj* Linker::add_cursor(ImoCursorInfo* pCursor)
{
if (m_pParent && m_pParent->is_document())
{
ImoDocument* pDoc = static_cast<ImoDocument*>(m_pParent);
pDoc->add_cursor_info(pCursor);
delete pCursor;
return NULL;
}
return pCursor;
}
示例6: TEST_FIXTURE
TEST_FIXTURE(ImVisitorTestFixture, ParagraphHeadingVisitor)
{
Document doc(m_libraryScope);
doc.from_file(m_scores_path + "09002-ebook-example.lms" );
ImoDocument* pRoot = doc.get_im_root();
MyHPVisitor v(m_libraryScope);
pRoot->accept_visitor(v);
// cout << "max_depth=" << v.max_depth()
// << ", num_in_nodes=" << v.num_in_nodes()
// << ", num_out_nodes=" << v.num_out_nodes() << endl;
CHECK( v.max_depth() == 1 );
CHECK( v.num_in_nodes() == 6 );
CHECK( v.num_out_nodes() == v.num_in_nodes() );
}
示例7: TEST_FIXTURE
TEST_FIXTURE(PresenterTestFixture, PresenterBuilder_NewDocument)
{
PresenterBuilder builder(m_libraryScope);
Presenter* pPresenter = builder.new_document(ViewFactory::k_view_simple);
CHECK( pPresenter != NULL );
Document* pDoc = pPresenter->get_document_raw_ptr();
ImoDocument* pImoDoc = pDoc->get_imodoc();
CHECK( pImoDoc->get_content_item(0) == NULL );
CHECK( pPresenter->get_num_interactors() == 1 );
Interactor* pIntor = pPresenter->get_interactor_raw_ptr(0);
CHECK( pIntor != NULL );
CHECK( pIntor->get_view() != NULL );
SimpleView* pView = dynamic_cast<SimpleView*>( pIntor->get_view() );
CHECK( pView != NULL );
delete pPresenter;
}
示例8: if
//---------------------------------------------------------------------------------------
ImoObj* Linker::add_page_info(ImoPageInfo* pPI)
{
if (m_pParent && m_pParent->is_score())
{
ImoScore* pScore = static_cast<ImoScore*>(m_pParent);
pScore->add_page_info(pPI);
delete pPI;
return NULL;
}
else if (m_pParent && m_pParent->is_document())
{
ImoDocument* pDoc = static_cast<ImoDocument*>(m_pParent);
pDoc->add_page_info(pPI);
delete pPI;
return NULL;
}
return pPI;
}