refactor: re-place files into correct position according to namespace hierarchy
This commit is contained in:
		
							
								
								
									
										0
									
								
								src/yycc/encoding/iconv.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/iconv.cpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/iconv.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/iconv.hpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/united_codec.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/united_codec.cpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/united_codec.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/united_codec.hpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/utf.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/utf.hpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/windows.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/windows.cpp
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								src/yycc/encoding/windows.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/yycc/encoding/windows.hpp
									
									
									
									
									
										Normal file
									
								
							@ -1,7 +1,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "../string.hpp"
 | 
			
		||||
#include "op.hpp"
 | 
			
		||||
#include "reinterpret.hpp"
 | 
			
		||||
#include "../string/op.hpp"
 | 
			
		||||
#include "../string/reinterpret.hpp"
 | 
			
		||||
#include <charconv>
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
#include <type_traits>
 | 
			
		||||
@ -18,7 +18,7 @@
 | 
			
		||||
 * and boolean values. It uses \c std::from_chars internally for efficient parsing.
 | 
			
		||||
 * @remarks See https://zh.cppreference.com/w/cpp/utility/from_chars for underlying called functions.
 | 
			
		||||
 */
 | 
			
		||||
namespace yycc::string::parse {
 | 
			
		||||
namespace yycc::num::parse {
 | 
			
		||||
 | 
			
		||||
    /// @private
 | 
			
		||||
    /// @brief The error kind when parsing string into number.
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "../string.hpp"
 | 
			
		||||
#include "reinterpret.hpp"
 | 
			
		||||
#include "../string/reinterpret.hpp"
 | 
			
		||||
#include <array>
 | 
			
		||||
#include <charconv>
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
@ -18,7 +18,7 @@
 | 
			
		||||
 * See https://en.cppreference.com/w/cpp/utility/to_chars for underlying called functions.
 | 
			
		||||
 * Default float precision = 6 is gotten from: https://en.cppreference.com/w/c/io/fprintf
 | 
			
		||||
 */
 | 
			
		||||
namespace yycc::string::stringify {
 | 
			
		||||
namespace yycc::num::stringify {
 | 
			
		||||
 | 
			
		||||
    /// @private
 | 
			
		||||
    /// @brief Size of the internal buffer used for string conversion.
 | 
			
		||||
@ -1,11 +1,11 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "../macro/feature_probe.hpp"
 | 
			
		||||
#include "../string/parse.hpp"
 | 
			
		||||
#include "panic.hpp"
 | 
			
		||||
#include "result.hpp"
 | 
			
		||||
#include "../../macro/feature_probe.hpp"
 | 
			
		||||
#include "../../num/parse.hpp"
 | 
			
		||||
#include "../panic.hpp"
 | 
			
		||||
#include "../result.hpp"
 | 
			
		||||
 | 
			
		||||
#define NS_YYCC_STRING ::yycc::string
 | 
			
		||||
#define NS_YYCC_STRING_PARSE ::yycc::string::parse
 | 
			
		||||
#define NS_YYCC_NUM_PARSE ::yycc::num::parse
 | 
			
		||||
#define NS_YYCC_RUST_RESULT ::yycc::rust::result
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -15,12 +15,12 @@
 | 
			
		||||
 * This namespace contains template functions for parsing strings into different types
 | 
			
		||||
 * (floating-point, integral, boolean) with Rust-like Result error handling.
 | 
			
		||||
 */
 | 
			
		||||
namespace yycc::rust::parse {
 | 
			
		||||
namespace yycc::rust::num::parse {
 | 
			
		||||
 | 
			
		||||
#if defined(YYCC_CPPFEAT_EXPECTED)
 | 
			
		||||
 | 
			
		||||
    /// @brief The error type of parsing.
 | 
			
		||||
    using Error = NS_YYCC_STRING_PARSE::ParseError;
 | 
			
		||||
    using Error = NS_YYCC_NUM_PARSE::ParseError;
 | 
			
		||||
 | 
			
		||||
    /// @brief The result type of parsing.
 | 
			
		||||
    /// @tparam T The expected value type in result.
 | 
			
		||||
@ -37,7 +37,7 @@ namespace yycc::rust::parse {
 | 
			
		||||
    template<typename T, std::enable_if_t<std::is_floating_point_v<T>, int> = 0>
 | 
			
		||||
    Result<T> parse(const NS_YYCC_STRING::u8string_view& strl,
 | 
			
		||||
            std::chars_format fmt = std::chars_format::general) {
 | 
			
		||||
        auto rv = NS_YYCC_STRING_PARSE::priv_parse<T>(strl, fmt);
 | 
			
		||||
        auto rv = NS_YYCC_NUM_PARSE::priv_parse<T>(strl, fmt);
 | 
			
		||||
 | 
			
		||||
        if (const auto* ptr = std::get_if<T>(&rv)) {
 | 
			
		||||
            return NS_YYCC_RUST_RESULT::Ok<Result<T>>(*ptr);
 | 
			
		||||
@ -58,7 +58,7 @@ namespace yycc::rust::parse {
 | 
			
		||||
     */
 | 
			
		||||
    template<typename T, std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, int> = 0>
 | 
			
		||||
    Result<T> parse(const NS_YYCC_STRING::u8string_view& strl, int base = 10) {
 | 
			
		||||
        auto rv = NS_YYCC_STRING_PARSE::priv_parse<T>(strl, base);
 | 
			
		||||
        auto rv = NS_YYCC_NUM_PARSE::priv_parse<T>(strl, base);
 | 
			
		||||
 | 
			
		||||
        if (const auto* ptr = std::get_if<T>(&rv)) {
 | 
			
		||||
            return NS_YYCC_RUST_RESULT::Ok<Result<T>>(*ptr);
 | 
			
		||||
@ -78,7 +78,7 @@ namespace yycc::rust::parse {
 | 
			
		||||
     */
 | 
			
		||||
    template<typename T, std::enable_if_t<std::is_same_v<T, bool>, int> = 0>
 | 
			
		||||
    Result<T> parse(const NS_YYCC_STRING::u8string_view& strl) {
 | 
			
		||||
        auto rv = NS_YYCC_STRING_PARSE::priv_parse<T>(strl);
 | 
			
		||||
        auto rv = NS_YYCC_NUM_PARSE::priv_parse<T>(strl);
 | 
			
		||||
 | 
			
		||||
        if (const auto* ptr = std::get_if<T>(&rv)) {
 | 
			
		||||
            return NS_YYCC_RUST_RESULT::Ok<Result<T>>(*ptr);
 | 
			
		||||
@ -95,5 +95,5 @@ namespace yycc::rust::parse {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#undef NS_YYCC_RUST_RESULT
 | 
			
		||||
#undef NS_YYCC_STRING_PARSE
 | 
			
		||||
#undef NS_YYCC_NUM_PARSE
 | 
			
		||||
#undef NS_YYCC_STRING
 | 
			
		||||
@ -1,10 +1,10 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "../string/stringify.hpp"
 | 
			
		||||
#include "../../num/stringify.hpp"
 | 
			
		||||
 | 
			
		||||
namespace yycc::rust::stringify {
 | 
			
		||||
namespace yycc::rust::num::stringify {
 | 
			
		||||
 | 
			
		||||
    // There is no modification for legacy "stringify" functions like "parse".
 | 
			
		||||
    // So we simply expose all functions into this namespace.
 | 
			
		||||
    using namespace ::yycc::string::stringify;
 | 
			
		||||
    using namespace ::yycc::num::stringify;
 | 
			
		||||
 | 
			
		||||
} // namespace yycc::rust::stringify
 | 
			
		||||
		Reference in New Issue
	
	Block a user