String.h 687 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef STRING_H
  2. #define STRING_H
  3. #include "utils/Types.h"
  4. class String final {
  5. public:
  6. String();
  7. String(const char* str);
  8. bool operator==(const String& other) const;
  9. bool operator!=(const String& other) const;
  10. operator const char*() const;
  11. char operator[](uint index) const;
  12. uint getLength() const;
  13. String& append(char c);
  14. String& append(const char* str);
  15. String& append(uint i);
  16. String& append(int i);
  17. String& append(float f);
  18. String& append(bool b);
  19. private:
  20. String& appendFormat(const char* format, void* value);
  21. static constexpr uint MAX_LENGTH = 255;
  22. char data[MAX_LENGTH];
  23. u8 length;
  24. };
  25. #endif