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


C++ OStringStream::str方法代码示例

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


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

示例1: is

const Foam::mixedFvPatchField<Type>&
Foam::codedMixedFvPatchField<Type>::redirectPatchField() const
{
    if (!redirectPatchFieldPtr_.valid())
    {
        // Construct a patch
        // Make sure to construct the patchfield with up-to-date value

        // Write the data from the mixed b.c.
        OStringStream os;
        mixedFvPatchField<Type>::write(os);
        IStringStream is(os.str());
        // Construct dictionary from it.
        dictionary dict(is);

        // Override the type to enforce the fvPatchField::New constructor
        // to choose our type
        dict.set("type", name_);

        redirectPatchFieldPtr_.set
        (
            dynamic_cast<mixedFvPatchField<Type>*>
            (
                fvPatchField<Type>::New
                (
                    this->patch(),
                    this->internalField(),
                    dict
                ).ptr()
            )
        );
    }
    return redirectPatchFieldPtr_();
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:34,代码来源:codedMixedFvPatchField.C

示例2: is

const Foam::fvPatchField<Type>&
Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
{
    if (!redirectPatchFieldPtr_.valid())
    {
        // Construct a patch
        // Make sure to construct the patchfield with up-to-date value

        OStringStream os;
        os.writeKeyword("type") << redirectType_ << token::END_STATEMENT
            << nl;
        static_cast<const Field<Type>&>(*this).writeEntry("value", os);
        IStringStream is(os.str());
        dictionary dict(is);

        redirectPatchFieldPtr_.set
        (
            fvPatchField<Type>::New
            (
                this->patch(),
                this->dimensionedInternalField(),
                dict
            ).ptr()
        );
    }
    return redirectPatchFieldPtr_();
}
开发者ID:ADGlassby,项目名称:OpenFOAM-2.2.x,代码行数:27,代码来源:codedFixedValueFvPatchField.C

示例3: toString

 static std::string toString(const std::vector<DATA> &values)
 {
   OStringStream ost;
   for (auto v : values)
     ost << "'" << v << "' "; // adds quote around the string to see whitespace
   return ost.str();
 }
开发者ID:Cdebus,项目名称:MITK,代码行数:7,代码来源:mitkVectorPropertyTest.cpp

示例4: writeData

Ostream& writeData(
    Ostream &o,
    Type value,
    const string annotation,
    const word header,
    bool newLine=false
) {
    const label annotationLen=25;
    if(annotation!="") {
        o << annotation.c_str();
        for(label i=0;i<(annotationLen-label(annotation.size()));i++) {
            o << " ";
        }
    }
    writeValue(o,value);
    for(direction i=0;i<pTraits<Type>::nComponents;i++) {
        scalar v=component(value,i);
        csvHeader+=","+header;
        if(pTraits<Type>::nComponents>1) {
            csvHeader+=string(" ")+pTraits<Type>::componentNames[i];
        }
        OStringStream s;
        s << v;
        csvLine+=","+s.str();
    }
    if(newLine) {
        o << endl;
    }
    return o;
}
开发者ID:martinep,项目名称:foam-extend-svn,代码行数:30,代码来源:fieldReport.C

示例5:

std::string 
StringTools::toString( double value )
{
  OStringStream stream;
  stream << value;
  return stream.str();
}
开发者ID:LTears,项目名称:rktotal,代码行数:7,代码来源:StringTools.cpp

示例6: forAll

void Foam::vtkPVblockMesh::updateInfoEdges
(
    vtkDataArraySelection* arraySelection
)
{
    if (debug)
    {
        Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
            << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
    }

    arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );

    const blockMesh& blkMesh = *meshPtr_;
    const curvedEdgeList& edges = blkMesh.edges();

    const int nEdges = edges.size();
    forAll(edges, edgeI)
    {
        OStringStream ostr;

        ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
            << edges[edgeI].type();

        // Add "beg:end - type" to GUI list
        arraySelection->AddArray(ostr.str().c_str());
    }
开发者ID:BarisCumhur,项目名称:OpenFOAM-dev,代码行数:27,代码来源:vtkPVblockMesh.C

示例7: ASSERT_ANY_COMPARE

void Assertion::ASSERT_ANY_COMPARE(const ROAnything &inputAny, const ROAnything &masterAny, String location, char delimSlot, char idxdelim) {
	OStringStream s;
	String failingPath(location);
	if(!AnyUtils::AnyCompareEqual(inputAny, masterAny, failingPath,&s, delimSlot, idxdelim)) {
		String strfail(failingPath);
		strfail << "\n" << s.str();
		ASSERTM((const char*)strfail, false);
	}
}
开发者ID:chenbk85,项目名称:CuteTestForCoastTest,代码行数:9,代码来源:AssertionAnything.cpp

示例8: entry

Foam::primitiveEntry::primitiveEntry(const keyType& keyword, const T& t)
:
    entry(keyword),
    ITstream(keyword, tokenList(10))
{
    OStringStream os;
    os << t << token::END_STATEMENT;
    readEntry(dictionary::null, IStringStream(os.str())());
}
开发者ID:Cescfangs,项目名称:OpenFOAM-1.7.x,代码行数:9,代码来源:primitiveEntryTemplates.C

示例9: toString

		static std::string toString(const EERIEMATRIX &matrix) {
			OStringStream ost;
			ost << std::endl << std::fixed;
			ost << matrix._11 << "\t" << matrix._12 << "\t" << matrix._13 << "\t" << matrix._14 << std::endl;
			ost << matrix._21 << "\t" << matrix._22 << "\t" << matrix._23 << "\t" << matrix._24 << std::endl;
			ost << matrix._31 << "\t" << matrix._32 << "\t" << matrix._33 << "\t" << matrix._34 << std::endl;
			ost << matrix._41 << "\t" << matrix._42 << "\t" << matrix._43 << "\t" << matrix._44 << std::endl;
			return ost.str();
		}
开发者ID:AlexMarlo,项目名称:ArxLibertatis,代码行数:9,代码来源:GraphicsUtilityTest.cpp

示例10: if

Foam::string Foam::stringOps::getVariable
(
    const word& name,
    const dictionary& dict,
    const bool allowEnvVars,
    const bool allowEmpty
)
{
    string value;

    const entry* ePtr = dict.lookupScopedEntryPtr
    (
        name,
        true,
        false
    );
    if (ePtr)
    {
        OStringStream buf;
        // Force floating point numbers to be printed with at least
        // some decimal digits.
        buf << fixed;
        buf.precision(IOstream::defaultPrecision());

        // fail for non-primitiveEntry
        dynamicCast<const primitiveEntry>
        (
            *ePtr
        ).write(buf, true);

        value = buf.str();
    }
    else if (allowEnvVars)
    {
        value = getEnv(name);

        if (value.empty())
        {
            FatalIOErrorInFunction
            (
                dict
            )   << "Cannot find dictionary or environment variable "
                << name << exit(FatalIOError);
        }
    }
    else
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "Cannot find dictionary variable "
            << name << exit(FatalIOError);
    }

    return value;
}
开发者ID:mattijsjanssens,项目名称:mattijs-extensions,代码行数:56,代码来源:stringOps.C

示例11: reactionStrLeft

Foam::string Foam::Reaction<ReactionThermo>::reactionStr
(
    OStringStream& reaction
) const
{
    reactionStrLeft(reaction);
    reaction << " = ";
    reactionStrRight(reaction);
    return reaction.str();
}
开发者ID:ADGlassby,项目名称:OpenFOAM-2.2.x,代码行数:10,代码来源:Reaction.C

示例12: set_args_

 explicit set_args_(const Range &args)
 {
     OStringStream os;
     boost::for_each(args, boost::bind(&set_args_::add, this,
         _1, boost::ref(os)));
     String s = os.str();
     cmd_line_.reset(new Char[s.size() + 1]);
     boost::copy(s, cmd_line_.get());
     cmd_line_[s.size()] = 0;
 }
开发者ID:pbondo,项目名称:uniproxy,代码行数:10,代码来源:set_args.hpp

示例13: forAll

void Foam::equationReader::fatalParseError
(
    const label index,
    const tokenList& tl,
    const label fromToken,
    const label toToken,
    const string& errorIn,
    const OStringStream& description
) const
{
    OStringStream errorMessage;
    forAll(tl, i)
    {
        if (i == fromToken)
        {
            errorMessage << "<";
        }
        if (tl[i].isPunctuation() && tl[i].pToken() == token::COLON)
        {
            errorMessage << "^";
        }
        else
        {
            errorMessage << tl[i];
        }
        if (i == toToken)
        {
            errorMessage << ">";
        }
    }

    FatalErrorIn(errorIn) << "Parsing error in the equation for "
        << operator[](index).name() << ", given by:" << endl
        << endl << token::TAB << operator[](index).rawText() << endl
        << endl << "Error occurs withing the < angle brackets >:" << endl
        << endl << token::TAB << errorMessage.str() << endl << endl
        << description.str()
        << abort(FatalError);
}
开发者ID:TsukasaHori,项目名称:openfoam-extend-foam-extend-3.1,代码行数:39,代码来源:equationReader.C

示例14: is

Foam::PtrList<Foam::dictionary> Foam::blockMesh::patchDicts() const
{
    const polyPatchList& patchTopologies = topology().boundaryMesh();

    PtrList<dictionary> patchDicts(patchTopologies.size());

    forAll(patchTopologies, patchI)
    {
        OStringStream os;
        patchTopologies[patchI].write(os);
        IStringStream is(os.str());
        patchDicts.set(patchI, new dictionary(is));
    }
开发者ID:AmaneShino,项目名称:OpenFOAM-2.0.x,代码行数:13,代码来源:blockMesh.C

示例15: args

bool Foam::functionEntries::calcEntry::execute
(
    const dictionary& parentDict,
    primitiveEntry& entry,
    Istream& is
)
{
    dictionary args(parentDict, is);
    OStringStream resultStream;
    resultStream
        << (args.lookup("x")[0].number() + args.lookup("y")[0].number());
    entry.read(parentDict, IStringStream(resultStream.str())());
    return true;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:14,代码来源:calcEntry.C


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