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


C++ ItemList::addChild方法代码示例

本文整理汇总了C++中ItemList::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::addChild方法的具体用法?C++ ItemList::addChild怎么用?C++ ItemList::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemList的用法示例。


在下文中一共展示了ItemList::addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PersName

void    CScribeToNeoScribeXML::Scribe2MEIXMLFileData(FileDesc* fileDesc, const scribe_part& partit )
{
    //title element and dependencies - part of fileDesc area of mei header
    //at this point of time, title and creator elements reside in the header and must be filled in the part iteration.
    //titleStmt
    TitleStmt* titleSmt = new TitleStmt;
    fileDesc->addChild(titleSmt);
    Title* title = new Title; //will fill below in clunky fashion
    title->setValue(partit.title);
    titleSmt->addChild(title);
    RespStmt* respStmt = new RespStmt;
    titleSmt->addChild(respStmt);
    
    PersName* creator = new PersName;
    creator->addAttribute("role", "creator");
    creator->setValue(partit.composer);
    respStmt->addChild(creator);
    
    PersName* encoder_pers = new PersName();
    encoder_pers->addAttribute("role", "encoder");
    encoder_pers->setValue(encoder);
    respStmt->addChild(encoder_pers);

    
    //fileDesc - <sourceDesc> - part of fileDesc area of mei header
    //ultimately source Desc must be linked to the music division element to permit multiple sources in the one file. Currently they reside in the header. New handing needed that is more multisource oriented
    SourceDesc* sourceDesc = new SourceDesc;
    fileDesc->addChild(sourceDesc);
    Source* source = new Source;
    source->addAttribute("n", partit.abbrev_ms);
    source->addAttribute("label", "manuscript");
    sourceDesc->addChild(source);
    TitleStmt* sourceTitleSmt = new TitleStmt;
    Title* sourceTitle = new Title; //will fill below in clunky fashion
    sourceTitle->setValue(partit.title);
    sourceTitleSmt->addChild(sourceTitle);
    source->addChild(sourceTitleSmt);
    ItemList* itemlist = new ItemList;
    source->addChild(itemlist);
    Item* msitem = new Item;
    itemlist->addChild(msitem);
    msitem->addAttribute("type", "manuscript");
    if (sourcekey->contains_code(partit.abbrev_ms))
    {
        std::string fols = ", fol. ";
        if (partit.folios.find('-')!=std::string::npos || partit.folios.find("/n-dash")!=std::string::npos ) {
            fols = ", fols. ";
        }
        
        msitem->setValue(sourcekey->getSourceName(partit.abbrev_ms)+ fols + partit.folios);
    }
    
    
    RespStmt* sourceRespStmt = new RespStmt;
        //Composer
    PersName* composer = new PersName;
    composer->addAttribute("role", "composer"); //also add other attributes like dbkey, url
    composer->setValue(partit.composer);
    sourceRespStmt->addChild(composer);
        //For later population
    PersName* poet = new PersName;
    poet->addAttribute("role", "poet");
    poet->setValue("TBC");
    sourceRespStmt->addChild(poet);
        //for later population
    PersName* dedicatee = new PersName;
    dedicatee->addAttribute("role", "dedicatee");
    dedicatee->setValue("TBC");
    sourceRespStmt->addChild(dedicatee);
    
    source->addChild(sourceRespStmt);
    PhysLoc* physLoc = new PhysLoc;
    if (sourcekey->contains_code(partit.abbrev_ms))
    {
        Repository* ms = new Repository;
        physLoc->addChild(ms);
        Abbr* abbr = new Abbr;
        abbr->addAttribute("label", "RISM siglum");
        ms->addChild(abbr);
        Expan* expan = new Expan;
        expan->addAttribute("label", "library");
        ms->addChild(expan);
        abbr->setValue(sourcekey->getRISMName(partit.abbrev_ms));
        expan->setValue(sourcekey->getSourceName(partit.abbrev_ms));
    }
    source->addChild(physLoc); //place for placing city, archive, shelfnumber
    
    /* - Revision Description
     
        </meihead>
    */
    
}
开发者ID:jjstoessel,项目名称:Scribe2NeoScribe,代码行数:93,代码来源:CScribeToNeoScribeXML.cpp


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