office-gobmx/l10ntools/inc/xrmmerge.hxx

163 lines
3.9 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-09-27 07:52:10 -05:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2001-08-23 05:45:30 -05:00
#include "sal/config.h"
#include <fstream>
2001-08-23 05:45:30 -05:00
//
// XRMResParser
//
class XRMResParser
{
private:
2012-02-02 14:36:11 -06:00
rtl::OString sGID;
rtl::OString sLID;
2001-08-23 05:45:30 -05:00
sal_Bool bError;
sal_Bool bText;
2001-08-23 05:45:30 -05:00
2012-02-02 14:36:11 -06:00
rtl::OString sCurrentOpenTag;
rtl::OString sCurrentCloseTag;
rtl::OString sCurrentText;
2012-01-25 14:34:11 -06:00
std::vector<rtl::OString> aLanguages;
2001-08-23 05:45:30 -05:00
protected:
2012-02-02 14:36:11 -06:00
rtl::OString GetAttribute( const rtl::OString &rToken, const rtl::OString &rAttribute );
void Error( const rtl::OString &rError );
2001-08-23 05:45:30 -05:00
2012-02-02 14:36:11 -06:00
virtual void Output( const rtl::OString& rOutput )=0;
2011-10-05 14:54:56 -05:00
virtual void WorkOnDesc(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
2011-10-05 14:54:56 -05:00
)=0;
2001-08-23 05:45:30 -05:00
virtual void WorkOnText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
)=0;
2001-08-23 05:45:30 -05:00
virtual void EndOfText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
const rtl::OString &rCloseTag
)=0;
2001-08-23 05:45:30 -05:00
2012-02-02 14:36:11 -06:00
rtl::OString GetGID() { return sGID; }
rtl::OString GetLID() { return sLID; }
2001-08-23 05:45:30 -05:00
2012-02-02 14:36:11 -06:00
void ConvertStringToDBFormat( rtl::OString &rString );
void ConvertStringToXMLFormat( rtl::OString &rString );
2001-08-23 05:45:30 -05:00
public:
XRMResParser();
virtual ~XRMResParser();
int Execute( int nToken, char * pToken );
void SetError( sal_Bool bErr = sal_True ) { bError = bErr; }
sal_Bool GetError() { return bError; }
2001-08-23 05:45:30 -05:00
};
//
// class XRMResOutputParser
//
class XRMResOutputParser : public XRMResParser
{
private:
2012-01-25 14:34:11 -06:00
std::vector<rtl::OString> aLanguages;
2001-08-23 05:45:30 -05:00
protected:
std::ofstream pOutputStream;
2001-08-23 05:45:30 -05:00
public:
2012-02-02 14:36:11 -06:00
XRMResOutputParser ( const rtl::OString &rOutputFile );
2001-08-23 05:45:30 -05:00
virtual ~XRMResOutputParser();
};
//
// XRMResExport
//
class XRMResExport : public XRMResOutputParser
{
private:
ResData *pResData;
2012-02-02 14:36:11 -06:00
rtl::OString sPrj;
rtl::OString sPath;
2012-01-25 14:34:11 -06:00
std::vector<rtl::OString> aLanguages;
2001-08-23 05:45:30 -05:00
protected:
2011-10-05 14:54:56 -05:00
void WorkOnDesc(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
2011-10-05 14:54:56 -05:00
);
void WorkOnText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
2001-08-23 05:45:30 -05:00
);
void EndOfText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
const rtl::OString &rCloseTag
2001-08-23 05:45:30 -05:00
);
2012-02-02 14:36:11 -06:00
void Output( const rtl::OString& rOutput );
2001-08-23 05:45:30 -05:00
public:
XRMResExport(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOutputFile,
const rtl::OString &rProject,
const rtl::OString &rFilePath
2001-08-23 05:45:30 -05:00
);
virtual ~XRMResExport();
};
//
// class XRMResMerge
//
class XRMResMerge : public XRMResOutputParser
{
private:
MergeDataFile *pMergeDataFile;
2012-02-02 14:36:11 -06:00
rtl::OString sFilename;
2001-08-23 05:45:30 -05:00
ResData *pResData;
2012-01-25 14:34:11 -06:00
std::vector<rtl::OString> aLanguages;
2001-08-23 05:45:30 -05:00
protected:
2011-10-05 14:54:56 -05:00
void WorkOnDesc(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
2011-10-05 14:54:56 -05:00
);
void WorkOnText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
rtl::OString &rText
2001-08-23 05:45:30 -05:00
);
void EndOfText(
2012-02-02 14:36:11 -06:00
const rtl::OString &rOpenTag,
const rtl::OString &rCloseTag
2001-08-23 05:45:30 -05:00
);
2012-02-02 14:36:11 -06:00
void Output( const rtl::OString& rOutput );
2001-08-23 05:45:30 -05:00
public:
XRMResMerge(
2012-02-02 14:36:11 -06:00
const rtl::OString &rMergeSource,
const rtl::OString &rOutputFile,
const rtl::OString &rFilename
2001-08-23 05:45:30 -05:00
);
virtual ~XRMResMerge();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */