Skip to content

Commit 5e7d5fe

Browse files
committed
format
1 parent 975b0fb commit 5e7d5fe

4 files changed

Lines changed: 53 additions & 59 deletions

File tree

src/svgdom/elements/shapes.cpp

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,12 @@ decltype(path_element::path) path_element::parse(std::string_view str)
240240

241241
p.skip_whitespaces_and_comma();
242242
}
243-
// NOLINTNEXTLINE(bugprone-empty-catch)
244-
} catch (
245-
std::invalid_argument&
246-
#ifdef DEBUG
247-
e
248-
#endif
249-
)
250-
{
251-
LOG([&](auto& o) {
243+
} catch (std::invalid_argument& e) {
244+
utki::log_debug([&](auto& o) {
252245
o << "WARNING: path_element::parse(): std::invalid_argument exception caught, ignored." << '\n'
253-
<< "e.what() = " << e.what() << std::endl;
254-
})
255-
// ignore
246+
<< " e.what() = " << e.what() << std::endl;
247+
});
248+
// ignore the exception
256249
}
257250

258251
return ret;
@@ -477,19 +470,12 @@ decltype(polyline_shape::points) polyline_shape::parse(std::string_view s)
477470

478471
p.skip_whitespaces_and_comma();
479472
}
480-
// NOLINTNEXTLINE(bugprone-empty-catch)
481-
} catch (
482-
std::invalid_argument&
483-
#ifdef DEBUG
484-
e
485-
#endif
486-
)
487-
{
488-
LOG([&](auto& o) {
473+
} catch (std::invalid_argument& e) {
474+
utki::log_debug([&](auto& o) {
489475
o << "WARNING: polyline_shape::parse(): std::invalid_argument exception caught, ignored." << '\n'
490-
<< "e.what() = " << e.what() << std::endl;
491-
})
492-
// ignore
476+
<< " e.what() = " << e.what() << std::endl;
477+
});
478+
// ignore the exception
493479
}
494480

495481
return ret;

src/svgdom/elements/transformable.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,12 @@ decltype(transformable::transformations) transformable::parse(std::string_view s
194194
p.skip_whitespaces_and_comma();
195195
}
196196
// NOLINTNEXTLINE(bugprone-empty-catch)
197-
} catch (
198-
std::invalid_argument&
199-
#ifdef DEBUG
200-
e
201-
#endif
202-
)
203-
{
204-
LOG([&](auto& o) {
197+
} catch (std::invalid_argument& e) {
198+
utki::log_debug([&](auto& o) {
205199
o << "WARNING: transformable::parse(): std::invalid_argument exception caught, ignored." << '\n'
206-
<< "e.what() = " << e.what() << std::endl;
207-
})
208-
// ignore
200+
<< " e.what() = " << e.what() << std::endl;
201+
});
202+
// ignore the exception
209203
}
210204

211205
return ret;

src/svgdom/parser.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,23 +1026,21 @@ class parse_content_visitor : public visitor
10261026

10271027
void visit(style_element& e) override
10281028
{
1029-
e.css.append(
1030-
cssom::read(
1031-
papki::span_file(this->content),
1032-
[](std::string_view name) -> uint32_t {
1033-
return uint32_t(styleable::string_to_property(name));
1034-
},
1035-
[](uint32_t id, std::string_view v) -> std::unique_ptr<cssom::property_value_base> {
1036-
auto sp = style_property(id);
1037-
if (sp == style_property::unknown) {
1038-
return nullptr;
1039-
}
1040-
auto ret = std::make_unique<style_element::css_style_value>();
1041-
ret->value = styleable::parse_style_property_value(sp, v);
1042-
return ret;
1029+
e.css.append(cssom::read(
1030+
papki::span_file(this->content),
1031+
[](std::string_view name) -> uint32_t {
1032+
return uint32_t(styleable::string_to_property(name));
1033+
},
1034+
[](uint32_t id, std::string_view v) -> std::unique_ptr<cssom::property_value_base> {
1035+
auto sp = style_property(id);
1036+
if (sp == style_property::unknown) {
1037+
return nullptr;
10431038
}
1044-
)
1045-
);
1039+
auto ret = std::make_unique<style_element::css_style_value>();
1040+
ret->value = styleable::parse_style_property_value(sp, v);
1041+
return ret;
1042+
}
1043+
));
10461044
}
10471045
};
10481046
} // namespace

src/svgdom/util/casters.hpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,23 @@ class styleable_caster_template : public std::conditional_t<is_const, const_visi
170170
this->pointer = &e;
171171
}
172172

173-
void visit(
174-
typename std::conditional_t<is_const, const linear_gradient_element&, linear_gradient_element&> e
173+
void visit( //
174+
typename std::conditional_t<
175+
is_const,
176+
const linear_gradient_element&, //
177+
linear_gradient_element& //
178+
> e //
175179
) override
176180
{
177181
this->pointer = &e;
178182
}
179183

180-
void visit(
181-
typename std::conditional_t<is_const, const radial_gradient_element&, radial_gradient_element&> e
184+
void visit( //
185+
typename std::conditional_t<
186+
is_const,
187+
const radial_gradient_element&, //
188+
radial_gradient_element& //
189+
> e //
182190
) override
183191
{
184192
this->pointer = &e;
@@ -189,15 +197,23 @@ class styleable_caster_template : public std::conditional_t<is_const, const_visi
189197
this->pointer = &e;
190198
}
191199

192-
void visit(
193-
typename std::conditional_t<is_const, const fe_gaussian_blur_element&, fe_gaussian_blur_element&> e
200+
void visit( //
201+
typename std::conditional_t<
202+
is_const,
203+
const fe_gaussian_blur_element&, //
204+
fe_gaussian_blur_element& //
205+
> e //
194206
) override
195207
{
196208
this->pointer = &e;
197209
}
198210

199-
void visit(
200-
typename std::conditional_t<is_const, const fe_color_matrix_element&, fe_color_matrix_element&> e
211+
void visit( //
212+
typename std::conditional_t<
213+
is_const,
214+
const fe_color_matrix_element&, //
215+
fe_color_matrix_element& //
216+
> e //
201217
) override
202218
{
203219
this->pointer = &e;

0 commit comments

Comments
 (0)