fs/io/*: make constructors "explicit"

This commit is contained in:
Max Kellermann 2017-01-04 10:37:55 +01:00
parent 288b98ccbf
commit 8aae9766e5
10 changed files with 10 additions and 10 deletions

View File

@ -36,7 +36,7 @@ class AutoGunzipReader final : public Reader {
GunzipReader *gunzip = nullptr; GunzipReader *gunzip = nullptr;
public: public:
AutoGunzipReader(Reader &_next) explicit AutoGunzipReader(Reader &_next)
:peek(_next) {} :peek(_next) {}
~AutoGunzipReader(); ~AutoGunzipReader();

View File

@ -44,7 +44,7 @@ class BufferedOutputStream {
DynamicFifoBuffer<char> buffer; DynamicFifoBuffer<char> buffer;
public: public:
BufferedOutputStream(OutputStream &_os) explicit BufferedOutputStream(OutputStream &_os)
:os(_os), buffer(32768) {} :os(_os), buffer(32768) {}
void Write(const void *data, size_t size); void Write(const void *data, size_t size);

View File

@ -40,7 +40,7 @@ class BufferedReader {
unsigned line_number = 0; unsigned line_number = 0;
public: public:
BufferedReader(Reader &_reader) explicit BufferedReader(Reader &_reader)
:reader(_reader), buffer(4096) {} :reader(_reader), buffer(4096) {}
/** /**

View File

@ -88,7 +88,7 @@ private:
Mode mode; Mode mode;
public: public:
FileOutputStream(Path _path, Mode _mode=Mode::CREATE); explicit FileOutputStream(Path _path, Mode _mode=Mode::CREATE);
~FileOutputStream() { ~FileOutputStream() {
if (IsDefined()) if (IsDefined())

View File

@ -46,7 +46,7 @@ class FileReader final : public Reader {
#endif #endif
public: public:
FileReader(Path _path); explicit FileReader(Path _path);
#ifdef WIN32 #ifdef WIN32
FileReader(FileReader &&other) FileReader(FileReader &&other)

View File

@ -43,7 +43,7 @@ public:
/** /**
* Construct the filter. * Construct the filter.
*/ */
GunzipReader(Reader &_next); explicit GunzipReader(Reader &_next);
~GunzipReader() { ~GunzipReader() {
inflateEnd(&z); inflateEnd(&z);

View File

@ -41,7 +41,7 @@ public:
/** /**
* Construct the filter. * Construct the filter.
*/ */
GzipOutputStream(OutputStream &_next); explicit GzipOutputStream(OutputStream &_next);
~GzipOutputStream(); ~GzipOutputStream();
/** /**

View File

@ -39,7 +39,7 @@ class PeekReader final : public Reader {
uint8_t buffer[64]; uint8_t buffer[64];
public: public:
PeekReader(Reader &_next) explicit PeekReader(Reader &_next)
:next(_next) {} :next(_next) {}
const void *Peek(size_t size); const void *Peek(size_t size);

View File

@ -30,7 +30,7 @@ class StdioOutputStream final : public OutputStream {
FILE *const file; FILE *const file;
public: public:
StdioOutputStream(FILE *_file):file(_file) {} explicit StdioOutputStream(FILE *_file):file(_file) {}
/* virtual methods from class OutputStream */ /* virtual methods from class OutputStream */
void Write(const void *data, size_t size) override { void Write(const void *data, size_t size) override {

View File

@ -38,7 +38,7 @@ class TextFile {
BufferedReader *const buffered_reader; BufferedReader *const buffered_reader;
public: public:
TextFile(Path path_fs); explicit TextFile(Path path_fs);
TextFile(const TextFile &other) = delete; TextFile(const TextFile &other) = delete;