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"
16 /**Internal String struct.
17 the data itself. Handles simple tasks (resizing, resetting)
21 // GNU malloc: storage overhead is 8 bytes anyway.
23 friend class String_handle;
24 int maxlen; // maxlen is arraysize-1
33 /// init from src. Conservative allocation.
34 String_data (String_data const &src);
38 /** POST: maxlen >= j.
39 @param j, maximum stringlength_.
44 /** POST: maxlen >= j.
45 @param j, maximum stringlength_.
46 contents are kept if it grows.
50 /// check if writeable.
56 /// reduce memory usage.
60 void set (Byte const *byte, int length_i);
62 void set (char const *str0);
65 void append (Byte const *byte, int length_i);
67 void operator += (char const *str0);
69 char const *c_str () const;
73 Byte const *to_bytes () const;
80 /** access element. not really safe. Can alter length_ without
81 #String_data# knowing it. */
82 Byte &operator [] (int j);
83 Byte operator [] (int j) const;
84 bool is_binary_bo () const;
89 #ifdef STRING_UTILS_INLINED
93 #include "string-data.icc"
96 #endif // STRING_DATA_HH