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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [wxwin/] [docsystem.h] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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