summaryrefslogtreecommitdiffstats
path: root/khelpcenter/docmetainfo.h
blob: 9b6871fa7113f12c1cf0c530304b35fbfe78f642 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef DOCMETAINFO_H
#define DOCMETAINFO_H

#include <tqstring.h>
#include <tqstringlist.h>
#include <tqvaluelist.h>
#include <tqdir.h>
#include <tqmap.h>

#include "docentry.h"

namespace KHC {

class HTMLSearch;
class DocEntryTraverser;

/*!
  This class provides some meta information about help documents.
*/
class DocMetaInfo
{
  public:
    /*!
      Return instance of DocMetaInfo. There can only be one instance at a time.
    */
    static DocMetaInfo *self();

    ~DocMetaInfo();

    void scanMetaInfo( bool force = false );

    DocEntry *addDocEntry( const TQString &fileName );

    void addDocEntry( DocEntry * );

    DocEntry::List docEntries();
    
    DocEntry::List searchEntries();

    void traverseEntries( DocEntryTraverser * );

    void startTraverseEntries( DocEntryTraverser *traverser );
    void startTraverseEntry( DocEntry *entry, DocEntryTraverser *traverser );
    void endProcess( DocEntry *entry, DocEntryTraverser *traverser );
    void endTraverseEntries( DocEntryTraverser * );

    static TQString languageName( const TQString &langcode );

  protected:
    DocEntry *scanMetaInfoDir( const TQString &filename, DocEntry *parent );
    DocEntry *addDirEntry( const TQDir &dir, DocEntry *parent );
    void traverseEntry( DocEntry *, DocEntryTraverser * );

  private:
    /*!
      DocMetaInfo is a singleton. Private constructor prevents direct
      instantisation.
    */
    DocMetaInfo();
  
    DocEntry::List mDocEntries;
    DocEntry::List mSearchEntries;

    DocEntry mRootEntry;

    TQStringList mLanguages;

    TQMap<TQString,TQString> mLanguageNames;

    HTMLSearch *mHtmlSearch;

    static bool mLoaded;

    static DocMetaInfo *mSelf;
};

}

#endif
// vim:ts=2:sw=2:et