<commit_before>#pragma once
#ifndef liuzianglib_jsonBuidler
#define liuzianglib_jsonBuilder
#include <vector>
#include <string>
#include "liuzianglib.h"
#include "DC_STR.h"
//Version 2.4.2V45
//20170604

namespace DC {

	namespace Web {

		namespace jsonBuilder {

			namespace jsonBuilderSpace {
			
				enum DataType {
					string_t,
					int_t,
					double_t,
					null_t,
					bool_t,
					empty_t
				};

				class NV_base {//numbervalueĻ
				public:
					virtual ~NV_base() = default;

				public:
					inline void fromNull(void) {
						rawStr = "null";
						type = jsonBuilderSpace::DataType::null_t;
					}

					inline jsonBuilderSpace::DataType getType()const noexcept {
						return this->type;
					}

					inline std::string getValue()const {
						switch (type) {
						case jsonBuilderSpace::DataType::bool_t: {
							if (rawStr == "1") return "true";
							return "false";
						}break;
						case jsonBuilderSpace::DataType::double_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::empty_t: {
							throw DC::Exception("jsonBuilder::jsonBuilderSpace::NV_base", "empty value");
						}break;
						case jsonBuilderSpace::DataType::int_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::null_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::string_t: {
							return '"' + rawStr + '"';
						}break;
						}
					}

					inline void clear() {
						rawStr.clear();
						type = DataType::empty_t;
					}

				protected:
					std::string rawStr;
					DataType type;
				};

				class JSKeyValuePair final :public DC::KeyValuePair {
				public:
					JSKeyValuePair(const JSKeyValuePair&) = default;

					JSKeyValuePair(JSKeyValuePair&& input) {
						name = std::move(input.name);
						value = std::move(input.value);
						OK = input.OK;
						input.OK = false;
					}

				public:
					template <typename T>
					inline void SetName(T&& input) {
						this->name = std::forward<T>(input);
					}

					template <typename T>
					inline void SetValue(T&& input) {
						this->value = std::forward<T>(input);
					}

					virtual inline char GetSeparator()const noexcept { return 0; }
				};

			}

			class value final :public jsonBuilderSpace::NV_base {
			public:
				value() {
					type = jsonBuilderSpace::DataType::empty_t;
				}

				value(const value&) = default;

				value(value&& input) {
					this->rawStr = std::move(input.rawStr);
					this->type = input.type;
					input.type = jsonBuilderSpace::DataType::empty_t;
				}

			public:
				template <typename T>
				inline void fromString(T&& input) {
					static_assert(std::is_same<std::string, typename std::decay<T>::type>::value, "input type should be std::string");
					rawStr = std::forward<T>(input);
					type = jsonBuilderSpace::DataType::string_t;
				}

				inline void fromBool(const bool& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::bool_t;
				}
			};

			class number final :public jsonBuilderSpace::NV_base {
			public:
				number() {
					type = jsonBuilderSpace::DataType::empty_t;
				}

				number(const number&) = default;

				number(number&& input) {
					this->rawStr = std::move(input.rawStr);
					this->type = input.type;
					input.type = jsonBuilderSpace::DataType::empty_t;
				}

			public:
				inline void fromInt32(const int32_t& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::int_t;
				}

				inline void fromDouble(const double& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::double_t;
				}
			};

			class object final {
			public:
				object() = default;

				object(const object&) = default;

				object(object&&) = default;

			public:
				std::string toString()const {}

				template <typename ...ARGS>
				inline void add(ARGS&& ...args) {
					m_data.emplace_back(std::forward<ARGS>(args)...);
				}

				inline void add(const jsonBuilderSpace::JSKeyValuePair& input) {
					m_data.push_back(input);
				}

				inline void add(jsonBuilderSpace::JSKeyValuePair&& input) {
					m_data.push_back(std::move(input));
				}

				inline void clear() {
					m_data.clear();
				}

			private:
				std::vector<jsonBuilderSpace::JSKeyValuePair> m_data;
			};

		}

	}

}

#endif<commit_msg>liuzianglib beta 2.4.2V46,20170605<commit_after>#pragma once
#ifndef liuzianglib_jsonBuidler
#define liuzianglib_jsonBuilder
#include <vector>
#include <string>
#include "liuzianglib.h"
#include "DC_STR.h"
//Version 2.4.2V46
//20170605

namespace DC {

	namespace Web {

		namespace jsonBuilder {

			namespace jsonBuilderSpace {
			
				enum DataType {
					string_t,
					int_t,
					double_t,
					null_t,
					bool_t,
					empty_t
				};

				class NV_base {//numbervalueĻ
				public:
					NV_base() : type(jsonBuilderSpace::DataType::empty_t) {}

					NV_base(const NV_base&) = default;

					NV_base(NV_base&& input) {
						this->rawStr = std::move(input.rawStr);
						this->type = input.type;
						input.type = jsonBuilderSpace::DataType::empty_t;
					}

					virtual ~NV_base() = default;

				public:
					inline void fromNull(void) {
						rawStr = "null";
						type = jsonBuilderSpace::DataType::null_t;
					}

					inline jsonBuilderSpace::DataType getType()const noexcept {
						return this->type;
					}

					inline std::string toString()const {
						switch (type) {
						case jsonBuilderSpace::DataType::bool_t: {
							if (rawStr == "1") return "true";
							return "false";
						}break;
						case jsonBuilderSpace::DataType::double_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::empty_t: {
							throw DC::Exception("jsonBuilder::jsonBuilderSpace::NV_base", "empty value");
						}break;
						case jsonBuilderSpace::DataType::int_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::null_t: {
							return rawStr;
						}break;
						case jsonBuilderSpace::DataType::string_t: {
							return '"' + rawStr + '"';
						}break;
						default: {
							throw DC::Exception("jsonBuilder::jsonBuilderSpace::NV_base", "bad type");
						}
						}
					}

					inline void clear() {
						rawStr.clear();
						type = DataType::empty_t;
					}

				protected:
					std::string rawStr;
					DataType type;
				};

				class JSKeyValuePair final :public DC::KeyValuePair {
				public:
					JSKeyValuePair() :DC::KeyValuePair::KeyValuePair() {}

					template <typename T, typename T2>
					JSKeyValuePair(T&& inputname, T2&& inputvalue) {
						static_assert(std::is_same<std::string, typename std::decay<T>::type>::value, "input type should be std::string");
						static_assert(std::is_same<std::string, typename std::decay<T2>::type>::value, "input type should be std::string");
						this->name = std::forward<T>(inputname);
						this->value = std::forward<T2>(inputvalue);
					}

					JSKeyValuePair(const JSKeyValuePair&) = default;

					JSKeyValuePair(JSKeyValuePair&& input) :DC::KeyValuePair::KeyValuePair(std::move(input)) {}

				public:
					template <typename T>
					inline void SetName(T&& input) {
						this->name = std::forward<T>(input);
					}

					template <typename T>
					inline void SetValue(T&& input) {
						this->value = std::forward<T>(input);
					}

					virtual inline char GetSeparator()const noexcept override {
						return 0;
					}
				};

			}

			class value final :public jsonBuilderSpace::NV_base {
			public:
				value() :NV_base() {}

				template <typename T, class = typename std::enable_if<!std::is_same<typename std::decay<T>::type, value>::value, T>::type, class = typename std::enable_if<!std::is_same<typename std::decay<T>::type, bool>::value, T>::type>
				value(T&& inputstr) {
					this->fromString(std::forward<T>(inputstr));
				}

				value(const char* const inputstr) {
					this->fromString(std::string(inputstr));
				}

				value(const bool& inputbool) {
					this->fromBool(inputbool);
				}

				value(const value& input) :NV_base(input) {}

				value(value&& input) :NV_base(std::move(input)) {}

			public:
				template <typename T>
				inline void fromString(T&& input) {
					static_assert(std::is_same<std::string, typename std::decay<T>::type>::value, "input type should be std::string");
					rawStr = std::forward<T>(input);
					type = jsonBuilderSpace::DataType::string_t;
				}

				inline void fromBool(const bool& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::bool_t;
				}
			};

			class number final :public jsonBuilderSpace::NV_base {
			public:
				number() :NV_base() {}
				
				number(const int32_t& input) {
					this->fromInt32(input);
				}

				number(const double& input) {
					this->fromDouble(input);
				}

				number(const number& input) :NV_base(input) {}

				number(number&& input) :NV_base(std::move(input)) {}

			public:
				inline void fromInt32(const int32_t& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::int_t;
				}

				inline void fromDouble(const double& input) {
					rawStr = DC::STR::toString(input);
					type = jsonBuilderSpace::DataType::double_t;
				}
			};
			
			template <typename T>
			inline T getNull() {//һںnullvaluenumber(ͨģָ)
				static_assert(std::is_same<number, typename std::decay<T>::type>::value || std::is_same<value, typename std::decay<T>::type>::value, "input type should be jsonBuilder::value or jsonBuilder::number");
				T rv;
				rv.fromNull();
				return rv;
			}

			class object final {
			public:
				object() = default;

				object(const object&) = default;

				object(object&&) = default;

			public:
				std::string toString()const {}

				inline void add(const std::string& name, const jsonBuilderSpace::NV_base& v) {
					m_data.emplace_back(name, v.toString());
				}

				inline void clear() {
					m_data.clear();
				}

			private:
				std::vector<jsonBuilderSpace::JSKeyValuePair> m_data;
			};

		}

	}

}

#endif
{'fraction_non_alphanumeric': 0.13867442093652863, 'fraction_numerical': 0.005915973127444099, 'mean_word_length': 3.0462474645030424, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1252783', 'n_tokens_mistral': 4412, 'n_tokens_neox': 3194, 'n_words': 647}