Aegis  4.25.D505
libaegis/aer/pos.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 1996, 2002-2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef AEGIS_AER_POS_H
00021 #define AEGIS_AER_POS_H
00022 
00023 #include <common/ac/shared_ptr.h>
00024 #include <common/nstring.h>
00025 
00026 struct sub_context_ty; // existence
00027 
00028 class sub_context_ty; // forward
00029 
00034 class rpt_position
00035 {
00036 public:
00037     typedef aegis_shared_ptr<rpt_position> pointer;
00038 
00039     virtual ~rpt_position();
00040 
00041 private:
00042     rpt_position(const nstring &file_name, long linum1, long linum2);
00043 
00044 public:
00045     static rpt_position::pointer create(const nstring &file_name);
00046 
00047     static rpt_position::pointer create(const nstring &file_name, long linum);
00048 
00049     static rpt_position::pointer create(const nstring &file_name, long linum1,
00050         long linum2);
00051 
00052     static rpt_position::pointer join(const rpt_position::pointer &lhs,
00053         const rpt_position::pointer &rhs);
00054 
00055     void print_error(sub_context_ty &sc, const char *text) const;
00056 
00057     nstring get_file_name() const { return file_name; }
00058 
00059     long get_line_number() const { return line_number[0]; }
00060 
00061     nstring representation() const;
00062 
00063 private:
00064     nstring file_name;
00065     long line_number[2];
00066 };
00067 
00068 #endif // AEGIS_AER_POS_H