Add explicit to constructors with 1 argument

This commit is contained in:
Luis Díaz Más
2018-11-06 18:36:15 +01:00
parent 2ea9039879
commit dc7eb5008b
18 changed files with 26 additions and 25 deletions
+3 -3
View File
@@ -270,7 +270,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Constructor, takes a BasicIo reference
IoCloser(BasicIo& bio) : bio_(bio) {}
explicit IoCloser(BasicIo& bio) : bio_(bio) {}
//! Destructor, closes the BasicIo reference
virtual ~IoCloser() { close(); }
//@}
@@ -307,7 +307,7 @@ namespace Exiv2 {
therefore never failes.
@param path The full path of a file
*/
FileIo(const std::string& path);
explicit FileIo(const std::string& path);
#ifdef EXV_UNICODE_PATH
/*!
@brief Like FileIo(const std::string& path) but accepts a
@@ -778,7 +778,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor that reads data from stdin/data uri path and writes them to the temp file.
XPathIo(const std::string& orgPath);
explicit XPathIo(const std::string& orgPath);
#ifdef EXV_UNICODE_PATH
/*!
@brief Like XPathIo(const std::string& orgPath) but accepts a
+1 -1
View File
@@ -77,7 +77,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
BmpImage(BasicIo::AutoPtr io);
explicit BmpImage(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
+2 -2
View File
@@ -236,7 +236,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Constructor.
ExifThumbC(const ExifData& exifData);
explicit ExifThumbC(const ExifData& exifData);
//@}
//! @name Accessors
@@ -305,7 +305,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Constructor.
ExifThumb(ExifData& exifData);
explicit ExifThumb(ExifData& exifData);
//@}
//! @name Manipulators
+1 -1
View File
@@ -78,7 +78,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
GifImage(BasicIo::AutoPtr io);
explicit GifImage(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
+1 -1
View File
@@ -140,7 +140,7 @@ public:
/*! @brief Construct INIReader and parse given filename. See ini.h for more info
about the parsing.
*/
INIReader(std::string filename);
explicit INIReader(const std::string& filename);
/*! @brief Return the result of ini_parse(), i.e., 0 on success, line number of
first error on parse error, or -1 on file open error.
+1 -1
View File
@@ -174,7 +174,7 @@ namespace Exiv2 {
//! @name Constructors
//@{
//! Constructor.
PreviewManager(const Image& image);
explicit PreviewManager(const Image& image);
//@}
//! @name Accessors
+2 -2
View File
@@ -76,14 +76,14 @@ namespace Exiv2 {
//! For comparison with prefix
struct Prefix {
//! Constructor.
Prefix(const std::string& prefix);
explicit Prefix(const std::string& prefix);
//! The prefix string.
std::string prefix_;
};
//! For comparison with namespace
struct Ns {
//! Constructor.
Ns(const std::string& ns);
explicit Ns(const std::string& ns);
//! The namespace string
std::string ns_;
};
+1 -1
View File
@@ -79,7 +79,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
PsdImage(BasicIo::AutoPtr io);
explicit PsdImage(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
+1 -1
View File
@@ -69,7 +69,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
Rw2Image(BasicIo::AutoPtr io);
explicit Rw2Image(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
+3 -3
View File
@@ -90,7 +90,7 @@ namespace Exiv2 {
{
public:
//! constructor (acquires the lock)
RWLock(const pthread_rwlockattr_t *attr = 0)
explicit RWLock(const pthread_rwlockattr_t *attr = 0)
{
pthread_rwlock_init(&rwlock_, attr);
}
@@ -151,7 +151,7 @@ namespace Exiv2 {
{
public:
//! constructor - locks the object
ScopedReadLock(RWLock &rwlock):
explicit ScopedReadLock(RWLock &rwlock):
rwlock_(rwlock)
{
rwlock_.rdlock();
@@ -173,7 +173,7 @@ namespace Exiv2 {
{
public:
//! constructor - locks the object
ScopedWriteLock(RWLock &rwlock):
explicit ScopedWriteLock(RWLock &rwlock):
rwlock_(rwlock)
{
rwlock_.wrlock();
+3 -2
View File
@@ -73,7 +73,7 @@ namespace Exiv2 {
//! Search key to find a GroupInfo by its group name.
struct GroupInfo::GroupName {
GroupName(const std::string& groupName); //!< Constructor
explicit GroupName(const std::string& groupName);
std::string g_; //!< Group name
};
@@ -176,7 +176,8 @@ namespace Exiv2 {
@throw Error if the key cannot be constructed from the tag number
and group name.
*/
ExifKey(const TagInfo& ti);
explicit ExifKey(const TagInfo& ti);
//! Copy constructor
ExifKey(const ExifKey& rhs);
//! Destructor
+1 -1
View File
@@ -79,7 +79,7 @@ namespace Exiv2 {
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
*/
TgaImage(BasicIo::AutoPtr io);
explicit TgaImage(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
+1 -1
View File
@@ -195,7 +195,7 @@ namespace Exiv2 {
*/
struct EXIV2API DataBufRef {
//! Constructor
DataBufRef(std::pair<byte*, long> rhs) : p(rhs) {}
explicit DataBufRef(std::pair<byte*, long> rhs) : p(rhs) {}
//! Pointer to a byte array and its size
std::pair<byte*, long> p;
};
+1 -1
View File
@@ -282,7 +282,7 @@ time_t Position::deltaMax_ = 60 ;
class UserData
{
public:
UserData(Options& options):
explicit UserData(Options& options):
indent(0)
, count(0)
, nTrkpt(0)
+1 -1
View File
@@ -45,7 +45,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor
Cr2Header(ByteOrder byteOrder =littleEndian);
explicit Cr2Header(ByteOrder byteOrder =littleEndian);
//! Destructor.
~Cr2Header();
//@}
+1 -1
View File
@@ -208,7 +208,7 @@ int Exiv2::ini_parse(const char* filename, ini_handler handler, void* user)
return error;
}
INIReader::INIReader(string filename)
INIReader::INIReader(const std::string &filename)
{
_error = ini_parse(filename.c_str(), ValueHandler, this);
}
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor
OrfHeader(ByteOrder byteOrder =littleEndian);
explicit OrfHeader(ByteOrder byteOrder =littleEndian);
//! Destructor.
~OrfHeader();
//@}
+1 -1
View File
@@ -476,7 +476,7 @@ namespace Exiv2 {
class FindExifdatum {
public:
//! Constructor, initializes the object with the IfdId to look for.
FindExifdatum(Exiv2::Internal::IfdId ifdId) : ifdId_(ifdId) {}
explicit FindExifdatum(Exiv2::Internal::IfdId ifdId) : ifdId_(ifdId) {}
//! Returns true if IFD id matches.
bool operator()(const Exiv2::Exifdatum& md) const { return ifdId_ == md.ifdId(); }