Skip to content
error.hh 1.28 KiB
Newer Older
Seblu's avatar
Seblu committed
/*
  This file is part of SLL.
Seblu's avatar
Seblu committed
  Copyright (C) 2008 Sebastien LUTTRINGER <contact@seblu.net>
Seblu's avatar
Seblu committed

  SLL is free software; you can redistribute it and/or modify
Seblu's avatar
Seblu committed
  it under the terms of the GNU General Public License as published by
Seblu's avatar
Seblu committed
  the Free Software Foundation; version 2 of the License.
Seblu's avatar
Seblu committed

  SLL is distributed in the hope that it will be useful,
Seblu's avatar
Seblu committed
  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 SLL; if not, write to the Free Software
Seblu's avatar
Seblu committed
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Seblu's avatar
Seblu committed
*/

Seblu's avatar
Seblu committed
#ifndef ERROR_HH
# define ERROR_HH

# include "slm.hh"
Seblu's avatar
Seblu committed

class Error
{
public:
  Error(int i, string s = "");
  Error(const Error &e);
Seblu's avatar
Seblu committed
  void print() const;
  string message() const;

  void suffix(const string &);
  void prefix(const string &);

Seblu's avatar
Seblu committed
  int code() const;
  void code(int);
Seblu's avatar
Seblu committed
  Error &operator=(const Error &rhs);
  friend ostream &operator<<(ostream &o, const Error &e);
  friend Error &operator<<(Error &e, const string &s);
  friend Error &operator>>(Error &e, const string &s);
  friend Error &operator<<(Error &e, int val);
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
protected:
  sstream msg_;
  int val_;
};

#endif