File: errorMsg.h

package info (click to toggle)
fastml 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,772 kB
  • sloc: cpp: 48,522; perl: 3,588; ansic: 819; makefile: 386; python: 83; sh: 55
file content (33 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// $Id: errorMsg.h 962 2006-11-07 15:13:34Z privmane $

// version 1.01
// last modified 1 Jan 2004

#ifndef ___ERROR_MSG_H
#define ___ERROR_MSG_H

#include <string>
#include <vector>
#include <iostream>

using namespace std;

// The error is always send to cerr. _errorOut is NULL, unless setErrorOstream is called.


class errorMsg {
public:
	static void reportError(const vector<string>& textToPrint, const int exitCode=1);
	static void reportError(const string& textToPrint, const int exitCode=1);
	static void setErrorOstream(ostream* errorOut) {_errorOut = errorOut;}
private:
	static ostream* _errorOut;
};

// example of how to output to a file called error.txt
// ofstream f("error.txt");
// errorMsg::setErrorOstream(&f);
// errorMsg::reportError("cheers");

#endif