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 <cstddef> // std::size_t
16#include <filesystem> // std::filesystem
17#include <istream> // std::basic_istream
18#include <optional> // std::optional, std::nullopt
19#include <ostream> // std::basic_ostream
20
29
30namespace sourcemeta::core {
31
48SOURCEMETA_CORE_YAML_EXPORT
49auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream)
50 -> JSON;
51
70SOURCEMETA_CORE_YAML_EXPORT
71auto parse_yaml(const JSON::String &input) -> JSON;
72
90SOURCEMETA_CORE_YAML_EXPORT
91auto parse_yaml(const JSON::String &input, bool &more_documents) -> JSON;
92
112SOURCEMETA_CORE_YAML_EXPORT
113auto read_yaml(const std::filesystem::path &path) -> JSON;
114
134SOURCEMETA_CORE_YAML_EXPORT
135auto read_yaml(const std::filesystem::path &path, bool &more_documents) -> JSON;
136
144SOURCEMETA_CORE_YAML_EXPORT
145auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
146 JSON &output, const JSON::ParseCallback &callback) -> void;
147
154SOURCEMETA_CORE_YAML_EXPORT
155auto parse_yaml(const JSON::String &input, JSON &output,
156 const JSON::ParseCallback &callback) -> void;
157
166SOURCEMETA_CORE_YAML_EXPORT
167auto parse_yaml(const JSON::String &input, bool &more_documents, JSON &output,
168 const JSON::ParseCallback &callback) -> void;
169
176SOURCEMETA_CORE_YAML_EXPORT
177auto read_yaml(const std::filesystem::path &path, JSON &output,
178 const JSON::ParseCallback &callback) -> void;
179
187SOURCEMETA_CORE_YAML_EXPORT
188auto read_yaml(const std::filesystem::path &path, bool &more_documents,
189 JSON &output, const JSON::ParseCallback &callback) -> void;
190
209SOURCEMETA_CORE_YAML_EXPORT
210auto read_yaml_or_json(const std::filesystem::path &path) -> JSON;
211
219SOURCEMETA_CORE_YAML_EXPORT
220auto read_yaml_or_json(const std::filesystem::path &path, JSON &output,
221 const JSON::ParseCallback &callback) -> void;
222
237SOURCEMETA_CORE_YAML_EXPORT
238auto parse_yaml(const JSON::String &input, YAMLRoundTrip &roundtrip) -> JSON;
239
261SOURCEMETA_CORE_YAML_EXPORT
262auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
263 YAMLRoundTrip &roundtrip) -> JSON;
264
272SOURCEMETA_CORE_YAML_EXPORT
273auto parse_yaml(const JSON::String &input, YAMLRoundTrip &roundtrip,
274 JSON &output, const JSON::ParseCallback &callback) -> void;
275
285SOURCEMETA_CORE_YAML_EXPORT
286auto parse_yaml(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
287 YAMLRoundTrip &roundtrip, JSON &output,
288 const JSON::ParseCallback &callback) -> void;
289
310SOURCEMETA_CORE_YAML_EXPORT
311auto read_yaml(const std::filesystem::path &path, YAMLRoundTrip &roundtrip)
312 -> JSON;
313
323SOURCEMETA_CORE_YAML_EXPORT
324auto read_yaml(const std::filesystem::path &path, YAMLRoundTrip &roundtrip,
325 JSON &output, const JSON::ParseCallback &callback) -> void;
326
352SOURCEMETA_CORE_YAML_EXPORT
353auto stringify_yaml(const JSON &document,
354 std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
355 const YAMLRoundTrip &roundtrip,
356 const std::optional<std::size_t> indentation = std::nullopt)
357 -> void;
358
375SOURCEMETA_CORE_YAML_EXPORT
376auto stringify_yaml(const JSON &document,
377 std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
378 const std::size_t indentation = 2) -> void;
379
380} // namespace sourcemeta::core
381
382#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:30
SOURCEMETA_CORE_YAML_EXPORT auto parse_yaml(std::basic_istream< JSON::Char, JSON::CharTraits > &stream) -> JSON
SOURCEMETA_CORE_YAML_EXPORT auto stringify_yaml(const JSON &document, std::basic_ostream< JSON::Char, JSON::CharTraits > &stream, const YAMLRoundTrip &roundtrip, const std::optional< std::size_t > indentation=std::nullopt) -> void
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