diff options
Diffstat (limited to '')
-rw-r--r-- | src/logfile_fwd.hh | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/src/logfile_fwd.hh b/src/logfile_fwd.hh index 4ea8fea..4d169f3 100644 --- a/src/logfile_fwd.hh +++ b/src/logfile_fwd.hh @@ -37,6 +37,9 @@ #include "base/auto_fd.hh" #include "file_format.hh" +#include "piper.looper.hh" +#include "text_format.hh" +#include "vis_line.hh" using ui_clock = std::chrono::steady_clock; @@ -52,10 +55,11 @@ enum class logfile_name_source { REMOTE, }; +using file_location_t = mapbox::util::variant<vis_line_t, std::string>; + struct logfile_open_options_base { std::string loo_filename; logfile_name_source loo_source{logfile_name_source::USER}; - bool loo_temp_file{false}; dev_t loo_temp_dev{0}; ino_t loo_temp_ino{0}; bool loo_detect_format{true}; @@ -65,6 +69,10 @@ struct logfile_open_options_base { ssize_t loo_visible_size_limit{-1}; bool loo_tail{true}; file_format_t loo_file_format{file_format_t::UNKNOWN}; + nonstd::optional<std::string> loo_format_name; + nonstd::optional<text_format_t> loo_text_format; + nonstd::optional<lnav::piper::running_handle> loo_piper; + file_location_t loo_init_location{mapbox::util::no_init{}}; }; struct logfile_open_options : public logfile_open_options_base { @@ -82,14 +90,6 @@ struct logfile_open_options : public logfile_open_options_base { return *this; } - logfile_open_options& with_fd(auto_fd fd) - { - this->loo_fd = std::move(fd); - this->loo_temp_file = true; - - return *this; - } - logfile_open_options& with_stat_for_temp(const struct stat& st) { this->loo_temp_dev = st.st_dev; @@ -131,7 +131,7 @@ struct logfile_open_options : public logfile_open_options_base { this->loo_non_utf_is_visible = val; return *this; - }; + } logfile_open_options& with_visible_size_limit(ssize_t val) { @@ -154,7 +154,27 @@ struct logfile_open_options : public logfile_open_options_base { return *this; } - auto_fd loo_fd; + logfile_open_options& with_piper(lnav::piper::running_handle handle) + { + this->loo_piper = handle; + this->loo_filename = handle.get_name(); + + return *this; + } + + logfile_open_options& with_init_location(file_location_t fl) + { + this->loo_init_location = fl; + + return *this; + } + + logfile_open_options& with_text_format(text_format_t tf) + { + this->loo_text_format = tf; + + return *this; + } }; #endif |