#pragma once #define NO_NED_NAMESPACE 1 #define NO_MALLINFO 1 #include "../../../Global_Win/Codes/nedmalloc/nedmalloc.h" //Copyright Mahmoud Al-Qudsi, 2010 //A very, very thin wrapper around TCHAR* //Uses a bit less memory than CString, auto-deletes when scope expires class qchar { public: TCHAR *t; private: void Copy(const TCHAR * str) { //NO Deallocation happens here if(str) { //t = new TCHAR[_tcsclen(str)+1]; t = (TCHAR*) nedmalloc((_tcsclen(str) + 1) * sizeof(TCHAR)); _tcscpy(t, str); } else { t = NULL; } } public: inline ~qchar() { if(t) { nedfree(t); t = NULL; } } inline qchar() { t = NULL; } inline qchar(const qchar &str) { Copy(str.t); } inline qchar(const TCHAR *str) { Copy(str); } qchar& operator= (const TCHAR *str) { if(t) nedfree(t); Copy(str); return *this; } qchar& operator= (const qchar &str) { if(this != &str) { if(t) nedfree(t); Copy(str.t); } return *this; } };