2 string-data.hh -- declare String_data
4 source file of the LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "flower-proto.hh"
15 /**Internal String struct.
16 the data itself. Handles simple tasks (resizing, resetting)
19 // GNU malloc: storage overhead is 8 bytes anyway.
21 friend class String_handle;
22 int maxlen; // maxlen is arraysize-1
31 /// init from src. Conservative allocation.
32 String_data (String_data const &src);
36 /** POST: maxlen >= j.
37 @param j, maximum stringlength_.
42 /** POST: maxlen >= j.
43 @param j, maximum stringlength_.
44 contents are kept if it grows.
48 /// check if writeable.
54 /// reduce memory usage.
58 void set (Byte const* byte, int length_i);
60 void set (char const* str0);
63 void append (Byte const* byte, int length_i);
65 void operator += (char const* str0);
67 char const* to_str0 () const;
71 Byte const* to_bytes () const;
78 /** access element. not really safe. Can alter length_ without
79 #String_data# knowing it. */
80 Byte &operator [] (int j);
81 Byte operator [] (int j) const;
82 bool is_binary_bo () const;
87 #ifdef STRING_UTILS_INLINED
91 #include "string-data.icc"
96 #endif // STRING_DATA_HH