1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include <precomp.h>
23 #include <x_parse.hxx>
24
25 // NOT FULLY DECLARED SERVICES
26
27
28
X_Parser(E_Event i_eEvent,const char * i_sObject,const String & i_sCausingFile_FullPath,uintt i_nCausingLineNr)29 X_Parser::X_Parser( E_Event i_eEvent,
30 const char * i_sObject,
31 const String & i_sCausingFile_FullPath,
32 uintt i_nCausingLineNr )
33 : eEvent(i_eEvent),
34 sObject(i_sObject),
35 sCausingFile_FullPath(i_sCausingFile_FullPath),
36 nCausingLineNr(i_nCausingLineNr)
37 {
38 }
39
~X_Parser()40 X_Parser::~X_Parser()
41 {
42 }
43
44 X_Parser::E_Event
GetEvent() const45 X_Parser::GetEvent() const
46 {
47 return eEvent;
48 }
49
50 void
GetInfo(std::ostream & o_rOutputMedium) const51 X_Parser::GetInfo( std::ostream & o_rOutputMedium ) const
52 {
53 o_rOutputMedium << "Error in file "
54 << sCausingFile_FullPath
55 << " in line "
56 << nCausingLineNr
57 << ": ";
58
59
60 switch (eEvent)
61 {
62 case x_InvalidChar:
63 o_rOutputMedium << "Unknown character '"
64 << sObject
65 << "'";
66 break;
67 case x_UnexpectedToken:
68 o_rOutputMedium << "Unexpected token \""
69 << sObject
70 << "\"";
71 break;
72 case x_UnexpectedEOF:
73 o_rOutputMedium << "Unexpected end of file.";
74 break;
75 case x_UnspecifiedSyntaxError:
76 o_rOutputMedium << "Unspecified syntax problem in file.";
77 break;
78 case x_Any:
79 default:
80 o_rOutputMedium << "Unspecified parsing exception.";
81 } // end switch
82 o_rOutputMedium << Endl();
83 }
84
85
86 std::ostream &
operator <<(std::ostream & o_rOut,const autodoc::X_Parser_Ifc & i_rException)87 operator<<( std::ostream & o_rOut,
88 const autodoc::X_Parser_Ifc & i_rException )
89 {
90 i_rException.GetInfo(o_rOut);
91 return o_rOut;
92 }
93