Merge branch 'master' into verilog-ams
[sverilog.git] / LineInfo.h
blobf9b0b9dd89e8c758e3aa23bc5227a60d625108dc
1 #ifndef __LineInfo_H
2 #define __LineInfo_H
3 /*
4 * Copyright (c) 1999 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 # include "StringHeap.h"
23 # include <string>
25 using namespace std;
28 * This class holds line information for an internal object.
30 * Note that the file names are C-style strings that are allocated by
31 * the lexor (which parses the line directives) and are never
32 * deallocated. We can therefore safely store the pointer and never
33 * delete the string, even if LineInfo objects are destroyed.
36 class LineInfo {
37 public:
38 LineInfo();
39 ~LineInfo();
41 // Get a fully formatted file/lineno
42 string get_fileline() const;
43 // Set the file/line fro another LineInfo object.
44 void set_line(const LineInfo&that);
46 // Access parts of LineInfo data
47 void set_file(perm_string f);
48 void set_lineno(unsigned n);
50 perm_string get_file() const { return file_; }
51 unsigned get_lineno() const { return lineno_; }
52 private:
53 perm_string file_;
54 unsigned lineno_;
57 #endif