1999-01-25 06:45:56 +01:00
|
|
|
#ifndef __LineInfo_H
|
|
|
|
|
#define __LineInfo_H
|
|
|
|
|
/*
|
2010-12-14 02:42:48 +01:00
|
|
|
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
|
1999-01-25 06:45:56 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form 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
|
|
|
|
|
*/
|
|
|
|
|
|
1999-02-15 03:06:15 +01:00
|
|
|
# include <string>
|
1999-01-25 06:45:56 +01:00
|
|
|
|
2005-06-14 17:33:54 +02:00
|
|
|
using namespace std;
|
|
|
|
|
|
2000-11-30 18:31:42 +01:00
|
|
|
/*
|
|
|
|
|
* This class holds line information for an internal object.
|
|
|
|
|
*
|
|
|
|
|
* Note that the file names are C-style strings that are allocated by
|
|
|
|
|
* the lexor (which parses the line directives) and are never
|
|
|
|
|
* deallocated. We can therefore safely store the pointer and never
|
|
|
|
|
* delete the string, even if LineInfo objects are destroyed.
|
|
|
|
|
*/
|
|
|
|
|
|
1999-01-25 06:45:56 +01:00
|
|
|
class LineInfo {
|
|
|
|
|
public:
|
2003-01-17 06:49:03 +01:00
|
|
|
LineInfo();
|
2000-11-30 18:31:42 +01:00
|
|
|
~LineInfo();
|
1999-01-25 06:45:56 +01:00
|
|
|
|
2005-08-13 02:45:53 +02:00
|
|
|
std::string get_line() const;
|
1999-01-25 06:45:56 +01:00
|
|
|
|
2000-11-30 18:31:42 +01:00
|
|
|
void set_line(const LineInfo&that);
|
1999-02-01 01:26:48 +01:00
|
|
|
|
2003-01-17 06:49:03 +01:00
|
|
|
void set_file(const char*f);
|
|
|
|
|
void set_lineno(unsigned n);
|
1999-01-25 06:45:56 +01:00
|
|
|
|
|
|
|
|
private:
|
2000-11-30 18:31:42 +01:00
|
|
|
const char* file_;
|
1999-01-25 06:45:56 +01:00
|
|
|
unsigned lineno_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|