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

C++ TStringStream类代码示例

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

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



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

示例1: locker

    TString TPerformanceMeasurerStorage::Statistic() const
    {
        TCriticalSection::TLocker locker(m_pCS);
        TPmMap *pTotal = new TPmMap();
        for(TThreadMap::iterator threadIt = m_pMap->begin(); threadIt != m_pMap->end(); ++threadIt)
        {
            TPmMap *pPmMap = threadIt->second;
            for(TPmMap::iterator pmIt = pPmMap->begin(); pmIt != pPmMap->end(); ++pmIt)
            {
                TPerformanceMeasurer *pPm = NULL;
                TPmMap::iterator totalIt = pTotal->find(pmIt->first);
                if(totalIt == pTotal->end())
                {
                    pPm = new TPerformanceMeasurer(pmIt->second->Description().c_str());
                    (*pTotal)[pmIt->first] = pPm;
                }
                else
                    pPm = totalIt->second;

                pPm->Combine(*pmIt->second);
            }
        }

        std::vector<TString> statistics;
        for(TPmMap::iterator totalIt = pTotal->begin(); totalIt != pTotal->end(); ++totalIt)
            statistics.push_back(totalIt->second->Statistic());
        Free(pTotal);

        std::sort(statistics.begin(), statistics.end());

        TStringStream statistic;
        for(size_t i = 0;  i < statistics.size(); ++i)
            statistic << statistics[i] << std::endl;
        return statistic.str();
    }
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:35,代码来源:adPerformance.cpp


示例2: Dump

///////////////////////////////////////////////////////////////////////////
// CTSPIConferenceCall::Dump
//
// Debug "dump" of the object and it's contents.
//
TString CTSPIConferenceCall::Dump() const 
{
	TStringStream outstm;

	CEnterCode keyLock(this, FALSE);
	outstm << _T("0x") << hex << (DWORD)this;
	outstm << _T(",htCall=0x") << hex << m_htCall;
	outstm << _T(",LineOwner=0x") << hex << GetLineOwner()->GetPermanentDeviceID();
	outstm << _T(",State=") << GetCallStateName();
	outstm << _T(",RefCnt=") << setw(2) << GetRefCount();

	// Only dump the conferenced parties if we can lock the object right now.
	// If not, ignore it and continue. This particular function is called during
	// call removal and causes a deadlock if another call is changing state at 
	// this moment in the conference. (V3.043)
	if (keyLock.Lock(0))
	{
		outstm << _T(",Parties=") << setw(2) << m_lstConference.size() << endl;
		for (TCallHubList::const_iterator iCall = m_lstConference.begin();
		     iCall != m_lstConference.end(); ++iCall)
			 outstm << _T("  ") << (*iCall)->Dump() << endl;
	}
	else outstm << endl;
    return(outstm.str());

}// CTSPIConferenceCall::Dump
开发者ID:junction,项目名称:jn-tapi,代码行数:31,代码来源:Confcall.cpp


示例3: FormatWithCommas

TString FormatWithCommas(T value)
{
    TStringStream tss;
    tss.imbue(locale(""));
    tss << fixed << value;
    return tss.str();
}
开发者ID:raychow,项目名称:EightZip,代码行数:7,代码来源:OverwriteDialog.cpp


示例4: FormatDateTime

TString FormatDateTime(time_t value)
{
    TStringStream tss;
    tss.imbue(locale(""));
    tss << put_time(localtime(&value), wxT("%c"));
    return tss.str();
}
开发者ID:raychow,项目名称:EightZip,代码行数:7,代码来源:OverwriteDialog.cpp


示例5: hash

// static
TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
{
    if (hashFunction == NULL || name.empty())
        return name;
    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
    TStringStream stream;
    stream << HASHED_NAME_PREFIX << std::hex << number;
    TString hashedName = stream.str();
    return hashedName;
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:11,代码来源:Intermediate.cpp


示例6: PrintTimePerItem

Stroka PrintTimePerItem(TDuration time, size_t count) {
    TStringStream res;
    if (time == TDuration::Zero())
        res << "0";
    else if (count == 0)
        res << "INF";
    else
        res << NFormat::Duration(time / count);

    return res.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:11,代码来源:tools.cpp


示例7: PrintItemPerSecond

Stroka PrintItemPerSecond(TDuration time, size_t itemscount, int kbase) {
    TStringStream res;
    double seconds = (double)(time.MilliSeconds()) / 1000.0;
    if (itemscount == 0)
        res << "0";
    else if (time == TDuration::Zero() && seconds == 0.0)
        res << "INF";
    else
        res << NFormat::Short<double>(itemscount / seconds, kbase);
    return res.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:11,代码来源:tools.cpp


示例8: Statistic

 TString TPerformanceMeasurer::Statistic() const
 {
     TStringStream ss;
     ss << m_decription << TEXT(": ");
     ss << std::setprecision(0) << std::fixed << m_total*1000 << TEXT(" ms");
     ss << TEXT(" / ") << m_count << TEXT(" = ");
     ss << std::setprecision(2) << std::fixed << Average()*1000.0 << TEXT(" ms");
     ss << std::setprecision(2) << TEXT(" {min=") << m_min*1000.0 << TEXT("; max=") << m_max*1000.0 << TEXT("}");
     if(m_size > (long long)m_count)
     {
         double size = double(m_size);
         ss << std::setprecision(3) << TEXT(" [<s>=") << size/m_count*0.001 << TEXT(" kb; <t>=") << m_total/size*1000000000 << TEXT(" ns]");
     }
     return ss.str();
 }
开发者ID:flying19880517,项目名称:AntiDupl,代码行数:15,代码来源:adPerformance.cpp


示例9: Summary

static Stroka Summary(TInstant start, size_t totalLines, TInstant prev, size_t prevLines, bool shrinked = true) {
    TInstant current = Now();
    TStringStream res;

    if (shrinked)
        res << NFormat::Short(totalLines);
    else
        res << totalLines;

    res << " processed (" << NFormat::Duration(current - start) << ", "
        << PrintTimePerItem(current - prev, prevLines) << " -> "
        << PrintTimePerItem(current - start, totalLines) << " avg)";

    return res.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:15,代码来源:tools.cpp


示例10: BuiltInConstants

//============================================================================
//
// Implementation dependent built-in constants.
//
//============================================================================
static TString BuiltInConstants(const ShBuiltInResources &resources)
{
    TStringStream s;

    s << "const int gl_MaxVertexAttribs = " << resources.MaxVertexAttribs << ";";
    s << "const int gl_MaxVertexUniformVectors = " << resources.MaxVertexUniformVectors << ";";

    s << "const int gl_MaxVaryingVectors = " << resources.MaxVaryingVectors << ";";
    s << "const int gl_MaxVertexTextureImageUnits = " << resources.MaxVertexTextureImageUnits << ";";
    s << "const int gl_MaxCombinedTextureImageUnits = " << resources.MaxCombinedTextureImageUnits << ";";
    s << "const int gl_MaxTextureImageUnits = " << resources.MaxTextureImageUnits << ";";
    s << "const int gl_MaxFragmentUniformVectors = " << resources.MaxFragmentUniformVectors << ";";
    s << "const int gl_MaxDrawBuffers = " << resources.MaxDrawBuffers << ";";

    return s.str();
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:21,代码来源:Initialize.cpp


示例11: getCompleteString

TString TType::getCompleteString() const
{
    TStringStream stream;

    if (qualifier != EvqTemporary && qualifier != EvqGlobal)
        stream << getQualifierString() << " " << getPrecisionString() << " ";
    if (array)
        stream << "array[" << getArraySize() << "] of ";
    if (matrix)
        stream << static_cast<int>(size) << "X" << static_cast<int>(size) << " matrix of ";
    else if (size > 1)
        stream << static_cast<int>(size) << "-component vector of ";

    stream << getBasicString();
    return stream.str();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:16,代码来源:intermOut.cpp


示例12: defined

// static
TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
{
    if (hashFunction == NULL || name.empty())
        return name;
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
    TStringStream stream;
    stream << HASHED_NAME_PREFIX << std::hex << number;
    TString hashedName = stream.str();
    return hashedName;
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:18,代码来源:Intermediate.cpp


示例13: getCompleteString

TString TType::getCompleteString() const
{
    TStringStream stream;

    if (qualifier != EvqTemporary && qualifier != EvqGlobal)
        stream << getQualifierString() << " ";
    if (precision != EbpUndefined)
        stream << getPrecisionString() << " ";
    if (array)
        stream << "array[" << getArraySize() << "] of ";
    if (isMatrix())
        stream << getCols() << "X" << getRows() << " matrix of ";
    else if (isVector())
        stream << getNominalSize() << "-component vector of ";

    stream << getBasicString();
    return stream.str();
}
开发者ID:merckhung,项目名称:libui,代码行数:18,代码来源:intermOut.cpp


示例14: TestVirtualInheritance

        inline void TestVirtualInheritance() {
            TStringStream ss;

            OUTS = &ss;

            class TA {
                public:
                    inline TA() {
                        *OUTS << "A";
                    }
            };

            class TB {
                public:
                    inline TB() {
                        *OUTS << "B";
                    }
            };

            class TC: public virtual TB, public virtual TA {
                public:
                    inline TC() {
                        *OUTS << "C";
                    }
            };

            class TD: public virtual TA {
                public:
                    inline TD() {
                        *OUTS << "D";
                    }
            };

            class TE: public TC, public TD {
                public:
                    inline TE() {
                        *OUTS << "E";
                    }
            };

            TE e;

            UNIT_ASSERT_EQUAL(ss.Str(), "BACDE");
        }
开发者ID:Mirocow,项目名称:balancer,代码行数:44,代码来源:yexception_ut.cpp


示例15: SummaryBytes

static Stroka SummaryBytes(TInstant start, size_t totalLines, TInstant prev, size_t prevLines, bool shrinked = true) {
    TInstant current = Now();

    const size_t KB = 1024;
    const size_t MB = 1024*KB;

    TStringStream res;

    if (shrinked)
        res << NFormat::Short(totalLines, KB);
    else
        res << totalLines;

    res << " bytes processed (" << NFormat::Duration(current - start) << ", "
        << PrintTimePerItem(current - prev, prevLines/MB) << "/MB -> "
        << PrintTimePerItem(current - start, totalLines/MB) << "/MB, "
        << PrintItemPerSecond(current - start, totalLines, KB) << "B/s avg)";

    return res.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:20,代码来源:tools.cpp


示例16: TEXT

void ErrExit::FinalError(const TCHAR *FailCall, const TCHAR *Function, const TCHAR *File, const long Line, const DWORD SystemErrorID, const TCHAR *ErrorText)
{
	const TCHAR *newl = TEXT("\r\n");
	TCHAR Buffer[MAX_PATH];
	int Response;
	TStringStream msg;

	//General Information
	msg << TEXT("DateTime: ") << GetLocalTime() << newl
	    << TEXT("FailCall: ") << FailCall << newl
	    << TEXT("Function: ") << Function << newl
	    << TEXT("File: ") << File << newl
	    << TEXT("Line: ") << Line << newl << newl;

	//Get Windows LastError Information
	if(SystemErrorID)
	{
		GetSystemErrText(SystemErrorID, Buffer, MAX_PATH);
		msg << TEXT("GetLastError: ") << SystemErrorID << newl
		    << Buffer << newl;
	}
	else if(ErrorText)
	{
		msg << TEXT("ErrorText: ") << newl << ErrorText << newl << newl;
	}

	//Get CallStack
	msg << TEXT("Stack: ") << newl << Stackage::GetString() << newl;

	//Display MessageBox and Copy to Clipboard
	TString info = msg.str();
	msg << newl << TEXT("Copy this information to clipboard?");
	Response = MessageBox(HWND_DESKTOP, msg.str().c_str(), TEXT("Fatal Error"), MB_YESNO | MB_ICONHAND | MB_DEFBUTTON2);
	if(Response == IDYES)
		ClipBoardSetText(info.c_str());

	//Fatal Fail
	ExitProcess(1);
}
开发者ID:Valrandir,项目名称:KirbyCore,代码行数:39,代码来源:StackTrace.cpp


示例17: while

bool TSimpleTextMiner::Run()
{
    if (Input == NULL || Output == NULL)
        return false;

    Wtroka text;
    SDocumentAttribtes docAttr;
    ETypeOfDocument type;

    while (DoInput(text, docAttr, type)) {
        bool res = DoProcess(text, docAttr, type);
        if (res)
            res = DoOutput(docAttr);

        if (!res && Errors != NULL && dynamic_cast<TStringStream*>(ErrorStream) != NULL) {
            TStringStream* str = static_cast<TStringStream*>(ErrorStream);
            Errors->OutputError(str->Str());
            str->clear();
        }
    }

    return true;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:23,代码来源:simpleprocessor.cpp


示例18: FormatOption

static Stroka FormatOption(const TOpt* option) {
    TStringStream result;
    const TOpt::TShortNames& shorts = option->GetShortNames();
    const TOpt::TLongNames& longs = option->GetLongNames();

    const size_t nopts = shorts.size() + longs.size();
    const bool multiple = 1 < nopts;
    if (multiple)
        result << '{';
    for (size_t i = 0; i < nopts; ++i) {
        if (multiple && 0 != i)
            result << '|';

        if (i < shorts.size()) // short
            result << '-' << shorts[i];
        else
            result << "--" << longs[i - shorts.size()];
    }
    if (multiple)
        result << '}';

    static const Stroka metavarDef("VAL");
    const Stroka& title = option->ArgTitle_;
    const Stroka& metavar = title.Empty() ? metavarDef : title;

    if (option->HasArg_ == OPTIONAL_ARGUMENT) {
        result << " [" << metavar;
        if (option->HasOptionalValue())
            result << ':' << option->GetOptionalValue();
        result << ']';
    } else if (option->HasArg_ == REQUIRED_ARGUMENT)
        result << ' ' << metavar;
    else
        YASSERT(option->HasArg_ == NO_ARGUMENT);

    return result.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:37,代码来源:last_getopt.cpp


示例19: FormatOption

static TString FormatOption(const TOpt* option, const NColorizer::TColors& colors) {
    TStringStream result;
    const TOpt::TShortNames& shorts = option->GetShortNames();
    const TOpt::TLongNames& longs = option->GetLongNames();

    const size_t nopts = shorts.size() + longs.size();
    const bool multiple = 1 < nopts;
    if (multiple)
        result << '{';
    for (size_t i = 0; i < nopts; ++i) {
        if (multiple && 0 != i)
            result << '|';

        if (i < shorts.size()) // short
            result  << colors.GreenColor() << '-' << shorts[i] << colors.OldColor();
        else
            result << colors.GreenColor() << "--" << longs[i - shorts.size()] << colors.OldColor();
    }
    if (multiple)
        result << '}';

    static const TString metavarDef("VAL");
    const TString& title = option->GetArgTitle();
    const TString& metavar = title.Empty() ? metavarDef : title;

    if (option->GetHasArg() == OPTIONAL_ARGUMENT) {
        result << " [" << metavar;
        if (option->HasOptionalValue())
            result << ':' << option->GetOptionalValue();
        result << ']';
    } else if (option->GetHasArg() == REQUIRED_ARGUMENT)
        result << ' ' << metavar;
    else
        Y_ASSERT(option->GetHasArg() == NO_ARGUMENT);

    return result.Str();
}
开发者ID:iamnik13,项目名称:catboost,代码行数:37,代码来源:last_getopt_opts.cpp


示例20: DebugString

Stroka CPrimitiveGroup::DebugString() const {
    TStringStream str;
    str << "CPrimitiveGroup \"" << NStr::DebugEncode(UTF8ToWide(GetRuleName())) << "\": homonyms [" << m_ActiveHomonyms << "]";
    return str.Str();
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:5,代码来源:primitivegroup.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TStringVector类代码示例发布时间:2022-05-31
下一篇:
C++ TStringList类代码示例发布时间: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