]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/string-handle.icc
*** empty log message ***
[lilypond.git] / flower / include / string-handle.icc
index 74b755b22c414d1f011274f88b4d96bb6713f2e7..aed19027d00cee907a5d709041bcabc3c60adb41 100644 (file)
@@ -4,52 +4,60 @@
 
   source file of Flower lib
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #ifndef STRINGHANDLE_INL
 #define STRINGHANDLE_INL
 
-#include <assert.h>
+#include <cassert>
+
 #include <memory.h>
 
 #include "string-data.hh"
 #include "string-handle.hh"
 
 INLINE void 
-String_handle::down() 
+String_handle::down () 
 { 
-  if (!(--data->references)) delete data; data = 0; 
+  if (! (--data->ref_count_))
+    delete data;
+  data = 0; 
 }
 
-/// increase ref count
+/*
+  increase ref count
+
+  THIS does not have to be initialized.
+*/
 INLINE void 
 String_handle::up (String_data *d) 
 { 
-  data=d; data->references ++; 
+  data=d;
+  data->ref_count_ ++; 
 }
 
 INLINE void 
-String_handle::copy() 
+String_handle::copy () 
 {
-  if (data->references !=1)
+  if (data->ref_count_ !=1)
     {
       String_data *newdata = new String_data (*data);
-      down();
+      down ();
       up (newdata);
     }
 }
 
 INLINE
-String_handle::String_handle() 
+String_handle::String_handle () 
 {
   up (new String_data);
 }
 
 INLINE
-String_handle::~String_handle() 
+String_handle::~String_handle () 
 {      
-  down();
+  down ();
 }    
 
 INLINE
@@ -59,99 +67,99 @@ String_handle::String_handle (String_handle const & src)
 }
 
 INLINE Byte* 
-String_handle::byte_l() 
+String_handle::get_bytes () 
 {
-  copy();
-  return data->byte_l();
+  copy ();
+  return data->get_bytes ();
 }
 
 INLINE char* 
-String_handle::ch_l() 
+String_handle::get_str0 () 
 {
-  copy();
-  return (char*)data->byte_l();
+  copy ();
+  return (char*)data->get_bytes ();
 }
 
 INLINE Byte 
-const* String_handle::byte_C() const 
+const* String_handle::to_bytes () const 
 {
-  return data->byte_C();
+  return data->to_bytes ();
 }
 
 INLINE char const* 
-String_handle::ch_C() const 
+String_handle::to_str0 () const 
 {
-  return (char const*)data->byte_C();
+  return (char const*)data->to_bytes ();
 }
 
 INLINE void 
-String_handle::operator =(String_handle const &src) 
+String_handle::operator = (String_handle const &src) 
 {
   if (this == &src)
     return;
-  down();
+  down ();
   up (src.data);
 }
 
 INLINE void 
 String_handle::operator += (char const *s) 
 {      
-  copy();
+  copy ();
   *data += s;
 }    
 
 
 INLINE Byte 
-String_handle::operator[](int j) const 
+String_handle::operator[] (int j) const 
 { 
   return (*data)[j]; 
 }
 
 // !NOT SAFE!
-// don't use this for loops. Use byte_C()
+// don't use this for loops. Use to_bytes ()
 INLINE Byte &
-String_handle::operator[](int j) 
+String_handle::operator[] (int j) 
 {
-  copy();      // hmm. Not efficient
-  return data->byte_l()[j];
+  copy ();     // hmm. Not efficient
+  return data->get_bytes ()[j];
 }
 
 INLINE void 
-String_handle::append (Byte const* byte_C, int length_i) 
+String_handle::append (Byte const* byte, int length_i) 
 {
-  copy();
-  data->append (byte_C, length_i);
+  copy ();
+  data->append (byte, length_i);
 }
                           
 INLINE void 
-String_handle::set (Byte const* byte_C, int length_i) 
+String_handle::set (Byte const* byte, int length_i) 
 {
-  copy();
-  data->set (byte_C, length_i);
+  copy ();
+  data->set (byte, length_i);
 }
                           
 INLINE void 
 String_handle::operator = (char const *p) 
 {
-  copy();
+  copy ();
   data->set (p);
 }
                           
 INLINE void 
 String_handle::trunc (int j) 
 {
-  copy(); data->trunc (j); 
+  copy (); data->trunc (j); 
 }
 
 INLINE int 
-String_handle::length_i() const 
+String_handle::length () const 
 { 
-  return data->length_i_
+  return data->length_; 
 }
 
 INLINE bool
-String_handle::is_binary_bo() const {
-  return data->is_binary_bo();
+String_handle::is_binary_bo () const {
+  return data->is_binary_bo ();
 }
 
 #endif