CWS-TOOLING: integrate CWS os146
[LibreOffice.git] / rsc / inc / rscerror.h
blob41f012040a0cccc7b19e8e2e123f27e9ad85bf3b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _RSCERROR_H
28 #define _RSCERROR_H
30 #ifndef _TOOLS_SOLAR_H
31 #include <tools/solar.h>
32 #endif
34 /****************** D E F I N I T I O N S ********************************/
35 /******************* R e t u r n E r r o r s *******************/
36 #define ERR_OK 0xFFFFFFFF
38 #define ERR_ERROR 0x0100
39 #define ERR_UNKNOWN_METHOD 0x0101 // Return
40 #define ERR_OPENFILE 0x0102 // Return
41 #define ERR_NOCHAR 0x0103 // Return
42 #define ERR_NORSCINST 0x0104 // Return
43 #define ERR_USAGE 0x0105 //
44 #define ERR_NOINPUT 0x0106 // Return
45 #define ERR_UNKNOWNSW 0x0107 //
46 #define ERR_REFTODEEP 0x0108 // Return
47 #define ERR_FILEFORMAT 0x0109 // Return
48 #define ERR_FILESIZE 0x010A // Return
49 #define ERR_RENAMEFILE 0x010B // Return
50 #define ERR_NOIMAGE 0x010C // Return
52 #define ERR_RSCRANGE 0x0200 // Return
53 #define ERR_RSCRANGE_OUTDEFSET (ERR_RSCRANGE +1 )
55 #define ERR_RSCENUM 0x0210 // Return
56 #define ERR_RSCFLAG 0x0220 // Return
57 #define ERR_RSCCONT 0x0240 // Return
58 #define ERR_CONT_INVALIDPOS (ERR_RSCCONT +1 ) // Return
59 #define ERR_CONT_INVALIDTYPE (ERR_RSCCONT +2 ) // Return
61 #define ERR_RSCCMPED 0x0250
62 #define ERR_RSCINST 0x0260
63 #define ERR_RSCINST_NOVARNAME (ERR_RSCINST +1 ) // Return
64 #define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 ) // Return
66 #define ERR_LEX 0x0270
67 #define ERR_YACC 0x0280 //
68 #define ERR_DOUBLEID (ERR_YACC +1 ) //
69 #define ERR_FALSETYPE (ERR_YACC +2 ) //
70 #define ERR_NOVARIABLENAME (ERR_YACC +3 ) //
71 #define ERR_USHORTRANGE (ERR_YACC +4 ) //
72 #define ERR_IDRANGE (ERR_YACC +5 ) //
73 #define ERR_NOCOPYOBJ (ERR_YACC +6 ) //
74 #define ERR_REFNOTALLOWED (ERR_YACC +7 ) // Return
75 #define ERR_DOUBLEDEFINE (ERR_YACC +8 ) //
76 #define ERR_COPYNOTALLOWED (ERR_YACC +9 ) //
77 #define ERR_IDEXPECTED (ERR_YACC +10) //
78 #define ERR_ZERODIVISION (ERR_YACC +11) //
79 #define ERR_PRAGMA (ERR_YACC +12) //
80 #define ERR_DECLAREDEFINE (ERR_YACC +13) //
81 #define ERR_NOTUPELNAME (ERR_YACC +14) //
82 #define ERR_NOTYPE (ERR_YACC +15) //
84 #define ERR_RSCARRAY 0x02A0 // Return
85 #define ERR_ARRAY_INVALIDINDEX (ERR_RSCARRAY +1 ) // Return
87 #define ERR_ERROREND 0x1000
89 #define ERR_WARNINGSTART 0x1001
90 #define WRN_LOCALID (ERR_WARNINGSTART +1 )
91 #define WRN_GLOBALID (ERR_WARNINGSTART +2 )
92 #define WRN_SUBINMEMBER (ERR_WARNINGSTART +3 )
93 #define WRN_CONT_NOID (ERR_WARNINGSTART +4 )
94 #define WRN_STR_REFNOTFOUND (ERR_WARNINGSTART +5 )
95 #define WRN_MGR_REFNOTFOUND (ERR_WARNINGSTART +6 )
96 #define WRN_CONT_DOUBLEID (ERR_WARNINGSTART +7 )
98 #define ERR_WARNINGEND 0x2000
100 class ERRTYPE {
101 sal_uInt32 nError;
102 public:
103 ERRTYPE() { nError = ERR_OK; }
104 ERRTYPE( sal_uInt32 nErr ) { nError = nErr; }
105 ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; };
106 ERRTYPE& operator = ( const ERRTYPE & rError );
107 operator sal_uInt32() const { return( nError ); }
108 sal_Bool IsError() const { return( nError <= ERR_ERROREND ); }
109 sal_Bool IsOk() const { return( !IsError() ); }
110 sal_Bool IsWarning() const {
111 return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND );
113 void Clear(){ nError = ERR_OK; }
116 /****************** R s c E r r o r **************************************/
117 class RscId;
118 class RscTop;
120 enum RscVerbosity
122 RscVerbositySilent = 0,
123 RscVerbosityNormal = 1,
124 RscVerbosityVerbose = 2
127 class RscError
129 FILE * fListing;
130 RscVerbosity m_verbosity;
132 void WriteError( const ERRTYPE& rError, const char * pMessage );
133 void StdLstOut( const char * pStr );
134 void StdLstErr( const char * pStr );
135 void ErrorFormat( const ERRTYPE& rError, RscTop * pClass,
136 const RscId & aId );
137 public:
138 sal_uInt32 nErrors;// Anzahl der Fehler
139 RscError( RscVerbosity _verbosity ) {
140 fListing = NULL;
141 nErrors = 0;
142 m_verbosity = _verbosity;
144 void SetListFile( FILE * fList ){
145 fListing = fList;
147 FILE * GetListFile(){
148 return fListing;
150 RscVerbosity GetVerbosity() const { return m_verbosity; }
151 virtual void StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal );
152 virtual void StdErr( const char * );
153 virtual void LstOut( const char * );
154 virtual void Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId,
155 const char * pMessage = NULL );
156 // Dieser Fehler sollte nur im Compilermodus auftreten,
157 // das Programm wird mit exit() verlassen
158 virtual void FatalError( const ERRTYPE& rError, const RscId &aId,
159 const char * pMessage = NULL );
162 #endif // _RSCERROR_H