Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/containers/string_res.hfa

    r1733184 r6cc87c0  
    1717
    1818#include <fstream.hfa>
    19 #include <string.h>    // e.g. strlen
    2019
    2120   
     
    2827    HandleNode *flink;                                  // forward link
    2928    HandleNode *blink;                                  // backward link
    30     VbyteHeap *ulink;                   // upward link
    3129
    3230    char *s;                                            // pointer to byte string
     
    3432}; // HandleNode
    3533
    36 VbyteHeap * DEBUG_string_heap();
    37 size_t DEBUG_string_bytes_in_heap( VbyteHeap * heap );
     34void ?{}( HandleNode & );                       // constructor for header node
     35
     36void ?{}( HandleNode &, VbyteHeap & );          // constructor for nodes in the handle list
     37void ^?{}( HandleNode & );                      // destructor for handle nodes
     38
     39extern VbyteHeap * DEBUG_string_heap;
    3840size_t DEBUG_string_bytes_avail_until_gc( VbyteHeap * heap );
    3941const char * DEBUG_string_heap_start( VbyteHeap * heap );
     
    4547struct string_res {
    4648    HandleNode Handle; // chars, start, end, global neighbours
    47     bool shareEditSet_owns_ulink;
    4849    string_res * shareEditSet_prev;
    4950    string_res * shareEditSet_next;
     
    7374// Constructors, Assignment Operators, Destructor
    7475void ?{}(string_res &s); // empty string
     76void ?{}(string_res &s, const char* initial); // copy from string literal (NULL-terminated)
    7577void ?{}(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 }
    7978
    8079void ?{}(string_res &s, const string_res & s2) = void;
     
    8786}
    8887
    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);
     88void assign(string_res &s, const char* buffer, size_t bsize); // copy specific length from buffer
     89void ?=?(string_res &s, const char* other); // copy from string literal (NULL-terminated)
     90void ?=?(string_res &s, const string_res &other);
     91void ?=?(string_res &s, string_res &other);
     92void ?=?(string_res &s, char other);
    9693
    9794void ^?{}(string_res &s);
     
    10299
    103100// Concatenation
    104 void append(string_res &s, const char* buffer, size_t bsize);
    105101void ?+=?(string_res &s, char other); // append a character
    106102void ?+=?(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 }
     103void ?+=?(string_res &s, const char* other);
     104void append(string_res &s, const char* buffer, size_t bsize);
    110105
    111106// Character access
    112 void assignAt(const string_res &s, size_t index, char val);
    113107char ?[?](const string_res &s, size_t index); // Mike changed to ret by val from Sunjay's ref, to match Peter's
    114108//char codePointAt(const string_res &s, size_t index); // revisit under Unicode
Note: See TracChangeset for help on using the changeset viewer.