-rw-r--r-- | lib/expat.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/expat.cc b/lib/expat.cc index fa6fdde..c4dab7e 100644 --- a/lib/expat.cc +++ b/lib/expat.cc | |||
@@ -1,96 +1,97 @@ | |||
1 | #include <opkele/expat.h> | 1 | #include <opkele/expat.h> |
2 | 2 | ||
3 | namespace opkele { | 3 | namespace opkele { |
4 | 4 | ||
5 | namespace util { | 5 | namespace util { |
6 | 6 | ||
7 | expat_t::~expat_t() throw() { | 7 | expat_t::~expat_t() throw() { |
8 | if(_x) | 8 | if(_x) |
9 | XML_ParserFree(_x); | 9 | XML_ParserFree(_x); |
10 | } | 10 | } |
11 | 11 | ||
12 | expat_t& expat_t::operator=(XML_Parser x) { | 12 | expat_t& expat_t::operator=(XML_Parser x) { |
13 | if(_x) | 13 | if(_x) |
14 | XML_ParserFree(_x); | 14 | XML_ParserFree(_x); |
15 | _x = x; | 15 | _x = x; |
16 | return *this; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | static void _start_element(void* ud,const XML_Char *n,const XML_Char **a) { | 19 | static void _start_element(void* ud,const XML_Char *n,const XML_Char **a) { |
19 | ((expat_t*)ud)->start_element(n,a); | 20 | ((expat_t*)ud)->start_element(n,a); |
20 | } | 21 | } |
21 | static void _end_element(void *ud,const XML_Char *n) { | 22 | static void _end_element(void *ud,const XML_Char *n) { |
22 | ((expat_t*)ud)->end_element(n); | 23 | ((expat_t*)ud)->end_element(n); |
23 | } | 24 | } |
24 | 25 | ||
25 | void expat_t::set_element_handler() { | 26 | void expat_t::set_element_handler() { |
26 | assert(_x); | 27 | assert(_x); |
27 | XML_SetElementHandler(_x,_start_element,_end_element); | 28 | XML_SetElementHandler(_x,_start_element,_end_element); |
28 | } | 29 | } |
29 | 30 | ||
30 | static void _character_data(void *ud,const XML_Char *s,int l) { | 31 | static void _character_data(void *ud,const XML_Char *s,int l) { |
31 | ((expat_t*)ud)->character_data(s,l); | 32 | ((expat_t*)ud)->character_data(s,l); |
32 | } | 33 | } |
33 | 34 | ||
34 | void expat_t::set_character_data_handler() { | 35 | void expat_t::set_character_data_handler() { |
35 | assert(_x); | 36 | assert(_x); |
36 | XML_SetCharacterDataHandler(_x,_character_data); | 37 | XML_SetCharacterDataHandler(_x,_character_data); |
37 | } | 38 | } |
38 | 39 | ||
39 | static void _processing_instruction(void *ud,const XML_Char *t,const XML_Char *d) { | 40 | static void _processing_instruction(void *ud,const XML_Char *t,const XML_Char *d) { |
40 | ((expat_t*)ud)->processing_instruction(t,d); | 41 | ((expat_t*)ud)->processing_instruction(t,d); |
41 | } | 42 | } |
42 | 43 | ||
43 | void expat_t::set_processing_instruction_handler() { | 44 | void expat_t::set_processing_instruction_handler() { |
44 | assert(_x); | 45 | assert(_x); |
45 | XML_SetProcessingInstructionHandler(_x,_processing_instruction); | 46 | XML_SetProcessingInstructionHandler(_x,_processing_instruction); |
46 | } | 47 | } |
47 | 48 | ||
48 | static void _comment(void *ud,const XML_Char *d) { | 49 | static void _comment(void *ud,const XML_Char *d) { |
49 | ((expat_t*)ud)->comment(d); | 50 | ((expat_t*)ud)->comment(d); |
50 | } | 51 | } |
51 | 52 | ||
52 | void expat_t::set_comment_handler() { | 53 | void expat_t::set_comment_handler() { |
53 | assert(_x); | 54 | assert(_x); |
54 | XML_SetCommentHandler(_x,_comment); | 55 | XML_SetCommentHandler(_x,_comment); |
55 | } | 56 | } |
56 | 57 | ||
57 | static void _start_cdata_section(void *ud) { | 58 | static void _start_cdata_section(void *ud) { |
58 | ((expat_t*)ud)->start_cdata_section(); | 59 | ((expat_t*)ud)->start_cdata_section(); |
59 | } | 60 | } |
60 | static void _end_cdata_section(void *ud) { | 61 | static void _end_cdata_section(void *ud) { |
61 | ((expat_t*)ud)->end_cdata_section(); | 62 | ((expat_t*)ud)->end_cdata_section(); |
62 | } | 63 | } |
63 | 64 | ||
64 | void expat_t::set_cdata_section_handler() { | 65 | void expat_t::set_cdata_section_handler() { |
65 | assert(_x); | 66 | assert(_x); |
66 | XML_SetCdataSectionHandler(_x,_start_cdata_section,_end_cdata_section); | 67 | XML_SetCdataSectionHandler(_x,_start_cdata_section,_end_cdata_section); |
67 | } | 68 | } |
68 | 69 | ||
69 | static void _default_handler(void *ud,const XML_Char *s,int l) { | 70 | static void _default_handler(void *ud,const XML_Char *s,int l) { |
70 | ((expat_t*)ud)->default_handler(s,l); | 71 | ((expat_t*)ud)->default_handler(s,l); |
71 | } | 72 | } |
72 | 73 | ||
73 | void expat_t::set_default_handler() { | 74 | void expat_t::set_default_handler() { |
74 | assert(_x); | 75 | assert(_x); |
75 | XML_SetDefaultHandler(_x,_default_handler); | 76 | XML_SetDefaultHandler(_x,_default_handler); |
76 | } | 77 | } |
77 | void expat_t::set_default_handler_expand() { | 78 | void expat_t::set_default_handler_expand() { |
78 | assert(_x); | 79 | assert(_x); |
79 | XML_SetDefaultHandlerExpand(_x,_default_handler); | 80 | XML_SetDefaultHandlerExpand(_x,_default_handler); |
80 | } | 81 | } |
81 | 82 | ||
82 | static void _start_namespace_decl(void *ud,const XML_Char *p,const XML_Char *u) { | 83 | static void _start_namespace_decl(void *ud,const XML_Char *p,const XML_Char *u) { |
83 | ((expat_t*)ud)->start_namespace_decl(p,u); | 84 | ((expat_t*)ud)->start_namespace_decl(p,u); |
84 | } | 85 | } |
85 | static void _end_namespace_decl(void *ud,const XML_Char *p) { | 86 | static void _end_namespace_decl(void *ud,const XML_Char *p) { |
86 | ((expat_t*)ud)->end_namespace_decl(p); | 87 | ((expat_t*)ud)->end_namespace_decl(p); |
87 | } | 88 | } |
88 | 89 | ||
89 | void expat_t::set_namespace_decl_handler() { | 90 | void expat_t::set_namespace_decl_handler() { |
90 | assert(_x); | 91 | assert(_x); |
91 | XML_SetNamespaceDeclHandler(_x,_start_namespace_decl,_end_namespace_decl); | 92 | XML_SetNamespaceDeclHandler(_x,_start_namespace_decl,_end_namespace_decl); |
92 | } | 93 | } |
93 | 94 | ||
94 | } | 95 | } |
95 | 96 | ||
96 | } | 97 | } |