• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ aurora::LocString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中aurora::LocString的典型用法代码示例。如果您正苦于以下问题:C++ LocString类的具体用法?C++ LocString怎么用?C++ LocString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了LocString类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: loadProperties

void Waypoint::loadProperties(const Aurora::GFFStruct &gff) {
	// Tag

	_tag = gff.getString("Tag", _tag);

	// Map note

	_hasMapNote = gff.getBool("MapNoteEnabled", _hasMapNote);
	if (gff.hasField("MapNote")) {
		Aurora::LocString mapNote;
		gff.getLocString("MapNote", mapNote);

		_mapNote = mapNote.getString();
	}
}
开发者ID:jjardon,项目名称:eos,代码行数:15,代码来源:waypoint.cpp


示例2: stream

GTEST_TEST_F(LocString, wrongEncodingNonUTF8) {
	if (!Common::hasSupportEncoding(Common::kEncodingCP1252)) {
		const ::testing::TestInfo* const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();

		std::fprintf(stderr, "Skipping %s.%s\n", testInfo->test_case_name(),  testInfo->name());
		return;
	}

	static const byte kData[] = { 0x04, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x81 };
	Common::MemoryReadStream stream(kData);

	Aurora::LocString locString;
	locString.readString(2, stream);

	EXPECT_STREQ(locString.getString().c_str(), "[!?!]");
}
开发者ID:asr1,项目名称:xoreos-tools,代码行数:16,代码来源:locstring.cpp


示例3: loadProperties

void Situated::loadProperties(const Aurora::GFFStruct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name
	if (gff.hasField("LocName")) {
		Aurora::LocString name;
		gff.getLocString("LocName", name);

		_name = name.getString();
	}

	// Description
	if (gff.hasField("Description")) {
		Aurora::LocString description;
		gff.getLocString("Description", description);

		_description = description.getString();
	}

	// Portrait
	loadPortrait(gff);

	// Appearance
	_appearanceID = gff.getUint("Appearance", _appearanceID);

	// Conversation
	_conversation = gff.getString("Conversation", _conversation);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// Locked
	_locked = gff.getBool("Locked", _locked);

	// Scripts
	readScripts(gff);
}
开发者ID:cc9cii,项目名称:xoreos,代码行数:41,代码来源:situated.cpp


示例4: loadProperties

void Creature::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name

	Aurora::LocString firstName;
	gff.getLocString("FirstName", firstName);
	Aurora::LocString lastName;
	gff.getLocString("LastName", lastName);

	if (!firstName.empty()) {
		_name = firstName.getString();
		if (!lastName.empty())
			_name += " " + lastName.getString();
	}


	// Description
	_description = gff.getString("Description", _description);

	// Portrait
	loadPortrait(gff);

	// Equipment
	loadEquipment(gff);

	// Appearance
	_appearance = gff.getUint("Appearance_Type", _appearance);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// PC
	_isPC = gff.getBool("IsPC", _isPC);

	// Gender
	_gender = Gender(gff.getUint("Gender"));

	// Race
	_race = Race(gff.getSint("Race", _race));
	_subRace = SubRace(gff.getSint("SubraceIndex", _subRace));

	// Hit Points
	_currentHitPoints = gff.getSint("CurrentHitPoints", _maxHitPoints);
	_maxHitPoints = gff.getSint("MaxHitPoints", _currentHitPoints);

	_minOneHitPoint = gff.getBool("Min1HP", _minOneHitPoint);

	// Faction
	_faction = Faction(gff.getUint("FactionID"));

	// Scripts
	readScripts(gff);

	_conversation = gff.getString("Conversation", _conversation);
}
开发者ID:mirv-sillyfish,项目名称:xoreos,代码行数:60,代码来源:creature.cpp


示例5: readStream

GTEST_TEST_F(LocString, write) {
	Aurora::LocString locString;
	locString.setString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderMale, "String to test");
	locString.setString(Aurora::kLanguageFrench, Aurora::kLanguageGenderMale, "String pour tester");

	Common::MemoryWriteStreamDynamic *writeStream = new Common::MemoryWriteStreamDynamic(true);
	locString.writeLocString(*writeStream);

	Aurora::LocString locString2;
	Common::MemoryReadStream readStream(writeStream->getData(), writeStream->size());
	EXPECT_EQ(readStream.readUint32LE(), 0);
	EXPECT_EQ(readStream.readUint32LE(), 14);
	Common::UString englishString = Common::readStringFixed(readStream, Common::kEncodingASCII, 14);
	EXPECT_STREQ(englishString.c_str(), "String to test");

	EXPECT_EQ(readStream.readUint32LE(), 2);
	EXPECT_EQ(readStream.readUint32LE(), 18);
	Common::UString frenchString = Common::readStringFixed(readStream, Common::kEncodingASCII, 18);
	EXPECT_STREQ(frenchString.c_str(), "String pour tester");

	delete writeStream;
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:22,代码来源:locstring.cpp


示例6:

GTEST_TEST_F(LocString, setStringGender) {
	Aurora::LocString locString;

	locString.setString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderFemale, kUTF8String);

	EXPECT_FALSE(locString.hasString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderMale  ));
	EXPECT_TRUE(locString.hasString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderFemale));

	EXPECT_STREQ(locString.getString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderMale  ).c_str(),
	             "");
	EXPECT_STREQ(locString.getString(Aurora::kLanguageEnglish, Aurora::kLanguageGenderFemale).c_str(),
	             kUTF8String);

	EXPECT_STREQ(locString.getFirstString().c_str(), kUTF8String);

	EXPECT_STREQ(locString.getString().c_str(), kUTF8String);
}
开发者ID:asr1,项目名称:xoreos-tools,代码行数:17,代码来源:locstring.cpp


示例7:

void GFF3Dumper::dumpLocString(const Aurora::LocString &locString) {
	std::vector<Aurora::LocString::SubLocString> str;
	locString.getStrings(str);

	if (!str.empty())
		_xml->breakLine();

	for (std::vector<Aurora::LocString::SubLocString>::iterator s = str.begin(); s != str.end(); ++s) {
		_xml->openTag("string");
		_xml->addProperty("language", Common::composeString(s->language));

		_xml->setContents(s->str);
		_xml->closeTag();
		_xml->breakLine();
	}
}
开发者ID:idkwim,项目名称:xoreos-tools,代码行数:16,代码来源:gff3dumper.cpp


示例8: catch

void GFF3Dumper::dumpField(const Aurora::GFF3Struct &strct, const Common::UString &field) {
	Aurora::GFF3Struct::FieldType type = strct.getType(field);

	Common::UString typeName;
	if (((size_t) type) < ARRAYSIZE(kGFF3FieldTypeNames))
		typeName = kGFF3FieldTypeNames[(int)type];
	else
		typeName = "filetype" + Common::composeString((uint64) type);

	Common::UString label = field;

	// Structs already open their own tag
	if (type != Aurora::GFF3Struct::kFieldTypeStruct) {
		_xml->openTag(typeName);
		_xml->addProperty("label", label);
	}

	switch (type) {
		case Aurora::GFF3Struct::kFieldTypeChar:
			_xml->setContents(Common::composeString(strct.getUint(field)));
			break;

		case Aurora::GFF3Struct::kFieldTypeByte:
		case Aurora::GFF3Struct::kFieldTypeUint16:
		case Aurora::GFF3Struct::kFieldTypeUint32:
		case Aurora::GFF3Struct::kFieldTypeUint64:
			_xml->setContents(Common::composeString(strct.getUint(field)));
			break;

		case Aurora::GFF3Struct::kFieldTypeSint16:
		case Aurora::GFF3Struct::kFieldTypeSint32:
		case Aurora::GFF3Struct::kFieldTypeSint64:
			_xml->setContents(Common::composeString(strct.getSint(field)));
			break;

		case Aurora::GFF3Struct::kFieldTypeFloat:
		case Aurora::GFF3Struct::kFieldTypeDouble:
			_xml->setContents(Common::UString::format("%.6f", strct.getDouble(field)));
			break;

		case Aurora::GFF3Struct::kFieldTypeStrRef:
			_xml->setContents(strct.getString(field));
			break;

		case Aurora::GFF3Struct::kFieldTypeExoString:
		case Aurora::GFF3Struct::kFieldTypeResRef:
			try {
				_xml->setContents(strct.getString(field));
			} catch (...) {
				_xml->addProperty("base64", "true");

				Common::SeekableReadStream *data = strct.getData(field);
				_xml->setContents(*data);
				delete data;
			}
			break;

		case Aurora::GFF3Struct::kFieldTypeLocString:
			{
				Aurora::LocString locString;

				strct.getLocString(field, locString);
				_xml->addProperty("strref", Common::composeString(locString.getID()));

				dumpLocString(locString);
			}
			break;

		case Aurora::GFF3Struct::kFieldTypeVoid:
			_xml->setContents(*strct.getData(field));
			break;

		case Aurora::GFF3Struct::kFieldTypeStruct:
			dumpStruct(strct.getStruct(field), label);
			break;

		case Aurora::GFF3Struct::kFieldTypeList:
			dumpList(strct.getList(field));
			break;

		case Aurora::GFF3Struct::kFieldTypeOrientation:
			{
				double a = 0.0, b = 0.0, c = 0.0, d = 0.0;

				strct.getOrientation(field, a, b, c, d);

				_xml->breakLine();

				_xml->openTag("double");
				_xml->setContents(Common::UString::format("%.6f", a));
				_xml->closeTag();
				_xml->breakLine();

				_xml->openTag("double");
				_xml->setContents(Common::UString::format("%.6f", b));
				_xml->closeTag();
				_xml->breakLine();

				_xml->openTag("double");
				_xml->setContents(Common::UString::format("%.6f", c));
//.........这里部分代码省略.........
开发者ID:idkwim,项目名称:xoreos-tools,代码行数:101,代码来源:gff3dumper.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ nwscript::FunctionContext类代码示例发布时间:2022-05-31
下一篇:
C++ aurora::GFFStruct类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap