malena
Why malena
Quick start
Tutorials
API docs
GitHub
GitHub
Tutorials
Loading...
Searching...
No Matches
Utilities
FileReader.h
Go to the documentation of this file.
1
// Copyright 2025 Dave R. Smith
2
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
3
4
#pragma once
5
6
#include <
Malena/Core/malena_export.h
>
7
#include <
Malena/Utilities/Json.h
>
8
#include <optional>
9
#include <string>
10
11
namespace
ml
12
{
29
class
MALENA_API
FileReader
30
{
31
public
:
37
static
std::optional<json>
readJson
(
const
std::string& path);
38
43
static
std::optional<std::string>
readText
(
const
std::string& path);
44
};
45
46
}
// namespace ml
Json.h
ml::FileReader
Read text or JSON data from a file.
Definition
FileReader.h:30
ml::FileReader::readText
static std::optional< std::string > readText(const std::string &path)
Read the entire contents of a file as a string.
ml::FileReader::readJson
static std::optional< json > readJson(const std::string &path)
Parse a JSON file.
malena_export.h
MALENA_API
#define MALENA_API
Definition
malena_export.h:18
ml
Definition
Component.h:22