// str.h - Interface to simple string class
//
// CSE374 example, 5/08-11/15 hp

#ifndef STR_H
#define STR_H

class str {
 public:
  // constructors
  // create empty string
  str();

  // create str from c-string s
  str(const char *s);

  // copy constructor - initialize this to be a copy of s
  str(const str &s);

  // destructor
  ~str();

  // return length of this string
  int length();

  // return a new c-string on the heap 
  // with a copy of the contents of this string
  char * c_str();

  // append contents of s to the end of this string
  void append(const str &s);

  // string assignment
  // (way beyond CSE303/374, but pretty cool nevertheless)
  // (returns reference to lhs to allow chained assignments s=t=u;)
  str & operator=(const str &s);

 private:
  // str representation
  char *st;        // c-string on heap with data bytes terminated by \0
};

#endif