本文整理汇总了C++中StringData::capacity方法的典型用法代码示例。如果您正苦于以下问题:C++ StringData::capacity方法的具体用法?C++ StringData::capacity怎么用?C++ StringData::capacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringData
的用法示例。
在下文中一共展示了StringData::capacity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: absorb
void StringBuffer::absorb(StringBuffer &buf) {
if (empty()) {
TAINT_OBSERVER_REGISTER_ACCESSED(buf.getTaintDataRefConst());
TAINT_OBSERVER_REGISTER_MUTATED(m_taint_data, dataIgnoreTaint());
StringData* str = m_str;
m_str = buf.m_str;
m_buffer = buf.m_buffer;
m_len = buf.m_len;
m_cap = buf.m_cap;
buf.m_str = str;
if (str) {
buf.m_buffer = (char*)str->data();
buf.m_len = str->size();
buf.m_cap = str->capacity();
} else {
buf.m_buffer = 0;
buf.m_len = 0;
buf.m_cap = 0;
}
buf.reset();
} else {
// REGISTER_ACCESSED()/REGISTER_MUTATED() are called by append()/detach()
append(buf.detach());
}
}
示例2: absorb
void StringBuffer::absorb(StringBuffer& buf) {
if (empty()) {
StringData* str = m_str;
m_str = buf.m_str;
m_buffer = buf.m_buffer;
m_len = buf.m_len;
m_cap = buf.m_cap;
buf.m_str = str;
if (str) {
buf.m_buffer = (char*)str->data();
buf.m_len = str->size();
buf.m_cap = str->capacity();
} else {
buf.m_buffer = 0;
buf.m_len = 0;
buf.m_cap = 0;
}
buf.clear();
return;
}
append(buf.detach());
}
示例3: absorb
void StringBuffer::absorb(StringBuffer &buf) {
if (empty()) {
StringData* str = m_str;
m_str = buf.m_str;
m_buffer = buf.m_buffer;
m_len = buf.m_len;
m_cap = buf.m_cap;
buf.m_str = str;
if (str) {
buf.m_buffer = (char*)str->data();
buf.m_len = str->size();
buf.m_cap = str->capacity();
} else {
buf.m_buffer = 0;
buf.m_len = 0;
buf.m_cap = 0;
}
buf.reset();
} else {
// REGISTER_ACCESSED()/REGISTER_MUTATED() are called by append()/detach()
append(buf.detach());
}
}