1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) 2013-2014 Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 13 #ifndef NN_EC_DOWNLOAD_CART_H_ 14 #define NN_EC_DOWNLOAD_CART_H_ 15 16 #include <nn/ec/ec_Cart.h> 17 18 namespace nn { namespace ec { 19 20 //! @addtogroup nn_ec_class 21 //! @{ 22 23 /*! 24 @brief Class for handling a download cart. 25 26 @see <a class="el" href="../../Doc/EcdkProgrammingManual/contents/Pages/Page_48711722.html#PageId_54695848">Programming Manual</a> 27 */ 28 class DownloadCart : public Cart 29 { 30 public: 31 NN_EC_DECLARE_ACCESSOR; 32 NN_EC_DECLARE_IMPL; 33 34 public: 35 /*! 36 @brief Specifies the maximum number of items that can be added to the download cart. 37 */ 38 static const u32 ITEM_NUM_MAX = 100; 39 40 public: 41 /*! 42 @brief Instantiates the object. 43 */ 44 DownloadCart(); 45 46 /*! 47 @brief Destroys the object. 48 */ 49 ~DownloadCart(); 50 51 /*! 52 @brief Adds an item to the download cart. 53 54 The reference counter of the added item is incremented by 1. 55 56 @param[in] pItem Specifies the item. 57 58 @return The result of processing. 59 60 @retval Result::IsSuccess Indicates success. 61 @retval ResultInvalidArgument Indicates that an argument is invalid. 62 @retval ResultInvalidData Indicates that the data is invalid. (Item contains invalid data.) 63 @retval ResultOutOfMemory Insufficient memory. 64 @retval ResultItemError Not an item that can be downloaded again. 65 @retval ResultDownloadCartFull The maximum number of items has been reached. 66 @retval ResultDownloadCartAlreadyAdded The item has already been added to the download cart. 67 */ 68 nn::Result AddItem(const Item* pItem); 69 70 /*! 71 @brief Removes an item from the download cart. 72 73 The reference counter of the deleted item is decremented by 1. 74 75 @param[in] index Specifies the index of the item to remove. 76 77 @return The result of processing. 78 79 @retval Result::IsSuccess Indicates success. 80 @retval ResultNotFound There is no item with that specified index. 81 */ 82 nn::Result RemoveItem(u32 index); 83 84 /*! 85 @brief Checks whether an item can be added to the download cart. 86 87 @param[in] pItem Specifies the item. 88 89 @return The result of processing. 90 91 @retval Result::IsSuccess The item can be added. 92 @retval ResultInvalidArgument Indicates that an argument is invalid. 93 @retval ResultInvalidData Indicates that the data is invalid. (Item contains invalid data.) 94 @retval ResultItemError Not an item that can be downloaded again. 95 @retval ResultDownloadCartFull The maximum number of items has been reached. 96 @retval ResultDownloadCartAlreadyAdded The item has already been added to the download cart. 97 */ 98 nn::Result CheckItem(const Item* pItem) const; 99 100 /*! 101 @brief Synchronizes the current license information. 102 103 In some cases, an item that was added to the download cart can be downloaded again before synchronizing license information with <tt>@ref SynchronizeAocRights</tt>, but not after. 104 105 If this occurs, call this function to remove all non-downloadable items from the shopping cart. 106 The reference counter of the deleted item is decremented by 1. 107 108 */ 109 void SynchronizeCurrentRights(); 110 }; 111 112 //! @} 113 114 }} // namespace nn::ec 115 116 #endif // NN_EC_DOWNLOAD_CART_H_ 117