Coverage Report

Created: 2026-02-10 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/trafficserver/lib/yamlcpp/include/yaml-cpp/traits.h
Line
Count
Source
1
#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2
#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3
4
#if defined(_MSC_VER) ||                                            \
5
    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
6
     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
7
#pragma once
8
#endif
9
10
#include <type_traits>
11
#include <utility>
12
#include <string>
13
#include <sstream>
14
15
namespace YAML {
16
template <typename>
17
struct is_numeric {
18
  enum { value = false };
19
};
20
21
template <>
22
struct is_numeric<char> {
23
  enum { value = true };
24
};
25
template <>
26
struct is_numeric<unsigned char> {
27
  enum { value = true };
28
};
29
template <>
30
struct is_numeric<int> {
31
  enum { value = true };
32
};
33
template <>
34
struct is_numeric<unsigned int> {
35
  enum { value = true };
36
};
37
template <>
38
struct is_numeric<long int> {
39
  enum { value = true };
40
};
41
template <>
42
struct is_numeric<unsigned long int> {
43
  enum { value = true };
44
};
45
template <>
46
struct is_numeric<short int> {
47
  enum { value = true };
48
};
49
template <>
50
struct is_numeric<unsigned short int> {
51
  enum { value = true };
52
};
53
#if defined(_MSC_VER) && (_MSC_VER < 1310)
54
template <>
55
struct is_numeric<__int64> {
56
  enum { value = true };
57
};
58
template <>
59
struct is_numeric<unsigned __int64> {
60
  enum { value = true };
61
};
62
#else
63
template <>
64
struct is_numeric<long long> {
65
  enum { value = true };
66
};
67
template <>
68
struct is_numeric<unsigned long long> {
69
  enum { value = true };
70
};
71
#endif
72
template <>
73
struct is_numeric<float> {
74
  enum { value = true };
75
};
76
template <>
77
struct is_numeric<double> {
78
  enum { value = true };
79
};
80
template <>
81
struct is_numeric<long double> {
82
  enum { value = true };
83
};
84
85
template <bool, class T = void>
86
struct enable_if_c {
87
  using type = T;
88
};
89
90
template <class T>
91
struct enable_if_c<false, T> {};
92
93
template <class Cond, class T = void>
94
struct enable_if : public enable_if_c<Cond::value, T> {};
95
96
template <bool, class T = void>
97
struct disable_if_c {
98
  using type = T;
99
};
100
101
template <class T>
102
struct disable_if_c<true, T> {};
103
104
template <class Cond, class T = void>
105
struct disable_if : public disable_if_c<Cond::value, T> {};
106
}
107
108
template <typename S, typename T>
109
struct is_streamable {
110
  template <typename StreamT, typename ValueT>
111
  static auto test(int)
112
      -> decltype(std::declval<StreamT&>() << std::declval<ValueT>(), std::true_type());
113
114
  template <typename, typename>
115
  static auto test(...) -> std::false_type;
116
117
  static const bool value = decltype(test<S, T>(0))::value;
118
};
119
120
template<typename Key, bool Streamable>
121
struct streamable_to_string {
122
5.51k
  static std::string impl(const Key& key) {
123
5.51k
    std::stringstream ss;
124
5.51k
    ss << key;
125
5.51k
    return ss.str();
126
5.51k
  }
Unexecuted instantiation: streamable_to_string<YAML::Node, true>::impl(YAML::Node const&)
streamable_to_string<char [3], true>::impl(char const (&) [3])
Line
Count
Source
122
2.76k
  static std::string impl(const Key& key) {
123
2.76k
    std::stringstream ss;
124
2.76k
    ss << key;
125
2.76k
    return ss.str();
126
2.76k
  }
streamable_to_string<char [8], true>::impl(char const (&) [8])
Line
Count
Source
122
1.98k
  static std::string impl(const Key& key) {
123
1.98k
    std::stringstream ss;
124
1.98k
    ss << key;
125
1.98k
    return ss.str();
126
1.98k
  }
streamable_to_string<char [7], true>::impl(char const (&) [7])
Line
Count
Source
122
759
  static std::string impl(const Key& key) {
123
759
    std::stringstream ss;
124
759
    ss << key;
125
759
    return ss.str();
126
759
  }
127
};
128
129
template<typename Key>
130
struct streamable_to_string<Key, false> {
131
0
  static std::string impl(const Key&) {
132
0
    return "";
133
0
  }
134
};
135
#endif  // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66