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 "y2/SymbolEntry.h"
00055 
00056 class bytecodeistream;
00057 
00058 class Point
00059 #ifdef D_MEMUSAGE
00060    : public MemUsage
00061 #endif
00062 {
00063   private:
00064     SymbolEntryPtr m_entry;             // filename as SymbolEntry (c_filename)
00065     int m_line;                         // line of definition / inclusion
00066     const Point *m_point;               // points to toplevel point for include files
00067   public:
00068     size_t mem_size () const { return sizeof (Point); }
00069     Point (std::string filename, int line = 0, const Point *point = 0);
00070     Point (SymbolEntryPtr sentry, int line = 0, const Point *point = 0);
00071     Point (bytecodeistream & str);
00072     ~Point (void);
00073 
00074     SymbolEntryPtr sentry (void) const;
00075     std::string filename (void) const;
00076     int line (void) const;
00077     const Point *point (void) const;
00078 
00079     std::string toString (void) const;
00080     std::ostream & toStream (std::ostream & str) const;
00081 };
00082 #endif // Point_h

Generated on Fri Jun 16 18:07:45 2006 for yast2-core by  doxygen 1.4.6