LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
parser::XmlParser Class Reference

#include <xmlParser.hpp>

Inheritance diagram for parser::XmlParser:
Inheritance graph
Collaboration diagram for parser::XmlParser:
Collaboration graph

Public Member Functions

 XmlParser ()
 
virtual ~XmlParser () override=default
 
void ParseData (const std::filesystem::path &filepath) override
 Loads and parses XML data from a file path.
 
void ParseData (std::istream &input) override
 Parse XML data from an arbitrary input stream.
 
uint32_t GetCurrentProgress () const override
 Gets the current parsing progress.
 
uint32_t GetTotalProgress () const override
 Gets the total expected progress value.
 
virtual std::vector< std::pair< std::string, std::string > > GetFileMetadata () const
 Ordered key → value pairs read from the file header during the last ParseData() call (see db::EventsContainer::SetFileMetadata).
 
void RegisterObserver (IDataParserObserver *observer)
 Registers an observer to receive parsing notifications.
 
void UnregisterObserver (IDataParserObserver *observer)
 
void NotifyNewEvent (db::LogEvent &&event)
 
void NotifyProgressUpdated ()
 
void NotifyNewEventBatch (std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch)
 

Public Attributes

uint32_t m_currentProgress = 0
 

Private Attributes

std::vector< IDataParserObserver * > observers
 

Constructor & Destructor Documentation

◆ XmlParser()

parser::XmlParser::XmlParser ( )

◆ ~XmlParser()

virtual parser::XmlParser::~XmlParser ( )
overridevirtualdefault

Member Function Documentation

◆ GetCurrentProgress()

uint32_t parser::XmlParser::GetCurrentProgress ( ) const
overridevirtual

Gets the current parsing progress.

Returns
uint32_t Current progress value (meaning depends on implementation)
Note
Progress values should be used with GetTotalProgress() for percentage calculations

Implements parser::IDataParser.

◆ GetFileMetadata()

virtual std::vector< std::pair< std::string, std::string > > parser::IDataParser::GetFileMetadata ( ) const
inlinevirtualinherited

Ordered key → value pairs read from the file header during the last ParseData() call (see db::EventsContainer::SetFileMetadata).

Returns
Empty for formats without a header (the default).

Reimplemented in parser::SapiLogParser.

◆ GetTotalProgress()

uint32_t parser::XmlParser::GetTotalProgress ( ) const
overridevirtual

Gets the total expected progress value.

Returns
uint32_t Maximum progress value when parsing is complete
Note
Return 0 if total progress cannot be determined in advance

Implements parser::IDataParser.

◆ NotifyNewEvent()

void parser::IDataParser::NotifyNewEvent ( db::LogEvent &&  event)
inlineinherited

◆ NotifyNewEventBatch()

void parser::IDataParser::NotifyNewEventBatch ( std::vector< std::pair< int, db::LogEvent::EventItems > > &&  eventBatch)
inlineinherited
Here is the caller graph for this function:

◆ NotifyProgressUpdated()

void parser::IDataParser::NotifyProgressUpdated ( )
inlineinherited
Here is the caller graph for this function:

◆ ParseData() [1/2]

void parser::XmlParser::ParseData ( const std::filesystem::path &  filepath)
overridevirtual

Loads and parses XML data from a file path.

Implements parser::IDataParser.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseData() [2/2]

void parser::XmlParser::ParseData ( std::istream &  input)
overridevirtual

Parse XML data from an arbitrary input stream.

Implements parser::IDataParser.

Here is the call graph for this function:

◆ RegisterObserver()

void parser::IDataParser::RegisterObserver ( IDataParserObserver *  observer)
inlineinherited

Registers an observer to receive parsing notifications.

Parameters
observerPointer to the observer object
Note
The observer must remain valid until parsing completes or it's unregistered
Duplicate observers are automatically prevented

◆ UnregisterObserver()

void parser::IDataParser::UnregisterObserver ( IDataParserObserver *  observer)
inlineinherited

Member Data Documentation

◆ m_currentProgress

uint32_t parser::XmlParser::m_currentProgress = 0

◆ observers

std::vector<IDataParserObserver*> parser::IDataParser::observers
privateinherited

The documentation for this class was generated from the following files: