/** rjp++ Copyright (C) 2020 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef RJP_HPP_INTERNAL #define RJP_HPP_INTERNAL #include #include "string.hpp" #include "value.hpp" #include //move namespace rjp{ string to_json(const value& val, int format = RJP_FORMAT_PRETTY); value parse_json(const rexy::string_base& str); value parse_json(const char* str); namespace detail{ template,std::remove_reference_t>::value> struct convert_helper; template struct convert_helper{ static To perform(From&& t){ return To(std::move(t)); } }; template struct convert_helper{ static To perform(const From& t){ return To(const_cast(t.raw()), false); } }; template struct convert_helper{ static decltype(auto) perform(From&& t){ return std::forward(t); } }; } template To convert(From&& from){ return detail::convert_helper::perform(std::forward(from)); } namespace detail{ template struct get_ref{ using type = std::remove_reference_t; }; template struct get_ref{ using type = std::remove_reference_t&; }; template struct get_ref{ using type = std::remove_reference_t&&; }; } template decltype(auto) cast(From&& from){ return static_cast::type>(std::forward(from)); } } #endif