MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sdsstring

Class sdsstring

src/sds.h:393–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391};
392
393class sdsstring : public sdsview
394{
395public:
396 sdsstring() = default;
397 explicit sdsstring(sds str)
398 : sdsview(str)
399 {}
400
401 sdsstring(const sdsstring &other)
402 : sdsview()
403 {
404 if (other.m_str != nullptr)
405 m_str = sdsdup(other.m_str);
406 }
407
408 sdsstring(const char *rgch, size_t cch)
409 : sdsview(sdsnewlen(rgch, cch))
410 {}
411
412 sdsstring(sdsstring &&other)
413 : sdsview(other.m_str)
414 {
415 other.m_str = nullptr;
416 }
417
418 sdsstring &operator=(const sdsstring &other)
419 {
420 sdsfree(m_str);
421 if (other.m_str != nullptr)
422 m_str = sdsdup(other.m_str);
423 else
424 m_str = nullptr;
425 return *this;
426 }
427
428 sdsstring &operator=(sds other)
429 {
430 sdsfree(m_str);
431 m_str = sdsdup(other);
432 return *this;
433 }
434
435 sdsstring &operator=(sdsstring &&other)
436 {
437 sds tmp = m_str;
438 m_str = other.m_str;
439 other.m_str = tmp;
440 return *this;
441 }
442
443 template<typename... Args>
444 sdsstring catfmt(const char *fmt, Args... args)
445 {
446 m_str = sdscatfmt(m_str, fmt, args...);
447 return *this;
448 }
449
450 sds release() {

Callers 7

rdbLoadStringFunction · 0.85
rdbSaveInfoAuxFieldsFunction · 0.85
rdbLoadRioFunction · 0.85
MasterSaveInfoMethod · 0.85
cronCommandFunction · 0.85
getInfoMethod · 0.85
getInfoMethod · 0.85

Calls 2

sdsfreeFunction · 0.85
sdsdupFunction · 0.85

Tested by 1

getInfoMethod · 0.68