Photon
1.0.0
Loading...
Searching...
No Matches
URL.hpp
Go to the documentation of this file.
1
/*
2
* =====================================================================
3
*
4
* Photon
5
* Copyright Amlal EL Mahrouss, all rights reserved.
6
*
7
* File: URL.hpp
8
* Purpose: Photon URI parser
9
*
10
* =====================================================================
11
*/
12
13
#pragma once
14
15
#include <
core/Core.hpp
>
16
17
#ifndef PHOTON_HTTPS_PROTOCOL
18
#define PHOTON_HTTPS_PROTOCOL ("https")
19
#endif
// !PHOTON_HTTPS_PROTOCOL
20
21
#ifndef PHOTON_HTTP_PROTOCOL
22
#define PHOTON_HTTP_PROTOCOL ("http")
23
#endif
// !PHOTON_HTTP_PROTOCOL
24
25
#ifndef PHOTON_FILE_PROTOCOL
26
#define PHOTON_FILE_PROTOCOL ("file")
27
#endif
// !PHOTON_FILE_PROTOCOL
28
29
#ifndef PHOTON_MAIL_PROTOCOL
30
#define PHOTON_MAIL_PROTOCOL ("mailto")
31
#endif
// !PHOTON_MAIL_PROTOCOL
32
33
#ifndef PHOTON_ECMA_PROTOCOL
34
#define PHOTON_ECMA_PROTOCOL ("javascript")
35
#endif
// !PHOTON_ECMA_PROTOCOL
36
37
#ifndef PHOTON_PHOTON_PROTOCOL
38
#define PHOTON_PHOTON_PROTOCOL ("photon")
39
#endif
// !PHOTON_PHOTON_PROTOCOL
40
41
namespace
Photon
42
{
43
class
PHOTON_API
URL
final
44
{
45
public
:
46
URL
(
const
char
* protocol);
47
virtual
~URL
();
48
49
URL
&
operator=
(
const
URL
&) =
default
;
50
URL
(
const
URL
&) =
default
;
51
52
String
port() noexcept;
53
String
protocol() noexcept;
54
String
get() noexcept;
55
56
public:
57
String
send(
String
data
);
58
String
fetch();
59
60
public:
61
URL
& operator/=(const
String
& uri);
62
URL
& operator/=(const
char
* uri);
63
64
private:
65
String
m_data;
66
String
m_protocol;
67
String
m_port;
68
};
69
70
class
PHOTON_API
URLError
final : public
BrowserError
71
{
72
public
:
73
URLError
(
URL
& uri) :
BrowserError
(
"INVALID_URL_AT_DEST"
), m_uri(uri)
74
{
75
}
76
77
~URLError
() =
default
;
// let the ABI define that.
78
79
URLError
&
operator=
(
const
URLError
&) =
default
;
80
URLError
(
const
URLError
&) =
default
;
81
82
URL
& get();
83
84
private
:
85
URL
m_uri
;
86
};
87
}
// namespace Photon
Core.hpp
Photon::BrowserError
Definition
Core.hpp:46
Photon::URLError
Definition
URL.hpp:71
Photon::URLError::operator=
URLError & operator=(const URLError &)=default
Photon::URLError::URLError
URLError(URL &uri)
Definition
URL.hpp:73
Photon::URLError::URLError
URLError(const URLError &)=default
Photon::URLError::m_uri
URL m_uri
Definition
URL.hpp:85
Photon::URLError::~URLError
~URLError()=default
Photon::URL
Definition
URL.hpp:44
Photon::URL::operator=
URL & operator=(const URL &)=default
Photon::URL::~URL
virtual ~URL()
Photon::URL::URL
URL(const URL &)=default
PHOTON_API
#define PHOTON_API
Definition
Config.hpp:64
Photon
This file is also about defining core js concepts.
Definition
BasePhotonWindow.hpp:22
Photon::String
std::string String
Definition
Core.hpp:37
data
Definition
format.h:1901
dev
core
URL.hpp
Generated by
1.9.8