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