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 { namespace fuse {
class Filesystem; class Filesystem;
class Fuse { class Fuse final {
public: public:
explicit Fuse(Filesystem *fs); explicit Fuse(Filesystem *fs);
virtual ~Fuse(); ~Fuse();
void run(int argc, char **argv); void run(int argc, char **argv);
bool running() const; bool running() const;
void stop(); void stop();
int getattr(const boost::filesystem::path &path, struct stat *stbuf); int getattr(const boost::filesystem::path &path, struct stat *stbuf);
int fgetattr(const boost::filesystem::path &path, struct stat *stbuf, fuse_file_info *fileinfo); int fgetattr(const boost::filesystem::path &path, struct stat *stbuf, fuse_file_info *fileinfo);

View File

@ -9,10 +9,9 @@
namespace fspp { namespace fspp {
namespace fuse{ namespace fuse{
class FuseErrnoException: public std::runtime_error { class FuseErrnoException final: public std::runtime_error {
public: public:
explicit FuseErrnoException(int errno_); explicit FuseErrnoException(int errno_);
virtual ~FuseErrnoException();
int getErrno() const; int getErrno() const;
private: private:
@ -30,9 +29,6 @@ inline FuseErrnoException::FuseErrnoException(int errno_)
ASSERT(_errno != 0, "Errno shouldn't be zero"); ASSERT(_errno != 0, "Errno shouldn't be zero");
} }
inline FuseErrnoException::~FuseErrnoException() {
}
inline int FuseErrnoException::getErrno() const { inline int FuseErrnoException::getErrno() const {
return _errno; 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 Symlink;
class OpenFile; class OpenFile;
class FilesystemImpl: public fuse::Filesystem { class FilesystemImpl final: public fuse::Filesystem {
public: public:
explicit FilesystemImpl(Device *device); explicit FilesystemImpl(Device *device);
virtual ~FilesystemImpl(); virtual ~FilesystemImpl();
@ -98,4 +98,4 @@ private:
} }
#endif /* FSPP_IMPL_FILESYSTEMIMPL_H_ */ #endif

View File

@ -9,10 +9,10 @@
namespace fspp { namespace fspp {
class FuseOpenFileList { class FuseOpenFileList final {
public: public:
FuseOpenFileList(); FuseOpenFileList();
virtual ~FuseOpenFileList(); ~FuseOpenFileList();
int open(cpputils::unique_ref<OpenFile> file); int open(cpputils::unique_ref<OpenFile> file);
OpenFile *get(int descriptor); 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 { namespace fspp {
template<class Entry> template<class Entry>
class IdList { class IdList final {
public: public:
IdList(); IdList();
virtual ~IdList(); virtual ~IdList();
@ -24,7 +24,7 @@ private:
int _id_counter; int _id_counter;
mutable std::mutex _mutex; mutable std::mutex _mutex;
DISALLOW_COPY_AND_ASSIGN(IdList<Entry>) DISALLOW_COPY_AND_ASSIGN(IdList<Entry>);
}; };
template<class Entry> template<class Entry>
@ -67,6 +67,6 @@ void IdList<Entry>::remove(int id) {
_entries.erase(found_iter); _entries.erase(found_iter);
} }
} /* namespace fspp */ }
#endif /* FSPP_FUSE_IDLIST_H_ */ #endif

View File

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

View File

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