summaryrefslogtreecommitdiff
path: root/l10ntools/inc/l10ntools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-15 12:55:11 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-23 10:31:17 +0000
commit796818d7b5a63c30d1ec837172deb73e300bfc38 (patch)
tree6a6be12e36c87476a6dbb277ae93408897e47db1 /l10ntools/inc/l10ntools
parent0f691cc6896e03ab8ca805bf0689bc0fc53dd42f (diff)
tweak build
Diffstat (limited to 'l10ntools/inc/l10ntools')
-rw-r--r--l10ntools/inc/l10ntools/HelpIndexer.hxx71
-rw-r--r--l10ntools/inc/l10ntools/dllapi.h49
2 files changed, 120 insertions, 0 deletions
diff --git a/l10ntools/inc/l10ntools/HelpIndexer.hxx b/l10ntools/inc/l10ntools/HelpIndexer.hxx
new file mode 100644
index 000000000000..ac034b5075f4
--- /dev/null
+++ b/l10ntools/inc/l10ntools/HelpIndexer.hxx
@@ -0,0 +1,71 @@
+#ifndef HELPINDEXER_HXX
+#define HELPINDEXER_HXX
+
+#include <l10ntools/dllapi.h>
+
+#include <CLucene/StdHeader.h>
+#include <CLucene.h>
+
+#include <rtl/ustring.hxx>
+#include <set>
+
+// I assume that TCHAR is defined as wchar_t throughout
+
+class L10N_DLLPUBLIC HelpIndexer {
+ private:
+ rtl::OUString d_lang;
+ rtl::OUString d_module;
+ rtl::OUString d_captionDir;
+ rtl::OUString d_contentDir;
+ rtl::OUString d_indexDir;
+ rtl::OUString d_error;
+ std::set<rtl::OUString> d_files;
+
+ public:
+
+ /**
+ * @param lang Help files language.
+ * @param module The module of the helpfiles.
+ * @param captionDir The directory to scan for caption files.
+ * @param contentDir The directory to scan for content files.
+ * @param indexDir The directory to write the index to.
+ */
+ HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module,
+ rtl::OUString const &captionDir, rtl::OUString const &contentDir,
+ rtl::OUString const &indexDir);
+
+ /**
+ * Run the indexer.
+ * @return true if index successfully generated.
+ */
+ bool indexDocuments();
+
+ /**
+ * Get the error string (empty if no error occurred).
+ */
+ rtl::OUString const & getErrorMessage();
+
+ private:
+
+ /**
+ * Scan the caption & contents directories for help files.
+ */
+ bool scanForFiles();
+
+ /**
+ * Scan for files in the given directory.
+ */
+ bool scanForFiles(rtl::OUString const &path);
+
+ /**
+ * Fill the Document with information on the given help file.
+ */
+ bool helpDocument(rtl::OUString const & fileName, lucene::document::Document *doc);
+
+ /**
+ * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
+ */
+ lucene::util::Reader *helpFileReader(rtl::OUString const & path);
+};
+
+#endif
diff --git a/l10ntools/inc/l10ntools/dllapi.h b/l10ntools/inc/l10ntools/dllapi.h
new file mode 100644
index 000000000000..184a590944ed
--- /dev/null
+++ b/l10ntools/inc/l10ntools/dllapi.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _L10N_DLLAPI_H
+#define _L10N_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined L10N_DLLIMPLEMENTATION
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined UNX && ! defined MACOS
+#define L10N_PLUGIN_PUBLIC L10N_DLLPUBLIC
+#else
+#define L10N_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */