summaryrefslogtreecommitdiff
path: root/pjlib/include/pj++/scanner.hpp
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2005-11-11 19:01:31 +0000
committerBenny Prijono <bennylp@teluu.com>2005-11-11 19:01:31 +0000
commit0b9e388f7f10dac01d5134ed6c1b24695810874e (patch)
treef01b4f05e8d074a8dba14a96b93803fd6797c105 /pjlib/include/pj++/scanner.hpp
parent0bc0f9112ac6319d7ce8662de86d6c076bd4b1e3 (diff)
First clean compile of pjsip
git-svn-id: http://svn.pjsip.org/repos/pjproject/main@43 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj++/scanner.hpp')
-rw-r--r--pjlib/include/pj++/scanner.hpp344
1 files changed, 172 insertions, 172 deletions
diff --git a/pjlib/include/pj++/scanner.hpp b/pjlib/include/pj++/scanner.hpp
index 9ddac097..8a3d9897 100644
--- a/pjlib/include/pj++/scanner.hpp
+++ b/pjlib/include/pj++/scanner.hpp
@@ -1,173 +1,173 @@
/* $Id$
- *
- */
-#ifndef __PJPP_SCANNER_H__
-#define __PJPP_SCANNER_H__
-
-#include <pjlib-util/scanner.h>
-#include <pj++/string.hpp>
-
-class Pj_Char_Spec
-{
-public:
- Pj_Char_Spec() { pj_cs_init(cs__); }
-
- void set(int c) { pj_cs_set(cs__, c); }
- void add_range(int begin, int end) { pj_cs_add_range(cs__, begin, end); }
- void add_alpha() { pj_cs_add_alpha(cs__); }
- void add_num() { pj_cs_add_num(cs__); }
- void add_str(const char *str) { pj_cs_add_str(cs__, str); }
- void del_range(int begin, int end) { pj_cs_del_range(cs__, begin, end); }
- void del_str(const char *str) { pj_cs_del_str(cs__, str); }
- void invert() { pj_cs_invert(cs__); }
- int match(int c) { return pj_cs_match(cs__, c); }
-
- pj_char_spec_element_t *cs_()
- {
- return cs__;
- }
-
- const pj_char_spec_element_t *cs_() const
- {
- return cs__;
- }
-
-private:
- pj_char_spec cs__;
-};
-
-class Pj_Scanner
-{
-public:
- Pj_Scanner() {}
-
- enum
- {
- SYNTAX_ERROR = 101
- };
- static void syntax_error_handler_throw_pj(pj_scanner *);
-
- typedef pj_scan_state State;
-
- void init(char *buf, int len, unsigned options=PJ_SCAN_AUTOSKIP_WS,
- pj_syn_err_func_ptr callback = &syntax_error_handler_throw_pj)
- {
- pj_scan_init(&scanner_, buf, len, options, callback);
- }
-
- void fini()
- {
- pj_scan_fini(&scanner_);
- }
-
- int eof() const
- {
- return pj_scan_is_eof(&scanner_);
- }
-
- int peek_char() const
- {
- return *scanner_.curptr;
- }
-
- int peek(const Pj_Char_Spec *cs, Pj_String *out)
- {
- return pj_scan_peek(&scanner_, cs->cs_(), out);
- }
-
- int peek_n(pj_size_t len, Pj_String *out)
- {
- return pj_scan_peek_n(&scanner_, len, out);
- }
-
- int peek_until(const Pj_Char_Spec *cs, Pj_String *out)
- {
- return pj_scan_peek_until(&scanner_, cs->cs_(), out);
- }
-
- void get(const Pj_Char_Spec *cs, Pj_String *out)
- {
- pj_scan_get(&scanner_, cs->cs_(), out);
- }
-
- void get_n(unsigned N, Pj_String *out)
- {
- pj_scan_get_n(&scanner_, N, out);
- }
-
- int get_char()
- {
- return pj_scan_get_char(&scanner_);
- }
-
- void get_quote(int begin_quote, int end_quote, Pj_String *out)
- {
- pj_scan_get_quote(&scanner_, begin_quote, end_quote, out);
- }
-
- void get_newline()
- {
- pj_scan_get_newline(&scanner_);
- }
-
- void get_until(const Pj_Char_Spec *cs, Pj_String *out)
- {
- pj_scan_get_until(&scanner_, cs->cs_(), out);
- }
-
- void get_until_ch(int until_ch, Pj_String *out)
- {
- pj_scan_get_until_ch(&scanner_, until_ch, out);
- }
-
- void get_until_chr(const char *spec, Pj_String *out)
- {
- pj_scan_get_until_chr(&scanner_, spec, out);
- }
-
- void advance_n(unsigned N, bool skip_ws=true)
- {
- pj_scan_advance_n(&scanner_, N, skip_ws);
- }
-
- int strcmp(const char *s, int len)
- {
- return pj_scan_strcmp(&scanner_, s, len);
- }
-
- int stricmp(const char *s, int len)
- {
- return pj_scan_stricmp(&scanner_, s, len);
- }
-
- void skip_ws()
- {
- pj_scan_skip_whitespace(&scanner_);
- }
-
- void save_state(State *state)
- {
- pj_scan_save_state(&scanner_, state);
- }
-
- void restore_state(State *state)
- {
- pj_scan_restore_state(&scanner_, state);
- }
-
- int get_pos_line() const
- {
- return scanner_.line;
- }
-
- int get_pos_col() const
- {
- return scanner_.col;
- }
-
-
-private:
- pj_scanner scanner_;
-};
-
-#endif /* __PJPP_SCANNER_H__ */
+ */
+#ifndef __PJPP_SCANNER_HPP__
+#define __PJPP_SCANNER_HPP__
+
+#include <pjlib-util/scanner.h>
+#include <pj++/string.hpp>
+
+class Pj_Char_Spec
+{
+public:
+ Pj_Char_Spec() { pj_cs_init(cs__); }
+
+ void set(int c) { pj_cs_set(cs__, c); }
+ void add_range(int begin, int end) { pj_cs_add_range(cs__, begin, end); }
+ void add_alpha() { pj_cs_add_alpha(cs__); }
+ void add_num() { pj_cs_add_num(cs__); }
+ void add_str(const char *str) { pj_cs_add_str(cs__, str); }
+ void del_range(int begin, int end) { pj_cs_del_range(cs__, begin, end); }
+ void del_str(const char *str) { pj_cs_del_str(cs__, str); }
+ void invert() { pj_cs_invert(cs__); }
+ int match(int c) { return pj_cs_match(cs__, c); }
+
+ pj_char_spec_element_t *cs_()
+ {
+ return cs__;
+ }
+
+ const pj_char_spec_element_t *cs_() const
+ {
+ return cs__;
+ }
+
+private:
+ pj_char_spec cs__;
+};
+
+class Pj_Scanner
+{
+public:
+ Pj_Scanner() {}
+
+ enum
+ {
+ SYNTAX_ERROR = 101
+ };
+ static void syntax_error_handler_throw_pj(pj_scanner *);
+
+ typedef pj_scan_state State;
+
+ void init(char *buf, int len, unsigned options=PJ_SCAN_AUTOSKIP_WS,
+ pj_syn_err_func_ptr callback = &syntax_error_handler_throw_pj)
+ {
+ pj_scan_init(&scanner_, buf, len, options, callback);
+ }
+
+ void fini()
+ {
+ pj_scan_fini(&scanner_);
+ }
+
+ int eof() const
+ {
+ return pj_scan_is_eof(&scanner_);
+ }
+
+ int peek_char() const
+ {
+ return *scanner_.curptr;
+ }
+
+ int peek(const Pj_Char_Spec *cs, Pj_String *out)
+ {
+ return pj_scan_peek(&scanner_, cs->cs_(), out);
+ }
+
+ int peek_n(pj_size_t len, Pj_String *out)
+ {
+ return pj_scan_peek_n(&scanner_, len, out);
+ }
+
+ int peek_until(const Pj_Char_Spec *cs, Pj_String *out)
+ {
+ return pj_scan_peek_until(&scanner_, cs->cs_(), out);
+ }
+
+ void get(const Pj_Char_Spec *cs, Pj_String *out)
+ {
+ pj_scan_get(&scanner_, cs->cs_(), out);
+ }
+
+ void get_n(unsigned N, Pj_String *out)
+ {
+ pj_scan_get_n(&scanner_, N, out);
+ }
+
+ int get_char()
+ {
+ return pj_scan_get_char(&scanner_);
+ }
+
+ void get_quote(int begin_quote, int end_quote, Pj_String *out)
+ {
+ pj_scan_get_quote(&scanner_, begin_quote, end_quote, out);
+ }
+
+ void get_newline()
+ {
+ pj_scan_get_newline(&scanner_);
+ }
+
+ void get_until(const Pj_Char_Spec *cs, Pj_String *out)
+ {
+ pj_scan_get_until(&scanner_, cs->cs_(), out);
+ }
+
+ void get_until_ch(int until_ch, Pj_String *out)
+ {
+ pj_scan_get_until_ch(&scanner_, until_ch, out);
+ }
+
+ void get_until_chr(const char *spec, Pj_String *out)
+ {
+ pj_scan_get_until_chr(&scanner_, spec, out);
+ }
+
+ void advance_n(unsigned N, bool skip_ws=true)
+ {
+ pj_scan_advance_n(&scanner_, N, skip_ws);
+ }
+
+ int strcmp(const char *s, int len)
+ {
+ return pj_scan_strcmp(&scanner_, s, len);
+ }
+
+ int stricmp(const char *s, int len)
+ {
+ return pj_scan_stricmp(&scanner_, s, len);
+ }
+
+ void skip_ws()
+ {
+ pj_scan_skip_whitespace(&scanner_);
+ }
+
+ void save_state(State *state)
+ {
+ pj_scan_save_state(&scanner_, state);
+ }
+
+ void restore_state(State *state)
+ {
+ pj_scan_restore_state(&scanner_, state);
+ }
+
+ int get_pos_line() const
+ {
+ return scanner_.line;
+ }
+
+ int get_pos_col() const
+ {
+ return scanner_.col;
+ }
+
+
+private:
+ pj_scanner scanner_;
+};
+
+#endif /* __PJPP_SCANNER_HPP__ */
+