1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Interface for single item model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IMULSINGLEITEMMODEL_H_ |
|
20 #define IMULSINGLEITEMMODEL_H_ |
|
21 |
|
22 // Includes |
|
23 #include <alf/ialfmodel.h> |
|
24 |
|
25 namespace osncore |
|
26 { |
|
27 // Forward Declarations |
|
28 class UString; |
|
29 } |
|
30 using namespace osncore; |
|
31 |
|
32 namespace Alf |
|
33 { |
|
34 |
|
35 // Forward Declarations |
|
36 class MulVisualItem; |
|
37 |
|
38 namespace mulsingleitemmodel |
|
39 { |
|
40 static const int KLastIndex = -1; |
|
41 static const int KNumberOfIndices = 4; |
|
42 |
|
43 static const char* const KBaseElementName = "base"; |
|
44 |
|
45 static const char* const KInvalidVisualItem = "NULL Visual Item passed"; |
|
46 static const char* const KIndexOutOfBound = "Index out of bound"; |
|
47 static const char* const KLogicError = "Logic error"; |
|
48 }// namespace mulsingleitemmodel |
|
49 |
|
50 class IMulSingleItemModel : public IAlfModel |
|
51 { |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Adds an item into the specified container at the given index. |
|
57 * |
|
58 * @param aItem Item to be added. Takes ownership. |
|
59 * @param aContainerName Name of the container. |
|
60 * @param aIndex Index of the item in the container. By default appends item. |
|
61 * @throw Invalid Argument, incase visual item is NULL or out of bound index. |
|
62 */ |
|
63 virtual void AddData(MulVisualItem* aItem, const UString& aContainerName, |
|
64 int aIndex = mulsingleitemmodel::KLastIndex) = 0; |
|
65 |
|
66 /** |
|
67 * Update an item within the specified container at the given index. |
|
68 * |
|
69 * @param aItem Item to be updated. Takes ownership. |
|
70 * @param aContainerName Name of the container. |
|
71 * @param aIndex Index of the item in the container. |
|
72 * @throw Invalid Argument, incase visual item is NULL, invalid container or out of bound index. |
|
73 * Logic Error, cannot add data because of invalid internal structure |
|
74 */ |
|
75 virtual void UpdateData(MulVisualItem& aItem, const UString& aContainerName, int aIndex) = 0; |
|
76 |
|
77 /** |
|
78 * Removes an item from the specified container at the given index. |
|
79 * |
|
80 * @param aContainerName Name of the container. |
|
81 * @param aIndex Index of the item in the container. |
|
82 * @throw Invalid Argument, incase of invalid container or out of bound index. |
|
83 */ |
|
84 virtual void RemoveData(const UString& aContainer, int aIndex) = 0; |
|
85 |
|
86 /** |
|
87 * Returns an item from the specified container at the given index. |
|
88 * |
|
89 * @param aContainerName Name of the container. |
|
90 * @param aIndex Index of the item in the container. |
|
91 * @return Reference to the item. |
|
92 * @throw Invalid Argument, incase of invalid container or out of bound index. |
|
93 */ |
|
94 virtual MulVisualItem& Data(const UString& aContainerName, int aIndex) = 0; |
|
95 |
|
96 /** |
|
97 * Returns number of items in the specified container. |
|
98 * |
|
99 * @param aContainerName Name of the container. |
|
100 * @return Number of items |
|
101 * @throw Invalid Argument, incase of invalid container. |
|
102 */ |
|
103 virtual int Count(const UString& aContainerName) = 0; |
|
104 |
|
105 /** |
|
106 * Virtual destructor. |
|
107 */ |
|
108 virtual ~IMulSingleItemModel() {} |
|
109 |
|
110 };// class IMulSingleItemModel |
|
111 |
|
112 }// namespace Alf |
|
113 #endif // IMULSINGLEITEMMODEL_H_ |
|
114 |
|
115 // End of file |
|