本文整理汇总了C++中common::UString::beginsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::beginsWith方法的具体用法?C++ UString::beginsWith怎么用?C++ UString::beginsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::UString
的用法示例。
在下文中一共展示了UString::beginsWith方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRosterMemberByTemplate
/** Add a creature by template name to the roster list. */
bool Roster::addRosterMemberByTemplate(Common::UString name, Common::UString cTemplate) {
// Disallow null strings
if (name.size() == 0 || cTemplate.size() == 0)
return false;
// Don't permit duplicate roster names
auto match = std::find_if(_members.begin(), _members.end(), [&](const Member &m) {
return m.rosterName == name;
});
if (match != _members.end())
return false;
// A matching template file must exist
if (!ResMan.hasResource(cTemplate, Aurora::kFileTypeUTC)) {
// HACK: Check for custom unit test token "[GTEST]" at start
if (!cTemplate.beginsWith("[GTEST]"))
return false;
}
// Add roster member to the list
Member member;
member.rosterName = name;
member.cTemplate = cTemplate;
_members.push_back(member);
// TODO: Template is not stored in ROSTER.rst, so load creature into game for saving, but don't spawn
return true;
}
示例2: relativize
UString FilePath::relativize(const UString &basePath, const UString &path) {
const Common::UString normPath = normalize(path, false);
const Common::UString normBase = normalize(basePath, false);
UString relative = "";
if (normPath.beginsWith(normBase))
relative = normPath.substr(normPath.getPosition(normBase.size() + 1), normPath.end());
return relative;
}
示例3: getExtension
Common::UString FileTypeManager::getExtension(FileType type) {
buildTypeLookup();
Common::UString ext;
TypeLookup::const_iterator t = _typeLookup.find(type);
if (t != _typeLookup.end())
ext = t->second->extension;
if (ext.beginsWith("."))
ext.erase(ext.begin());
return ext;
}
示例4: loadPortrait
void Creature::loadPortrait(const Aurora::GFF3Struct &gff) {
uint32 portraitID = gff.getUint("PortraitId");
if (portraitID != 0) {
const Aurora::TwoDAFile &twoda = TwoDAReg.get2DA("portraits");
Common::UString portrait = twoda.getRow(portraitID).getString("BaseResRef");
if (!portrait.empty()) {
if (portrait.beginsWith("po_"))
_portrait = portrait;
else
_portrait = "po_" + portrait;
}
}
_portrait = gff.getString("Portrait", _portrait);
}
示例5: load
void Model_Witcher::load(ParserContext &ctx) {
if (ctx.mdb->readByte() != 0) {
ctx.mdb->seek(0);
Common::UString type = Common::readString(*ctx.mdb, Common::kEncodingASCII);
if (type.beginsWith("binarycompositemodel"))
throw Common::Exception("TODO: binarycompositemodel");
throw Common::Exception("Not a The Witcher MDB file");
}
ctx.mdb->seek(4);
ctx.fileVersion = ctx.mdb->readUint32LE() & 0x0FFFFFFF;
if ((ctx.fileVersion != 136) && (ctx.fileVersion != 133))
throw Common::Exception("Unknown The Witcher MDB version %d", ctx.fileVersion);
uint32 modelCount = ctx.mdb->readUint32LE();
if (modelCount != 1)
throw Common::Exception("Unsupported model count %d in The Witcher MDB", modelCount);
ctx.mdb->skip(4);
ctx.modelDataSize = ctx.mdb->readUint32LE();
ctx.mdb->skip(4);
ctx.offModelData = 32;
if (ctx.fileVersion == 133) {
ctx.offRawData = ctx.mdb->readUint32LE() + ctx.offModelData;
ctx.rawDataSize = ctx.mdb->readUint32LE();
ctx.offTexData = ctx.offModelData;
ctx.texDatasize = 0;
} else {
ctx.offRawData = ctx.offModelData;
ctx.rawDataSize = 0;
ctx.offTexData = ctx.mdb->readUint32LE() + ctx.offModelData;
ctx.texDatasize = ctx.mdb->readUint32LE();
}
ctx.mdb->skip(8);
_name = Common::readStringFixed(*ctx.mdb, Common::kEncodingASCII, 64);
uint32 offsetRootNode = ctx.mdb->readUint32LE();
ctx.mdb->skip(32);
byte type = ctx.mdb->readByte();
ctx.mdb->skip(3);
ctx.mdb->skip(48);
float firstLOD = ctx.mdb->readIEEEFloatLE();
float lastLOD = ctx.mdb->readIEEEFloatLE();
ctx.mdb->skip(16);
Common::UString detailMap = Common::readStringFixed(*ctx.mdb, Common::kEncodingASCII, 64);
ctx.mdb->skip(4);
float modelScale = ctx.mdb->readIEEEFloatLE();
Common::UString superModel = Common::readStringFixed(*ctx.mdb, Common::kEncodingASCII, 64);
ctx.mdb->skip(16);
newState(ctx);
ModelNode_Witcher *rootNode = new ModelNode_Witcher(*this);
ctx.nodes.push_back(rootNode);
ctx.mdb->seek(ctx.offModelData + offsetRootNode);
rootNode->load(ctx);
addState(ctx);
}
示例6: fixWidgetType
void CharSpells::fixWidgetType(const Common::UString &tag, GUI::WidgetType &type) {
if (tag.beginsWith("SpellLevel"))
type = kWidgetTypeButton;
}
示例7: load
void Model_Witcher::load(ParserContext &ctx) {
if (ctx.mdb->readByte() != 0) {
ctx.mdb->seek(0);
Common::UString type;
type.readASCII(*ctx.mdb);
if (type.beginsWith("binarycompositemodel"))
throw Common::Exception("TODO: binarycompositemodel");
throw Common::Exception("Not a The Witcher MDB file");
}
ctx.mdb->seek(4);
ctx.fileVersion = ctx.mdb->readUint16LE();
ctx.mdb->skip(10);
ctx.modelDataSize = ctx.mdb->readUint32LE();
ctx.mdb->skip(4);
ctx.offModelData = 32;
if (ctx.fileVersion == 133) {
ctx.offRawData = ctx.mdb->readUint32LE() + ctx.offModelData;
ctx.rawDataSize = ctx.mdb->readUint32LE();
ctx.offTexData = ctx.offModelData;
ctx.texDatasize = 0;
} else {
ctx.offRawData = ctx.offModelData;
ctx.rawDataSize = 0;
ctx.offTexData = ctx.mdb->readUint32LE() + ctx.offModelData;
ctx.texDatasize = ctx.mdb->readUint32LE();
}
ctx.mdb->skip(8);
_name.readFixedASCII(*ctx.mdb, 64);
uint32 offsetRootNode = ctx.mdb->readUint32LE();
ctx.mdb->skip(32);
byte type = ctx.mdb->readByte();
ctx.mdb->skip(3);
ctx.mdb->skip(48);
float firstLOD = ctx.mdb->readIEEEFloatLE();
float lastLOD = ctx.mdb->readIEEEFloatLE();
ctx.mdb->skip(16);
Common::UString detailMap;
detailMap.readFixedASCII(*ctx.mdb, 64);
ctx.mdb->skip(4);
float scale = ctx.mdb->readIEEEFloatLE();
Common::UString superModel;
superModel.readFixedASCII(*ctx.mdb, 64);
ctx.mdb->skip(16);
newState(ctx);
ModelNode_Witcher *rootNode = new ModelNode_Witcher(*this);
ctx.nodes.push_back(rootNode);
ctx.mdb->seek(ctx.offModelData + offsetRootNode);
rootNode->load(ctx);
addState(ctx);
}