home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / GENMAN.ZIP / STRLOC.MAN < prev   
Text File  |  1993-03-13  |  3KB  |  93 lines

  1.  
  2. STRLOC(base)                   BASE UTILITIES                    STRLOC(base)
  3.  
  4.                                                                  Jun 19 16:39
  5. NAME
  6.     strloc - class to manage strings
  7.  
  8. SYNOPSIS
  9.     #include <base/strloc.h>
  10.  
  11.     class strloc
  12.  
  13.         Public members
  14.             strloc( const char *str= 0 );
  15.             strloc( strloc & );
  16.             ~strloc();
  17.             strloc & operator=( strloc & );
  18.             strloc & operator=( const char * );
  19.             void operator+=( const char * );
  20.             const char *ptr();
  21.             int len();
  22.             friend int operator==( const strloc &x, const char *s );
  23.             friend int operator==( const char *s, const strloc &x );
  24.             friend int operator==( const strloc &x, const strloc &y );
  25.             friend int operator!=( const strloc &x, const char *s );
  26.             friend int operator!=( const char *s, const strloc &x );
  27.             friend int operator!=( const strloc &x, const strloc &y );
  28.  
  29.         Private members
  30.             strloc_data *st_com;
  31.                Pointer to character string struct.
  32.  
  33. DESCRIPTION
  34.     The strloc class is a class for managing strings.
  35.     It uses reference counts on copy operations.
  36.  
  37. SEE ALSO
  38.     strings(3)
  39.  
  40. STRUCTURES
  41.     struct strloc_data {
  42.         char *std_ptr;         pointer to string
  43.         int   std_refcnt;      reference count
  44.     };
  45.  
  46. DEFINED MACROS
  47.     UTIL_STRLOC_H
  48.  
  49. INCLUDED FILES
  50.     <strings.hxx>
  51.  
  52. SOURCE FILES
  53.     strloc.cxx
  54.     strloc.h
  55.  
  56. SUMMARY
  57.     strloc::strloc( const char *newstr )
  58.         Normal constructor.
  59.         Passed a pointer to a character string it copies it
  60.         to new memory and sets the reference count to 1.
  61.  
  62.     strloc::strloc( strloc &orig )
  63.         Constructor called when strloc a= b.
  64.         "this" is "a" and "orig" is a pointer to "b".
  65.  
  66.     strloc::~strloc()
  67.         Destructor for the strloc class.
  68.         The refernce count is decrimented and when it goes to
  69.         zero the string is deleted.
  70.  
  71.     strloc & strloc::operator=( strloc &rvalue )
  72.         Implements copy function.
  73.         Frees up old string and copies a pointer to the new one.
  74.  
  75.     strloc & strloc::operator=( const char *newstr )
  76.         Implements set function: strloc a; a= "foo";
  77.         Frees up old string and copies a pointer to the new one.
  78.  
  79.     void strloc::operator+=( const char *string )
  80.         Appends the specified string onto the end of the current string.
  81.  
  82.     inline const char *strloc::ptr()
  83.         Returns the pointer to the string.
  84.  
  85.     inline int strloc::len()
  86.         Returns the length of the string.
  87.  
  88.     inline int operator==( const strloc &x, const strloc &y )
  89.         Returns 1 if the two strings are equal, 0 if not.
  90.  
  91.     inline int operator!=( const strloc &x, const strloc &y )
  92.         Returns 1 if the two strings are not equal, 0 if equal.
  93.