- use C++11 features to delete unwanted methods.

This commit is contained in:
Christoph Oelckers 2020-02-08 10:42:37 +01:00
parent 645a8506e2
commit 5dca3403a1
2 changed files with 10 additions and 8 deletions

View file

@ -25,6 +25,11 @@ struct MPG123Decoder : public SoundDecoder
virtual size_t getSampleOffset() override; virtual size_t getSampleOffset() override;
virtual size_t getSampleLength() override; virtual size_t getSampleLength() override;
// Make non-copyable
MPG123Decoder() = default;
MPG123Decoder(const MPG123Decoder& rhs) = delete;
MPG123Decoder& operator=(const MPG123Decoder& rhs) = delete;
virtual ~MPG123Decoder(); virtual ~MPG123Decoder();
protected: protected:
@ -37,10 +42,6 @@ private:
static off_t file_lseek(void *handle, off_t offset, int whence); static off_t file_lseek(void *handle, off_t offset, int whence);
static ssize_t file_read(void *handle, void *buffer, size_t bytes); static ssize_t file_read(void *handle, void *buffer, size_t bytes);
// Make non-copyable
MPG123Decoder(const MPG123Decoder &rhs);
MPG123Decoder& operator=(const MPG123Decoder &rhs);
}; };
#endif #endif

View file

@ -21,6 +21,11 @@ struct SndFileDecoder : public SoundDecoder
virtual size_t getSampleOffset() override; virtual size_t getSampleOffset() override;
virtual size_t getSampleLength() override; virtual size_t getSampleLength() override;
SndFileDecoder() = default;
// Make non-copyable
SndFileDecoder(const SndFileDecoder& rhs) = delete;
SndFileDecoder& operator=(const SndFileDecoder& rhs) = delete;
virtual ~SndFileDecoder(); virtual ~SndFileDecoder();
protected: protected:
@ -36,10 +41,6 @@ private:
static sf_count_t file_read(void *ptr, sf_count_t count, void *user_data); static sf_count_t file_read(void *ptr, sf_count_t count, void *user_data);
static sf_count_t file_write(const void *ptr, sf_count_t count, void *user_data); static sf_count_t file_write(const void *ptr, sf_count_t count, void *user_data);
static sf_count_t file_tell(void *user_data); static sf_count_t file_tell(void *user_data);
// Make non-copyable
SndFileDecoder(const SndFileDecoder &rhs);
SndFileDecoder& operator=(const SndFileDecoder &rhs);
}; };
#endif #endif