1#ifndef RAYLIB_CPP_INCLUDE_FILETEXT_HPP_
2#define RAYLIB_CPP_INCLUDE_FILETEXT_HPP_
8#include "./raylib-cpp-utils.hpp"
15 FileText(
const FileText&) =
delete;
16 FileText(FileText&& other) noexcept : data(other.data), length(other.length) {
20 FileText& operator=(
const FileText&) =
delete;
21 FileText& operator=(FileText&& other)
noexcept {
22 std::swap(data, other.data);
23 std::swap(length, other.length);
26 ~FileText() { Unload(); }
28 explicit FileText(
const std::string_view fileName) {
32 GETTER(
const char*, Data, data)
33 GETTER(
unsigned int, Length, length)
35 [[nodiscard]]
const char* c_str()
const {
return data; }
37 [[nodiscard]] std::string ToString()
const {
return data; }
38 explicit operator std::string()
const {
42 void Load(
const std::string_view fileName) { Load(fileName.data()); }
43 void Load(
const char* fileName) {
44 data = ::LoadFileText(fileName);
45 length = ::TextLength(data);
49 if (data !=
nullptr) {
50 ::UnloadFileText(data);
58 unsigned int length{0};
63using RFileText = raylib::FileText;