commit ef82a7d8fedab1820c324655dbaf6d9f6f7d3d98
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Mon Sep 21 15:31:38 2026 +0200
Mark a bunch of one-parameter constructors as explicit
Many remain to be done.
Spotted by cppcheck.
---
src/Author.h | 2 +-
src/BiblioInfo.h | 2 +-
src/Buffer.h | 2 +-
src/BufferView.cpp | 2 +-
src/Bullet.h | 2 +-
src/Compare.cpp | 4 ++--
src/Encoding.h | 2 +-
src/LayoutFile.h | 2 +-
src/MetricsInfo.h | 4 ++--
src/Mover.h | 2 +-
src/OutputParams.h | 2 +-
src/ParIterator.h | 6 +++---
src/Paragraph.cpp | 7 +++++--
src/PersonalWordList.h | 2 +-
src/ServerSocket.h | 4 ++--
src/Session.h | 2 +-
src/Spacing.h | 2 +-
src/TextClass.h | 2 +-
src/TocBackend.h | 2 +-
src/TocBuilder.h | 2 +-
src/Undo.cpp | 4 ++--
src/Undo.h | 6 +++---
src/client/client.cpp | 4 ++--
src/frontends/qt/BulletsModule.h | 2 +-
src/frontends/qt/ButtonController.cpp | 2 +-
src/frontends/qt/ButtonPolicy.cpp | 2 +-
src/frontends/qt/PanelStack.h | 2 +-
src/graphics/GraphicsLoader.cpp | 2 +-
src/graphics/GraphicsLoader.h | 2 +-
src/graphics/GraphicsParams.h | 2 +-
src/graphics/PreviewLoader.h | 2 +-
src/insets/ExternalTransforms.h | 1 +
src/insets/Inset.cpp | 2 +-
src/insets/InsetCaptionable.h | 2 +-
src/insets/InsetCollapsible.h | 2 +-
src/insets/InsetERT.h | 2 +-
src/insets/InsetInfo.h | 2 +-
src/insets/InsetListings.h | 2 +-
src/insets/InsetListingsParams.h | 2 +-
src/insets/InsetNomencl.h | 2 +-
src/insets/InsetScript.h | 2 +-
src/insets/InsetTabular.h | 2 +-
src/mathed/InsetMathBoldSymbol.h | 2 +-
src/mathed/InsetMathFrac.h | 2 +-
src/mathed/InsetMathKern.h | 2 +-
src/mathed/InsetMathXYMatrix.h | 2 +-
src/mathed/MathRow.h | 10 +++++-----
src/mathed/MathStream.h | 6 +++---
src/support/Cache.h | 2 +-
src/support/Changer.h | 2 +-
src/support/FileMonitor.h | 2 +-
src/support/ForkedCalls.h | 2 +-
src/support/Lexer.h | 4 ++--
src/support/Messages.h | 2 +-
src/support/TempFile.h | 2 +-
src/support/Timeout.h | 2 +-
src/support/limited_stack.h | 2 +-
src/support/mutex.h | 12 ++++++------
src/tex2lyx/Parser.h | 4 ++--
src/tex2lyx/tex2lyx.cpp | 2 +-
60 files changed, 86 insertions(+), 82 deletions(-)
diff --git a/src/Author.h b/src/Author.h
index 75b0ae59e9..e19b43855b 100644
--- a/src/Author.h
+++ b/src/Author.h
@@ -27,7 +27,7 @@ public:
Author(docstring const & name, docstring const & email,
docstring const & initials);
/// For when the \author line is missing (#9854)
- Author(int buffer_id);
+ explicit Author(int buffer_id);
///
docstring const & name() const { return name_; }
///
diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h
index ad73c7d45a..217ba4514d 100644
--- a/src/BiblioInfo.h
+++ b/src/BiblioInfo.h
@@ -59,7 +59,7 @@ public:
BibTeXInfo() : is_bibtex_(true), num_bib_key_(0), modifier_(0) {}
/// argument sets isBibTeX_, so should be false only if it's coming
/// from a bibliography environment
- BibTeXInfo(bool ib) : is_bibtex_(ib), num_bib_key_(0), modifier_(0) {}
+ explicit BibTeXInfo(bool ib) : is_bibtex_(ib), num_bib_key_(0),
modifier_(0) {}
/// constructor that sets the entryType
BibTeXInfo(docstring const & key, docstring const & type);
/// \return an author or editor list (short form by default),
diff --git a/src/Buffer.h b/src/Buffer.h
index 0141bd5439..dc37e40f5c 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -879,7 +879,7 @@ private:
/// and leave the rest to us.
class MarkAsExporting {
public:
- MarkAsExporting(Buffer const * buf) : buf_(buf)
+ explicit MarkAsExporting(Buffer const * buf) : buf_(buf)
{
buf_->setExportStatus(true);
}
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index e185b1a626..f6698f65ae 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -226,7 +226,7 @@ enum ScreenUpdateStrategy {
struct BufferView::Private
{
- Private(BufferView & bv) :
+ explicit Private(BufferView & bv) :
update_strategy_(FullScreenUpdate),
update_flags_(Update::Force),
cursor_(bv), anchor_pit_(0), anchor_ypos_(10000),
diff --git a/src/Bullet.h b/src/Bullet.h
index c60ab69cec..4a9d0a9fbc 100644
--- a/src/Bullet.h
+++ b/src/Bullet.h
@@ -26,7 +26,7 @@ public:
///
Bullet(Bullet const & b);
///
- Bullet(int f = -1, int c = -1, int s = -1);
+ explicit Bullet(int f = -1, int c = -1, int s = -1);
///
explicit Bullet(docstring const &);
diff --git a/src/Compare.cpp b/src/Compare.cpp
index 79b6f3dbdf..0e63364839 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -253,7 +253,7 @@ public:
: from(from_), to(to_)
{}
- DocRange(Buffer const * buf) :
+ explicit DocRange(Buffer const * buf) :
from(doc_iterator_begin(buf)),
to(doc_iterator_end(buf))
{
@@ -419,7 +419,7 @@ private:
class Compare::Impl {
public:
///
- Impl(Compare const & compare)
+ explicit Impl(Compare const & compare)
: abort_(false), n_(0), m_(0), offset_reverse_diagonal_(0),
odd_offset_(false), compare_(compare),
old_buf_(nullptr), new_buf_(nullptr), dest_buf_(nullptr),
diff --git a/src/Encoding.h b/src/Encoding.h
index b097d7f44b..3db48b54e5 100644
--- a/src/Encoding.h
+++ b/src/Encoding.h
@@ -26,7 +26,7 @@ namespace support { class FileName; }
class EncodingException : public std::exception {
public:
- EncodingException(char_type c);
+ explicit EncodingException(char_type c);
virtual ~EncodingException() noexcept {}
virtual const char * what() const noexcept override;
diff --git a/src/LayoutFile.h b/src/LayoutFile.h
index 790dfe927d..5d9c6de6f7 100644
--- a/src/LayoutFile.h
+++ b/src/LayoutFile.h
@@ -28,7 +28,7 @@ class LayoutFileIndex {
public:
///
typedef std::string base_type;
- ///
+ /// missing explicit intended
LayoutFileIndex(base_type const & t) : data_(t) { }
///
operator base_type() const { return data_; }
diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h
index 4c340dbaa7..7496bc58cb 100644
--- a/src/MetricsInfo.h
+++ b/src/MetricsInfo.h
@@ -40,8 +40,8 @@ class MacroContext;
class MetricsBase {
public:
///
- MetricsBase(BufferView * bv = 0, FontInfo const & font = FontInfo(),
- int textwidth = 0);
+ explicit MetricsBase(BufferView * bv = 0, FontInfo const & font =
FontInfo(),
+ int textwidth = 0);
/// the current view
BufferView * bv;
diff --git a/src/Mover.h b/src/Mover.h
index bfddd95a30..a3f13ea53c 100644
--- a/src/Mover.h
+++ b/src/Mover.h
@@ -131,7 +131,7 @@ public:
* location to the temporary directory, they are the same, so $$l may
be
* ignored in this case, as it is in the Mover baseclass.
*/
- SpecialisedMover(std::string const & command)
+ explicit SpecialisedMover(std::string const & command)
: command_(command) {}
/// The template used to launch the external command.
diff --git a/src/OutputParams.h b/src/OutputParams.h
index f76f44f177..63b9ab63e0 100644
--- a/src/OutputParams.h
+++ b/src/OutputParams.h
@@ -74,7 +74,7 @@ public:
SUBFLOAT
};
- OutputParams(Encoding const *);
+ explicit OutputParams(Encoding const *);
/** The file that we export depends occasionally on what is to
compile the file.
diff --git a/src/ParIterator.h b/src/ParIterator.h
index 0e1d93004e..78b0e4cbe3 100644
--- a/src/ParIterator.h
+++ b/src/ParIterator.h
@@ -29,7 +29,7 @@ class ParIterator : public DocIterator
{
public:
///
- ParIterator(Buffer * buf) : DocIterator(buf) {}
+ explicit ParIterator(Buffer * buf) : DocIterator(buf) {}
///
explicit ParIterator(DocIterator const & dit) :
DocIterator(dit) {}
@@ -71,10 +71,10 @@ class ParConstIterator : public DocIterator
{
public:
///
- ParConstIterator(Buffer const * buf)
+ explicit ParConstIterator(Buffer const * buf)
: DocIterator(const_cast<Buffer *>(buf)) {}
///
- ParConstIterator(ParConstIterator const & pi)
+ explicit ParConstIterator(ParConstIterator const & pi)
: DocIterator(DocIterator(pi)) {}
///
explicit ParConstIterator(DocIterator const & dit)
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index d4fe200d46..8398b4b968 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -585,7 +585,7 @@ namespace {
*/
struct ChangesMonitor {
///
- ChangesMonitor(Paragraph & par)
+ explicit ChangesMonitor(Paragraph & par)
: par_(par), was_changed_(par.isChanged()) {}
///
~ChangesMonitor()
@@ -3539,10 +3539,13 @@ public:
xml::FontTypes ft;
bool has_value;
- OptionalFontType(): ft(xml::FT_EMPH), has_value(false) {} // A possible
value at random for ft.
+ // A possible value at random for ft.
+ OptionalFontType(): ft(xml::FT_EMPH), has_value(false) {}
+ // intentionally non explicit
OptionalFontType(xml::FontTypes ftt): ft(ftt), has_value(true) {}
};
+
OptionalFontType fontShapeToXml(FontShape fs)
{
switch (fs) {
diff --git a/src/PersonalWordList.h b/src/PersonalWordList.h
index 9abb3fd146..d35e2ef326 100644
--- a/src/PersonalWordList.h
+++ b/src/PersonalWordList.h
@@ -23,7 +23,7 @@ namespace lyx {
class PersonalWordList {
public:
/// the word list has an associated language
- PersonalWordList(std::string const & lang) : lang_(lang), dirty_(false)
{}
+ explicit PersonalWordList(std::string const & lang) : lang_(lang),
dirty_(false) {}
/// the location of the file to hold to word list
lyx::support::FileName dictfile() const;
/// (re)load the word list from file
diff --git a/src/ServerSocket.h b/src/ServerSocket.h
index c66658042f..b8ed4e4fcf 100644
--- a/src/ServerSocket.h
+++ b/src/ServerSocket.h
@@ -38,7 +38,7 @@ class LyXDataSocket;
class ServerSocket {
public:
///
- ServerSocket(support::FileName const &);
+ explicit ServerSocket(support::FileName const &);
///
~ServerSocket();
/// Address of the local socket
@@ -69,7 +69,7 @@ private:
class LyXDataSocket {
public:
///
- LyXDataSocket(int fd);
+ explicit LyXDataSocket(int fd);
///
~LyXDataSocket();
/// Connection status
diff --git a/src/Session.h b/src/Session.h
index aa756ddcef..b077051008 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -295,7 +295,7 @@ public:
public:
///
- LastCommandsSection(unsigned int num);
+ explicit LastCommandsSection(unsigned int num);
///
void read(std::istream & is) override;
diff --git a/src/Spacing.h b/src/Spacing.h
index d394b28b2b..a1aba39c0a 100644
--- a/src/Spacing.h
+++ b/src/Spacing.h
@@ -35,7 +35,7 @@ public:
///
Spacing() : space(Default), value("1.0") {}
///
- Spacing(Spacing::Space sp, double val = 1.0) { set(sp, val); }
+ explicit Spacing(Spacing::Space sp, double val = 1.0) { set(sp, val); }
///
Spacing(Spacing::Space sp, std::string const & val) { set(sp, val); }
///
diff --git a/src/TextClass.h b/src/TextClass.h
index e8d054784c..022e07e01e 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -613,7 +613,7 @@ public:
std::vector<std::pair<std::string, LaTeXColor>> latexColors() const {
return texcolors_; }
protected:
/// Constructs a DocumentClass based upon a LayoutFile.
- DocumentClass(LayoutFile const & tc);
+ explicit DocumentClass(LayoutFile const & tc);
/// Needed in tex2lyx
DocumentClass() {}
private:
diff --git a/src/TocBackend.h b/src/TocBackend.h
index ac4eeec42b..4864c32487 100644
--- a/src/TocBackend.h
+++ b/src/TocBackend.h
@@ -122,7 +122,7 @@ public:
/// \retval end() if no item was found.
static Toc::iterator findItem(Toc & toc, int depth, docstring const &
str);
///
- TocBackend(Buffer const * buffer) : buffer_(buffer) {}
+ explicit TocBackend(Buffer const * buffer) : buffer_(buffer) {}
///
void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
///
diff --git a/src/TocBuilder.h b/src/TocBuilder.h
index 23d5fe8329..6c9f0e0923 100644
--- a/src/TocBuilder.h
+++ b/src/TocBuilder.h
@@ -27,7 +27,7 @@ class DocIterator;
class TocBuilder
{
public:
- TocBuilder(std::shared_ptr<Toc> const & toc);
+ explicit TocBuilder(std::shared_ptr<Toc> const & toc);
/// Open a level.
/// When entering a float or flex or paragraph (with AddToToc)
void pushItem(DocIterator const & dit, docstring const & s,
diff --git a/src/Undo.cpp b/src/Undo.cpp
index 69d85a7e5f..afbee90bc4 100644
--- a/src/Undo.cpp
+++ b/src/Undo.cpp
@@ -132,7 +132,7 @@ class UndoElementStack
{
public:
/// limit is the maximum size of the stack
- UndoElementStack(size_t limit = 100) { limit_ = limit; }
+ explicit UndoElementStack(size_t limit = 100) { limit_ = limit; }
/// limit is the maximum size of the stack
~UndoElementStack() { clear(); }
@@ -186,7 +186,7 @@ private:
struct Undo::Private
{
- Private(Buffer & buffer) : buffer_(buffer),
+ explicit Private(Buffer & buffer) : buffer_(buffer),
group_id_(0), group_level_(0), undo_finished_(true) {}
// Do one undo/redo step
diff --git a/src/Undo.h b/src/Undo.h
index 32be7d2ede..3b566d740c 100644
--- a/src/Undo.h
+++ b/src/Undo.h
@@ -49,7 +49,7 @@ class Undo
void operator=(Undo const &);
public:
- Undo(Buffer &);
+ explicit Undo(Buffer &);
~Undo();
@@ -139,10 +139,10 @@ private:
class UndoGroupHelper {
public:
// Begin a new undo group for buffer \c buf.
- UndoGroupHelper(Buffer * buf);
+ explicit UndoGroupHelper(Buffer * buf);
// Begin an undo group for the buffer of \c cur with the the
// `before' cursor set to \c cur.
- UndoGroupHelper(CursorData & cur);
+ explicit UndoGroupHelper(CursorData & cur);
// End all active undo groups.
~UndoGroupHelper();
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 70a6125a3e..28a52b66b5 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -250,7 +250,7 @@ bool IOWatch::isset(int fd)
// Modified LyXDataSocket class for use with the client
class LyXDataSocket {
public:
- LyXDataSocket(FileName const &);
+ explicit LyXDataSocket(FileName const &);
~LyXDataSocket();
// File descriptor of the connection
int fd() const;
@@ -422,7 +422,7 @@ docstring mainTmp(from_ascii("/tmp"));
class StopException : public exception
{
public:
- StopException(int status) : status_(status) {}
+ explicit StopException(int status) : status_(status) {}
int status() const { return status_; }
private:
int status_;
diff --git a/src/frontends/qt/BulletsModule.h b/src/frontends/qt/BulletsModule.h
index 8930134813..b5ff5c666c 100644
--- a/src/frontends/qt/BulletsModule.h
+++ b/src/frontends/qt/BulletsModule.h
@@ -29,7 +29,7 @@ class BulletsModule : public QWidget, public Ui::BulletsUi
public:
///
- BulletsModule(QWidget * parent = nullptr);
+ explicit BulletsModule(QWidget * parent = nullptr);
/// set a bullet
void setBullet(int level, Bullet const & bullet);
diff --git a/src/frontends/qt/ButtonController.cpp
b/src/frontends/qt/ButtonController.cpp
index 1124c5200f..1f92c6a64c 100644
--- a/src/frontends/qt/ButtonController.cpp
+++ b/src/frontends/qt/ButtonController.cpp
@@ -39,7 +39,7 @@ namespace frontend {
class CheckedLineEdit
{
public:
- CheckedLineEdit(QLineEdit * input, QWidget * label = nullptr,
+ explicit CheckedLineEdit(QLineEdit * input, QWidget * label = nullptr,
int tabindex = -1, QString const & panel = QString());
/// check the widget and do visual marking
bool check() const;
diff --git a/src/frontends/qt/ButtonPolicy.cpp
b/src/frontends/qt/ButtonPolicy.cpp
index 3061d6a84f..ee38912499 100644
--- a/src/frontends/qt/ButtonPolicy.cpp
+++ b/src/frontends/qt/ButtonPolicy.cpp
@@ -140,7 +140,7 @@ public:
typedef ButtonPolicy::Policy Policy;
typedef ButtonPolicy::State State;
- Private(Policy policy);
+ explicit Private(Policy policy);
void nextState(SMInput input);
diff --git a/src/frontends/qt/PanelStack.h b/src/frontends/qt/PanelStack.h
index 502c103b1f..8730c03fde 100644
--- a/src/frontends/qt/PanelStack.h
+++ b/src/frontends/qt/PanelStack.h
@@ -32,7 +32,7 @@ class PanelStack : public QWidget
Q_OBJECT
public:
///
- PanelStack(QWidget * parent = 0);
+ explicit PanelStack(QWidget * parent = 0);
/// add a category with no associated panel
void addCategory(QString const & name, QString const & parent =
QString());
diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp
index 614f57f76f..6ae605cdc8 100644
--- a/src/graphics/GraphicsLoader.cpp
+++ b/src/graphics/GraphicsLoader.cpp
@@ -167,7 +167,7 @@ class Loader::Impl {
friend class Loader;
public:
///
- Impl(FileName const & doc_file);
+ explicit Impl(FileName const & doc_file);
///
~Impl();
///
diff --git a/src/graphics/GraphicsLoader.h b/src/graphics/GraphicsLoader.h
index 1fa51d3ee8..904f9b88af 100644
--- a/src/graphics/GraphicsLoader.h
+++ b/src/graphics/GraphicsLoader.h
@@ -40,7 +40,7 @@ class Params;
class Loader {
public:
/// Must use the reset methods to make this instance usable.
- Loader(support::FileName const & doc_file);
+ explicit Loader(support::FileName const & doc_file);
/// The image is not transformed, just displayed as-is.
Loader(support::FileName const & doc_file, support::FileName const &
file_with_path, bool display = true);
/// The image is transformed before display.
diff --git a/src/graphics/GraphicsParams.h b/src/graphics/GraphicsParams.h
index e05bb67c5a..88de7e88cf 100644
--- a/src/graphics/GraphicsParams.h
+++ b/src/graphics/GraphicsParams.h
@@ -32,7 +32,7 @@ public:
///
BoundingBox();
///
- BoundingBox(std::string const &);
+ explicit BoundingBox(std::string const &);
/// 0 0 0 0 is empty!
bool empty() const;
diff --git a/src/graphics/PreviewLoader.h b/src/graphics/PreviewLoader.h
index cc1d94efcd..00bee36b30 100644
--- a/src/graphics/PreviewLoader.h
+++ b/src/graphics/PreviewLoader.h
@@ -40,7 +40,7 @@ public:
/** We need buffer because we require the preamble to the
* LaTeX file.
*/
- PreviewLoader(Buffer const & buffer);
+ explicit PreviewLoader(Buffer const & buffer);
/** Is there an image already associated with this snippet of LaTeX?
* If so, returns a pointer to it, else returns 0.
diff --git a/src/insets/ExternalTransforms.h b/src/insets/ExternalTransforms.h
index b7bf821913..f5dd99fa9b 100644
--- a/src/insets/ExternalTransforms.h
+++ b/src/insets/ExternalTransforms.h
@@ -109,6 +109,7 @@ private:
class RotationDataType {
RotationData::OriginType val_;
public:
+ // intentionally non explicit
RotationDataType(RotationData::OriginType val) : val_(val) {}
operator RotationData::OriginType() const { return val_; }
};
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 7b78747f38..758ab4d904 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -51,7 +51,7 @@ namespace lyx {
class InsetName {
public:
- InsetName(string const & n = string(), docstring const & dn =
docstring())
+ explicit InsetName(string const & n = string(), docstring const & dn =
docstring())
: name(n), display_name(dn) {}
string name;
docstring display_name;
diff --git a/src/insets/InsetCaptionable.h b/src/insets/InsetCaptionable.h
index aa063256e1..1559681dbd 100644
--- a/src/insets/InsetCaptionable.h
+++ b/src/insets/InsetCaptionable.h
@@ -26,7 +26,7 @@ class InsetLabel;
class InsetCaptionable : public InsetCollapsible
{
public:
- InsetCaptionable(Buffer * buffer, std::string const & type =
"senseless")
+ explicit InsetCaptionable(Buffer * buffer, std::string const & type =
"senseless")
: InsetCollapsible(buffer), caption_type_(type) {}
///
std::string const & captionType() const { return caption_type_; }
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index d497e8494e..4f6026f4c6 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -36,7 +36,7 @@ namespace support { class TempFile; }
class InsetCollapsible : public InsetText {
public:
///
- InsetCollapsible(Buffer *, InsetText::UsePlain =
InsetText::PlainLayout);
+ explicit InsetCollapsible(Buffer *, InsetText::UsePlain =
InsetText::PlainLayout);
///
InsetCollapsible(InsetCollapsible const & rhs);
///
diff --git a/src/insets/InsetERT.h b/src/insets/InsetERT.h
index fe195cb05a..e37fa8074e 100644
--- a/src/insets/InsetERT.h
+++ b/src/insets/InsetERT.h
@@ -29,7 +29,7 @@ namespace lyx {
class InsetERT : public InsetCollapsible {
public:
///
- InsetERT(Buffer *, CollapseStatus status = Open);
+ explicit InsetERT(Buffer *, CollapseStatus status = Open);
///
InsetERT(InsetERT const & old);
///
diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h
index fdaef96bb8..98eaf39c2c 100644
--- a/src/insets/InsetInfo.h
+++ b/src/insets/InsetInfo.h
@@ -161,7 +161,7 @@ extern InsetInfoParams infoparams;
class InsetInfo : public InsetCollapsible {
public:
///
- InsetInfo(Buffer * buf, std::string const & info = std::string());
+ explicit InsetInfo(Buffer * buf, std::string const & info =
std::string());
///
InsetCode lyxCode() const override { return INFO_CODE; }
///
diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h
index 9bfc751eec..fc1023b630 100644
--- a/src/insets/InsetListings.h
+++ b/src/insets/InsetListings.h
@@ -31,7 +31,7 @@ class InsetListings : public InsetCaptionable
{
public:
///
- InsetListings(Buffer *, InsetListingsParams const & par =
InsetListingsParams());
+ explicit InsetListings(Buffer *, InsetListingsParams const & par =
InsetListingsParams());
///
InsetListings(InsetListings const &) = default;
///
diff --git a/src/insets/InsetListingsParams.h b/src/insets/InsetListingsParams.h
index e68a5d8be9..2f832d9005 100644
--- a/src/insets/InsetListingsParams.h
+++ b/src/insets/InsetListingsParams.h
@@ -22,7 +22,7 @@ public:
InsetListingsParams();
///
- InsetListingsParams(std::string const &, bool in=false,
+ explicit InsetListingsParams(std::string const &, bool in=false,
InsetCollapsible::CollapseStatus s = InsetCollapsible::Open);
/// write parameters to an ostream
diff --git a/src/insets/InsetNomencl.h b/src/insets/InsetNomencl.h
index 688d06428e..ef229ebaea 100644
--- a/src/insets/InsetNomencl.h
+++ b/src/insets/InsetNomencl.h
@@ -26,7 +26,7 @@ class LaTeXFeatures;
class InsetNomencl : public InsetCollapsible {
public:
///
- InsetNomencl(Buffer * buf);
+ explicit InsetNomencl(Buffer * buf);
/// \name Public functions inherited from Inset class
//@{
diff --git a/src/insets/InsetScript.h b/src/insets/InsetScript.h
index e97e519990..daec2784e1 100644
--- a/src/insets/InsetScript.h
+++ b/src/insets/InsetScript.h
@@ -49,7 +49,7 @@ class InsetScript : public InsetText
{
public:
///
- InsetScript(Buffer *, InsetScriptParams const & = InsetScriptParams());
+ explicit InsetScript(Buffer *, InsetScriptParams const & =
InsetScriptParams());
///
InsetScript(Buffer *, std::string const &);
///
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index 6f4370a72d..f1cdea7a7d 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -1115,7 +1115,7 @@ class InsetTabular : public Inset
{
public:
///
- InsetTabular(Buffer *, row_type rows = 1,
+ explicit InsetTabular(Buffer *, row_type rows = 1,
col_type columns = 1);
///
~InsetTabular();
diff --git a/src/mathed/InsetMathBoldSymbol.h b/src/mathed/InsetMathBoldSymbol.h
index f6010e40f8..3c8b67f49d 100644
--- a/src/mathed/InsetMathBoldSymbol.h
+++ b/src/mathed/InsetMathBoldSymbol.h
@@ -26,7 +26,7 @@ public:
BM_HEAVY
};
///
- InsetMathBoldSymbol(Buffer * buf, Kind kind = AMS_BOLD);
+ explicit InsetMathBoldSymbol(Buffer * buf, Kind kind = AMS_BOLD);
///
docstring name() const override;
///
diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h
index 7841d45338..6d779ce243 100644
--- a/src/mathed/InsetMathFrac.h
+++ b/src/mathed/InsetMathFrac.h
@@ -23,7 +23,7 @@ namespace lyx {
class InsetMathFracBase : public InsetMathNest {
public:
///
- InsetMathFracBase(Buffer * buf, idx_type ncells = 2);
+ explicit InsetMathFracBase(Buffer * buf, idx_type ncells = 2);
///
marker_type marker(BufferView const *) const override { return
marker_type::MARKER2; }
///
diff --git a/src/mathed/InsetMathKern.h b/src/mathed/InsetMathKern.h
index 41b63aa643..f68f8ffb67 100644
--- a/src/mathed/InsetMathKern.h
+++ b/src/mathed/InsetMathKern.h
@@ -26,7 +26,7 @@ namespace lyx {
class InsetMathKern : public InsetMath {
public:
///
- InsetMathKern(Buffer * buf);
+ explicit InsetMathKern(Buffer * buf);
///
explicit InsetMathKern(Buffer * buf, Length const & wid);
///
diff --git a/src/mathed/InsetMathXYMatrix.h b/src/mathed/InsetMathXYMatrix.h
index ccc2b5539f..0e96b11dea 100644
--- a/src/mathed/InsetMathXYMatrix.h
+++ b/src/mathed/InsetMathXYMatrix.h
@@ -23,7 +23,7 @@ namespace lyx {
class InsetMathXYMatrix : public InsetMathGrid {
public:
///
- InsetMathXYMatrix(Buffer * buf, Length const & = Length(), char c =
'\0',
+ explicit InsetMathXYMatrix(Buffer * buf, Length const & = Length(),
char c = '\0',
bool equal_spacing = false);
///
void metrics(MetricsInfo &, Dimension &) const override;
diff --git a/src/mathed/MathRow.h b/src/mathed/MathRow.h
index c2cd930660..c1814dbe08 100644
--- a/src/mathed/MathRow.h
+++ b/src/mathed/MathRow.h
@@ -97,7 +97,11 @@ public:
///
MathRow() {}
///
- MathRow(Dimension const & dim) : caret_dim(dim) {}
+ explicit MathRow(Dimension const & dim) : caret_dim(dim) {}
+ // create the math row by unwinding all macros in the MathData and
+ // compute the spacings.
+ MathRow(MetricsInfo & mi, MathData const * md);
+
///
typedef std::vector<Element> Elements;
///
@@ -119,10 +123,6 @@ public:
//
void insert(size_t pos, Element const & e) {
elements_.insert(elements_.begin() + pos, e); }
- // create the math row by unwinding all macros in the MathData and
- // compute the spacings.
- MathRow(MetricsInfo & mi, MathData const * md);
-
//
void metrics(MetricsInfo & mi, Dimension & dim);
//
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 1fcbcff78b..7f670607c3 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -420,7 +420,7 @@ private:
class MTag {
public:
///
- MTag(const std::string & tag, const std::string & attr = std::string())
+ explicit MTag(const std::string & tag, const std::string & attr =
std::string())
: tag_(tag), attr_(attr) {}
///
std::string tag_;
@@ -432,7 +432,7 @@ public:
class MTagInline {
public:
///
- MTagInline(const std::string & tag, const std::string & attr =
std::string())
+ explicit MTagInline(const std::string & tag, const std::string & attr =
std::string())
: tag_(tag), attr_(attr) {}
///
std::string tag_;
@@ -465,7 +465,7 @@ public:
class CTag {
public:
///
- CTag(const std::string & tag, std::string const & attr = "")
+ explicit CTag(const std::string & tag, std::string const & attr = "")
: tag_(tag), attr_(attr) {}
///
std::string tag_;
diff --git a/src/support/Cache.h b/src/support/Cache.h
index 1e44ff2f8b..eec9fc5f98 100644
--- a/src/support/Cache.h
+++ b/src/support/Cache.h
@@ -41,7 +41,7 @@ class Cache : private QCache<Key, Val> {
public:
///
- Cache(int max_cost = 100) : Q(max_cost) {}
+ explicit Cache(int max_cost = 100) : Q(max_cost) {}
///
bool insert(Key const & key, Val object, int cost = 1)
{
diff --git a/src/support/Changer.h b/src/support/Changer.h
index 0a5d14b8a3..43e2cac082 100644
--- a/src/support/Changer.h
+++ b/src/support/Changer.h
@@ -37,7 +37,7 @@ using Changer = std::unique_ptr<Revertible>;
template<typename X>
class RevertibleRef : public Revertible {
public:
- RevertibleRef(X & rf) : ref(rf), old(rf), enabled(true) {}
+ explicit RevertibleRef(X & rf) : ref(rf), old(rf), enabled(true) {}
//
~RevertibleRef() override { revert(); }
//
diff --git a/src/support/FileMonitor.h b/src/support/FileMonitor.h
index b7282dd896..4c746b77b8 100644
--- a/src/support/FileMonitor.h
+++ b/src/support/FileMonitor.h
@@ -127,7 +127,7 @@ class FileMonitor : public QObject
Q_OBJECT
public:
- FileMonitor(std::shared_ptr<FileMonitorGuard> const & monitor);
+ explicit FileMonitor(std::shared_ptr<FileMonitorGuard> const & monitor);
typedef signal<void(bool)> sig;
typedef sig::slot_type slot;
diff --git a/src/support/ForkedCalls.h b/src/support/ForkedCalls.h
index 6c41ca9d9b..ab36c97507 100644
--- a/src/support/ForkedCalls.h
+++ b/src/support/ForkedCalls.h
@@ -152,7 +152,7 @@ private:
class ForkedCall final : public ForkedProcess {
public:
///
- ForkedCall(std::string const & path = empty_string(),
+ explicit ForkedCall(std::string const & path = empty_string(),
std::string const & lpath = empty_string());
///
std::shared_ptr<ForkedProcess> clone() const override {
diff --git a/src/support/Lexer.h b/src/support/Lexer.h
index b1bee669b4..89383b1985 100644
--- a/src/support/Lexer.h
+++ b/src/support/Lexer.h
@@ -65,8 +65,8 @@ public:
/// initialize Lexer with no special keywords.
Lexer();
/// initialize Lexer with a bunch of keywords
- template<int N> Lexer(LexerKeyword (&table)[N])
- : pimpl_(0), lastReadOk_(false) { init(table, N); }
+ template<int N> explicit Lexer(LexerKeyword (&table)[N])
+ : pimpl_(0), lastReadOk_(false) { init(table, N); }
///
~Lexer();
diff --git a/src/support/Messages.h b/src/support/Messages.h
index e4670e4f6f..b3d88f0882 100644
--- a/src/support/Messages.h
+++ b/src/support/Messages.h
@@ -23,7 +23,7 @@ public:
/// dummy instantiation: no translation is done
Messages() {}
/// messages in the language \p l.
- Messages(std::string const & l);
+ explicit Messages(std::string const & l);
/// Return the translation of message \c msg, or the original
/// string if no context was found. Context is always removed.
docstring const get(std::string const & msg) const;
diff --git a/src/support/TempFile.h b/src/support/TempFile.h
index 16efede3ab..6e427346da 100644
--- a/src/support/TempFile.h
+++ b/src/support/TempFile.h
@@ -49,7 +49,7 @@ public:
* specify the "XXXXXX" portion if the extension of the generated
* name is important (e.g. for the converter machinery).
*/
- TempFile(std::string const & mask);
+ explicit TempFile(std::string const & mask);
TempFile(FileName const & temp_dir, std::string const & mask);
~TempFile();
/**
diff --git a/src/support/Timeout.h b/src/support/Timeout.h
index 98e171140e..9644d3a0b7 100644
--- a/src/support/Timeout.h
+++ b/src/support/Timeout.h
@@ -28,7 +28,7 @@ public:
CONTINUOUS //< repeating
};
/// Note that the c-tor is implemented in the GUI-specific frontends
- Timeout(unsigned int msec, Type = ONETIME);
+ explicit Timeout(unsigned int msec, Type = ONETIME);
///
~Timeout();
/// Is the timer running?
diff --git a/src/support/limited_stack.h b/src/support/limited_stack.h
index c76497c447..420e39af0a 100644
--- a/src/support/limited_stack.h
+++ b/src/support/limited_stack.h
@@ -32,7 +32,7 @@ public:
typedef typename container_type::const_iterator const_iterator;
/// limit is the maximum size of the stack
- limited_stack(size_type limit = 100) : limit_(limit) {}
+ explicit limited_stack(size_type limit = 100) : limit_(limit) {}
/// Return the top element.
value_type & top() {
diff --git a/src/support/mutex.h b/src/support/mutex.h
index 99b83e3a3d..5b831688b4 100644
--- a/src/support/mutex.h
+++ b/src/support/mutex.h
@@ -22,8 +22,8 @@ namespace lyx {
class Mutex
{
/// noncopyable
- Mutex(const Mutex&);
- Mutex& operator=(const Mutex&);
+ Mutex(const Mutex &);
+ Mutex & operator=(const Mutex &);
public:
Mutex();
~Mutex();
@@ -39,14 +39,14 @@ public:
class Locker
{
public:
- Locker(Mutex*);
+ explicit Locker(Mutex *);
~Locker();
private:
Locker();
- Locker(const Locker& rhs);
- Locker& operator=(const Locker& rhs);
- Mutex* mutex_;
+ Locker(const Locker & rhs);
+ Locker & operator=(const Locker & rhs);
+ Mutex * mutex_;
};
private:
diff --git a/src/tex2lyx/Parser.h b/src/tex2lyx/Parser.h
index 75549cbfa1..663a63f4fb 100644
--- a/src/tex2lyx/Parser.h
+++ b/src/tex2lyx/Parser.h
@@ -124,7 +124,7 @@ class iparserdocstream
public:
typedef idocstream::int_type int_type;
- iparserdocstream(idocstream & is) : is_(is) {}
+ explicit iparserdocstream(idocstream & is) : is_(is) {}
/// Like std::istream::operator bool()
/// Do not convert is_ implicitly to bool, since that is forbidden in
C++11.
@@ -176,7 +176,7 @@ public:
///
Parser(idocstream & is, std::string const & fixedenc);
///
- Parser(std::string const & s);
+ explicit Parser(std::string const & s);
///
~Parser();
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index e7870936a2..d32ce10f27 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -654,7 +654,7 @@ typedef int (*cmd_helper)(string const &, string const &);
class StopException : public exception
{
public:
- StopException(int status) : status_(status) {}
+ explicit StopException(int status) : status_(status) {}
int status() const { return status_; }
private:
int status_;
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs