本文整理汇总了C++中std::stringstream::addTab方法的典型用法代码示例。如果您正苦于以下问题:C++ stringstream::addTab方法的具体用法?C++ stringstream::addTab怎么用?C++ stringstream::addTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::stringstream
的用法示例。
在下文中一共展示了stringstream::addTab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static bool
dumpSegments(std::stringstream & outBuffer,
yarp::os::Bottle & segmentsAsBottle,
const double scale)
#endif // ! defined(MpM_UseCustomStringBuffer)
{
ODL_ENTER(); //####
ODL_P2("outBuffer = ", &outBuffer, "segmentsAsBottle = ", &segmentsAsBottle); //####
ODL_D1("scale = ", scale); //####
bool okSoFar = true;
int numSegments = segmentsAsBottle.size();
if (0 < numSegments)
{
for (int ii = 0; okSoFar && (numSegments > ii); ++ii)
{
yarp::os::Value & aValue = segmentsAsBottle.get(ii);
if (aValue.isList())
{
yarp::os::Bottle * asList = aValue.asList();
if (asList && (2 == asList->size()))
{
yarp::os::Value & keyValue = asList->get(0);
yarp::os::Value & valueValue = asList->get(1);
if (keyValue.isString() && valueValue.isList())
{
YarpString keyString = keyValue.asString();
yarp::os::Bottle * valueList = valueValue.asList();
#if defined(MpM_UseCustomStringBuffer)
outBuffer.addString(keyString);
#else // ! defined(MpM_UseCustomStringBuffer)
outBuffer << keyString.c_str();
#endif // ! defined(MpM_UseCustomStringBuffer)
if (valueList && (7 == valueList->size()))
{
int numValues = valueList->size();
for (int jj = 0; okSoFar && (numValues > jj); ++jj)
{
double elementAsDouble;
yarp::os::Value & valueElement = valueList->get(jj);
if (valueElement.isDouble())
{
elementAsDouble = valueElement.asDouble();
}
else if (valueElement.isInt())
{
elementAsDouble = valueElement.asInt();
}
else
{
cerr << "value not an integer or a float" << endl; //!!!!
okSoFar = false;
}
if (okSoFar)
{
if (3 > jj)
{
elementAsDouble *= scale;
}
#if defined(MpM_UseCustomStringBuffer)
outBuffer.addTab().addDouble(elementAsDouble);
#else // ! defined(MpM_UseCustomStringBuffer)
outBuffer << "\t" << elementAsDouble;
#endif // ! defined(MpM_UseCustomStringBuffer)
}
}
#if defined(MpM_UseCustomStringBuffer)
outBuffer.addString(LINE_END_);
#else // ! defined(MpM_UseCustomStringBuffer)
outBuffer << LINE_END_;
#endif // ! defined(MpM_UseCustomStringBuffer)
}
else
{
cerr << "bad list pointer or incorrect list size" << endl; //!!!!
okSoFar = false;
}
}
else
{
cerr << "segment not a string and a list" << endl; //!!!!
okSoFar = false;
}
}
else
{
cerr << "segment not a 2-element list" << endl; //!!!!
okSoFar = false;
}
}
else
{
cerr << "segment not a list" << endl; //!!!!
okSoFar = false;
//.........这里部分代码省略.........