NeBuild dev
Loading...
Searching...
No Matches
parser.hpp
Go to the documentation of this file.
1//# This file is a part of toml++ and is subject to the the terms of the MIT license.
2//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
3//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
4// SPDX-License-Identifier: MIT
5#pragma once
6
7#include "preprocessor.hpp"
8#if TOML_ENABLE_PARSER
9
10#include "table.hpp"
11#include "parse_result.hpp"
12#include "header_start.hpp"
13
15{
17
40 parse_result TOML_CALLCONV parse(std::string_view doc, std::string_view source_path = {});
41
64 parse_result TOML_CALLCONV parse(std::string_view doc, std::string && source_path);
65
83 parse_result TOML_CALLCONV parse_file(std::string_view file_path);
84
85#if TOML_HAS_CHAR8
86
109 parse_result TOML_CALLCONV parse(std::u8string_view doc, std::string_view source_path = {});
110
133 parse_result TOML_CALLCONV parse(std::u8string_view doc, std::string && source_path);
134
152 parse_result TOML_CALLCONV parse_file(std::u8string_view file_path);
153
154#endif // TOML_HAS_CHAR8
155
156#if TOML_ENABLE_WINDOWS_COMPAT
157
182 parse_result TOML_CALLCONV parse(std::string_view doc, std::wstring_view source_path);
183
211 parse_result TOML_CALLCONV parse(std::istream & doc, std::wstring_view source_path);
212
232 parse_result TOML_CALLCONV parse_file(std::wstring_view file_path);
233
234#endif // TOML_ENABLE_WINDOWS_COMPAT
235
236#if TOML_HAS_CHAR8 && TOML_ENABLE_WINDOWS_COMPAT
237
262 parse_result TOML_CALLCONV parse(std::u8string_view doc, std::wstring_view source_path);
263
264#endif // TOML_HAS_CHAR8 && TOML_ENABLE_WINDOWS_COMPAT
265
291 parse_result TOML_CALLCONV parse(std::istream & doc, std::string_view source_path = {});
292
318 parse_result TOML_CALLCONV parse(std::istream & doc, std::string && source_path);
319
320 TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
321
322 inline namespace literals
323 {
325
348 parse_result operator"" _toml(const char* str, size_t len)
349 {
350 return parse(std::string_view{ str, len });
351 }
352
353#if TOML_HAS_CHAR8
354
377 parse_result operator"" _toml(const char8_t* str, size_t len)
378 {
379 return parse(std::u8string_view{ str, len });
380 }
381
382#endif // TOML_HAS_CHAR8
383
384 TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
385 }
386}
388
389#include "header_end.hpp"
390#endif // TOML_ENABLE_PARSER
The result of a parsing operation.
Definition parse_result.hpp:53
#define TOML_CALLCONV
Calling convention to apply to exported free/static functions. \detail Not defined by default (let th...
Definition preprocessor.hpp:1134
#define TOML_EXCEPTIONS
Sets whether the library uses exceptions to report parsing failures. \detail Defaults to 1 or 0 accor...
Definition preprocessor.hpp:1126
#define TOML_EXPORTED_FREE_FUNCTION
An 'export' annotation to add to free functions. \detail Not defined by default.
Definition preprocessor.hpp:988
Definition json.h:24463
TOML_ABI_NAMESPACE_END
Definition parser.hpp:384
TOML_NAMESPACE_START
Definition parser.hpp:15
TOML_NODISCARD TOML_EXPORTED_FREE_FUNCTION parse_result TOML_CALLCONV parse_file(std::string_view file_path)
Parses a TOML document from a file.
Definition parser.inl:3449
TOML_ABI_NAMESPACE_END
Definition parser.hpp:320
TOML_NODISCARD TOML_EXPORTED_FREE_FUNCTION parse_result TOML_CALLCONV parse(std::string_view doc, std::string_view source_path={})
Parses a TOML document from a string view.
Definition parser.inl:3427
TOML_NAMESPACE_END
Definition parser.hpp:387
#define TOML_ABI_NAMESPACE_BOOL(cond, T, F)
Definition preprocessor.hpp:1323
#define TOML_NODISCARD
Definition preprocessor.hpp:439
#define TOML_ALWAYS_INLINE
Definition preprocessor.hpp:405