libgourou/include/fulfillment_item.h

79 lines
1.8 KiB
C
Raw Permalink Normal View History

2021-07-03 21:57:53 +02:00
/*
Copyright 2021 Grégory Soutadé
This file is part of libgourou.
libgourou is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libgourou is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
2021-08-21 20:37:07 +02:00
along with libgourou. If not, see <http://www.gnu.org/licenses/>.
2021-07-03 21:57:53 +02:00
*/
#ifndef _FULFILLMENT_ITEM_H_
#define _FULFILLMENT_ITEM_H_
#include "bytearray.h"
#include <pugixml.hpp>
namespace gourou
{
class User;
/**
* @brief This class is a container for a fulfillment object
*/
class FulfillmentItem
{
public:
/**
* @brief Main constructor. Not to be called by user
*
* @param doc Fulfill reply
* @param user User pointer
*/
2021-07-03 21:57:53 +02:00
FulfillmentItem(pugi::xml_document& doc, User* user);
/**
* @brief Return metadata value from ACSM metadata section
*
* @param name Name of key to return
*/
std::string getMetadata(std::string name);
/**
* @brief Return rights generated by ACS server (XML format)
*/
std::string getRights();
/**
* @brief Return epub download URL
*/
std::string getDownloadURL();
/**
* @brief Return resource value
*/
std::string getResource();
2021-07-03 21:57:53 +02:00
private:
pugi::xml_document fulfillDoc;
2021-07-03 21:57:53 +02:00
pugi::xml_node metadatas;
pugi::xml_document rights;
std::string downloadURL;
std::string resource;
2021-07-03 21:57:53 +02:00
void buildRights(const pugi::xml_node& licenseToken, User* user);
};
}
#endif