src.ctf.fs: make ctf_fs_file::path an std::string
[babeltrace.git] / src / plugins / ctf / fs-src / file.hpp
index ccde384b1756ca0e27abdeed1c9f29997ec9ed70..5f0ca39570ec32d3689d8c6438fe4b9cfb236f6c 100644 (file)
@@ -7,12 +7,23 @@
 #ifndef CTF_FS_FILE_H
 #define CTF_FS_FILE_H
 
+#include <memory>
+#include <string>
+
 #include <babeltrace2/babeltrace.h>
 
+#include "cpp-common/bt2c/libc-up.hpp"
 #include "cpp-common/bt2c/logging.hpp"
 
+struct ctf_fs_file_deleter
+{
+    void operator()(struct ctf_fs_file *file) noexcept;
+};
+
 struct ctf_fs_file
 {
+    using UP = std::unique_ptr<ctf_fs_file, ctf_fs_file_deleter>;
+
     explicit ctf_fs_file(const bt2c::Logger& parentLogger) :
         logger {parentLogger, "PLUGIN/SRC.CTF.FS/FILE"}
     {
@@ -20,18 +31,16 @@ struct ctf_fs_file
 
     bt2c::Logger logger;
 
-    /* Owned by this */
-    GString *path = nullptr;
+    std::string path;
 
-    /* Owned by this */
-    FILE *fp = nullptr;
+    bt2c::FileUP fp;
 
     off_t size = 0;
 };
 
 void ctf_fs_file_destroy(struct ctf_fs_file *file);
 
-struct ctf_fs_file *ctf_fs_file_create(const bt2c::Logger& parentLogger);
+ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger);
 
 int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
 
This page took 0.024894 seconds and 4 git commands to generate.