• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XMLwrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XMLwrapper的典型用法代码示例。如果您正苦于以下问题:C++ XMLwrapper类的具体用法?C++ XMLwrapper怎么用?C++ XMLwrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: XMLwrapper

void Presets::copy(const char *name)
{
    XMLwrapper *xml = new XMLwrapper();

    //used only for the clipboard
    if(name == NULL)
        xml->minimal = false;

    char type[MAX_PRESETTYPE_SIZE];
    strcpy(type, this->type);
    //strcat(type, "n");
    if(name == NULL)
        if(strstr(type, "Plfo") != NULL)
            strcpy(type, "Plfo");

    xml->beginbranch(type);
    add2XML(xml);
    xml->endbranch();

    if(name == NULL)
        presetsstore.copyclipboard(xml, type);
    else
        presetsstore.copypreset(xml, type, name);

    delete (xml);
}
开发者ID:CallisteHanriat,项目名称:lmms,代码行数:26,代码来源:Presets.cpp


示例2: doArrayPaste

void doArrayPaste(MiddleWare &mw, int field, string url, string type,
        XMLwrapper &xml, Ts&&... args)
{
    //Generate a new object
    T *t = new T(std::forward<Ts>(args)...);

    if(xml.enterbranch(type+"n") == 0) {
        delete t;
        return;
    }
    t->defaults(field);
    t->getfromXMLsection(xml, field);
    xml.exitbranch();

    //Send the pointer
    string path = url+"paste-array";
    char buffer[1024];
    rtosc_message(buffer, 1024, path.c_str(), "bi", sizeof(void*), &t, field);
    if(!Master::ports.apropos(path.c_str()))
        fprintf(stderr, "Warning: Missing Paste URL: '%s'\n", path.c_str());
    //printf("Sending info to '%s'<%d>\n", buffer, field);
    mw.transmitMsg(buffer);

    //Let the pointer be reclaimed later
}
开发者ID:loki42,项目名称:Carla,代码行数:25,代码来源:PresetExtractor.cpp


示例3: loadCache

static bvec loadCache(void)
{
    bvec cache;
    XMLwrapper xml;
    xml.loadXMLfile(getCacheName());
    if(xml.enterbranch("bank-cache")) {
        auto nodes = xml.getBranch();

        for(auto node:nodes) {
            BankEntry be;
#define bind(x,y) if(node.has(#x)) {be.x = y(node[#x].c_str());}
            bind(file, string);
            bind(bank, string);
            bind(name, string);
            bind(comments, string);
            bind(author, string);
            bind(type, atoi);
            bind(id, atoi);
            bind(add, atoi);
            bind(pad, atoi);
            bind(sub, atoi);
            bind(time, atoi);
#undef bind
            cache.push_back(be);
        }
    }
    return cache;
}
开发者ID:grejppi,项目名称:zynaddsubfx,代码行数:28,代码来源:BankDb.cpp


示例4: if

bool Bank::addtobank(size_t rootID, size_t bankID, int pos, const string filename, const string name)
{    
    BankEntry &bank = roots [rootID].banks [bankID];
    if (pos >= 0 && pos < BANK_SIZE)
    {
        if (bank.instruments [pos].used)
        {
            pos = -1; // force it to find a new free position
        }
    }
    else if (pos >= BANK_SIZE)
        pos = -1;

    if (pos < 0)
    {

        if(!bank.instruments.empty() && bank.instruments.size() > BANK_SIZE)
        {
            pos = bank.instruments.rbegin()->first + 1;
        }
        else
        {
            pos = BANK_SIZE-1;
            while (!emptyslotWithID(rootID, bankID, pos))
            {
                pos -= 1;
                if(pos < 0)
                {
                    break;
                }
            }
        }
    }
    if (pos < 0)
        return -1; // the bank is full

    deletefrombank(rootID, bankID, pos);
    InstrumentEntry &instrRef = getInstrumentReference(rootID, bankID, pos);
    instrRef.used = true;
    instrRef.name = name;
    instrRef.filename = filename;
    instrRef.PADsynth_used = false;
    instrRef.ADDsynth_used = false;
    instrRef.SUBsynth_used = false;

    // see which engines are used
    if (synth->getRuntime().checksynthengines)
    {
        XMLwrapper *xml = new XMLwrapper(synth);
        xml->checkfileinformation(getFullPath(rootID, bankID, pos));
        instrRef.PADsynth_used = xml->information.PADsynth_used;
        instrRef.ADDsynth_used = xml->information.ADDsynth_used;
        instrRef.SUBsynth_used = xml->information.SUBsynth_used;
        delete xml;
    }
    return 0;
}
开发者ID:obek,项目名称:yoshimi,代码行数:57,代码来源:Bank.cpp


示例5:

void FilterParams::add2XMLsection(XMLwrapper& xml, int n)
{
    int nvowel = n;
    for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) {
        xml.beginbranch("FORMANT", nformant);
        xml.addpar("freq", Pvowels[nvowel].formants[nformant].freq);
        xml.addpar("amp", Pvowels[nvowel].formants[nformant].amp);
        xml.addpar("q", Pvowels[nvowel].formants[nformant].q);
        xml.endbranch();
    }
}
开发者ID:wtrsltnk,项目名称:zynaddsubfx-fork,代码行数:11,代码来源:FilterParams.cpp


示例6: saveXML

int Part::saveXML(const char *filename)
{
    XMLwrapper xml;

    xml.beginbranch("INSTRUMENT");
    add2XMLinstrument(&xml);
    xml.endbranch();

    int result = xml.saveXMLfile(filename, gzip_compression);
    return result;
}
开发者ID:UIKit0,项目名称:zynaddsubfx,代码行数:11,代码来源:Part.cpp


示例7: XMLwrapper

int Microtonal::saveXML(const char *filename) const
{
    XMLwrapper *xml = new XMLwrapper();

    xml->beginbranch("MICROTONAL");
    add2XML(xml);
    xml->endbranch();

    int result = xml->saveXMLfile(filename);
    delete (xml);
    return result;
}
开发者ID:xsgoodbox,项目名称:zynaddsubfx,代码行数:12,代码来源:Microtonal.cpp


示例8: loadXMLinstrument

int Part::loadXMLinstrument(const char *filename)
{
    XMLwrapper xml;
    if(xml.loadXMLfile(filename) < 0) {
        return -1;
    }

    if(xml.enterbranch("INSTRUMENT") == 0)
        return -10;
    getfromXMLinstrument(&xml);
    xml.exitbranch();

    return 0;
}
开发者ID:UIKit0,项目名称:zynaddsubfx,代码行数:14,代码来源:Part.cpp


示例9: deletefrombank

int Bank::addtobank(int pos, const char *filename, const char *name)
{
    if((pos >= 0) && (pos < BANK_SIZE)) {
        if(ins[pos].used)
            pos = -1;             //force it to find a new free position
    }
    else
    if(pos >= BANK_SIZE)
        pos = -1;


    if(pos < 0) { //find a free position
        for(int i = BANK_SIZE - 1; i >= 0; i--)
            if(!ins[i].used) {
                pos = i;
                break;
            }
        ;
    }

    if(pos < 0)
        return -1;         //the bank is full

    // printf("%s   %d\n",filename,pos);

    deletefrombank(pos);

    ins[pos].used = true;
    snprintf(ins[pos].name, PART_MAX_NAME_LEN, "%s", name);

    snprintf(tmpinsname[pos], PART_MAX_NAME_LEN + 10, " ");

    int len = strlen(filename) + 1 + strlen(dirname);
    ins[pos].filename = new char[len + 2];
    ins[pos].filename[len + 1] = 0;
    snprintf(ins[pos].filename, len + 1, "%s/%s", dirname, filename);

    //see if PADsynth is used
    if(config.cfg.CheckPADsynth) {
        XMLwrapper *xml = new XMLwrapper();
        xml->loadXMLfile(ins[pos].filename);

        ins[pos].info.PADsynth_used = xml->hasPadSynth();
        delete xml;
    }
    else
        ins[pos].info.PADsynth_used = false;

    return 0;
}
开发者ID:AHudon,项目名称:SOEN6471_LMMS,代码行数:50,代码来源:Bank.cpp


示例10: getfromXML

void LFOParams::getfromXML(XMLwrapper& xml)
{
    Pfreq       = xml.getparreal("freq", Pfreq, 0.0f, 1.0f);
    Pintensity  = xml.getpar127("intensity", Pintensity);
    Pstartphase = xml.getpar127("start_phase", Pstartphase);
    PLFOtype    = xml.getpar127("lfo_type", PLFOtype);
    Prandomness = xml.getpar127("randomness_amplitude", Prandomness);
    Pfreqrand   = xml.getpar127("randomness_frequency", Pfreqrand);
    Pdelay      = xml.getpar127("delay", Pdelay);
    Pstretch    = xml.getpar127("stretch", Pstretch);
    Pcontinous  = xml.getparbool("continous", Pcontinous);
}
开发者ID:loki42,项目名称:Carla,代码行数:12,代码来源:LFOParams.cpp


示例11:

void LFOParams::add2XML(XMLwrapper& xml)
{
    xml.addparreal("freq", Pfreq);
    xml.addpar("intensity", Pintensity);
    xml.addpar("start_phase", Pstartphase);
    xml.addpar("lfo_type", PLFOtype);
    xml.addpar("randomness_amplitude", Prandomness);
    xml.addpar("randomness_frequency", Pfreqrand);
    xml.addpar("delay", Pdelay);
    xml.addpar("stretch", Pstretch);
    xml.addparbool("continous", Pcontinous);
}
开发者ID:loki42,项目名称:Carla,代码行数:12,代码来源:LFOParams.cpp


示例12: doPaste

void doPaste(MiddleWare &mw, string url, string type, XMLwrapper &xml, Ts&&... args)
{
    //Generate a new object
    T *t = new T(std::forward<Ts>(args)...);
    
    //Old workaround for LFO parameters
    if(strstr(type.c_str(), "Plfo"))
        type = "Plfo";

    if(xml.enterbranch(type) == 0)
        return;

    t->getfromXML(xml);

    //Send the pointer
    string path = url+"paste";
    char buffer[1024];
    rtosc_message(buffer, 1024, path.c_str(), "b", sizeof(void*), &t);
    if(!Master::ports.apropos(path.c_str()))
        fprintf(stderr, "Warning: Missing Paste URL: '%s'\n", path.c_str());
    //printf("Sending info to '%s'\n", buffer);
    mw.transmitMsg(buffer);

    //Let the pointer be reclaimed later
}
开发者ID:loki42,项目名称:Carla,代码行数:25,代码来源:PresetExtractor.cpp


示例13: getfromXMLsection

void FilterParams::getfromXMLsection(XMLwrapper& xml, int n)
{
    int nvowel = n;
    for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) {
        if(xml.enterbranch("FORMANT", nformant) == 0)
            continue;
        Pvowels[nvowel].formants[nformant].freq = xml.getpar127(
            "freq",
            Pvowels[nvowel
            ].formants[nformant].freq);
        Pvowels[nvowel].formants[nformant].amp = xml.getpar127(
            "amp",
            Pvowels[nvowel
            ].formants[nformant].amp);
        Pvowels[nvowel].formants[nformant].q =
            xml.getpar127("q", Pvowels[nvowel].formants[nformant].q);
        xml.exitbranch();
    }
}
开发者ID:wtrsltnk,项目名称:zynaddsubfx-fork,代码行数:19,代码来源:FilterParams.cpp


示例14: presetPasteArray

void presetPasteArray(MiddleWare &mw, std::string url, int field, std::string name)
{
    (void) name;
    //printf("PresetArrayPaste()\n");
    string data = "";
    XMLwrapper xml;
    if(name.empty()) {
        data = mw.getPresetsStore().clipboard.data;
        if(data.length() < 20)
            return;
        if(!xml.putXMLdata(data.c_str()))
            return;
    } else {
        if(xml.loadXMLfile(name))
            return;
    }
    //printf("Performing Paste...\n");
    doClassArrayPaste(getUrlType(url), getUrlPresetType(url, mw), field, mw, url, xml);
}
开发者ID:loki42,项目名称:Carla,代码行数:19,代码来源:PresetExtractor.cpp


示例15:

void Resonance::add2XML(XMLwrapper& xml)
{
    xml.addparbool("enabled", Penabled);

    if((Penabled == 0) && (xml.minimal))
        return;

    xml.addpar("max_db", PmaxdB);
    xml.addpar("center_freq", Pcenterfreq);
    xml.addpar("octaves_freq", Poctavesfreq);
    xml.addparbool("protect_fundamental_frequency", Pprotectthefundamental);
    xml.addpar("resonance_points", N_RES_POINTS);
    for(int i = 0; i < N_RES_POINTS; ++i) {
        xml.beginbranch("RESPOINT", i);
        xml.addpar("val", Prespoints[i]);
        xml.endbranch();
    }
}
开发者ID:peter1000,项目名称:Carla,代码行数:18,代码来源:Resonance.cpp


示例16: deletefrombank

int Bank::addtobank(int pos, string filename, string name)
{
    if((pos >= 0) && (pos < BANK_SIZE)) {
        if(ins[pos].used)
            pos = -1;  //force it to find a new free position
    }
    else
    if(pos >= BANK_SIZE)
        pos = -1;


    if(pos < 0)   //find a free position
        for(int i = BANK_SIZE - 1; i >= 0; i--)
            if(!ins[i].used) {
                pos = i;
                break;
            }

    if(pos < 0)
        return -1;  //the bank is full

    deletefrombank(pos);

    ins[pos].used     = true;
    ins[pos].name     = name;
    ins[pos].filename = dirname + '/' + filename;

    //see if PADsynth is used
    if(config.cfg.CheckPADsynth) {
        XMLwrapper xml;
        xml.loadXMLfile(ins[pos].filename);

        ins[pos].info.PADsynth_used = xml.hasPadSynth();
    }
    else
        ins[pos].info.PADsynth_used = false;

    return 0;
}
开发者ID:dmlloyd,项目名称:Carla,代码行数:39,代码来源:Bank.cpp


示例17: getfromXML

void Resonance::getfromXML(XMLwrapper& xml)
{
    Penabled = xml.getparbool("enabled", Penabled);

    PmaxdB       = xml.getpar127("max_db", PmaxdB);
    Pcenterfreq  = xml.getpar127("center_freq", Pcenterfreq);
    Poctavesfreq = xml.getpar127("octaves_freq", Poctavesfreq);
    Pprotectthefundamental = xml.getparbool("protect_fundamental_frequency",
                                             Pprotectthefundamental);
    for(int i = 0; i < N_RES_POINTS; ++i) {
        if(xml.enterbranch("RESPOINT", i) == 0)
            continue;
        Prespoints[i] = xml.getpar127("val", Prespoints[i]);
        xml.exitbranch();
    }
}
开发者ID:peter1000,项目名称:Carla,代码行数:16,代码来源:Resonance.cpp


示例18: strcpy

void Presets::paste(int npreset)
{
    char type[MAX_PRESETTYPE_SIZE];
    strcpy(type, this->type);
    //strcat(type, "n");

    if(npreset == 0)
        if(strstr(type, "Plfo") != NULL)
            strcpy(type, "Plfo");

    XMLwrapper *xml = new XMLwrapper();
    if(npreset == 0) {
        if(!checkclipboardtype()) {
            delete (xml);
            return;
        }
        if(!presetsstore.pasteclipboard(xml)) {
            delete (xml);
            return;
        }
    }
    else
    if(!presetsstore.pastepreset(xml, npreset)) {
        delete (xml);
        return;
    }

    if(xml->enterbranch(type) == 0)
        return;

    defaults();
    getfromXML(xml);

    xml->exitbranch();

    delete (xml);
}
开发者ID:CallisteHanriat,项目名称:lmms,代码行数:37,代码来源:Presets.cpp


示例19: saveCache

static void saveCache(bvec vec)
{
    XMLwrapper xml;
    xml.beginbranch("bank-cache");
    for(auto value:vec) {
        XmlNode binding("instrument-entry");
#define bind(x) binding[#x] = to_s(value.x);
        bind(file);
        bind(bank);
        bind(name);
        bind(comments);
        bind(author);
        bind(type);
        bind(id);
        bind(add);
        bind(pad);
        bind(sub);
        bind(time);
#undef bind
        xml.add(binding);
    }
    xml.endbranch();
    xml.saveXMLfile(getCacheName(), 0);
}
开发者ID:grejppi,项目名称:zynaddsubfx,代码行数:24,代码来源:BankDb.cpp


示例20: XMLwrapper

void Config::saveConfig(const char *filename) const
{
    XMLwrapper *xmlcfg = new XMLwrapper();

    xmlcfg->beginbranch("CONFIGURATION");

    xmlcfg->addpar("sample_rate", cfg.SampleRate);
    xmlcfg->addpar("sound_buffer_size", cfg.SoundBufferSize);
    xmlcfg->addpar("oscil_size", cfg.OscilSize);
    xmlcfg->addpar("swap_stereo", cfg.SwapStereo);
    xmlcfg->addpar("bank_window_auto_close", cfg.BankUIAutoClose);

    xmlcfg->addpar("gzip_compression", cfg.GzipCompression);

    xmlcfg->addpar("check_pad_synth", cfg.CheckPADsynth);
    xmlcfg->addpar("ignore_program_change", cfg.IgnoreProgramChange);

    xmlcfg->addparstr("bank_current", cfg.currentBankDir);

    xmlcfg->addpar("user_interface_mode", cfg.UserInterfaceMode);
    xmlcfg->addpar("virtual_keyboard_layout", cfg.VirKeybLayout);


    for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i)
        if(!cfg.bankRootDirList[i].empty()) {
            xmlcfg->beginbranch("BANKROOT", i);
            xmlcfg->addparstr("bank_root", cfg.bankRootDirList[i]);
            xmlcfg->endbranch();
        }

    for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i)
        if(!cfg.presetsDirList[i].empty()) {
            xmlcfg->beginbranch("PRESETSROOT", i);
            xmlcfg->addparstr("presets_root", cfg.presetsDirList[i]);
            xmlcfg->endbranch();
        }

    xmlcfg->addpar("interpolation", cfg.Interpolation);

    //linux stuff
    xmlcfg->addparstr("linux_oss_wave_out_dev", cfg.oss_devs.linux_wave_out);
    xmlcfg->addparstr("linux_oss_seq_in_dev", cfg.oss_devs.linux_seq_in);

    //windows stuff
    xmlcfg->addpar("windows_wave_out_id", cfg.WindowsWaveOutId);
    xmlcfg->addpar("windows_midi_in_id", cfg.WindowsMidiInId);

    xmlcfg->endbranch();

    // for some reason (which one?), the gzip compression is bashed to 0
    xmlcfg->saveXMLfile(filename, 0);

    delete (xmlcfg);
}
开发者ID:ViktorNova,项目名称:Carla,代码行数:54,代码来源:Config.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XMP_IO类代码示例发布时间:2022-05-31
下一篇:
C++ XML_Parser类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap