Branch data TLA Line data Source code
1 : : // Copyright (c) 2014-2022 Thomas Fussell
2 : : // Copyright (c) 2010-2015 openpyxl
3 : : // Copyright (c) 2024-2025 xlnt-community
4 : : //
5 : : // Permission is hereby granted, free of charge, to any person obtaining a copy
6 : : // of this software and associated documentation files (the "Software"), to deal
7 : : // in the Software without restriction, including without limitation the rights
8 : : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 : : // copies of the Software, and to permit persons to whom the Software is
10 : : // furnished to do so, subject to the following conditions:
11 : : //
12 : : // The above copyright notice and this permission notice shall be included in
13 : : // all copies or substantial portions of the Software.
14 : : //
15 : : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 : : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 : : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 : : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 : : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 : : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 : : // THE SOFTWARE
22 : : //
23 : : // @license: http://www.opensource.org/licenses/mit-license.php
24 : : // @author: see AUTHORS file
25 : :
26 : : #include <xlnt/utils/exceptions.hpp>
27 : :
28 : : namespace xlnt {
29 : :
30 :CBC 164 : exception::exception(const std::string &message)
31 [ + + ]: 164 : : std::runtime_error("xlnt::exception : " + message)
32 : : {
33 [ + ]: 164 : this->message(message);
34 : 164 : }
35 : :
36 : 285 : exception::~exception() = default;
37 : :
38 : 164 : void exception::message(const std::string &message)
39 : : {
40 : 164 : message_ = message;
41 : 164 : }
42 : :
43 :UBC 0 : const std::string & exception::message()
44 : : {
45 : 0 : return message_;
46 : : }
47 : :
48 : 0 : unhandled_switch_case::unhandled_switch_case()
49 [ # # ]: 0 : : xlnt::exception("unhandled switch case")
50 : : {
51 : 0 : }
52 : :
53 : 0 : unhandled_switch_case::~unhandled_switch_case()
54 : : {
55 : 0 : }
56 : :
57 :CBC 11 : invalid_sheet_title::invalid_sheet_title(const std::string &title)
58 [ + + + ]: 22 : : exception(std::string("bad worksheet title: ") + title)
59 : : {
60 : 11 : }
61 : :
62 : 22 : invalid_sheet_title::~invalid_sheet_title()
63 : : {
64 : 22 : }
65 : :
66 : 4 : invalid_column_index::invalid_column_index()
67 [ + + ]: 8 : : exception("column string index error")
68 : : {
69 : 4 : }
70 : :
71 : 8 : invalid_column_index::~invalid_column_index()
72 : : {
73 : 8 : }
74 : :
75 : 2 : invalid_data_type::invalid_data_type()
76 [ + + ]: 4 : : exception("data type error")
77 : : {
78 : 2 : }
79 : :
80 : 2 : invalid_data_type::~invalid_data_type()
81 : : {
82 : 2 : }
83 : :
84 : 1 : invalid_file::invalid_file(const std::string &reason)
85 [ + + + ]: 2 : : exception(std::string("couldn't load file, reason given: ") + reason)
86 : : {
87 : 1 : }
88 : :
89 : 2 : invalid_file::~invalid_file()
90 : : {
91 : 2 : }
92 : :
93 : 1 : invalid_cell_reference::invalid_cell_reference(column_t column, row_t row)
94 : : : exception(
95 [ + + + + : 3 : std::string("bad cell coordinates: (") + std::to_string(column.index) + ", " + std::to_string(row) + ")")
+ + ]
96 : : {
97 : 1 : }
98 : :
99 : 17 : invalid_cell_reference::invalid_cell_reference(const std::string &coord_string)
100 [ + + + + : 54 : : exception(std::string("bad cell coordinates: (") + (coord_string.empty() ? "<empty>" : coord_string) + ")")
+ + + + +
+ - - ]
101 : : {
102 : 17 : }
103 : :
104 : 28 : invalid_cell_reference::~invalid_cell_reference()
105 : : {
106 : 28 : }
107 : :
108 : 29 : illegal_character::illegal_character(char c)
109 [ + + + + ]: 87 : : exception(std::string("illegal character: (") + std::to_string(static_cast<unsigned char>(c)) + ")")
110 : : {
111 : 29 : }
112 : :
113 : 58 : illegal_character::~illegal_character()
114 : : {
115 : 58 : }
116 : :
117 : 13 : invalid_parameter::invalid_parameter(const char *optional_message)
118 [ + + + + ]: 26 : : exception(optional_message != nullptr ? optional_message : "invalid parameter")
119 : : {
120 : 13 : }
121 : :
122 : 24 : invalid_parameter::~invalid_parameter()
123 : : {
124 : 24 : }
125 : :
126 : 26 : invalid_attribute::invalid_attribute(const char *optional_message)
127 [ + + + + ]: 52 : : exception(optional_message != nullptr ? optional_message : "bad attribute")
128 : : {
129 : 26 : }
130 : :
131 : 47 : invalid_attribute::~invalid_attribute()
132 : : {
133 : 47 : }
134 : :
135 : 13 : key_not_found::key_not_found()
136 [ + + ]: 26 : : exception("key not found in container")
137 : : {
138 : 13 : }
139 : :
140 : 22 : key_not_found::~key_not_found()
141 : : {
142 : 22 : }
143 : :
144 :UBC 0 : no_visible_worksheets::no_visible_worksheets()
145 [ # # ]: 0 : : exception("workbook needs at least one non-hidden worksheet to be saved")
146 : : {
147 : 0 : }
148 : :
149 : 0 : no_visible_worksheets::~no_visible_worksheets()
150 : : {
151 : 0 : }
152 : :
153 : 0 : unsupported::unsupported(const std::string &message)
154 : 0 : : exception(message)
155 : : {
156 : 0 : }
157 : :
158 : 0 : unsupported::~unsupported()
159 : : {
160 : 0 : }
161 : :
162 : : } // namespace xlnt
|