Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
11 : #define INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
12 :
13 : #include <helpcompiler/dllapi.h>
14 :
15 : #include <rtl/ustring.hxx>
16 : #include <set>
17 :
18 : // I assume that TCHAR is defined as wchar_t throughout
19 :
20 : namespace lucene
21 : {
22 : namespace document
23 : {
24 : class Document;
25 : }
26 : namespace util
27 : {
28 : class Reader;
29 : }
30 : }
31 :
32 0 : class L10N_DLLPUBLIC HelpIndexer {
33 : private:
34 : OUString d_lang;
35 : OUString d_module;
36 : OUString d_captionDir;
37 : OUString d_contentDir;
38 : OUString d_indexDir;
39 : OUString d_error;
40 : std::set<OUString> d_files;
41 :
42 : public:
43 :
44 : /**
45 : * @param lang Help files language.
46 : * @param module The module of the helpfiles.
47 : * @param srcDir The help directory to index
48 : * @param outDir The directory to write the "module".idxl directory to
49 : */
50 : HelpIndexer(OUString const &lang, OUString const &module,
51 : OUString const &srcDir, OUString const &outDir);
52 :
53 : /**
54 : * Run the indexer.
55 : * @return true if index successfully generated.
56 : */
57 : bool indexDocuments();
58 :
59 : /**
60 : * Get the error string (empty if no error occurred).
61 : */
62 0 : OUString const & getErrorMessage() { return d_error;}
63 :
64 : private:
65 :
66 : /**
67 : * Scan the caption & contents directories for help files.
68 : */
69 : bool scanForFiles();
70 :
71 : /**
72 : * Scan for files in the given directory.
73 : */
74 : bool scanForFiles(OUString const &path);
75 :
76 : /**
77 : * Fill the Document with information on the given help file.
78 : */
79 : bool helpDocument(OUString const & fileName, lucene::document::Document *doc);
80 :
81 : /**
82 : * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
83 : */
84 : lucene::util::Reader *helpFileReader(OUString const & path);
85 : };
86 :
87 : #endif
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|