00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
#ifndef BASICFILELOCATION_H
00027
#define BASICFILELOCATION_H
00028
00029
#include <string>
00030
00036 class BasicFileLocation {
00037 std::string
filename;
00038 long line;
00039 long col;
00040 bool empty;
00041
00042
public:
00046 BasicFileLocation() :
line(-1),
col(-1),
empty(true) {}
00047
00051 BasicFileLocation(
const BasicFileLocation &x) :
00052
filename(x.
filename),
line(x.
line),
col(x.
col),
empty(x.
empty) {}
00053
00059 BasicFileLocation(
const std::string filename,
const long line,
00060
const long col) :
00061 filename(filename), line(line), col(col),
empty(false) {}
00062
00063 virtual ~BasicFileLocation() {}
00064
00065 const std::string
getFilename()
const {
return filename;}
00066
00070 const long getLine()
const {
return line;}
00071
00075 const long getCol()
const {
return col;}
00076
00080 bool isEmpty()
const {
return empty;}
00081
00082
friend std::ostream &
operator<<(std::ostream &stream,
00083
const BasicFileLocation &fl);
00084 };
00085
00095 std::ostream &
operator<<(std::ostream &stream,
const BasicFileLocation &fl);
00096
00097 #define FILE_LOCATION BasicFileLocation(__FILE__, __LINE__, -1)
00098
00099
#endif