aboutsummaryrefslogtreecommitdiffstats
path: root/src/libdash/source/xml/Node.h
blob: 552d83e5f10c455f4b615f0da3df3f6ea8251dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Node.h
 *****************************************************************************
 * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
 *
 * Email: libdash-dev@vicky.bitmovin.net
 *
 * This source code and its use and distribution, is subject to the terms
 * and conditions of the applicable license agreement.
 *****************************************************************************/

#ifndef NODE_H_
#define NODE_H_

#include "config.h"

#include "INode.h"
#include "../helpers/String.h"
#include "../mpd/AdaptationSet.h"
#include "../mpd/BaseUrl.h"
#include "../mpd/ContentComponent.h"
#include "../mpd/Descriptor.h"
#include "../mpd/Metrics.h"
#include "../mpd/MPD.h"
#include "../mpd/MultipleSegmentBase.h"
#include "../mpd/Period.h"
#include "../mpd/ProgramInformation.h"
#include "../mpd/Range.h"
#include "../mpd/Representation.h"
#include "../mpd/RepresentationBase.h"
#include "../mpd/SegmentBase.h"
#include "../mpd/SegmentList.h"
#include "../mpd/SegmentTemplate.h"
#include "../mpd/SegmentTimeline.h"
#include "../mpd/SegmentURL.h"
#include "../mpd/SubRepresentation.h"
#include "../mpd/Subset.h"
#include "../mpd/URLType.h"
#include "IHTTPTransaction.h"

namespace dash
{
    namespace xml
    {
        class Node : public INode
        {
            public:
                Node            ();
                Node            (const Node& other);
                virtual ~Node   ();

                const std::vector<INode *>&                 GetNodes            ()  const;
                const std::vector<Node *>&                  GetSubNodes         ()  const;
                std::vector<std::string>                    GetAttributeKeys    ()  const;
                const std::string&                          GetName             ()  const;
                std::string                                 GetText             ()  const;
                const std::map<std::string, std::string>&   GetAttributes       ()  const;
                int                                         GetType             ()  const;
                void                                        SetType             (int type);
                const std::string&                          GetAttributeValue   (std::string key) const;
                void                                        AddSubNode          (Node *node);
                void                                        SetName             (const std::string &name);
                bool                                        HasAttribute        (const std::string& name) const;
                void                                        AddAttribute        (const std::string &key, const std::string &value);
                bool                                        HasText             ()  const;
                void                                        SetText             (const std::string &text);
                void                                        Print               (std::ostream &stream)  const;
                dash::mpd::MPD*                             ToMPD               ()  const;
                void                                        SetMPDPath          (std::string path);

            private:
                void                                        SetCommonValuesForRep   (dash::mpd::RepresentationBase& object) const;
                void                                        SetCommonValuesForSeg   (dash::mpd::SegmentBase& object) const;
                void                                        SetCommonValuesForMSeg  (dash::mpd::MultipleSegmentBase& object) const;
                dash::mpd::AdaptationSet*                   ToAdaptationSet         ()  const;
                dash::mpd::BaseUrl*                         ToBaseUrl               ()  const;
                dash::mpd::ContentComponent*                ToContentComponent      ()  const;
                dash::mpd::Descriptor*                      ToDescriptor            ()  const;
                dash::mpd::Metrics*                         ToMetrics               ()  const;
                dash::mpd::Period*                          ToPeriod                ()  const;
                dash::mpd::ProgramInformation*              ToProgramInformation    ()  const;
                dash::mpd::Range*                           ToRange                 ()  const;
                dash::mpd::Representation*                  ToRepresentation        ()  const;
                dash::mpd::SegmentBase*                     ToSegmentBase           ()  const;
                dash::mpd::SegmentList*                     ToSegmentList           ()  const;
                dash::mpd::SegmentTemplate*                 ToSegmentTemplate       ()  const;
                dash::mpd::Timeline*                        ToTimeline              ()  const;
                dash::mpd::SegmentTimeline*                 ToSegmentTimeline       ()  const;
                dash::mpd::SegmentURL*                      ToSegmentURL            ()  const;
                dash::mpd::SubRepresentation*               ToSubRepresentation     ()  const;
                dash::mpd::Subset*                          ToSubset                ()  const;
                dash::mpd::URLType*                         ToURLType               (dash::metrics::HTTPTransactionType transActType)  const;

                std::vector<Node *>                 subNodes;
                std::map<std::string, std::string>  attributes;
                std::string                         name;
                std::string                         text;
                int                                 type;
                std::string                         mpdPath;

        };
    }
}

#endif /* NODE_H_ */