1#ifndef RAYLIB_CPP_INCLUDE_FILETEXT_HPP_
2#define RAYLIB_CPP_INCLUDE_FILETEXT_HPP_
7#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 {
return data; }
40 void Load(
const std::string_view fileName) { Load(fileName.data()); }
41 void Load(
const char* fileName) {
47 if (data !=
nullptr) {
48 ::UnloadFileText(data);
55 unsigned int length{0};
60using RFileText = raylib::FileText;
All raylib-cpp classes and functions appear in the raylib namespace.
static unsigned int TextLength(const char *text)
Check if two text string are equal.
static std::string LoadFileText(const std::string_view fileName)
Load text data from file (read)