⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splash.doc

📁 SPLASH is a c++ class library that implements many of the Perl constructs and data types, including
💻 DOC
📖 第 1 页 / 共 2 页
字号:
                    SPLASH Class Library

class SPList<T>  A list of any type specified by T
                 
  T& operator[](n)       returns a reference to the element at
                        index 'n' (0 based). Generates an ASSERT
                        error if n < 0, can be used as an
                        lvalue. Using an index greater than the
                        current size of the list will cause the
                        list to grow upto that index. The values
                        inbetween will be undefined if <T> is a
                        built-in type.
  operator void*()     returns NULL if the list is empty, can
                        be used like:
                        if(list) // not empty
  int isempty()        returns TRUE if the list is empty, as
                        analternative for the previous technique
  void reset()         clears all elements in the list, but
                        doesn'tactually free up the storage
                        until it is destroyed
  int count()          returns the number of elements in the
                        list
  int scalar()         Perl-like Synonym (alias) for count()
  T pop()              removes and returns the last element on
                        thelist. If the list is empty the value
                        returned is usually undefined
  void push(T x)       puts the single value `x` at the end of
                        the list
  void push(SPList<T> l)    puts all the elements in the list
                        `l` at the end of the list.
  T shift()            removes and returns the first element in
                        the list
  int unshift(T x)     puts the single value `x` at the start
                        of the list
  int unshift(SPList<T> l)  puts all the elements in the list
                        `l`at the start of the list
  SPList<T> reverse()  returns a list that is in the
                        reverseorder
  SPList<T> splice(offset, len, SPList<T> l)
                        removes `len` elements from `offset` (0
                        based) and inserts all the elements in
                        the list `l` at the same position
  SPList<T> splice(offset, len)  removes `len` elements from
                        `offset` (0 based)
  SPList<T> splice(offset)  removes all the elements from
                        `offset` (0 based)
  SPList<T> sort()     returns a list that has been sorted
                        accordingto the rules that
                        T::operator<() returns for the type T.
  SubList<T> operator()(offset, len)  Returns the SubList from
                        `offset` for `len` elements. Maybe
                        assigned to a SPList or used wherever an
                        SPList may be used. Can also be assigned
                        to, in which case the specified elements
                        are replaced with the RHS
  SubList<T> operator()(Range rng)    Same as above, but
                        returns the range specified by `rng`
  SubList<T> operator()(Slice slc)    Same as above, but
                        returns the slice specified by `slc`. A
                        slice can be a non-contiguous set of
                        Ranges. See Slice below.
  SubList<T> operator()(char *s) Same as above, but returns the
                        slice specified by `s` where `s` is a
                        string that specifies a set of indices.
                        `s` can be:-
                         "a..b" or "a-b" which specifies a
                           continuous range from a thru' b.
                         "a,b,c" which specifies individual
                           indices a, b and c.
                         "a..b,c,d" which specifies a range and 2
                           individual indices.

class SPStringList    everything SPList does and ...
                 
  int split(str [,pat] [,limit]) appends the results of
                        splitting the string `str` to the list.
                        If `pat` is specified then any string
                        that matches the RE `pat` is considered
                        a separator to split on, the default is
                        white-space. If `limit` is specified
                        then no more than that number of
                        elements is generated. If `limit` is not
                        specified, then empty entries are
                        stripped from the end of the list. If
                        the RE includes subexpressions then they
                        are inserted into the list as well. If
                        `pat` is equal to the string "` `" then
                        a special case is done which matches
                        awks handling of whitespace. If `pat` is
                        an empty string "", then all characters
                        are split into the list
  SPString join([pat]) Returns the string that is the result of
                        combining all the elements in the list,
                        and separating them by `pat`. If `pat`
                        is omitted then the elements are
                        separated by a space
  int m(const char *exp, targ [,opts)
                        Appends to the list all
                        the subexpression matches that occured
                        when applying the regular expression
                        `exp` to the string `targ`.The number of
                        matches is returned. The first element
                        generated is the entire matched string
                        opts: (a const char * with default "")
                         i -    Forces case insensitive match
  SPStringList grep(const char *exp [,opts])
                        returns a list of all the elements
                        that matched the regular expression
                        `exp`.
                        opts: (a const char * with default "")
                         i - Forces the search to be case
                             insensitive

class SPString   A standard c null-terminated string may be used
                 anywhere that a SPString can be used and vice-
                 versa.
                 
  char operator[]      Allows Individual characters to be read
                        with the `[]` operator.
  int length()         returns the length of the string
  char chop()          removes and returns the last character
                        in the string
  int index(SPString str [, offset])  returns the offset in the
                        string that matches the string `str`,
                        starting at position `offset` if
                        specified, otherwise searches the entire
                        string. Returns -1 if no match is found
  int rindex(SPString str [, offset]) returns the offset in the
                        string that matches the string `str`,
                        starting at the end of the string
                        `offset` if specified, otherwise
                        searches the entire string. Returns -1
                        if no match is found
  substring substr(offset [, len])    returns the substring
                        within the string that starts at
                        `offset` and is `len` characters, if
                        `len` is omitted the rest of the string
                        is returned. This may be used as an
                        lvalue, in which case the characters are
                        removed, and the RHS of the expression
                        in inserted at the same postion.
  SPStringList split([,pat] [,limit]) same as
                        SPStringList::split() but returns a list
                        of splits
  operator<            These operators do what you would expect
  operator>
  operator<=
  operator>=
  operator==
  operator!=
  operator+            returns the result of contenating two or
                        more strings
  operator+=           replaces the LHS of the expression with
                        the concatenation of the LHS with the
                        RHS
  int m(const char *exp [,opts]) returns 0 if the regular
                        expression `exp` fails to match the
                        string. Returns 1 if a match was made.
                        opts: (a const char * with default "")
                         i - Forces case insensitive match
  int m(const Regexp& exp)  Same as above but takes a
                        precompiled regular expression.
  int m(const char *exp, SPStringList& l [,opts])
                        Loads the list `l` with all
                        subexpression matches of the regular
                        expression `exp` with the string.
                        Returns 0 if no matches were made.
                        Returns the number of matches if any.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -