Ignore:
Timestamp:
Jan 18, 2006 11:32:27 PM (18 years ago)
Author:
bennylp
Message:

Fixed minor warnings/mismatched comments mainly in pjlib++

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj++/scanner.hpp

    r65 r122  
    2323#include <pj++/string.hpp> 
    2424 
    25 class Pj_Char_Spec 
     25class Pj_Cis; 
     26class Pj_Cis_Buffer; 
     27class Pj_Scanner; 
     28 
     29class Pj_Cis_Buffer 
    2630{ 
     31    friend class Pj_Cis; 
     32 
    2733public: 
    28     Pj_Char_Spec() { pj_cs_init(cs__); } 
    29  
    30     void set(int c) { pj_cs_set(cs__, c); } 
    31     void add_range(int begin, int end) { pj_cs_add_range(cs__, begin, end); } 
    32     void add_alpha() { pj_cs_add_alpha(cs__); } 
    33     void add_num() { pj_cs_add_num(cs__); } 
    34     void add_str(const char *str) { pj_cs_add_str(cs__, str); } 
    35     void del_range(int begin, int end) { pj_cs_del_range(cs__, begin, end); } 
    36     void del_str(const char *str) { pj_cs_del_str(cs__, str); } 
    37     void invert() { pj_cs_invert(cs__); } 
    38     int  match(int c) { return pj_cs_match(cs__, c); } 
    39  
    40     pj_char_spec_element_t *cs_() 
    41     { 
    42         return cs__; 
    43     } 
    44  
    45     const pj_char_spec_element_t *cs_() const 
    46     { 
    47         return cs__; 
     34    Pj_Cis_Buffer()  
     35    {  
     36        pj_cis_buf_init(&buf_);  
    4837    } 
    4938 
    5039private: 
    51     pj_char_spec cs__; 
     40    pj_cis_buf_t buf_; 
    5241}; 
     42 
     43 
     44class Pj_Cis 
     45{ 
     46    friend class Pj_Scanner; 
     47 
     48public: 
     49    Pj_Cis(Pj_Cis_Buffer *buf) 
     50    { 
     51        pj_cis_init(&buf->buf_, &cis_); 
     52    } 
     53 
     54    Pj_Cis(const Pj_Cis &rhs) 
     55    { 
     56        pj_cis_dup(&cis_, (pj_cis_t*)&rhs.cis_); 
     57    } 
     58 
     59    void add_range(int start, int end) 
     60    { 
     61        pj_cis_add_range(&cis_, start, end); 
     62    } 
     63 
     64    void add_alpha() 
     65    { 
     66        pj_cis_add_alpha(&cis_); 
     67    } 
     68 
     69    void add_num() 
     70    { 
     71        pj_cis_add_num(&cis_); 
     72    } 
     73 
     74    void add_str(const char *str) 
     75    { 
     76        pj_cis_add_str(&cis_, str); 
     77    } 
     78 
     79    void add_cis(const Pj_Cis &rhs) 
     80    { 
     81        pj_cis_add_cis(&cis_, &rhs.cis_); 
     82    } 
     83 
     84    void del_range(int start, int end) 
     85    { 
     86        pj_cis_del_range(&cis_, start, end); 
     87    } 
     88 
     89    void del_str(const char *str) 
     90    { 
     91        pj_cis_del_str(&cis_, str); 
     92    } 
     93 
     94    void invert() 
     95    { 
     96        pj_cis_invert(&cis_); 
     97    } 
     98 
     99    bool match(int c) const 
     100    { 
     101        return pj_cis_match(&cis_, c) != 0; 
     102    } 
     103 
     104private: 
     105    pj_cis_t cis_; 
     106}; 
     107 
     108 
    53109 
    54110class Pj_Scanner 
     
    86142    } 
    87143 
    88     int peek(const Pj_Char_Spec *cs, Pj_String *out) 
    89     { 
    90         return pj_scan_peek(&scanner_,  cs->cs_(), out); 
     144    int peek(const Pj_Cis *cis, Pj_String *out) 
     145    { 
     146        return pj_scan_peek(&scanner_,  &cis->cis_, out); 
    91147    } 
    92148 
     
    96152    } 
    97153 
    98     int peek_until(const Pj_Char_Spec *cs, Pj_String *out) 
    99     { 
    100         return pj_scan_peek_until(&scanner_, cs->cs_(), out); 
    101     } 
    102  
    103     void get(const Pj_Char_Spec *cs, Pj_String *out) 
    104     { 
    105         pj_scan_get(&scanner_, cs->cs_(), out); 
     154    int peek_until(const Pj_Cis *cis, Pj_String *out) 
     155    { 
     156        return pj_scan_peek_until(&scanner_, &cis->cis_, out); 
     157    } 
     158 
     159    void get(const Pj_Cis *cis, Pj_String *out) 
     160    { 
     161        pj_scan_get(&scanner_, &cis->cis_, out); 
    106162    } 
    107163 
     
    126182    } 
    127183 
    128     void get_until(const Pj_Char_Spec *cs, Pj_String *out) 
    129     { 
    130         pj_scan_get_until(&scanner_, cs->cs_(), out); 
     184    void get_until(const Pj_Cis *cis, Pj_String *out) 
     185    { 
     186        pj_scan_get_until(&scanner_, &cis->cis_, out); 
    131187    } 
    132188 
     
    161217    } 
    162218 
    163     void save_state(State *state) 
     219    void save_state(State *state) const 
    164220    { 
    165221        pj_scan_save_state(&scanner_, state); 
     
    178234    int get_pos_col() const 
    179235    { 
    180         return scanner_.col; 
     236        return pj_scan_get_col(&scanner_); 
    181237    } 
    182238 
Note: See TracChangeset for help on using the changeset viewer.