当前位置: 首页>>代码示例>>C++>>正文


C++ UString::begin方法代码示例

本文整理汇总了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;
    }
}
开发者ID:idkwim,项目名称:xoreos-tools,代码行数:30,代码来源:unerf.cpp

示例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);
}
开发者ID:EffWun,项目名称:xoreos,代码行数:13,代码来源:console.cpp

示例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;
}
开发者ID:TC01,项目名称:phaethon,代码行数:13,代码来源:util.cpp

示例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;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:17,代码来源:area.cpp

示例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;
}
开发者ID:ImperatorPrime,项目名称:xoreos,代码行数:42,代码来源:cline.cpp

示例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;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:21,代码来源:util.cpp

示例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 += "&quot;";
		else if (c == '\'')
			escaped += "&apos;";
		else if (c == '&')
			escaped += "&amp;";
		else if (c == '<')
			escaped += "&lt;";
		else if (c == '>')
			escaped += "&gt;";
		else
			escaped += c;

	}

	return escaped;
}
开发者ID:EffWun,项目名称:xoreos-tools,代码行数:23,代码来源:xmlwriter.cpp

示例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);
	}
}
开发者ID:farmboy0,项目名称:xoreos,代码行数:23,代码来源:text.cpp

示例9: buildChars

void TTFFont::buildChars(const Common::UString &str) {
	for (Common::UString::iterator c = str.begin(); c != str.end(); ++c)
		addChar(*c);

	rebuildPages();
}
开发者ID:cc9cii,项目名称:xoreos,代码行数:6,代码来源:ttffont.cpp


注:本文中的common::UString::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。