2 stringhandle.hh -- declare String_handle
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #ifndef STRINGHANDLE_HH
11 #define STRINGHANDLE_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 /// increase ref count
29 void up(String_data
*d
);
31 /** make sure data has only one reference.
32 POST: data->references == 1
39 String_handle(String_handle
const & src
);
41 Byte
const* byte_c_l() const;
42 char const* ch_c_l() const;
46 void operator =(String_handle
const &src
);
47 void operator += (char const *s
);
48 Byte
operator[](int j
) const;
50 /** Access elements. WARNING: NOT SAFE
51 don't use this for loops. Use byte_c_l()
53 Byte
&operator[](int j
);
54 void append( Byte
const* byte_c_l
, int length_i
);
55 void set( Byte
const* byte_c_l
, int length_i
);
56 void operator = (char const *p
);
61 #ifdef STRING_UTILS_INLINED
65 #include "stringhandle.inl"
66 /* we should be resetting INLINE. oh well. */
70 #endif // STRINGHANDLE_HH