🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
GenericValue.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/ParseFormat.hpp"
25#include <string>
26
27AST_NAMESPACE_BEGIN
28
34{
35public:
36 GenericValue() = default;
38 : value_(value){}
39 GenericValue(const char* value)
40 : value_(value){}
41 GenericValue(const std::string& value)
42 : value_(value){}
43 GenericValue(int value)
44 : value_(aFormatInt(value)){}
45 GenericValue(double value)
46 : value_(aFormatDouble(value)){}
47 GenericValue(bool value)
48 : value_(aFormatBool(value)){}
49 GenericValue(Color value)
50 : value_(aFormatColor(value)){}
51
52 const std::string& value() const { return value_; }
53 const char* c_str() const { return value_.c_str(); }
54protected:
55 std::string value_;
56};
57
58AST_NAMESPACE_END
颜色类
定义 Color.hpp:87
通用值类
定义 GenericValue.hpp:34
errc_t aFormatDouble(double value, std::string &str, int precision)
将双精度浮点数格式化为字符串
定义 ParseFormat.cpp:500
errc_t aFormatColor(Color value, std::string &str)
将颜色值格式化为字符串
定义 ParseFormat.cpp:511
errc_t aFormatInt(int value, std::string &str)
将整数格式化为字符串
定义 ParseFormat.cpp:453
void aFormatBool(bool value, std::string &str)
将布尔值格式化为字符串
定义 ParseFormat.cpp:448