summaryrefslogtreecommitdiff
path: root/l10ntools/source/cfgmerge.cxx
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-03-15 15:42:05 +0100
committerZolnai Tamás <zolnaitamas2000@gmail.com>2013-03-16 12:27:32 +0100
commit15a13bafccb96e6ab0cc5a23af6dd46715fa22c5 (patch)
tree91b93ddc0f731aec2d5b19f1895545550872a119 /l10ntools/source/cfgmerge.cxx
parent516118b515fb577b1cc40e4b8d7dc06919b64675 (diff)
Get rid of generating temporary sdf file
Working: 1. Localize add header to po files. 2. Executables append po entries to po files. 3. Localize delete entryless po files and empty directories Plus a bunch of clean up. Change-Id: I58e300eaee4cee948203cc9d3e642ca9462d0d26
Diffstat (limited to 'l10ntools/source/cfgmerge.cxx')
-rw-r--r--l10ntools/source/cfgmerge.cxx65
1 files changed, 22 insertions, 43 deletions
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index e380b223e0f9..50329fa3f3d2 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -73,8 +73,7 @@ FILE * init(int argc, char ** argv) {
global::parser.reset(
new CfgExport(
aArgs.m_sOutputFile.getStr(), aArgs.m_sPrj.getStr(),
- common::pathnameToken(global::inputPathname.getStr(),
- aArgs.m_sPrjRoot.getStr())));
+ global::inputPathname ));
}
return pFile;
@@ -355,30 +354,6 @@ void CfgParser::Error(const rtl::OString& rError)
}
//
-// class CfgOutputParser
-//
-
-CfgOutputParser::CfgOutputParser(const rtl::OString &rOutputFile)
-{
- pOutputStream.open(
- rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc);
- if (!pOutputStream.is_open())
- {
- rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("ERROR: Unable to open output file: "));
- sError.append(rOutputFile);
- Error(sError.makeStringAndClear());
- std::exit(EXIT_FAILURE);
- }
-}
-
-/*****************************************************************************/
-CfgOutputParser::~CfgOutputParser()
-/*****************************************************************************/
-{
- pOutputStream.close();
-}
-
-//
// class CfgExport
//
@@ -389,10 +364,15 @@ CfgExport::CfgExport(
const rtl::OString &rFilePath
)
/*****************************************************************************/
- : CfgOutputParser( rOutputFile ),
- sPrj( rProject ),
+ : sPrj( rProject ),
sPath( rFilePath )
{
+ pOutputStream.open( rOutputFile, PoOfstream::APP );
+ if (!pOutputStream.isOpen())
+ {
+ std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n";
+ std::exit(EXIT_FAILURE);
+ }
Export::InitLanguages( false );
aLanguages = Export::GetLanguages();
}
@@ -401,6 +381,7 @@ CfgExport::CfgExport(
CfgExport::~CfgExport()
/*****************************************************************************/
{
+ pOutputStream.close();
}
/*****************************************************************************/
@@ -432,19 +413,9 @@ void CfgExport::WorkOnResourceEnd()
sText = Export::UnquoteHTML( sText );
- rtl::OString sOutput( sPrj ); sOutput += "\t";
- sOutput += sPath;
- sOutput += "\t0\t";
- sOutput += pStackData->sResTyp; sOutput += "\t";
- sOutput += sGroupId; sOutput += "\t";
- sOutput += sLocalId; sOutput += "\t\t\t0\t";
- sOutput += sCur;
- sOutput += "\t";
-
- sOutput += sText; sOutput += "\t";
- sOutput += sXComment; sOutput += "\t\t\t";
-
- pOutputStream << sOutput.getStr() << '\n';
+ Export::writePoEntry(
+ "Cfgex", pOutputStream, sPath, pStackData->sResTyp,
+ sGroupId, sLocalId, sXComment, sText);
}
}
}
@@ -466,12 +437,19 @@ void CfgExport::WorkOnText(
CfgMerge::CfgMerge(
const rtl::OString &rMergeSource, const rtl::OString &rOutputFile,
const rtl::OString &rFilename)
- : CfgOutputParser( rOutputFile ),
- pMergeDataFile( NULL ),
+ : pMergeDataFile( NULL ),
pResData( NULL ),
sFilename( rFilename ),
bEnglish( sal_False )
{
+ pOutputStream.open(
+ rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc);
+ if (!pOutputStream.is_open())
+ {
+ std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n";
+ std::exit(EXIT_FAILURE);
+ }
+
if (rMergeSource.getLength())
{
pMergeDataFile = new MergeDataFile(
@@ -491,6 +469,7 @@ CfgMerge::CfgMerge(
CfgMerge::~CfgMerge()
/*****************************************************************************/
{
+ pOutputStream.close();
delete pMergeDataFile;
delete pResData;
}