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


C++ ObjectInputStream类代码示例

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


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

示例1: throw

void EditSelection::readSerialized(ObjectInputStream & in) throw (InputStreamException) {
	in.readObject("EditSelection");
	this->x = in.readDouble();
	this->y = in.readDouble();
	this->width = in.readDouble();
	this->height = in.readDouble();

	in >> this->contents;

	in.endObject();
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:11,代码来源:EditSelection.cpp

示例2: throw

void XojFont::readSerialized(ObjectInputStream& in) throw (
    InputStreamException)
{
	XOJ_CHECK_TYPE(XojFont);

	in.readObject("XojFont");

	this->name = in.readString();
	this->size = in.readDouble();

	in.endObject();
}
开发者ID:cass00,项目名称:xournalpp,代码行数:12,代码来源:Font.cpp

示例3: throw

void Element::readSerializedElement(ObjectInputStream& in) throw (InputStreamException)
{
	XOJ_CHECK_TYPE(Element);

	in.readObject("Element");

	this->x = in.readDouble();
	this->y = in.readDouble();
	this->color = in.readInt();

	in.endObject();
}
开发者ID:project-renard-survey,项目名称:xournalpp,代码行数:12,代码来源:Element.cpp

示例4: throw

void Text::readSerialized(ObjectInputStream & in) throw (InputStreamException) {
	XOJ_CHECK_TYPE(Text);

	in.readObject("Text");

	readSerializedElement(in);

	this->text = in.readString();

	font.readSerialized(in);

	in.endObject();
}
开发者ID:yolanother,项目名称:Xournal,代码行数:13,代码来源:Text.cpp

示例5: objectData

SceneObject* ObjectManager::cloneObject(SceneObject* object, bool makeTransient) {
	ObjectOutputStream objectData(500);

	(cast<ManagedObject*>(object))->writeObject(&objectData);
	objectData.reset();

	ObjectInputStream objectInput;
	objectData.copy(&objectInput, 0);
	objectInput.reset();

	uint32 serverCRC = object->getServerObjectCRC();

	SceneObject* clonedObject = NULL;

	ObjectDatabase* database = getTable(object->getObjectID());
	String databaseName;
	uint64 oid;

	if (database != NULL) {
		database->getDatabaseName(databaseName);

		oid = getNextObjectID(databaseName);
	} else
		oid = getNextFreeObjectID();


	clonedObject = instantiateSceneObject(serverCRC, oid, false);

	if (makeTransient || !object->isPersistent()) {
		//clonedObject = createObject(serverCRC, 0, databaseName);
		clonedObject->setPersistent(0);
	} else if (object->isPersistent()) {
		//clonedObject = createObject(serverCRC, object->getPersistenceLevel(), databaseName);
		clonedObject->setPersistent(object->getPersistenceLevel());
	}

	Locker locker(clonedObject);

	clonedObject->readObject(&objectInput);
	clonedObject->createComponents();
	clonedObject->setParent(NULL);

	if (clonedObject->isPersistent())
		updatePersistentObject(clonedObject);

	return clonedObject;
}
开发者ID:Marott1,项目名称:Core3,代码行数:47,代码来源:ObjectManager.cpp

示例6: info

void ChatManagerImplementation::loadMailDatabase() {
	info("Checking mail for expiration...", true);

	ObjectDatabase* playerMailDatabase = ObjectDatabaseManager::instance()->loadObjectDatabase("mail", true);

	if (playerMailDatabase == NULL) {
		error("Could not load the player mail database.");
		return;
	}

	int i = 0;

	try {
		ObjectDatabaseIterator iterator(playerMailDatabase);

		uint64 objectID;
		uint32 timeStamp, currentTime = System::getTime();
		ObjectInputStream* objectData = new ObjectInputStream(2000);

		while (i < 25000 && iterator.getNextKeyAndValue(objectID, objectData)) {
			if (!Serializable::getVariable<uint32>(STRING_HASHCODE("PersistentMessage.timeStamp"), &timeStamp, objectData)) {
				objectData->clear();
				continue;
			}

			if (currentTime - timeStamp > PM_LIFESPAN) {
				Reference<PersistentMessage*> mail = Core::getObjectBroker()->lookUp(objectID).castTo<PersistentMessage*>();

				if (mail != NULL) {
					i++;

					ObjectManager::instance()->destroyObjectFromDatabase(objectID);
				}
			}

			objectData->clear();
		}

		delete objectData;
	} catch (DatabaseException& e) {
		error("Database exception in ChatManager::loadMailDatabase(): " + e.getMessage());
	}

	info("Deleted " + String::valueOf(i) + " mails due to expiration.", true);
}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:45,代码来源:ChatManagerImplementation.cpp

示例7: throw

void Image::readSerialized(ObjectInputStream & in) throw (InputStreamException) {
	XOJ_CHECK_TYPE(Image);

	in.readObject("Image");

	readSerializedElement(in);

	this->width = in.readDouble();
	this->height = in.readDouble();

	if (this->image) {
		cairo_surface_destroy(this->image);
		this->image = NULL;
	}

	this->image = in.readImage();

	in.endObject();
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:19,代码来源:Image.cpp

示例8: throw

void TexImage::readSerialized(ObjectInputStream & in) throw (InputStreamException) {
	XOJ_CHECK_TYPE(TexImage);

	in.readObject("TexImage");

	readSerializedElement(in);

	this->width = in.readDouble();
	this->height = in.readDouble();
	String tmp = in.readString();
	//cast this
	char * tmpcstring = new char[tmp.size()];
	strcpy(tmpcstring,tmp.c_str());
	this->text = tmpcstring;

	if (this->image) {
		cairo_surface_destroy(this->image);
		this->image = NULL;
	}

	this->image = in.readImage();

	in.endObject();
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:24,代码来源:TexImage.cpp

示例9: readObject

void EntryRemovedEvent::readObject (ObjectInputStream& in)
{
    presents::dobj::EntryEvent::readObject(in);
    key = boost::static_pointer_cast<Streamable>(in.readObject());
}
开发者ID:691739159,项目名称:narya,代码行数:5,代码来源:EntryRemovedEvent.cpp

示例10: info

void StructureManager::loadPlayerStructures(const String& zoneName) {

	info("Loading player structures from playerstructures.db");

	ObjectDatabaseManager* dbManager = ObjectDatabaseManager::instance();
	ObjectDatabase* playerStructuresDatabase =
			ObjectDatabaseManager::instance()->loadObjectDatabase(
					"playerstructures", true);

	if (playerStructuresDatabase == NULL) {
		error("Could not load the player structures database.");
		return;
	}

	int i = 0;

	try {
		ObjectDatabaseIterator iterator(playerStructuresDatabase);

		uint64 objectID;
		ObjectInputStream* objectData = new ObjectInputStream(2000);

		String zoneReference;

		while (iterator.getNextKeyAndValue(objectID, objectData)) {
			if (!Serializable::getVariable<String>(String("SceneObject.zone").hashCode(),
					&zoneReference, objectData)) {
				objectData->clear();
				continue;
			}

			if (zoneName != zoneReference) {
				objectData->clear();
				continue;
			}

			Reference<SceneObject*> object = server->getObject(objectID);

			if (object != NULL) {
				++i;

				if(object->isGCWBase()){
					Zone* zone = object->getZone();

					if(zone == NULL)
						return;

					GCWManager* gcwMan = zone->getGCWManager();
					if(gcwMan == NULL)
						return;

					gcwMan->registerGCWBase(cast<BuildingObject*>(object.get()),false);

				}

				if (ConfigManager::instance()->isProgressMonitorActivated())
					printf("\r\tLoading player structures [%d] / [?]\t", i);
			} else {
				error(
						"Failed to deserialize structure with objectID: "
								+ String::valueOf(objectID));
			}

			objectData->clear();
		}

		delete objectData;
	} catch (DatabaseException& e) {
		error(
				"Database exception in StructureManager::loadPlayerStructures(): "
						+ e.getMessage());
	}

	info(String::valueOf(i) + " player structures loaded for " + zoneName + ".",
			true);

}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:77,代码来源:StructureManager.cpp

示例11: readObject

void DObject::readObject (ObjectInputStream& in)
{
    oid = int32(in.readInt());
}
开发者ID:691739159,项目名称:narya,代码行数:4,代码来源:DObject.cpp

示例12: readObject

void BoxedShort::readObject (ObjectInputStream& in)
{
    value = in.readShort();
}
开发者ID:691739159,项目名称:narya,代码行数:4,代码来源:BoxedShort.cpp

示例13:

ArrayMask::ArrayMask (ObjectInputStream& in)
{
    _length = in.readShort();
    _mask = new uint8[_length];
    in.readBytes(_mask, _length);
}
开发者ID:691739159,项目名称:narya,代码行数:6,代码来源:ArrayMask.cpp

示例14: 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

示例15: objectData

SceneObject* ObjectManager::cloneObject(SceneObject* object, bool makeTransient) {
	
	ObjectOutputStream objectData(500);

	(cast<ManagedObject*>(object))->writeObject(&objectData);
	objectData.reset();

	ObjectInputStream objectInput;
	objectData.copy(&objectInput, 0);
	objectInput.reset();

	uint32 serverCRC = object->getServerObjectCRC();

	SceneObject* clonedObject = NULL;

	ObjectDatabase* database = getTable(object->getObjectID());
	String databaseName;
	uint64 oid;

	if (database != NULL) {
		database->getDatabaseName(databaseName);

		oid = getNextObjectID(databaseName);
	} else
		oid = getNextFreeObjectID();


	clonedObject = instantiateSceneObject(serverCRC, oid, false);

	if (makeTransient || !object->isPersistent()) {
		//clonedObject = createObject(serverCRC, 0, databaseName);
		clonedObject->setPersistent(0);
	} else if (object->isPersistent()) {
		//clonedObject = createObject(serverCRC, object->getPersistenceLevel(), databaseName);
		clonedObject->setPersistent(object->getPersistenceLevel());
	}

	Locker locker(clonedObject);

	clonedObject->readObject(&objectInput);
	clonedObject->createComponents();
	clonedObject->setParent(NULL);
    
	VectorMap<String, ManagedReference<SceneObject*> > slottedObjects;
	clonedObject->getSlottedObjects(slottedObjects);
    
	for (int i=slottedObjects.size()-1; i>=0; i--) {
		String key = slottedObjects.elementAt(i).getKey();
        
		Reference<SceneObject*> obj = slottedObjects.elementAt(i).getValue();
        
		clonedObject->removeSlottedObject(i);
        
		Reference<SceneObject*> clonedChild = cloneObject(obj, makeTransient);
		clonedChild->setParent(object);
        
		slottedObjects.put(key, clonedChild);
        
	}
	
	VectorMap<uint64, ManagedReference<SceneObject*> > objects;
	clonedObject->getContainerObjects(objects);
	
	for (int i=objects.size()-1; i>=0; i--) {
		uint64 key = objects.elementAt(i).getKey();
		
		Reference<SceneObject*> obj = objects.elementAt(i).getValue();
		
		objects.remove(i);
		
		Reference<SceneObject*> clonedChild = cloneObject(obj, makeTransient);
		clonedChild->setParent(object);
		
		objects.put(key, clonedChild);
	}
	
	clonedObject->onCloneObject(object);

	if (clonedObject->isPersistent())
		updatePersistentObject(clonedObject);

	return clonedObject;
}
开发者ID:Tatwi,项目名称:legend-of-hondo,代码行数:83,代码来源:ObjectManager.cpp


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