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