Branch libreoffice-5-0-4
[LibreOffice.git] / include / helpcompiler / HelpIndexer.hxx
blob5a73358728e00d845bce37670b43068c61c0bf2f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
11 #define INCLUDED_HELPCOMPILER_HELPINDEXER_HXX
13 #include <helpcompiler/dllapi.h>
15 #include <rtl/ustring.hxx>
16 #include <set>
18 // I assume that TCHAR is defined as wchar_t throughout
20 namespace lucene
22 namespace document
24 class Document;
26 namespace util
28 class Reader;
32 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;
42 public:
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
50 HelpIndexer(OUString const &lang, OUString const &module,
51 OUString const &srcDir, OUString const &outDir);
53 /**
54 * Run the indexer.
55 * @return true if index successfully generated.
57 bool indexDocuments();
59 /**
60 * Get the error string (empty if no error occurred).
62 OUString const & getErrorMessage() { return d_error;}
64 private:
66 /**
67 * Scan the caption & contents directories for help files.
69 bool scanForFiles();
71 /**
72 * Scan for files in the given directory.
74 bool scanForFiles(OUString const &path);
76 /**
77 * Fill the Document with information on the given help file.
79 bool helpDocument(OUString const & fileName, lucene::document::Document *doc);
81 /**
82 * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
84 static lucene::util::Reader *helpFileReader(OUString const & path);
87 #endif
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */