RWCSubString man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



RWCSubString(3C++)					    RWCSubString(3C++)

Name
     RWCSubString - Rogue Wave library class

Synopsis
	      #include <rw/cstring.h>

	      RWCString s("test string");
	  s(6,3);     // "tri"

Description
     The class RWCSubString allows some subsection of an RWCString to be
     addressed by defining a starting position and an extent.  For example the
     7th through the 11th elements, inclusive, would have a starting position
     of 7 and an extent of 5.  The specification of a starting position and
     extent can also be done in your behalf by such functions as
     RWCString::strip() or the overloaded function call operator taking a
     regular expression as an argument.	 There are no public constructors --
     RWCSubStrings are constructed by various functions of the RWCString class
     and then destroyed immediately. A zero length substring is one with a
     defined starting position and an extent of zero.  It can be thought of as
     starting just before the indicated character, but not including it.  It
     can be used as an lvalue.	A null substring is also legal and is
     frequently used to indicate that a requested substring, perhaps through a
     search, does not exist.  A null substring can be detected with member
     function isNull().	 However, it cannot be used as an lvalue.

Persistence
     None

Example
	      #include <rw/cstring.h>
	  #include <rw/rstream.h>
	  main(){
	    RWCString s("What I tell you is true.");
	    // Create a substring and use it as an lvalue:
	    s(19, 0) = "three times ";
	    cout << s << endl;
	  }

     Program output:

	      What I tell you is three times true.

									Page 1

RWCSubString(3C++)					    RWCSubString(3C++)

Assignment Operators
	      RWCSubString&
	  operator=(const RWCString&);

     Assignment from an RWCString.  The statements:

	      RWCString a;

	      RWCString b;
	  b(2, 3) = a;

     will copy a's data into the substring b(2,3).  The number of elements
     need not match: if they differ, b will be resized appropriately.  Sets
     self's extent to be the length of the assigned RWCString.	If self is the
     null substring, then the statement has no effect.	Returns a reference to
     self.

	      RWCSubString&
	  operator=(const RWCSubString&);

     Assignment from an RWCSubString.  The statements:

	      RWCString a;

	      RWCString b;
	  b(2, 3) = a(5,5);

     will copy 5 characters of a's data into the substring b(2,3).  The number
     of elements need not match: if they differ, b will be resized
     appropriately.  Sets self's extent to be the extent of the assigned
     RWCSubString.  If self is the null substring, then the statement has no
     effect.  Returns a reference to self.

	      RWCSubString&
	  operator=(const char*);

     Assignment from a character string.  Example:

	      RWCString str("Mary had a lamb");

									Page 2

RWCSubString(3C++)					    RWCSubString(3C++)

	      char dat[] = "Perrier";
	  str(11,4) = dat;  // "Mary had a Perrier"

     Note that the number of characters selected need not match: if they
     differ, str will be resized appropriately.	 Sets self's extent to be the
     strlen() of the assigned character string.	 If self is the null
     substring, then the statement has no effect.  Returns a reference to
     self.

Indexing Operators
	      char&
	  operator[](size_t i);
	  char
	  operator[](size_t i) const;

     Returns the ith character of the substring.  The first variant can be
     used as an lvalue, the second cannot.  The index i must be between zero
     and the length of the substring, less one.	 Bounds checking is performed:
     if the index is out of range, then an exception of type RWBoundsErr will
     occur.

	      char&
	  operator()(size_t i);
	  char
	  operator()(size_t i) const;

     Returns the ith character of the substring.  The first variant can be
     used as an lvalue, the second cannot.  The index i must be between zero
     and the length of the substring, less one.	 Bounds checking is enabled by
     defining the pre-processor macro RWBOUNDS_CHECK before including
     <rw/cstring.h>.  In this case, if the index is out of range, then an
     exception of type RWBoundsErr will occur.

Public Member Functions
	      RWBoolean
	  isNull() const;

     Returns TRUE if this is a null substring.

	      size_t
	  length() const;

     Returns the extent (i.e., length) of the RWCSubString.

	      RWBoolean
	  operator!() const;

									Page 3

RWCSubString(3C++)					    RWCSubString(3C++)

     Returns TRUE if this is a null substring.

	      size_t
	  start() const;

     Returns the starting element of the RWCSubString.

	      void
	  toLower();

     Changes all upper-case letters in self to lower-case.  Uses the standard
     C library function tolower().

	      void
	  toUpper();

     Changes all lower-case letters in self to upper-case.  Uses the standard
     C library function toupper().

Global Logical Operators
	      RWBoolean
	  operator==(const RWCSubString&, const RWCSubString&);
	  RWBoolean
	  operator==(const RWCString&,	  const RWCSubString&);
	  RWBoolean
	  operator==(const RWCSubString&, const RWCString&   );
	  RWBoolean
	  operator==(const char*,	  const RWCSubString&);
	  RWBoolean
	  operator==(const RWCSubString&, const char*	     );

     Returns TRUE if the substring is lexicographically equal to the character
     string or RWCString argument.  Case sensitivity is exact.

	      RWBoolean
	  operator!=(const RWCString&,	  const RWCString&   );
	  RWBoolean
	  operator!=(const RWCString&,	  const RWCSubString&);
	  RWBoolean
	  operator!=(const RWCSubString&, const RWCString&   );
	  RWBoolean
	  operator!=(const char*,	  const RWCString&   );
	  RWBoolean
	  operator!=(const RWCString&,	  const char*	     );

     Returns the negation of the respective operator==().

									Page 4

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net