From b2416925f8845b70ed25fb4ec7cde8ef11e8c239 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 21 Aug 2025 20:39:52 +0100 Subject: Initial commit; basic Apache log parsing --- src/logTypes.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/logTypes.hpp (limited to 'src/logTypes.hpp') diff --git a/src/logTypes.hpp b/src/logTypes.hpp new file mode 100644 index 0000000..d4f1b7b --- /dev/null +++ b/src/logTypes.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include + +namespace WebStat { + struct QuotedString : std::string { + using std::string::string; + using std::string::operator=; + }; + + struct QueryString : std::optional { + using std::optional::optional; + using std::optional::operator=; + bool operator<=>(const QueryString &) const = default; + }; + + struct CLFString : std::optional { + using std::optional::optional; + using std::optional::operator=; + bool operator<=>(const CLFString &) const = default; + }; +} + +namespace scn { + using ContextType = scn::v4::basic_scan_context; + + template<> struct scanner : scanner { + static scan_expected scan(WebStat::QuotedString & value, ContextType & ctx); + }; + + template<> struct scanner : scanner { + static scan_expected scan(WebStat::QueryString & value, ContextType & ctx); + }; + + template<> struct scanner : scanner { + static scan_expected scan(WebStat::CLFString & value, ContextType & ctx); + + static void decode(std::string &); + }; +} -- cgit v1.2.3