mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
rename tab elements namespace
This commit is contained in:
parent
4e733d8997
commit
2986a475c1
29 changed files with 181 additions and 181 deletions
|
|
@ -1,94 +0,0 @@
|
|||
#include "request.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::data::navbar;
|
||||
using namespace std;
|
||||
|
||||
// Construct
|
||||
Request::Request()
|
||||
{
|
||||
// Init entry
|
||||
set_placeholder_text(
|
||||
_("URL or search term...")
|
||||
);
|
||||
|
||||
set_hexpand(
|
||||
true
|
||||
);
|
||||
|
||||
// Connect events
|
||||
signal_changed().connect(
|
||||
[this]
|
||||
{
|
||||
parse();
|
||||
|
||||
activate_action(
|
||||
"navbar.refresh"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
signal_activate().connect(
|
||||
[this]
|
||||
{
|
||||
parse();
|
||||
|
||||
activate_action(
|
||||
"data.update"
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Request::~Request() = default;
|
||||
|
||||
// Getters
|
||||
string Request::get_scheme()
|
||||
{
|
||||
return scheme;
|
||||
}
|
||||
|
||||
string Request::get_host()
|
||||
{
|
||||
return host;
|
||||
}
|
||||
|
||||
string Request::get_path()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
string Request::get_query()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
int Request::get_port()
|
||||
{
|
||||
return stoi(
|
||||
port
|
||||
);
|
||||
}
|
||||
|
||||
// Private helpers
|
||||
void Request::parse()
|
||||
{
|
||||
string subject = get_text();
|
||||
|
||||
smatch results;
|
||||
|
||||
static const regex pattern( // @TODO user:password@#fragment?
|
||||
R"regex(^((\w+)?:\/\/)?([^:\/]+)?(:(\d+)?)?([^\?$]+)?(\?(.*)?)?)regex"
|
||||
);
|
||||
|
||||
regex_search(
|
||||
subject,
|
||||
results,
|
||||
pattern
|
||||
);
|
||||
|
||||
scheme = results[2];
|
||||
host = results[3];
|
||||
port = results[5];
|
||||
path = results[6];
|
||||
query = results[8];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue