LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
MainController.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "EventsContainer.hpp"
4#include "IControler.hpp"
5
6#include "IDataParser.hpp"
7
8#include <filesystem>
9#include <memory>
10
11namespace mvc {
12
14public:
15 explicit MainController(db::EventsContainer& events);
16
17 [[nodiscard]] std::vector<std::string> GetSearchColumns() const override;
18
19 void SearchEvents(const std::string& query,
20 const std::vector<std::string>& columns,
21 const std::function<void(const SearchResultRow&)>& onResult,
22 std::function<void(size_t, size_t)> progressCallback = {}) override;
23
24 void LoadLogFile(const std::filesystem::path& filepath,
25 parser::IDataParserObserver* observer) override;
26
27 uint32_t GetParserCurrentProgress() const override;
28 uint32_t GetParserTotalProgress() const override;
29
30 // parser::IDataParserObserver
31 void ProgressUpdated() override;
32 void NewEventFound(db::LogEvent&& event) override;
33 void NewEventBatchFound(std::vector<std::pair<int,
34 db::LogEvent::EventItems>>&& eventBatch) override;
35
36private:
38 std::unique_ptr<parser::IDataParser> m_activeParser;
39};
40
41} // namespace mvc
Container class for managing collections of LogEvent objects.
Interface for controller components in the MVC architecture.
Interface definitions for data parsing components.
High-performance, thread-safe container for managing large collections of LogEvent objects.
Definition EventsContainer.hpp:129
Represents a single, structured log event with key-value data.
Definition LogEvent.hpp:97
std::vector< std::pair< std::string, std::string > > EventItems
A collection of key-value pairs representing event data (eventFieldName, data).
Definition LogEvent.hpp:101
Toolkit-agnostic controller interface for the MVC architecture.
Definition IControler.hpp:55
Definition MainController.hpp:13
std::unique_ptr< parser::IDataParser > m_activeParser
Definition MainController.hpp:38
void NewEventFound(db::LogEvent &&event) override
Called when a new event is discovered during parsing.
Definition MainController.cpp:194
void ProgressUpdated() override
Called when parsing progress is updated.
Definition MainController.cpp:189
std::vector< std::string > GetSearchColumns() const override
Definition MainController.cpp:21
db::EventsContainer & m_events
Definition MainController.hpp:37
void NewEventBatchFound(std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch) override
Called when a batch of new events is discovered during parsing.
Definition MainController.cpp:199
void SearchEvents(const std::string &query, const std::vector< std::string > &columns, const std::function< void(const SearchResultRow &)> &onResult, std::function< void(size_t, size_t)> progressCallback={}) override
Definition MainController.cpp:44
void LoadLogFile(const std::filesystem::path &filepath, parser::IDataParserObserver *observer) override
Parses and loads the provided log file into the model.
Definition MainController.cpp:108
uint32_t GetParserTotalProgress() const override
Definition MainController.cpp:184
uint32_t GetParserCurrentProgress() const override
Definition MainController.cpp:179
Observer interface for receiving notifications from data parsers.
Definition IDataParser.hpp:52
Definition IControler.hpp:27
Result row returned by IController::SearchEvents() for each matching event.
Definition IControler.hpp:36