]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/string.icc
f0ceee1fac63b95fe7889b9fdf29a0bba80f573d
[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@xs4all.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 INLINE
21 char const *
22 String::to_str0 () const
23 {
24   return strh_.to_str0 ();
25 }
26
27 // because char const* also has an operator ==, this is for safety:
28 INLINE
29 bool
30 operator == (String s1, char const *s2)
31 {
32   return s1 == String (s2);
33 }
34
35 INLINE
36 bool
37 operator == (char const *s1, String s2)
38 {
39   return String (s1) == s2;
40 }
41
42 INLINE
43 bool
44 operator != (String s1, char const *s2)
45 {
46   return s1 != String (s2);
47 }
48
49 INLINE
50 bool
51 operator != (char const *s1, String s2)
52 {
53   return String (s2) != s1;
54 }
55
56 INLINE
57 char &
58 String::operator [] (int n)
59 {
60   return (char &) strh_[n];
61 }
62
63 INLINE
64 char
65 String::operator [] (int n) const
66 {
67   return strh_[n];
68 }
69
70 INLINE
71 String::String ()
72 {
73 }
74
75 INLINE
76 String::String (char const *source)
77 {
78   assert (source);
79   strh_ = source;
80 }
81
82 #endif /* STRING_ICC */