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