]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/string.icc
*** empty log message ***
[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--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef STRING_ICC
10 #define STRING_ICC
11
12 namespace std {
13
14 INLINE
15 char const *
16 String::c_str () const
17 {
18   return strh_.c_str ();
19 }
20
21 // because char const* also has an operator ==, this is for safety:
22 INLINE
23 bool
24 operator == (String s1, char const *s2)
25 {
26   return s1 == String (s2);
27 }
28
29 INLINE
30 bool
31 operator == (char const *s1, String s2)
32 {
33   return String (s1) == s2;
34 }
35
36 INLINE
37 bool
38 operator != (String s1, char const *s2)
39 {
40   return s1 != String (s2);
41 }
42
43 INLINE
44 bool
45 operator != (char const *s1, String s2)
46 {
47   return String (s2) != s1;
48 }
49
50 INLINE
51 char &
52 String::operator [] (int n)
53 {
54   return (char &) strh_[n];
55 }
56
57 INLINE
58 char
59 String::operator [] (int n) const
60 {
61   return strh_[n];
62 }
63
64 INLINE
65 String::String ()
66 {
67 }
68
69 INLINE
70 String::String (char const *source)
71 {
72   assert (source);
73   strh_ = source;
74 }
75
76 }
77
78 #endif /* STRING_ICC */