Browse Source

Remove all Jupiter string types & aliases; left some string utilities in Readable_String.h for legacy usage

master
Jessica James 3 years ago
parent
commit
77762980cc
  1. 4
      README.md
  2. 10
      src/common/Config.cpp
  3. 1
      src/common/DataBuffer.cpp
  4. 2
      src/common/Database.cpp
  5. 4
      src/common/File.cpp
  6. 13
      src/common/GenericCommand.cpp
  7. 73
      src/common/HTTP_Server.cpp
  8. 4
      src/common/INIConfig.cpp
  9. 181
      src/common/IRC_Client.cpp
  10. 4
      src/common/Plugin.cpp
  11. 10
      src/common/Socket.cpp
  12. 1
      src/include/Jupiter/Base64.h
  13. 14
      src/include/Jupiter/Config.h
  14. 54
      src/include/Jupiter/DataBuffer_Imp.h
  15. 6
      src/include/Jupiter/Database.h
  16. 1
      src/include/Jupiter/File.h
  17. 3
      src/include/Jupiter/GenericCommand.h
  18. 27
      src/include/Jupiter/HTTP.h
  19. 98
      src/include/Jupiter/HTTP_QueryString.h
  20. 4
      src/include/Jupiter/HTTP_Server.h
  21. 48
      src/include/Jupiter/Hash.h
  22. 2
      src/include/Jupiter/IRC.h
  23. 29
      src/include/Jupiter/IRC_Client.h
  24. 61
      src/include/Jupiter/InvalidIndex.h
  25. 2
      src/include/Jupiter/Jupiter.h
  26. 6
      src/include/Jupiter/Plugin.h
  27. 41
      src/include/Jupiter/Readable_String.h
  28. 45
      src/include/Jupiter/Reference_String.h
  29. 114
      src/include/Jupiter/Shift_String.h
  30. 102
      src/include/Jupiter/Shift_String_Imp.h
  31. 10
      src/include/Jupiter/Socket.h
  32. 185
      src/include/Jupiter/String.hpp
  33. 250
      src/include/Jupiter/String_Imp.h
  34. 326
      src/include/Jupiter/String_Type.h
  35. 593
      src/include/Jupiter/String_Type_Imp.h
  36. 2
      src/jessilib

4
README.md

@ -2,10 +2,6 @@
Primarily developed in C++, Jupiter is an open-source multi-purpose library initially intended for the purpose of creating IRC bots, but is by no means restricted to IRC bots.
Jupiter has been used to expedite the production of numerous projects ranging from ZIP code verifiers, to game administration systems, to game leaderboards and web APIs.
## Strings
Jupiter contains a number of deprecated string classes, which are deprecated in favor of std::string_view and std::string.
These will be removed in the future, with any useful string utilities being replaced by equivalents in jessilib.
## Sockets
Jupiter includes a Socket wrapper, allowing for simple interaction with sockets, while eliminating all of the platform-dependant code.
Jupiter sockets are also IP agnostic, allowing for compatibility with IPv4, IPv6, and whatever the future may hold.

10
src/common/Config.cpp

@ -30,7 +30,7 @@ Jupiter::Config& Jupiter::Config::operator=(const Config& in_config) {
}
std::string_view Jupiter::Config::get(std::string_view in_key, std::string_view in_default_value) const {
auto value = m_table.find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto value = m_table.find(JUPITER_WRAP_MAP_KEY(in_key));
if (value != m_table.end()) {
return value->second;
}
@ -40,7 +40,7 @@ std::string_view Jupiter::Config::get(std::string_view in_key, std::string_view
Jupiter::Config *Jupiter::Config::getSection(std::string_view in_key) const {
if (m_sections != nullptr) {
auto section = m_sections->find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto section = m_sections->find(JUPITER_WRAP_MAP_KEY(in_key));
if (section != m_sections->end()) {
return &section->second;
}
@ -54,7 +54,7 @@ Jupiter::Config &Jupiter::Config::getSectionReference(std::string_view in_key) {
m_sections = std::make_unique<SectionHashTable>();
}
auto section = m_sections->find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto section = m_sections->find(JUPITER_WRAP_MAP_KEY(in_key));
if (section == m_sections->end()) {
// for some reason msvc doesn't like emplace
section = m_sections->try_emplace(static_cast<std::string>(in_key)).first;
@ -72,7 +72,7 @@ bool Jupiter::Config::set(std::string_view in_key, std::string in_value) {
}
bool Jupiter::Config::remove(std::string_view in_key) {
auto value = m_table.find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto value = m_table.find(JUPITER_WRAP_MAP_KEY(in_key));
if (value == m_table.end()) {
return false;
}
@ -86,7 +86,7 @@ bool Jupiter::Config::removeSection(std::string_view in_key) {
return false;
}
auto section = m_sections->find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto section = m_sections->find(JUPITER_WRAP_MAP_KEY(in_key));
if (section == m_sections->end()) {
return false;
}

1
src/common/DataBuffer.cpp

@ -19,7 +19,6 @@
#include <cstdlib>
#include <cstring>
#include "DataBuffer.h"
#include "Reference_String.h"
Jupiter::DataBuffer::DataBuffer() {
Jupiter::DataBuffer::base = nullptr;

2
src/common/Database.cpp

@ -17,7 +17,7 @@
*/
#include "Database.h"
#include <cstring>
#include "DataBuffer.h"
struct Jupiter::Database::Data
{

4
src/common/File.cpp

@ -20,7 +20,6 @@
#include <string>
#include "jessilib/word_split.hpp"
#include "File.h"
#include "String.hpp"
#if defined _WIN32
#define stat64 _stat64
@ -142,10 +141,9 @@ bool Jupiter::File::load(std::string file) {
}
bool Jupiter::File::load(FILE *file) {
Jupiter::String buffer(defaultBufferSize);
std::string buffer;
int chr;
while (true) {
chr = fgetc(file);

13
src/common/GenericCommand.cpp

@ -20,7 +20,6 @@
#include "jessilib/word_split.hpp"
#include "Plugin.h"
using namespace Jupiter::literals;
using namespace std::literals;
// Is there a reason we're not using WHITESPACE_SV?
@ -103,8 +102,7 @@ Jupiter::GenericCommandNamespace::~GenericCommandNamespace() {
Jupiter::GenericCommand::ResponseLine* Jupiter::GenericCommandNamespace::trigger(std::string_view in_input) {
GenericCommand* command;
Jupiter::ReferenceString input(in_input);
auto split_input = jessilib::word_split_once_view(input, GENERIC_COMMAND_WORD_DELIMITER_SV);
auto split_input = jessilib::word_split_once_view(in_input, GENERIC_COMMAND_WORD_DELIMITER_SV);
if (split_input.second.empty()) { // No parameters; list commands
return new Jupiter::GenericCommand::ResponseLine(m_help,Jupiter::GenericCommand::DisplayType::PrivateSuccess);
@ -115,14 +113,11 @@ Jupiter::GenericCommand::ResponseLine* Jupiter::GenericCommandNamespace::trigger
return command->trigger(split_input.second);
}
return new Jupiter::GenericCommand::ResponseLine(""_jrs, Jupiter::GenericCommand::DisplayType::PrivateError);
return new Jupiter::GenericCommand::ResponseLine(""sv, Jupiter::GenericCommand::DisplayType::PrivateError);
}
std::string_view Jupiter::GenericCommandNamespace::getHelp(std::string_view parameters) {
static Jupiter::ReferenceString not_found = "Error: Command not found"_jrs;
Jupiter::ReferenceString input(parameters);
auto input_split = jessilib::word_split_once_view(input, GENERIC_COMMAND_WORD_DELIMITER_SV);
auto input_split = jessilib::word_split_once_view(parameters, GENERIC_COMMAND_WORD_DELIMITER_SV);
if (input_split.second.empty()) // No parameters; list commands
{
if (Jupiter::GenericCommandNamespace::m_should_update_help)
@ -140,7 +135,7 @@ std::string_view Jupiter::GenericCommandNamespace::getHelp(std::string_view para
}
// Command not found
return not_found;
return "Error: Command not found"sv;
}
bool Jupiter::GenericCommandNamespace::isNamespace() const {

73
src/common/HTTP_Server.cpp

@ -21,16 +21,14 @@
#include <numeric>
#include "jessilib/split.hpp"
#include "jessilib/unicode.hpp"
#include "String.hpp"
#include "Reference_String.h"
#include "TCPSocket.h"
#include "HTTP.h"
#include "HTTP_Server.h"
using namespace Jupiter::literals;
using namespace std::literals;
static const std::string_view HTTP_REQUEST_ENDING = "\r\n\r\n"sv;
#define HTTP_ENDL "\r\n"
template<typename ResultT = unsigned int, typename InT>
ResultT calc_checksum(const InT& in_container) {
@ -130,7 +128,7 @@ directory_add_loop: // TODO: for the love of god, why why why
// add directory
size_t index = in_name_ref.find('/');
if (index != Jupiter::INVALID_INDEX) {
if (index != std::string_view::npos) {
directory->directories.push_back(std::make_unique<Directory>(static_cast<std::string>(in_name_ref.substr(size_t{ 0 }, index))));
directory = directory->directories[directories.size() - 1].get();
in_name_ref.remove_prefix(index + 1);
@ -191,7 +189,7 @@ Jupiter::HTTP::Server::Content *Jupiter::HTTP::Server::Directory::find(std::stri
}
size_t index = in_name_ref.find('/');
if (index == Jupiter::INVALID_INDEX) { // Search content
if (index == std::string_view::npos) { // Search content
unsigned int content_name_checksum = calc_checksum(in_name_ref);
index = content.size();
for (auto& content_item : content) {
@ -291,7 +289,7 @@ struct Jupiter::HTTP::Server::Data {
Jupiter::HTTP::Server::Data::Data() {
// hosts[0] is always the "global" namespace.
m_hosts.push_back(std::make_unique<Host>(static_cast<std::string>(Jupiter::HTTP::Server::global_namespace)));
m_hosts.push_back(std::make_unique<Host>(""s));
}
// Data destructor
@ -302,7 +300,6 @@ Jupiter::HTTP::Server::Data::~Data() {
// Data functions
void Jupiter::HTTP::Server::Data::hook(std::string_view hostname, std::string_view in_path, std::unique_ptr<Content> in_content) {
Jupiter::ReferenceString dir_name;
Jupiter::HTTP::Server::Host* host = find_host(hostname);
if (host == nullptr) {
@ -458,29 +455,30 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
{
default:
case HTTPVersion::HTTP_1_0:
result = "HTTP/1.0 200 OK"_jrs ENDL;
result = "HTTP/1.0 200 OK"sv HTTP_ENDL;
break;
case HTTPVersion::HTTP_1_1:
result = "HTTP/1.1 200 OK"_jrs ENDL;
result = "HTTP/1.1 200 OK"sv HTTP_ENDL;
break;
}
result += "Date: "_jrs;
result += "Date: "sv;
char *time_header = html_time();
result += time_header;
delete[] time_header;
result += ENDL;
result += HTTP_ENDL;
result += "Server: "_jrs JUPITER_VERSION ENDL;
result += string_printf("Content-Length: %u" ENDL, content_result->size());
result += "Server: "sv JUPITER_VERSION HTTP_ENDL;
result += "Content-Length: "sv;
result += std::to_string(content_result->size()); // TODO: to_chars?
result += HTTP_ENDL;
if (session.keep_alive)
result += "Connection: keep-alive"_jrs ENDL;
result += "Connection: keep-alive"sv HTTP_ENDL;
else
result += "Connection: close"_jrs ENDL;
result += "Connection: close"sv HTTP_ENDL;
result += "Content-Type: "_jrs;
result += "Content-Type: "sv;
if (content->type.empty()) {
result += Jupiter::HTTP::Content::Type::Text::PLAIN;
}
@ -489,18 +487,18 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
}
if (!content->charset.empty()) {
result += "; charset="_jrs;
result += "; charset="sv;
result += content->charset;
}
result += ENDL;
result += HTTP_ENDL;
if (!content->language.empty()) {
result += "Content-Language: "_jrs;
result += "Content-Language: "sv;
result += content->language;
result += ENDL;
result += HTTP_ENDL;
}
result += ENDL;
result += HTTP_ENDL;
if (command == HTTPCommand::GET)
result += *content_result;
@ -517,28 +515,28 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
{
default:
case HTTPVersion::HTTP_1_0:
result = "HTTP/1.0 404 Not Found"_jrs ENDL;
result = "HTTP/1.0 404 Not Found"sv HTTP_ENDL;
break;
case HTTPVersion::HTTP_1_1:
result = "HTTP/1.1 404 Not Found"_jrs ENDL;
result = "HTTP/1.1 404 Not Found"sv HTTP_ENDL;
break;
}
char *time_header = html_time();
result += "Date: "_jrs ENDL;
result += "Date: "sv HTTP_ENDL;
result += time_header;
delete[] time_header;
result += "Server: "_jrs JUPITER_VERSION ENDL;
result += "Server: "sv JUPITER_VERSION HTTP_ENDL;
result += "Content-Length: 0"_jrs ENDL;
result += "Content-Length: 0"sv HTTP_ENDL;
if (session.keep_alive)
result += "Connection: keep-alive"_jrs ENDL;
result += "Connection: keep-alive"sv HTTP_ENDL;
else
result += "Connection: close"_jrs ENDL;
result += "Connection: close"sv HTTP_ENDL;
result += ENDL ENDL;
result += HTTP_ENDL HTTP_ENDL;
session.sock.send(result);
}
break;
@ -558,7 +556,7 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
session.request = session.request.substr(get_line_offset(index));
}
if (session.request.find(HTTP_REQUEST_ENDING) != Jupiter::INVALID_INDEX) { // there's another full request already received
if (session.request.find(HTTP_REQUEST_ENDING) != std::string::npos) { // there's another full request already received
return process_request(session);
}
break;
@ -587,7 +585,7 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
auto second_split = jessilib::split_once_view(first_split.second, ' ');
query_string = second_split.first;
span = query_string.find('?'); // repurposing 'span'
if (span == Jupiter::INVALID_INDEX) {
if (span == std::string_view::npos) {
if (session.host == nullptr) {
content = find(query_string);
}
@ -622,7 +620,7 @@ int Jupiter::HTTP::Server::Data::process_request(HTTPSession &session) {
auto second_split = jessilib::split_once_view(first_split.second, ' ');
query_string = second_split.first;
span = query_string.find('?'); // repurposing 'span'
if (span == Jupiter::INVALID_INDEX) {
if (span == std::string_view::npos) {
if (session.host == nullptr) {
content = find(query_string);
}
@ -753,7 +751,7 @@ int Jupiter::HTTP::Server::think() {
std::string_view sock_buffer = session->sock.getBuffer();
if (session->request.size() + sock_buffer.size() <= m_data->max_request_size) { // accept
session->request += sock_buffer;
if (session->request.find(HTTP_REQUEST_ENDING) != Jupiter::INVALID_INDEX) { // completed request
if (session->request.find(HTTP_REQUEST_ENDING) != std::string::npos) { // completed request
session->last_active = std::chrono::steady_clock::now();
m_data->process_request(*session);
if (session->keep_alive == false) { // remove completed session
@ -794,7 +792,7 @@ int Jupiter::HTTP::Server::think() {
std::string_view sock_buffer = session->sock.getBuffer();
if (sock_buffer.size() < m_data->max_request_size) { // accept
session->request = session->sock.getBuffer();
if (sock_buffer.find(HTTP_REQUEST_ENDING) != Jupiter::INVALID_INDEX) { // completed request
if (sock_buffer.find(HTTP_REQUEST_ENDING) != std::string_view::npos) { // completed request
m_data->process_request(*session);
if (session->keep_alive) { // session will live for 30 seconds.
m_data->m_sessions.push_back(std::move(session));
@ -806,7 +804,7 @@ int Jupiter::HTTP::Server::think() {
}
}
else if (sock_buffer.size() == m_data->max_request_size) {
if (sock_buffer.find(HTTP_REQUEST_ENDING) == Jupiter::INVALID_INDEX) { // reject (too large)
if (sock_buffer.find(HTTP_REQUEST_ENDING) == std::string_view::npos) { // reject (too large)
continue;
}
@ -827,6 +825,3 @@ int Jupiter::HTTP::Server::think() {
}
return 0;
}
std::string_view Jupiter::HTTP::Server::global_namespace = ""_jrs;
std::string_view Jupiter::HTTP::Server::server_string = "Jupiter"_jrs;

4
src/common/INIConfig.cpp

@ -131,7 +131,7 @@ bool Jupiter::INIConfig::read_internal(const char *in_filename) {
while (depth > section_stack.size())
section_stack.push(std::addressof(section_stack.top()->getSectionReference({})));
section_stack.push(&section_stack.top()->getSectionReference(static_cast<KeyType>(line)));
section_stack.push(&section_stack.top()->getSectionReference(line));
}
else
{
@ -180,7 +180,7 @@ bool Jupiter::INIConfig::read_internal(const char *in_filename) {
line = std::string_view{};
// Add entry to current table on stack
section_stack.top()->set(KeyType{key}, static_cast<std::string>(line));
section_stack.top()->set(std::string{key}, static_cast<std::string>(line));
}
};

181
src/common/IRC_Client.cpp

@ -27,14 +27,13 @@
#include "Jupiter.h"
#include "Functions.h"
#include "TCPSocket.h"
#include "String.hpp"
#include "Plugin.h"
#include "Base64.h"
#include "Readable_String.h"
//#define SHORT_IRC_MACROS
#include "IRC_Numerics.h"
using namespace Jupiter::literals;
using namespace std::literals;
Jupiter::IRC::Client::Client(Jupiter::Config *in_primary_section, Jupiter::Config *in_secondary_section) {
@ -44,42 +43,42 @@ Jupiter::IRC::Client::Client(Jupiter::Config *in_primary_section, Jupiter::Confi
if (m_primary_section != nullptr)
m_primary_section_name = m_primary_section->getName();
m_server_hostname = static_cast<std::string>(Jupiter::IRC::Client::readConfigValue("Hostname"_jrs, ""_jrs));
m_server_hostname = static_cast<std::string>(Jupiter::IRC::Client::readConfigValue("Hostname"sv, ""sv));
m_log_file_name = static_cast<std::string>(Jupiter::IRC::Client::readConfigValue("LogFile"_jrs));
m_nickname = Jupiter::IRC::Client::readConfigValue("Nick"_jrs, "Jupiter"_jrs);
m_log_file_name = static_cast<std::string>(Jupiter::IRC::Client::readConfigValue("LogFile"sv));
m_nickname = Jupiter::IRC::Client::readConfigValue("Nick"sv, "Jupiter"sv);
m_realname = Jupiter::IRC::Client::readConfigValue("RealName"_jrs, "Jupiter IRC Client"_jrs);
m_realname = Jupiter::IRC::Client::readConfigValue("RealName"sv, "Jupiter IRC Client"sv);
m_sasl_password = Jupiter::IRC::Client::readConfigValue("SASL.Password"_jrs);
m_sasl_password = Jupiter::IRC::Client::readConfigValue("SASL.Password"sv);
if (m_sasl_password.empty())
m_sasl_password = Jupiter::IRC::Client::readConfigValue("SASL.Pass"_jrs);
m_sasl_password = Jupiter::IRC::Client::readConfigValue("SASL.Pass"sv);
m_sasl_account = Jupiter::IRC::Client::readConfigValue("SASL.Account"_jrs);
m_sasl_account = Jupiter::IRC::Client::readConfigValue("SASL.Account"sv);
if (m_sasl_account.empty())
m_sasl_account = m_nickname;
m_auto_part_message = Jupiter::IRC::Client::readConfigValue("AutoPartMessage"_jrs);
m_auto_part_message = Jupiter::IRC::Client::readConfigValue("AutoPartMessage"sv);
m_ssl = Jupiter::IRC::Client::readConfigBool("SSL"_jrs);
m_ssl_certificate = Jupiter::IRC::Client::readConfigValue("Certificate"_jrs);
m_ssl_key = Jupiter::IRC::Client::readConfigValue("Key"_jrs);
m_ssl = Jupiter::IRC::Client::readConfigBool("SSL"sv);
m_ssl_certificate = Jupiter::IRC::Client::readConfigValue("Certificate"sv);
m_ssl_key = Jupiter::IRC::Client::readConfigValue("Key"sv);
if (m_ssl_certificate.empty())
{
m_ssl_certificate = Jupiter::IRC::Client::readConfigValue("Cert"_jrs);
m_ssl_certificate = Jupiter::IRC::Client::readConfigValue("Cert"sv);
if (m_ssl_certificate.empty())
m_ssl_certificate = m_ssl_key;
}
if (m_ssl_key.empty())
m_ssl_key = m_ssl_certificate;
m_join_on_kick = Jupiter::IRC::Client::readConfigBool("AutoJoinOnKick"_jrs);
m_reconnect_delay = Jupiter::IRC::Client::readConfigInt("AutoReconnectDelay"_jrs);
m_max_reconnect_attempts = Jupiter::IRC::Client::readConfigInt("MaxReconnectAttempts"_jrs);
m_server_port = (unsigned short)Jupiter::IRC::Client::readConfigInt("Port"_jrs, m_ssl ? 994 : 194);
m_default_chan_type = Jupiter::IRC::Client::readConfigInt("Channel.Type"_jrs);
m_join_on_kick = Jupiter::IRC::Client::readConfigBool("AutoJoinOnKick"sv);
m_reconnect_delay = Jupiter::IRC::Client::readConfigInt("AutoReconnectDelay"sv);
m_max_reconnect_attempts = Jupiter::IRC::Client::readConfigInt("MaxReconnectAttempts"sv);
m_server_port = (unsigned short)Jupiter::IRC::Client::readConfigInt("Port"sv, m_ssl ? 994 : 194);
m_default_chan_type = Jupiter::IRC::Client::readConfigInt("Channel.Type"sv);
if (Jupiter::IRC::Client::readConfigBool("PrintOutput"_jrs, true))
if (Jupiter::IRC::Client::readConfigBool("PrintOutput"sv, true))
m_output = stdout;
else
m_output = nullptr;
@ -171,7 +170,7 @@ std::string_view Jupiter::IRC::Client::getConfigSection() const {
return m_primary_section_name;
}
return ""_jrs;
return ""sv;
}
Jupiter::Config *Jupiter::IRC::Client::getPrimaryConfigSection() const {
@ -255,7 +254,7 @@ void Jupiter::IRC::Client::setPrintOutput(FILE *f) {
m_output = f;
}
Jupiter::ReferenceString getSender(std::string_view line) {
std::string_view getSender(std::string_view line) {
return jessilib::word_split_once_view(line, ":! "sv).first;
}
@ -270,7 +269,7 @@ int Jupiter::IRC::Client::getAccessLevel(const Channel &in_channel, std::string_
}
int Jupiter::IRC::Client::getAccessLevel(std::string_view in_channel, std::string_view in_nickname) const {
auto channel = m_channels.find(in_channel);
auto channel = m_channels.find(JUPITER_WRAP_MAP_KEY(in_channel));
if (channel != m_channels.end())
return this->getAccessLevel(channel->second, in_nickname);
@ -279,10 +278,7 @@ int Jupiter::IRC::Client::getAccessLevel(std::string_view in_channel, std::strin
}
void Jupiter::IRC::Client::send(std::string_view rawMessage) {
Jupiter::StringS out = rawMessage;
out += ENDL;
m_socket->send(out);
m_socket->send(static_cast<std::string>(rawMessage) + "\r\n");
}
const Jupiter::IRC::Client::UserTableType &Jupiter::IRC::Client::getUsers() const {
@ -294,7 +290,7 @@ size_t Jupiter::IRC::Client::getUserCount() const {
}
std::shared_ptr<Jupiter::IRC::Client::User> Jupiter::IRC::Client::getUser(std::string_view in_nickname) const {
auto user = m_users.find(in_nickname);
auto user = m_users.find(JUPITER_WRAP_MAP_KEY(in_nickname));
if (user != m_users.end()) {
return user->second;
}
@ -311,8 +307,7 @@ size_t Jupiter::IRC::Client::getChannelCount() const {
}
Jupiter::IRC::Client::Channel *Jupiter::IRC::Client::getChannel(std::string_view in_channel) const {
Jupiter::ReferenceString channel_name = in_channel; // TODO: remove this
auto channel = m_channels.find(channel_name);
auto channel = m_channels.find(JUPITER_WRAP_MAP_KEY(in_channel));
if (channel != m_channels.end()) {
return const_cast<Channel*>(&channel->second);
}
@ -339,15 +334,19 @@ void Jupiter::IRC::Client::joinChannel(std::string_view in_channel, std::string_
void Jupiter::IRC::Client::partChannel(std::string_view in_channel) {
m_socket->send(string_printf("PART %.*s" ENDL, in_channel.size(), in_channel.data()));
Jupiter::ReferenceString channel_name = in_channel;
m_channels[channel_name].setType(-2);
auto channel = m_channels.find(JUPITER_WRAP_MAP_KEY(in_channel));
if (channel != m_channels.end()) {
channel->second.setType(-2);
}
}
void Jupiter::IRC::Client::partChannel(std::string_view in_channel, std::string_view in_message) {
m_socket->send(string_printf("PART %.*s :%.*s" ENDL, in_channel.size(), in_channel.data(), in_message.size(), in_message.data()));
Jupiter::ReferenceString channel_name = in_channel;
m_channels[channel_name].setType(-2);
auto channel = m_channels.find(JUPITER_WRAP_MAP_KEY(in_channel));
if (channel != m_channels.end()) {
channel->second.setType(-2);
}
}
void Jupiter::IRC::Client::sendMessage(std::string_view dest, std::string_view message) {
@ -387,7 +386,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
auto first_split = jessilib::split_once_view(line, " "sv);
Jupiter::ReferenceString w1 = first_split.first;
std::string_view w1 = first_split.first;
if (!w1.empty())
{
int numeric = asInt(first_split.second);
@ -395,7 +394,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
if (!first_split.second.empty()) {
// TODO: This entire method should basically just be a state machine instead of this massive mess
auto line_split = jessilib::split_view(line, " "sv);
auto getLineToken = [&line_split](size_t index) -> Jupiter::ReferenceString {
auto getLineToken = [&line_split](size_t index) -> std::string_view {
if (index < line_split.size()) {
return line_split[index];
}
@ -442,7 +441,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
{
case Error::UNKNOWNCOMMAND: // 421
{
Jupiter::ReferenceString command = getLineToken(2);
std::string_view command = getLineToken(2);
if (jessilib::equalsi(command, "STARTTLS"sv)) { // Server doesn't support STARTTLS
Client::startCAP();
}
@ -492,7 +491,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
case 0:
if (jessilib::equalsi(getLineToken(1), "CAP"sv))
{
Jupiter::ReferenceString w4 = getLineToken(3);
std::string_view w4 = getLineToken(3);
if (w4 == "LS"sv)
{
std::vector<std::string_view> cap_list{ line_split.begin() + 4, line_split.end() };
@ -567,8 +566,8 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
case Error::NICKNAMEINUSE: // 433
case Error::NICKCOLLISION: // 436
case Error::BANNICKCHANGE: // 437 -- Note: This conflicts with another token.
std::string_view altNick = Jupiter::IRC::Client::readConfigValue("AltNick"_jrs);
std::string_view configNick = Jupiter::IRC::Client::readConfigValue("Nick"_jrs, "Jupiter"_jrs);
std::string_view altNick = Jupiter::IRC::Client::readConfigValue("AltNick"sv);
std::string_view configNick = Jupiter::IRC::Client::readConfigValue("Nick"sv, "Jupiter"sv);
if (!altNick.empty() && jessilib::equalsi(m_nickname, altNick)) // The alternate nick failed.
{
@ -630,9 +629,8 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
case Reply::ISUPPORT: // 005
{
// Parse supported user prefixes
size_t pos = line.find("PREFIX=("_jrs);
if (pos != Jupiter::INVALID_INDEX)
{
size_t pos = line.find("PREFIX=("sv);
if (pos != std::string_view::npos) {
std::string_view prefix_line_start = line.substr(pos + 8);
size_t prefix_modes_end = prefix_line_start.find(')');
if (prefix_modes_end != std::string_view::npos) {
@ -643,8 +641,8 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
// Parse supported channel modes
pos = line.find("CHANMODES="_jrs);
if (pos != Jupiter::INVALID_INDEX) {
pos = line.find("CHANMODES="sv);
if (pos != std::string_view::npos) {
std::string_view chan_modes_view = line.substr(pos + 10, line.find(' '));
std::vector<std::string_view> chan_modes = jessilib::split_n_view(chan_modes_view, ","sv, 3); // only split 3 times to cover A-D, but server _can_ send more
if (chan_modes.size() > 0) {
@ -662,8 +660,8 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
// Parse supported channel types
pos = line.find("CHANTYPES="_jrs);
if (pos != Jupiter::INVALID_INDEX) {
pos = line.find("CHANTYPES="sv);
if (pos != std::string_view::npos) {
m_chan_types = line.substr(pos + 10, line.find(' '));
}
}
@ -674,7 +672,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
size_t offset = key.size();
unsigned int i = 1;
Jupiter::ReferenceString value;
std::string_view value;
auto config_loop_condition = [&]
{
key += std::to_string(i);
@ -692,15 +690,15 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
{
if (config != nullptr) {
for (auto& section : config->getSections()) {
if (section.second.get<bool>("AutoJoin"_jrs, false)) {
if (section.second.get<bool>("AutoJoin"sv, false)) {
this->joinChannel(section.first);
}
}
}
};
join_channels_for_config(m_primary_section->getSection("Channels"_jrs));
join_channels_for_config(m_secondary_section->getSection("Channels"_jrs));
join_channels_for_config(m_primary_section->getSection("Channels"sv));
join_channels_for_config(m_secondary_section->getSection("Channels"sv));
m_connection_status = 5;
m_reconnect_attempts = 0;
@ -777,10 +775,9 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
}
else {
Jupiter::ReferenceString message = message_view;
this->OnChat(channel_name, nick, message);
this->OnChat(channel_name, nick, message_view);
for (auto& plugin: Jupiter::plugins) {
plugin->OnChat(this, channel_name, nick, message);
plugin->OnChat(this, channel_name, nick, message_view);
}
}
}
@ -870,7 +867,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
auto user = getUser(nick);
if (user != nullptr) {
channel->delUser(nick);
Jupiter::ReferenceString reason;
std::string_view reason;
size_t pos = line.find(':', 1);
if (pos != std::string_view::npos)
@ -885,8 +882,12 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
if (jessilib::equalsi(nick, m_nickname))
Client::delChannel(channel_name);
if (user->getChannelCount() == 0)
m_users.erase(nick);
if (user->getChannelCount() == 0) {
auto user_itr = m_users.find(JUPITER_WRAP_MAP_KEY(nick));
if (user_itr != m_users.end()) {
m_users.erase(user_itr);
}
}
}
}
}
@ -895,7 +896,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
else if (jessilib::equalsi(command_token, "KICK"sv)) {
std::string_view channel_name = getLineToken(2);
if (!channel_name.empty()) {
Jupiter::ReferenceString kicker = getSender(line);
std::string_view kicker = getSender(line);
if (!kicker.empty()) {
std::string_view kicked_nickname = getLineToken(3);
if (!kicked_nickname.empty()) {
@ -905,7 +906,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
if (user != nullptr) {
channel->delUser(kicked_nickname);
size_t pos = line.find(':', 1);
Jupiter::ReferenceString reason;
std::string_view reason;
if (pos != std::string_view::npos)
reason = line.substr(pos + 1);
@ -924,7 +925,10 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
if (user->getChannelCount() == 0) {
m_users.erase(kicked_nickname);
auto user_itr = m_users.find(JUPITER_WRAP_MAP_KEY(kicked_nickname));
if (user_itr != m_users.end()) {
m_users.erase(user_itr);
}
}
}
}
@ -933,7 +937,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
}
else if (jessilib::equalsi(command_token, "QUIT"sv)) {
Jupiter::ReferenceString nick = getSender(line);
std::string_view nick = getSender(line);
std::string_view message = jessilib::split_once_view(line.substr(1), ':').second;
auto user = getUser(nick);
if (user != nullptr) {
@ -947,11 +951,14 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
plugin->OnQuit(this, nick, message);
}
m_users.erase(nick);
auto user_itr = m_users.find(JUPITER_WRAP_MAP_KEY(nick));
if (user_itr != m_users.end()) {
m_users.erase(user_itr);
}
}
}
else if (jessilib::equalsi(command_token, "INVITE"sv)) {
Jupiter::ReferenceString inviter = getSender(line);
std::string_view inviter = getSender(line);
std::string_view invited_nickname = getLineToken(2);
std::string_view channel_name = jessilib::split_once_view(line.substr(1), ':').second;
this->OnInvite(channel_name, inviter, invited_nickname);
@ -1084,7 +1091,7 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
{
if (!m_sasl_password.empty())
{
Jupiter::StringS auth_str = m_nickname + '\0' + m_sasl_account + '\0' + m_sasl_password;
std::string auth_str = m_nickname + '\0' + m_sasl_account + '\0' + m_sasl_password;
char *enc = Jupiter::base64encode(auth_str.data(), auth_str.size());
m_socket->send("AUTHENTICATE "s + enc + ENDL);
@ -1112,12 +1119,12 @@ int Jupiter::IRC::Client::process_line(std::string_view line) {
}
bool Jupiter::IRC::Client::connect() {
std::string_view clientAddress = Jupiter::IRC::Client::readConfigValue("ClientAddress"_jrs);
if (m_socket->connect(m_server_hostname.c_str(), m_server_port, clientAddress.empty() ? nullptr : static_cast<std::string>(clientAddress).c_str(), (unsigned short)Jupiter::IRC::Client::readConfigLong("ClientPort"_jrs)) == false)
std::string_view clientAddress = Jupiter::IRC::Client::readConfigValue("ClientAddress"sv);
if (m_socket->connect(m_server_hostname.c_str(), m_server_port, clientAddress.empty() ? nullptr : static_cast<std::string>(clientAddress).c_str(), (unsigned short)Jupiter::IRC::Client::readConfigLong("ClientPort"sv)) == false)
return false;
m_socket->setBlocking(false);
if (m_ssl == false && Jupiter::IRC::Client::readConfigBool("STARTTLS"_jrs, true))
if (m_ssl == false && Jupiter::IRC::Client::readConfigBool("STARTTLS"sv, true))
{
m_socket->send("STARTTLS" ENDL);
m_connection_status = 1;
@ -1135,7 +1142,7 @@ void Jupiter::IRC::Client::disconnect(bool stayDead)
m_reconnect_time = time(0) + m_reconnect_delay;
m_dead = stayDead;
this->OnDisconnect();
bool ssl = Jupiter::IRC::Client::readConfigBool("SSL"_jrs);
bool ssl = Jupiter::IRC::Client::readConfigBool("SSL"sv);
if (ssl != m_ssl)
{
m_ssl = ssl;
@ -1334,7 +1341,10 @@ void Jupiter::IRC::Client::writeToLogs(std::string_view message) {
*/
void Jupiter::IRC::Client::delChannel(std::string_view in_channel) {
m_channels.erase(in_channel);
auto channel_itr = m_channels.find(JUPITER_WRAP_MAP_KEY(in_channel));
if (channel_itr != m_channels.end()) {
m_channels.erase(channel_itr);
}
}
std::shared_ptr<Jupiter::IRC::Client::User> Jupiter::IRC::Client::findUser(std::string_view in_nickname) const {
@ -1390,8 +1400,7 @@ void Jupiter::IRC::Client::addNamesToChannel(Channel &in_channel, std::string_vi
}
void Jupiter::IRC::Client::addChannel(std::string_view in_channel) {
Jupiter::ReferenceString channel_name = in_channel;
m_channels.emplace(channel_name, Channel(channel_name, this));
m_channels.emplace(in_channel, Channel(in_channel, this));
}
bool Jupiter::IRC::Client::startCAP() {
@ -1420,15 +1429,15 @@ bool Jupiter::IRC::Client::registerClient() {
* User Implementation
*/
std::string_view Jupiter::IRC::Client::User::getNickname() const {
const std::string& Jupiter::IRC::Client::User::getNickname() const {
return m_nickname;
}
std::string_view Jupiter::IRC::Client::User::getUsername() const {
const std::string& Jupiter::IRC::Client::User::getUsername() const {
return m_username;
}
std::string_view Jupiter::IRC::Client::User::getHostname() const {
const std::string& Jupiter::IRC::Client::User::getHostname() const {
return m_hostname;
}
@ -1441,8 +1450,9 @@ size_t Jupiter::IRC::Client::User::getChannelCount() const {
*/
Jupiter::IRC::Client::Channel::Channel(std::string_view in_name, Jupiter::IRC::Client *in_parent) {
// TODO: remove this
auto to_lower = [&in_name]() {
Jupiter::String result(in_name.size());
std::string result;
const char *itr = in_name.data();
const char *end = itr + in_name.size();
@ -1459,10 +1469,10 @@ Jupiter::IRC::Client::Channel::Channel(std::string_view in_name, Jupiter::IRC::C
m_parent = in_parent;
m_type = m_parent->getDefaultChanType();
Jupiter::String name = to_lower();
std::string name = to_lower();
auto read_type = [&name](Jupiter::Config &in_config, int default_type) {
return in_config["Channels"_jrs][name].get<int>("Type"_jrs, default_type);
return in_config["Channels"sv][name].get<int>("Type"sv, default_type);
};
if (m_parent->getSecondaryConfigSection() != nullptr)
@ -1494,7 +1504,10 @@ std::shared_ptr<Jupiter::IRC::Client::Channel::User> Jupiter::IRC::Client::Chann
}
void Jupiter::IRC::Client::Channel::delUser(std::string_view in_nickname) {
m_users.erase(in_nickname);
auto user_itr = m_users.find(JUPITER_WRAP_MAP_KEY(in_nickname));
if (user_itr != m_users.end()) {
m_users.erase(user_itr);
}
}
void Jupiter::IRC::Client::Channel::addUserPrefix(std::string_view in_nickname, char prefix) {
@ -1520,7 +1533,7 @@ std::string_view Jupiter::IRC::Client::Channel::getName() const {
}
std::shared_ptr<Jupiter::IRC::Client::Channel::User> Jupiter::IRC::Client::Channel::getUser(std::string_view in_nickname) const {
auto user = m_users.find(in_nickname);
auto user = m_users.find(JUPITER_WRAP_MAP_KEY(in_nickname));
if (user != m_users.end()) {
return user->second;
}
@ -1528,8 +1541,6 @@ std::shared_ptr<Jupiter::IRC::Client::Channel::User> Jupiter::IRC::Client::Chann
return nullptr;
}
static_assert(Jupiter::INVALID_INDEX == std::string_view::npos);
char Jupiter::IRC::Client::Channel::getUserPrefix(const Channel::User& in_user) const {
std::string_view prefixes = m_parent->getPrefixes();
for (auto prefix : prefixes) {
@ -1579,19 +1590,19 @@ Jupiter::IRC::Client::User *Jupiter::IRC::Client::Channel::User::getUser() const
return m_user.get();
}
std::string_view Jupiter::IRC::Client::Channel::User::getPrefixes() const {
const std::string& Jupiter::IRC::Client::Channel::User::getPrefixes() const {
return m_prefixes;
}
std::string_view Jupiter::IRC::Client::Channel::User::getNickname() const {
const std::string& Jupiter::IRC::Client::Channel::User::getNickname() const {
return m_user->getNickname();
}
std::string_view Jupiter::IRC::Client::Channel::User::getUsername() const {
const std::string& Jupiter::IRC::Client::Channel::User::getUsername() const {
return m_user->getUsername();
}
std::string_view Jupiter::IRC::Client::Channel::User::getHostname() const {
const std::string& Jupiter::IRC::Client::Channel::User::getHostname() const {
return m_user->getHostname();
}

4
src/common/Plugin.cpp

@ -29,9 +29,7 @@
#include "Plugin.h"
#include <memory>
#include "Functions.h"
#include "String.hpp"
using namespace Jupiter::literals;
using namespace std::literals;
#if defined _WIN32
@ -102,7 +100,7 @@ bool Jupiter::Plugin::shouldRemove() const {
return _shouldRemove;
}
std::string_view Jupiter::Plugin::getName() const {
const std::string& Jupiter::Plugin::getName() const {
return name;
}

10
src/common/Socket.cpp

@ -396,23 +396,23 @@ in_addr6 Jupiter::Socket::pton6(const char *str) {
return r;
}
Jupiter::StringS Jupiter::Socket::ntop4(uint32_t ip) {
std::string Jupiter::Socket::ntop4(uint32_t ip) {
static char buf[16];
if (inet_ntop(AF_INET, &ip, buf, sizeof(buf)) == nullptr) {
return {};
}
return Jupiter::String(buf);
return std::string(buf);
}
Jupiter::StringS Jupiter::Socket::ntop6(in_addr6 ip) {
std::string Jupiter::Socket::ntop6(in_addr6 ip) {
static char buf[46];
if (inet_ntop(AF_INET6, &ip, buf, sizeof(buf)) == nullptr) {
return {};
}
return Jupiter::String(buf);
return std::string(buf);
}
Jupiter::StringS Jupiter::Socket::ntop(void *ip, size_t size) {
std::string Jupiter::Socket::ntop(void *ip, size_t size) {
switch (size) {
case 4:
return ntop4(*reinterpret_cast<uint32_t *>(ip));

1
src/include/Jupiter/Base64.h

@ -27,7 +27,6 @@
#include <cstdint>
#include <cstddef>
#include "Jupiter.h"
#include "String.hpp"
namespace Jupiter
{

14
src/include/Jupiter/Config.h

@ -28,8 +28,7 @@
#include <memory>
#include "Jupiter.h"
#include "Hash.h"
#include "Reference_String.h"
#include "String.hpp"
#include "Readable_String.h" // from_string
/** DLL Linkage Nagging */
#if defined _MSC_VER
@ -48,14 +47,7 @@ namespace Jupiter
/** Hash_Table type for sections */
using SectionHashTable = std::unordered_map<std::string, Config, str_hash<char>, std::equal_to<>>;
using ValuesHashTable = std::unordered_map<std::string, std::string, str_hash<char>, std::equal_to<>>;
#ifdef __cpp_lib_generic_unordered_lookup
using KeyType = std::string_view;
#define JUPITER_WRAP_CONFIG_KEY(in_key) in_key
#else // We can't use std::string_view for InKeyType until GCC 11 & clang 12, and I still want to support GCC 9
using KeyType = std::string;
#define JUPITER_WRAP_CONFIG_KEY(in_key) static_cast<KeyType>(in_key)
#endif // __cpp_lib_generic_unordered_lookup
using InKeyType = InMapKeyType;
Config() = default;
Config(const Config& in_config);
@ -236,7 +228,7 @@ namespace Jupiter
template<typename T>
inline T Jupiter::Config::get(std::string_view in_key, T in_default_value) const {
auto result = m_table.find(JUPITER_WRAP_CONFIG_KEY(in_key));
auto result = m_table.find(JUPITER_WRAP_MAP_KEY(in_key));
if (result == m_table.end()) {
return in_default_value;

54
src/include/Jupiter/DataBuffer_Imp.h

@ -25,6 +25,7 @@
* Note: Modification of this file is not supported in any way.
*/
#include <cstring>
#include <vector>
#include <array>
#include <string>
@ -41,9 +42,6 @@ template<typename T> T Jupiter::DataBuffer::interpret_data(uint8_t *&head)
return r;
}
template<template<typename, typename> class T, typename X, typename Y> static T<X, Y> interpret_data(uint8_t *&head);
template<template<typename, typename, typename> class T, typename X, typename Y, typename Z> static T<X, Y, Z> interpret_data(uint8_t *&head);
// Basic peek
template<typename T> T Jupiter::DataBuffer::peek() const
@ -201,11 +199,6 @@ template<template<typename> class T, typename Y> void Jupiter::DataBuffer::push(
Jupiter::DataBuffer::push<T, Y>(&data);
}
template<template<typename> class T, typename Y> T<Y> Jupiter::DataBuffer::interpret_data(uint8_t *&head)
{
return _Jupiter_DataBuffer_partial_specialization_impl<T>::template interpret<Y>(head);
}
// PUSH SPECIALIZATION: std::array
template<template<typename, size_t> class T> struct _Jupiter_DataBuffer_partial_specialization_impl_std_array
@ -288,42 +281,27 @@ template<template<typename, typename> class T, typename X, typename Y> T<X, Y> J
return _Jupiter_DataBuffer_partial_specialization_impl_std_vector<T>::template interpret<X, Y>(head);
}
template<template<typename, typename> class T, typename X, typename Y> static T<X, Y> interpret_data(uint8_t *&head)
{
return _Jupiter_DataBuffer_partial_specialization_impl_std_vector<T>::template interpret<X, Y>(head);
}
// SPECIALIZATION: std::string
template<template<typename, typename, typename> class T> struct _Jupiter_DataBuffer_partial_specialization_impl_std_string
{
};
template<> struct _Jupiter_DataBuffer_partial_specialization_impl_std_string<std::basic_string>
{
template<typename X, typename Y, typename Z> static void push(Jupiter::DataBuffer *buffer, const std::basic_string<X, Y, Z> *data)
{
buffer->push(data->size());
if (std::is_fundamental<typename std::basic_string<X, Y, Z>::value_type>::value)
buffer->push(reinterpret_cast<const uint8_t *>(data->data()), data->size() * sizeof(X));
else
{
auto itr = data->begin();
auto end = data->end();
while (itr != end)
buffer->push<typename std::basic_string<X, Y, Z>::value_type>(*itr++);
}
template<> struct _Jupiter_DataBuffer_partial_specialization_impl_std_string<std::basic_string> {
template<typename X, typename Y, typename Z> static void push(Jupiter::DataBuffer *buffer, const std::basic_string<X, Y, Z> *data) {
buffer->secure(sizeof(size_t) + data->size() * sizeof(Y));
buffer->push<size_t>(data->size());
buffer->push(reinterpret_cast<const uint8_t*>(data->data()), data->size() * sizeof(X));
};
template<typename X, typename Y, typename Z> static std::basic_string<X, Y, Z> interpret(uint8_t *&head)
{
size_t size_ = *reinterpret_cast<size_t *>(head);
template<typename X, typename Y, typename Z> static std::basic_string<X, Y, Z> interpret(uint8_t*& head) {
size_t read_length = *reinterpret_cast<size_t *>(head);
head += sizeof(size_t);
std::basic_string<X, Y, Z> r;
r.reserve(size_);
while (size_-- != 0)
r.push_back(Jupiter::DataBuffer::interpret_data<typename std::basic_string<X, Y, Z>::value_type>(head));
return r;
std::basic_string<X, Y, Z> result;
result.resize(read_length);
std::memcpy(result.data(), head, read_length);
head += read_length;
return result;
}
};
@ -342,9 +320,9 @@ template<template<typename, typename, typename> class T, typename X, typename Y,
return _Jupiter_DataBuffer_partial_specialization_impl_std_string<T>::template interpret<X, Y, Z>(head);
}
template<template<typename, typename, typename> class T, typename X, typename Y, typename Z> static T<X, Y, Z> interpret_data(uint8_t *&head)
{
return _Jupiter_DataBuffer_partial_specialization_impl_std_string<T>::template interpret<X, Y, Z>(head);
template<>
inline std::string Jupiter::DataBuffer::interpret_data<std::string>(uint8_t *&head) {
return _Jupiter_DataBuffer_partial_specialization_impl_std_string<std::basic_string>::template interpret<char, std::string::traits_type, std::string::allocator_type>(head);
}
#endif // _DATABUFFER_IMP_H_HEADER

6
src/include/Jupiter/Database.h

@ -24,10 +24,14 @@
* @brief Defines a database file structure.
*/
#include "String.hpp"
#include <cstdio>
#include <string>
#include <string_view>
#include "Jupiter.h"
namespace Jupiter
{
class DataBuffer;
/**
* @brief Provides an implementation for database files.

1
src/include/Jupiter/File.h

@ -25,7 +25,6 @@
*/
#include "Jupiter.h"
#include "Readable_String.h"
#include <cstdio>
namespace Jupiter

3
src/include/Jupiter/GenericCommand.h

@ -26,7 +26,6 @@
#include <memory>
#include "Command.h"
#include "String.hpp"
/** DLL Linkage Nagging */
#if defined _MSC_VER
@ -157,7 +156,7 @@ namespace Jupiter
private:
bool m_should_update_help = true;
Jupiter::StringS m_help;
std::string m_help;
};
/** Generic command list */

27
src/include/Jupiter/HTTP.h

@ -24,8 +24,6 @@
* @brief Defines constants related to HTTP
*/
#include "Reference_String.h"
namespace Jupiter
{
namespace HTTP
@ -137,14 +135,13 @@ namespace Jupiter
* @brief Content-Language values
* TODO: Implement all ISO 639-1 translations
*/
namespace Language
{
static STRING_LITERAL_AS_NAMED_REFERENCE(ENGLISH, "en");
static STRING_LITERAL_AS_NAMED_REFERENCE(FRENCH, "fr");
static STRING_LITERAL_AS_NAMED_REFERENCE(GERMAN, "gr");
static STRING_LITERAL_AS_NAMED_REFERENCE(RUSSIAN, "ru");
static STRING_LITERAL_AS_NAMED_REFERENCE(JAPANESE, "ja");
static STRING_LITERAL_AS_NAMED_REFERENCE(CHINESE, "zh");
namespace Language {
static constexpr std::string_view ENGLISH = "en";
static constexpr std::string_view FRENCH = "fr";
static constexpr std::string_view GERMAN = "gr";
static constexpr std::string_view RUSSIAN = "ru";
static constexpr std::string_view JAPANESE = "ja";
static constexpr std::string_view CHINESE = "zh";
}
/**
@ -157,16 +154,16 @@ namespace Jupiter
{
namespace Charset
{
static STRING_LITERAL_AS_NAMED_REFERENCE(ASCII, "ascii");
static STRING_LITERAL_AS_NAMED_REFERENCE(UTF8, "utf-8");
static constexpr std::string_view ASCII = "ascii";
static constexpr std::string_view UTF8 = "utf-8";
}
static STRING_LITERAL_AS_NAMED_REFERENCE(HTML, "text/html");
static STRING_LITERAL_AS_NAMED_REFERENCE(PLAIN, "text/plain");