2 string-data.hh -- declare String_data
4 source file of the LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 /**Internal String struct.
15 the data itself. Handles simple tasks (resizing, resetting)
18 // GNU malloc: storage overhead is 8 bytes anyway.
20 friend class String_handle;
21 int maxlen; // maxlen is arraysize-1
30 /// init from src. Conservative allocation.
31 String_data (String_data const &src);
35 /** POST: maxlen >= j.
36 @param j, maximum stringlength_i_.
41 /** POST: maxlen >= j.
42 @param j, maximum stringlength_i_.
43 contents are kept if it grows.
47 /// check if writeable.
53 /// reduce memory usage.
57 void set (Byte const* byte_C, int length_i);
59 void set (char const* ch_C);
62 void append (Byte const* byte_C, int length_i);
64 void operator += (char const* ch_C);
66 char const* ch_C() const;
70 Byte const* byte_C() const;
77 /** access element. not really safe. Can alter length_i_ without
78 #String_data# knowing it. */
79 Byte &operator [](int j);
80 Byte operator [](int j) const;
81 bool is_binary_bo() const;
86 #ifdef STRING_UTILS_INLINED
90 #include "string-data.icc"
95 #endif // STRING_DATA_HH