/* This file is part of cardwords
   (c) 1998 1999 2000 Tobias Peters
   see file COPYING for the copyright terms.
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// cardwords_string.hh

#ifndef CARDWORDS_STRING_HH
#define CARDWORDS_STRING_HH

#include "cardwords_char.hh"
#include <string>
#include <vector>
#include <string.h>
#include <algo.h>
namespace CardWords {

class String {
public:
  String () {};

  String (const string &);

  // this is again ok
  // String (const String&);

  // the default destructor is not virtual enough for the compiler
  // It would be ok to leave that warning in, but warnings are ugly...
  virtual ~String() {};

  // the default assignment operator is ok
  // String&
  // operator= (const String &);

  // assignment from a non-string vector<Char>:
  virtual
  String&
  operator= (const vector<Char> &);

  // copy a part from a non-string vector(Char):
  String (vector<Char>::const_iterator,
                    vector<Char>::const_iterator);
  virtual
  String&
  operator+= (const String &);

  virtual
  String&
  operator+= (const Char &);

  int
  compare (const String &) const;

  bool
  operator== (const String &) const;
  bool
  operator!= (const String &) const;
  bool
  operator< (const String &) const;
  bool
  operator> (const String &) const;

  Char &
  operator[] (int);

  const Char &
  operator[] (int) const;

  size_t
  length (void) const;

  void
  sort (void);

  ostream&
  print_to_stream(ostream &) const;
protected:
  vector<Char> representation;
};
}


ostream&
operator<< (ostream &, const CardWords::String &);


istream&
operator>> (istream &is, CardWords::String &ks);

// declared as friend in String:
// ostream&
// operator<< (ostream & os, const String &ks);

#endif

