本文整理汇总了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_();
}
示例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_();
}
示例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();
}
示例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;
}
示例5:
std::string
StringTools::toString( double value )
{
OStringStream stream;
stream << value;
return stream.str();
}
示例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());
}
示例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);
}
}
示例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())());
}
示例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();
}
示例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;
}
示例11: reactionStrLeft
Foam::string Foam::Reaction<ReactionThermo>::reactionStr
(
OStringStream& reaction
) const
{
reactionStrLeft(reaction);
reaction << " = ";
reactionStrRight(reaction);
return reaction.str();
}
示例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;
}
示例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);
}
示例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));
}
示例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