2 string-data.hh -- declare String_data
4 source file of the LilyPond music typesetter
6 (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "flower-proto.hh"
14 /**Internal String struct.
15 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;
85 #ifdef STRING_UTILS_INLINED
89 #include "string-data.icc"
93 #endif // STRING_DATA_HH