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


C++ Emitter::SetSeqFormat方法代码示例

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


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

示例1: save_gui_cfg

void save_gui_cfg()
{
	YAML::Emitter out;
	out.SetSeqFormat(YAML::Flow);
	out << g_gui_cfg;

	// Save to file
	s_gui_cfg.seek(0);
	s_gui_cfg.trunc(0);
	s_gui_cfg.write(out.c_str(), out.size());
}
开发者ID:sergioengineer,项目名称:rpcs3,代码行数:11,代码来源:rpcs3.cpp

示例2: main

int main(int argc, char* argv[])
{
    (void) argc;
    (void) argv;


    // Create a new yaml document
    std::cout << "Creating a yaml file:" << std::endl;

    RMatrix<1,1> s;
    s << 42;

    RMatrix<3,1> col;
    col << 1,2,3;

    RMatrix<1,3> row;
    row << 1,2,3;

    RMatrix<2,2> R;
    R << 1, 2,
         3, 4;

    CMatrix<3,3> C;
    C << 1.1,            1.2,                1.3,
         complex_t(1,1), complex_t(1.2,3.4), 0,
         3.1,            3.2,                3.3;

    YAML::Node root;

    root["scalar"] = s;
    root["row"] = row;
    root["col"] = col;
    root["R"] = R;
    root["C"] = C;

    YAML::Emitter out;
    out.SetIndent(4);
    //out.SetMapFormat(YAML::Flow);
    out.SetSeqFormat(YAML::Flow);
    out << root;

    std::cout << out.c_str() << std::endl;

    std::ofstream fout("matrices.yaml");
    fout << out.c_str() << std::endl;
}
开发者ID:WaveBlocks,项目名称:libwaveblocks,代码行数:46,代码来源:test_yaml_eigen.cpp

示例3: ComplexGlobalSettings

		void ComplexGlobalSettings(YAML::Emitter& out, std::string& desiredOutput)
		{
			out << YAML::BeginSeq;
			out << YAML::Block;
			out << YAML::BeginMap;
			out << YAML::Key << "key 1" << YAML::Value << "value 1";
			out << YAML::Key << "key 2" << YAML::Value;
			out.SetSeqFormat(YAML::Flow);
			out << YAML::BeginSeq << "a" << "b" << "c" << YAML::EndSeq;
			out << YAML::EndMap;
			out << YAML::BeginMap;
			out << YAML::Key << YAML::BeginSeq << 1 << 2 << YAML::EndSeq;
			out << YAML::Value << YAML::BeginMap << YAML::Key << "a" << YAML::Value << "b" << YAML::EndMap;
			out << YAML::EndMap;
			out << YAML::EndSeq;
			
			desiredOutput = "- key 1: value 1\n  key 2: [a, b, c]\n- [1, 2]:\n    a: b";
		}
开发者ID:Airstriker,项目名称:viewer,代码行数:18,代码来源:emittertests.cpp

示例4: GenerateReportData

    void GenerateReportData(const Game& game,
        std::list<Message>& messages,
        const std::list<Plugin>& plugins,
        const std::string& masterlistVersion,
        const std::string& masterlistDate,
        const bool masterlistUpdateEnabled) {

        YAML::Node oldDetails;
        GetOldReportDetails(game.ReportDataPath(), oldDetails);
        
        //Need to output YAML as a JSON Javascript variable.
        YAML::Emitter yout;
        yout.SetOutputCharset(YAML::EscapeNonAscii);
        yout.SetStringFormat(YAML::DoubleQuoted);
        yout.SetBoolFormat(YAML::TrueFalseBool);
        yout.SetSeqFormat(YAML::Flow);
        yout.SetMapFormat(YAML::Flow);

        BOOST_LOG_TRIVIAL(debug) << "Generating JSON report data.";

        yout << YAML::BeginMap;

        yout << YAML::Key << "lootVersion"
            << YAML::Value << IntToString(g_version_major) + "." + IntToString(g_version_minor) + "." + IntToString(g_version_patch);

        yout << YAML::Key << "masterlist"
            << YAML::BeginMap
            << YAML::Key << "updaterEnabled"
            << YAML::Value;

        if (masterlistUpdateEnabled)
            yout << boost::locale::translate("Enabled").str();
        else
            yout << boost::locale::translate("Disabled").str();

        yout << YAML::Key << "revision"
            << YAML::Value << masterlistVersion
            << YAML::Key << "date"
            << YAML::Value << masterlistDate
            << YAML::EndMap;

        if (!plugins.empty()) {
            BOOST_LOG_TRIVIAL(debug) << "Generating JSON plugin data.";
            YAML::Emitter tempout;
            tempout.SetOutputCharset(YAML::EscapeNonAscii);
            tempout.SetStringFormat(YAML::DoubleQuoted);
            tempout.SetBoolFormat(YAML::TrueFalseBool);
            tempout.SetSeqFormat(YAML::Flow);
            tempout.SetMapFormat(YAML::Flow);

            tempout << YAML::BeginSeq;
            for (std::list<Plugin>::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) {
                WritePlugin(tempout, *it, game);
            }
            tempout << YAML::EndSeq;

            YAML::Node node = YAML::Load(tempout.c_str());

            if (AreDetailsEqual(node, oldDetails))
                messages.push_front(loot::Message(loot::Message::say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));
                
            //Need to generate output twice because passing the node causes !<!> to be written before every key and value for some reason.
            yout << YAML::Key << "plugins"
                << YAML::Value << YAML::BeginSeq;
            for (std::list<Plugin>::const_iterator it = plugins.begin(), endit = plugins.end(); it != endit; ++it) {
                WritePlugin(yout, *it, game);
            }
            yout << YAML::EndSeq;
        }
        else if (oldDetails.size() == 0)
            messages.push_front(loot::Message(loot::Message::say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));

        if (!messages.empty()) {
            BOOST_LOG_TRIVIAL(debug) << "Generating JSON general message data.";
            yout << YAML::Key << "globalMessages"
                << YAML::Value << YAML::BeginSeq;
            for (std::list<Message>::const_iterator it = messages.begin(), endit = messages.end(); it != endit; ++it) {
                WriteMessage(yout, *it);
            }
            yout << YAML::EndSeq;
        }

        BOOST_LOG_TRIVIAL(debug) << "Generating text translations.";
        yout << YAML::Key << "l10n"
            << YAML::BeginMap

            << YAML::Key << "txtSummarySec"
            << YAML::Value << boost::locale::translate("Summary").str()

            << YAML::Key << "txtSummary"
            << YAML::Value << boost::locale::translate("Summary").str()

            << YAML::Key << "txtLootVersion"
            << YAML::Value << boost::locale::translate("LOOT Version").str()

            << YAML::Key << "txtMasterlistRevision"
            << YAML::Value << boost::locale::translate("Masterlist Revision").str()

            << YAML::Key << "txtMasterlistDate"
            << YAML::Value << boost::locale::translate("Masterlist Date").str()
//.........这里部分代码省略.........
开发者ID:dbb,项目名称:loot,代码行数:101,代码来源:generators.cpp


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