LCOV - code coverage report
Current view: top level - l10ntools/inc - gsicheck.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 19 0.0 %
Date: 2012-08-25 Functions: 0 19 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _GSICHECK_HXX_
      30                 :            : #define _GSICHECK_HXX_
      31                 :            : 
      32                 :            : #include "sal/config.h"
      33                 :            : 
      34                 :            : #include <cstddef>
      35                 :            : #include <vector>
      36                 :            : 
      37                 :            : #include "tagtest.hxx"
      38                 :            : 
      39                 :            : //
      40                 :            : // class GSILine
      41                 :            : //
      42                 :            : enum LineFormat { FORMAT_SDF, FORMAT_UNKNOWN };
      43                 :            : 
      44                 :          0 : class GSILine
      45                 :            : {
      46                 :            : private:
      47                 :            :     ParserMessageList aMessages;
      48                 :            :     LineFormat aFormat;
      49                 :            :     std::size_t nLineNumber;
      50                 :            : 
      51                 :            :     rtl::OString aUniqId;
      52                 :            :     rtl::OString aLineType;
      53                 :            :     rtl::OString aLangId;
      54                 :            :     rtl::OString aText;
      55                 :            :     rtl::OString aQuickHelpText;
      56                 :            :     rtl::OString aTitle;
      57                 :            : 
      58                 :            :     sal_Bool bOK;
      59                 :            :     sal_Bool bFixed;
      60                 :            : 
      61                 :            :     void              ReassembleLine();
      62                 :            : 
      63                 :            : public:
      64                 :            :     rtl::OString data_;
      65                 :            : 
      66                 :            :     GSILine( const rtl::OString &rLine, std::size_t nLine );
      67                 :          0 :     LineFormat  GetLineFormat() const    { return aFormat; }
      68                 :          0 :     std::size_t GetLineNumber() const    { return nLineNumber; }
      69                 :            : 
      70                 :          0 :     rtl::OString  const GetUniqId()     const    { return aUniqId; }
      71                 :          0 :     rtl::OString  const GetLineType()   const    { return aLineType; }
      72                 :          0 :     rtl::OString  const GetLanguageId() const    { return aLangId; }
      73                 :          0 :     rtl::OString  const GetText()       const    { return aText; }
      74                 :          0 :     rtl::OUString  const GetUText()      const    { return rtl::OStringToOUString( aText, RTL_TEXTENCODING_UTF8 ); }
      75                 :          0 :     rtl::OString  const GetQuickHelpText() const { return aQuickHelpText; }
      76                 :          0 :     rtl::OString  const GetTitle()      const    { return aTitle; }
      77                 :            : 
      78                 :          0 :     void SetUText( rtl::OUString const &aNew ) { aText = rtl::OUStringToOString(aNew, RTL_TEXTENCODING_UTF8); ReassembleLine(); }
      79                 :          0 :     void        SetText( rtl::OString const &aNew ) { aText = aNew; ReassembleLine(); }
      80                 :          0 :     void        SetQuickHelpText( rtl::OString const &aNew ) { aQuickHelpText = aNew; ReassembleLine(); }
      81                 :          0 :     void        SetTitle( rtl::OString const &aNew ) { aTitle = aNew; ReassembleLine(); }
      82                 :            : 
      83                 :          0 :     ParserMessageList* GetMessageList() { return &aMessages; };
      84                 :          0 :     sal_Bool HasMessages(){ return ( aMessages.size() > 0 ); };
      85                 :            : 
      86                 :          0 :     sal_Bool IsOK() const { return bOK; }
      87                 :            :     void NotOK();
      88                 :            : 
      89                 :          0 :     sal_Bool IsFixed() const { return bFixed; }
      90                 :          0 :     void SetFixed() { bFixed = sal_True; };
      91                 :            : };
      92                 :            : 
      93                 :            : //
      94                 :            : // class GSIBlock
      95                 :            : //
      96                 :            : 
      97                 :            : typedef std::vector< GSILine* > GSIBlock_Impl;
      98                 :            : 
      99                 :            : class LazyStream;
     100                 :            : 
     101                 :            : class GSIBlock
     102                 :            : {
     103                 :            : private:
     104                 :            :     GSIBlock_Impl maList;
     105                 :            :     GSILine *pSourceLine;
     106                 :            :     GSILine *pReferenceLine;
     107                 :            :     void PrintList( ParserMessageList *pList, rtl::OString const & aPrefix, GSILine *pLine );
     108                 :            :     sal_Bool bPrintContext;
     109                 :            :     sal_Bool bCheckSourceLang;
     110                 :            :     sal_Bool bCheckTranslationLang;
     111                 :            :     sal_Bool bReference;
     112                 :            :     sal_Bool bAllowSuspicious;
     113                 :            : 
     114                 :            :     sal_Bool bHasBlockError;
     115                 :            : 
     116                 :            :     sal_Bool IsUTF8( const rtl::OString &aTestee, sal_Bool bFixTags, sal_Int32 &nErrorPos, rtl::OString &aErrorMsg, sal_Bool &bHasBeenFixed, rtl::OString &aFixed ) const;
     117                 :            :     sal_Bool TestUTF8( GSILine* pTestee, sal_Bool bFixTags );
     118                 :            :     sal_Bool HasSuspiciousChars( GSILine* pTestee, GSILine* pSource );
     119                 :            : 
     120                 :            : public:
     121                 :            :     GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowSusp );
     122                 :            :     ~GSIBlock();
     123                 :            :     void PrintMessage( rtl::OString const & aType, rtl::OString const & aMsg, rtl::OString const & aPrefix, rtl::OString const & aContext, std::size_t nLine, rtl::OString const & aUniqueId = rtl::OString() );
     124                 :            :     void PrintError( rtl::OString const & aMsg, rtl::OString const & aPrefix, rtl::OString const & aContext, std::size_t nLine, rtl::OString const & aUniqueId = rtl::OString() );
     125                 :            :     void InsertLine( GSILine* pLine, const rtl::OString &rSourceLang);
     126                 :            :     void SetReferenceLine( GSILine* pLine );
     127                 :            :     sal_Bool CheckSyntax( std::size_t nLine, sal_Bool bRequireSourceLine, sal_Bool bFixTags );
     128                 :            : 
     129                 :            :     void WriteError( LazyStream &aErrOut, sal_Bool bRequireSourceLine );
     130                 :            :     void WriteCorrect( LazyStream &aOkOut, sal_Bool bRequireSourceLine );
     131                 :            :     void WriteFixed( LazyStream &aFixOut );
     132                 :            : };
     133                 :            : 
     134                 :            : #endif
     135                 :            : 
     136                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10