Coverage Report

Created: 2025-09-22 13:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/be/src/util/to_string.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
//
18
19
#pragma once
20
21
#include <absl/strings/ascii.h>
22
#include <fmt/compile.h>
23
#include <fmt/format.h>
24
#include <glog/logging.h>
25
26
#include <cfloat>
27
#include <map>
28
#include <set>
29
#include <string>
30
#include <type_traits>
31
#include <vector>
32
33
namespace doris {
34
35
template <typename T>
36
21
std::string to_string(const T& t) {
37
21
    return fmt::format("{}", t);
38
21
}
_ZN5doris9to_stringISt6atomicINS_19TWgSlotMemoryPolicy4typeEEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_
Line
Count
Source
36
21
std::string to_string(const T& t) {
37
21
    return fmt::format("{}", t);
38
21
}
Unexecuted instantiation: _ZN5doris9to_stringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES6_RKT_
39
40
template <typename K, typename V>
41
std::string to_string(const std::map<K, V>& m);
42
43
template <typename T>
44
std::string to_string(const std::set<T>& s);
45
46
template <typename T>
47
std::string to_string(const std::vector<T>& t);
48
49
template <typename K, typename V>
50
std::string to_string(const typename std::pair<K, V>& v) {
51
    return fmt::format("{}: {}", to_string(v.first), to_string(v.second));
52
}
53
54
template <typename T>
55
0
std::string to_string(const T& beg, const T& end) {
56
0
    std::string out;
57
0
    for (T it = beg; it != end; ++it) {
58
0
        if (it != beg) out += ", ";
59
0
        out += to_string(*it);
60
0
    }
61
0
    return out;
62
0
}
63
64
template <typename T>
65
0
std::string to_string(const std::vector<T>& t) {
66
0
    return "[" + to_string(t.begin(), t.end()) + "]";
67
0
}
68
69
template <typename K, typename V>
70
std::string to_string(const std::map<K, V>& m) {
71
    return "{" + to_string(m.begin(), m.end()) + "}";
72
}
73
74
template <typename T>
75
std::string to_string(const std::set<T>& s) {
76
    return "{" + to_string(s.begin(), s.end()) + "}";
77
}
78
79
} // namespace doris