Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

SubString Class Reference

#include <GString.h>

List of all members.

Public Methods

 ~SubString ()
SubString & operator= (const String &y)
SubString & operator= (const SubString &y)
SubString & operator= (const char *t)
SubString & operator= (char c)
int contains (char c) const
int contains (const String &y) const
int contains (const SubString &y) const
int contains (const char *t) const
int contains (const Regex &r) const
int matches (const Regex &r) const
unsigned int length () const
int empty () const
const char * chars () const
int OK () const

Protected Methods

void assign (const JString_t *, const char *, int=-1)
 SubString (String &x, int p, int l)
 SubString (const SubString &x)

Protected Attributes

StringS
unsigned short pos
unsigned short len

Friends

class String
ostream & operator<< (ostream &s, const SubString &x)


Constructor & Destructor Documentation

SubString::SubString String   x,
int    first,
int    l
[inline, protected]
 

Definition at line 490 of file GString.h.

00491   :S(x), pos(first), len(l) {}

SubString::SubString const SubString &    x [inline, protected]
 

Definition at line 488 of file GString.h.

00489   :S(x.S), pos(x.pos), len(x.len) {}

SubString::~SubString   [inline]
 

Definition at line 493 of file GString.h.

00493 {}


Member Function Documentation

int SubString::OK   const
 

Definition at line 1300 of file GString.cc.

01301 {
01302   int v = S != (const char*)0; // have a String;
01303   v &= S.OK();                 // that is legal
01304   v &= pos + len >= (short) S.rep->len;// pos and len within bounds
01305   if (!v) S.error("SubString invariant failure");
01306   return v;
01307 }

void SubString::assign const JString_t  ,
const char *   ,
int    = -1
[protected]
 

Referenced by operator=().

const char * SubString::chars   const [inline]
 

Definition at line 468 of file GString.h.

Referenced by String::after(), String::at(), String::before(), cat(), compare(), contains(), String::contains(), String::del(), String::freq(), String::from(), String::gsub(), String::index(), matches(), String::matches(), operator<<(), operator=(), String::operator=(), String::prepend(), and String::through().

00468 { return &(S.rep->s[pos]); }

int SubString::contains const Regex &    r const [inline]
 

Definition at line 1107 of file GString.h.

01108 {
01109   int unused;  return r.search(chars(), len, unused, 0) >= 0;
01110 }

int SubString::contains const char *    t const [inline]
 

Definition at line 1087 of file GString.h.

01088 {   
01089   return S.search(pos, pos+len, t) >= 0;
01090 }

int SubString::contains const SubString &    y const [inline]
 

Definition at line 1097 of file GString.h.

01098 {   
01099   return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
01100 }

int SubString::contains const String   y const [inline]
 

Definition at line 1092 of file GString.h.

01093 {   
01094   return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
01095 }

int SubString::contains char    c const [inline]
 

Definition at line 1102 of file GString.h.

01103 {
01104   return S.search(pos, pos+len, c) >= 0;
01105 }

int SubString::empty   const [inline]
 

Definition at line 467 of file GString.h.

00467 { return len == 0; }

unsigned int SubString::length   const [inline]
 

Definition at line 466 of file GString.h.

Referenced by String::after(), String::at(), String::before(), cat(), compare(), contains(), String::contains(), String::del(), String::freq(), String::from(), String::gsub(), String::index(), String::matches(), operator<<(), operator=(), String::operator=(), String::prepend(), and String::through().

00466 { return len; }

int SubString::matches const Regex &    r const [inline]
 

Definition at line 1112 of file GString.h.

01113 {
01114   return r.match(chars(), len, 0) == len;
01115 }

SubString & SubString::operator= char    ch [inline]
 

Definition at line 528 of file GString.h.

00529 {
00530   assign(0, &ch, 1);
00531   return *this;
00532 }

SubString & SubString::operator= const char *    ys [inline]
 

Definition at line 522 of file GString.h.

00523 {
00524   assign(0, ys);
00525   return *this;
00526 }

SubString & SubString::operator= const SubString &    y [inline]
 

Definition at line 540 of file GString.h.

00541 {
00542   assign(y.S.rep, y.chars(), y.length());
00543   return *this;
00544 }

SubString & SubString::operator= const String   y [inline]
 

Definition at line 534 of file GString.h.

00535 {
00536   assign(y.rep, y.chars(), y.length());
00537   return *this;
00538 }


Friends And Related Function Documentation

friend class String [friend]
 

Definition at line 118 of file GString.h.

ostream& operator<< ostream &    s,
const SubString &    x
[friend]
 

Definition at line 1247 of file GString.cc.

01248 { 
01249   const char* a = x.chars();
01250   const char* lasta = &(a[x.length()]);
01251   while (a < lasta)
01252     s.put(*a++);
01253   return(s);
01254 }


Member Data Documentation

String& SubString::S [protected]
 

Definition at line 121 of file GString.h.

Referenced by operator=().

unsigned short SubString::len [protected]
 

Definition at line 123 of file GString.h.

unsigned short SubString::pos [protected]
 

Definition at line 122 of file GString.h.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:55 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001