#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, and we will 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; return os; // enable 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]; // allocate one spot for empty string str[0] = '\0'; } BString::BString(const char* s) // init to the contents of the incoming c-string s { size = strlen(s); // compute length of s str = new char[size+1]; /* for (int i = 0; i < size; i++) str[i] = s[i]; */ strcpy(str,s); // only if 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) { }