本文整理汇总了C++中StringBuffer::appendFormatted方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::appendFormatted方法的具体用法?C++ StringBuffer::appendFormatted怎么用?C++ StringBuffer::appendFormatted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::appendFormatted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
void ToHitStats::dump() const
{
StringBuffer buffer;
buffer.appendFormatted("Debugdump of ToHit of %s:\n", Owner->GetName(1));
buffer.appendFormatted("TOTAL: %d\n", total);
buffer.appendFormatted("Base: %2d\tGeneric: %d\tAbility: %d\n", base, genericBonus, abilityBonus);
buffer.appendFormatted("Armor: %d\tShield: %d\n", armorBonus, shieldBonus);
buffer.appendFormatted("Weapon: %d\tProficiency: %d\n\n", weaponBonus, proficiencyBonus);
Log(DEBUG, "ToHit", buffer);
}
示例2: PrintPossibleFiles
static void PrintPossibleFiles(StringBuffer& buffer, const char* ResRef, const TypeID *type)
{
const std::vector<ResourceDesc>& types = PluginMgr::Get()->GetResourceDesc(type);
for (size_t j = 0; j < types.size(); j++) {
buffer.appendFormatted("%s.%s ", ResRef, types[j].GetExt());
}
}
示例3: dump
void Door::dump() const
{
StringBuffer buffer;
buffer.appendFormatted( "Debugdump of Door %s:\n", GetScriptName() );
buffer.appendFormatted( "Door Global ID: %d\n", GetGlobalID());
buffer.appendFormatted( "Position: %d.%d\n", Pos.x, Pos.y);
buffer.appendFormatted( "Door Open: %s\n", YESNO(IsOpen()));
buffer.appendFormatted( "Door Locked: %s Difficulty: %d\n", YESNO(Flags&DOOR_LOCKED), LockDifficulty);
buffer.appendFormatted( "Door Trapped: %s Difficulty: %d\n", YESNO(Trapped), TrapRemovalDiff);
if (Trapped) {
buffer.appendFormatted( "Trap Permanent: %s Detectable: %s\n", YESNO(Flags&DOOR_RESET), YESNO(Flags&DOOR_DETECTABLE) );
}
buffer.appendFormatted( "Secret door: %s (Found: %s)\n", YESNO(Flags&DOOR_SECRET),YESNO(Flags&DOOR_FOUND));
const char *Key = GetKey();
const char *name = "NONE";
if (Scripts[0]) {
name = Scripts[0]->GetName();
}
buffer.appendFormatted( "Script: %s, Key (%s) removed: %s, Dialog: %s\n", name, Key?Key:"NONE", YESNO(Flags&DOOR_KEY), Dialog );
Log(DEBUG, "Door", buffer);
}
示例4: Exists
bool ResourceManager::Exists(const char *ResRef, const TypeID *type, bool silent) const
{
if (ResRef[0] == '\0')
return false;
// TODO: check various caches
const std::vector<ResourceDesc> &types = PluginMgr::Get()->GetResourceDesc(type);
for (size_t j = 0; j < types.size(); j++) {
for (size_t i = 0; i < searchPath.size(); i++) {
if (searchPath[i]->HasResource(ResRef, types[j])) {
return true;
}
}
}
if (!silent) {
StringBuffer buffer;
buffer.appendFormatted("Couldn't find '%s'... ", ResRef);
buffer.append("Tried ");
PrintPossibleFiles(buffer, ResRef,type);
Log(WARNING, "ResourceManager", buffer);
}
return false;
}
示例5: GetResource
Resource* ResourceManager::GetResource(const char* ResRef, const TypeID *type, bool silent, bool useCorrupt) const
{
if (ResRef[0] == '\0')
return NULL;
if (!silent) {
Log(MESSAGE, "ResourceManager", "Searching for '%s'...", ResRef);
}
const std::vector<ResourceDesc> &types = PluginMgr::Get()->GetResourceDesc(type);
for (size_t j = 0; j < types.size(); j++) {
for (size_t i = 0; i < searchPath.size(); i++) {
DataStream *str = searchPath[i]->GetResource(ResRef, types[j]);
if (!str && useCorrupt && core->UseCorruptedHack) {
// don't look at other paths if requested
core->UseCorruptedHack = false;
return NULL;
}
core->UseCorruptedHack = false;
if (str) {
Resource *res = types[j].Create(str);
if (res) {
if (!silent) {
Log(MESSAGE, "ResourceManager", "Found '%s.%s' in '%s'.",
ResRef, types[j].GetExt(), searchPath[i]->GetDescription());
}
return res;
}
}
}
}
if (!silent) {
StringBuffer buffer;
buffer.appendFormatted("Couldn't find '%s'... ", ResRef);
buffer.append("Tried ");
PrintPossibleFiles(buffer, ResRef,type);
Log(WARNING, "ResourceManager", buffer);
}
return NULL;
}
示例6: dump
void InfoPoint::dump() const
{
StringBuffer buffer;
switch (Type) {
case ST_TRIGGER:
buffer.appendFormatted( "Debugdump of InfoPoint Region %s:\n", GetScriptName() );
break;
case ST_PROXIMITY:
buffer.appendFormatted( "Debugdump of Trap Region %s:\n", GetScriptName() );
break;
case ST_TRAVEL:
buffer.appendFormatted( "Debugdump of Travel Region %s:\n", GetScriptName() );
break;
default:
buffer.appendFormatted( "Debugdump of Unsupported Region %s:\n", GetScriptName() );
break;
}
buffer.appendFormatted( "Region Global ID: %d\n", GetGlobalID());
buffer.appendFormatted( "Position: %d.%d\n", Pos.x, Pos.y);
buffer.appendFormatted( "TalkPos: %d.%d\n", TalkPos.x, TalkPos.y);
buffer.appendFormatted( "UsePoint: %d.%d (on: %s)\n", UsePoint.x, UsePoint.y, YESNO(GetUsePoint()));
switch(Type) {
case ST_TRAVEL:
buffer.appendFormatted( "Destination Area: %s Entrance: %s\n", Destination, EntranceName);
break;
case ST_PROXIMITY:
buffer.appendFormatted( "TrapDetected: %d, Trapped: %s\n", TrapDetected, YESNO(Trapped));
buffer.appendFormatted( "Trap detection: %d%%, Trap removal: %d%%\n", TrapDetectionDiff,
TrapRemovalDiff );
break;
case ST_TRIGGER:
buffer.appendFormatted ( "InfoString: %ls\n", OverheadText.c_str() );
break;
default:;
}
const char *name = "NONE";
if (Scripts[0]) {
name = Scripts[0]->GetName();
}
buffer.appendFormatted( "Script: %s, Key: %s, Dialog: %s\n", name, KeyResRef, Dialog );
buffer.appendFormatted( "Deactivated: %s\n", YESNO(Flags&TRAP_DEACTIVATED));
buffer.appendFormatted( "Active: %s\n", YESNO(InternalFlags&IF_ACTIVE));
Log(DEBUG, "InfoPoint", buffer);
}