Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

String.h File Reference

Copyright and Use More...

#include <stdexcept>
#include <stdio.h>
#include "SubString.h"
#include "RCArray.h"

Include dependency graph for String.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class  String
 This class is a container for strings composed of 8-bit ASCII characters. More...


Typedefs

typedef RCArray< char > CharArray
 Define a type for a growable reference counted array object that implements copy-on-write semantics.


Functions

String operator+ (const char *Cstr, String &s)
 Global operator +: "abcd" + String(" efgh").

String operator+ (const char ch, String &s)
 Global operator +: Concatenate a character and a String object.

bool operator== (const char *Cstr, String &s)
 Global Cstr == String operator, where Cstr is a "C" string.

bool operator!= (const char *Cstr, String &s)
 Global Cstr != String operator, where Cstr is a "C" string.

bool operator<= (const char *Cstr, String &s)
 Cstr <= s: however, we must use the comparision s to Cstr.

bool operator>= (const char *Cstr, String &s)
 Cstr >= s: however, we must use the comparision s to Cstr.

bool operator< (const char *Cstr, String &s)
 Cstr < s: however, we must use the comparision s to Cstr.

bool operator> (const char *Cstr, String &s)
 Cstr > s: however, we must use the comparision s to Cstr.


Detailed Description

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2001, 2002, 2003

This software is provided "as is", without any warrenty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International.

Please send any bug fixes or suggested source changes to:

iank@bearcave.com

Definition in file String.h.


Typedef Documentation

typedef RCArray<char> CharArray
 

Define a type for a growable reference counted array object that implements copy-on-write semantics.

Definition at line 42 of file String.h.

Referenced by String::String().


Function Documentation

bool operator!= const char *  Cstr,
String s
 

Global Cstr != String operator, where Cstr is a "C" string.

Definition at line 459 of file String.C.

00460 {
00461   return (s != Cstr);
00462 } // operator !=

String operator+ const char  ch,
String s
 

Global operator +: Concatenate a character and a String object.

String Str("ab"); String a;

a = 'c' + Str

Here, "a" will contain "abc"

Definition at line 434 of file String.C.

00435 {
00436   String tmp;
00437 
00438   tmp = ch;
00439   tmp += s;
00440 
00441   return tmp;
00442 } // global operator +

String operator+ const char *  Cstr,
String s
 

Global operator +: "abcd" + String(" efgh").

This operator supports an operation like "abcd" + String(" efgh"). The result of this operator would be a String object containing "abcd efgh".

Definition at line 409 of file String.C.

00410 {
00411   String tmp;
00412   if (Cstr != 0) {
00413     tmp = Cstr;
00414   }
00415   
00416   tmp += s;
00417   return tmp;
00418 } // global operator +

bool operator< const char *  Cstr,
String s
 

Cstr < s: however, we must use the comparision s to Cstr.

So this expression is true if s > Cstr.

Definition at line 495 of file String.C.

00496 {
00497   return (s > Cstr);
00498 } // global operator <

bool operator<= const char *  Cstr,
String s
 

Cstr <= s: however, we must use the comparision s to Cstr.

So this expression is true if s >= Cstr.

Definition at line 471 of file String.C.

00472 {
00473   return (s >= Cstr);
00474 } // global operator <=

bool operator== const char *  Cstr,
String s
 

Global Cstr == String operator, where Cstr is a "C" string.

Definition at line 449 of file String.C.

00450 {
00451   return (s == Cstr);
00452 } // global operator ==

bool operator> const char *  Cstr,
String s
 

Cstr > s: however, we must use the comparision s to Cstr.

So this expression is true if s < Cstr.

Definition at line 507 of file String.C.

00508 {
00509   return (s < Cstr);
00510 } // global operator >

bool operator>= const char *  Cstr,
String s
 

Cstr >= s: however, we must use the comparision s to Cstr.

So this expression is true if s <= Cstr.

Definition at line 483 of file String.C.

00484 {
00485   return (s <= Cstr);
00486 } // global operator >=


Generated on Mon Sep 22 20:23:00 2003 by doxygen 1.3.3