]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/string.icc
526d7c4eba9448be4aa5972a5537ce7d7cc63dca
[lilypond.git] / flower / include / string.icc
1 /*
2   string.icc -- implement String inlines
3
4   source file of the Flower Library
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef STRING_ICC
10 #define STRING_ICC
11
12 /// for completeness (=handy)
13 INLINE
14 String
15 to_string (String s)
16 {
17   return s;
18 }
19
20 // because char const* also has an operator ==, this is for safety:
21 INLINE
22 bool
23 operator == (String s1, char const *s2)
24 {
25   return s1 == String (s2);
26 }
27
28 INLINE
29 bool
30 operator == (char const *s1, String s2)
31 {
32   return String (s1) == s2;
33 }
34
35 INLINE
36 bool
37 operator != (String s1, char const *s2)
38 {
39   return s1 != String (s2);
40 }
41
42 INLINE
43 bool
44 operator != (char const *s1, String s2)
45 {
46   return String (s2) != s1;
47 }
48
49 INLINE
50 char &
51 String::operator [] (int n)
52 {
53   return (char &) strh_[n];
54 }
55
56 INLINE
57 char
58 String::operator [] (int n) const
59 {
60   return strh_[n];
61 }
62
63 INLINE
64 String::String ()
65 {
66 }
67
68 INLINE
69 String::String (char const *source)
70 {
71   assert (source);
72   strh_ = source;
73 }
74
75 #endif /* STRING_ICC */