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/gConv.hxx | |
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/gConv.hxx')
-rw-r--r-- | l10ntools/inc/gConv.hxx | 73 |
1 files changed, 20 insertions, 53 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 |