Back to index

texmacs  1.0.7.15
Public Member Functions | Private Attributes | Friends
parse_string_rep Class Reference

#include <parse_string.hpp>

Inheritance diagram for parse_string_rep:
Inheritance graph
[legend]
Collaboration diagram for parse_string_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 parse_string_rep ()
 parse_string_rep (string s)
 ~parse_string_rep ()
void advance (int n)
string read (int n)
void write (string s)
char get_char (int n)
string get_string (int n)
bool test (string s)

Private Attributes

list< stringl
list< int > p
int ref_count

Friends

class parse_string
tm_ostreamoperator<< (tm_ostream &out, parse_string s)
bool test (parse_string s, string what)

Detailed Description

Definition at line 19 of file parse_string.hpp.


Constructor & Destructor Documentation

Definition at line 24 of file parse_string.hpp.

: l (), p () {}

Definition at line 25 of file parse_string.hpp.

: l (s), p (0) {}

Definition at line 26 of file parse_string.hpp.

{}

Member Function Documentation

void parse_string_rep::advance ( int  n)

Definition at line 17 of file parse_string.cpp.

                                {
  if (is_nil (l) || n <= 0) return;
  p->item += n;
  if (p->item >= N (l->item)) {
    n= p->item - N (l->item);
    l= l->next;
    p= p->next;
    advance (n);
  }
}

Here is the call graph for this function:

char parse_string_rep::get_char ( int  n)

Definition at line 56 of file parse_string.cpp.

                                 {
  if (is_nil (l)) return 0;
  if (p->item + n < N (l->item))
    return l->item [p->item + n];

  list<string> ll= l;
  list<int>    pp= p;
  while (!is_nil (l) && pp->item + n >= N (ll->item)) {
    n -= (N (ll->item) - pp->item);
    ll = ll->next;
    pp = pp->next;
  }
  if (is_nil (ll)) return 0;
  return ll->item [pp->item + n];
}

Here is the call graph for this function:

Definition at line 73 of file parse_string.cpp.

                                   {
  if (is_nil (l)) return "";
  if (p->item + n <= N (l->item))
    return l->item (p->item, p->item + n);

  string s;
  list<string> ll= l;
  list<int>    pp= p;
  while (n >= 0 && !is_nil (ll)) {
    int m= min (N (ll->item) - pp->item, n);
    s << ll->item (pp->item, pp->item + m);
    n -= m;
    ll = ll->next;
    pp = pp->next;
  }
  return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 29 of file parse_string.cpp.

                             {
  string s;
  while (!is_nil (l) && p->item + n > N (l->item)) {
    s << l->item (p->item, N (l->item));
    n -= (N (l->item) - p->item);
    l  = l->next;
    p  = p->next;
  }
  if (is_nil (l)) return s;
  s << l->item (p->item, p->item + n);
  p->item += n;
  if (p->item >= N(l->item)) {
    l= l->next;
    p= p->next;
  }
  return s;
}

Here is the call graph for this function:

Definition at line 92 of file parse_string.cpp.

                                {
  if (is_nil (l)) return N(s) == 0;
  if (p->item + N(s) <= N (l->item))
    return ::test (l->item, p->item, s);

  return get_string (N(s)) == s;
}

Here is the call graph for this function:

Definition at line 48 of file parse_string.cpp.

                                 {
  if (N(s) > 0) {
    l= list<string> (s, l);
    p= list<int>    (0, p);
  }
}

Here is the call graph for this function:


Friends And Related Function Documentation

tm_ostream& operator<< ( tm_ostream out,
parse_string  s 
) [friend]

Definition at line 106 of file parse_string.cpp.

                                              {
  list<string> l= s->l;
  list<int>    p= s->p;
  while (!is_nil (l)) {
    out << l->item (p->item, N(l->item));
    l= l->next;
    p= p->next;
  }
  return out;
}
friend class parse_string [friend]

Definition at line 35 of file parse_string.hpp.

bool test ( parse_string  s,
string  what 
) [friend]

Definition at line 101 of file parse_string.cpp.

                                   {
  return s->test (what);
}

Member Data Documentation

Definition at line 20 of file parse_string.hpp.

list<int> parse_string_rep::p [private]

Definition at line 21 of file parse_string.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.


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