Make classes final if they're not meant to be derived from

This commit is contained in:
Sebastian Messmer 2015-11-27 14:05:48 +01:00
parent 5a924f44fa
commit 6227764858
7 changed files with 19 additions and 23 deletions

View File

@ -16,14 +16,14 @@ class Device;
namespace fuse {
class Filesystem;
class Fuse {
class Fuse final {
public:
explicit Fuse(Filesystem *fs);
virtual ~Fuse();
~Fuse();
void run(int argc, char **argv);
bool running() const;
void stop();
void run(int argc, char **argv);
bool running() const;
void stop();
int getattr(const boost::filesystem::path &path, struct stat *stbuf);
int fgetattr(const boost::filesystem::path &path, struct stat *stbuf, fuse_file_info *fileinfo);

View File

@ -9,10 +9,9 @@
namespace fspp {
namespace fuse{
class FuseErrnoException: public std::runtime_error {
class FuseErrnoException final: public std::runtime_error {
public:
explicit FuseErrnoException(int errno_);
virtual ~FuseErrnoException();
int getErrno() const;
private:
@ -30,9 +29,6 @@ inline FuseErrnoException::FuseErrnoException(int errno_)
ASSERT(_errno != 0, "Errno shouldn't be zero");
}
inline FuseErrnoException::~FuseErrnoException() {
}
inline int FuseErrnoException::getErrno() const {
return _errno;
}
@ -40,4 +36,4 @@ inline int FuseErrnoException::getErrno() const {
}
}
#endif /* FSPP_FUSE_FUSEERRNOEXCEPTION_H_ */
#endif

View File

@ -17,7 +17,7 @@ class File;
class Symlink;
class OpenFile;
class FilesystemImpl: public fuse::Filesystem {
class FilesystemImpl final: public fuse::Filesystem {
public:
explicit FilesystemImpl(Device *device);
virtual ~FilesystemImpl();
@ -98,4 +98,4 @@ private:
}
#endif /* FSPP_IMPL_FILESYSTEMIMPL_H_ */
#endif

View File

@ -9,10 +9,10 @@
namespace fspp {
class FuseOpenFileList {
class FuseOpenFileList final {
public:
FuseOpenFileList();
virtual ~FuseOpenFileList();
~FuseOpenFileList();
int open(cpputils::unique_ref<OpenFile> file);
OpenFile *get(int descriptor);
@ -46,4 +46,4 @@ inline void FuseOpenFileList::close(int descriptor) {
}
#endif /* FSPP_IMPL_FUSEOPENFILELIST_H_ */
#endif

View File

@ -10,7 +10,7 @@
namespace fspp {
template<class Entry>
class IdList {
class IdList final {
public:
IdList();
virtual ~IdList();
@ -24,7 +24,7 @@ private:
int _id_counter;
mutable std::mutex _mutex;
DISALLOW_COPY_AND_ASSIGN(IdList<Entry>)
DISALLOW_COPY_AND_ASSIGN(IdList<Entry>);
};
template<class Entry>
@ -67,6 +67,6 @@ void IdList<Entry>::remove(int id) {
_entries.erase(found_iter);
}
} /* namespace fspp */
}
#endif /* FSPP_FUSE_IDLIST_H_ */
#endif

View File

@ -7,7 +7,7 @@
#include <messmer/cpp-utils/macros.h>
namespace fspp {
class Profiler {
class Profiler final {
public:
Profiler(std::atomic_uint_fast64_t *targetForAddingNanosec);
~Profiler();

View File

@ -4,10 +4,10 @@
#include <messmer/cpp-utils/data/Data.h>
class InMemoryFile {
class InMemoryFile final {
public:
InMemoryFile(cpputils::Data data);
virtual ~InMemoryFile();
~InMemoryFile();
int read(void *buf, size_t count, off_t offset) const;