Skip to content

Commit

Permalink
bspfile: make conversion operators/constructors explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwa committed Dec 28, 2024
1 parent ca26b0e commit bbe39c7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion common/bspfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ inline void CopyArray(std::vector<F> &from, std::vector<T> &to)
if constexpr (std::is_arithmetic_v<T> && std::is_arithmetic_v<F>)
to.push_back(numeric_cast<T>(v));
else
to.push_back(v);
to.push_back(static_cast<T>(v));
}
}

Expand Down
40 changes: 20 additions & 20 deletions include/common/bspfile_q1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ struct dmodelq1_t
dmodelq1_t() = default;

// convert from mbsp_t
dmodelq1_t(const dmodelh2_t &model);
explicit dmodelq1_t(const dmodelh2_t &model);

// convert to mbsp_t
operator dmodelh2_t() const;
explicit operator dmodelh2_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down Expand Up @@ -120,10 +120,10 @@ struct bsp29_dnode_t
bsp29_dnode_t() = default;

// convert from mbsp_t
bsp29_dnode_t(const bsp2_dnode_t &model);
explicit bsp29_dnode_t(const bsp2_dnode_t &model);

// convert to mbsp_t
operator bsp2_dnode_t() const;
explicit operator bsp2_dnode_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -142,10 +142,10 @@ struct bsp2rmq_dnode_t
bsp2rmq_dnode_t() = default;

// convert from mbsp_t
bsp2rmq_dnode_t(const bsp2_dnode_t &model);
explicit bsp2rmq_dnode_t(const bsp2_dnode_t &model);

// convert to mbsp_t
operator bsp2_dnode_t() const;
explicit operator bsp2_dnode_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -167,10 +167,10 @@ struct bsp29_dclipnode_t
bsp29_dclipnode_t() = default;

// convert from mbsp_t
bsp29_dclipnode_t(const bsp2_dclipnode_t &model);
explicit bsp29_dclipnode_t(const bsp2_dclipnode_t &model);

// convert to mbsp_t
operator bsp2_dclipnode_t() const;
explicit operator bsp2_dclipnode_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -197,10 +197,10 @@ struct texinfo_t
texinfo_t() = default;

// convert from mbsp_t
texinfo_t(const mtexinfo_t &model);
explicit texinfo_t(const mtexinfo_t &model);

// convert to mbsp_t
operator mtexinfo_t() const;
explicit operator mtexinfo_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down Expand Up @@ -228,10 +228,10 @@ struct bsp29_dface_t
bsp29_dface_t() = default;

// convert from mbsp_t
bsp29_dface_t(const mface_t &model);
explicit bsp29_dface_t(const mface_t &model);

// convert to mbsp_t
operator mface_t() const;
explicit operator mface_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -253,10 +253,10 @@ struct bsp2_dface_t
bsp2_dface_t() = default;

// convert from mbsp_t
bsp2_dface_t(const mface_t &model);
explicit bsp2_dface_t(const mface_t &model);

// convert to mbsp_t
operator mface_t() const;
explicit operator mface_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -276,10 +276,10 @@ struct bsp29_dleaf_t
bsp29_dleaf_t() = default;

// convert from mbsp_t
bsp29_dleaf_t(const mleaf_t &model);
explicit bsp29_dleaf_t(const mleaf_t &model);

// convert to mbsp_t
operator mleaf_t() const;
explicit operator mleaf_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -299,10 +299,10 @@ struct bsp2rmq_dleaf_t
bsp2rmq_dleaf_t() = default;

// convert from mbsp_t
bsp2rmq_dleaf_t(const mleaf_t &model);
explicit bsp2rmq_dleaf_t(const mleaf_t &model);

// convert to mbsp_t
operator mleaf_t() const;
explicit operator mleaf_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -322,10 +322,10 @@ struct bsp2_dleaf_t
bsp2_dleaf_t() = default;

// convert from mbsp_t
bsp2_dleaf_t(const mleaf_t &model);
explicit bsp2_dleaf_t(const mleaf_t &model);

// convert to mbsp_t
operator mleaf_t() const;
explicit operator mleaf_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down
32 changes: 16 additions & 16 deletions include/common/bspfile_q2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ struct q2_dmodel_t
q2_dmodel_t() = default;

// convert from mbsp_t
q2_dmodel_t(const dmodelh2_t &model);
explicit q2_dmodel_t(const dmodelh2_t &model);

// convert to mbsp_t
operator dmodelh2_t() const;
explicit operator dmodelh2_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down Expand Up @@ -164,10 +164,10 @@ struct q2_dnode_t
q2_dnode_t() = default;

// convert from mbsp_t
q2_dnode_t(const bsp2_dnode_t &model);
explicit q2_dnode_t(const bsp2_dnode_t &model);

// convert to mbsp_t
operator bsp2_dnode_t() const;
explicit operator bsp2_dnode_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down Expand Up @@ -207,10 +207,10 @@ struct q2_texinfo_t
q2_texinfo_t() = default;

// convert from mbsp_t
q2_texinfo_t(const mtexinfo_t &model);
explicit q2_texinfo_t(const mtexinfo_t &model);

// convert to mbsp_t
operator mtexinfo_t() const;
explicit operator mtexinfo_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -232,10 +232,10 @@ struct q2_dface_t
q2_dface_t() = default;

// convert from mbsp_t
q2_dface_t(const mface_t &model);
explicit q2_dface_t(const mface_t &model);

// convert to mbsp_t
operator mface_t() const;
explicit operator mface_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -257,10 +257,10 @@ struct q2_dface_qbism_t
q2_dface_qbism_t() = default;

// convert from mbsp_t
q2_dface_qbism_t(const mface_t &model);
explicit q2_dface_qbism_t(const mface_t &model);

// convert to mbsp_t
operator mface_t() const;
explicit operator mface_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -286,10 +286,10 @@ struct q2_dleaf_t
q2_dleaf_t() = default;

// convert from mbsp_t
q2_dleaf_t(const mleaf_t &model);
explicit q2_dleaf_t(const mleaf_t &model);

// convert to mbsp_t
operator mleaf_t() const;
explicit operator mleaf_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -315,10 +315,10 @@ struct q2_dleaf_qbism_t
q2_dleaf_qbism_t() = default;

// convert from mbsp_t
q2_dleaf_qbism_t(const mleaf_t &model);
explicit q2_dleaf_qbism_t(const mleaf_t &model);

// convert to mbsp_t
operator mleaf_t() const;
explicit operator mleaf_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand All @@ -333,10 +333,10 @@ struct q2_dbrushside_t
q2_dbrushside_t() = default;

// convert from mbsp_t
q2_dbrushside_t(const q2_dbrushside_qbism_t &model);
explicit q2_dbrushside_t(const q2_dbrushside_qbism_t &model);

// convert to mbsp_t
operator q2_dbrushside_qbism_t() const;
explicit operator q2_dbrushside_qbism_t() const;

// serialize for streams
void stream_write(std::ostream &s) const;
Expand Down

0 comments on commit bbe39c7

Please sign in to comment.