Main Page Class Hierarchy Compound List File List Compound Members File Members

# cmt_char_list_node Class Reference

Inheritance diagram for cmt_char_list_node

[legend]
Collaboration diagram for cmt_char_list_node:

[legend]
List of all members.

## Public Methods
| cmt_char_list_node (cmt_string list)
const cmt_regexp::iterator | match (const cmt_string& text, int pos) const
## Protected Attributes
cmt_string | _list
cmt_string | _choices

## Constructor & Destructor Documentation

cmt_char_list_node::cmt_char_list_node ( | cmt_string list )

| Definition at line 323 of file cmt_regexp.cxx.
    00324 {
    00325   _list = list;
    00326
    00327   _choices = "";
    00328
    00329   char c;
    00330   int i;
    00331
    00332   for (i = 0; i < list.size (); i++)
    00333     {
    00334       c = list[i];
    00335
    00336       switch (c)
    00337         {
    00338           case '-':
    00339             i++;
    00340             {
    00341               char c1 = _choices[_choices.size () - 1];
    00342               char c2 = list[i];
    00343               int j;
    00344               int j0 = (c1 < c2) ? c1 : c2;
    00345               int j1 = (c1 > c2) ? c1 : c2;
    00346               for (j = j0; j <= j1; j++)
    00347                 {
    00348                   _choices += j;
    00349                 }
    00350             }
    00351             break;
    00352           case '\\':
    00353             i++;
    00354             c = list[i];
    00355             switch (c)
    00356               {
    00357                 case '[':
    00358                 case ']':
    00359                 case '(':
    00360                 case ')':
    00361                 case '.':
    00362                 case '*':
    00363                 case '?':
    00364                 case '^':
    00365                 case '$':
    00366                 case '\\':
    00367                   break;
    00368                 case 'r':
    00369                   c = '\r';
    00370                   break;
    00371                 case 't':
    00372                   c = '\t';
    00373                   break;
    00374                 case 'n':
    00375                   c = '\n';
    00376                   break;
    00377                 default:
    00378                   break;
    00379               }
    00380           default:
    00381             _choices += c;
    00382             break;
    00383         }
    00384     }
    00385 }

## Member Function Documentation

const cmt_regexp::iterator cmt_char_list_node::match ( | const cmt_string & text,
| int pos ) const`[virtual]`

| Reimplemented from cmt_node. Reimplemented in cmt_not_char_list_node. Definition at line 387 of file cmt_regexp.cxx.
    00389 {
    00390   if ((pos < 0) || (pos > text.size ()))
    00391     {
    00392       return (cmt_regexp::iterator::null ());
    00393     }
    00394
    00395   char c = text[pos];
    00396
    00397   int i;
    00398
    00399   for (i = 0; i < _choices.size (); i++)
    00400     {
    00401       if (c == _choices[i]) return (cmt_regexp::iterator (pos, 1));
    00402     }
    00403
    00404   return (cmt_regexp::iterator::null ());
    00405 }

## Member Data Documentation

cmt_string cmt_char_list_node::_choices`[protected]`

| Definition at line 71 of file cmt_regexp.cxx.

cmt_string cmt_char_list_node::_list`[protected]`

| Definition at line 70 of file cmt_regexp.cxx.

The documentation for this class was generated from the following file:

- cmt_regexp.cxx