Added documentation comments using Doxygen, changed the file structure back to the original, and wrote the getter functions for the individual entries.

This commit is contained in:
rapturate
2026-05-28 12:33:46 -04:00
parent 5673f32e69
commit 9ce211c572
7 changed files with 192 additions and 101 deletions
+103
View File
@@ -0,0 +1,103 @@
/**
* @file log_parsing.h
* @author Lew Price (lewis.e.price@outlook.com)
* @brief A series of functions for parsing the access logs of an Apache2 webserver.
* @version 0.1
* @date 2026-05-28
*
* @copyright Copyright (c) 2026
*
*/
#pragma once
#include <regex>
#include <string>
struct Entry {
std::string ip;
std::string timestamp;
std::string request;
std::string status;
std::string bytes;
std::string referer;
std::string os;
std::string browser;
};
class parsed_logs {
private:
Entry entry;
std::vector<Entry> logs;
std::string url;
public:
/**
* @brief Construct a new parsed logs object
* Detailed explanation: This function takes in the absolute path to a .log file and parses the lines into individual "Entry"s. These Entrys are then stored into a vector that can then be accessed via getter functions.
* @param string
*/
parsed_logs(std::string);
/**
* @brief Getter function for a specific Entry's IP
*
* @param int
* @return std::string
*/
std::string entryx_ip(int);
/**
* @brief Getter function for a specific Entry's time stamp
*
* @param int
* @return std::string
*/
std::string entryx_timestamp(int);
/**
* @brief Getter function for a specific Entry's request
*
* @param int
* @return std::string
*/
std::string entryx_request(int);
/**
* @brief Getter function for a specific Entry's status
*
* @param int
* @return std::string
*/
std::string entryx_status(int);
/**
* @brief Getter function for a specific Entry's byte size
*
* @param int
* @return std::string
*/
std::string entryx_bytes(int);
/**
* @brief Getter function for a specific Entry's referer
*
* @param int
* @return std::string
*/
std::string entryx_referer(int);
/**
* @brief Getter function for a specific Entry's OS info
*
* @param int
* @return std::string
*/
std::string entryx_os(int);
/**
* @brief Getter function for a specific Entry's browser info
*
* @param int
* @return std::string
*/
std::string entryx_browser(int);
};