LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/l10ntools/inc - xrmmerge.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2013-07-09 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef XRMMERGE_INCLUDED
      21             : #define XRMMERGE_INCLUDED
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <fstream>
      26             : 
      27             : 
      28             : /// Parser for *.xrm and description.xml files
      29             : class XRMResParser
      30             : {
      31             : private:
      32             :     OString sGID;
      33             :     OString sLID;
      34             : 
      35             :     sal_Bool bError;
      36             :     sal_Bool bText;
      37             : 
      38             :     OString sCurrentOpenTag;
      39             :     OString sCurrentCloseTag;
      40             :     OString sCurrentText;
      41             : protected:
      42             :     OString GetAttribute( const OString &rToken, const OString &rAttribute );
      43             :     void Error( const OString &rError );
      44             : 
      45             :     virtual void Output( const OString& rOutput )=0;
      46             :     virtual void WorkOnDesc(
      47             :         const OString &rOpenTag,
      48             :         OString &rText
      49             :     )=0;
      50             :     virtual void WorkOnText(
      51             :         const OString &rOpenTag,
      52             :         OString &rText
      53             :     )=0;
      54             :     virtual void EndOfText(
      55             :         const OString &rOpenTag,
      56             :         const OString &rCloseTag
      57             :     )=0;
      58             : 
      59           0 :     OString GetGID() { return sGID; }
      60             :     OString GetLID() { return sLID; }
      61             : 
      62             : public:
      63             :     XRMResParser();
      64             :     virtual ~XRMResParser();
      65             : 
      66             :     int Execute( int nToken, char * pToken );
      67             : 
      68           0 :     void SetError( sal_Bool bErr = sal_True ) { bError = bErr; }
      69           0 :     sal_Bool GetError() { return bError; }
      70             : };
      71             : 
      72             : 
      73             : /// Export strings from *.xrm and description.xml files
      74             : class XRMResExport : public XRMResParser
      75             : {
      76             : private:
      77             :     ResData *pResData;
      78             :     OString sPath;
      79             :     PoOfstream pOutputStream;
      80             : protected:
      81             :     void WorkOnDesc(
      82             :         const OString &rOpenTag,
      83             :         OString &rText
      84             :     );
      85             :     void WorkOnText(
      86             :         const OString &rOpenTag,
      87             :         OString &rText
      88             :     );
      89             :     void EndOfText(
      90             :         const OString &rOpenTag,
      91             :         const OString &rCloseTag
      92             :     );
      93             :     void Output( const OString& rOutput );
      94             : 
      95             : public:
      96             :     XRMResExport(
      97             :         const OString &rOutputFile,
      98             :         const OString &rFilePath
      99             :     );
     100             :     virtual ~XRMResExport();
     101             : };
     102             : 
     103             : 
     104             : /// Merge strings to *.xrm and description.xml files
     105             : class XRMResMerge : public XRMResParser
     106             : {
     107             : private:
     108             :     MergeDataFile *pMergeDataFile;
     109             :     OString sFilename;
     110             :     ResData *pResData;
     111             :     std::ofstream pOutputStream;
     112             :     std::vector<OString> aLanguages;
     113             : 
     114             : protected:
     115             :     void WorkOnDesc(
     116             :         const OString &rOpenTag,
     117             :         OString &rText
     118             :     );
     119             :     void WorkOnText(
     120             :         const OString &rOpenTag,
     121             :         OString &rText
     122             :     );
     123             :     void EndOfText(
     124             :         const OString &rOpenTag,
     125             :         const OString &rCloseTag
     126             :     );
     127             :     void Output( const OString& rOutput );
     128             : public:
     129             :     XRMResMerge(
     130             :         const OString &rMergeSource,
     131             :         const OString &rOutputFile,
     132             :         const OString &rFilename
     133             :     );
     134             :     virtual ~XRMResMerge();
     135             : };
     136             : 
     137             : #endif // XRMMERGE_INCLUDED
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10