2 * error.cpp: ErrorEventArgs and its subclasses
5 * Moonlight List (moonlight-list@lists.ximian.com)
7 * Copyright 2007 Novell, Inc. (http://www.novell.com)
9 * See the LICENSE file included with the distribution for details.
18 ErrorEventArgs::ErrorEventArgs (Type::Kind kind
, ErrorType type
, int code
, const char *msg
)
23 error_message
= g_strdup (msg
);
24 extended_message
= NULL
;
28 ErrorEventArgs::ErrorEventArgs (ErrorType type
, int code
, const char *msg
)
29 : EventArgs (Type::ERROREVENTARGS
)
33 error_message
= g_strdup (msg
);
34 extended_message
= NULL
;
38 ErrorEventArgs::ErrorEventArgs (ErrorType type
, int code
, const char *msg
, int extended_error_code
, const char *extended_msg
)
39 : EventArgs (Type::ERROREVENTARGS
)
43 error_message
= g_strdup (msg
);
44 extended_message
= g_strdup (extended_msg
);
45 extended_code
= extended_error_code
;
48 ErrorEventArgs::~ErrorEventArgs ()
50 g_free (error_message
);
51 g_free (extended_message
);
56 // ImageErrorEventArgs
59 ImageErrorEventArgs::ImageErrorEventArgs (const char *msg
)
60 : ErrorEventArgs (Type::IMAGEERROREVENTARGS
, ImageError
, 4001, msg
)
64 ImageErrorEventArgs::~ImageErrorEventArgs ()
70 // ParserErrorEventArgs
73 ParserErrorEventArgs::ParserErrorEventArgs (const char *msg
, const char *file
,
74 int line
, int column
, int error_code
,
75 const char *element
, const char *attribute
)
76 : ErrorEventArgs (Type::PARSERERROREVENTARGS
, ParserError
, error_code
, msg
)
78 xml_attribute
= g_strdup (attribute
);
79 xml_element
= g_strdup (element
);
80 xaml_file
= g_strdup (file
);
81 char_position
= column
;
85 ParserErrorEventArgs::~ParserErrorEventArgs ()
89 g_free (xml_attribute
);
96 MoonError::MoonError ()
98 number
= (ErrorType
) 0;
106 MoonError::~MoonError ()
122 MoonError::FillIn (MoonError
*error
, ErrorType number
, int code
, char *message
)
127 error
->number
= number
;
129 error
->message
= message
;
133 MoonError::FillIn (MoonError
*error
, ErrorType number
, int code
, const char *message
)
138 FillIn (error
, number
, code
, g_strdup (message
));
142 MoonError::FillIn (MoonError
*error
, ErrorType type
, char *message
)
147 FillIn (error
, type
, 0, message
);
151 MoonError::FillIn (MoonError
*error
, ErrorType type
, const char *message
)
156 FillIn (error
, type
, 0, message
);
161 MoonError::SetXamlPositionInfo (MoonError
*error
, int char_position
, int line_number
)
165 error
->char_position
= char_position
;
166 error
->line_number
= line_number
;