line |
true |
false |
branch |
103
|
0 |
0 |
if (!mem) throw std::bad_alloc(); |
350
|
0 |
1236 |
if (std::is_same::value && this == (void*)&source) return *this; |
358
|
0 |
4 |
if (std::is_same::value && this == (void*)&source) |
369
|
0 |
316 |
if (std::is_same::value && this == (void*)&source) return *this; |
428
|
450 |
0 |
operator std::basic_string () const { return std::basic_string(_str, _length); } |
451
|
10 |
1 |
case State::INTERNAL: return _storage.internal->refcnt == 1 ? _capacity_internal() : 0; |
452
|
0 |
0 |
case State::EXTERNAL: return _storage.external->refcnt == 1 ? _capacity_external() : 0; |
481
|
0 |
0 |
if (offset > _length) throw std::out_of_range("basic_string::offset"); |
|
0 |
0 |
if (offset > _length) throw std::out_of_range("basic_string::offset"); |
482
|
0 |
0 |
if (length > _length - offset) _length = _length - offset; |
722
|
8 |
0 |
const CharT* ptr = _str + (pos >= _length ? _length : (pos+1)); |
723
|
50 |
4 |
while (--ptr >= _str) if (traits_type::eq(*ptr, ch)) return ptr - _str; |
|
4 |
46 |
while (--ptr >= _str) if (traits_type::eq(*ptr, ch)) return ptr - _str; |
856
|
29 |
0 |
if (count) { |
866
|
78 |
0 |
if (str._length) { // can't call append(const CharT*, size_type) because otherwise if &str == this a fuckup would occur |
887
|
92 |
0 |
if (count) { |
1144
|
1 |
11 |
if (_state == State::LITERAL) return _str; // LITERALs are NT |
1150
|
1 |
10 |
if (capacity() <= _length) const_cast(this)->_reserve_save(_length + 1); // we're in COW mode or don't have space |
1164
|
0 |
0 |
if (capacity <= MAX_SSO_CHARS) { |
1168
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto"); |
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto"); |
1249
|
0 |
427 |
if (offset > oth._length) throw std::out_of_range("basic_string::assign"); |
|
0 |
0 |
if (offset > oth._length) throw std::out_of_range("basic_string::assign"); |
1250
|
0 |
427 |
if (length > oth._length - offset) length = oth._length - offset; |
1259
|
0 |
0 |
if (oth._state == State::SSO) _str = _sso + (oth._str - oth._sso); |
1277
|
0 |
0 |
if (_storage.internal->refcnt > 1) { |
1281
|
0 |
0 |
else if (_storage.internal->capacity < capacity) { // could realloc save anything? |
1289
|
0 |
0 |
if (_storage.external->refcnt > 1) { |
1293
|
0 |
0 |
else if (_storage.external->capacity < capacity) { |
1309
|
0 |
0 |
if (_storage.any->refcnt > 1) _detach_cow(_length); |
1338
|
0 |
0 |
if (capacity < _length) capacity = _length; |
1348
|
0 |
0 |
if (_storage.internal->refcnt > 1) _detach_cow(capacity * extra); |
1349
|
0 |
0 |
else if (_storage.internal->capacity < capacity) _internal_realloc(capacity * extra); // need to grow storage |
1350
|
0 |
0 |
else if (_capacity_internal() < capacity) { // may not to grow storage if str is moved to the beginning |
1359
|
0 |
0 |
if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) { |
|
0 |
0 |
if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) { |
1360
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc"); |
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc"); |
1375
|
0 |
0 |
if (_storage.external->refcnt > 1) _detach_cow(capacity * extra); |
1376
|
0 |
0 |
else if (_storage.external->capacity < capacity) _external_realloc(capacity * extra); // need to grow storage, switch to INTERNAL/SSO |
1377
|
0 |
0 |
else if (_capacity_external() < capacity) { // may not to grow storage if str is moved to the beginning |
1393
|
0 |
0 |
if (MAX_SSO_CHARS < capacity) { |
1397
|
0 |
0 |
else if (_capacity_sso() < capacity) { |
1504
|
0 |
0 |
static void _release_internal (Buffer* buf, dtor_fn dtor) { if (!--buf->refcnt) _free_internal(buf, dtor); } |
1505
|
0 |
0 |
static void _release_external (ExternalShared* ebuf, dtor_fn dtor) { if (!--ebuf->refcnt) _free_external(ebuf, dtor); } |
1514
|
873 |
230 |
if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0); |
|
828 |
45 |
if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0); |
|
20 |
808 |
if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0); |
1584
|
0 |
369 |
if (llen == 0) return rhs; |
1585
|
1 |
368 |
if (rhs.length() == 0) return basic_string(lhs, llen); |
1684
|
137 |
0 |
return panda::hash::hashXX(panda::string_view((const char*)s.data(), s.length() * sizeof(C))); |