]> git.saurik.com Git - wxWidgets.git/blame - utils/HelpGen/src/docripper.h
don't blit too much when copying static box border in OnPaint()
[wxWidgets.git] / utils / HelpGen / src / docripper.h
CommitLineData
cecfc5e7
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: No names yet.
3// Purpose: Contrib. demo
4// Author: Aleksandras Gluchovas
5// Modified by:
6// Created: 22/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Aleskandars Gluchovas
41964404 9// Licence: wxWindows licence
cecfc5e7
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __DOCRIPPER_G__
13#define __DOCRIPPER_G__
14
15#include "scriptbinder.h"
16#include "srcparser.h"
17#include "sourcepainter.h"
18
19#if defined( wxUSE_TEMPLATE_STL )
cecfc5e7 20
41964404
WS
21 #include <vector>
22
23 typedef vector<ScriptTemplate*> STemplateListT;
cecfc5e7
VZ
24
25#else
26
41964404 27 #include "wxstlvec.h"
cecfc5e7 28
41964404
WS
29 typedef ScriptTemplate* ScriptTemplatePtrT;
30 typedef WXSTL_VECTOR_SHALLOW_COPY(ScriptTemplatePtrT) STemplateListT;
cecfc5e7
VZ
31
32#endif
33
34
41964404 35// specific DocGenerator class for "Ripper",
cecfc5e7
VZ
36// also acts as source code visitor
37
38class RipperDocGen : public DocGeneratorBase, public spVisitor
39{
40protected:
41964404
WS
41 // templates for various sections
42 ScriptTemplate mTopTempl;
43 ScriptTemplate mContentIdxTempl;
44 ScriptTemplate mSuperContentTempl;
45 ScriptTemplate mSubContentTempl;
46 ScriptTemplate mOutLineTempl;
47 ScriptTemplate mOutLine1Templ;
48
49 // template used for corss-references
50 ScriptTemplate mRefTempl;
51
52 // template used to show not-existing sections
53 ScriptTemplate mDeadRefTempl;
54
55 // template collection for generation of class-tree
56 STemplateListT mTreeTemplates;
57
58 // pointers to all major index sections
59 ScriptSection* mpTopIdx;
60 ScriptSection* mpClassIdx;
61 ScriptSection* mpEnumIdx;
62 ScriptSection* mpTypeDefIdx;
63 ScriptSection* mpMacroIdx;
64 ScriptSection* mpGlobalVarsIdx;
65 ScriptSection* mpGlobalFuncIdx;
66 ScriptSection* mpConstIdx;
67
68 // parser set up from user-code for sepcific language
69 SourceParserBase* mpParser;
70
71 // class section, which is currently being
72 // assembled
73 ScriptSection* mpCurClassSect;
74
75 // source syntax heighlighter object
76 SourcePainter mSrcPainter;
77
78 // context, to which all file contexts
79 // are assembled
80 spContext* mpFileBinderCtx;
81
82 // script tags set up from usesr code
2af95167 83 MarkupTagsT m_Tags;
cecfc5e7
VZ
84
85protected:
41964404 86 // helpers
16a0cc1d 87 void AppendComments( spContext& fromContext, wxString& str );
cecfc5e7 88
401af0f8 89 void AppendMulitilineStr( wxString& st, wxString& mlStr );
cecfc5e7 90
16a0cc1d 91 void AppendHighlightedSource( wxString& st, wxString source );
cecfc5e7 92
41964404
WS
93 // returns true, if no comments found in the context,
94 // plus, creates dummy(empty) section, and puts a
95 // reference woth "dead-link" template to it in the
96 // given index-section "toSect"
cecfc5e7 97
41964404 98 bool CheckIfUncommented( spContext& ctx, ScriptSection& toSect );
cecfc5e7 99
41964404
WS
100 // checks if context has any comments, then returns
101 // template of normal reference, otherwise of dead reference
cecfc5e7 102
41964404 103 ScriptTemplate* GetRefTemplFor( spContext& ctx );
cecfc5e7 104
41964404
WS
105 // adds "someClass::" perfix to the context name,
106 // if it's not in the file scope (i.e. if it's not global)
cecfc5e7 107
41964404 108 wxString GetScopedName( spContext& ofCtx );
cecfc5e7 109
41964404
WS
110 // adds section to currently assembled class section
111 // and places references to it from "public", "protected"
112 // or "private" indexing-subsections of the class, depending
113 // on the visibility of the context
cecfc5e7 114
41964404
WS
115 void AddToCurrentClass( ScriptSection* pSection, spContext& ctx,
116 const char* subSectionName );
cecfc5e7 117
41964404
WS
118 // called, after all files are processed, to
119 // resolve possible super/derived class relations,
120 // and put cross references to them - where resolution was
121 // successful
122 void LinkSuperClassRefs();
cecfc5e7 123
41964404 124 // implementations of "visiting procedures", declared in spVisitor
cecfc5e7 125
41964404
WS
126 virtual void VisitClass( spClass& cl );
127 virtual void VisitEnumeration( spEnumeration& en );
128 virtual void VisitTypeDef( spTypeDef& td );
129 virtual void VisitPreprocessorLine( spPreprocessorLine& pd );
130 virtual void VisitAttribute( spAttribute& attr );
131 virtual void VisitOperation( spOperation& op );
cecfc5e7 132
41964404 133 // overriden member of DocGernatorBase
cecfc5e7 134
41964404 135 virtual bool OnSaveDocument( ScriptStream& stm );
cecfc5e7 136
41964404
WS
137 virtual ScriptSection* GetTopSection()
138 { return mpTopIdx; }
cecfc5e7
VZ
139
140public:
41964404 141 RipperDocGen();
d3c7fc99 142 virtual ~RipperDocGen();
41964404
WS
143
144 // should be called onece to set user-code provided,
145 // parser for specific source code language
146 // (NOTE:: it's the user-code's responsibility to
147 // relseas memory of pParser)
148
149 void Init( SourceParserBase* pParser );
150
151 // should be called on each file
152
153 void ProcessFile( const char* sourceFile );
cecfc5e7
VZ
154};
155
156
753287c1 157#endif