mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Added new helpers to the Request, and smaller fixes.
This commit is contained in:
parent
dadd431f1c
commit
0a53e84fb4
@ -178,6 +178,18 @@ const String &Request::get_current_path_segment() const {
|
||||
return _path_stack[_path_stack_pointer];
|
||||
}
|
||||
|
||||
const String &Request::get_next_path_segment() const {
|
||||
int pst = _path_stack_pointer + 1;
|
||||
|
||||
if (pst >= _path_stack.size()) {
|
||||
//for convenience
|
||||
static const String e_str = "";
|
||||
return e_str;
|
||||
}
|
||||
|
||||
return _path_stack[pst];
|
||||
}
|
||||
|
||||
uint32_t Request::get_path_segment_count() const {
|
||||
return _path_stack.size();
|
||||
}
|
||||
@ -214,6 +226,12 @@ String Request::get_url_root_parent(const int parent) const {
|
||||
}
|
||||
|
||||
String Request::get_url_root() const {
|
||||
int pst = _path_stack_pointer + 1;
|
||||
|
||||
if (pst > _path_stack.size()) {
|
||||
pst = _path_stack.size();
|
||||
}
|
||||
|
||||
String path = "/";
|
||||
|
||||
for (uint32_t i = 0; i < _path_stack_pointer; ++i) {
|
||||
@ -224,6 +242,23 @@ String Request::get_url_root() const {
|
||||
return path;
|
||||
}
|
||||
|
||||
String Request::get_url_root_current() const {
|
||||
int pst = _path_stack_pointer + 1;
|
||||
|
||||
if (pst > _path_stack.size()) {
|
||||
pst = _path_stack.size();
|
||||
}
|
||||
|
||||
String path = "/";
|
||||
|
||||
for (uint32_t i = 0; i < pst; ++i) {
|
||||
path += _path_stack[i];
|
||||
path += "/";
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
String Request::get_url_site() const {
|
||||
String path = get_host();
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
virtual const String &get_path_full() const;
|
||||
const String &get_path_segment(const uint32_t i) const;
|
||||
const String &get_current_path_segment() const;
|
||||
const String &get_next_path_segment() const;
|
||||
uint32_t get_path_segment_count() const;
|
||||
uint32_t get_current_segment_index() const;
|
||||
uint32_t get_remaining_segment_count() const;
|
||||
@ -77,6 +78,7 @@ public:
|
||||
|
||||
String get_url_root_parent(const int parent = 1) const;
|
||||
String get_url_root() const;
|
||||
String get_url_root_current() const;
|
||||
String get_url_site() const;
|
||||
|
||||
String get_url_root_parent(const String &add) const;
|
||||
|
Loading…
Reference in New Issue
Block a user