summaryrefslogtreecommitdiff
path: root/src/logTypes.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/logTypes.hpp')
-rw-r--r--src/logTypes.hpp42
1 files changed, 42 insertions, 0 deletions
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 <optional>
+#include <scn/scan.h>
+#include <string>
+
+namespace WebStat {
+ struct QuotedString : std::string {
+ using std::string::string;
+ using std::string::operator=;
+ };
+
+ struct QueryString : std::optional<std::string> {
+ using std::optional<std::string>::optional;
+ using std::optional<std::string>::operator=;
+ bool operator<=>(const QueryString &) const = default;
+ };
+
+ struct CLFString : std::optional<std::string> {
+ using std::optional<std::string>::optional;
+ using std::optional<std::string>::operator=;
+ bool operator<=>(const CLFString &) const = default;
+ };
+}
+
+namespace scn {
+ using ContextType = scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char>;
+
+ template<> struct scanner<WebStat::QuotedString> : scanner<std::string, char> {
+ static scan_expected<typename ContextType::iterator> scan(WebStat::QuotedString & value, ContextType & ctx);
+ };
+
+ template<> struct scanner<WebStat::QueryString> : scanner<std::string, char> {
+ static scan_expected<typename ContextType::iterator> scan(WebStat::QueryString & value, ContextType & ctx);
+ };
+
+ template<> struct scanner<WebStat::CLFString> : scanner<std::string, char> {
+ static scan_expected<typename ContextType::iterator> scan(WebStat::CLFString & value, ContextType & ctx);
+
+ static void decode(std::string &);
+ };
+}