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


C++ StringBuilder::drop_position方法代码示例

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


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

示例1: switch

int8_t STM32F7USB::notify(ManuvrMsg* active_event) {
  int8_t return_value = 0;

  switch (active_event->eventCode()) {
    case MANUVR_MSG_XPORT_QUEUE_RDY:
      read_port();
      if (_accumulator.count()) {
        char* working_chunk = _accumulator.position(0);
        if (write_port((uint8_t*) working_chunk, strlen(working_chunk))) {
          // TODO: Fail-over timer? Disconnection signal?
          _accumulator.drop_position(0);
        }
      }
      return_value++;
      break;

    case MANUVR_MSG_SYS_BOOTLOADER:
    case MANUVR_MSG_SYS_REBOOT:
    case MANUVR_MSG_SYS_SHUTDOWN:
      connected(false);
      listening(false);
      TM_USBD_Stop(TM_USB_FS);    // DeInit() The USB device.
      return_value++;
      break;
    default:
      return_value += ManuvrXport::notify(active_event);
      break;
  }

  if (local_log.length() > 0) Kernel::log(&local_log);
  return return_value;
}
开发者ID:Manuvr,项目名称:Digitabulum-Firmware,代码行数:32,代码来源:STM32F7USB.cpp

示例2:

/**
* Log has reached the end of its journey. This class will render it to the user.
*
* @param  buf    A pointer to the buffer.
* @param  len    How long the buffer is.
* @param  mm     A declaration of memory-management responsibility.
* @return A declaration of memory-management responsibility.
*/
int8_t STM32F7USB::toCounterparty(StringBuilder* buf, int8_t mm) {
  _accumulator.concatHandoff(buf);
  if (connected() && !_tx_in_progress) {
    char* working_chunk = _accumulator.position(0);
    if (write_port((uint8_t*) working_chunk, strlen(working_chunk))) {
      // TODO: Fail-over timer? Disconnection signal?
      _accumulator.drop_position(0);
    }
  }
  return MEM_MGMT_RESPONSIBLE_BEARER;  // We took the buffer.
}
开发者ID:Manuvr,项目名称:Digitabulum-Firmware,代码行数:19,代码来源:STM32F7USB.cpp


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