]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/string-data.hh
* The grand 2005-2006 replace.
[lilypond.git] / flower / include / string-data.hh
index 0b71643e98aa11e6cb60699f89131b0b012080ca..da528ef77bc466f20e58831bd7f86c3da78faf4e 100644 (file)
@@ -3,86 +3,85 @@
 
   source file of the LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-
 #ifndef STRINGDATA_HH
 #define STRINGDATA_HH
 
+#include "flower-proto.hh"
 
 /**Internal String struct.
    the data itself. Handles simple tasks (resizing, resetting)
-   */
-class String_data {
-    // GNU malloc: storage overhead is 8 bytes anyway.
-
-friend class String_handle;
-    int maxlen;        // maxlen is arraysize-1
-    
-    int length_i_;
-    Byte* data_byte_p_;
-    int references;
-
-    /// init to ""
-    String_data();
-
-    /// init from src. Conservative allocation.
-    String_data (String_data const &src); 
-    
-    ~String_data();
-
-    /** POST: maxlen >= j.
-      @param j, maximum stringlength_i_.    
+*/
+class String_data
+{
+  // GNU malloc: storage overhead is 8 bytes anyway.
+
+  friend class String_handle;
+  int maxlen;  // maxlen is arraysize-1
+
+  int length_;
+  Byte *data_byte_;
+  int ref_count_;
+
+  /// init to ""
+  String_data ();
+
+  /// init from src. Conservative allocation.
+  String_data (String_data const &src);
+
+  ~String_data ();
+
+  /** POST: maxlen >= j.
+      @param j, maximum stringlength_.
       contents thrown away.
-    */
-    void setmax (int j);
-    
-    /** POST: maxlen >= j.
-      @param j, maximum stringlength_i_.
+  */
+  void setmax (int j);
+
+  /** POST: maxlen >= j.
+      @param j, maximum stringlength_.
       contents are kept if it grows.
-      */
-    void remax (int j);
+  */
+  void remax (int j);
+
+  /// check if writeable.
+  void OKW ();
 
-    /// check if writeable.
-    void OKW();
+  /// check state.
+  void OK ();
 
-    /// check state.
-    void OK();
+  /// reduce memory usage.
+  void tighten ();
 
-    /// reduce memory usage.
-    void tighten();
+  // assignment.
+  void set (Byte const *byte, int length_i);
 
-    // assignment.
-    void set (Byte const* byte_C, int length_i);
+  void set (char const *str0);
 
-    void set (char const* ch_C);
-    
-    /// concatenation.
-    void append (Byte const* byte_C, int length_i);
+  /// concatenation.
+  void append (Byte const *byte, int length_i);
 
-    void operator += (char const* ch_C);
+  void operator += (char const *str0);
 
-    char const* ch_C() const; 
+  char const *to_str0 () const;
 
-    char* ch_l();
+  char *get_str0 ();
 
-    Byte const* byte_C() const;
+  Byte const *to_bytes () const;
 
-    // idem, non const
-    Byte* byte_l();
+  // idem, non const
+  Byte *get_bytes ();
 
-    void trunc (int j);
+  void trunc (int j);
 
-    /** access element. not really safe. Can alter length_i_ without
+  /** access element. not really safe. Can alter length_ without
       #String_data# knowing it.  */
-    Byte &operator [](int j);
-    Byte operator [](int j) const;
-    bool is_binary_bo() const;
+  Byte &operator [] (int j);
+  Byte operator [] (int j) const;
+  bool is_binary_bo () const;
 };
 
-
-
 #ifdef STRING_UTILS_INLINED
 #ifndef INLINE
 #define INLINE inline
@@ -91,5 +90,4 @@ friend class String_handle;
 
 #endif
 
-
 #endif // STRING_DATA_HH