本文整理汇总了C++中stringutil::StrStreamType类的典型用法代码示例。如果您正苦于以下问题:C++ StrStreamType类的具体用法?C++ StrStreamType怎么用?C++ StrStreamType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StrStreamType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToString
void Version::ToString(String& text) const
{
StringUtil::StrStreamType versionText;
//Find the last non-zero component
int lastNonzeroComponent = -1;
for (int index = MAX_COMPONENTS - 1; index >= 0; index--)
{
if (this->components[index] != 0)
{
lastNonzeroComponent = index;
break;
}
}
//Output everything up to the last non-zero component
if (lastNonzeroComponent >= 0)
{
for (int index = 0; index <= lastNonzeroComponent; index++)
{
versionText << this->components[index];
if (index < lastNonzeroComponent)
versionText << ".";
}
}
else
{
//All components are zero
versionText << "0";
}
text = versionText.str();
}
示例2: reportLeaks
//--------------------------------------------------------------------------
void MemoryTracker::reportLeaks()
{
StringUtil::StrStreamType os;
if (mAllocations.empty())
os << "No leaks!";
else
{
size_t totalMem = 0;
os << "Leaks detected:" << std::endl << std::endl;
for (AllocationMap::const_iterator i = mAllocations.begin(); i != mAllocations.end(); ++i)
{
const Alloc& alloc = i->second;
if (!alloc.filename.empty())
os << alloc.filename << "(" << alloc.line << ", " << alloc.function << "): ";
else
os << "(unknown source): ";
os << alloc.bytes << " bytes";
os << std::endl;
totalMem += alloc.bytes;
}
os << std::endl;
os << mAllocations.size() << " leaks detected, " << totalMem << " bytes total";
}
if (mDumpToStdOut)
std::cout << os.str();
std::ofstream of;
of.open(mLeakFileName.c_str());
of << os.str();
of.close();
}
示例3: _freeUnusedBufferCopies
//-----------------------------------------------------------------------
void HardwareBufferManagerBase::_freeUnusedBufferCopies(void)
{
OGRE_LOCK_MUTEX(mTempBuffersMutex);
size_t numFreed = 0;
// Free unused temporary buffers
FreeTemporaryVertexBufferMap::iterator i;
i = mFreeTempVertexBufferMap.begin();
while (i != mFreeTempVertexBufferMap.end())
{
FreeTemporaryVertexBufferMap::iterator icur = i++;
// Free the temporary buffer that referenced by ourself only.
// TODO: Some temporary buffers are bound to vertex buffer bindings
// but not checked out, need to sort out method to unbind them.
if (icur->second.useCount() <= 1)
{
++numFreed;
mFreeTempVertexBufferMap.erase(icur);
}
}
StringUtil::StrStreamType str;
if (numFreed)
{
str << "HardwareBufferManager: Freed " << numFreed << " unused temporary vertex buffers.";
}
else
{
str << "HardwareBufferManager: No unused temporary vertex buffers found.";
}
LogManager::getSingleton().logMessage(str.str(), LML_TRIVIAL);
}
示例4: ParseHardwareBufferUsage
HardwareBuffer::Usage OgreMaxUtilities::ParseHardwareBufferUsage(const String& usage)
{
String usageLower = usage;
StringUtil::toLowerCase(usageLower);
if (usageLower == "static")
return HardwareBuffer::HBU_STATIC;
else if (usageLower == "dynamic")
return HardwareBuffer::HBU_DYNAMIC;
else if (usageLower == "writeonly")
return HardwareBuffer::HBU_WRITE_ONLY;
else if (usageLower == "staticwriteonly")
return HardwareBuffer::HBU_STATIC_WRITE_ONLY;
else if (usageLower == "dynamicwriteonly")
return HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid hardware buffer usage specified: " << usage;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParseHardwareBufferUsage"
);
}
示例5: ParseShadowTechnique
ShadowTechnique OgreMaxUtilities::ParseShadowTechnique(const String& technique)
{
String techniqueLower = technique;
StringUtil::toLowerCase(techniqueLower);
if (techniqueLower == "none")
return SHADOWTYPE_NONE;
else if (techniqueLower == "stencilmodulative")
return SHADOWTYPE_STENCIL_MODULATIVE;
else if (techniqueLower == "stenciladditive")
return SHADOWTYPE_STENCIL_ADDITIVE;
else if (techniqueLower == "texturemodulative")
return SHADOWTYPE_TEXTURE_MODULATIVE;
else if (techniqueLower == "textureadditive")
return SHADOWTYPE_TEXTURE_ADDITIVE;
else if (techniqueLower == "texturemodulativeintegrated")
return SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED;
else if (techniqueLower == "textureadditiveintegrated")
return SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid shadow technique specified: " << technique;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParseShadowTechnique"
);
}
示例6: ParseBillboardOrigin
BillboardOrigin OgreMaxUtilities::ParseBillboardOrigin(const String& origin)
{
String originLower = origin;
StringUtil::toLowerCase(originLower);
if (originLower == "topleft")
return BBO_TOP_LEFT;
else if (originLower == "topcenter")
return BBO_TOP_CENTER;
else if (originLower == "topright")
return BBO_TOP_RIGHT;
else if (originLower == "centerleft")
return BBO_CENTER_LEFT;
else if (originLower == "center")
return BBO_CENTER;
else if (originLower == "centerright")
return BBO_CENTER_RIGHT;
else if (originLower == "bottomleft")
return BBO_BOTTOM_LEFT;
else if (originLower == "bottomcenter")
return BBO_BOTTOM_CENTER;
else if (originLower == "bottomright")
return BBO_BOTTOM_RIGHT;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid billboard origin specified: " << origin;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParseBillboardOrigin"
);
}
示例7: ParticleAffector
//-----------------------------------------------------------------------
ColourInterpolatorAffector::ColourInterpolatorAffector(ParticleSystem* psys)
: ParticleAffector(psys)
{
for (int i=0;i<MAX_STAGES;i++)
{
// set default colour to transparent grey, transparent since we might not want to display the particle here
// grey because when a colour component is 0.5f the maximum difference to another colour component is 0.5f
mColourAdj[i] = ColourValue(0.5f, 0.5f, 0.5f, 0.0f);
mTimeAdj[i] = 1.0f;
}
mType = "ColourInterpolator";
// Init parameters
if (createParamDictionary("ColourInterpolatorAffector"))
{
ParamDictionary* dict = getParamDictionary();
for (int i=0;i<MAX_STAGES;i++)
{
msColourCmd[i].mIndex = i;
msTimeCmd[i].mIndex = i;
StringUtil::StrStreamType stage;
stage << i;
String colour_title = String("colour") + stage.str();
String time_title = String("time") + stage.str();
String colour_descr = String("Stage ") + stage.str() + String(" colour.");
String time_descr = String("Stage ") + stage.str() + String(" time.");
dict->addParameter(ParameterDef(colour_title, colour_descr, PT_COLOURVALUE), &msColourCmd[i]);
dict->addParameter(ParameterDef(time_title, time_descr, PT_REAL), &msTimeCmd[i]);
}
}
}
示例8:
void Win32GLSupport::setConfigOption(const String &name, const String &value)
{
ConfigOptionMap::iterator it = mOptions.find(name);
// Update
if(it != mOptions.end())
it->second.currentValue = value;
else
{
StringUtil::StrStreamType str;
str << "Option named '" << name << "' does not exist.";
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, str.str(), "Win32GLSupport::setConfigOption" );
}
if( name == "Video Mode" )
refreshConfig();
if( name == "Full Screen" )
{
it = mOptions.find( "Display Frequency" );
if( value == "No" )
{
it->second.currentValue = "N/A";
it->second.immutable = true;
}
else
{
if (it->second.currentValue.empty() || it->second.currentValue == "N/A")
it->second.currentValue = it->second.possibleValues.front();
it->second.immutable = false;
}
}
}
示例9: prepareMaterialInstance
//------------------------------------------------------
void MaterialService::prepareMaterialInstance(MaterialPtr& mat, unsigned int idx, int tag) {
if (tag < 0) // Should not be here if the polygon is sky textured
OPDE_EXCEPT("Non-instanced material instance requested", "MaterialService::prepareMaterialInstance");
mat->setReceiveShadows(true);
StringUtil::StrStreamType lightmapName;
lightmapName << "@lightmap" << tag;
Pass *shadPass = mat->getTechnique(0)->getPass(0);
if (shadPass->getNumTextureUnitStates() <= 1) {
// Lightmap texture is added here
TextureUnitState* tex = shadPass->createTextureUnitState(lightmapName.str());
// Blend
tex->setColourOperation(LBO_MODULATE);
// Use 2nd texture co-ordinate set
tex->setTextureCoordSet(1);
// Clamp
tex->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
// Switch filtering off to see lmap pixels: TFO_NONE
tex->setTextureFiltering(TFO_BILINEAR);
} else {
// There is a definition of the lightmapping pass already, we only update that definition
TextureUnitState* tex = shadPass->getTextureUnitState(1);
tex->setTextureName(lightmapName.str());
tex->setTextureCoordSet(1);
}
}
示例10: processResponse
//---------------------------------------------------------------------
void DefaultWorkQueueBase::processResponse(Response* r)
{
StringUtil::StrStreamType dbgMsg;
dbgMsg << "thread:" <<
#if OGRE_THREAD_SUPPORT
OGRE_THREAD_CURRENT_ID
#else
"main"
#endif
<< "): ID=" << r->getRequest()->getID()
<< " success=" << r->succeeded() << " messages=[" << r->getMessages() << "] channel="
<< r->getRequest()->getChannel() << " requestType=" << r->getRequest()->getType();
LogManager::getSingleton().stream(LML_TRIVIAL) <<
"DefaultWorkQueueBase('" << mName << "') - PROCESS_RESPONSE_START(" << dbgMsg.str();
ResponseHandlerListByChannel::iterator i = mResponseHandlers.find(r->getRequest()->getChannel());
if (i != mResponseHandlers.end())
{
ResponseHandlerList& handlers = i->second;
for (ResponseHandlerList::reverse_iterator j = handlers.rbegin(); j != handlers.rend(); ++j)
{
if ((*j)->canHandleResponse(r, this))
{
(*j)->handleResponse(r, this);
}
}
}
LogManager::getSingleton().stream(LML_TRIVIAL) <<
"DefaultWorkQueueBase('" << mName << "') - PROCESS_RESPONSE_END(" << dbgMsg.str();
}
示例11: ParseBillboardType
BillboardType OgreMaxUtilities::ParseBillboardType(const String& type)
{
String typeLower = type;
StringUtil::toLowerCase(typeLower);
if (typeLower == "point")
return BBT_POINT;
else if (typeLower == "orientedcommon")
return BBT_ORIENTED_COMMON;
else if (typeLower == "orientedself")
return BBT_ORIENTED_SELF;
else if (typeLower == "perpendicularcommon")
return BBT_PERPENDICULAR_COMMON;
else if (typeLower == "perpendicularself")
return BBT_PERPENDICULAR_SELF;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid billboard type specified: " << type;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParseBillboardType"
);
}
示例12: ParseBoundingVolumeType
BoundingVolume::Type OgreMaxUtilities::ParseBoundingVolumeType(const String& type)
{
String typeLower = type;
StringUtil::toLowerCase(typeLower);
if (typeLower == "sphere")
return BoundingVolume::SPHERE;
else if (typeLower == "box")
return BoundingVolume::BOX;
else if (typeLower == "cylinder")
return BoundingVolume::CYLINDER;
else if (typeLower == "capsule")
return BoundingVolume::CAPSULE;
else if (typeLower == "mesh")
return BoundingVolume::MESH;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid bounding volume type specified: " << type;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParseBoundingVolumeType"
);
}
示例13: driverDescription
String D3D9Driver::DriverDescription() const
{
StringUtil::StrStreamType str;
str << "Monitor-" << (mAdapterNumber+1) << "-" << mAdapterIdentifier.Description;
String driverDescription(str.str());
StringUtil::trim(driverDescription);
return driverDescription;
}
示例14: ParsePixelFormat
PixelFormat OgreMaxUtilities::ParsePixelFormat(const String& pixelFormat)
{
static bool initialized = false;
static std::map<String, PixelFormat> nameToFormat;
if (!initialized)
{
nameToFormat["PF_L8"] = PF_L8;
nameToFormat["PF_L16"] = PF_L16;
nameToFormat["PF_A8"] = PF_A8;
nameToFormat["PF_A4L4"] = PF_A4L4;
nameToFormat["PF_BYTE_LA"] = PF_BYTE_LA;
nameToFormat["PF_R5G6B5"] = PF_R5G6B5;
nameToFormat["PF_B5G6R5"] = PF_B5G6R5;
nameToFormat["PF_R3G3B2"] = PF_R3G3B2;
nameToFormat["PF_A4R4G4B4"] = PF_A4R4G4B4;
nameToFormat["PF_A1R5G5B5"] = PF_A1R5G5B5;
nameToFormat["PF_R8G8B8"] = PF_R8G8B8;
nameToFormat["PF_B8G8R8"] = PF_B8G8R8;
nameToFormat["PF_A8R8G8B8"] = PF_A8R8G8B8;
nameToFormat["PF_A8B8G8R8"] = PF_A8B8G8R8;
nameToFormat["PF_B8G8R8A8"] = PF_B8G8R8A8;
nameToFormat["PF_R8G8B8A8"] = PF_R8G8B8A8;
nameToFormat["PF_X8R8G8B8"] = PF_X8R8G8B8;
nameToFormat["PF_X8B8G8R8"] = PF_X8B8G8R8;
nameToFormat["PF_A2R10G10B10"] = PF_A2R10G10B10;
nameToFormat["PF_A2B10G10R10"] = PF_A2B10G10R10;
nameToFormat["PF_FLOAT16_R"] = PF_FLOAT16_R;
nameToFormat["PF_FLOAT16_RGB"] = PF_FLOAT16_RGB;
nameToFormat["PF_FLOAT16_RGBA"] = PF_FLOAT16_RGBA;
nameToFormat["PF_FLOAT32_R"] = PF_FLOAT32_R;
nameToFormat["PF_FLOAT32_RGB"] = PF_FLOAT32_RGB;
nameToFormat["PF_FLOAT32_RGBA"] = PF_FLOAT32_RGBA;
nameToFormat["PF_FLOAT16_GR"] = PF_FLOAT16_GR;
nameToFormat["PF_FLOAT32_GR"] = PF_FLOAT32_GR;
nameToFormat["PF_DEPTH"] = PF_DEPTH;
nameToFormat["PF_SHORT_RGBA"] = PF_SHORT_RGBA;
nameToFormat["PF_SHORT_GR"] = PF_SHORT_GR;
nameToFormat["PF_SHORT_RGB"] = PF_SHORT_RGB;
initialized = true;
}
std::map<String, PixelFormat>::iterator format = nameToFormat.find(pixelFormat);
if (format != nameToFormat.end())
return format->second;
StringUtil::StrStreamType errorMessage;
errorMessage << "Invalid pixel format specified: " << pixelFormat;
OGRE_EXCEPT
(
Exception::ERR_INVALIDPARAMS,
errorMessage.str(),
"OgreMaxUtilities::ParsePixelFormat"
);
}
示例15: toString
//-----------------------------------------------------------------------
String StringConverter::toString(unsigned long val,
unsigned short width, char fill, std::ios::fmtflags flags)
{
StringUtil::StrStreamType stream;
stream.width(width);
stream.fill(fill);
if (flags)
stream.setf(flags);
stream << val;
return stream.str();
}