Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Samo Golež
VLC
Commits
1b64ac0e
Commit
1b64ac0e
authored
Mar 03, 2020
by
Hugo Beauzée-Luyssen
Browse files
cxx helpers: Add an url helper
parent
c3cc9c9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/vlc_cxx_helpers.hpp
View file @
1b64ac0e
...
...
@@ -32,6 +32,8 @@
#include <memory>
#include <utility>
#include <type_traits>
#include <string>
#include <stdexcept>
#ifdef VLC_THREADS_H_
// Ensure we can use vlc_sem_wait_i11e. We can't declare different versions
...
...
@@ -397,6 +399,66 @@ private:
#endif // VLC_THREADS_H_
#ifdef VLC_URL_H
class
url
:
public
vlc_url_t
{
public:
class
invalid
:
public
std
::
runtime_error
{
public:
invalid
(
const
char
*
url
)
:
std
::
runtime_error
(
std
::
string
{
"Invalid url: "
}
+
url
)
{
}
};
url
()
{
psz_buffer
=
nullptr
;
psz_pathbuffer
=
nullptr
;
psz_host
=
nullptr
;
}
url
(
const
char
*
str
)
{
if
(
vlc_UrlParse
(
this
,
str
)
)
throw
invalid
(
str
);
}
url
(
const
std
::
string
&
str
)
:
url
(
str
.
c_str
()
)
{
}
~
url
()
{
vlc_UrlClean
(
this
);
}
url
(
const
url
&
)
=
delete
;
url
&
operator
=
(
const
url
&
)
=
delete
;
url
(
url
&&
u
)
noexcept
:
vlc_url_t
(
u
)
{
u
.
psz_buffer
=
nullptr
;
u
.
psz_pathbuffer
=
nullptr
;
u
.
psz_host
=
nullptr
;
}
url
&
operator
=
(
url
&&
u
)
noexcept
{
*
(
static_cast
<
vlc_url_t
*>
(
this
))
=
u
;
u
.
psz_buffer
=
nullptr
;
u
.
psz_pathbuffer
=
nullptr
;
u
.
psz_host
=
nullptr
;
return
*
this
;
}
};
#endif
}
// namespace vlc
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment