17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 20:10:23 +01:00

refactor(sonar): mark converting constructors explicit (cpp:S1709)

sound_source and the gl::object conversion operators stay implicit; they
are relied upon by copy-list-initialisation and GL calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 16:55:10 +02:00
parent 8afb232f2a
commit 1cc9890197
18 changed files with 22 additions and 22 deletions

View File

@@ -5,7 +5,7 @@
class CSkyDome { class CSkyDome {
public: public:
CSkyDome( int const Tesselation = 54 ); explicit CSkyDome( int const Tesselation = 54 );
~CSkyDome(); ~CSkyDome();
void Generate(); void Generate();
void RebuildColors(); void RebuildColors();

View File

@@ -23,7 +23,7 @@ HANDLE pipe_wr = nullptr;
#endif #endif
public: public:
piped_proc(std::string cmd, bool write = false); explicit piped_proc(std::string cmd, bool write = false);
size_t read(unsigned char *buf, size_t len); size_t read(unsigned char *buf, size_t len);
size_t write(unsigned char *buf, size_t len); size_t write(unsigned char *buf, size_t len);
~piped_proc(); ~piped_proc();

View File

@@ -15,8 +15,8 @@ namespace gl
static std::shared_ptr<gl::vao> vao; static std::shared_ptr<gl::vao> vao;
public: public:
postfx(const std::string &s); explicit postfx(const std::string &s);
postfx(const shader &s); explicit postfx(const shader &s);
void attach(); void attach();
void apply(opengl_texture &src, framebuffer *dst); void apply(opengl_texture &src, framebuffer *dst);

View File

@@ -25,7 +25,7 @@ protected:
GLenum glenum_target(targets target) const; GLenum glenum_target(targets target) const;
public: public:
query(targets target); explicit query(targets target);
~query(); ~query();
void begin(); void begin();

View File

@@ -21,7 +21,7 @@ namespace gl
#ifdef SHADERVALIDATOR_STANDALONE #ifdef SHADERVALIDATOR_STANDALONE
shader() = default; shader() = default;
#endif #endif
shader(const std::string &filename); explicit shader(const std::string &filename);
~shader(); ~shader();
enum class components_e enum class components_e
@@ -85,7 +85,7 @@ namespace gl
{ {
public: public:
program(); program();
program(std::vector<std::reference_wrapper<const gl::shader>>); explicit program(std::vector<std::reference_wrapper<const gl::shader>>);
~program(); ~program();
using bindable::bind; using bindable::bind;

View File

@@ -11,11 +11,11 @@ public:
static constexpr GLuint invalid_id { std::numeric_limits<GLuint>::max() }; static constexpr GLuint invalid_id { std::numeric_limits<GLuint>::max() };
deferred_image() = default; deferred_image() = default;
deferred_image(const std::string &p) : path(p) { } explicit deferred_image(const std::string &p) : path(p) { }
deferred_image(const deferred_image&) = delete; deferred_image(const deferred_image&) = delete;
deferred_image(deferred_image&&) = default; deferred_image(deferred_image&&) = default;
deferred_image &operator=(deferred_image&&) = default; deferred_image &operator=(deferred_image&&) = default;
operator bool() const explicit operator bool() const
{ {
return image != null_handle || !path.empty(); return image != null_handle || !path.empty();
} }

View File

@@ -18,7 +18,7 @@ namespace network::tcp
friend class client; friend class client;
public: public:
connection(asio::io_context &io_ctx, bool client = false, size_t counter = 0); explicit connection(asio::io_context &io_ctx, bool client = false, size_t counter = 0);
~connection(); ~connection();
void connected() override; void connected() override;

View File

@@ -18,7 +18,7 @@ struct message
type_e type; type_e type;
message(type_e t) : type(t) {} explicit message(type_e t) : type(t) {}
virtual void serialize(std::ostream &stream) const { /* message carries no payload */ } virtual void serialize(std::ostream &stream) const { /* message carries no payload */ }
virtual void deserialize(std::istream &stream) { /* message carries no payload */ } virtual void deserialize(std::istream &stream) { /* message carries no payload */ }
virtual ~message() = default; virtual ~message() = default;

View File

@@ -35,7 +35,7 @@ namespace network
virtual void send_message(const message &msg) = 0; virtual void send_message(const message &msg) = 0;
virtual void send_messages(const std::vector<std::shared_ptr<message>> &messages) = 0; virtual void send_messages(const std::vector<std::shared_ptr<message>> &messages) = 0;
connection(bool client = false, size_t counter = 0); explicit connection(bool client = false, size_t counter = 0);
void set_handler(std::function<void(const message &msg)> handler); void set_handler(std::function<void(const message &msg)> handler);
virtual void disconnect() = 0; virtual void disconnect() = 0;
@@ -63,7 +63,7 @@ namespace network
command_queue::commands_map client_commands_queue; command_queue::commands_map client_commands_queue;
public: public:
server(std::shared_ptr<std::istream> buf); explicit server(std::shared_ptr<std::istream> buf);
void push_delta(const frame_info &msg); void push_delta(const frame_info &msg);
command_queue::commands_map pop_commands(); command_queue::commands_map pop_commands();
}; };

View File

@@ -19,7 +19,7 @@ struct node_snapshot {
scene::basic_node *node; scene::basic_node *node;
std::string data; std::string data;
node_snapshot( scene::basic_node *Node ) : explicit node_snapshot( scene::basic_node *Node ) :
node( Node ) { node( Node ) {
if( Node != nullptr ) { if( Node != nullptr ) {
Node->export_as_text( data ); } }; Node->export_as_text( data ); } };

View File

@@ -27,7 +27,7 @@ public:
}; };
// constructors // constructors
template<typename ...Args_> template<typename ...Args_>
basic_element( basic_element::type_e Type = basic_element::type_e::variable, Args_ ...Args ); explicit basic_element( basic_element::type_e Type = basic_element::type_e::variable, Args_ ...Args );
// methods // methods
// data access // data access
auto input() -> int &; auto input() -> int &;

View File

@@ -225,7 +225,7 @@ public:
void deserialize_float64(std::istream&); void deserialize_float64(std::istream&);
void serialize_float32(std::ostream&) const; void serialize_float32(std::ostream&) const;
float4x4() = default; float4x4() = default;
float4x4(const float f[16]) explicit float4x4(const float f[16])
{ {
for (int i = 0; i < 16; ++i) for (int i = 0; i < 16; ++i)
e[i] = f[i]; e[i] = f[i];

View File

@@ -23,7 +23,7 @@ struct dictionary_source {
keyvaluepair_sequence<std::vector<glm::vec2>> vec2_lists; keyvaluepair_sequence<std::vector<glm::vec2>> vec2_lists;
// constructors // constructors
dictionary_source() = default; dictionary_source() = default;
dictionary_source( std::string const &Input ); explicit dictionary_source( std::string const &Input );
// methods // methods
inline void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); } inline void insert( std::string const &Key, double const Value ) { floats.emplace_back( Key, Value ); }
inline void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); } inline void insert( std::string const &Key, int const Value ) { integers.emplace_back( Key, Value ); }

View File

@@ -11,7 +11,7 @@ class popup
static int id; static int id;
public: public:
popup(ui_panel &panel); explicit popup(ui_panel &panel);
virtual ~popup(); virtual ~popup();
virtual bool render(); virtual bool render();

View File

@@ -8,7 +8,7 @@ class vehiclelist_panel : public ui_panel
bool m_first_show = true; bool m_first_show = true;
public: public:
vehiclelist_panel(ui_layer &parent); explicit vehiclelist_panel(ui_layer &parent);
void render_contents() override; void render_contents() override;
}; };

View File

@@ -70,7 +70,7 @@ class TSegment
public: public:
bool bCurve = false; bool bCurve = false;
TSegment(TTrack *owner); explicit TSegment(TTrack *owner);
bool Init(glm::dvec3 NewPoint1, glm::dvec3 NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0); bool Init(glm::dvec3 NewPoint1, glm::dvec3 NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0);
bool Init(glm::dvec3 &NewPoint1, glm::dvec3 NewCPointOut, glm::dvec3 NewCPointIn, glm::dvec3 &NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true); bool Init(glm::dvec3 &NewPoint1, glm::dvec3 NewCPointOut, glm::dvec3 NewCPointIn, glm::dvec3 &NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
double double

View File

@@ -19,7 +19,7 @@ class TTractionPowerSource : public scene::basic_node {
public: public:
// constructor // constructor
TTractionPowerSource( scene::node_data const &Nodedata ); explicit TTractionPowerSource( scene::node_data const &Nodedata );
// methods // methods
void Init(double const u, double const i); void Init(double const u, double const i);
bool Load(cParser *parser); bool Load(cParser *parser);

View File

@@ -81,7 +81,7 @@ class TTrainParameters
bool UpdateMTable(double hh, double mm, std::string const &NewName); bool UpdateMTable(double hh, double mm, std::string const &NewName);
bool UpdateMTable( scenario_time const &Time, std::string const &NewName ); bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
bool RewindTimeTable( std::string actualStationName ); bool RewindTimeTable( std::string actualStationName );
TTrainParameters( std::string const &NewTrainName = "none" ); explicit TTrainParameters( std::string const &NewTrainName = "none" );
void NewName(std::string const &NewTrainName); void NewName(std::string const &NewTrainName);
void UpdateVelocity(int StationCount, double vActual); void UpdateVelocity(int StationCount, double vActual);
bool LoadTTfile(std::string scnpath, int iPlus, double vmax); bool LoadTTfile(std::string scnpath, int iPlus, double vmax);