本文整理汇总了C++中common::UString::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::begin方法的具体用法?C++ UString::begin怎么用?C++ UString::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::UString
的用法示例。
在下文中一共展示了UString::begin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsePassword
void parsePassword(const Common::UString &arg, std::vector<byte> &password) {
const size_t length = arg.size();
password.clear();
password.reserve(length / 2);
size_t i = 0;
byte c = 0x00;
for (Common::UString::iterator s = arg.begin(); s != arg.end(); ++s, i++) {
byte d = 0;
if (*s >= '0' && *s <= '9')
d = *s - '0';
else if (*s >= 'a' && *s <= 'f')
d = *s - 'a' + 10;
else if (*s >= 'A' && *s <= 'F')
d = *s - 'A' + 10;
else
throw Common::Exception("0x%08X is not a valid hex digit", (uint) *s);
if ((i % 2) == 1) {
c |= d;
password.push_back(c);
c = 0x00;
} else
c |= d << 4;
}
}
示例2: findWordStart
uint32 ConsoleWindow::findWordStart(const Common::UString &line, uint32 pos) {
Common::UString::iterator it = line.getPosition(pos);
if ((it == line.end()) || (*it == ' '))
return 0;
while ((it != line.begin()) && (*it != ' '))
--it;
if (*it == ' ')
++it;
return line.getPosition(it);
}
示例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: createDisplayName
// "Elfland: The Woods" -> "The Woods"
Common::UString Area::createDisplayName(const Common::UString &name) {
for (Common::UString::iterator it = name.begin(); it != name.end(); ++it) {
if (*it == ':') {
if (++it == name.end())
break;
if (*it == ' ')
if (++it == name.end())
break;
return Common::UString(it, name.end());
}
}
return name;
}
示例5: parseOption
static bool parseOption(const Common::UString &arg, Common::UString &key) {
if (arg.size() < 2) {
warning("Unrecognized command line argument \"%s\"", arg.c_str());
return false;
}
Common::UString::iterator start = arg.begin();
++start;
Common::UString value;
if (*start == '-') {
// Long option
++start;
Common::UString::iterator e = arg.findFirst('=');
if (e != arg.end()) {
key = arg.substr(start, e++);
value = arg.substr(e, arg.end());
} else
key = arg.substr(start, arg.end());
} else {
// Short option
key = convertShortToLongOption(*start++);
value = arg.substr(start, arg.end());
}
if (key.empty()) {
warning("Unrecognized command line argument \"%s\"", arg.c_str());
return false;
}
if (value.empty())
return true;
if (!setOption(key, value))
return false;
return true;
}
示例6: createDisplayName
Common::UString createDisplayName(const Common::UString &name) {
bool inBrace = false;
Common::UString displayName;
for (Common::UString::iterator it = name.begin(); it != name.end(); ++it) {
if (*it == '{') {
inBrace = true;
continue;
}
if (*it == '}') {
inBrace = false;
continue;
}
if (!inBrace)
displayName += *it;
}
return displayName;
}
示例7: escape
Common::UString XMLWriter::escape(const Common::UString &str) {
Common::UString escaped;
for (Common::UString::iterator s = str.begin(); s != str.end(); ++s) {
uint32 c = *s;
if (c == '\"')
escaped += """;
else if (c == '\'')
escaped += "'";
else if (c == '&')
escaped += "&";
else if (c == '<')
escaped += "<";
else if (c == '>')
escaped += ">";
else
escaped += c;
}
return escaped;
}
示例8: drawLine
void Text::drawLine(const Common::UString &line,
ColorPositions::const_iterator color, size_t position) {
Font &font = _font.getFont();
// Horizontal Align
glTranslatef(roundf((_width - font.getLineWidth(line)) * _halign), 0.0f, 0.0f);
// Draw line
for (Common::UString::iterator s = line.begin(); s != line.end(); ++s, position++) {
// If we have color changes, apply them
while ((color != _colors.end()) && (color->position <= position)) {
if (color->defaultColor)
glColor4f(_r, _g, _b, _a);
else
glColor4f(color->r, color->g, color->b, color->a);
++color;
}
font.draw(*s);
}
}
示例9: buildChars
void TTFFont::buildChars(const Common::UString &str) {
for (Common::UString::iterator c = str.begin(); c != str.end(); ++c)
addChar(*c);
rebuildPages();
}