Lines Matching refs:value
38 void OutputJsonKey(FILE *output, const T &value)
40 if constexpr (std::is_same<T, std::string>::value) {
41 if (value.empty()) {
45 fprintf(output, "\"%s\":", value.c_str());
46 } else if constexpr (std::is_same<T, std::string_view>::value) {
47 if (value.empty()) {
51 fprintf(output, "\"%s\":", value.data());
52 } else if constexpr (std::is_same<typename std::decay<T>::type, char *>::value) {
53 if (value[0] == '\0') {
54 // same as value.empty()
57 fprintf(output, "\"%s\":", value);
59 fprintf(output, "\"%s\":", std::to_string(value).c_str());
63 void OutputJsonValue(FILE *output, const T &value, bool first = true)
68 if constexpr (std::is_same<T, std::string>::value) {
69 fprintf(output, "\"%s\"", value.c_str());
70 } else if constexpr (std::is_same<T, std::string_view>::value) {
71 fprintf(output, "\"%s\"", value.data());
72 } else if constexpr (std::is_same<T, int>::value) {
73 fprintf(output, "%s", std::to_string(value).c_str());
74 } else if constexpr (std::is_same<T, uint64_t>::value) {
75 fprintf(output, "%s", std::to_string(value).c_str());
76 } else if constexpr (std::is_same<T, bool>::value) {
77 fprintf(output, "%s", std::to_string(value).c_str());
78 } else if constexpr (std::is_same<T, size_t>::value) {
79 fprintf(output, "%s", std::to_string(value).c_str());
80 } else if constexpr (std::is_same<typename std::decay<T>::type, char *>::value) {
81 fprintf(output, "\"%s\"", value);
83 value.OutputJson(output);
92 void OutputJsonPair(FILE *output, const K &key, const T &value, bool first = false)
102 OutputJsonValue(output, value);
109 void OutputJsonVectorList(FILE *output, const std::string &key, const std::vector<T> &value,
118 auto it = value.begin();
119 while (it != value.end()) {
120 OutputJsonValue(output, *it, it == value.begin());
133 void OutputJsonMapList(FILE *output, const std::string &key, const std::map<K, V> &value,
142 auto it = value.begin();
143 while (it != value.end()) {
144 OutputJsonValue(output, it->second, it == value.begin());
157 void OutputJsonMap(FILE *output, const std::string &key, const std::map<K, V> &value,
166 auto it = value.begin();
167 while (it != value.end()) {
168 OutputJsonPair(output, it->first, it->second, it == value.begin());