You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/02/12 00:16:01 UTC
svn commit: r1444992 [1/2] - /openoffice/branches/l10n/main/l10ntools/source/
Author: jani
Date: Mon Feb 11 23:16:00 2013
New Revision: 1444992
URL: http://svn.apache.org/r1444992
Log:
new class structure, more simple.
Added:
openoffice/branches/l10n/main/l10ntools/source/gCon.hxx (with props)
openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx (with props)
openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx (with props)
Removed:
openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx
openoffice/branches/l10n/main/l10ntools/source/gConPo.cxx
openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx
openoffice/branches/l10n/main/l10ntools/source/gConUlf.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXcs.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXhp.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXrm.cxx
Modified:
openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx
openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l
openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
openoffice/branches/l10n/main/l10ntools/source/gConProp.cxx
openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx
openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l
openoffice/branches/l10n/main/l10ntools/source/gConTree.cxx
openoffice/branches/l10n/main/l10ntools/source/gConUlf.hxx
openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l
openoffice/branches/l10n/main/l10ntools/source/gConXcs.hxx
openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l
openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXculex.l
openoffice/branches/l10n/main/l10ntools/source/gConXhp.hxx
openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l
openoffice/branches/l10n/main/l10ntools/source/gConXrm.hxx
openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l
openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
openoffice/branches/l10n/main/l10ntools/source/gLang.hxx
openoffice/branches/l10n/main/l10ntools/source/makefile.mk
Modified: openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.cxx Mon Feb 11 23:16:00 2013
@@ -18,7 +18,20 @@
* under the License.
*
*************************************************************/
-#include "gLang.hxx"
+#include "gCon.hxx"
+#include "gConHrc.hxx"
+#include "gConPo.hxx"
+#include "gConProp.hxx"
+#include "gConSrc.hxx"
+#include "gConTree.hxx"
+#include "gConUlf.hxx"
+#include "gConXcs.hxx"
+#include "gConXcu.hxx"
+#include "gConXhp.hxx"
+#include "gConXrm.hxx"
+
+#include <iostream>
+#include <fstream>
@@ -31,29 +44,38 @@
+/******************* G L O B A L D E F I N I T I O N *******************/
+convert_gen_impl * convert_gen_impl::mcImpl = NULL;
+
+
+
/********************** I M P L E M E N T A T I O N **********************/
-convert_gen::convert_gen(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose)
- : msSourceFile(srSourceFile),
- mbVerbose(brVerbose),
- mcMemory(crMemory)
+convert_gen::convert_gen(const std::string& srSourceFile, l10nMem& crMemory, const bool bMerge)
{
- std::ifstream inputFile(msSourceFile.c_str(), std::ios::binary);
-
-
- if (!inputFile.is_open())
- throw std::string("Could not open ")+msSourceFile;
+ // did the user give a .xxx with the source file ?
+ int nInx = srSourceFile.rfind(".");
+ if (nInx == std::string::npos)
+ throw std::string("source file: ")+srSourceFile+" missing extension";
- // get length of file:
- mnSourceReadIndex = 0;
- inputFile.seekg (0, std::ios::end);
- msSourceBuffer.resize((unsigned int)inputFile.tellg());
- inputFile.seekg (0, std::ios::beg);
+ // do we have an old object
+ if (convert_gen_impl::mcImpl)
+ delete convert_gen_impl::mcImpl;
- // get size, prepare std::string and read whole file
- inputFile.read((char *)msSourceBuffer.c_str(), msSourceBuffer.size());
- if ((unsigned int)inputFile.gcount() != msSourceBuffer.size())
- throw std::string("cannot read whole file: "+msSourceFile);
- inputFile.close();
+ // find correct conversion class and create correct object
+ std::string sExtension = srSourceFile.substr(nInx+1);
+ if (sExtension == "hrc") convert_gen_impl::mcImpl = new convert_hrc(crMemory);
+ else if (sExtension == "src") convert_gen_impl::mcImpl = new convert_src(crMemory);
+ else if (sExtension == "po") convert_gen_impl::mcImpl = new convert_po(crMemory);
+ else if (sExtension == "tree") convert_gen_impl::mcImpl = new convert_tree(crMemory);
+ else if (sExtension == "ulf") convert_gen_impl::mcImpl = new convert_ulf(crMemory);
+ else if (sExtension == "xcu") convert_gen_impl::mcImpl = new convert_xcs(crMemory);
+ else if (sExtension == "xhp") convert_gen_impl::mcImpl = new convert_xhp(crMemory);
+ else if (sExtension == "properties") convert_gen_impl::mcImpl = new convert_prop(crMemory);
+ else throw std::string("unknown extension on source file: ")+srSourceFile;
+
+ // and set environment
+ convert_gen_impl::mcImpl->msSourceFile = srSourceFile;
+ convert_gen_impl::mcImpl->mbMergeMode = bMerge;
}
@@ -61,40 +83,56 @@ convert_gen::convert_gen(const std::stri
/********************** I M P L E M E N T A T I O N **********************/
convert_gen::~convert_gen()
{
+ delete convert_gen_impl::mcImpl;
}
/********************** I M P L E M E N T A T I O N **********************/
-convert_gen& convert_gen::getConverter(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose)
+void convert_gen::execute()
{
- // did the user give a .xxx with the source file ?
- int nInx = srSourceFile.find_last_of(".");
- if (nInx <= 0)
- throw std::string("source file: ")+srSourceFile+" missing extension";
+ // and load file
+ convert_gen_impl::mcImpl->prepareFile();
- // find correct conversion class
- std::string sExtension = srSourceFile.substr(nInx+1);
+ // and execute conversion
+ convert_gen_impl::mcImpl->execute();
+}
- // did the user give a .xxx with the source file ?
- if (sExtension == "hrc") return *(new convert_hrc (srSourceFile, crMemory, brVerbose));
- if (sExtension == "src") return *(new convert_src (srSourceFile, crMemory, brVerbose));
- if (sExtension == "po") return *(new convert_po (srSourceFile, crMemory, brVerbose));
- if (sExtension == "tree") return *(new convert_tree (srSourceFile, crMemory, brVerbose));
- if (sExtension == "ulf") return *(new convert_ulf (srSourceFile, crMemory, brVerbose));
- if (sExtension == "xcu") return *(new convert_xcu (srSourceFile, crMemory, brVerbose));
- if (sExtension == "xcs") return *(new convert_xcs (srSourceFile, crMemory, brVerbose));
- if (sExtension == "xrm") return *(new convert_xrm (srSourceFile, crMemory, brVerbose));
- if (sExtension == "xhp") return *(new convert_xhp (srSourceFile, crMemory, brVerbose));
- if (sExtension == "properties") return *(new convert_properties(srSourceFile, crMemory, brVerbose));
- throw std::string("unknown extension on source file: ")+srSourceFile;
+
+/********************** I M P L E M E N T A T I O N **********************/
+convert_gen_impl::convert_gen_impl(l10nMem& crMemory) : mcMemory(crMemory) {}
+convert_gen_impl::~convert_gen_impl() {mcImpl = NULL;}
+
+
+
+/********************** I M P L E M E N T A T I O N **********************/
+void convert_gen_impl::prepareFile()
+{
+ std::ifstream inputFile(msSourceFile.c_str(), std::ios::binary);
+
+
+ if (!inputFile.is_open())
+ throw std::string("Could not open ")+msSourceFile;
+
+ // get length of file:
+ mnSourceReadIndex = 0;
+ inputFile.seekg (0, std::ios::end);
+ msSourceBuffer.resize((unsigned int)inputFile.tellg());
+ inputFile.seekg (0, std::ios::beg);
+
+ // get size, prepare std::string and read whole file
+ inputFile.read((char *)msSourceBuffer.c_str(), msSourceBuffer.size());
+ if ((unsigned int)inputFile.gcount() != msSourceBuffer.size())
+ throw std::string("cannot read whole file: "+msSourceFile);
+ inputFile.close();
}
+
/********************** I M P L E M E N T A T I O N **********************/
-void convert_gen::lexRead(char *sBuf, int *nResult, int nMax_size)
+void convert_gen_impl::lexRead(char *sBuf, int *nResult, int nMax_size)
{
// did we hit eof
if (mnSourceReadIndex == -1)
@@ -123,7 +161,7 @@ void convert_gen::lexRead(char *sBuf, in
/********************** I M P L E M E N T A T I O N **********************/
-void convert_gen::lineRead(bool *bEof, std::string& line)
+void convert_gen_impl::lineRead(bool *bEof, std::string& line)
{
// did we hit eof
if (mnSourceReadIndex == -1 || mnSourceReadIndex >= (int)msSourceBuffer.size())
@@ -148,7 +186,7 @@ void convert_gen::lineRead(bool *bEof, s
/********************** I M P L E M E N T A T I O N **********************/
-void convert_gen::writeSourceFile(const std::string& line)
+void convert_gen_impl::writeSourceFile(const std::string& line)
{
if (!line.size())
return;
@@ -160,7 +198,7 @@ void convert_gen::writeSourceFile(const
/********************** I M P L E M E N T A T I O N **********************/
-void convert_gen::trim(std::string& sLine)
+void convert_gen_impl::trim(std::string& sLine)
{
int nL;
@@ -174,3 +212,17 @@ void convert_gen::trim(std::string& sLin
if (nL != (int)std::string::npos)
sLine.erase(nL +1);
}
+
+
+
+/********************** I M P L E M E N T A T I O N **********************/
+void convert_gen_impl::collectData(char *sText)
+{
+ msCollector += sText;
+ if (sText == "\n")
+ {
+ if (mbMergeMode)
+ writeSourceFile(msCollector);
+ msCollector.clear();
+ }
+}
Added: openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.hxx?rev=1444992&view=auto
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.hxx (added)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.hxx Mon Feb 11 23:16:00 2013
@@ -0,0 +1,79 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+#ifndef GCON_HXX
+#define GCON_HXX
+#include "gLang.hxx"
+
+
+
+/*****************************************************************************
+ **************************** 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;
+
+
+ convert_gen_impl(l10nMem& crMemory);
+ virtual ~convert_gen_impl();
+
+ // all converters MUST implement this function
+ virtual void execute() = 0;
+
+ // generic variables
+ bool mbMergeMode;
+ std::string msSourceFile;
+ l10nMem& mcMemory;
+
+ // converter help variables
+ bool mbCollectingData;
+ std::string msCollector;
+ std::string msKey;
+
+ // utility functions for converters
+ void lexRead (char *sBuf, int *nResult, int nMax_size);
+ void lineRead(bool *bEof, std::string& line);
+ void writeSourceFile(const std::string& line);
+ void trim(std::string& line);
+ void collectData(char *sCollectedText);
+
+ private:
+ std::string msSourceBuffer;
+ int mnSourceReadIndex;
+
+ void prepareFile();
+
+
+ friend class convert_gen;
+};
+#endif
\ No newline at end of file
Propchange: openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
------------------------------------------------------------------------------
svn:executable = *
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx Mon Feb 11 23:16:00 2013
@@ -20,7 +20,7 @@
*************************************************************/
#ifndef GCONHRCHXX
#define GCONHRCHXX
-#include "gLang.hxx"
+#include "gCon.hxx"
@@ -33,26 +33,19 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_hrc_impl : public convert_gen
+class convert_hrc : public convert_gen_impl
{
public:
- convert_hrc_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_hrc_impl();
+ convert_hrc(l10nMem& crMemory);
+ ~convert_hrc();
- void setKey(std::string &sText);
- void saveData(std::string& sText);
- void copyData(std::string& sText);
+ void setKey(char *sText);
+ void saveData(char *sText);
private:
std::vector<std::string> mcStack;
- std::string msCollector;
- std::string msKey;
- void extract();
- void insert();
- void runLex();
-
- friend class convert_hrc;
+ void execute();
};
#endif
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConHrc.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -30,19 +33,24 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_hrc::convert_hrc(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_hrc::~convert_hrc() {}
/********************** I M P L E M E N T A T I O N **********************/
namespace HrcWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_hrc *)convert_gen_impl::mcImpl)
#include "gConHrc_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::runLex()
+void convert_hrc::execute()
{
HrcWrap::genHrc_lex();
}
@@ -50,8 +58,9 @@ void convert_hrc_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::setKey(std::string &sText)
+void convert_hrc::setKey(char *sInpText)
{
+ std::string sText(sInpText);
int nL, nE;
// write text for merge
@@ -69,10 +78,10 @@ void convert_hrc_impl::setKey(std::strin
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::saveData(std::string &sText)
+void convert_hrc::saveData(char *sInpText)
{
int nL, nE;
- std::string sUseText;
+ std::string sUseText, sText(sInpText);
// write text for merge
if (mbMergeMode)
@@ -102,17 +111,3 @@ void convert_hrc_impl::saveData(std::str
else
mcMemory.setEnUsKey(msKey, sUseText);
}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::copyData(std::string &sText)
-{
- msCollector += sText;
- if (sText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_hrc::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -60,28 +60,23 @@
%%
[fF][iI][xX][eE][dD][lL][iI][nN][eE][^\{]* {
- std::string text(yytext);
- convert_hrc::mcpImpl->setKey(text);
+ LOCptr->setKey(yytext);
}
[rR][aA][dD][iI][oO][bB][uU][tT][tT][oO][nM][^\{]* {
- std::string text(yytext);
- convert_hrc::mcpImpl->setKey(text);
+ LOCptr->setKey(yytext);
}
[cC][hH][eE][cC][kK][bB][oO][xX][^\{]* {
- std::string text(yytext);
- convert_hrc::mcpImpl->setKey(text);
+ LOCptr->setKey(yytext);
}
[tT][eE][xX][tT][^\"]*"\""[^\"]*"\";" {
- std::string text(yytext);
- convert_hrc::mcpImpl->saveData(text);
+ LOCptr->saveData(yytext);
}
.|\n {
- std::string text(yytext);
- convert_hrc::mcpImpl->copyData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPo.hxx Mon Feb 11 23:16:00 2013
@@ -20,8 +20,7 @@
*************************************************************/
#ifndef GCONPO_HXX
#define GCONPO_HXX
-#include "gLang.hxx"
-#include <stack>
+#include "gCon.hxx"
@@ -30,49 +29,20 @@
*****************************************************************************
* This is the class header for .po conversion
*****************************************************************************/
-typedef enum {TAG_COMPONENT, TAG_PROP, TAG_NODE } TAG_TYPE;
/******************** C L A S S D E F I N I T I O N ********************/
-class po_stack_entry
+class convert_po : public convert_gen_impl
{
public:
- po_stack_entry(TAG_TYPE sIsNode, std::string& sName);
- ~po_stack_entry();
-
- TAG_TYPE mbIsNode;
- std::string msName;
-};
-
+ convert_po(l10nMem& crMemory);
+ ~convert_po();
-
-
-/******************** C L A S S D E F I N I T I O N ********************/
-class po_stack_entry;
-class convert_po_impl : public convert_gen
-{
- public:
- convert_po_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_po_impl();
-
- void pushKeyPart(TAG_TYPE eIsNode, std::string &sTag);
- void popKeyPart (TAG_TYPE eIsNode, std::string &sTag);
-
- void startCollectData(std::string& sCollectedText);
- void stopCollectData(std::string& sCollectedText);
- void collectData(std::string& sCollectedText);
+ void startCollectData(char *sCollectedText);
+ void stopCollectData(char *sCollectedText);
private:
- std::stack<po_stack_entry> mcStack;
- bool mbMergeMode;
- bool mbCollectingData;
- std::string msCollector;
-
- void extract();
- void insert();
- void runLex();
-
- friend class convert_po;
+ void execute();
};
#endif
\ No newline at end of file
Modified: openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConPo.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -30,57 +33,34 @@
-/********************** I M P L E M E N T A T I O N **********************/
-namespace PoWrap
-{
-#include "gConPo_yy.c"
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::runLex()
-{
- PoWrap::genpo_lex();
-}
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_po::convert_po(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_po::~convert_po() {}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::pushKeyPart(TAG_TYPE bIsNode, std::string& sTag)
+namespace PoWrap
{
- // remember text for merge
- msCollector += sTag;
-
- po_stack_entry newTag(bIsNode, sTag);
-
- mcStack.push(newTag);
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_po *)convert_gen_impl::mcImpl)
+#include "gConPo_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::popKeyPart(TAG_TYPE bIsNode, std::string &sTag)
+void convert_po::execute()
{
- // remember text for merge
- msCollector += sTag;
-
- // check for correct node/prop relations
- if (bIsNode != mcStack.top().mbIsNode)
- throw "node/prob mismatch in file " + msSourceFile;
-
- mcStack.pop();
-
- if (mbMergeMode && msCollector.size())
- writeSourceFile(msCollector);
- msCollector.clear();
+ PoWrap::genpo_lex();
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::startCollectData(std::string& sCollectedText)
+void convert_po::startCollectData(char *sText)
{
+ std::string sCollectedText(sText);
if (mbMergeMode && msCollector.size())
writeSourceFile(msCollector);
@@ -91,18 +71,12 @@ void convert_po_impl::startCollectData(s
/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::stopCollectData(std::string& sCollectedText)
+void convert_po::stopCollectData(char *sText)
{
+ std::string sCollectedText(sText);
std::string useKey;
- // locate key and extract it
- while (mcStack.size())
- {
- po_stack_entry nowEntry = mcStack.top();
- mcStack.pop();
- useKey = useKey + nowEntry.msName;
- }
if (mbMergeMode)
{
@@ -125,16 +99,3 @@ void convert_po_impl::stopCollectData(st
mbCollectingData = false;
msCollector.clear();
}
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_po_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPolex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPolex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPolex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_po::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -59,49 +59,16 @@
/******************* R U L E S D E F I N I T I O N S *******************/
%%
-"<oor:component-data "[^>]*> {
- std::string text(yytext);
- convert_po::mcpImpl->pushKeyPart(TAG_COMPONENT, text);
-}
-
-
-"</oor:component-data>" {
- std::string text(yytext);
- convert_po::mcpImpl->popKeyPart(TAG_COMPONENT, text);
-}
-
-"<prop oor:name=\""[^\"]*\" {
- std::string text(yytext);
- convert_po::mcpImpl->pushKeyPart(TAG_PROP, text);
-}
-
-"</prop>" {
- std::string text(yytext);
- convert_po::mcpImpl->popKeyPart(TAG_PROP, text);
-}
-
-"<node oor:name=\""[^\"]*\" {
- std::string text(yytext);
- convert_po::mcpImpl->pushKeyPart(TAG_NODE, text);
-}
-
-"</node>" {
- std::string text(yytext);
- convert_po::mcpImpl->popKeyPart(TAG_NODE, text);
-}
"<value xml:lang=\""[^\"]*\"[^>]*">" {
- std::string text(yytext);
- convert_po::mcpImpl->startCollectData(text);
+ LOCptr->startCollectData(yytext);
}
"</value>" {
- std::string text(yytext);
- convert_po::mcpImpl->stopCollectData(text);
+ LOCptr->stopCollectData(yytext);
}
.|\n {
- std::string text(yytext);
- convert_po::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConProp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConProp.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConProp.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConProp.cxx Mon Feb 11 23:16:00 2013
@@ -18,7 +18,7 @@
* under the License.
*
*************************************************************/
-#include "gLang.hxx"
+#include "gConProp.hxx"
@@ -31,32 +31,22 @@
/********************** I M P L E M E N T A T I O N **********************/
-convert_properties::convert_properties(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose)
- : convert_gen(srSourceFile, crMemory, brVerbose)
+convert_prop::convert_prop(l10nMem& crMemory) : convert_gen_impl(crMemory)
{
- throw std::string("convert_properties not implemented");
+ throw std::string("convert_prop not implemented");
}
/********************** I M P L E M E N T A T I O N **********************/
-convert_properties::~convert_properties()
+convert_prop::~convert_prop()
{
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_properties::extract()
+void convert_prop::execute()
{
- throw std::string("convert_properties::extract not implemented");
+ throw std::string("convert_prop::execute not implemented");
}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_properties::insert()
-{
- throw std::string("convert_properties::insert not implemented");
-}
-
Added: openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx?rev=1444992&view=auto
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx (added)
+++ openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx Mon Feb 11 23:16:00 2013
@@ -0,0 +1,46 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+#ifndef GCONPROP_HXX
+#define GCONPROP_HXX
+#include "gCon.hxx"
+
+
+
+/*****************************************************************************
+ ************************ G C O N P R O P . H X X ************************
+ *****************************************************************************
+ * This is the class header for .proporties conversion
+ *****************************************************************************/
+
+
+
+/******************** C L A S S D E F I N I T I O N ********************/
+class convert_prop : public convert_gen_impl
+{
+ public:
+ convert_prop(l10nMem& crMemory);
+ ~convert_prop();
+
+
+ private:
+ void execute();
+};
+#endif
\ No newline at end of file
Propchange: openoffice/branches/l10n/main/l10ntools/source/gConProp.hxx
------------------------------------------------------------------------------
svn:executable = *
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx Mon Feb 11 23:16:00 2013
@@ -20,8 +20,7 @@
*************************************************************/
#ifndef GCONSRCHXX
#define GCONSRCHXX
-#include "gLang.hxx"
-#include <vector>
+#include "gCon.hxx"
@@ -34,30 +33,25 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_src_impl : public convert_gen
+class convert_src : public convert_gen_impl
{
public:
- convert_src_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_src_impl();
+ convert_src(l10nMem& crMemory);
+ ~convert_src();
- void pushKey(std::string &sText);
- void popKey (std::string &sText);
- void pushNoKey(std::string &sText);
- void registerKey(std::string &sText);
+ void pushKey(char *sText);
+ void popKey (char *sText);
+ void pushNoKey(char *sText);
+ void registerKey(char *sText);
- void saveData(std::string& sText);
- void saveItemList(std::string& sText);
- void copyData(std::string& sText);
+ void saveData(char *sText);
+ void saveItemList(char *sText);
private:
std::vector<std::string> mcStack;
std::string msCollector;
bool mbNoKey;
- void extract();
- void insert();
- void runLex();
-
- friend class convert_src;
+ void execute();
};
#endif
\ No newline at end of file
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConSrc.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -30,19 +33,24 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_src::convert_src(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_src::~convert_src() {}
/********************** I M P L E M E N T A T I O N **********************/
namespace SrcWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_src *)convert_gen_impl::mcImpl)
#include "gConSrc_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::runLex()
+void convert_src::execute()
{
SrcWrap::genSrc_lex();
}
@@ -50,9 +58,9 @@ void convert_src_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::pushKey(std::string &sText)
+void convert_src::pushKey(char *sInpText)
{
- std::string sKey;
+ std::string sKey, sText(sInpText);
int nL, nE;
// write text for merge
@@ -63,8 +71,8 @@ void convert_src_impl::pushKey(std::stri
// locate id
for (nL = 0; sText[nL] != ' ' && sText[nL] != '\t' && sText[nL] != '\n'; ++nL) ;
for (; sText[nL] == ' ' || sText[nL] == '\t'; ++nL) ;
- for (nE = nL; sText[nE] != ' ' && sText[nE] != '\t' && sText[nE] != '\n'; ++nE) ;
- sKey = sText.substr(nL, nE - nL);
+ for (nE = sText.size()-1; sText[nE] == ' ' || sText[nE] == '\t' || sText[nE] == '\n'; --nE) ;
+ sKey = sText.substr(nL, nE - nL +1);
mcStack.push_back(sKey);
mbNoKey = false;
@@ -73,9 +81,11 @@ void convert_src_impl::pushKey(std::stri
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::popKey(std::string &sText)
+void convert_src::popKey(char *sInpText)
{
- // write text for merge
+ std::string sText(sInpText);
+
+ // write text for merge
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
@@ -89,8 +99,9 @@ void convert_src_impl::popKey(std::strin
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::pushNoKey(std::string &sText)
+void convert_src::pushNoKey(char *sInpText)
{
+ std::string sText(sInpText);
// write text for merge
if (mbMergeMode)
writeSourceFile(msCollector + sText);
@@ -102,12 +113,12 @@ void convert_src_impl::pushNoKey(std::st
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::registerKey(std::string &sText)
+void convert_src::registerKey(char *sInpText)
{
- std::string sKey;
+ std::string sKey, sText(sInpText);
int nL, nE;
- // write text for merge
+ // write text for merged
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
@@ -131,10 +142,10 @@ void convert_src_impl::registerKey(std::
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::saveData(std::string &sText)
+void convert_src::saveData(char *sInpText)
{
int nL, nE;
- std::string sKey, sUseText;
+ std::string sKey, sUseText, sText(sInpText);
// write text for merge
if (mbMergeMode)
@@ -176,10 +187,10 @@ void convert_src_impl::saveData(std::str
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::saveItemList(std::string &sText)
+void convert_src::saveItemList(char *sInpText)
{
int nL, nE;
- std::string sKey, sUseText;
+ std::string sKey, sUseText, sText(sInpText);
// write text for merge
if (mbMergeMode)
@@ -219,17 +230,3 @@ void convert_src_impl::saveItemList(std:
}
}
}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::copyData(std::string &sText)
-{
- msCollector += sText;
- if (sText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_src::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -61,11 +61,11 @@
[bB][iI][tT][mM][aA][pP]\ +[a-zA-Z]+[^\{]* |
[bB][uU][tT][tT][oO][nN][iI][mM][aA][gG][eE]\ +[a-zA-Z]+[^\{]* |
-[eE][dD][iI][tT]\ +[a-zA-Z]+[^\{]* |
[cC][aA][nN][cC][eE][lL][bB][uU][tT][tT][oO][nN]\ +[a-zA-Z]+[^\{]* |
[cC][hH][eE][cC][kK][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
[cC][oO][nN][tT][rR][oO][lL]\ +[a-zA-Z]+[^\{]* |
[cC][oO][mM][bB][oO][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
+[eE][dD][iI][tT]\ +[a-zA-Z]+[^\{]* |
[eE][rR][rR][oO][rR][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
[fF][iI][xX][eE][dD][tT][eE][xX][tT]\ +[a-zA-Z]+[^\{]* |
[fF][iI][xX][eE][dD][lL][iI][nN][eE]\ +[a-zA-Z]+[^\{]* |
@@ -79,6 +79,7 @@
[lL][iI][sS][tT][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
[mM][eE][nN][uU]\ +[a-zA-Z]+[^\{]* |
[mM][eE][nN][uU][iI][tT][eE][mM]\ +[a-zA-Z]+[^\{]* |
+[mM][eE][tT][rR][iI][cC][fF][iI][eE][lL][dD]\ +[a-zA-Z]+[^\{]* |
[mM][oO][dD][aA][lL][dD][iI][aA][lL][oO][gG]\ +[a-zA-Z]+[^\{]* |
[mM][uU][lL][tT][iI][lL][iI][nN][eE][eE][dD][iI][tT]\ +[a-zA-Z]+[^\{]* |
[nN][uU][mM][eE][rR][iI][cC][fF][iI][eE][lL][dD]\ +[a-zA-Z]+[^\{]* |
@@ -88,6 +89,7 @@
[pP][uU][sS][hH][bB][uU][tT][tT][oO][nN]\ +[a-zA-Z]+[^\{]* |
[qQ][uU][eE][rR][yY][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
[rR][aA][dD][iI][oO][bB][uU][tT][tT][oO][nN]\ +[a-zA-Z]+[^\{]* |
+[rR][eE][sS][oO][uU][rR][cC][eE]\ +[a-zA-Z]+[^\{]* |
[sS][tT][rR][iI][nN][gG]\ +[a-zA-Z]+[^\{]* |
[sS][tT][rR][iI][nN][gG][aA][rR][rR][aA][yY]\ +[a-zA-Z]+[^\{]* |
[tT][aA][bB][cC][oO][nN][tT][rR][oO][lL]\ +[a-zA-Z]+[^\{]* |
@@ -95,19 +97,18 @@
[tT][aA][bB][pP][aA][gG][eE]\ +[a-zA-Z]+[^\{]* |
[tT][oO][oO][lL][bB][oO][xX]\ +[a-zA-Z]+[^\{]* |
[tT][oO][oO][lL][bB][oO][xX][iI][tT][eE][mM]\ +[a-zA-Z]+[^\{]* {
- std::string text(yytext);
- convert_src::mcpImpl->pushKey(text);
+ LOCptr->pushKey(yytext);
}
[bB][iI][tT][mM][aA][pP][ \t\n]+"{" |
[bB][uU][tT][tT][oO][nN][iI][mM][aA][gG][eE][ \t\n]+"{" |
-[eE][dD][iI][tT][ \t\n]+"{" |
[cC][aA][nN][cC][eE][lL][bB][uU][tT][tT][oO][nN][ \t\n]"{" |
[cC][hH][eE][cC][kK][bB][oO][xX][ \t\n]+"{" |
[cC][oO][nN][tT][rR][oO][lL][ \t\n]+"{" |
[cC][oO][mM][bB][oO][bB][oO][xX][ \t\n]+"{" |
+[eE][dD][iI][tT][ \t\n]+"{" |
[eE][rR][rR][oO][rR][bB][oO][xX][ \t\n]+"{" |
[fF][iI][xX][eE][dD][tT][eE][xX][tT][ \t\n]+"{" |
[fF][iI][xX][eE][dD][lL][iI][nN][eE][ \t\n]+"{" |
@@ -121,6 +122,7 @@
[lL][iI][sS][tT][bB][oO][xX][ \t\n]+"{" |
[mM][eE][nN][uU][ \t\n]+"{" |
[mM][eE][nN][uU][iI][tT][eE][mM][ \t\n]+"{" |
+[mM][eE][tT][rR][iI][cC][fF][iI][eE][lL][dD][ \t\n]+"{" |
[mM][oO][dD][aA][lL][dD][iI][aA][lL][oO][gG][ \t\n]+"{" |
[mM][uU][lL][tT][iI][lL][iI][nN][eE][eE][dD][iI][tT][ \t\n]+"{" |
[nN][uU][mM][eE][rR][iI][cC][fF][iI][eE][lL][dD][ \t\n]+"{" |
@@ -130,43 +132,40 @@
[pP][uU][sS][hH][bB][uU][tT][tT][oO][nN][ \t\n]+"{" |
[qQ][uU][eE][rR][yY][bB][oO][xX][ \t\n]+"{" |
[rR][aA][dD][iI][oO][bB][uU][tT][tT][oO][nN][ \t\n]+"{" |
+[rR][eE][sS][oO][uU][rR][cC][eE][ \t\n]+"{" |
[sS][tT][rR][iI][nN][gG][ \t\n]+"{" |
+[sS][tT][rR][iI][nN][gG][aA][rR][rR][aA][yY][ \t\n]+"{" |
[tT][aA][bB][cC][oO][nN][tT][rR][oO][lL][ \t\n]+"{" |
[tT][aA][bB][dD][iI][aA][lL][oO][gG][ \t\n]+"{" |
[tT][aA][bB][pP][aA][gG][eE][ \t\n]+"{" |
[tT][oO][oO][lL][bB][oO][xX][ \t\n]+"{" |
[tT][oO][oO][lL][bB][oO][xX][iI][tT][eE][mM][ \t\n]+"{" {
- std::string text(yytext);
- convert_src::mcpImpl->pushNoKey(text);
+ LOCptr->pushNoKey(yytext);
}
[hH][eE][lL][pP][iI][dD]\ *"="\ *[a-zA-Z\"]+[^;]* |
[iI][dD][eE][nN][tT][iI][fF][iI][eE][rR]\ *"="\ *[a-zA-Z\"]+[^;]* {
- std::string text(yytext);
- convert_src::mcpImpl->registerKey(text);
+ LOCptr->registerKey(yytext);
}
[mM][eE][sS][sS][aA][gG][eE]\ *"["\ *"en-US"\ *"]"\ *"="[^\n]* |
[qQ][uU][iI][cC][kK][hH][eE][lL][pP][tT][eE][xX][tT]\ *"["\ *"en-US"\ *"]"\ *"="[^\n]* |
[tT][eE][xX][tT]\ *"["\ *"en-US"\ *"]"\ *"="[^\n]* |
[tT][iI][tT][lL][eE]\ *"["\ *"en-US"\ *"]"\ *"="[^\n]* {
- std::string text(yytext);
- convert_src::mcpImpl->saveData(text);
+ LOCptr->saveData(yytext);
}
-[iI][tT][eE][mM][lL][iI][sS][tT]\ *"["\ *"en-US"\ *"]"\ *"="[ \n]+"{"[^\}]*"};" {
- std::string text(yytext);
- convert_src::mcpImpl->saveItemList(text);
+[iI][tT][eE][mM][lL][iI][sS][tT]\ *"["\ *"en-US"\ *"]"\ *"="[ \t\n]+"{"[^\}]*"};" |
+[sS][tT][rR][iI][nN][gG][lL][iI][sS][tT]\ *"["\ *"en-US"\ *"]"\ *"="[ \t\n]+"{"[^\}]*"};" {
+ LOCptr->saveItemList(yytext);
}
"}"[ ]*";" {
- std::string text(yytext);
- convert_src::mcpImpl->popKey(text);
+ LOCptr->popKey(yytext);
}
.|\n {
- std::string text(yytext);
- convert_src::mcpImpl->copyData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConTree.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConTree.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConTree.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConTree.cxx Mon Feb 11 23:16:00 2013
@@ -18,7 +18,7 @@
* under the License.
*
*************************************************************/
-#include "gLang.hxx"
+#include "gConTree.hxx"
@@ -31,8 +31,7 @@
/********************** I M P L E M E N T A T I O N **********************/
-convert_tree::convert_tree(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose)
- : convert_gen(srSourceFile, crMemory, brVerbose)
+convert_tree::convert_tree(l10nMem& crMemory) : convert_gen_impl(crMemory)
{
// extension, program, parameter, collectMode, xxx
// ".tree", "xhtex", "", "negative", "noiso"
@@ -49,15 +48,7 @@ convert_tree::~convert_tree()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_tree::extract()
+void convert_tree::execute()
{
- throw std::string("convert_tree::extract not implemented");
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_tree::insert()
-{
- throw std::string("convert_tree::insert not implemented");
+ throw std::string("convert_tree::execute not implemented");
}
Added: openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx?rev=1444992&view=auto
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx (added)
+++ openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx Mon Feb 11 23:16:00 2013
@@ -0,0 +1,46 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+#ifndef GCONTREE_HXX
+#define GCONTREE_HXX
+#include "gCon.hxx"
+
+
+
+/*****************************************************************************
+ **************************** G C O N . H X X ****************************
+ *****************************************************************************
+ * This is the class header for .tree conversion
+ *****************************************************************************/
+
+
+
+/******************** C L A S S D E F I N I T I O N ********************/
+class convert_tree : public convert_gen_impl
+{
+ public:
+ convert_tree(l10nMem& crMemory);
+ ~convert_tree();
+
+
+ private:
+ void execute();
+};
+#endif
\ No newline at end of file
Propchange: openoffice/branches/l10n/main/l10ntools/source/gConTree.hxx
------------------------------------------------------------------------------
svn:executable = *
Modified: openoffice/branches/l10n/main/l10ntools/source/gConUlf.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConUlf.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConUlf.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConUlf.hxx Mon Feb 11 23:16:00 2013
@@ -20,7 +20,7 @@
*************************************************************/
#ifndef GCONULF_HXX
#define GCONULF_HXX
-#include "gLang.hxx"
+#include "gCon.hxx"
@@ -33,24 +33,17 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_ulf_impl : public convert_gen
+class convert_ulf : public convert_gen_impl
{
public:
- convert_ulf_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_ulf_impl();
+ convert_ulf(l10nMem& crMemory);
+ ~convert_ulf();
- void setKey(std::string &sCollectedText);
- void setText(std::string &sCollectedText);
- void collectData(std::string& sCollectedText);
+ void setKey(char *sCollectedText);
+ void setText(char *sCollectedText);
private:
- std::string msCollector;
- std::string msKey;
-
- void extract();
- void insert();
- void runLex();
-
- friend class convert_ulf;
+ void execute();
+ void handleLines();
};
#endif
\ No newline at end of file
Modified: openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConUlf.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -31,15 +34,23 @@
/********************** I M P L E M E N T A T I O N **********************/
+convert_ulf::convert_ulf(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_ulf::~convert_ulf() {}
+
+
+
+/********************** I M P L E M E N T A T I O N **********************/
namespace UlfWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_ulf *)convert_gen_impl::mcImpl)
#include "gConUlf_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_ulf_impl::runLex()
+void convert_ulf::execute()
{
UlfWrap::genulf_lex();
}
@@ -47,8 +58,9 @@ void convert_ulf_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_ulf_impl::setKey(std::string& sCollectedText)
+void convert_ulf::setKey(char *sText)
{
+ std::string sCollectedText(sText);
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
msCollector.clear();
@@ -60,8 +72,9 @@ void convert_ulf_impl::setKey(std::strin
/********************** I M P L E M E N T A T I O N **********************/
-void convert_ulf_impl::setText(std::string& sCollectedText)
+void convert_ulf::setText(char *sInpText)
{
+ std::string sCollectedText(sInpText);
int nL, nE;
std::string sText;
@@ -97,17 +110,3 @@ void convert_ulf_impl::setText(std::stri
else
mcMemory.setEnUsKey(msKey, msCollector);
}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_ulf_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_ulf::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -60,17 +60,14 @@
%%
"["[^\]]*"]" {
- std::string text(yytext);
- convert_ulf::mcpImpl->setKey(text);
+ LOCptr->setKey(yytext);
}
"en-US"[ ]*"="[^\n]* {
- std::string text(yytext);
- convert_ulf::mcpImpl->setText(text);
+ LOCptr->setText(yytext);
}
.|\n {
- std::string text(yytext);
- convert_ulf::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcs.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcs.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcs.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcs.hxx Mon Feb 11 23:16:00 2013
@@ -20,7 +20,7 @@
*************************************************************/
#ifndef GCONXCS_HXX
#define GCONXCS_HXX
-#include "gLang.hxx"
+#include "gCon.hxx"
@@ -33,27 +33,18 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_xcs_impl : public convert_gen
+class convert_xcs : public convert_gen_impl
{
public:
- convert_xcs_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_xcs_impl();
+ convert_xcs(l10nMem& crMemory);
+ ~convert_xcs();
- void setKey(std::string &sCollectedText);
- void unsetKey(std::string &sCollectedText);
- void startCollectData(std::string& sCollectedText);
- void stopCollectData(std::string& sCollectedText);
- void collectData(std::string& sCollectedText);
+ void setKey(char *sCollectedText);
+ void unsetKey(char *sCollectedText);
+ void startCollectData(char *sCollectedText);
+ void stopCollectData(char *sCollectedText);
private:
- bool mbCollectingData;
- std::string msCollector;
- std::string msKey;
-
- void extract();
- void insert();
- void runLex();
-
- friend class convert_xcs;
+ void execute();
};
#endif
\ No newline at end of file
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConXcs.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -30,16 +33,24 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_xcs::convert_xcs(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_xcs::~convert_xcs() {}
+
+
+
/********************** I M P L E M E N T A T I O N **********************/
namespace XcsWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_xcs *)convert_gen_impl::mcImpl)
#include "gConXcs_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::runLex()
+void convert_xcs::execute()
{
// currently no .xcs files generate en-US translation, so stop trying
XcsWrap::genxcs_lex();
@@ -48,24 +59,24 @@ void convert_xcs_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::setKey(std::string& sCollectedText)
+void convert_xcs::setKey(char *sCollectedText)
{
int nL;
- std::string sHead;
+ std::string sHead, myText(sCollectedText);
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
msCollector.clear();
// is it to be translated
- if (sCollectedText.find("oor:localized=") == std::string::npos)
+ if (myText.find("oor:localized=") == std::string::npos)
return;
// locate key (is any)
- nL = sCollectedText.find("oor:name=\"");
+ nL = myText.find("oor:name=\"");
if (nL == (int)std::string::npos)
return;
- sHead = sCollectedText.substr(nL+10);
+ sHead = myText.substr(nL+10);
nL = sHead.find("\"");
msKey = sHead.substr(0,nL);
}
@@ -73,8 +84,10 @@ void convert_xcs_impl::setKey(std::strin
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::unsetKey(std::string& sCollectedText)
+void convert_xcs::unsetKey(char *sText)
{
+ std::string sCollectedText(sText);
+
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
msCollector.clear();
@@ -85,8 +98,11 @@ void convert_xcs_impl::unsetKey(std::str
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::startCollectData(std::string& sCollectedText)
+void convert_xcs::startCollectData(char *sText)
{
+ std::string sCollectedText(sText);
+
+
if (mbMergeMode)
writeSourceFile(msCollector);
msCollector.clear();
@@ -98,9 +114,9 @@ void convert_xcs_impl::startCollectData(
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::stopCollectData(std::string& sCollectedText)
+void convert_xcs::stopCollectData(char *sInpText)
{
- std::string sHead, sKey, sLang, sText;
+ std::string sHead, sKey, sLang, sText, sCollectedText(sInpText);
int nL;
@@ -147,16 +163,3 @@ void convert_xcs_impl::stopCollectData(s
mbCollectingData = false;
}
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcs_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_xcs::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -60,27 +60,22 @@
%%
"<prop"[^>]*> {
- std::string text(yytext);
- convert_xcs::mcpImpl->setKey(text);
+ LOCptr->setKey(yytext);
}
"</prop>" {
- std::string text(yytext);
- convert_xcs::mcpImpl->unsetKey(text);
+ LOCptr->unsetKey(yytext);
}
"<value"[^>]*> {
- std::string text(yytext);
- convert_xcs::mcpImpl->startCollectData(text);
+ LOCptr->startCollectData(yytext);
}
"</value>" {
- std::string text(yytext);
- convert_xcs::mcpImpl->stopCollectData(text);
+ LOCptr->stopCollectData(yytext);
}
.|\n {
- std::string text(yytext);
- convert_xcs::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx Mon Feb 11 23:16:00 2013
@@ -20,8 +20,7 @@
*************************************************************/
#ifndef GCONXCU_HXX
#define GCONXCU_HXX
-#include "gLang.hxx"
-#include <vector>
+#include "gCon.hxx"
@@ -30,34 +29,27 @@
*****************************************************************************
* This is the class header for .xcu conversion
*****************************************************************************/
-typedef enum {TAG_COMPONENT, TAG_PROP, TAG_NODE } TAG_TYPE;
/******************** C L A S S D E F I N I T I O N ********************/
class xcu_stack_entry;
-class convert_xcu_impl : public convert_gen
+class convert_xcu : public convert_gen_impl
{
public:
- convert_xcu_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_xcu_impl();
+ typedef enum {TAG_COMPONENT, TAG_PROP, TAG_NODE } TAG_TYPE;
+ convert_xcu(l10nMem& crMemory);
+ ~convert_xcu();
- void pushKeyPart(TAG_TYPE eIsNode, std::string &sTag);
- void popKeyPart (TAG_TYPE eIsNode, std::string &sTag);
+ void pushKeyPart(TAG_TYPE eIsNode, char *sTag);
+ void popKeyPart (TAG_TYPE eIsNode, char *sTag);
- void startCollectData(std::string& sCollectedText);
- void stopCollectData(std::string& sCollectedText);
- void collectData(std::string& sCollectedText);
+ void startCollectData(char *sCollectedText);
+ void stopCollectData(char *sCollectedText);
private:
std::vector<std::string> mcStack;
- bool mbCollectingData;
- std::string msCollector;
- void extract();
- void insert();
- void runLex();
-
- friend class convert_xcu;
+ void execute();
};
#endif
\ No newline at end of file
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,7 +19,9 @@
*
*************************************************************/
#include "gConXcu.hxx"
-
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
/*****************************************************************************
@@ -30,16 +32,24 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_xcu::convert_xcu(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_xcu::~convert_xcu() {}
+
+
+
/********************** I M P L E M E N T A T I O N **********************/
namespace XcuWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_xcu *)convert_gen_impl::mcImpl)
#include "gConXcu_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::runLex()
+void convert_xcu::execute()
{
XcuWrap::genxcu_lex();
}
@@ -47,9 +57,9 @@ void convert_xcu_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::pushKeyPart(TAG_TYPE bIsNode, std::string& sTag)
+void convert_xcu::pushKeyPart(TAG_TYPE bIsNode, char *sTag)
{
- std::string sKey;
+ std::string sKey, myTag(sTag);
int nL, nE;
@@ -59,24 +69,24 @@ void convert_xcu_impl::pushKeyPart(TAG_T
msCollector.clear();
// find key in tag
- nL = sTag.find("oor:name=\"");
+ nL = myTag.find("oor:name=\"");
if (nL == (int)std::string::npos)
return;
// find end of key
nL += 10;
- nE = sTag.find("\"", nL);
+ nE = myTag.find("\"", nL);
if (nE == (int)std::string::npos)
return;
- sKey = sTag.substr(nL, nE - nL);
+ sKey = myTag.substr(nL, nE - nL);
mcStack.push_back(sKey);
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::popKeyPart(TAG_TYPE bIsNode, std::string &sTag)
+void convert_xcu::popKeyPart(TAG_TYPE bIsNode, char *sTag)
{
// write text for merge
if (mbMergeMode)
@@ -91,7 +101,7 @@ void convert_xcu_impl::popKeyPart(TAG_TY
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::startCollectData(std::string& sCollectedText)
+void convert_xcu::startCollectData(char *sCollectedText)
{
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
@@ -103,7 +113,7 @@ void convert_xcu_impl::startCollectData(
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::stopCollectData(std::string& sCollectedText)
+void convert_xcu::stopCollectData(char *sCollectedText)
{
int nL;
std::string useKey;
@@ -138,16 +148,3 @@ void convert_xcu_impl::stopCollectData(s
msCollector.clear();
}
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_xcu_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXculex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXculex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXculex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXculex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_xcu::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -60,48 +60,39 @@
%%
"<oor:component-data "[^>]*> {
- std::string text(yytext);
- convert_xcu::mcpImpl->pushKeyPart(TAG_COMPONENT, text);
+ LOCptr->pushKeyPart(convert_xcu::TAG_COMPONENT, yytext);
}
"</oor:component-data>" {
- std::string text(yytext);
- convert_xcu::mcpImpl->popKeyPart(TAG_COMPONENT, text);
+ LOCptr->popKeyPart(convert_xcu::TAG_COMPONENT, yytext);
}
"<prop oor:name=\""[^\"]*\" {
- std::string text(yytext);
- convert_xcu::mcpImpl->pushKeyPart(TAG_PROP, text);
+ LOCptr->pushKeyPart(convert_xcu::TAG_PROP, yytext);
}
"</prop>" {
- std::string text(yytext);
- convert_xcu::mcpImpl->popKeyPart(TAG_PROP, text);
+ LOCptr->popKeyPart(convert_xcu::TAG_PROP, yytext);
}
"<node oor:name=\""[^\"]*\" {
- std::string text(yytext);
- convert_xcu::mcpImpl->pushKeyPart(TAG_NODE, text);
+ LOCptr->pushKeyPart(convert_xcu::TAG_NODE, yytext);
}
"</node>" {
- std::string text(yytext);
- convert_xcu::mcpImpl->popKeyPart(TAG_NODE, text);
+ LOCptr->popKeyPart(convert_xcu::TAG_NODE, yytext);
}
"<value xml:lang=\""[^\"]*\"[^>]*">" {
- std::string text(yytext);
- convert_xcu::mcpImpl->startCollectData(text);
+ LOCptr->startCollectData(yytext);
}
"</value>" {
- std::string text(yytext);
- convert_xcu::mcpImpl->stopCollectData(text);
+ LOCptr->stopCollectData(yytext);
}
.|\n {
- std::string text(yytext);
- convert_xcu::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhp.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhp.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhp.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhp.hxx Mon Feb 11 23:16:00 2013
@@ -20,7 +20,7 @@
*************************************************************/
#ifndef GCONXHP_HXX
#define GCONXHP_HXX
-#include "gLang.hxx"
+#include "gCon.hxx"
@@ -33,26 +33,19 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_xhp_impl : public convert_gen
+class convert_xhp : public convert_gen_impl
{
public:
- convert_xhp_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_xhp_impl();
+ convert_xhp(l10nMem& crMemory);
+ ~convert_xhp();
void startCollectData(std::string sType, std::string& sCollectedText);
void stopCollectData(std::string sType, std::string& sCollectedText);
- void collectData(std::string& sCollectedText);
private:
- bool mbCollectingData;
- std::string msCollector;
std::string msMergeType;
std::string msTag;
- void extract();
- void insert();
- void runLex();
-
- friend class convert_xhp;
+ void execute();
};
#endif
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,9 @@
*
*************************************************************/
#include "gConXhp.hxx"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
@@ -30,15 +33,23 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_xhp::convert_xhp(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_xhp::~convert_xhp() {}
+
+
+
/********************** I M P L E M E N T A T I O N **********************/
namespace XhpWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_xhp *)convert_gen_impl::mcImpl)
#include "gConXhp_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xhp_impl::runLex()
+void convert_xhp::execute()
{
XhpWrap::genXhp_lex();
@@ -49,7 +60,7 @@ void convert_xhp_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xhp_impl::startCollectData(std::string sType, std::string& sCollectedText)
+void convert_xhp::startCollectData(std::string sType, std::string& sCollectedText)
{
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
@@ -67,7 +78,7 @@ void convert_xhp_impl::startCollectData(
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xhp_impl::stopCollectData(std::string sType, std::string& sCollectedText)
+void convert_xhp::stopCollectData(std::string sType, std::string& sCollectedText)
{
std::string sKey;
int nL;
@@ -108,16 +119,3 @@ void convert_xhp_impl::stopCollectData(s
mbCollectingData = false;
msCollector.clear();
}
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_xhp_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_xhp::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -61,37 +61,37 @@
"<title"[^>]*> {
std::string text(yytext);
- convert_xhp::mcpImpl->startCollectData(text.substr(1,5), text);
+ LOCptr->startCollectData(text.substr(1,5), text);
}
"<bookmark "[^>]*> {
std::string text(yytext);
- convert_xhp::mcpImpl->startCollectData(text.substr(1,8), text);
+ LOCptr->startCollectData(text.substr(1,8), text);
}
"<paragraph"[^>]*> {
std::string text(yytext);
- convert_xhp::mcpImpl->startCollectData(text.substr(1,9), text);
+ LOCptr->startCollectData(text.substr(1,9), text);
}
"</paragraph>" {
std::string text(yytext);
- convert_xhp::mcpImpl->stopCollectData(text.substr(2,9), text);
+ LOCptr->stopCollectData(text.substr(2,9), text);
}
"</bookmark>" {
std::string text(yytext);
- convert_xhp::mcpImpl->stopCollectData(text.substr(2,8), text);
+ LOCptr->stopCollectData(text.substr(2,8), text);
}
"</title>" {
std::string text(yytext);
- convert_xhp::mcpImpl->stopCollectData(text.substr(2,5), text);
+ LOCptr->stopCollectData(text.substr(2,5), text);
}
.|\n {
std::string text(yytext);
- convert_xhp::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXrm.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXrm.hxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXrm.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXrm.hxx Mon Feb 11 23:16:00 2013
@@ -20,7 +20,7 @@
*************************************************************/
#ifndef GCONXRM_HXX
#define GCONXRM_HXX
-#include "gLang.hxx"
+#include "gCon.hxx"
@@ -33,25 +33,20 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class convert_xrm_impl : public convert_gen
+class convert_xrm : public convert_gen_impl
{
public:
- convert_xrm_impl(const std::string& srSourceFile, l10nMem& crMemory, bool brVerbose);
- ~convert_xrm_impl();
+ convert_xrm(l10nMem& crMemory);
+ ~convert_xrm();
void startCollectData(std::string sType, std::string& sCollectedText);
void stopCollectData(std::string sType, std::string& sCollectedText);
- void collectData(std::string& sCollectedText);
private:
- bool mbCollectingData;
- std::string msCollector;
std::string msTag;
std::string msMergeType;
- void extract();
- void insert();
- void runLex();
+ void execute();
friend class convert_xrm;
};
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx Mon Feb 11 23:16:00 2013
@@ -19,7 +19,9 @@
*
*************************************************************/
#include "gConXrm.hxx"
-
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
/*****************************************************************************
@@ -30,15 +32,23 @@
+/************ I N T E R F A C E I M P L E M E N T A T I O N ************/
+convert_xrm::convert_xrm(l10nMem& crMemory) : convert_gen_impl(crMemory) {}
+convert_xrm::~convert_xrm() {}
+
+
+
/********************** I M P L E M E N T A T I O N **********************/
namespace XrmWrap
{
+#define IMPLptr convert_gen_impl::mcImpl
+#define LOCptr ((convert_xrm *)convert_gen_impl::mcImpl)
#include "gConXrm_yy.c"
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xrm_impl::runLex()
+void convert_xrm::execute()
{
XrmWrap::genXrm_lex();
@@ -50,7 +60,7 @@ void convert_xrm_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xrm_impl::startCollectData(std::string sType, std::string& sCollectedText)
+void convert_xrm::startCollectData(std::string sType, std::string& sCollectedText)
{
if (mbMergeMode)
writeSourceFile(msCollector+sCollectedText);
@@ -64,7 +74,7 @@ void convert_xrm_impl::startCollectData(
/********************** I M P L E M E N T A T I O N **********************/
-void convert_xrm_impl::stopCollectData(std::string sType, std::string& sCollectedText)
+void convert_xrm::stopCollectData(std::string sType, std::string& sCollectedText)
{
std::string sKey;
int nL;
@@ -105,16 +115,3 @@ void convert_xrm_impl::stopCollectData(s
mbCollectingData = false;
msCollector.clear();
}
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_xrm_impl::collectData(std::string& sCollectedText)
-{
- msCollector += sCollectedText;
- if (sCollectedText == "\n")
- {
- if (mbMergeMode)
- writeSourceFile(msCollector);
- msCollector.clear();
- }
-}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l Mon Feb 11 23:16:00 2013
@@ -36,7 +36,7 @@
#define YYLMAX 64000
/* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { convert_xrm::mcpImpl->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
%}
@@ -61,27 +61,26 @@
"<p"[^>]*> {
std::string text(yytext);
- convert_xrm::mcpImpl->startCollectData(text.substr(1,1), text);
+ LOCptr->startCollectData(text.substr(1,1), text);
}
"<h"[0-9][^>]*> {
std::string text(yytext);
- convert_xrm::mcpImpl->startCollectData(text.substr(1,2), text);
+ LOCptr->startCollectData(text.substr(1,2), text);
}
"</p>" {
std::string text(yytext);
- convert_xrm::mcpImpl->stopCollectData(text.substr(2,1), text);
+ LOCptr->stopCollectData(text.substr(2,1), text);
}
"</h"[0-9]> {
std::string text(yytext);
- convert_xrm::mcpImpl->stopCollectData(text.substr(2,2), text);
+ LOCptr->stopCollectData(text.substr(2,2), text);
}
.|\n {
- std::string text(yytext);
- convert_xrm::mcpImpl->collectData(text);
+ IMPLptr->collectData(yytext);
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx Mon Feb 11 23:16:00 2013
@@ -20,6 +20,7 @@
*************************************************************/
#include <iostream>
#include "gLang.hxx"
+#include <cstdlib>
@@ -34,19 +35,8 @@
/********************** I M P L E M E N T A T I O N **********************/
-handler::handler()
- : meWorkMode(DO_NONE),
- mbVerbose(false)
-{
- // clear translation memory
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-handler::~handler()
-{
-}
+handler::handler() {}
+handler::~handler() {}
@@ -67,7 +57,7 @@ void handler::checkCommandLine(int argc,
sWorkText = argv[1];
if (sWorkText == "extract") meWorkMode = DO_EXTRACT;
- else if (sWorkText == "merge") meWorkMode = DO_MERGE;
+ else if (sWorkText == "merge") meWorkMode = DO_EXTRACTMERGE;
else if (sWorkText == "generate") meWorkMode = DO_GENERATE;
else if (sWorkText == "insert") meWorkMode = DO_INSERT;
else if (sWorkText == "--help") throw std::string("");
@@ -105,7 +95,7 @@ void handler::checkCommandLine(int argc,
if (!msSourceFiles.size()) throw std::string("missing source files");
break;
- case DO_MERGE:
+ case DO_EXTRACTMERGE:
// required parameters
if (!msSourceDir.size()) throw std::string("missing -s <source dir>");
if (!msTargetDir.size()) throw std::string("missing -t <target dir>");
@@ -133,9 +123,6 @@ void handler::checkCommandLine(int argc,
// not allowed parameters
if (!msSourceFiles.size()) throw std::string("<source> is invalid with generate");
break;
-
- case DO_NONE:
- throw std::string("unknown mode (1 argument)");
}
}
catch(std::string sErr)
@@ -145,7 +132,7 @@ void handler::checkCommandLine(int argc,
std::cerr << "commandline error:" << sErr << std::endl;
// give the correct usage
- std::cout << "genLang (c)2012 by Apache Software Foundation\n"
+ std::cout << "genLang (c)2013 by Apache Software Foundation\n"
"====================================\n"
"As part of the L10N framework, genLang extracts and merges translations\n"
"out of and into the whole source tree.\n\n"
@@ -206,11 +193,10 @@ void handler::run()
// use workMode to start correct control part
switch (meWorkMode)
{
- case DO_EXTRACT: runExtract(); break;
- case DO_MERGE: runMerge(); break;
- case DO_GENERATE: runGenerate(); break;
- case DO_INSERT: runInsert(); break;
- case DO_NONE: throw std::string("INTERNAL ERROR, checkCommandLine not called!!!");
+ case DO_EXTRACT: runExtractMerge(false); break;
+ case DO_EXTRACTMERGE: runExtractMerge(true); break;
+ case DO_GENERATE: runGenerate(); break;
+ case DO_INSERT: runInsert(); break;
}
}
catch(std::string sErr)
@@ -223,7 +209,7 @@ void handler::run()
/********************** I M P L E M E N T A T I O N **********************/
-void handler::runExtract()
+void handler::runExtractMerge(bool bMerge)
{
// prepare translation memory to module type
mcMemory.setModuleName(msModuleName);
@@ -239,7 +225,8 @@ void handler::runExtract()
mcMemory.setFileName(*siSource);
// get converter and extract files
- convert_gen::getConverter(msSourceDir + *siSource, mcMemory, mbVerbose).extract();
+ convert_gen convertObj(msSourceDir + *siSource, mcMemory, bMerge);
+ convertObj.execute();
}
// and generate language file
@@ -249,14 +236,6 @@ void handler::runExtract()
/********************** I M P L E M E N T A T I O N **********************/
-void handler::runMerge()
-{
- throw std::string("handler::runMerge not implemented");
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
void handler::runGenerate()
{
throw std::string("handler::runGenerate not implemented");
Modified: openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx?rev=1444992&r1=1444991&r2=1444992&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx Mon Feb 11 23:16:00 2013
@@ -19,6 +19,7 @@
*
*************************************************************/
#include "gLang.hxx"
+#include <fstream>
@@ -82,7 +83,7 @@ void l10nMem::save(const std::string& sr
outputFile << mcMemory[i].msModuleName << "\t" << mcMemory[i].msSourceFile << "\t"
<< mcMemory[i].msKey;
if (mcMemory[i].miIndex)
- outputFile << ":" << mcMemory[i].miIndex;
+ outputFile << "." << mcMemory[i].miIndex;
outputFile << "\t" << mcMemory[i].msLanguage << "\t"
<< mcMemory[i].msText << std::endl;
}