summaryrefslogtreecommitdiffabout
path: root/include/opkele
Unidiff
Diffstat (limited to 'include/opkele') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/expat.h2
-rw-r--r--include/opkele/tidy.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/opkele/expat.h b/include/opkele/expat.h
index 21be003..c154785 100644
--- a/include/opkele/expat.h
+++ b/include/opkele/expat.h
@@ -1,85 +1,85 @@
1#ifndef __OPKELE_EXPAT_H 1#ifndef __OPKELE_EXPAT_H
2#define __OPKELE_EXPAT_H 2#define __OPKELE_EXPAT_H
3 3
4#include <cassert> 4#include <cassert>
5#include <expat.h> 5#include <expat.h>
6 6
7namespace opkele { 7namespace opkele {
8 8
9 namespace util { 9 namespace util {
10 10
11 class expat_t { 11 class expat_t {
12 public: 12 public:
13 XML_Parser _x; 13 XML_Parser _x;
14 14
15 expat_t() : _x(0) { } 15 expat_t() : _x(0) { }
16 expat_t(XML_Parser x) : _x(x) { } 16 expat_t(XML_Parser x) : _x(x) { }
17 virtual ~expat_t() throw(); 17 virtual ~expat_t() throw();
18 18
19 expat_t& operator=(XML_Parser x); 19 expat_t& operator=(XML_Parser x);
20 20
21 operator const XML_Parser(void) const { return _x; } 21 operator XML_Parser(void) const { return _x; }
22 operator XML_Parser(void) { return _x; } 22 operator XML_Parser(void) { return _x; }
23 23
24 inline bool parse(const char *s,int len,bool final=false) { 24 inline bool parse(const char *s,int len,bool final=false) {
25 assert(_x); 25 assert(_x);
26 return XML_Parse(_x,s,len,final); 26 return XML_Parse(_x,s,len,final);
27 } 27 }
28 28
29 virtual int unknown_encoding(const XML_Char * /* n */,XML_Encoding * /* i */) { return XML_STATUS_ERROR; } 29 virtual int unknown_encoding(const XML_Char * /* n */,XML_Encoding * /* i */) { return XML_STATUS_ERROR; }
30 void set_unknown_encoding_handler(); 30 void set_unknown_encoding_handler();
31 31
32 virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { } 32 virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { }
33 virtual void end_element(const XML_Char * /* n */) { } 33 virtual void end_element(const XML_Char * /* n */) { }
34 void set_element_handler(); 34 void set_element_handler();
35 35
36 virtual void character_data(const XML_Char * /* s */,int /* l */) { } 36 virtual void character_data(const XML_Char * /* s */,int /* l */) { }
37 void set_character_data_handler(); 37 void set_character_data_handler();
38 38
39 virtual void processing_instruction(const XML_Char * /* t */,const XML_Char * /* d */) { } 39 virtual void processing_instruction(const XML_Char * /* t */,const XML_Char * /* d */) { }
40 void set_processing_instruction_handler(); 40 void set_processing_instruction_handler();
41 41
42 virtual void comment(const XML_Char * /* d */) { } 42 virtual void comment(const XML_Char * /* d */) { }
43 void set_comment_handler(); 43 void set_comment_handler();
44 44
45 virtual void start_cdata_section() { } 45 virtual void start_cdata_section() { }
46 virtual void end_cdata_section() { } 46 virtual void end_cdata_section() { }
47 void set_cdata_section_handler(); 47 void set_cdata_section_handler();
48 48
49 virtual void default_handler(const XML_Char * /* s */,int /* l */) { } 49 virtual void default_handler(const XML_Char * /* s */,int /* l */) { }
50 void set_default_handler(); 50 void set_default_handler();
51 void set_default_handler_expand(); 51 void set_default_handler_expand();
52 52
53 virtual void start_namespace_decl(const XML_Char * /* p */,const XML_Char * /* u */) { } 53 virtual void start_namespace_decl(const XML_Char * /* p */,const XML_Char * /* u */) { }
54 virtual void end_namespace_decl(const XML_Char * /* p */) { } 54 virtual void end_namespace_decl(const XML_Char * /* p */) { }
55 void set_namespace_decl_handler(); 55 void set_namespace_decl_handler();
56 56
57 inline enum XML_Error get_error_code() { 57 inline enum XML_Error get_error_code() {
58 assert(_x); return XML_GetErrorCode(_x); } 58 assert(_x); return XML_GetErrorCode(_x); }
59 static inline const XML_LChar *error_string(XML_Error c) { 59 static inline const XML_LChar *error_string(XML_Error c) {
60 return XML_ErrorString(c); } 60 return XML_ErrorString(c); }
61 61
62 inline long get_current_byte_index() { 62 inline long get_current_byte_index() {
63 assert(_x); return XML_GetCurrentByteIndex(_x); } 63 assert(_x); return XML_GetCurrentByteIndex(_x); }
64 inline int get_current_line_number() { 64 inline int get_current_line_number() {
65 assert(_x); return XML_GetCurrentLineNumber(_x); } 65 assert(_x); return XML_GetCurrentLineNumber(_x); }
66 inline int get_current_column_number() { 66 inline int get_current_column_number() {
67 assert(_x); return XML_GetCurrentColumnNumber(_x); } 67 assert(_x); return XML_GetCurrentColumnNumber(_x); }
68 68
69 inline void set_user_data() { 69 inline void set_user_data() {
70 assert(_x); XML_SetUserData(_x,this); } 70 assert(_x); XML_SetUserData(_x,this); }
71 71
72 inline bool set_base(const XML_Char *b) { 72 inline bool set_base(const XML_Char *b) {
73 assert(_x); return XML_SetBase(_x,b); } 73 assert(_x); return XML_SetBase(_x,b); }
74 inline const XML_Char *get_base() { 74 inline const XML_Char *get_base() {
75 assert(_x); return XML_GetBase(_x); } 75 assert(_x); return XML_GetBase(_x); }
76 76
77 inline int get_specified_attribute_count() { 77 inline int get_specified_attribute_count() {
78 assert(_x); return XML_GetSpecifiedAttributeCount(_x); } 78 assert(_x); return XML_GetSpecifiedAttributeCount(_x); }
79 79
80 inline bool set_param_entity_parsing(enum XML_ParamEntityParsing c) { 80 inline bool set_param_entity_parsing(enum XML_ParamEntityParsing c) {
81 assert(_x); return XML_SetParamEntityParsing(_x,c); } 81 assert(_x); return XML_SetParamEntityParsing(_x,c); }
82 82
83 inline static XML_Parser parser_create(const XML_Char *e=0) { 83 inline static XML_Parser parser_create(const XML_Char *e=0) {
84 return XML_ParserCreate(e); } 84 return XML_ParserCreate(e); }
85 inline static XML_Parser parser_create_ns(const XML_Char *e=0,XML_Char s='\t') { 85 inline static XML_Parser parser_create_ns(const XML_Char *e=0,XML_Char s='\t') {
diff --git a/include/opkele/tidy.h b/include/opkele/tidy.h
index 059656d..039d13a 100644
--- a/include/opkele/tidy.h
+++ b/include/opkele/tidy.h
@@ -1,80 +1,80 @@
1#ifndef __OPKELE_TIDY_H 1#ifndef __OPKELE_TIDY_H
2#define __OPKELE_TIDY_H 2#define __OPKELE_TIDY_H
3 3
4#include <cassert> 4#include <cassert>
5#ifdef HAVE_TIDY_H 5#ifdef HAVE_TIDY_H
6# include <tidy.h> 6# include <tidy.h>
7# include <buffio.h> 7# include <buffio.h>
8#elif HAVE_TIDY_TIDY_H 8#elif HAVE_TIDY_TIDY_H
9# include <tidy/tidy.h> 9# include <tidy/tidy.h>
10# include <tidy/buffio.h> 10# include <tidy/buffio.h>
11#else 11#else
12# error "Don't know where to look for htmltidy headers" 12# error "Don't know where to look for htmltidy headers"
13#endif 13#endif
14 14
15namespace opkele { 15namespace opkele {
16 namespace util { 16 namespace util {
17 17
18 class tidy_buf_t { 18 class tidy_buf_t {
19 public: 19 public:
20 TidyBuffer _x; 20 TidyBuffer _x;
21 21
22 tidy_buf_t() { tidyBufInit(&_x); } 22 tidy_buf_t() { tidyBufInit(&_x); }
23 virtual ~tidy_buf_t() throw() { 23 virtual ~tidy_buf_t() throw() {
24 tidyBufFree(&_x); } 24 tidyBufFree(&_x); }
25 25
26 inline operator const TidyBuffer&(void) const { return _x; } 26 inline operator const TidyBuffer&(void) const { return _x; }
27 inline operator TidyBuffer&(void) { return _x; } 27 inline operator TidyBuffer&(void) { return _x; }
28 28
29 inline operator const char*(void) const { return (const char*)_x.bp; } 29 inline operator const char*(void) const { return (const char*)_x.bp; }
30 inline operator char*(void) { return (char*)_x.bp; } 30 inline operator char*(void) { return (char*)_x.bp; }
31 31
32 inline const char *c_str() const { 32 inline const char *c_str() const {
33 return (const char*)_x.bp; } 33 return (const char*)_x.bp; }
34 inline size_t size() const { 34 inline size_t size() const {
35 return _x.size; } 35 return _x.size; }
36 }; 36 };
37 37
38 class tidy_doc_t { 38 class tidy_doc_t {
39 public: 39 public:
40 TidyDoc _x; 40 TidyDoc _x;
41 41
42 tidy_doc_t() : _x(0) { } 42 tidy_doc_t() : _x(0) { }
43 tidy_doc_t(TidyDoc x) : _x(x) { } 43 tidy_doc_t(TidyDoc x) : _x(x) { }
44 virtual ~tidy_doc_t() throw() { 44 virtual ~tidy_doc_t() throw() {
45 if(_x) tidyRelease(_x); } 45 if(_x) tidyRelease(_x); }
46 46
47 tidy_doc_t& operator=(TidyDoc x) { 47 tidy_doc_t& operator=(TidyDoc x) {
48 if(_x) tidyRelease(_x); 48 if(_x) tidyRelease(_x);
49 _x = x; 49 _x = x;
50 return *this; 50 return *this;
51 } 51 }
52 52
53 operator const TidyDoc(void) const { return _x; } 53 operator TidyDoc(void) const { return _x; }
54 operator TidyDoc(void) { return _x; } 54 operator TidyDoc(void) { return _x; }
55 55
56 inline bool opt_set(TidyOptionId o,bool v) { 56 inline bool opt_set(TidyOptionId o,bool v) {
57 assert(_x); 57 assert(_x);
58 return tidyOptSetBool(_x,o,v?yes:no); } 58 return tidyOptSetBool(_x,o,v?yes:no); }
59 inline bool opt_set(TidyOptionId o,int v) { 59 inline bool opt_set(TidyOptionId o,int v) {
60 assert(_x); 60 assert(_x);
61 return tidyOptSetInt(_x,o,v); } 61 return tidyOptSetInt(_x,o,v); }
62 62
63 inline int parse_string(const string& s) { 63 inline int parse_string(const string& s) {
64 assert(_x); 64 assert(_x);
65 return tidyParseString(_x,s.c_str()); } 65 return tidyParseString(_x,s.c_str()); }
66 inline int clean_and_repair() { 66 inline int clean_and_repair() {
67 assert(_x); 67 assert(_x);
68 return tidyCleanAndRepair(_x); } 68 return tidyCleanAndRepair(_x); }
69 inline int save_buffer(TidyBuffer& ob) { 69 inline int save_buffer(TidyBuffer& ob) {
70 assert(_x); 70 assert(_x);
71 return tidySaveBuffer(_x,&ob); } 71 return tidySaveBuffer(_x,&ob); }
72 72
73 static inline TidyDoc create() { 73 static inline TidyDoc create() {
74 return tidyCreate(); } 74 return tidyCreate(); }
75 }; 75 };
76 76
77 } 77 }
78} 78}
79 79
80#endif /* __OPKELE_TIDY_H */ 80#endif /* __OPKELE_TIDY_H */