2 string-handle.hh -- declare String_handle
4 source file of the LilyPond music typesetter
6 (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #ifndef STRINGHANDLE_HH
10 #define STRINGHANDLE_HH
12 #include "flower-proto.hh"
15 Reference counting for strings.
17 handles ref. counting, and provides a very thin interface using
24 /// decrease ref count. Named kind of like a Tanenbaum semafore
27 void up (String_data *d);
29 /** make sure data has only one reference.
30 POST: data->ref_count_ == 1
37 String_handle (String_handle const &src);
39 Byte const *to_bytes () const;
40 char const *c_str () const;
43 bool is_binary_bo () const;
44 void operator = (String_handle const &src);
45 void operator += (char const *s);
46 Byte operator [] (int j) const;
48 /** Access elements. WARNING: NOT SAFE
49 don't use this for loops. Use to_bytes ()
51 Byte &operator [] (int j);
52 void append (Byte const *byte, int length_i);
53 void set (Byte const *byte, int length_i);
54 void operator = (char const *p);
59 #ifdef STRING_UTILS_INLINED
63 #include "string-handle.icc"
64 /* we should be resetting INLINE. oh well. */
67 #endif // STRINGHANDLE_HH