GCC Code Coverage Report


Directory: libimgdoc2/
File: libimgdoc2/src/public/OpenExistingOptions.cpp
Date: 2025-02-03 12:41:04
Exec Total Coverage
Lines: 13 17 76.5%
Functions: 6 8 75.0%
Branches: 1 4 25.0%

Line Branch Exec Source
1 // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH
2 //
3 // SPDX-License-Identifier: MIT
4
5 #include <string>
6 #include <unordered_set>
7 #include <imgdoc2.h>
8
9 using namespace imgdoc2;
10
11 class OpenExistingOptions : public imgdoc2::IOpenExistingOptions
12 {
13 private:
14 std::string filename_;
15 bool read_only_{false};
16 public:
17 10 OpenExistingOptions() = default;
18
19 4 void SetFilename(const char* filename) override
20 {
21 4 this->filename_ = filename;
22 4 }
23
24 2 void SetOpenReadonly(bool read_only) override
25 {
26 2 this->read_only_ = read_only;
27 2 }
28
29 4 [[nodiscard]] bool GetOpenReadonly() const override
30 {
31 4 return this->read_only_;
32 }
33
34 4 [[nodiscard]] const std::string& GetFilename() const override
35 {
36 4 return this->filename_;
37 }
38 };
39
40 /*static*/IOpenExistingOptions* imgdoc2::ClassFactory::CreateOpenExistingOptions()
41 {
42 return new OpenExistingOptions();
43 }
44
45 10 /*static*/std::unique_ptr<imgdoc2::IOpenExistingOptions> imgdoc2::ClassFactory::CreateOpenExistingOptionsUp()
46 {
47
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 return make_unique<OpenExistingOptions>();
48 }
49
50 /*static*/std::shared_ptr<imgdoc2::IOpenExistingOptions> imgdoc2::ClassFactory::CreateOpenExistingOptionsSp()
51 {
52 return make_shared<OpenExistingOptions>();
53 }
54