GCC Code Coverage Report


Directory: ./
File: Fw/Types/StringTemplate.hpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 16 16 100.0%
Functions: 47 47 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 // ======================================================================
2 // @file StringTemplate.hpp
3 // @author Rob Bocchino
4 // @brief A string template parameterized by size
5 // ======================================================================
6
7 #ifndef FW_STRING_TEMPLATE_HPP
8 #define FW_STRING_TEMPLATE_HPP
9
10 #include <Fw/FPrimeBasicTypes.hpp>
11
12 #include "Fw/Types/StringBase.hpp"
13
14 namespace Fw {
15
16 template <Fw::StringBase::SizeType size>
17 class StringTemplate final : public StringBase {
18 public:
19 enum {
20 STRING_SIZE = size,
21 SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE),
22 };
23
24
1/1
✓ Branch 11 taken 18731205 times.
37255675 StringTemplate() : StringBase() { *this = ""; }
25
26
1/1
✓ Branch 11 taken 67353 times.
67593 StringTemplate(const StringTemplate& src) : StringBase() { *this = src; }
27
28
1/1
✓ Branch 11 taken 42354 times.
43032 StringTemplate(const ConstStringBase& src) : StringBase() { *this = src; }
29
30
1/1
✓ Branch 11 taken 74923 times.
134613 StringTemplate(const char* src) : StringBase() { *this = src; }
31
32 37831670 ~StringTemplate() {}
33
34 183125 StringTemplate& operator=(const StringTemplate& src) {
35 183125 (void)StringBase::operator=(src);
36 183125 return *this;
37 }
38
39 43974 StringTemplate& operator=(const ConstStringBase& src) {
40 43974 (void)StringBase::operator=(src);
41 43974 return *this;
42 }
43
44 37787468 StringTemplate& operator=(const char* src) {
45 37787468 (void)StringBase::operator=(src);
46 37787468 return *this;
47 }
48
49 25783613 const char* toChar() const { return this->m_buf; }
50
51 38695901 StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }
52
53 private:
54 char m_buf[BUFFER_SIZE(size)];
55 };
56 } // namespace Fw
57
58 #endif
59