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


C++ Deserialize函数代码示例

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


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

示例1: FATAL

bool BaseVariantProtocol::SignalInputData(IOBuffer &buffer) {
	if (_pProtocolHandler == NULL) {
		FATAL("This protocol is not registered to any application yet");
		return false;
	}

	if (_pFarProtocol->GetType() == PT_OUTBOUND_HTTP
			|| _pFarProtocol->GetType() == PT_INBOUND_HTTP) {
#ifdef HAS_PROTOCOL_HTTP
		//1. This is a HTTP based transfer. We only start doing stuff
		//after a complete request is made.
		BaseHTTPProtocol *pHTTPProtocol = (BaseHTTPProtocol *) _pFarProtocol;
		if (!pHTTPProtocol->TransferCompleted())
			return true;

		if (!Deserialize(GETIBPOINTER(buffer), pHTTPProtocol->GetContentLength(),
				_lastReceived)) {
			FATAL("Unable to deserialize content");
			return false;
		}
		buffer.Ignore(pHTTPProtocol->GetContentLength());

		_lastReceived.Compact();

		return _pProtocolHandler->ProcessMessage(this, _lastSent, _lastReceived);
#else
		FATAL("HTTP protocol not supported");
		return false;
#endif /* HAS_PROTOCOL_HTTP */
	} else if (_pFarProtocol->GetType() == PT_TCP) {
		while (GETAVAILABLEBYTESCOUNT(buffer) > 4) {
			uint32_t size = ENTOHLP(GETIBPOINTER(buffer));
			if (size > 4 * 1024 * 1024) {
				FATAL("Size too big: %u", size);
				return false;
			}
			if (GETAVAILABLEBYTESCOUNT(buffer) < size + 4) {
				FINEST("Need more data");
				return true;
			}

			if (!Deserialize(GETIBPOINTER(buffer) + 4, size, _lastReceived)) {
				FATAL("Unable to deserialize variant");
				return false;
			}
			buffer.Ignore(size + 4);

			_lastReceived.Compact();

			if (!_pProtocolHandler->ProcessMessage(this, _lastSent, _lastReceived)) {
				FATAL("Unable to process message");
				return false;
			}
		}
		return true;
	} else {
		FATAL("Invalid protocol stack");
		return false;
	}
}
开发者ID:dista,项目名称:crtmpserver,代码行数:60,代码来源:basevariantprotocol.cpp

示例2: BOOST_SERIALIZATION_NVP

void CombatData::load(Archive & ar, const unsigned int version)
{
    ar  & BOOST_SERIALIZATION_NVP(m_combat_turn_number)
        & BOOST_SERIALIZATION_NVP(m_system);
    Deserialize(ar, m_combat_universe);
    PathingEngine::s_combat_universe = &m_combat_universe;
    Deserialize(ar, m_pathing_engine);
    PathingEngine::s_combat_universe = 0;
}
开发者ID:adesst,项目名称:freeorion,代码行数:9,代码来源:SerializeMultiplayerCommon.cpp

示例3: Deserialize

    bool Deserialize(const rapidjson::Value& json_val, jos_lib::SyncServerConf& obj_val)
    {
        do
        {
            // fields from "jos_lib::SyncServerConf"
            if (!Deserialize(json_val, "network", obj_val.network, obj_val.json_has_network)) break; // @(field_type : NetworkConf)
            if (!Deserialize(json_val, "sync", obj_val.sync, obj_val.json_has_sync)) break; // @(field_type : SyncConf)

            return true;
        } while (0);

        return false;
    }
开发者ID:87439247,项目名称:huststore,代码行数:13,代码来源:sync_conf.cpp

示例4: Deserialize

Simple *DeserializeSimple(const uint8_t *data, int dataLen, bool *usedDefaultOut)
{
    void *res = NULL;
    res = Deserialize(data, dataLen, SimpleVersion, &gSimpleMetadata);
    if (res) {
        *usedDefaultOut = false;
        return (Simple*)res;
    }
    res = Deserialize(&gSimpleDefault[0], sizeof(gSimpleDefault), SimpleVersion, &gSimpleMetadata);
    CrashAlwaysIf(!res);
    *usedDefaultOut = true;
    return (Simple*)res;
}
开发者ID:kindleStudy,项目名称:sumatrapdf,代码行数:13,代码来源:SettingsBinSimple.cpp

示例5: Deserialize

    bool Deserialize ( const Json::Value& json_val, json_lib::Status& obj_val )
    {
        do
        {
            // fields from "json_lib::Status"
            if ( ! Deserialize (json_val, "total_status", obj_val.total_status, obj_val.json_has_total_status) ) break; // @(field_type : std::map<std::string, uint64_t>)
            if ( ! Deserialize (json_val, "status", obj_val.status, obj_val.json_has_status) ) break; // @(field_type : std::map<std::string, std::map<std::string, uint64_t> >)

            return true;
        }
        while ( 0 );

        return false;
    }
开发者ID:2014-andy,项目名称:huststore,代码行数:14,代码来源:status_serialization.cpp

示例6: lock

bool CSettingsManager::Load(const TiXmlElement *root, bool &updated, bool triggerEvents /* = true */, std::map<std::string, CSetting*> *loadedSettings /* = NULL */)
{
  CSharedLock lock(m_critical);
  CExclusiveLock settingsLock(m_settingsCritical);
  if (m_loaded || root == NULL)
    return false;

  if (triggerEvents && !OnSettingsLoading())
    return false;

  if (!Deserialize(root, loadedSettings))
    return false;

  bool ret = true;
  // load any ISubSettings implementations
  if (triggerEvents)
    ret = Load(root);

  updated = UpdateSettings(root);

  if (triggerEvents)
    OnSettingsLoaded();

  return ret;
}
开发者ID:Anankin,项目名称:xbmc,代码行数:25,代码来源:SettingsManager.cpp

示例7: Initialize

	bool Application::Initialize(const std::string& configDataPath, OPTIONAL HINSTANCE appInstanceHandler)
	{
		this->_SetResourcesPath();
		this->_configDataPath = configDataPath;

		auto logger = Logger::Create();

		if (false == Deserialize(ExtendString::Format("%s\\%s", _resourcesPath.c_str(), _configDataPath.c_str()).c_str()))
		{
			LOG_ERROR("Failed to deserialize a Application");
			return false;
		}

		_isReplaceData = true;

		if (false == _CreateWindow((nullptr == appInstanceHandler) ? GetModuleHandle(nullptr) : appInstanceHandler))
		{
			LOG_ERROR("Failed to create a WinAPI");
			return false;
		}

		auto director = Director::Create();
		if (false == director->Initialize(_winHandler))
		{
			LOG_ERROR("Failed to initialize a Director");
			director->Destroy();
			return false;
		}
		
		return _OnInitialize();
	}
开发者ID:SentioMe,项目名称:D2D_Project,代码行数:31,代码来源:Application.cpp

示例8: Deserialize

void CPlayer::Deserialize(std::string jsonstr)
{
	rapidjson::Document attrs;
	attrs.Parse<0>(jsonstr.c_str());

	Deserialize(attrs);
}
开发者ID:songjundev,项目名称:b,代码行数:7,代码来源:Player.cpp

示例9: EZ_SUCCEED_OR_RETURN

ezResult ezTextureAtlasCreationDesc::Load(const char* szFile)
{
  ezFileReader file;
  EZ_SUCCEED_OR_RETURN(file.Open(szFile));

  return Deserialize(file);
}
开发者ID:ezEngine,项目名称:ezEngine,代码行数:7,代码来源:TextureAtlasDesc.cpp

示例10: Deserialize_Array

	void Deserialize_Array(
		const Json::Value& srcValue,
		const mxArrayType& arrayInfo,
		void *rawMem
		)
	{
		Assert( srcValue.isArray() );

		const UINT numObjects = srcValue.size();

		arrayInfo.Generic_Set_Count( rawMem, numObjects );

		const void* pArrayData = arrayInfo.Generic_Get_Data( rawMem );

		const mxType& itemType = arrayInfo.m_elemType;
		const UINT itemSize = itemType.m_instanceSize;

		for( Json::Value::UInt iObject = 0; iObject < numObjects; iObject++ )
		{
			void* pObject = (BYTE*)pArrayData + iObject * itemSize;
			const Json::Value objectValue = srcValue[ iObject ];

			Deserialize( objectValue, itemType, pObject, 0/*offset*/ );
		}
	}
开发者ID:S-V,项目名称:Lollipop,代码行数:25,代码来源:JsonSerializationCommon.cpp

示例11: Deserialize

ObstacleSpawner::ObstacleSpawner(GameActor* player)
{
    
     Deserialize();
    _nextpos.x = player->GetPosition().x+2*player->GetCenter().x;
    _nextpos.y = player->GetPosition().y+2*player->GetCenter().y;
    
    /*
     TODO:
     This part should be in the tick generate the obstactle base 
     On It's weight and the hard of the level stage
     Now just random generate some obstacle for test;
     */
    
    
    for (int i = 0; i < 100; i++)
    {
        _nextpos.x+=Random(100,150);
        
        int j= Random(4,1);
        GenerateObstacle(_nextpos,j-1);

    }
    
    
    
}
开发者ID:song1shuai,项目名称:CS587GameEngineDesign,代码行数:27,代码来源:ObstacleSpawner.cpp

示例12: Deserialize

Node* Node::Deserialize(const YAML::Node& node) {
    Node* n = new Node;

    std::string uuid;
    node["uuid"] >> uuid;
    std::cout << "::LOADING " << uuid << std::endl;
    n->mId = boost::uuids::string_generator()(uuid);

    try {
        for(unsigned i = 0; i < node["children"].size(); i++) {
            Node* c = Deserialize(node["children"][i]);
            if(c != nullptr)
                n->AddChild(c);
        }
    } catch(YAML::TypedKeyNotFound<std::string> e) {}

    try {
        for(unsigned i = 0; i < node["components"].size(); i++) {
            Component* c = Component::Deserialize(node["components"][i]);
            if(c != nullptr)
                n->AddComponent(c);
        }
    } catch(YAML::TypedKeyNotFound<std::string> e) {}

    return n;
}
开发者ID:svenstaro,项目名称:minimal-examples,代码行数:26,代码来源:Node.cpp

示例13: FATAL

bool StreamCapabilities::Deserialize(string seekFilePath, StreamCapabilities &capabilities) {
	File file;
	if (!file.Initialize(seekFilePath, FILE_OPEN_MODE_READ)) {
		FATAL("Unable to open seek file %s", STR(seekFilePath));
		return false;
	}

	uint32_t length = 0;
	if (!file.ReadUI32(&length, false)) {
		FATAL("Unable to read stream capabilities length from file %s", STR(seekFilePath));
		return false;
	}
	if (length > 1024 * 1024) {
		FATAL("Invalid stream capabilities length in file %s: %"PRIu32, STR(seekFilePath), length);
		return false;
	}

	IOBuffer buffer;
	buffer.ReadFromRepeat(0, length);
	if (!file.ReadBuffer(GETIBPOINTER(buffer), length)) {
		FATAL("Unable to read stream capabilities payload from file %s", STR(seekFilePath));
		return false;
	}

	file.Close();

	if (!Deserialize(buffer, capabilities)) {
		FATAL("Unable to deserialize stream capabilities from file %s", STR(seekFilePath));
		return false;
	}

	return true;
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:33,代码来源:streamcapabilities.cpp

示例14: data_stream

/// Loads a Power Tab object from an input stream
/// @param stream Input stream to load from
/// @param version File version
/// @return True if the object was loaded, false if not
bool PowerTabObject::Deserialize(wxInputStream& stream, wxWord version)
{
    //------Last Checked------//
    // - Dec 21, 2004
    PowerTabInputStream data_stream(stream);
    return (Deserialize(data_stream, version));
}
开发者ID:BackupTheBerlios,项目名称:ptparser-svn,代码行数:11,代码来源:powertabobject.cpp

示例15: fseek

bool SystemAddressList::Load(const char *filename)
{
	FILE *fp = NULL;
	unsigned long fileSize;

	if ( ( fp = fopen( filename, "rb" ) ) == 0 )
		return false;

	fseek( fp, 0, SEEK_END );
	fileSize = ftell( fp );
	fseek( fp, 0, SEEK_SET );
	if (fileSize==0)
	{
		fclose(fp);
		return false;
	}
	unsigned char *filedata = (unsigned char*) rakMalloc_Ex( fileSize, __FILE__, __LINE__ );
	fread(filedata, fileSize, 1, fp);
	fclose(fp);

	RakNet::BitStream bs(filedata, fileSize, false);
	Deserialize(&bs);
	rakFree_Ex(filedata, __FILE__, __LINE__ );
	return true;
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:25,代码来源:SystemAddressList.cpp


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