Skip to content

Commit

Permalink
Made some constructors explicit.
Browse files Browse the repository at this point in the history
  • Loading branch information
5cript committed Sep 15, 2023
1 parent a218235 commit 81e5a51
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions nui/include/nui/frontend/components/dialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ namespace Nui::Components

struct ConstructionArgs
{
Observed<std::optional<std::string>> className = std::nullopt;
Observed<std::string> title = "";
Observed<std::string> body = "";
Observed<std::string> buttonClassName = "";
Observed<ButtonConfiguration> buttonConfiguration = ButtonConfiguration::Ok;
Observed<std::optional<std::string>> className{std::nullopt};
Observed<std::string> title{""};
Observed<std::string> body{""};
Observed<std::string> buttonClassName{""};
Observed<ButtonConfiguration> buttonConfiguration{ButtonConfiguration::Ok};
std::function<void(Button)> onButtonClicked = [](Button) {};
};

Expand Down
2 changes: 1 addition & 1 deletion nui/include/nui/frontend/dom/basic_element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Nui::Dom
class BasicElement : public std::enable_shared_from_this<BasicElement>
{
public:
BasicElement(Nui::val val)
explicit BasicElement(Nui::val val)
: element_{std::move(val)}
{}
virtual ~BasicElement() = default;
Expand Down
4 changes: 2 additions & 2 deletions nui/include/nui/frontend/dom/childless_element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace Nui::Dom
class ChildlessElement : public BasicElement
{
public:
ChildlessElement(HtmlElement const& elem)
explicit ChildlessElement(HtmlElement const& elem)
: BasicElement{ChildlessElement::createElement(elem)}
{}
ChildlessElement(Nui::val val)
explicit ChildlessElement(Nui::val val)
: BasicElement{std::move(val)}
{}

Expand Down
4 changes: 2 additions & 2 deletions nui/include/nui/frontend/dom/element.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ namespace Nui::Dom
using const_iterator = collection_type::const_iterator;
using value_type = collection_type::value_type;

Element(HtmlElement const& elem)
explicit Element(HtmlElement const& elem)
: ChildlessElement{elem}
, children_{}
, unsetup_{}
{}

Element(Nui::val val)
explicit Element(Nui::val val)
: ChildlessElement{std::move(val)}
, children_{}
, unsetup_{}
Expand Down
2 changes: 1 addition & 1 deletion nui/include/nui/frontend/dom/reference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Nui::Dom
struct ReferencePasser
{
public:
ReferencePasser(T&& func)
explicit ReferencePasser(T&& func)
: func_{std::move(func)}
{}
void operator()(std::weak_ptr<BasicElement>&& weakElement) const
Expand Down
10 changes: 5 additions & 5 deletions nui/include/nui/frontend/event_system/observed_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace Nui
~ModifiableObserved() = default;

template <typename T = ContainedT>
ModifiableObserved(T&& t)
explicit ModifiableObserved(T&& t)
: contained_{std::forward<T>(t)}
{}

Expand Down Expand Up @@ -532,12 +532,12 @@ namespace Nui
, afterEffectId_{registerAfterEffect()}
{}
template <typename T = ContainerT>
ObservedContainer(T&& t)
explicit ObservedContainer(T&& t)
: ModifiableObserved<ContainerT>{std::forward<T>(t)}
, rangeContext_{static_cast<long>(contained_.size())}
, afterEffectId_{registerAfterEffect()}
{}
ObservedContainer(RangeEventContext&& rangeContext)
explicit ObservedContainer(RangeEventContext&& rangeContext)
: ModifiableObserved<ContainerT>{}
, rangeContext_{std::move(rangeContext)}
, afterEffectId_{registerAfterEffect()}
Expand Down Expand Up @@ -1039,7 +1039,7 @@ namespace Nui
: ObservedContainer<std::set<Parameters...>>{RangeEventContext{0, true}}
{}
template <typename T = std::set<Parameters...>>
Observed(T&& t)
explicit Observed(T&& t)
: ObservedContainer<std::set<Parameters...>>{
std::forward<T>(t),
RangeEventContext{static_cast<long>(t.size()), true}}
Expand Down Expand Up @@ -1123,7 +1123,7 @@ namespace Nui
struct CopiableObservedWrap // minimal wrapper to make Observed<T> copiable
{
public:
constexpr CopiableObservedWrap(Observed<T> const& observed)
explicit constexpr CopiableObservedWrap(Observed<T> const& observed)
: observed_{&observed}
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace Nui
class ObservedValueCombinatorBase
{
public:
constexpr ObservedValueCombinatorBase(ObservedValues const&... observedValues)
explicit constexpr ObservedValueCombinatorBase(ObservedValues const&... observedValues)
: observedValues_{observedValues...}
{}
constexpr ObservedValueCombinatorBase(std::tuple<ObservedValues const&...> observedValues)
explicit constexpr ObservedValueCombinatorBase(std::tuple<ObservedValues const&...> observedValues)
: observedValues_{std::move(observedValues)}
{}

Expand Down
2 changes: 1 addition & 1 deletion nui/include/nui/frontend/event_system/range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Nui
class ObservedRange
{
public:
constexpr ObservedRange(ObservedValue& observedValues)
explicit constexpr ObservedRange(ObservedValue& observedValues)
: observedValue_{observedValues}
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace Nui
class RangeEventContext
{
public:
RangeEventContext(long dataSize)
explicit RangeEventContext(long dataSize)
: modificationRanges_{}
, fullRangeUpdate_{true}
, disableOptimizations_{false}
Expand Down

0 comments on commit 81e5a51

Please sign in to comment.