source: dev/trunk/jenga/include/smoothie/SmoothieException.h@ 300

Last change on this file since 300 was 186, checked in by dai_9181, 17 years ago
File size: 1.4 KB
Line 
1#pragma once
2
3#include <string>
4#include <vector>
5
6void SetError(int ErrorNum,const std::string &keyWord,int pos);
7void SetError(int num,const char *KeyWord,int pos);
8void SetError();
9
10class SmoothieException
11{
12 int errorCode;
13 std::string keyword;
14 int nowLine;
15 static void Throwing()
16 {
17 //ここでブレークポイント
18 int dummy=0;
19 }
20public:
21 static void Throw( int errorCode, const std::string &keyword, int nowLine )
22 {
23 Throwing();
24 SetError( errorCode, keyword, nowLine );
25 }
26 static void Throw( int errorCode, const std::string &keyword )
27 {
28 Throwing();
29 SetError( errorCode, keyword,-1 );
30 }
31 static void Throw( int errorCode )
32 {
33 Throwing();
34 SetError( errorCode,"",-1 );
35 }
36 static void Throw()
37 {
38 Throwing();
39 SetError();
40 }
41
42 SmoothieException( int errorCode, const std::string &keyword, int nowLine )
43 : errorCode( errorCode )
44 , keyword( keyword )
45 , nowLine( nowLine )
46 {
47 }
48 SmoothieException( int errorCode, const std::string &keyword )
49 : errorCode( errorCode )
50 , keyword( keyword )
51 , nowLine( -1 )
52 {
53 }
54 SmoothieException( int errorCode )
55 : errorCode( errorCode )
56 , keyword( "" )
57 , nowLine( -1 )
58 {
59 }
60 SmoothieException()
61 : errorCode( 300 )
62 , keyword( "" )
63 , nowLine( -1 )
64 {
65 }
66
67 int GetErrorCode() const
68 {
69 return errorCode;
70 }
71 const std::string &GetKeyword() const
72 {
73 return keyword;
74 }
75 int GetNowLine() const
76 {
77 return nowLine;
78 }
79};
Note: See TracBrowser for help on using the repository browser.