split into src and lib and socket changes
* libanthracite files are now all in lib/ * anthracite-bin + anthracite-api-bin files are now all in src/ * socket split into header and source properly
This commit is contained in:
parent
fba87f3fbb
commit
71be773d49
24 changed files with 49 additions and 121 deletions
60
lib/http/header_query.hpp
Normal file
60
lib/http/header_query.hpp
Normal 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(); }
|
||||
};
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue