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


C++ CStopWatch::GetDuration方法代码示例

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


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

示例1: SimulateInOut


//.........这里部分代码省略.........
    });
    loader.OnParsed([](const InfoTextLoader::LinedataType& data)
    {
        cout << "[" << std::setfill('0') << std::setw(3) << 0 << "]Data   : (" << data.data.size() << ") " << data.line << endl;
    });
    instreamCText >> loader;
    cout << "Version of CText data stream was: " << loader.Version() << " " << endl;
    cout << endl;

    //gui::components::CPoint p1(0, 0);
    CRectangle r1(10, 20, 33, 55);
    cout << "Simulate running" << endl;
    cout << r1 << endl;
    std::ostringstream outstring;
    outstring << r1;
    std::string outFromr1 = outstring.str();

    std::istringstream instream;
    instream.str(outFromr1);
    CRectangle r2;
    //std::cin >> r2;
    instream >> r2;
    cout << r2 << endl;

    {
        std::istringstream instream2;
        instream2.str("\"Older Depp, Du.\"");
        std::locale x(std::locale::classic(), new my_ctypeComma);
        instream2.imbue(x);

        std::string tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
        instream2 >> tmp1;
        instream2 >> tmp2;
        instream2 >> tmp3;
        instream2 >> tmp4;
        instream2 >> tmp5;
    }

    //std::string newstr = "CText Arial, \"Use the up and down arrow or[w] and[s] to move the menu
    // cursor up and down.\", DarkRed;";
    std::string newstr = "CText Arial, 34, \"Use the up and down arrow, or[w] and[s] to move the menu cursor up and down.\", DarkRed;";
    {
        std::string delimiters("\",;");
        std::vector<std::string> parts;
        split(parts, newstr, boost::is_any_of(delimiters));
    }

    {
        std::istringstream instream4;
        instream4.str(newstr);
        std::string sin((std::istreambuf_iterator<char>(instream4)),
                std::istreambuf_iterator<char>());

        //std::regex
        // word_regex(",(?!(?<=(?:^|,)\s*\"(?:[^\"]|\"\"|\\\")*,)(?:[^\"]|\"\"|\\\")*\"\s*(?:,|$))");
        std::regex word_regex(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
        auto what =
            std::sregex_iterator(sin.begin(), sin.end(), word_regex);
        auto wend = std::sregex_iterator();

        std::vector<std::string> v;

        for(; what != wend; ++what) {
            std::smatch match = *what;
            v.push_back(match.str());
        }
    }

    cout << endl;
    cout << endl;
    const int iMax = 1000;
    const char* versionString = "Version 1.2.3.4";
    stdcOut(iMax << " * Version parse of '" << versionString << "'.");

    CStopWatch sw;
    sw.Start();
    //std::time()
    VersionToken vtok1;

    for(int i = 0; i < iMax; ++i)
    {
        std::istringstream instream3;
        instream3.str(versionString);
        instream3 >> vtok1;

        /*std::istringstream instreamCText2;
           instreamCText2.str(str);
           //instreamCText2.seekg(std::ios_base::beg);
           InfoTextLoader loader2;
           instreamCText2 >> loader2;*/
    }
    sw.Stop();
    cout << "Time: " << sw.GetDuration() << endl;
    cout << "VersionToken: " << vtok1 << endl;
    cout << endl;
    cout << endl;

    // Todo: create a version class derived from a token class in the serializer lib
    //       that reads in versioned stuff from iostream.
} // SimulateInOut
开发者ID:Jedzia,项目名称:Humbug,代码行数:101,代码来源:main.cpp


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