Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
yaml.h
1#ifndef SOURCEMETA_CORE_YAML_H_
2#define SOURCEMETA_CORE_YAML_H_
3
4#ifndef SOURCEMETA_CORE_YAML_EXPORT
5#include <sourcemeta/core/yaml_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9
10// NOLINTBEGIN(misc-include-cleaner)
11#include <sourcemeta/core/yaml_error.h>
12#include <sourcemeta/core/yaml_roundtrip.h>
13// NOLINTEND(misc-include-cleaner)
14
15#include <filesystem> // std::filesystem
16#include <istream> // std::basic_istream
17#include <ostream> // std::basic_ostream
18
27
28namespace sourcemeta::core {
29
46SOURCEMETA_CORE_YAML_EXPORT
47auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream)
48 -> JSON;
49
68SOURCEMETA_CORE_YAML_EXPORT
69auto parse_yaml(const JSON::String &input) -> JSON;
70
90SOURCEMETA_CORE_YAML_EXPORT
91auto read_yaml(const std::filesystem::path &path) -> JSON;
92
100SOURCEMETA_CORE_YAML_EXPORT
101auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
102 JSON &output, const JSON::ParseCallback &callback) -> void;
103
110SOURCEMETA_CORE_YAML_EXPORT
111auto parse_yaml(const JSON::String &input, JSON &output,
112 const JSON::ParseCallback &callback) -> void;
113
120SOURCEMETA_CORE_YAML_EXPORT
121auto read_yaml(const std::filesystem::path &path, JSON &output,
122 const JSON::ParseCallback &callback) -> void;
123
142SOURCEMETA_CORE_YAML_EXPORT
143auto read_yaml_or_json(const std::filesystem::path &path) -> JSON;
144
152SOURCEMETA_CORE_YAML_EXPORT
153auto read_yaml_or_json(const std::filesystem::path &path, JSON &output,
154 const JSON::ParseCallback &callback) -> void;
155
170SOURCEMETA_CORE_YAML_EXPORT
171auto parse_yaml(const JSON::String &input, YAMLRoundTrip &roundtrip) -> JSON;
172
180SOURCEMETA_CORE_YAML_EXPORT
181auto parse_yaml(const JSON::String &input, YAMLRoundTrip &roundtrip,
182 JSON &output, const JSON::ParseCallback &callback) -> void;
183
204SOURCEMETA_CORE_YAML_EXPORT
205auto stringify_yaml(const JSON &document,
206 std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
207 const YAMLRoundTrip &roundtrip) -> void;
208
223SOURCEMETA_CORE_YAML_EXPORT
224auto stringify_yaml(const JSON &document,
225 std::basic_ostream<JSON::Char, JSON::CharTraits> &stream)
226 -> void;
227
228} // namespace sourcemeta::core
229
230#endif
std::function< void( const ParsePhase phase, const Type type, const std::uint64_t line, const std::uint64_t column, const ParseContext context, const std::size_t index, const String &property)> ParseCallback
Definition json_value.h:103
std::basic_string< Char, CharTraits, Allocator< Char > > String
The string type used by the JSON document.
Definition json_value.h:52
Definition json_value.h:39
Definition yaml_roundtrip.h:29
SOURCEMETA_CORE_YAML_EXPORT auto stringify_yaml(const JSON &document, std::basic_ostream< JSON::Char, JSON::CharTraits > &stream, const YAMLRoundTrip &roundtrip) -> void
SOURCEMETA_CORE_YAML_EXPORT auto parse_yaml(std::basic_istream< JSON::Char, JSON::CharTraits > &stream) -> JSON
SOURCEMETA_CORE_YAML_EXPORT auto read_yaml(const std::filesystem::path &path) -> JSON
SOURCEMETA_CORE_YAML_EXPORT auto read_yaml_or_json(const std::filesystem::path &path) -> JSON