Modules |
Files |
Inheritance Tree |
Inheritance Graph |
Name Index |
Config
File: Synopsis/Parser/C++/syn/linkstore.hh
1| // Synopsis C++ Parser: linkstore.hh header file
2| // The LinkStore class which stores syntax and xref link info
3|
4| // $Id: linkstore.hh,v 1.9 2002/12/21 05:04:40 chalky Exp $
5| //
6| // This file is a part of Synopsis.
7| // Copyright (C) 2000-2002 Stephen Davies
8| // Copyright (C) 2000, 2001 Stefan Seefeld
9| //
10| // Synopsis is free software; you can redistribute it and/or modify it
11| // under the terms of the GNU General Public License as published by
12| // the Free Software Foundation; either version 2 of the License, or
13| // (at your option) any later version.
14| //
15| // This program is distributed in the hope that it will be useful,
16| // but WITHOUT ANY WARRANTY; without even the implied warranty of
17| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18| // General Public License for more details.
19| //
20| // You should have received a copy of the GNU General Public License
21| // along with this program; if not, write to the Free Software
22| // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23| // 02111-1307, USA.
24| //
25| // $Log: linkstore.hh,v $
26| // Revision 1.9 2002/12/21 05:04:40 chalky
27| // Move constants since gcc 3.2 didn't like them.
28| //
29| // Revision 1.8 2002/12/09 04:01:00 chalky
30| // Added multiple file support to parsers, changed AST datastructure to handle
31| // new information, added a demo to demo/C++. AST Declarations now have a
32| // reference to a SourceFile (which includes a filename) instead of a filename.
33| //
34| // Revision 1.7 2002/11/17 12:11:43 chalky
35| // Reformatted all files with astyle --style=ansi, renamed fakegc.hh
36| //
37| // Revision 1.6 2002/11/02 06:37:38 chalky
38| // Allow non-frames output, some refactoring of page layout, new modules.
39| //
40| // Revision 1.5 2002/02/19 09:05:16 chalky
41| // Applied patch from David Abrahams to help compilation on Cygwin
42| //
43| // Revision 1.4 2002/01/30 11:53:15 chalky
44| // Couple bug fixes, some cleaning up.
45| //
46| // Revision 1.3 2002/01/28 13:17:24 chalky
47| // More cleaning up of code. Combined xref into LinkStore. Encoded links file.
48| //
49| // Revision 1.2 2002/01/25 14:24:33 chalky
50| // Start of refactoring and restyling effort.
51| //
52| // Revision 1.1 2001/06/10 00:31:39 chalky
53| // Refactored link storage, better comments, better parsing
54| //
55|
56| #ifndef H_SYNOPSIS_CPP_LINKSTORE
57| #define H_SYNOPSIS_CPP_LINKSTORE
58|
59| #include "ast.hh"
60| #include <iostream>
61| class Parser;
62| class Ptree;
63| class SWalker;
64| class FileFilter;
65|
66|
67|
68|
69|
70|
71|
72|
73|
74|
75|
76|
77| class LinkStore
78| {
79| public:
80|
81| enum Context
82| {
83| Reference,
84| Definition,
85| Span,
86| Implementation,
87| UsingDirective,
88| UsingDeclaration,
89| FunctionCall,
90| NumContext
91| };
92|
93|
94|
95|
96|
97| LinkStore(FileFilter* filter, SWalker* swalker);
98|
99|
100| ~LinkStore();
101|
102|
103|
104| void link(Ptree* node, Context, const ScopedName& name, const std::string& desc, const AST::Declaration* decl = NULL);
105|
106|
107| void link(Ptree* node, const AST::Declaration* decl);
108|
109|
110|
111| void link(Ptree* node, Types::Type*, Context = Reference);
112|
113|
114| void span(int line, int col, int len, const char* desc);
115|
116|
117| void span(Ptree* node, const char* desc);
118|
119|
120| void long_span(Ptree* node, const char* desc);
121|
122|
123| SWalker* swalker();
124|
125|
126|
127| class encode;
128|
129|
130| class encode_name;
131|
132| protected:
133|
134| void store_syntax_record(AST::SourceFile*, int line, int col, int len, Context context, const ScopedName& name, const std::string& desc);
135|
136|
137| void store_xref_record(AST::SourceFile*, const AST::Declaration* decl, const std::string& file, int line, Context context);
138|
139|
140| std::ostream& get_syntax_stream(AST::SourceFile*);
141|
142|
143| std::ostream& get_xref_stream(AST::SourceFile*);
144|
145|
146|
147|
148|
149|
150| int find_col(int line, const char* ptr);
151|
152|
153| struct Private;
154|
155| Private* m;
156| };
157|
158| #endif
159|