]> git.cworth.org Git - apitrace/commitdiff
Inline some File methods.
authorZack Rusin <zack@kde.org>
Thu, 25 Aug 2011 01:54:56 +0000 (21:54 -0400)
committerZack Rusin <zack@kde.org>
Thu, 25 Aug 2011 01:54:56 +0000 (21:54 -0400)
trace_file.cpp
trace_file.hpp

index 758ecd78c264d6e218b001473489394607da4b8f..c7227c68c84a27ef68f1b3a4fd264234376627cf 100644 (file)
@@ -25,75 +25,11 @@ File::File(const std::string &filename,
     }
 }
 
-
 File::~File()
 {
     close();
 }
 
-bool File::isOpened() const
-{
-    return m_isOpened;
-}
-
-File::Mode File::mode() const
-{
-    return m_mode;
-}
-
-std::string File::filename() const
-{
-    return m_filename;
-}
-
-bool File::open(const std::string &filename, File::Mode mode)
-{
-    if (m_isOpened) {
-        close();
-    }
-    m_isOpened = rawOpen(filename, mode);
-    m_mode = mode;
-
-    return m_isOpened;
-}
-
-bool File::write(const void *buffer, int length)
-{
-    if (!m_isOpened || m_mode != File::Write) {
-        return false;
-    }
-    return rawWrite(buffer, length);
-}
-
-bool File::read(void *buffer, int length)
-{
-    if (!m_isOpened || m_mode != File::Read) {
-        return false;
-    }
-    return rawRead(buffer, length);
-}
-
-void File::close()
-{
-    if (m_isOpened) {
-        rawClose();
-        m_isOpened = false;
-    }
-}
-
-void File::flush(FlushType type)
-{
-    rawFlush(type);
-}
-
-int File::getc()
-{
-    if (!m_isOpened || m_mode != File::Read) {
-        return 0;
-    }
-    return rawGetc();
-}
-
 bool File::isZLibCompressed(const std::string &filename)
 {
     std::fstream stream(filename.c_str(),
index f1a63f2affaf73262729767f58d788c59c8ae288..fc42e9b9e7f27ccdc0685d7833d14077bfd99272 100644 (file)
@@ -26,6 +26,7 @@ public:
 
     bool isOpened() const;
     File::Mode mode() const;
+
     std::string filename() const;
 
     bool open(const std::string &filename, File::Mode mode);
@@ -49,6 +50,69 @@ protected:
     bool m_isOpened;
 };
 
+inline bool File::isOpened() const
+{
+    return m_isOpened;
+}
+
+inline File::Mode File::mode() const
+{
+    return m_mode;
+}
+
+inline std::string File::filename() const
+{
+    return m_filename;
+}
+
+inline bool File::open(const std::string &filename, File::Mode mode)
+{
+    if (m_isOpened) {
+        close();
+    }
+    m_isOpened = rawOpen(filename, mode);
+    m_mode = mode;
+
+    return m_isOpened;
+}
+
+inline bool File::write(const void *buffer, int length)
+{
+    if (!m_isOpened || m_mode != File::Write) {
+        return false;
+    }
+    return rawWrite(buffer, length);
+}
+
+inline bool File::read(void *buffer, int length)
+{
+    if (!m_isOpened || m_mode != File::Read) {
+        return false;
+    }
+    return rawRead(buffer, length);
+}
+
+inline void File::close()
+{
+    if (m_isOpened) {
+        rawClose();
+        m_isOpened = false;
+    }
+}
+
+inline void File::flush(File::FlushType type)
+{
+    rawFlush(type);
+}
+
+inline int File::getc()
+{
+    if (!m_isOpened || m_mode != File::Read) {
+        return 0;
+    }
+    return rawGetc();
+}
+
 class ZLibFile : public File {
 public:
     ZLibFile(const std::string &filename = std::string(),