String.h 751 B

123456789101112131415161718192021222324252627282930
  1. #ifndef STRING_H
  2. #define STRING_H
  3. #include <cstddef>
  4. class String final {
  5. public:
  6. String();
  7. String(const char* str);
  8. String& operator+=(const char* str);
  9. String& operator+=(char c);
  10. String& operator+=(char32_t c);
  11. String& operator+=(unsigned int i);
  12. String& operator+=(double d);
  13. String operator+(const char* str) const;
  14. operator const char*() const;
  15. size_t getLength() const;
  16. bool isFull() const;
  17. bool operator==(const String& other) const;
  18. bool operator!=(const String& other) const;
  19. bool operator==(const char* other) const;
  20. bool operator!=(const char* other) const;
  21. private:
  22. static constexpr size_t capacity = 4096;
  23. size_t usedCapacity;
  24. char data[capacity];
  25. };
  26. #endif