using namespace alias to simplify importing iguana (#575)

This commit is contained in:
qicosmos 2024-01-22 15:46:06 +08:00 committed by GitHub
parent b7ec8af03c
commit 679cbac8f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 130 deletions

View File

@ -16,76 +16,4 @@
#pragma once
#include <iguana/json_reader.hpp>
namespace struct_json {
template <typename T, typename It>
IGUANA_INLINE void from_json(T &value, It &&it, It &&end) {
iguana::from_json(value, it, end);
}
template <typename T, typename It>
IGUANA_INLINE void from_json(T &value, It &&it, It &&end,
std::error_code &ec) noexcept {
iguana::from_json(value, it, end, ec);
}
template <typename T, typename View>
IGUANA_INLINE void from_json(T &value, const View &view) {
iguana::from_json(value, view);
}
template <typename T, typename View>
IGUANA_INLINE void from_json(T &value, const View &view,
std::error_code &ec) noexcept {
iguana::from_json(value, view, ec);
}
template <typename T, typename Byte>
IGUANA_INLINE void from_json(T &value, const Byte *data, size_t size) {
iguana::from_json(value, data, size);
}
template <typename T, typename Byte>
IGUANA_INLINE void from_json(T &value, const Byte *data, size_t size,
std::error_code &ec) noexcept {
iguana::from_json(value, data, size, ec);
}
template <typename T>
IGUANA_INLINE void from_json_file(T &value, const std::string &filename) {
iguana::from_json_file(value, filename);
}
template <typename T>
IGUANA_INLINE void from_json_file(T &value, const std::string &filename,
std::error_code &ec) noexcept {
iguana::from_json_file(value, filename, ec);
}
using numeric_str = iguana::numeric_str;
// dom parse
using jvalue = iguana::jvalue;
using jarray = iguana::jarray;
using jobject = iguana::jarray;
template <typename It>
inline void parse(jvalue &result, It &&it, It &&end) {
iguana::parse(result, it, end);
}
template <typename It>
inline void parse(jvalue &result, It &&it, It &&end, std::error_code &ec) {
iguana::parse(result, it, end, ec);
}
template <typename T, typename View>
inline void parse(T &result, const View &view) {
iguana::parse(result, view);
}
template <typename T, typename View>
inline void parse(T &result, const View &view, std::error_code &ec) {
iguana::parse(result, view, ec);
}
} // namespace struct_json
namespace struct_json = iguana;

View File

@ -17,9 +17,4 @@
#include <iguana/json_writer.hpp>
namespace struct_json {
template <typename Stream, typename T>
IGUANA_INLINE void to_json(Stream &s, T &&t) {
iguana::to_json(s, t);
}
} // namespace struct_json
namespace struct_json = iguana;

View File

@ -17,29 +17,4 @@
#include <iguana/util.hpp>
#include <iguana/xml_reader.hpp>
namespace struct_xml {
template <typename T, typename View>
inline void from_xml(T &&t, const View &str) {
iguana::from_xml(std::forward<T>(t), str);
}
template <typename Num>
inline Num get_number(std::string_view str) {
return iguana::get_number<Num>(str);
}
template <typename T, typename map_type = std::unordered_map<std::string_view,
std::string_view>>
using xml_attr_t = iguana::xml_attr_t<T, map_type>;
template <typename T>
inline constexpr std::string_view type_string() {
return iguana::type_string<T>();
}
template <auto T>
inline constexpr std::string_view enum_string() {
return iguana::enum_string<T>();
}
} // namespace struct_xml
namespace struct_xml = iguana;

View File

@ -16,10 +16,4 @@
#pragma once
#include <iguana/xml_writer.hpp>
namespace struct_xml {
template <bool pretty = false, typename Stream, typename T>
inline void to_xml(T &&t, Stream &s) {
iguana::to_xml<pretty>(std::forward<T>(t), s);
}
} // namespace struct_xml
namespace struct_xml = iguana;

View File

@ -16,15 +16,4 @@
#pragma once
#include <iguana/yaml_reader.hpp>
namespace struct_yaml {
template <typename T, typename View>
inline void from_yaml(T &value, const View &view) {
iguana::from_yaml(value, view);
}
template <typename T, typename View>
inline void from_yaml(T &value, const View &view, std::error_code &ec) {
iguana::from_yaml(value, view, ec);
}
} // namespace struct_yaml
namespace struct_yaml = iguana;

View File

@ -16,9 +16,4 @@
#pragma once
#include <iguana/yaml_writer.hpp>
namespace struct_yaml {
template <typename Stream, typename T>
inline void to_yaml(T &&t, Stream &s, size_t min_spaces = 0) {
iguana::to_yaml(std::forward<T>(t), s, min_spaces);
}
} // namespace struct_yaml
namespace struct_yaml = iguana;