GCC Code Coverage Report


Directory: src/gate/
File: src/gate/cxx_guids.cpp
Date: 2025-09-14 13:10:38
Exec Total Coverage
Lines: 39 39 100.0%
Functions: 13 13 100.0%
Branches: 7 20 35.0%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright(c) 2018-2025, Stefan Meislinger <sm@opengate.at> |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28 #include "gate/guids.hpp"
29 #include "gate/exceptions.hpp"
30
31 namespace gate
32 {
33
34
35 6 Guid::Guid()
36 6 : gate_guid_t(gate_guid_t())
37 {
38 6 }
39 1 Guid::Guid(gate_guid_t const& guid)
40 1 : gate_guid_t(guid)
41 {
42 1 }
43 1 Guid::Guid(Guid const& guid)
44 1 : gate_guid_t(guid)
45 {
46 1 }
47 1 Guid& Guid::operator=(Guid const& guid)
48 {
49 1 gate_guid_t& self = *this;
50 1 self = guid;
51 1 return *this;
52 }
53 8 Guid::~Guid()
54 {
55 8 }
56
57 1 bool Guid::operator==(Guid const& that) const
58 {
59 1 return gate_guid_equals(this, &that);
60 }
61 6 bool Guid::operator!=(Guid const& that) const
62 {
63 6 return !gate_guid_equals(this, &that);
64 }
65
66 2 bool Guid::operator==(gate_guid_t const& that) const
67 {
68 2 return gate_guid_equals(this, &that);
69 }
70 1 bool Guid::operator!=(gate_guid_t const& that) const
71 {
72 1 return !gate_guid_equals(this, &that);
73 }
74
75 3 Guid Guid::generate()
76 {
77 3 Guid tmp;
78
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 result_t res = gate_guid_generate(&tmp);
79
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
3 GATEXX_CHECK_ERROR(res);
80 3 return tmp;
81 }
82 1 Guid Guid::parse(String const& text)
83 {
84 1 Guid tmp;
85
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t res = gate_guid_parse_string(text.c_str(), text.size(), &tmp);
86
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(res);
87 1 return tmp;
88 }
89
90 2 String Guid::toString() const
91 {
92 char buffer[64];
93
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 result_t res = gate_guid_to_string(this, buffer);
94
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 GATEXX_CHECK_ERROR(res);
95
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 return String(&buffer[0]);
96 }
97
98 1 gate_guid_t const* Guid::c_impl() const
99 {
100 1 return static_cast<gate_guid_t const*>(this);
101 }
102
103
104 } // end of namespace gate
105