|
1 /* |
|
2 * Copyright (c) 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: Valid contact data info. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMVALIDATOR_H |
|
20 #define CPIMVALIDATOR_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include "pimcommon.h" |
|
26 |
|
27 /** |
|
28 * PIM validator abstract base class. |
|
29 * Provides information about valid fields, attributes and values. |
|
30 * |
|
31 * @par Notes: |
|
32 * @li The value validator methods do not take any behavioral aspects into |
|
33 * account. Checking is based on predefined values only (if applicable) |
|
34 * and additional dynamic checking might be necessary. |
|
35 * |
|
36 */ |
|
37 NONSHARABLE_CLASS(CPIMValidator): public CBase |
|
38 { |
|
39 public: // Destructor |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~CPIMValidator(); |
|
45 |
|
46 public: // New functions |
|
47 |
|
48 /** |
|
49 * Provides an array of valid fields. |
|
50 */ |
|
51 virtual const CArrayFix< TPIMFieldAndType>& ValidFields() const; |
|
52 |
|
53 /** |
|
54 * Determines whether given field is valid for this list type. |
|
55 */ |
|
56 virtual TBool IsValidField(const TPIMField& aField) const; |
|
57 |
|
58 /** |
|
59 * Provides data type of given field. |
|
60 * Can be also used for determining wheter a field is valid for |
|
61 * the derived class. |
|
62 * |
|
63 * @param aField A field. |
|
64 * |
|
65 * @return Data type of \a aField, or \ref EPIMFieldInvalid if |
|
66 * \a aField is not valid for the derived class. |
|
67 */ |
|
68 virtual TPIMFieldDataType FieldDataType( |
|
69 const TPIMField& aField) const; |
|
70 |
|
71 /** |
|
72 * Provides valid contact attributes, combined. |
|
73 */ |
|
74 virtual TPIMAttribute ValidAttributes() const; |
|
75 |
|
76 /** |
|
77 * Provides number of elements for given string array field. |
|
78 * Default implementation leaves with \c KErrArgument. |
|
79 */ |
|
80 virtual TInt NumElementsL( |
|
81 const TPIMField& /*aStringArrayField*/) const; |
|
82 |
|
83 /** |
|
84 * Determines wheter given value is valid for given field. |
|
85 * @return Default implementation returns always \c ETrue. |
|
86 */ |
|
87 virtual TBool IsValidBooleanValue( |
|
88 const TPIMField& aField, |
|
89 const TBool& aValue) const; |
|
90 |
|
91 /** |
|
92 * Determines wheter given value is valid for given field. |
|
93 * @return Default implementation returns always \c ETrue. |
|
94 */ |
|
95 virtual TBool IsValidDateValue( |
|
96 const TPIMField& aField, |
|
97 const TPIMDate& aValue) const; |
|
98 |
|
99 /** |
|
100 * Determines wheter given value is valid for given field. |
|
101 * @return Default implementation returns always \c ETrue. |
|
102 */ |
|
103 virtual TBool IsValidIntegerValue( |
|
104 const TPIMField& aField, |
|
105 const TInt& aValue) const; |
|
106 |
|
107 /** |
|
108 * Determines wheter given value is valid for given field. |
|
109 * @return Default implementation returns always \c ETrue. |
|
110 */ |
|
111 virtual TBool IsValidBinaryValue( |
|
112 const TPIMField& aField, |
|
113 const CPIMByteArray& aValue) const; |
|
114 |
|
115 /** |
|
116 * Determines wheter given value is valid for given field. |
|
117 * @return Default implementation returns always \c ETrue. |
|
118 */ |
|
119 virtual TBool IsValidStringValue( |
|
120 const TPIMField& aField, |
|
121 const HBufC& aValue) const; |
|
122 |
|
123 /** |
|
124 * Determines wheter given value is valid for given field. |
|
125 * @return Default implementation returns always \c ETrue. |
|
126 */ |
|
127 virtual TBool IsValidStringArrayValue( |
|
128 const TPIMField& aField, |
|
129 const CDesCArray& aValue) const; |
|
130 |
|
131 protected: // Constructors and destructor |
|
132 |
|
133 /** |
|
134 * Symbian 2nd phase constructor. Must be called in the |
|
135 * ConstructL of derived classes. |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 /** |
|
140 * C++ constructor. |
|
141 * @param aValidAttributes Valid attributes from the derived class, |
|
142 * combined. |
|
143 */ |
|
144 CPIMValidator(const TPIMAttribute& aValidAttributes); |
|
145 |
|
146 protected: // Data |
|
147 |
|
148 /** Valid fields and their types. Owned. */ |
|
149 CArrayFix< TPIMFieldAndType>* iValidFields; |
|
150 |
|
151 /** Valid attributes, combined. */ |
|
152 TPIMAttribute iValidAttributes; |
|
153 }; |
|
154 |
|
155 #endif // CPIMVALIDATOR_H |
|
156 // End of File |