// Str.h - Interface to simple string class
// CSE374 example 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();

  // member functions that do not alter this Str are const

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

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

  // 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