summaryrefslogtreecommitdiff
path: root/l10ntools/inc
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools/inc')
-rw-r--r--l10ntools/inc/export.hxx23
-rw-r--r--l10ntools/inc/gsicheck.hxx60
2 files changed, 80 insertions, 3 deletions
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index bf1809bfb54e..915eaba62e89 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -71,6 +71,9 @@ typedef boost::unordered_map<rtl::OString, PFormEntrys*, rtl::OStringHash>
typedef boost::unordered_map<rtl::OString, MergeData*, rtl::OStringHash>
MergeDataHashMap;
+typedef boost::unordered_map<rtl::OString, size_t, rtl::OStringHash>
+ LineNumberHashMap;
+
#define SOURCE_LANGUAGE rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))
#define X_COMMENT rtl::OString(RTL_CONSTASCII_STRINGPARAM("x-comment"))
#define LIST_REFID "LIST_REFID"
@@ -374,23 +377,36 @@ private:
OStringBoolHashMap bQuickHelpTextFirst;
OStringHashMap sTitle;
OStringBoolHashMap bTitleFirst;
+ OStringHashMap sSDFLine;
+ LineNumberHashMap nLine;
public:
PFormEntrys( const rtl::OString &rPForm ) : data_( rPForm ) {};
void InsertEntry(const rtl::OString &rId, const rtl::OString &rText,
- const rtl::OString &rQuickHelpText, const rtl::OString &rTitle)
+ const rtl::OString &rQuickHelpText, const rtl::OString &rTitle,
+ const rtl::OString &rSDFLine, const std::size_t nLineIn)
{
-
sText[ rId ] = rText;
bTextFirst[ rId ] = true;
sQuickHelpText[ rId ] = rQuickHelpText;
bQuickHelpTextFirst[ rId ] = true;
sTitle[ rId ] = rTitle;
bTitleFirst[ rId ] = true;
+ sSDFLine[ rId ] = rSDFLine;
+ nLine[ rId ] = nLineIn;
}
sal_Bool GetText( rtl::OString &rReturn, sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel = sal_False );
sal_Bool GetTransex3Text( rtl::OString &rReturn, sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel = sal_False );
+ rtl::OString & GetSDF(const rtl::OString &nLangIndex)
+ {
+ return sSDFLine[nLangIndex];
+ }
+
+ std::size_t GetNLine(const rtl::OString &nLangIndex)
+ {
+ return nLine[nLangIndex];
+ }
};
//
@@ -445,7 +461,8 @@ class MergeDataFile
const rtl::OString &rLID, const rtl::OString &rPFO,
const rtl::OString &nLang, const rtl::OString &rTEXT,
const rtl::OString &rQHTEXT, const rtl::OString &rTITLE,
- const rtl::OString &sFilename, bool bCaseSensitive);
+ const rtl::OString &sFilename, bool bCaseSensitive,
+ const rtl::OString &rSDF, std::size_t nLine);
public:
explicit MergeDataFile(const rtl::OString &rFileName,
const rtl::OString& rFile, bool bErrLog, bool bCaseSensitive = false);
diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx
index 467925e46767..266ea96c2543 100644
--- a/l10ntools/inc/gsicheck.hxx
+++ b/l10ntools/inc/gsicheck.hxx
@@ -33,6 +33,7 @@
#include <cstddef>
#include <vector>
+#include <fstream>
#include "tagtest.hxx"
@@ -131,6 +132,65 @@ public:
void WriteFixed( LazyStream &aFixOut );
};
+sal_Bool check(rtl::OString s,std::size_t nLine);
+
+void PrintMessage( rtl::OString const & aType, rtl::OString const & aMsg, rtl::OString const & aPrefix,
+ rtl::OString const & aContext, sal_Bool bPrintContext, std::size_t nLine, rtl::OString aUniqueId = rtl::OString() );
+
+void PrintError( rtl::OString const & aMsg, rtl::OString const & aPrefix,
+ rtl::OString const & aContext, sal_Bool bPrintContext, std::size_t nLine, rtl::OString const & aUniqueId = rtl::OString() );
+
+bool LanguageOK( rtl::OString const & aLang );
+
+class LazyStream: public std::ofstream
+{
+
+private:
+ rtl::OString aFileName;
+ bool bOpened;
+
+public:
+ LazyStream()
+ : aFileName()
+ , bOpened(false)
+ {};
+
+ void SetFileName( const rtl::OString& rFileName )
+ {
+ aFileName = rFileName;
+ };
+
+ void LazyOpen();
+};
+
+namespace {
+
+sal_Int32 const MAX_GID_LID_LEN = 250;
+
+rtl::OString copyUpTo(
+ rtl::OString const & text, sal_Int32 start, sal_Int32 maximumLength)
+{
+ assert(start >= 0 && start <= text.getLength());
+ return text.copy(start, std::min(text.getLength() - start, maximumLength));
+}
+
+rtl::OString addSuffix(
+ rtl::OString const & pathname, rtl::OString const & suffix)
+{
+ sal_Int32 n = pathname.lastIndexOf('.');
+ if (n == -1) {
+ fprintf(
+ stderr,
+ ("Error: pathname \"%s\" does not contain dot to add suffix in"
+ " front of\n"),
+ pathname.getStr());
+ exit(EXIT_FAILURE);
+ }
+ return pathname.replaceAt(n, 0, suffix);
+}
+
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */