]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/string.icc
* The grand 2005-2006 replace.
[lilypond.git] / flower / include / string.icc
index 7b4985b8c3cd1da14ee9b5d96d3f2ad21e89954f..52d221b5a0d74abbda527027569729fcafad731b 100644 (file)
@@ -1,35 +1,82 @@
-/*   
+/*
   string.icc -- implement String inlines
-  
+
   source file of the Flower Library
-  
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
+
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
 
 #ifndef STRING_ICC
 #define STRING_ICC
 
+/// for completeness (=handy)
+INLINE
+String
+to_string (String s)
+{
+  return s;
+}
 
-INLINE 
-char &
-String::operator [](int n)
+INLINE
+char const *
+String::to_str0 () const
+{
+  return strh_.to_str0 ();
+}
+
+// because char const* also has an operator ==, this is for safety:
+INLINE
+bool
+operator == (String s1, char const *s2)
+{
+  return s1 == String (s2);
+}
+
+INLINE
+bool
+operator == (char const *s1, String s2)
 {
-  return (char &) strh_[n]; 
+  return String (s1) == s2;
 }
 
-INLINE 
-char 
-String::operator [](int n) const
+INLINE
+bool
+operator != (String s1, char const *s2)
 {
-  return strh_[n]; 
+  return s1 != String (s2);
 }
 
-INLINE 
-String::String () 
+INLINE
+bool
+operator != (char const *s1, String s2)
 {
+  return String (s2) != s1;
 }
 
+INLINE
+char &
+String::operator [] (int n)
+{
+  return (char &) strh_[n];
+}
+
+INLINE
+char
+String::operator [] (int n) const
+{
+  return strh_[n];
+}
 
+INLINE
+String::String ()
+{
+}
+
+INLINE
+String::String (char const *source)
+{
+  assert (source);
+  strh_ = source;
+}
 
 #endif /* STRING_ICC */