1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Constants for use in storing comms data via CommsDat
27 #if (!defined COMMSDAT_H)
30 #include <comms-infras/metatype.h>
31 #include <e32property.h>
38 Visitor factory functions
41 MMetaType* TMDBNumBaseVisitorFactoryL(const TAny* mem, const TAny* data);
45 MMetaType* TMDBTextBaseVisitorFactoryL(const TAny* mem, const TAny* data);
49 MMetaType* TMDBBinBaseVisitorFactoryL(const TAny* mem, const TAny* data);
53 MMetaType* TMDBDeprecatedVisitorFactoryL(const TAny* mem, const TAny* data);
58 IMPORT_C MMetaType* TMDBNumVisitorFactoryL(const TAny* mem, const TAny* data);
63 IMPORT_C MMetaType* TMDBLinkNumVisitorFactoryL(const TAny* mem, const TAny* data);
68 IMPORT_C MMetaType* TMDBTextVisitorFactoryL(const TAny* mem, const TAny* data);
73 IMPORT_C MMetaType* TMDBMedTextVisitorFactoryL(const TAny* mem, const TAny* data);
78 IMPORT_C MMetaType* TMDBLongTextVisitorFactoryL(const TAny* mem, const TAny* data);
83 IMPORT_C MMetaType* TMDBBinVisitorFactoryL(const TAny* mem, const TAny* data);
88 IMPORT_C MMetaType* TMDBLinkVisitorFactoryL(const TAny* mem, const TAny* data);
93 IMPORT_C MMetaType* TMDBRecordSetVisitorFactoryL(const TAny* mem, const TAny* data);
98 IMPORT_C MMetaType* TMDBGenericRecordVisitorFactoryL(const TAny* mem, const TAny* data);
107 Use this constant for Debug panic calls
111 _LIT(KCommsDatName,"CommsDat");
114 Use this constant for Debug panic calls
120 ECommitBeforeOpenTransaction = 1,
121 ERollBackBeforeOpenTransaction = 2,
123 EWrongAPPrioritySelPolRecord = 4,
124 EWrongIAPServiceType = 5
127 using namespace Meta;
129 //////////////////////////////////////////////////
134 Use this constant when starting a session to ask to use the latest version of the data set
135 Do not use this constant if want option to keep using particular version after update
136 Using this constant will require the client to keep up to date with any changes in the current dataset
137 Use specific version constants to avoid changing until a deprecated version is no longer supported.
141 #define KCDLatestVersion TVersion(0,0,0)
145 Versions of the dataset in use
146 NB These versions will change as data set is updated
147 All versions apart from the one defined as KCDCurrentVersion are deprecated
155 #define KCDVersion1_1 TVersion(1,1,1)
157 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
159 Some elements in Version KCDVersion1_1 now deprecated
160 These elements will be mapped if the client starts a session with KCDVersion1_1
161 They will be ignored or rejected as not supported if client starts a session with
162 KCDVersion1_2 or KCDLatestVersion
166 #define KCDVersion1_2 TVersion(1,2,1)
169 The version of the dataset supported by default
170 NB This version will change as data set is updated
174 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
176 #define KCDCurrentVersion KCDVersion1_2
180 #define KCDCurrentVersion KCDVersion1_1
187 ////////////////////////////////////////////////////
192 Access control attribute flags.
193 When these are SET in the mask the attribute is obeyed
194 When they are CLEARED from the mask, the attribute is ignored
195 By default attributes are obeyed.
201 ECDNoWriteButDelete = 0x0000010, // R/W Read Only but deleteable Caller should explicitly choose to modify
202 // Enforced by convention only, not with Platform Security
203 ECDHidden = 0x0000020, // R/W Read-Write Hidden data Not policed - hides public utility info such as default values
204 // Enforced by convention only, not with Platform Security
205 ECDPrivate = 0x0000040, // R/W Read-Write Private data For sensitive user data such as passwords
206 // Policed at storage server API with platsec capability
207 ECDProtectedWrite = 0x0000080, // W Write-Protected data To allow data to be read only to most clients but modifiable by a few privileged clients
208 // Policed at storage server API with platsec capability
212 /////////////////////////////////////////////////////
221 EText, ///< Text field - descriptor with a maximum length of 50 unicode characters.
222 EDesC8, ///< Buffer of TUInt8. Maximum length is 1024 * 8.
223 EUint32, ///< Unsigned 32 bit integer field.
224 EInt, ///< Signed integer field
225 EBool, ///< Boolean field
226 EMedText, ///< Text field - descriptor with a maximum length of 256 unicode characters.
227 ELongText, ///< Text field - descriptor with a maximum length of 1024 unicode characters.
228 ELink ///< This field is an integer that identifies a record in another table.
230 } TCDFieldValueTypes;
236 const TInt KMaxTextLength = 50; ///< Specifies the max length (characters) for short text.
241 const TInt KMaxMedTextLength = 255; ///< Specifies the max length (characters) for medium text.
246 const TInt KMaxLongTextLength = 1024; ///< Specifies the max length (characters) for long text.
251 const TInt KMaxNumLength = 1; ///< Specifies the max length for an integer and a boolean.
253 // Length override on a normal text field
258 const TInt KShortTextLength = 32;
260 ////////////////////////////////////////////////////
261 // Masks for Element Type info
266 Mask to use to hide attribute reserved bits
270 #define KCDMaskHideAttrAndRes 0xffffff00
274 Mask to use to show reserved bits
278 #define KCDMaskShowRes 0x8000000f
282 Mask to use to hide reserved bits
286 #define KCDMaskHideRes 0x7ffffff0
290 T x x Mask to show Table Type info
294 #define KCDMaskShowRecordType 0x7f800000
298 x C x Mask to show Column Type
302 #define KCDMaskShowFieldType 0x007f0000
306 T C x Mask to show Table and Column Type
310 #define KCDMaskShowType 0x7fff0000
314 T x R Mask to show Record id
316 @publishedAll - don't use this. Replace with KCDMaskShowRecordId
318 #define KCDMaskShowInstance 0x0000ff00
322 T x R Mask to show Record id
323 Use in place of KCDMaskShowInstance
326 #define KCDMaskShowRecordId 0x0000ff00
330 T C R Mask to show Field instance without attributes or reserved bits
334 #define KCDMaskShowField 0x7fffff00
338 T C R Mask for Central Repository to find a single field
342 #define KCDMaskFindSingleField 0x7FFFFFFE
345 T x R Mask to show Record Type and Record Id without column type, attributes or reserved bits
349 #define KCDMaskShowRecordTypeAndId (KCDMaskShowRecordType | KCDMaskShowRecordId)
352 x C R Mask to show Column Type and Record Id without Record type, attributes or reserved bits
356 #define KCDMaskShowColumnTypeAndRecordId (KCDMaskShowFieldType | KCDMaskShowRecordId)
360 Mask to show Attributes
364 #define KCDMaskShowAttributes 0x000000f0
368 Mask for all attribute settings that apply to read and write operations
369 see TCDAttributeFlags
371 ECDNoWriteButDelete = 0x0000010
372 ECDHidden = 0x0000020
373 ECDPrivate = 0x0000040
374 ECDProtectedWrite = 0x0000080
379 #define KCDMaskShowReadWriteAttributes (ECDNoWriteButDelete |ECDHidden | ECDPrivate | ECDProtectedWrite)
382 Mask for all attribute settings that apply to read operations
383 see TCDAttributeFlags
385 ECDHidden = 0x0000020
386 ECDPrivate = 0x0000040
391 #define KCDMaskShowReadAttributes (ECDHidden| ECDPrivate)
394 Mask to use to show attributes and reserved bits
398 #define KCDMaskShowAttrAndRes 0x000000ff
402 Id for the Initial record in a record set
406 #define KCDInitialRecordId 0x00000100
410 Id for the Initial table in the database
414 #define KCDInitialTableId 0x00800000
418 Id for the Initial User defined table in the database
419 clients have 64 table ids available to them
423 #define KCDInitialUDefRecordType 0x5F800000
427 Id for the Last User defined table in the database.
431 #define KCDLastUDefRecordType 0x7F800000
435 Id for the Initial column in a record set
439 #define KCDInitialColumnId 0x00010000
443 T C 0 location for default field values
447 #define KCDDefaultRecord 0x00000000
451 Combine with table id and Column id to give the location of column type info
455 #define KCDColumnTypeInfo 0x0000ff00
458 Combine with table id to give the location of table type info
463 #define KCDTableTypeInfo 0x007fff00
466 Combine with table id to give location of record type info
468 //#define KCDRecordTypeInfo 0x007f0000
472 Use to request allocation of a new table id.
473 Should only be called when creating a new user-defined table
478 #define KCDNewTableRequest 0x007fff00
482 Combine with table id to give request for a new column in a table.
483 The table must already exist. New columns should only normally be
484 requested when creating a new user-defined table
489 #define KCDNewColumnRequest 0x0000ff01
494 Combine with table id to give request for a new record in a table.
495 The table must already exist.
499 #define KCDNewRecordRequest 0x807f0001
503 Combined with CMDBField, it finds the TableId given the table name
507 #define KCDMaskGenericTableName KCDNewTableRequest
512 Maximum number of tables that can be created in one repository
516 #define KCDMaxTables 254
520 Maximum number of User defined tables that can be created in one repository
524 #define KCDMaxUserDefTables 64
528 Maximum number of columns that can be created in one table
532 #define KCDMaxColumns 126
536 Maximum number of records that can be stored in one table
540 #define KCDMaxRecords 254
544 Maximum number of characters in a field name
548 #define KCDMaxFieldNameLength 64
553 Flag to indicate change in field
554 Not for use in database. Just with fields
558 #define KCDChangedFlag 0x00000001
564 #define KCDMaxRecordId 0x0000ff00
569 #define KCDMaxColumnId 0x007f0000
574 #define KCDMaxTableId 0x7f800000
579 Mask to show only basic type info,
580 Masks out all info on links
583 #define KCDShowBasicTypeInfo 0x000000ff
585 Typedefs for convenience in meta data definitions
588 using namespace Meta;
590 template <class TYPE> class TMDBVisitor;
591 class TMDBRecordLinkVisitor;
592 class TMDBRecordSetVisitor;
593 class TMDBGenericRecordVisitor;
597 Visitors for field values
601 Typedefs for convenience in meta data definitions
604 typedef TMDBVisitor<TInt> TMDBNum;
607 Typedefs for convenience in meta data definitions
610 typedef TMDBVisitor<TInt> TMDBBool;
613 Typedefs for convenience in meta data definitions
616 typedef TMDBVisitor<TDesC> TMDBDes;
619 Typedefs for convenience in meta data definitions
622 typedef TMDBVisitor<TDesC8> TMDBDes8;
625 Visitors for containers
629 Typedefs for convenience in meta data definitions
632 typedef TMDBRecordLinkVisitor TMDBLink;
635 Typedefs for convenience in meta data definitions
638 typedef TMDBRecordSetVisitor TMDBRecordSet;
641 Typedefs for convenience in meta data definitions
644 typedef TMDBGenericRecordVisitor TMDBGenRecord;
646 /** UIDs for CommDB event notification */
651 const TUid KUidCommDbNotificationEvent = {0x1020762E};
656 const TUid KUidCommsDatStatusEvent = {KUidSystemCategoryValue};
661 const TInt KCommsDatStatusEventCommitSeq = 0x1020762F;
664 Metadatabase container type ids
668 #define KCDTIdMDBElement 123
671 Metadatabase container type ids
675 #define KCDTIdMDBNumFieldBase 223
678 Metadatabase container type ids
682 #define KCDTIdMDBTextFieldBase 224
685 Metadatabase container type ids
689 #define KCDTIdMDBBinFieldBase 225
692 Metadatabase container type ids
696 #define KCDTIdMDBRecordLinkBase 323
699 Metadatabase container type ids
703 #define KCDTIdMDBRecordSetBase 523
706 Metadatabase container type ids
710 #define KCDTIdMDBGenericRecord 585
714 Macro for interaction with netmeta
717 #define X_REGISTER_ATTRIBUTE( thisMetaClass, var, metaType ) \
718 { _FOFF( thisMetaClass, var ), Meta::metaType##VisitorFactoryL },
721 #define EXP_DATA_VTABLE \
722 IMPORT_C virtual Meta::SVDataTableEntry const* GetVDataTable() const; \
723 IMPORT_C virtual TUint8* GetAttribPtr(const TInt aOffset) const; \
724 IMPORT_C static Meta::SVDataTableEntry const* GetVDataTableStatic(); \
725 static const Meta::SVDataTableEntry iVDataTable[];
729 Macros used to implement virtual functions from MMetaData interface and construct the v data table
732 #define EXP_START_ATTRIBUTE_TABLE( thisMetaClass, uid, typeId ) \
733 EXPORT_C Meta::SVDataTableEntry const* thisMetaClass::GetVDataTable() const { return &iVDataTable[0]; }; \
734 EXPORT_C TUint8* thisMetaClass::GetAttribPtr(const TInt aOffset) const { return (TUint8*)this + aOffset; }; \
735 EXPORT_C Meta::SVDataTableEntry const* thisMetaClass::GetVDataTableStatic() { return &iVDataTable[0]; }; \
736 const Meta::SVDataTableEntry thisMetaClass::iVDataTable[] = { \
737 { uid, reinterpret_cast<Meta::TMetaTypeNewL>(typeId) },
740 #define END_ATTRIBUTE_TABLE_BASE_N( baseMetaClass, baseId, entry ) \
741 { (TInt)((TAny*)(baseMetaClass::GetVDataTableStatic() + entry)), NULL }};
744 } //end namespace CommsDat