/*---------------------------------------------------------------------------* Copyright (C) 2013-2014 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef NN_EC_DOWNLOAD_CART_H_ #define NN_EC_DOWNLOAD_CART_H_ #include namespace nn { namespace ec { //! @addtogroup nn_ec_class //! @{ /*! @brief Class for handling a download cart. @see Programming Manual */ class DownloadCart : public Cart { public: NN_EC_DECLARE_ACCESSOR; NN_EC_DECLARE_IMPL; public: /*! @brief Specifies the maximum number of items that can be added to the download cart. */ static const u32 ITEM_NUM_MAX = 100; public: /*! @brief Instantiates the object. */ DownloadCart(); /*! @brief Destroys the object. */ ~DownloadCart(); /*! @brief Adds an item to the download cart. The reference counter of the added item is incremented by 1. @param[in] pItem Specifies the item. @return The result of processing. @retval Result::IsSuccess Indicates success. @retval ResultInvalidArgument Indicates that an argument is invalid. @retval ResultInvalidData Indicates that the data is invalid. (Item contains invalid data.) @retval ResultOutOfMemory Insufficient memory. @retval ResultItemError Not an item that can be downloaded again. @retval ResultDownloadCartFull The maximum number of items has been reached. @retval ResultDownloadCartAlreadyAdded The item has already been added to the download cart. */ nn::Result AddItem(const Item* pItem); /*! @brief Removes an item from the download cart. The reference counter of the deleted item is decremented by 1. @param[in] index Specifies the index of the item to remove. @return The result of processing. @retval Result::IsSuccess Indicates success. @retval ResultNotFound There is no item with that specified index. */ nn::Result RemoveItem(u32 index); /*! @brief Checks whether an item can be added to the download cart. @param[in] pItem Specifies the item. @return The result of processing. @retval Result::IsSuccess The item can be added. @retval ResultInvalidArgument Indicates that an argument is invalid. @retval ResultInvalidData Indicates that the data is invalid. (Item contains invalid data.) @retval ResultItemError Not an item that can be downloaded again. @retval ResultDownloadCartFull The maximum number of items has been reached. @retval ResultDownloadCartAlreadyAdded The item has already been added to the download cart. */ nn::Result CheckItem(const Item* pItem) const; /*! @brief Synchronizes the current license information. In some cases, an item that was added to the download cart can be downloaded again before synchronizing license information with @ref SynchronizeAocRights, but not after. If this occurs, call this function to remove all non-downloadable items from the shopping cart. The reference counter of the deleted item is decremented by 1. */ void SynchronizeCurrentRights(); }; //! @} }} // namespace nn::ec #endif // NN_EC_DOWNLOAD_CART_H_