LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
ParserFactory.hpp File Reference

Factory for creating parser instances based on file type. More...

#include "IDataParser.hpp"
#include "Result.hpp"
#include "Error.hpp"
#include <filesystem>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <string>
Include dependency graph for ParserFactory.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  parser::ParserFactory
 Factory class for creating parser instances. More...
 

Namespaces

namespace  parser
 Data parsing components and interfaces.
 

Enumerations

enum class  parser::ParserType { parser::XML , parser::JSON , parser::CSV , parser::Custom }
 Supported parser types. More...
 

Detailed Description

Factory for creating parser instances based on file type.

Author
LogViewer Development Team
Date
2025

Implements the Factory design pattern for parser instantiation. Supports runtime registration of custom parsers and automatic parser selection based on file extension.

Example Usage:
// Automatic parser selection
auto parser = ParserFactory::CreateFromFile("logfile.xml");
parser->RegisterObserver(observer);
parser->ParseData("logfile.xml");
// Explicit parser type
auto xmlParser = ParserFactory::Create(ParserType::XML);
// Register custom parser
ParserFactory::Register(".custom", []() {
return std::make_unique<CustomParser>();
});
Data parsing components and interfaces.
Definition IControler.hpp:22