#pragma once #include #include class String { public: String(); String(const char * c_str); String(const char * data, size_t size); String(const String &); String(String &&); String & operator = (const String &); String & operator = (String &&); ~String(); public: static String va_fmt(va_list args, const char * fmt); static String fmt(const char * fmt, ...); public: const char * c_str() const; char * data() const; size_t size() const; bool empty() const; public: friend bool operator == (const String &, const String &); friend bool operator != (const String &, const String &); private: void set(const char * data); void set(const char * data, size_t data_len); private: char * _data = nullptr; size_t _data_len = 0; };