plis::slip Class Reference

#include <plis.h>

List of all members.

Public Member Functions

 slip (const slip &s)
 slip (const char *s)
 slip (const char *s, int n)
 slip (const char c)
 slip (const substring &sb)
slipoperator= (const char *s)
 Assignment operator from const char.
slipoperator= (const slip &s)
 Copy assignment.
slipoperator= (const substring &sb)
 operator const char * () const
 Casting operator to const char*.
 operator const std::string () const
 Casting operator to std::string.
const char operator[] (int n) const
 Single character access.
int length (void) const
 Return the length of the string.
char chop (void)
 Erase the last character.
void chomp (void)
 Erase the last character if it is a white space character.
int index (const slip &s, int offset=0)
 Returns position of a string within a string.
int rindex (const slip &s, int offset=-1)
 Returns position of a string within a from the right string.
int wsplit (llip &)
 White space split.
int strsplit (const slip &str, llip &sl)
 Split a string on boundries of constant string.
substring substr (int offset, int len=-1)
 Return a substring of a string.
PLIS_INLINE substring substr (const Range &r)
int tr (const char *, const char *, const char *opts="")
 Like perl tr operator. Translates characters.
int m (Regexp &r)
int m (const char *, const char *opts="")
 Match a regular exppression string.
int m (const char *, llip &match_list, const char *opts="")
int m (Regexp &r, llip &match_list)
int s (const char *, const char *, const char *opts="")
 like perl/sed s/// operator for regexp substition
llip split (const char *pat="[ \\t\\n]+", int limit=-1)
int operator< (const slip &s) const
int operator> (const slip &s) const
int operator<= (const slip &s) const
int operator>= (const slip &s) const
int operator== (const slip &s) const
int operator== (const char *s) const
int operator!= (const slip &s) const
int operator!= (const char *s) const
slip operator+ (const slip &s) const
 Concatination operator with another slip.
slip operator+ (const char *s) const
 Concatination operator with a const char *.
slip operator+ (char c) const
 Concatination operator with a char.
slipoperator+= (const slip &s)
 Inline concatination with a slip.
slipoperator+= (const char *s)
 Inline concatination with a const char*.
slipoperator+= (char c)
 Inline concatination with a char.
const std::string & str () const
 Return the underlying std::string string.
const char * c_str () const
 Compatibility function with string.
int atoi ()
 A wrapper for the atoi() function.
double atof ()
 A wrapper for the atof() function.

Friends

class substring
slip operator+ (const char *s1, const slip &s2)
 Contationation operator.
std::istream & operator>> (std::istream &, slip &)
 Output to a stream.


Detailed Description

A very featureful perl like string class with regular expression support. It is built around the standard std::string which may be accessed through the str() method.

The regular expression engine used is the PCRE library, which has been wrapped in the Regexp class.


Member Function Documentation

int plis::slip::m const char *  ,
llip match_list,
const char *  opts = ""
 

Match a regular expression and return matched groups

Parameters:
opts Matching options
Return values:
match_list The list of the sub groups found. Note that match_list[0] is the whole expression and $1 is placed in match_list[1], etc.

int plis::slip::m const char *  ,
const char *  opts = ""
 

Match a regular exppression string.

Parameters:
opts Optional parameters. May be one of:
  • 'i' - Case insensitive match.

llip plis::slip::split const char *  pat = "[ \\t\\n]+",
int  limit = -1
 

split a string on a regexp

int plis::slip::strsplit const slip str,
llip sl
 

Split a string on boundries of constant string.

Parameters:
str String to split on.
Return values:
sl Output slip list


The documentation for this class was generated from the following file:
plis - Perl Like Structures