10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
SimpleURLService.h
1#ifndef TENDUKE_NET_SIMPLEURLSERVICE_H
2#define TENDUKE_NET_SIMPLEURLSERVICE_H
3
4#include "./AbstractURLs.h"
5#include "./URLDecoder.h"
6#include "./URLEncoder.h"
7#include "./URLParser.h"
8
9namespace tenduke { namespace net {
10
11class SimpleURLService : public ::tenduke::net::AbstractURLs
12{
13public:
14 SimpleURLService(
15 const std::shared_ptr<const tenduke::net::URLDecoder> &url_decoder,
16 const std::shared_ptr<const tenduke::net::URLEncoder> &url_encoder,
17 const std::shared_ptr<const tenduke::net::URLParser> &url_parser
18 ) : urlDecoder(url_decoder),
19 urlEncoder(url_encoder),
20 parseURL(url_parser)
21 {
22 }
23
24 std::string decodeURLComponent(const char *value) const override
25 {
26 return urlDecoder->decode(value);
27 }
28 std::string decodeURLComponent(const char *value, size_t length) const override
29 {
30 return urlDecoder->decode(value, length);
31 }
32 std::string decodeURLComponent(const std::string &value) const override
33 {
34 return decodeURLComponent(value.c_str(), value.length());
35 }
36 std::string encodeURLComponent(const std::string &value) const override
37 {
38 return urlEncoder->encode(value);
39 }
40 tenduke::net::URL parse(const std::string &url) const override
41 {
42 return parseURL->from(url);
43 }
44
45private:
46 const std::shared_ptr<const ::tenduke::net::URLDecoder> urlDecoder;
47 const std::shared_ptr<const ::tenduke::net::URLEncoder> urlEncoder;
48 const std::shared_ptr<const ::tenduke::net::URLParser> parseURL;
49};
50
51}}
52
53
54#endif //TENDUKE_NET_SIMPLEURLSERVICE_H
Abstract base implementation of tenduke::net::URLs.
Definition AbstractURLs.h:13
std::string encodeURLComponent(const std::string &value) const override
Encodes URL component.
Definition SimpleURLService.h:36
std::string decodeURLComponent(const char *value) const override
Decodes URL component.
Definition SimpleURLService.h:24
std::string decodeURLComponent(const std::string &value) const override
Decodes URL component.
Definition SimpleURLService.h:32
std::string decodeURLComponent(const char *value, size_t length) const override
Decodes URL component.
Definition SimpleURLService.h:28
tenduke::net::URL parse(const std::string &url) const override
Parses URL from string.
Definition SimpleURLService.h:40
Represents URL.
Definition URL.h:21
Generic networking support.
Definition AbstractURLCodec.h:6
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4