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"
16 Reference counting for strings.
18 handles ref. counting, and provides a very thin interface using
25 /// decrease ref count. Named kind of like a Tanenbaum semafore
28 void up (String_data *d);
30 /** make sure data has only one reference.
31 POST: data->ref_count_ == 1
38 String_handle (String_handle const &src);
40 Byte const *to_bytes () const;
41 char const *c_str () const;
44 bool is_binary_bo () const;
45 void operator = (String_handle const &src);
46 void operator += (char const *s);
47 Byte operator [] (int j) const;
49 /** Access elements. WARNING: NOT SAFE
50 don't use this for loops. Use to_bytes ()
52 Byte &operator [] (int j);
53 void append (Byte const *byte, int length_i);
54 void set (Byte const *byte, int length_i);
55 void operator = (char const *p);
62 #ifdef STRING_UTILS_INLINED
66 #include "string-handle.icc"
67 /* we should be resetting INLINE. oh well. */
70 #endif // STRINGHANDLE_HH