]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/string.icc
*** empty log message ***
[lilypond.git] / flower / include / string.icc
index da95d373e60f74be42cf9853b0cb4a7dd207a949..5f8a39a495e1f5258ffbefe5198a5b71341365c5 100644 (file)
@@ -1,35 +1,78 @@
-/*   
+/*
   string.icc -- implement String inlines
-  
+
   source file of the Flower Library
-  
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
+
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
 
 #ifndef STRING_ICC
 #define STRING_ICC
 
+namespace std {
+
+INLINE
+char const *
+String::c_str () const
+{
+  return strh_.c_str ();
+}
+
+// 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 String (s1) == s2;
+}
+
+INLINE
+bool
+operator != (String s1, char const *s2)
+{
+  return s1 != String (s2);
+}
+
+INLINE
+bool
+operator != (char const *s1, String s2)
+{
+  return String (s2) != s1;
+}
 
-INLINE 
+INLINE
 char &
-String::operator [](int n)
+String::operator [] (int n)
 {
-  return (char &) strh_[n]; 
+  return (char &) strh_[n];
 }
 
-INLINE 
-char 
-String::operator [](int n) const
+INLINE
+char
+String::operator [] (int n) const
 {
-  return strh_[n]; 
+  return strh_[n];
 }
 
-INLINE 
-String::String () 
+INLINE
+String::String ()
 {
 }
 
+INLINE
+String::String (char const *source)
+{
+  assert (source);
+  strh_ = source;
+}
 
+}
 
 #endif /* STRING_ICC */