Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

Point.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                       Copyright 2003, SuSE Linux AG  |
00011 \----------------------------------------------------------------------/
00012 
00013    File:        Point.h
00014 
00015    Author:      Klaus Kaempf <kkaempf@suse.de>
00016    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00017 
00018    Definition of "definition point" which stores
00019    - filename
00020    - line number
00021    - inclusion point
00022    to trace filenames, definition points, and include hierachies
00023 
00024    This helps in issuing proper error messages like
00025      "identifier <name>
00026       defined in <file1> at <line1>
00027       included from <file2> at <line2>
00028       included from <toplevel> at <line>"
00029 
00030    A TableEntry (identifier <name>) has a Point which stores the definition
00031    point (Point) of this identifier.
00032    If its Point is in an include file, the m_point member points to the
00033    inclusion point (where the 'include ".."' statement is) of the include
00034    file.
00035 
00036    Point works as a linked list (file1 -> file2 -> toplevel in the above
00037    example) for definition points inside include files. The real structure
00038    is a tree since for the next include of file3 inside file2, the list
00039    is file3 -> file2 -> toplevel and the latter two nodes are shared.
00040 
00041    An identifier has a definition point. A file has a filename and
00042    an inclusion point (if its an included file).
00043 /-*/
00044 // -*- c++ -*-
00045 
00046 #ifndef Point_h
00047 #define Point_h
00048 
00049 #include <string>
00050 using std::string;
00051 
00052 // MemUsage.h defines/undefines D_MEMUSAGE
00053 #include <y2util/MemUsage.h>
00054 #include "ycp/SymbolEntry.h"
00055 
00056 class Point
00057 #ifdef D_MEMUSAGE
00058    : public MemUsage
00059 #endif
00060 {
00061   private:
00062     SymbolEntryPtr m_entry;             // filename as SymbolEntry (c_filename)
00063     int m_line;                         // line of definition / inclusion
00064     const Point *m_point;               // points to toplevel point for include files
00065   public:
00066     size_t mem_size () const { return sizeof (Point); }
00067     Point (std::string filename, int line = 0, const Point *point = 0);
00068     Point (SymbolEntryPtr sentry, int line = 0, const Point *point = 0);
00069     Point (std::istream & str);
00070     ~Point (void);
00071 
00072     SymbolEntryPtr sentry (void) const;
00073     std::string filename (void) const;
00074     int line (void) const;
00075     const Point *point (void) const;
00076 
00077     std::string toString (void) const;
00078     std::ostream & toStream (std::ostream & str) const;
00079 };
00080 #endif // Point_h

Generated on Fri Nov 9 18:15:22 2007 for yast2-core by doxygen 1.3.6