- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/string_res.hfa
r1733184 r6cc87c0 17 17 18 18 #include <fstream.hfa> 19 #include <string.h> // e.g. strlen20 19 21 20 … … 28 27 HandleNode *flink; // forward link 29 28 HandleNode *blink; // backward link 30 VbyteHeap *ulink; // upward link31 29 32 30 char *s; // pointer to byte string … … 34 32 }; // HandleNode 35 33 36 VbyteHeap * DEBUG_string_heap(); 37 size_t DEBUG_string_bytes_in_heap( VbyteHeap * heap ); 34 void ?{}( HandleNode & ); // constructor for header node 35 36 void ?{}( HandleNode &, VbyteHeap & ); // constructor for nodes in the handle list 37 void ^?{}( HandleNode & ); // destructor for handle nodes 38 39 extern VbyteHeap * DEBUG_string_heap; 38 40 size_t DEBUG_string_bytes_avail_until_gc( VbyteHeap * heap ); 39 41 const char * DEBUG_string_heap_start( VbyteHeap * heap ); … … 45 47 struct string_res { 46 48 HandleNode Handle; // chars, start, end, global neighbours 47 bool shareEditSet_owns_ulink;48 49 string_res * shareEditSet_prev; 49 50 string_res * shareEditSet_next; … … 73 74 // Constructors, Assignment Operators, Destructor 74 75 void ?{}(string_res &s); // empty string 76 void ?{}(string_res &s, const char* initial); // copy from string literal (NULL-terminated) 75 77 void ?{}(string_res &s, const char* buffer, size_t bsize); // copy specific length from buffer 76 static inline void ?{}(string_res &s, const char* rhs) { // copy from string literal (NULL-terminated)77 (s){ rhs, strlen(rhs) };78 }79 78 80 79 void ?{}(string_res &s, const string_res & s2) = void; … … 87 86 } 88 87 89 string_res & assign(string_res &s, const char* buffer, size_t bsize); // copy specific length from buffer 90 static inline string_res & ?=?(string_res &s, const char* other) { // copy from string literal (NULL-terminated) 91 return assign(s, other, strlen(other)); 92 } 93 string_res & ?=?(string_res &s, const string_res &other); 94 string_res & ?=?(string_res &s, string_res &other); 95 string_res & ?=?(string_res &s, char other); 88 void assign(string_res &s, const char* buffer, size_t bsize); // copy specific length from buffer 89 void ?=?(string_res &s, const char* other); // copy from string literal (NULL-terminated) 90 void ?=?(string_res &s, const string_res &other); 91 void ?=?(string_res &s, string_res &other); 92 void ?=?(string_res &s, char other); 96 93 97 94 void ^?{}(string_res &s); … … 102 99 103 100 // Concatenation 104 void append(string_res &s, const char* buffer, size_t bsize);105 101 void ?+=?(string_res &s, char other); // append a character 106 102 void ?+=?(string_res &s, const string_res &s2); // append-concatenate to first string 107 static inline void ?+=?(string_res &s, const char* other) { 108 append( s, other, strlen(other) ); 109 } 103 void ?+=?(string_res &s, const char* other); 104 void append(string_res &s, const char* buffer, size_t bsize); 110 105 111 106 // Character access 112 void assignAt(const string_res &s, size_t index, char val);113 107 char ?[?](const string_res &s, size_t index); // Mike changed to ret by val from Sunjay's ref, to match Peter's 114 108 //char codePointAt(const string_res &s, size_t index); // revisit under Unicode
Note:
See TracChangeset
for help on using the changeset viewer.