LCOV - code coverage report
Current view: top level - libreoffice/rsc/inc - rscerror.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 21 100.0 %
Date: 2012-12-27 Functions: 14 14 100.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             : #ifndef _RSCERROR_H
      20             : #define _RSCERROR_H
      21             : 
      22             : #ifndef _TOOLS_SOLAR_H
      23             : #include <tools/solar.h>
      24             : #endif
      25             : 
      26             : /****************** D E F I N I T I O N S ********************************/
      27             : /******************* R e t u r n   E r r o r s         *******************/
      28             : #define ERR_OK              0xFFFFFFFF
      29             : 
      30             : #define ERR_ERROR           0x0100
      31             : #define ERR_UNKNOWN_METHOD  0x0101  // Return
      32             : #define ERR_OPENFILE        0x0102  // Return
      33             : #define ERR_NOCHAR          0x0103  // Return
      34             : #define ERR_NORSCINST       0x0104  // Return
      35             : #define ERR_USAGE           0x0105  //
      36             : #define ERR_NOINPUT         0x0106  // Return
      37             : #define ERR_UNKNOWNSW       0x0107  //
      38             : #define ERR_REFTODEEP       0x0108  // Return
      39             : #define ERR_FILEFORMAT      0x0109  // Return
      40             : #define ERR_FILESIZE        0x010A  // Return
      41             : #define ERR_RENAMEFILE      0x010B  // Return
      42             : #define ERR_NOIMAGE         0x010C  // Return
      43             : 
      44             : #define ERR_RSCRANGE        0x0200  // Return
      45             : #define ERR_RSCRANGE_OUTDEFSET  (ERR_RSCRANGE +1 )
      46             : 
      47             : #define ERR_RSCENUM         0x0210  // Return
      48             : #define ERR_RSCFLAG         0x0220  // Return
      49             : #define ERR_RSCCONT         0x0240  // Return
      50             : #define ERR_CONT_INVALIDPOS     (ERR_RSCCONT +1 ) // Return
      51             : #define ERR_CONT_INVALIDTYPE    (ERR_RSCCONT +2 ) // Return
      52             : 
      53             : #define ERR_RSCCMPED        0x0250
      54             : #define ERR_RSCINST         0x0260
      55             : #define ERR_RSCINST_NOVARNAME   (ERR_RSCINST +1 ) // Return
      56             : #define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 ) // Return
      57             : 
      58             : #define ERR_LEX             0x0270
      59             : #define ERR_YACC            0x0280  //
      60             : #define ERR_DOUBLEID            (ERR_YACC    +1 ) //
      61             : #define ERR_FALSETYPE           (ERR_YACC    +2 ) //
      62             : #define ERR_NOVARIABLENAME      (ERR_YACC    +3 ) //
      63             : #define ERR_USHORTRANGE         (ERR_YACC    +4 ) //
      64             : #define ERR_IDRANGE             (ERR_YACC    +5 ) //
      65             : #define ERR_NOCOPYOBJ           (ERR_YACC    +6 ) //
      66             : #define ERR_REFNOTALLOWED       (ERR_YACC    +7 ) // Return
      67             : #define ERR_DOUBLEDEFINE        (ERR_YACC    +8 ) //
      68             : #define ERR_COPYNOTALLOWED      (ERR_YACC    +9 ) //
      69             : #define ERR_IDEXPECTED          (ERR_YACC    +10) //
      70             : #define ERR_ZERODIVISION        (ERR_YACC    +11) //
      71             : #define ERR_PRAGMA              (ERR_YACC    +12) //
      72             : #define ERR_DECLAREDEFINE       (ERR_YACC    +13) //
      73             : #define ERR_NOTUPELNAME         (ERR_YACC    +14) //
      74             : #define ERR_NOTYPE              (ERR_YACC    +15) //
      75             : 
      76             : #define ERR_RSCARRAY         0x02A0  // Return
      77             : #define ERR_ARRAY_INVALIDINDEX  (ERR_RSCARRAY +1 ) // Return
      78             : 
      79             : #define ERR_ERROREND                0x1000
      80             : 
      81             : #define ERR_WARNINGSTART        0x1001
      82             : #define WRN_LOCALID             (ERR_WARNINGSTART +1 )
      83             : #define WRN_GLOBALID            (ERR_WARNINGSTART +2 )
      84             : #define WRN_SUBINMEMBER         (ERR_WARNINGSTART +3 )
      85             : #define WRN_CONT_NOID           (ERR_WARNINGSTART +4 )
      86             : #define WRN_STR_REFNOTFOUND     (ERR_WARNINGSTART +5 )
      87             : #define WRN_MGR_REFNOTFOUND     (ERR_WARNINGSTART +6 )
      88             : #define WRN_CONT_DOUBLEID       (ERR_WARNINGSTART +7 )
      89             : 
      90             : #define ERR_WARNINGEND      0x2000
      91             : 
      92             : class ERRTYPE {
      93             :     sal_uInt32  nError;
      94             : public:
      95     1062017 :     ERRTYPE()                { nError = ERR_OK; }
      96     1565556 :     ERRTYPE( sal_uInt32 nErr )   { nError = nErr; }
      97      205769 :     ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; };
      98             :     ERRTYPE& operator = ( const ERRTYPE & rError );
      99        4235 :     operator  sal_uInt32() const { return( nError ); }
     100     3887754 :     sal_Bool IsError() const     { return( nError <= ERR_ERROREND ); }
     101     1037808 :     sal_Bool IsOk() const        { return( !IsError() ); }
     102     1364198 :     sal_Bool IsWarning() const   {
     103     1364198 :         return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND );
     104             :     };
     105       15541 :     void    Clear(){ nError = ERR_OK; }
     106             : };
     107             : 
     108             : /****************** R s c E r r o r **************************************/
     109             : class RscId;
     110             : class RscTop;
     111             : 
     112             : enum RscVerbosity
     113             : {
     114             :     RscVerbositySilent = 0,
     115             :     RscVerbosityNormal = 1,
     116             :     RscVerbosityVerbose = 2
     117             : };
     118             : 
     119             : class RscError
     120             : {
     121             :     FILE *  fListing;
     122             :     RscVerbosity m_verbosity;
     123             : 
     124             :     void WriteError( const ERRTYPE& rError, const char * pMessage );
     125             :     void StdLstOut( const char * pStr );
     126             :     void StdLstErr( const char * pStr );
     127             :     void ErrorFormat( const ERRTYPE& rError, RscTop * pClass,
     128             :                       const RscId & aId );
     129             : public:
     130        1382 :     virtual ~RscError() {}
     131             : 
     132             :     sal_uInt32  nErrors;// Anzahl der Fehler
     133         691 :                     RscError( RscVerbosity _verbosity ) {
     134         691 :                         fListing = NULL;
     135         691 :                         nErrors = 0;
     136         691 :                         m_verbosity = _verbosity;
     137         691 :                     };
     138         813 :     void            SetListFile( FILE * fList ){
     139         813 :                         fListing = fList;
     140         813 :                     };
     141      344022 :     FILE *          GetListFile(){
     142      344022 :                         return fListing;
     143             :                     };
     144         691 :     RscVerbosity    GetVerbosity() const { return m_verbosity; }
     145             :     virtual void    StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal );
     146             :     virtual void    StdErr( const char * );
     147             :     virtual void    LstOut( const char * );
     148             :     virtual void    Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId,
     149             :                            const char * pMessage = NULL );
     150             :     // Dieser Fehler sollte nur im Compilermodus auftreten,
     151             :     // das Programm wird mit exit() verlassen
     152             :     virtual void    FatalError( const ERRTYPE& rError, const RscId &aId,
     153             :                                 const char * pMessage = NULL );
     154             : };
     155             : 
     156             : #endif // _RSCERROR_H
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10