LCOV - code coverage report
Current view: top level - usr/include/yaml-cpp - traits.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 5 5 100.0 %
Date: 2025-08-24 09:11:10 Functions: 2 9 22.2 %

          Line data    Source code
       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 SS, typename TT>
     111             :   static auto test(int)
     112             :       -> decltype(std::declval<SS&>() << std::declval<TT>(), 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          12 :   static std::string impl(const Key& key) {
     123          12 :     std::stringstream ss;
     124          12 :     ss << key;
     125          24 :     return ss.str();
     126          12 :   }
     127             : };
     128             : 
     129             : template<typename Key>
     130             : struct streamable_to_string<Key, false> {
     131             :   static std::string impl(const Key&) {
     132             :     return "";
     133             :   }
     134             : };
     135             : #endif  // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66

Generated by: LCOV version 1.14