17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 03:59:19 +02: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 {
public:
CSkyDome( int const Tesselation = 54 );
explicit CSkyDome( int const Tesselation = 54 );
~CSkyDome();
void Generate();
void RebuildColors();

View File

@@ -23,7 +23,7 @@ HANDLE pipe_wr = nullptr;
#endif
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 write(unsigned char *buf, size_t len);
~piped_proc();

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,7 +18,7 @@ namespace network::tcp
friend class client;
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();
void connected() override;

View File

@@ -18,7 +18,7 @@ struct message
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 deserialize(std::istream &stream) { /* message carries no payload */ }
virtual ~message() = default;

View File

@@ -35,7 +35,7 @@ namespace network
virtual void send_message(const message &msg) = 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);
virtual void disconnect() = 0;
@@ -63,7 +63,7 @@ namespace network
command_queue::commands_map client_commands_queue;
public:
server(std::shared_ptr<std::istream> buf);
explicit server(std::shared_ptr<std::istream> buf);
void push_delta(const frame_info &msg);
command_queue::commands_map pop_commands();
};

View File

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

View File

@@ -27,7 +27,7 @@ public:
};
// constructors
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
// data access
auto input() -> int &;

View File

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

View File

@@ -23,7 +23,7 @@ struct dictionary_source {
keyvaluepair_sequence<std::vector<glm::vec2>> vec2_lists;
// constructors
dictionary_source() = default;
dictionary_source( std::string const &Input );
explicit dictionary_source( std::string const &Input );
// methods
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 ); }

View File

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

View File

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

View File

@@ -70,7 +70,7 @@ class TSegment
public:
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 NewCPointOut, glm::dvec3 NewCPointIn, glm::dvec3 &NewPoint2, double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
double

View File

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

View File

@@ -81,7 +81,7 @@ class TTrainParameters
bool UpdateMTable(double hh, double mm, std::string const &NewName);
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
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 UpdateVelocity(int StationCount, double vActual);
bool LoadTTfile(std::string scnpath, int iPlus, double vmax);