/*---------------------------------------------------------------------------* Copyright (C) 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_SHOPPING_CART_H_ #define NN_EC_SHOPPING_CART_H_ #include namespace nn { namespace ec { //! @addtogroup nn_ec_class //! @{ /*! @brief Class for handling a shopping cart. @see Programming Manual */ class ShoppingCart : public Cart { public: NN_EC_DECLARE_ACCESSOR; NN_EC_DECLARE_IMPL; public: /*! @brief Specifies the maximum number of downloadable content items that can be added to the shopping cart. */ static const u32 AOC_NUM_MAX = 20; /*! @brief Specifies the maximum number of items that can be added to the shopping cart. */ static const u32 ITEM_NUM_MAX = AOC_NUM_MAX; public: /*! @brief Instantiates an object. */ ShoppingCart(); /*! @brief Destroys the object. */ ~ShoppingCart(); /*! @brief Adds an item to the shopping 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 purchased. @retval ResultShoppingCartFull The maximum number of items has been reached. @retval ResultShoppingCartAlreadyAdded The item has already been added to the shopping cart. @retval ResultShoppingCartPartiallyAdded Indicates that a portion of the item that includes multiple pieces of content has already been added to the shopping cart. */ nn::Result AddItem(const Item* pItem); /*! @brief Removes an item from the shopping 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 shopping cart. An item that has not been purchased cannot be added again if it is already in the shopping 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 purchased. @retval ResultShoppingCartFull The maximum number of items has been reached. @retval ResultShoppingCartAlreadyAdded The item has already been added to the shopping cart. @retval ResultShoppingCartPartiallyAdded Indicates that a portion of the item that includes multiple pieces of content has already been added to the shopping cart. */ nn::Result CheckItem(const Item* pItem) const; /*! @brief Synchronizes the current license information. In some cases, an item that was added to the shopping cart can be purchased before synchronizing license information with @ref SynchronizeAocRights, but not after. If this occurs, call this function to remove all items that have not been purchased from the shopping cart. The reference counter of the deleted item is decremented by 1. */ void SynchronizeCurrentRights(); /*! @brief Gets the total amount of the prices of all items in the shopping cart. @return Returns the total amount of the prices. */ Money GetTotalAmount() const; }; //! @} }} // namespace nn::ec #endif // NN_EC_SHOPPING_CART_H_