#include #include #include "bstring.h" using namespace std; /* char * str; // the pointer to my dynamic string int size; // size of string -- allocation will be // size+1, so that we can store AS a c-string */ ostream& operator<<(ostream& os, const BString& s) { /* for (int i = 0; i < s.size; i++) os << s.str[i]; */ os << s.str; // call the library function to print a c-string return os; // enable the cascaded calls! } istream& operator>>(istream& is, BString& s) { } istream& getline(istream& is, BString& s) { } istream& getline(istream& is, BString& s, char delim) { } BString operator+ (const BString& x, const BString& y) { } bool operator< (const BString& x, const BString& y) { } bool operator> (const BString& x, const BString& y) { } bool operator<=(const BString& x, const BString& y) { } bool operator>=(const BString& x, const BString& y) { } bool operator==(const BString& x, const BString& y) { } bool operator!=(const BString& x, const BString& y) { } // member functions below BString::BString() // init to an empty string { size = 0; str = new char[1]; str[0] = '\0'; // consistent with new interpretation } BString::BString(const char* s) // init to a copy of s, the incoming c-string { size = strlen(s); str = new char[size+1]; /* for (int i = 0; i < size; i++) str[i] = s[i]; */ strcpy(str, s); // NOW I have room for '\0' } BString::~BString() { } BString::BString(const BString& s) { } BString& BString::operator=(const BString& s) { } BString& BString::operator+=(const BString& s) // concatenate s onto the calling object { } int BString::GetSize() const { } BString BString::substring(int pos, int len) { } void BString::Resize(int newsize) { }