summaryrefslogtreecommitdiffstats
path: root/l10ntools/inc
diff options
context:
space:
mode:
authorjan iversen <jani@documentfoundation.org>2016-03-14 22:10:23 +0100
committerjan iversen <jani@documentfoundation.org>2016-03-14 23:31:44 +0100
commit48c2e04bdb60429823cb8b12a14d954af544a2bf (patch)
treea4c5065547a6ab275ef646ee8416447f64f02cde /l10ntools/inc
parenttdf#97885 SIDEBAR: Message missing from blank properties tab (diff)
downloadcore-48c2e04bdb60429823cb8b12a14d954af544a2bf.tar.gz
core-48c2e04bdb60429823cb8b12a14d954af544a2bf.zip
genLang update
removed gL10nMemDB (combined with gL10nMemDB) to avoid CLANG problem. removed (temporary) gL10nMem dependency on convPO (circular dep). Change-Id: I17646be2ccc0feaaa8850a9b753f86c8c62e9f24
Diffstat (limited to 'l10ntools/inc')
-rw-r--r--l10ntools/inc/gConv.hxx26
-rw-r--r--l10ntools/inc/gL10nMem.hxx209
-rw-r--r--l10ntools/inc/gLang.hxx135
3 files changed, 129 insertions, 241 deletions
diff --git a/l10ntools/inc/gConv.hxx b/l10ntools/inc/gConv.hxx
index 7287a499ca10..604e5ed5671c 100644
--- a/l10ntools/inc/gConv.hxx
+++ b/l10ntools/inc/gConv.hxx
@@ -19,11 +19,33 @@
#ifndef GCON_HXX
#define GCON_HXX
-#include "gLang.hxx"
-
#include <iostream>
#include <fstream>
+class convert_gen
+{
+public:
+ convert_gen(l10nMem& cMemory,
+ const std::string& sSourceDir,
+ const std::string& sTargetDir,
+ const std::string& sSourceFile);
+ ~convert_gen();
+
+ // do extract/merge
+ bool execute(const bool bMerge, const bool bKid);
+
+ // ONLY po should implement these functions
+ void startSave(const std::string& sLanguage,
+ const std::string& sFile);
+ void save(const std::string& sFileName,
+ const std::string& sKey,
+ const std::string& sENUStext,
+ const std::string& sText,
+ bool bFuzzy);
+ void endSave();
+ static bool checkAccess(std::string& sFile);
+ static bool createDir(std::string& sDir, std::string& sFile);
+};
/*****************************************************************************
diff --git a/l10ntools/inc/gL10nMem.hxx b/l10ntools/inc/gL10nMem.hxx
index e7dcd705bab9..94e76c9c8d0f 100644
--- a/l10ntools/inc/gL10nMem.hxx
+++ b/l10ntools/inc/gL10nMem.hxx
@@ -16,78 +16,77 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#ifndef GL10NMEM_HXX
#define GL10NMEM_HXX
-#include "gLang.hxx"
-
-
-
-class l10nMem_lang_entry
-{
- public:
- l10nMem_lang_entry(const std::string& sMsgStr, bool bFuzzy);
- ~l10nMem_lang_entry();
-
- std::string msMsgStr; // translated text from po file
- bool mbFuzzy; // fuzzy flag
-};
-
-
-class l10nMem_enus_entry
+class l10nMem_enus_entry;
+class l10nMem_file_entry;
+class l10nMem_lang_list_entry;
+class l10nMem
{
- public:
- l10nMem_enus_entry(const std::string& sKey,
- const std::string& sMsgId,
- int iLineNo,
- int iFileInx,
- int iLangSize,
- l10nMem::ENTRY_STATE eState);
- ~l10nMem_enus_entry();
-
- std::string msKey; // key in po file and source file
- std::string msMsgId; // en-US text from source file
- l10nMem::ENTRY_STATE meState; // status information
- int miFileInx; // index of file name
- int miLineNo; // line number
- std::vector<l10nMem_lang_entry> mcLangText; // language texts (index is languageId)
-};
-
-
-
-class l10nMem_file_entry
-{
- public:
- l10nMem_file_entry(const std::string& sFileName, int iStart);
- ~l10nMem_file_entry();
-
- std::string msFileName; // file Name with relative path
- std::string msPureName; // just filename
- int miStart; // start index of entries in mcMasterEntries (l10Mem_db::mcENUS)
- int miEnd; // last index of entries in mcMasterEntries (l10Mem_db::mcENUS)
-};
-
-
-
-class l10nMem_lang_list_entry
-{
- public:
- l10nMem_lang_list_entry(const std::string& sName);
- ~l10nMem_lang_list_entry();
-
- std::string msName; // language Name
- bool mbChanged; // used for "convert", true if language is modified
-};
-
-
-
-class l10nMem_db
-{
- public:
- l10nMem_db();
- ~l10nMem_db();
-
+public:
+ l10nMem();
+ ~l10nMem();
+
+ typedef enum
+ {
+ ENTRY_DELETED,
+ ENTRY_ADDED,
+ ENTRY_CHANGED,
+ ENTRY_NORMAL
+ } ENTRY_STATE;
+
+ static int showError(const std::string& sText, int iLineNo = 0);
+ static void showWarning(const std::string& sText, int iLineNo = 0);
+ static void showDebug(const std::string& sText, int iLineNo = 0);
+ static void showVerbose(const std::string& sText, int iLineNo = 0);
+ static void keyToUpper(std::string& sKey);
+
+ void setModuleName(const std::string& sModuleName);
+ const std::string& getModuleName(void);
+ void setLanguage(const std::string& sLanguage,
+ bool bCreate);
+ void setConvert(bool bConvert,
+ bool bStrict);
+ void setVerbose(const bool doVerbose);
+ void setDebug(const bool doDebug);
+
+
+ void loadEntryKey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sOrgText,
+ const std::string& sText,
+ bool bIsFuzzy);
+
+ void setSourceKey(int iLineNo,
+ const std::string& sFilename,
+ const std::string& sKey,
+ const std::string& sText,
+ bool bMustExist);
+
+ void saveTemplates(const std::string& sTargetDir,
+ bool bKid,
+ bool bForce);
+ void saveLanguages(l10nMem& cMem,
+ const std::string& sTargetDir,
+ bool bForce);
+ void dumpMem(const std::string& sTargetDir);
+
+ int prepareMerge();
+ bool getMergeLang(std::string& sLang,
+ std::string& sText);
+ void showNOconvert();
+ bool isError();
+
+ void convertToInetString(std::string& sText);
+ void convertFromInetString(std::string& sText);
+
+private:
+ bool mbVerbose;
+ bool mbDebug;
+ bool mbInError;
+ std::string msModuleName;
int miCurFileInx;
int miCurLangInx;
int miCurENUSinx;
@@ -98,41 +97,43 @@ class l10nMem_db
std::vector<l10nMem_file_entry> mcFileList;
std::vector<l10nMem_lang_list_entry> mcLangList;
-
- void loadENUSkey (int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId);
- void setLanguage (const std::string& sLanguage,
- bool bCreate);
- void setConvert (bool bConvert,
- bool bStrict);
- bool findFileName (const std::string& sSourceFile);
- void loadLangKey (int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId,
- const std::string& sMsgStr,
- bool bFuzzy);
-
-
- bool locateKey (int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId,
- bool bThrow);
- void reorganize (bool bConvert);
- void addKey (int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId,
- l10nMem::ENTRY_STATE eStat);
-
- int prepareMerge ();
- bool getMergeLang (std::string& sLang,
- std::string& sText);
- bool getLangList (std::string& sLang);
-
-static void keyToUpper(std::string& sKey);
+ void formatAndShowText(const std::string& sType, int iLineNo, const std::string& sText);
+ bool needWrite(const std::string sFileName, bool bForce);
+ bool convFilterWarning(const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId);
+ void convEntryKey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId,
+ const std::string& sMsgStr,
+ bool bIsFuzzy);
+ void saveTemplates(l10nMem& cMem,
+ const std::string& sTargetDir,
+ bool bKid,
+ bool bForce);
+
+ void loadENUSkey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId);
+ void loadLangKey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId,
+ const std::string& sMsgStr,
+ bool bFuzzy);
+ void reorganize(bool bConvert);
+ bool locateKey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId,
+ bool bThrow);
+ void addKey(int iLineNo,
+ const std::string& sSourceFile,
+ const std::string& sKey,
+ const std::string& sMsgId,
+ l10nMem::ENTRY_STATE eStat);
+ bool findFileName(const std::string& sSourceFile);
};
#endif
diff --git a/l10ntools/inc/gLang.hxx b/l10ntools/inc/gLang.hxx
deleted file mode 100644
index 381d4d9df669..000000000000
--- a/l10ntools/inc/gLang.hxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef GLANG_HXX
-#define GLANG_HXX
-#include <string>
-#include <vector>
-
-
-
-class l10nMem_db;
-class l10nMem
-{
- public:
- l10nMem();
- ~l10nMem();
-
- static int showError(const std::string& sText, int iLineNo = 0);
- static void showWarning(const std::string& sText, int iLineNo = 0);
- static void showDebug(const std::string& sText, int iLineNo = 0);
- static void showVerbose(const std::string& sText, int iLineNo = 0);
- static bool isError();
-
- void setModuleName (const std::string& sModuleName);
- const std::string& getModuleName (void);
- void setLanguage (const std::string& sLanguage,
- bool bCreate);
- void setConvert (bool bConvert,
- bool bStrict);
- void loadEntryKey (int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sOrgText,
- const std::string& sText,
- bool bIsFuzzy);
-
- void setSourceKey (int iLineNo,
- const std::string& sFilename,
- const std::string& sKey,
- const std::string& sText,
- bool bMustExist);
-
- void saveTemplates (const std::string& sTargetDir,
- bool bKid,
- bool bForce);
- void saveLanguages(l10nMem& cMem,
- const std::string& sTargetDir,
- bool bForce);
- void dumpMem (const std::string& sTargetDir);
-
- int prepareMerge ();
- bool getMergeLang (std::string& sLang,
- std::string& sText);
- void showNOconvert ();
-
- void convertToInetString(std::string& sText);
- void convertFromInetString(std::string& sText);
-
- private:
- l10nMem_db *mcDb;
- bool mbVerbose;
- bool mbDebug;
- bool mbInError;
- typedef enum
- {
- ENTRY_DELETED,
- ENTRY_ADDED,
- ENTRY_CHANGED,
- ENTRY_NORMAL
- } ENTRY_STATE;
- std::string msModuleName;
-
- void formatAndShowText(const std::string& sType, int iLineNo, const std::string& sText);
- bool needWrite(const std::string sFileName, bool bForce);
- bool convFilterWarning(const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId);
- void convEntryKey(int iLineNo,
- const std::string& sSourceFile,
- const std::string& sKey,
- const std::string& sMsgId,
- const std::string& sMsgStr,
- bool bIsFuzzy);
- void saveTemplates(l10nMem& cMem,
- const std::string& sTargetDir,
- bool bKid,
- bool bForce);
-
- friend class handler;
- friend class l10nMem_enus_entry;
- friend class l10nMem_db;
-};
-
-
-
-class convert_gen
-{
- public:
- convert_gen(l10nMem& cMemory,
- const std::string& sSourceDir,
- const std::string& sTargetDir,
- const std::string& sSourceFile);
- ~convert_gen();
-
- // do extract/merge
- bool execute(const bool bMerge, const bool bKid);
-
- // ONLY po should implement these functions
- void startSave(const std::string& sLanguage,
- const std::string& sFile);
- void save(const std::string& sFileName,
- const std::string& sKey,
- const std::string& sENUStext,
- const std::string& sText,
- bool bFuzzy);
- void endSave();
- static bool checkAccess(std::string& sFile);
- static bool createDir(std::string& sDir, std::string& sFile);
-};
-#endif