cleanup of source + build system

* seperated most parts into headers & source files
* seperated anthracite into libanthracite and anthracite-bin for modules
* built demo webAPI module
* rewrote some code to do things in the
* changed cmakelists to not build in src directory
This commit is contained in:
Nicholas Orlowsky 2025-02-04 02:03:27 -05:00
parent c4540a1397
commit 54d82b8c66
Signed by: nickorlow
GPG key ID: 838827D8C4611687
26 changed files with 607 additions and 378 deletions

60
src/http/header_query.hpp Normal file
View file

@ -0,0 +1,60 @@
#pragma once
#include <string>
namespace anthracite::http {
class name_value {
private:
std::string _name;
std::string _value;
protected:
name_value() {}
public:
name_value(std::string name, std::string value)
: _name(std::move(name))
, _value(std::move(value))
{
}
virtual ~name_value() = default;
name_value(const name_value&) = default;
name_value& operator=(name_value const&) = default;
name_value(name_value&&) = default;
name_value& operator=(name_value&&) = default;
std::string& name() { return _name; }
std::string& value() { return _value; }
virtual std::string to_string() { return ""; }
};
class header : public name_value {
public:
header()
: name_value()
{
}
header(std::string name, std::string value)
: name_value(name, value)
{
}
std::string to_string() override { return name() + ": " + value() + "\r\n"; }
};
class query_param : public name_value {
public:
query_param()
: name_value()
{
}
query_param(std::string name, std::string value)
: name_value(name, value)
{
}
std::string to_string() override { return name() + "=" + value(); }
};
};