diff options
author | jan iversen <jani@documentfoundation.org> | 2016-03-14 23:35:34 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-03-14 23:35:34 +0100 |
commit | 4043af877587622935be828049b7b18cc27ad1d8 (patch) | |
tree | 090d661d309db7ab63b73fabdeb91db9d5d0e5c3 /l10ntools/inc | |
parent | 48c2e04bdb60429823cb8b12a14d954af544a2bf (diff) |
genLang update
Last singleton gone, structure is now
handler (local in gLang.cxx) holds
a variable of l10nMem
a temporary convert_gen variable (to analyze file)
l10nMem contains hash list of all PO information
convert_xxx is inherited from convert_gen and instanciated
with a static function convert_gen::createInstance
the lex functions (in c) uses a "this" pointer to find back
to the class. This needs to be done better.
l10nMem contains a link to convert_PO, to save files, this
needs to be split.
Change-Id: I3ad31aac27aac739845062f8da61c8c1c3bf9c31
Diffstat (limited to 'l10ntools/inc')
-rw-r--r-- | l10ntools/inc/gConv.hxx | 73 | ||||
-rw-r--r-- | l10ntools/inc/gConvDB.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvPo.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvProp.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvSrc.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvTree.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvUlf.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvXcs.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvXcu.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvXhp.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/gConvXrm.hxx | 2 |
11 files changed, 30 insertions, 63 deletions
diff --git a/l10ntools/inc/gConv.hxx b/l10ntools/inc/gConv.hxx index 604e5ed5671c..b9507ace74e2 100644 --- a/l10ntools/inc/gConv.hxx +++ b/l10ntools/inc/gConv.hxx @@ -25,65 +25,40 @@ class convert_gen { public: - convert_gen(l10nMem& cMemory, + static convert_gen *mcImpl; + + convert_gen(l10nMem& cMemory); + virtual ~convert_gen(); + + // Create instance + static convert_gen& createInstance(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); + // all converters MUST implement this function + virtual void execute() = 0; + // ONLY po should implement these functions - void startSave(const std::string& sLanguage, + virtual void startSave(const std::string& sLanguage, const std::string& sFile); - void save(const std::string& sFileName, + virtual void save(const std::string& sFileName, const std::string& sKey, const std::string& sENUStext, const std::string& sText, bool bFuzzy); - void endSave(); + virtual void endSave(); static bool checkAccess(std::string& sFile); static bool createDir(std::string& sDir, std::string& sFile); -}; - - -/***************************************************************************** - **************************** G C O N . H X X **************************** - ***************************************************************************** - * This is the class definition header for all converter classes, - * all classes and their interrelations is defined here - *****************************************************************************/ - - - -/******************* G L O B A L D E F I N I T I O N *******************/ - - - -/******************** C L A S S D E F I N I T I O N ********************/ -class convert_gen_impl -{ - public: - static convert_gen_impl *mcImpl; + // utility functions for converters + void lexRead(char *sBuf, int *nResult, int nMax_size); + std::string& copySource(char const *yyText, bool bDoClear = true); - convert_gen_impl(l10nMem& crMemory); - virtual ~convert_gen_impl(); - - // all converters MUST implement this function - virtual void execute() = 0; - - // ONLY po should implement these functions - virtual void startSave(const std::string& sLanguage, - const std::string& sFile); - virtual void save(const std::string& sFileName, - const std::string& sKey, - const std::string& sENUStext, - const std::string& sText, - bool bFuzzy); - virtual void endSave(); - +protected: // generic variables bool mbMergeMode; bool mbLoadMode; @@ -93,22 +68,14 @@ class convert_gen_impl l10nMem& mcMemory; std::string msCollector; int miLineNo; - - - // utility functions for converters - void lexRead (char *sBuf, int *nResult, int nMax_size); - void writeSourceFile(const std::string& line); - std::string& copySource (char const *yyText, bool bDoClear = true); - - protected: std::string msSourceBuffer, msCopyText; int miSourceReadIndex; bool prepareFile(); - private: + // utility functions for converters + void writeSourceFile(const std::string& line); +private: std::ofstream mcOutputFile; - - friend class convert_gen; }; #endif diff --git a/l10ntools/inc/gConvDB.hxx b/l10ntools/inc/gConvDB.hxx index 0cbb746b066c..51c837741739 100644 --- a/l10ntools/inc/gConvDB.hxx +++ b/l10ntools/inc/gConvDB.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_db : public convert_gen_impl +class convert_db : public convert_gen { public: convert_db(l10nMem& crMemory); diff --git a/l10ntools/inc/gConvPo.hxx b/l10ntools/inc/gConvPo.hxx index b46706440a9f..33fc4ef73d0d 100644 --- a/l10ntools/inc/gConvPo.hxx +++ b/l10ntools/inc/gConvPo.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_po : public convert_gen_impl +class convert_po : public convert_gen { public: bool mbExpectId; diff --git a/l10ntools/inc/gConvProp.hxx b/l10ntools/inc/gConvProp.hxx index 8b1c2816e940..b2b9bd1de696 100644 --- a/l10ntools/inc/gConvProp.hxx +++ b/l10ntools/inc/gConvProp.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_prop : public convert_gen_impl +class convert_prop : public convert_gen { public: convert_prop(l10nMem& crMemory); diff --git a/l10ntools/inc/gConvSrc.hxx b/l10ntools/inc/gConvSrc.hxx index e9a21399ca1e..669430f90f2a 100644 --- a/l10ntools/inc/gConvSrc.hxx +++ b/l10ntools/inc/gConvSrc.hxx @@ -31,7 +31,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_src : public convert_gen_impl +class convert_src : public convert_gen { public: bool mbExpectValue; diff --git a/l10ntools/inc/gConvTree.hxx b/l10ntools/inc/gConvTree.hxx index dda10ca89712..a0ecb20b0730 100644 --- a/l10ntools/inc/gConvTree.hxx +++ b/l10ntools/inc/gConvTree.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_tree : public convert_gen_impl +class convert_tree : public convert_gen { public: typedef enum diff --git a/l10ntools/inc/gConvUlf.hxx b/l10ntools/inc/gConvUlf.hxx index 2fdbea6ced03..dc7c75fd2788 100644 --- a/l10ntools/inc/gConvUlf.hxx +++ b/l10ntools/inc/gConvUlf.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_ulf : public convert_gen_impl +class convert_ulf : public convert_gen { public: convert_ulf(l10nMem& crMemory); diff --git a/l10ntools/inc/gConvXcs.hxx b/l10ntools/inc/gConvXcs.hxx index a72f7c022c12..40cb2ca06433 100644 --- a/l10ntools/inc/gConvXcs.hxx +++ b/l10ntools/inc/gConvXcs.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_xcs : public convert_gen_impl +class convert_xcs : public convert_gen { public: convert_xcs(l10nMem& crMemory); diff --git a/l10ntools/inc/gConvXcu.hxx b/l10ntools/inc/gConvXcu.hxx index e751e368f9ad..c19f9901fbea 100644 --- a/l10ntools/inc/gConvXcu.hxx +++ b/l10ntools/inc/gConvXcu.hxx @@ -33,7 +33,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ class xcu_stack_entry; -class convert_xcu : public convert_gen_impl +class convert_xcu : public convert_gen { public: bool mbNoCollectingData; diff --git a/l10ntools/inc/gConvXhp.hxx b/l10ntools/inc/gConvXhp.hxx index 04de5aa87a83..d59a00b911a5 100644 --- a/l10ntools/inc/gConvXhp.hxx +++ b/l10ntools/inc/gConvXhp.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_xhp : public convert_gen_impl +class convert_xhp : public convert_gen { public: convert_xhp(l10nMem& crMemory); diff --git a/l10ntools/inc/gConvXrm.hxx b/l10ntools/inc/gConvXrm.hxx index b29b5362a604..4928bace8f6f 100644 --- a/l10ntools/inc/gConvXrm.hxx +++ b/l10ntools/inc/gConvXrm.hxx @@ -32,7 +32,7 @@ /******************** C L A S S D E F I N I T I O N ********************/ -class convert_xrm : public convert_gen_impl +class convert_xrm : public convert_gen { public: bool mbNoCollectingData; |