Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "CFString.h"
- char* CFString::strempty = "";
- CFString::CFString() {
- strdata = strempty;
- }
- CFString::CFString(const char* str) {
- strdata = NULL;
- if (str != NULL) {
- strdata = new char[strlen(str) + 1];
- strncpy(strdata, str, strlen(str));
- strdata[strlen(strdata)] = 0;
- } else strdata = strempty;
- }
- CFString::CFString(const CFString& str) {
- if(str.strdata != NULL) {
- strdata = new char[strlen(str) + 1];
- strncpy(strdata, str.strdata, strlen(strdata));
- strdata[strlen(strdata)] = 0;
- } else strdata = strempty;
- }
- CFString::~CFString() {
- if (strdata != NULL){
- delete[] strdata;
- }
- }
- CFString::operator const char* ()
- {
- return strdata;
- }
- CFString::operator const char* () const
- {
- return strdata;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement