home *** CD-ROM | disk | FTP | other *** search
-
- STRLOC.H(c++) BASE STRLOC.H(c++)
-
- Feb 14, 1990
-
- DESCRIPTION
- The strloc class is a class for managing strings.
- It uses reference counts on copy operations.
-
- CLASS strloc
-
- Public members
- strloc( const char *str= 0 );
- strloc( strloc & );
- ~strloc();
- strloc & operator=( strloc & );
- strloc & operator=( const char * );
- void operator+=( const char * );
- const char *ptr();
- int len();
- friend int operator==( const strloc &x, const char *s );
- friend int operator==( const char *s, const strloc &x );
- friend int operator==( const strloc &x, const strloc &y );
- friend int operator!=( const strloc &x, const char *s );
- friend int operator!=( const char *s, const strloc &x );
- friend int operator!=( const strloc &x, const strloc &y );
-
- Private members
- strloc_data *st_com;
- Pointer to character string struct.
-
-
- DEFINED MACROS
- UTIL_STRLOC_H
-
- INCLUDED FILES
- <strings.hxx>
-
- STRUCTURES
- strloc_data
- {
- char *std_ptr; pointer to string
- int std_refcnt; reference count
- };
-
- SOURCE FILES
- strloc.cxx
- strloc.h
-
- SUMMARY
- strloc::strloc( const char *newstr )
- Normal constructor.
- Passed a pointer to a character string it copies it
- to new memory and sets the reference count to 1.
-
- strloc::strloc( strloc &orig )
- Constructor called when strloc a= b.
- "this" is "a" and "orig" is a pointer to "b".
-
- strloc::~strloc()
- Destructor for the strloc class.
- The refernce count is decrimented and when it goes to
- zero the string is deleted.
-
- strloc & strloc::operator=( strloc &rvalue )
- Implements copy function.
- Frees up old string and copies a pointer to the new one.
-
- strloc & strloc::operator=( const char *newstr )
- Implements set function: strloc a; a= "foo";
- Frees up old string and copies a pointer to the new one.
-
- void strloc::operator+=( const char *string )
- Appends the specified string onto the end of the current string.
-
- inline const char *strloc::ptr()
- Returns the pointer to the string.
-
- inline int strloc::len()
- Returns the length of the string.
-
-