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


C++ nsDependentCSubstring::Data方法代码示例

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


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

示例1: responseLine

void
VolumeManager::OnLineRead(int aFd, nsDependentCSubstring& aMessage)
{
  MOZ_ASSERT(aFd == mSocket.get());
  char* endPtr;
  int responseCode = strtol(aMessage.Data(), &endPtr, 10);
  if (*endPtr == ' ') {
    endPtr++;
  }

  // Now fish out the rest of the line after the response code
  nsDependentCString  responseLine(endPtr, aMessage.Length() - (endPtr - aMessage.Data()));
  DBG("Rcvd: %d '%s'", responseCode, responseLine.Data());

  if (responseCode >= ::ResponseCode::UnsolicitedInformational) {
    // These are unsolicited broadcasts. We intercept these and process
    // them ourselves
    HandleBroadcast(responseCode, responseLine);
  } else {
    // Everything else is considered to be part of the command response.
    if (mCommands.size() > 0) {
      VolumeCommand* cmd = mCommands.front();
      cmd->HandleResponse(responseCode, responseLine);
      if (responseCode >= ::ResponseCode::CommandOkay) {
        // That's a terminating response. We can remove the command.
        mCommands.pop();
        mCommandPending = false;
        // Start the next command, if there is one.
        WriteCommandData();
      }
    } else {
      ERR("Response with no command");
    }
  }
}
开发者ID:70599,项目名称:Waterfox,代码行数:35,代码来源:VolumeManager.cpp

示例2: OnLineRead

void NetdClient::OnLineRead(int aFd, nsDependentCSubstring& aMessage)
{
  // Set errno to 0 first. For preventing to use the stale version of errno.
  errno = 0;
  // We found a line terminator. Each line is formatted as an
  // integer response code followed by the rest of the line.
  // Fish out the response code.
  int responseCode = strtol(aMessage.Data(), nullptr, 10);
  if (!errno) {
    NetdCommand* response = new NetdCommand();
    // Passing all the response message, including the line terminator.
    response->mSize = aMessage.Length();
    memcpy(response->mData, aMessage.Data(), aMessage.Length());
    gNetdConsumer->MessageReceived(response);
  }

  if (!responseCode) {
    LOG("Can't parse netd's response");
  }
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:20,代码来源:Netd.cpp


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