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


C++ ObjectInputStream::size方法代码示例

本文整理汇总了C++中ObjectInputStream::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectInputStream::size方法的具体用法?C++ ObjectInputStream::size怎么用?C++ ObjectInputStream::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectInputStream的用法示例。


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

示例1: SetUp

	void SetUp() {
		// Perform setup of common constructs here.
		lootGroupMap->initialize();

		ASSERT_TRUE( templateManager != NULL );
		if( templateManager->loadedTemplatesCount == 0 ) {
			templateManager->loadLuaTemplates();
		}

		commandConfigManager->registerSpecialCommands(list);
		commandConfigManager->loadSlashCommandsFile();

		Vector<String> files;
		files.add("string/en/mob/creature_names.stf");
		files.add("string/en/npc_name.stf");
		files.add("string/en/monster_name.stf");
		files.add("string/en/droid_name.stf");
		files.add("string/en/npc_spawner_n.stf");
		files.add("string/en/theme_park_name.stf");
		files.add("string/en/event_perk.stf");
		files.add("string/en/bestine.stf");
		files.add("string/en/theme_park/warren/warren_system_messages.stf");
		files.add("string/en/newbie_tutorial/system_messages.stf");
		files.add("string/en/chassis_npc.stf");

		int count = 0;

		for (int i = 0; i < files.size(); i++) {
			String file = files.get(i);
			ObjectInputStream* stream = templateManager->openTreFile(file);

			if (stream != NULL) {

				if (stream->size() > 4) {
					StringFile stringFile;
					if (stringFile.load(stream)) {
						file = file.replaceFirst("string/en/","");
						file = file.replaceFirst(".stf","");

						HashTable<String, UnicodeString>* hashTable = stringFile.getStringMap();

						HashTableIterator<String, UnicodeString> iterator = hashTable->iterator();

						while (iterator.hasNext()) {
							String name;
							UnicodeString value;

							iterator.getNextKeyAndValue(name, value);

							String full = "@" + file + ":" + name;

							mobNames.add(full);
							count++;
						}
					}

				}

				delete stream;

			}

		}

		ASSERT_TRUE( count > 0 ) << "Could not load creature names.";
	}
开发者ID:Marott1,项目名称:Core3,代码行数:66,代码来源:LuaMobileTest.cpp

示例2: populateDatabase

void StringIdManager::populateDatabase() {
	int count = 0;

	TemplateManager::instance();
	TreeArchive* treeArchive = DataArchiveStore::instance()->getTreeArchive();

	Vector<String>* files = treeArchive->getFilesAndSubDirectoryFiles("string/en");

	if (files == NULL) {
		error("string/en directory missing");

		ObjectDatabaseManager::instance()->commitLocalTransaction();
		return;
	}

	for (int i = 0; i < files->size(); ++i) {
		String file = files->get(i);

		ObjectInputStream* stream = TemplateManager::instance()->openTreFile(files->get(i));

		if (stream == NULL) {
			//error("could not open file " + files->get(i));

			continue;
		} else {
			if (stream->size() > 4) {
				//info("opening " + files->get(i), true);

				StringFile stringFile;
				if (!stringFile.load(stream)) {
					delete stream;

					error("could not parse " + files->get(i));
					continue;
				}

				file = file.replaceFirst("string/en/","");
				file = file.replaceFirst(".stf","");

				HashTable<String, UnicodeString>* hashTable = stringFile.getStringMap();

				HashTableIterator<String, UnicodeString> iterator = hashTable->iterator();

				while (iterator.hasNext()) {
					String name;
					UnicodeString value;

					iterator.getNextKeyAndValue(name, value);

					String full = "@" + file + ":" + name;

					//info("key = " + full + " value = " + value.toString(), true);

					ObjectOutputStream* data = new ObjectOutputStream();
					value.toBinaryStream(data);

					uint64 longKey = (uint64)full.hashCode();

					ObjectOutputStream* key = new ObjectOutputStream();
					TypeInfo<uint64>::toBinaryStream(&longKey, key);

					stringsDatabase->putData(key, data);
					++count;
				}

			}

			delete stream;
		}
	}

	delete files;

	info("writing to the db " + String::valueOf(count) + " strings", true);
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:75,代码来源:StringIdManager.cpp


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