2 string-handle.hh -- declare String_handle
4 source file of the LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #ifndef STRINGHANDLE_HH
11 #define STRINGHANDLE_HH
13 #include "flower-proto.hh"
17 Reference counting for strings.
19 handles ref. counting, and provides a very thin interface using
26 /// decrease ref count. Named kind of like a Tanenbaum semafore
29 /// increase ref count
30 void up (String_data *d);
32 /** make sure data has only one reference.
33 POST: data->references == 1
40 String_handle (String_handle const & src);
42 Byte const* to_bytes () const;
43 char const* to_str0 () const;
46 bool is_binary_bo () const;
47 void operator = (String_handle const &src);
48 void operator += (char const *s);
49 Byte operator[] (int j) const;
51 /** Access elements. WARNING: NOT SAFE
52 don't use this for loops. Use to_bytes ()
54 Byte &operator[] (int j);
55 void append (Byte const* byte, int length_i);
56 void set (Byte const* byte, int length_i);
57 void operator = (char const *p);
62 #ifdef STRING_UTILS_INLINED
66 #include "string-handle.icc"
67 /* we should be resetting INLINE. oh well. */
71 #endif // STRINGHANDLE_HH