Libgourou

Libgourou Git Source Tree

Root/include/fulfillment_item.h

1/*
2 Copyright 2021 Grégory Soutadé
3
4 This file is part of libgourou.
5
6 libgourou is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 libgourou is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with libgourou. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef _FULFILLMENT_ITEM_H_
21#define _FULFILLMENT_ITEM_H_
22
23#include "bytearray.h"
24
25#include <pugixml.hpp>
26
27namespace gourou
28{
29 class User;
30
31 /**
32 * @brief This class is a container for a fulfillment object
33 */
34 class FulfillmentItem
35 {
36 public:
37FulfillmentItem(pugi::xml_document& doc, User* user);
38
39/**
40 * @brief Return metadata value from ACSM metadata section
41 *
42 * @param name Name of key to return
43 */
44std::string getMetadata(std::string name);
45
46/**
47 * @brief Return rights generated by ACS server (XML format)
48 */
49std::string getRights();
50
51/**
52 * @brief Return epub download URL
53 */
54std::string getDownloadURL();
55
56/**
57 * @brief Return resource value
58 */
59std::string getResource();
60
61 private:
62pugi::xml_node metadatas;
63pugi::xml_document rights;
64std::string downloadURL;
65std::string resource;
66
67void buildRights(const pugi::xml_node& licenseToken, User* user);
68 };
69}
70
71#endif

Archive Download this file