MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / BString

Class BString

source/util/bstring.h:29–199  ·  view source on GitHub ↗

this class represents the local holder of the shared data, BStringData BStringData is reference counted, if someone tries to write to BStringData and it has a reference count greater than one, then it will make a copy

Source from the content-addressed store, hash-verified

27//
28// BStringData is reference counted, if someone tries to write to BStringData and it has a reference count greater than one, then it will make a copy
29class BString {
30public:
31 BString();
32 BString(const char*, bool litteral);
33 BString(U32 size, char value);
34 BString(BString&& from) noexcept {
35 this->data = from.data;
36 from.data = nullptr;
37 }
38 //BString(const char* s);
39 //BString(const char* s, int len);
40 BString(const BString& s);
41 BString(char c);
42 ~BString();
43
44 const char* c_str() const;
45 char* str();
46 void w_str(wchar_t* w, int len) const;
47
48 char charAt(int i) const;
49 int compareTo(const BString& s, bool ignoreCase = false, int offset = 0, int len = -1) const;
50 int compareTo(const char* s, bool ignoreCase = false, int offset = 0, int len = -1) const;
51 bool contains(const BString& s, bool ignoreCase = false) const;
52 bool contains(const char* s, bool ignoreCase = false) const;
53 bool endsWith(const BString& s, bool ignoreCase = false) const;
54 bool endsWith(const char* s, bool ignoreCase = false) const;
55 bool endsWith(char c, bool ignoreCase = false) const;
56 int indexOf(const BString& s, int fromIndex = 0) const;
57 int indexOf(const char* s, int fromIndex = 0) const;
58 int indexOf(char c, int fromIndex = 0) const;
59 bool isEmpty() const;
60 int lastIndexOf(const BString& s, int fromIndex = -1) const;
61 int lastIndexOf(const char* s, int fromIndex = -1) const;
62 int lastIndexOf(char c, int fromIndex = -1) const;
63 int length() const;
64 void split(char c, std::vector<BString>& results) const;
65 void split(const char* s, std::vector<BString>& results) const;
66 void split(BString s, std::vector<BString>& results) const;
67 bool startsWith(const BString& s, bool ignoreCase = false) const;
68 bool startsWith(const char* s, bool ignoreCase = false) const;
69 bool startsWith(char s, bool ignoreCase = false) const;
70 BString substr(int beginIndex) const;
71 BString substr(int beginIndex, int len) const;
72 int32_t toInt() const;
73 int64_t toInt64() const;
74
75 template<typename ... Args>
76 void sprintf(const char* format, Args ... args) {
77 int size = std::snprintf(nullptr, 0, format, args ...);
78 makeWritable(size);
79 std::snprintf(str(), size + 1, format, args ...);
80 setLength(size);
81 }
82
83 // modifying function
84 void append(const BString& s);
85 void append(const BString& s, int offset, int len);
86 void append(const char* s);

Callers 15

startupArgs.cppFile · 0.85
uihelper.hFile · 0.85
BoxedContainerClass · 0.85
ContainersViewMethod · 0.85
InstallViewClass · 0.85
LayoutRowClass · 0.85
LayoutSectionClass · 0.85
startProcessMethod · 0.85
execveMethod · 0.85
startMethod · 0.85
substrMethod · 0.85
toLowerCaseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected