1 /*---------------------------------------------------------------------------*
2 
3 Copyright (C) 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_CART_H_
14 #define NN_EC_CART_H_
15 
16 #include <nn/ec/ec_ItemList.h>
17 
18 namespace nn { namespace ec {
19 
20 //! @addtogroup  nn_ec_class
21 //! @{
22 
23 /*!
24 @brief  Class for handling a cart.
25 */
26 class Cart : public ItemList
27 {
28 public:
29     NN_EC_DECLARE_ACCESSOR;
30     NN_EC_DECLARE_IMPL;
31 
32 public:
33     /*!
34 @brief  Instantiates an object.
35 */
36     Cart();
37 
38     /*!
39 @brief  Destroys the object.
40 */
41     virtual ~Cart();
42 
43     // pure-virtual:
44     virtual nn::Result AddItem(const Item* pItem) = 0;
45 
46     // pure-virtual:
47     virtual nn::Result RemoveItem(u32 index) = 0;
48 
49     // pure-virtual:
50     virtual nn::Result CheckItem(const Item* pItem) const = 0;
51 
52     // pure-virtual:
53     virtual void SynchronizeCurrentRights() = 0;
54 
55     /*!
56 @brief  Removes an item from the cart.
57 
58 The reference counter of the deleted item is decremented by 1.
59 
60 @param[in] id  Specifies the NS-UID of the item to remove.
61 
62 @return  The result of processing.
63 
64 @retval Result::IsSuccess  Indicates success.
65 @retval ResultNotFound  There is no item with that specified NS-UID.
66 */
67     nn::Result RemoveItemById(NsUniqueId id);
68 
69     /*!
70 @brief  Determines whether the specified item is in the cart.
71 
72 @param[in] pItem  Specifies the item.
73 
74 @return  Returns <tt>true</tt> if the item has been added to the cart, or <tt>false</tt> otherwise.
75 */
76     bool ContainsItem(const Item* pItem) const;
77 };
78 
79 //! @}
80 
81 }} // namespace nn::ec
82 
83 #endif // NN_EC_CART_H_
84