OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [wxwin/] [docsystem.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//                                                                          
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
//
6
// This program is part of the eCos host tools.
7
//
8
// This program is free software; you can redistribute it and/or modify it 
9
// under the terms of the GNU General Public License as published by the Free 
10
// Software Foundation; either version 2 of the License, or (at your option) 
11
// any later version.
12
// 
13
// This program is distributed in the hope that it will be useful, but WITHOUT 
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16
// more details.
17
// 
18
// You should have received a copy of the GNU General Public License along with
19
// this program; if not, write to the Free Software Foundation, Inc., 
20
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
//
22
// ----------------------------------------------------------------------------
23
//                                                                          
24
//####COPYRIGHTEND####
25
//===========================================================================
26
//#####DESCRIPTIONBEGIN####
27
//
28
// Author(s):   julians
29
// Contact(s):  julians
30
// Date:                2001/04/04
31
// Version:             0.01
32
// Purpose:     
33
// Description: Classes for the Configtool documentation system
34
// Requires:    
35
// Provides:    
36
// See also:    
37
// Known bugs:  
38
// Usage:       
39
//
40
//####DESCRIPTIONEND####
41
//  
42
//===========================================================================
43
 
44
#ifndef _EC_DOCSYSTEM_H_
45
#define _EC_DOCSYSTEM_H_
46
 
47
#ifdef __GNUG__
48
#pragma interface "docsystem.cpp"
49
#endif
50
 
51
#include "htmlparser.h"
52
 
53
enum ecIndexType { ecIndexByClass, ecIndexByList, ecIndexNoParse, ecIndexStartSection, ecIndexEndSection } ;
54
 
55
/*
56
 * ecHtmlIndexer
57
 * A class to parse files and generate suitable MS Html Help/wxHTML Help compatible
58
 * project, contents and keyword files.
59
 */
60
 
61
class ecHtmlIndexer: public wxObject
62
{
63
public:
64
    ecHtmlIndexer(bool useRelativeURLs = TRUE);
65
    ~ecHtmlIndexer();
66
 
67
//// Operations
68
    // Top-level function: generate appropriate index files
69
    // and place them either in the install directory or if that is read-only,
70
    // in the user's .eCos directory
71
    // Returns TRUE and the created project file if successful
72
    bool IndexDocs(const wxString& reposDir, wxString& projectFile, bool force = TRUE);
73
 
74
    // Creates the project, contents and keywords files using the ecIndexItems
75
    // we previously added.
76
    bool DoIndexDocs(const wxString& reposDir, wxString& projectFile, bool force = TRUE);
77
 
78
    // If tag is an <A HREF...>, write the item by looking at the text between <A> and </A>
79
    void CreateHHCOutputItem(wxSimpleHtmlTag* tag, int level, int& indent, const wxString& pathPrefix, const wxString& docDir, wxOutputStream& stream);
80
 
81
    // Append HHC-compatible code to a stream according to the tags found in the
82
    // given HTML file: use P CLASS attributes to determine level.
83
    bool CreateHHCByExaminingClass(const wxString& title, const wxString& topURL, const wxString& htmlFile, const wxString& docDir, wxOutputStream& stream, int startIndent = 0);
84
 
85
    // Append HHC-compatible code to a stream according to the tags found in the
86
    // given HTML file: use <DL> </DL> level
87
    bool CreateHHCByExaminingList(const wxString& title, const wxString& topURL, const wxString& htmlFile, const wxString& docDir, wxOutputStream& stream, int startIndent = 0);
88
 
89
    // Just add the given contents item without parsing
90
    bool CreateHHCItem(const wxString& title, const wxString& topURL, const wxString& docDir, wxOutputStream& stream, int startIndent = 0);
91
 
92
    void CreateHHCWriteHeader(wxOutputStream& stream);
93
    void CreateHHCWriteFooter(wxOutputStream& stream);
94
 
95
    // Start a section, which may or may not contain multiple subsections, one per architecture
96
    bool CreateHHCStartSection(const wxString& title, const wxString& topURL, const wxString& docDir, wxOutputStream& stream);
97
    bool CreateHHCEndSection(wxOutputStream& stream);
98
 
99
    // Create a section for all the Packages in the system, using the current document/repository
100
    bool CreateHHCPackagesSection(const wxString& title, const wxString& topURL, wxOutputStream& stream, const wxString& htmlPath);
101
 
102
    // Convert redirection to actual filename
103
    static wxString Redirect(const wxString& baseName, const wxString& url);
104
 
105
    // Write the project file
106
    bool WriteHHP(const wxString& filename, const wxString& docDir);
107
 
108
    // Find appropriate destination directory for writing files to
109
    wxString FindIndexFilesDir(const wxString& reposDir) ;
110
 
111
//// Operations on items
112
    void AddIndexByClass(const wxString& title, const wxString& urlToShow, const wxString& urlToExamine, int startIndent = 0);
113
    void AddIndexByList(const wxString& title, const wxString& urlToShow, const wxString& urlToExamine, int startIndent = 0);
114
    void AddIndexItem(const wxString& title, const wxString& urlToShow, int startIndent = 0);
115
    void AddStartSection(const wxString& title, const wxString& urlToShow = wxEmptyString);
116
    void AddEndSection();
117
    void ClearItems();
118
 
119
//// Symbol tables
120
 
121
    // Some things should be translated in the contents
122
    void AddEntityTranslation(const wxString& entity, const wxString& translation);
123
    // Apply all translations to this string
124
    wxString TranslateEntities(const wxString& toTranslate);
125
 
126
    // Mapping from directory to user-viewable name
127
    void AddTutorialDirectory(const wxString& dirName, const wxString& title);
128
    wxString TranslateTutorialDirectory(const wxString& dirName);
129
 
130
//// Accessors
131
    wxList& GetIndexItems() { return m_indexItems; }
132
    bool UseRelativeURLs() const { return m_useRelativeURLs; }
133
    bool UseOldDocs() const { return m_useOldDocs; }
134
 
135
//// Helpers
136
 
137
    // Set m_useOldDocs to TRUE if we find old-style docs
138
    bool CheckDocEra(const wxString& reposDir) ;
139
 
140
private:
141
    // List of ecIndexItems
142
    wxList  m_indexItems;
143
    bool    m_useRelativeURLs;
144
    bool    m_useOldDocs; // if TRUE, we have the old-style docs generated by FrameMaker
145
    wxArrayString m_entityTableNames; // Translations for awkward symbols not processed by wxHTML or MS HTML Help such as &#8212; (--)
146
    wxArrayString m_entityTableValues; // values for the above
147
    wxArrayString m_tutorialTableNames; // Directory -> title mapping e.g. arm -> ARM, sparclite -> Fujitsu SPARClite
148
    wxArrayString m_tutorialTableValues;
149
};
150
 
151
class ecIndexItem: public wxObject
152
{
153
public:
154
    ecIndexItem(ecIndexType type, const wxString& title, const wxString& urlToShow,
155
        const wxString& urlToExamine, int startLevel = 0)
156
    {
157
        m_type = type; m_title = title; m_urlToShow = urlToShow;
158
        m_urlToExamine = urlToExamine; m_startLevel = startLevel;
159
    }
160
 
161
    ecIndexType     m_type;
162
    wxString        m_title;
163
    wxString        m_urlToShow;
164
    wxString        m_urlToExamine;
165
    int             m_startLevel;
166
};
167
 
168
#endif
169
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.