本文整理汇总了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.";
}
示例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);
}