libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
URI.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_URI_HH_
2#define _BBC_PARSE_DASH_MPD_URI_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: URI class
5 *****************************************************************************
6 * Copyright: (C) 2025 British Broadcasting Corporation
7 * Author(s): David Waring <david.waring2@bbc.co.uk>
8 * License: LGPLv3
9 *
10 * For full license terms please see the LICENSE file distributed with this
11 * library or refer to: https://www.gnu.org/licenses/lgpl-3.0.txt.
12 */
13#include <iostream>
14#include <list>
15#include <string>
16
17#include "macros.hh"
18
21// Forward declarations for types only used by pointer or reference
22namespace xmlpp {
23 class Element;
24 class Node;
25}
28
30
31class BaseURL;
32
41public:
42 URI() :m_uri() {};
43 URI(const char *uri) :m_uri(uri) {validate();};
44 URI(const std::string &uri) :m_uri(uri) {validate();};
45 URI(std::string &&uri) :m_uri(std::move(uri)) {validate();};
46 URI(const URI &other) :m_uri(other.m_uri) {};
47 URI(URI &&other) :m_uri(std::move(other.m_uri)) {};
48
49 virtual ~URI() {};
50
51 URI &operator=(const URI &other) { m_uri = other.m_uri; return *this; };
52 URI &operator=(URI &&other) { m_uri = std::move(other.m_uri); return *this; };
53 URI &operator=(const std::string &val) { m_uri = val; validate(); return *this; };
54 URI &operator=(std::string &&val) { m_uri = std::move(val); validate(); return *this; };
55
56 bool operator==(const URI &other) const { return m_uri == other.m_uri; };
57
58 operator std::string() const { return m_uri; };
59 const std::string &str() const { return m_uri; };
60
61 URI resolveUsingBaseURLs(const std::list<BaseURL> &base_urls) const;
62 bool isURL() const;
63 bool isAbsoluteURL() const;
64
66protected:
67 friend class MPD;
68 friend class Period;
69 friend class AdaptationSet;
70 friend class Representation;
71 friend class BaseURL;
72 friend class SegmentBase;
73 URI(xmlpp::Node&);
74 void setXMLElement(xmlpp::Element&) const;
76
77private:
78 void validate();
79
80 std::string m_uri;
81};
82
84
85LIBMPDPP_PUBLIC_API std::ostream &operator<<(std::ostream &os, const LIBMPDPP_NAMESPACE_CLASS(URI) &uri);
86
87/* vim:ts=8:sts=4:sw=4:expandtab:
88 */
89#endif /*_BBC_PARSE_DASH_MPD_URI_HH_*/
std::ostream & operator<<(std::ostream &os, const com::bbc::libmpdpp ::URI &uri)
AdaptationSet class.
Definition AdaptationSet.hh:60
Definition BaseURL.hh:43
Definition MPD.hh:49
Definition Period.hh:53
Definition Representation.hh:55
Definition SegmentBase.hh:41
URI & operator=(URI &&other)
Definition URI.hh:52
URI(const char *uri)
Definition URI.hh:43
URI & operator=(std::string &&val)
Definition URI.hh:54
URI(const URI &other)
Definition URI.hh:46
URI(const std::string &uri)
Definition URI.hh:44
URI(std::string &&uri)
Definition URI.hh:45
URI resolveUsingBaseURLs(const std::list< BaseURL > &base_urls) const
URI & operator=(const std::string &val)
Definition URI.hh:53
URI()
Definition URI.hh:42
URI & operator=(const URI &other)
Definition URI.hh:51
URI(URI &&other)
Definition URI.hh:47
bool operator==(const URI &other) const
Definition URI.hh:56
const std::string & str() const
Definition URI.hh:59
bool isAbsoluteURL() const
virtual ~URI()
Definition URI.hh:49
#define LIBMPDPP_NAMESPACE_CLASS(A)
Definition macros.hh:61
#define LIBMPDPP_NAMESPACE_END
Definition macros.hh:54
#define LIBMPDPP_PUBLIC_API
Used to mark something as part of the public API.
Definition macros.hh:21
#define LIBMPDPP_NAMESPACE_BEGIN
Definition macros.hh:50
Definition SegmentAvailability.hh:87