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


C++ BString::getDataLength方法代码示例

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


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

示例1: sendAdminFeedback

void ObjectController::sendAdminFeedback(BString reply) const
{
    PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
    if ((player) && (player->isConnected()))
    {
        if (reply.getLength())
        {
            gLogger->log(LogManager::NOTICE,"Admin (%s): %s", player->getFirstName().getAnsi(), reply.getAnsi());
            reply.convert(BSTRType_Unicode16);
            gMessageLib->SendSystemMessage(reply.getUnicode16(), player, true);
        }
        else
        {
            gLogger->log(LogManager::NOTICE,"Admin (%s):", player->getFirstName().getAnsi());
        }
    }
    else
    {
        if (reply.getDataLength())
        {
            gLogger->log(LogManager::NOTICE,"Admin (anon): %s", reply.getAnsi());
        }
        else
        {
            gLogger->log(LogManager::NOTICE,"Admin (anon):");
        }
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: addString

void MessageFactory::addString(const BString& data)
{
    // Make sure we've called StartMessage()
    assert(mCurrentMessage && "Must call StartMessage before adding data");

    // Adjust start bounds if necessary.
    _adjustHeapStartBounds(data.getDataLength());

    // Insert our data and move our end pointer.
    switch(data.getType())
    {
    case BSTRType_UTF8:
    case BSTRType_ANSI:
    {
        // First insert the string length
        *((uint16*)mCurrentMessageEnd) = data.getLength();
        mCurrentMessageEnd += 2;

        memcpy(mCurrentMessageEnd, data.getAnsi(), data.getLength());
        mCurrentMessageEnd += data.getLength();
    }
    break;

    case BSTRType_Unicode16:
    {
        // First insert the string length
        *((uint32*)mCurrentMessageEnd) = data.getLength();
        mCurrentMessageEnd += 4;

        memcpy(mCurrentMessageEnd, data.getUnicode16(), data.getLength() * 2);
        mCurrentMessageEnd += data.getLength() * 2;
    }
    break;
    }
}
开发者ID:ANHcRush,项目名称:mmoserver,代码行数:35,代码来源:MessageFactory.cpp

示例3: sendAdminFeedback

void ObjectController::sendAdminFeedback(BString reply) const
{
    PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
    if ((player) && (player->isConnected()))
    {
        if (reply.getLength())
        {
            reply.convert(BSTRType_Unicode16);
            gMessageLib->SendSystemMessage(reply.getUnicode16(), player, true);
        }
        else
        {
            DLOG(info) << "Admin :" << player->getFirstName().getAnsi();
        }
    }
    else
    {
        if (reply.getDataLength())
        {
            DLOG(info) << "Admin (anon): " << reply.getAnsi();
        }
        else
        {
        }
    }
}
开发者ID:schizix,项目名称:mmoserver,代码行数:26,代码来源:OCAdminHandlers.cpp


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