diff options
author | Patrick Venture <venture@google.com> | 2018-11-01 16:52:10 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-11-01 16:59:54 -0700 |
commit | dace680fa404d7c02a68db105fd7b958b4681442 (patch) | |
tree | 6d447ced41a2d1ef9bbd8206d52099609cd973d1 /file.hpp | |
parent | 3c4a23e7764c7785d18cb30340a6d185022a797a (diff) | |
download | phosphor-gpio-monitor-dace680fa404d7c02a68db105fd7b958b4681442.tar.gz phosphor-gpio-monitor-dace680fa404d7c02a68db105fd7b958b4681442.zip |
Add clang-format to repo
Add clang-format to repo.
Change-Id: I3f8704d80dd0bdde0706ab189c68cffe6d347995
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'file.hpp')
-rw-r--r-- | file.hpp | 80 |
1 files changed, 40 insertions, 40 deletions
@@ -10,48 +10,48 @@ namespace gpio */ class FileDescriptor { - private: - /** @brief File descriptor for the gpio input device */ - int fd = -1; - - public: - FileDescriptor() = default; - FileDescriptor(const FileDescriptor&) = delete; - FileDescriptor& operator=(const FileDescriptor&) = delete; - FileDescriptor(FileDescriptor&&) = delete; - FileDescriptor& operator=(FileDescriptor&&) = delete; - - /** @brief Saves File descriptor and uses it to do file operation - * - * @param[in] fd - File descriptor - */ - FileDescriptor(int fd) : fd(fd) + private: + /** @brief File descriptor for the gpio input device */ + int fd = -1; + + public: + FileDescriptor() = default; + FileDescriptor(const FileDescriptor&) = delete; + FileDescriptor& operator=(const FileDescriptor&) = delete; + FileDescriptor(FileDescriptor&&) = delete; + FileDescriptor& operator=(FileDescriptor&&) = delete; + + /** @brief Saves File descriptor and uses it to do file operation + * + * @param[in] fd - File descriptor + */ + FileDescriptor(int fd) : fd(fd) + { + // Nothing + } + + ~FileDescriptor() + { + if (fd >= 0) { - // Nothing - } - - ~FileDescriptor() - { - if (fd >=0) - { - close(fd); - } - } - - int operator()() - { - return fd; - } - - operator bool() const - { - return fd != -1; - } - - void set(int descriptor) - { - fd = descriptor; + close(fd); } + } + + int operator()() + { + return fd; + } + + operator bool() const + { + return fd != -1; + } + + void set(int descriptor) + { + fd = descriptor; + } }; } // namespace gpio |