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


C++ CData::data方法代码示例

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


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

示例1: loadScript

bool loadScript(CFile* f)
{
	if( !f->isOpen() )
		return false;
	CData d;
	d.fromFile(f);
	d.write("\x0",1);
	String s = d.data();
	try{
		object main_module((
		handle<>(borrowed
		(PyImport_AddModule("__main__")))));

		object main_namespace =
			main_module.attr("__dict__");

		boost::algorithm::replace_all(s,"\r\n","\n");
		handle<> ignored(PyRun_String(
			s.c_str()
			, Py_file_input
			, main_namespace.ptr()
			, main_namespace.ptr()
			));
	} catch(error_already_set)
	{
		PyErr_Print();
		return false;
	};
	return true;
};
开发者ID:proton,项目名称:ireon,代码行数:30,代码来源:py_init.cpp

示例2: onLoginSignal

void CPCRCHelloState::onLoginSignal(CData &data)
{
    CLog::instance()->log(CLog::msgLvlInfo,_("Sending login request to root server.\n"));
    CData request;
    request.wrt((ireon::net::commandId)ireon::net::rspcCodes::scHelloLogin);
    request.append(data.data(), data.length());
    m_ownerConnection->write(request);
}
开发者ID:proton,项目名称:ireon,代码行数:8,代码来源:pcrc_hello_state.cpp

示例3: onSendVersionSignal

void CPCRCHelloState::onSendVersionSignal(CData &data)
{
    CData versionData;
    char clientVersion[] = {PRODUCT_VERSION};
    for (int i = 0; i < 4; i++)
        versionData << clientVersion[i];
    CLog::instance()->log(CLog::msgFlagNetwork, CLog::msgLvlInfo,_("Initiating version negotiation.\n"));
    CData request;
    request.wrt((ireon::net::commandId)ireon::net::rspcCodes::scCheckVersion);
    request.write(versionData.data(), versionData.length());
    m_ownerConnection->write(request);
};
开发者ID:proton,项目名称:ireon,代码行数:12,代码来源:pcrc_hello_state.cpp

示例4: processCommand

void CNetConnection::processCommand(ireon::net::commandId id, CData& data, netAddress fromAddress)
{
    if (fromAddress.m_type == netAddress::atInternalAddress)
        CLog::instance()->log(CLog::msgFlagNetwork,CLog::msgLvlDebug,_("Received internal packet. Id = %d.\n"),id);
    else
        CLog::instance()->log(CLog::msgFlagNetwork,CLog::msgLvlDebug,_("Received packet. Id = %d.\n"),id);

    if( !processSignal(id, fromAddress, data) )
    {
        if (fromAddress.m_type == netAddress::atExternalAddress)
        {
            CData response;
            response.wrt((ireon::net::commandId) ireon::net::rcCommandNotFound);
            response << id;
            write(response);
        }
        CLog::instance()->log(CLog::msgLvlError,_("Can't process packet. Contents:\n"));
        CLog::instance()->dump(CLog::msgLvlError,data.data(),data.length());
    }
    return;
};
开发者ID:proton,项目名称:ireon,代码行数:21,代码来源:net_connection.cpp


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