epoc32/include/commsdat.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Constants for use in storing comms data via CommsDat
    15 // 
    16 //
    17 
    18 
    19 
    20 /**
    21  @file
    22  @publishedAll
    23  @released
    24 */
    25 
    26 
    27 #if (!defined COMMSDAT_H)
    28 #define       COMMSDAT_H
    29 
    30 #include <comms-infras/metatype.h>
    31 #include <e32property.h>
    32 
    33 
    34 namespace Meta
    35     {
    36 
    37 	/**
    38 	Visitor factory functions
    39 	@internalComponent
    40 	*/
    41     MMetaType* TMDBNumBaseVisitorFactoryL(const TAny* mem, const TAny* data);
    42    	/**     
    43    	@internalComponent
    44    	*/
    45     MMetaType* TMDBTextBaseVisitorFactoryL(const TAny* mem, const TAny* data);
    46     /**     
    47    	@internalComponent
    48    	*/
    49     MMetaType* TMDBBinBaseVisitorFactoryL(const TAny* mem, const TAny* data);
    50     /**     
    51    	@internalComponent
    52    	*/
    53     MMetaType* TMDBDeprecatedVisitorFactoryL(const TAny* mem, const TAny* data);
    54 	/**
    55     @publishedPartner
    56     @released
    57     */
    58     IMPORT_C MMetaType* TMDBNumVisitorFactoryL(const TAny* mem, const TAny* data);
    59     /**
    60     @publishedPartner
    61     @released
    62     */
    63     IMPORT_C MMetaType* TMDBLinkNumVisitorFactoryL(const TAny* mem, const TAny* data);
    64     /**
    65     @publishedPartner
    66     @released
    67     */
    68     IMPORT_C MMetaType* TMDBTextVisitorFactoryL(const TAny* mem, const TAny* data);
    69     /**
    70     @publishedPartner
    71     @released
    72     */
    73     IMPORT_C MMetaType* TMDBMedTextVisitorFactoryL(const TAny* mem, const TAny* data);
    74     /**
    75     @publishedPartner
    76     @released
    77     */
    78     IMPORT_C MMetaType* TMDBLongTextVisitorFactoryL(const TAny* mem, const TAny* data);
    79     /**
    80     @publishedPartner
    81     @released
    82     */
    83     IMPORT_C MMetaType* TMDBBinVisitorFactoryL(const TAny* mem, const TAny* data);
    84     /**
    85     @publishedPartner
    86     @released
    87     */
    88     IMPORT_C MMetaType* TMDBLinkVisitorFactoryL(const TAny* mem, const TAny* data);
    89     /**
    90     @publishedPartner
    91     @released
    92     */
    93     IMPORT_C MMetaType* TMDBRecordSetVisitorFactoryL(const TAny* mem, const TAny* data);
    94     /**
    95     @publishedPartner
    96     @released
    97     */
    98     IMPORT_C MMetaType* TMDBGenericRecordVisitorFactoryL(const TAny* mem, const TAny* data);
    99 
   100     }
   101 
   102 
   103 namespace CommsDat
   104 {
   105 
   106 /**
   107 Use this constant for Debug panic calls
   108 
   109 @publishedAll
   110 */
   111 _LIT(KCommsDatName,"CommsDat");
   112 
   113 /**
   114 Use this constant for Debug panic calls
   115 
   116 @publishedAll
   117 */
   118 enum
   119 	{
   120 	ECommitBeforeOpenTransaction = 1,
   121 	ERollBackBeforeOpenTransaction = 2,
   122 	ESessionClosed = 3,
   123     EWrongAPPrioritySelPolRecord = 4,
   124     EWrongIAPServiceType = 5
   125 	};
   126 	
   127 using namespace Meta;
   128 
   129 //////////////////////////////////////////////////
   130 // VERSION INFO
   131 //
   132 
   133 /**
   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.
   138 
   139 @publishedAll
   140 */
   141 #define KCDLatestVersion            TVersion(0,0,0)
   142 
   143 
   144 /**
   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
   148 */
   149 
   150 /*
   151 Initial Version 
   152 @publishedAll
   153 */
   154 
   155 #define KCDVersion1_1               TVersion(1,1,1)
   156 
   157 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
   158 /**
   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
   163 
   164 @publishedAll
   165 */
   166 #define KCDVersion1_2               TVersion(1,2,1)
   167 #endif
   168 /**
   169 The version of the dataset supported by default
   170 NB This version will change as data set is updated
   171 
   172 @publishedAll
   173 */
   174 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
   175 
   176 #define KCDCurrentVersion           KCDVersion1_2
   177 
   178 #else
   179 
   180 #define KCDCurrentVersion           KCDVersion1_1
   181 
   182 #endif
   183 
   184 
   185 
   186 
   187 ////////////////////////////////////////////////////
   188 //  Attribute Flags
   189 //
   190 
   191 /**
   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.
   196 
   197 @publishedAll
   198 */
   199 typedef enum
   200 {
   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
   209 } TCDAttributeFlags;
   210 
   211 
   212 /////////////////////////////////////////////////////
   213 // Field types
   214 //
   215 /**
   216 @publishedPartner
   217 @released
   218 */
   219 typedef enum
   220 {
   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.
   229 
   230 } TCDFieldValueTypes;
   231 
   232 /**
   233 @publishedPartner
   234 @released
   235 */
   236 const TInt KMaxTextLength		= 50; 		///< Specifies the max length (characters) for short text.
   237 /**
   238 @publishedPartner
   239 @released
   240 */
   241 const TInt KMaxMedTextLength	= 255; 		///< Specifies the max length (characters) for medium text.
   242 /**
   243 @publishedPartner
   244 @released
   245 */
   246 const TInt KMaxLongTextLength	= 1024;		///< Specifies the max length (characters) for long text.
   247 /**
   248 @publishedPartner
   249 @released
   250 */
   251 const TInt KMaxNumLength		= 1;		///< Specifies the max length for an integer and a boolean.
   252 
   253 // Length override on a normal text field
   254 /**
   255 @publishedPartner
   256 @released
   257 */
   258 const TInt KShortTextLength		= 32;
   259 
   260 ////////////////////////////////////////////////////
   261 // Masks for Element Type info
   262 //
   263 
   264 
   265 /**
   266 Mask to use to hide attribute reserved bits
   267 
   268 @publishedAll
   269 */
   270 #define KCDMaskHideAttrAndRes       0xffffff00
   271 
   272 
   273 /**
   274 Mask to use to show reserved bits
   275 
   276 @publishedAll
   277 */
   278 #define KCDMaskShowRes              0x8000000f
   279 
   280 
   281 /**
   282 Mask to use to hide reserved bits
   283 
   284 @publishedAll
   285 */
   286 #define KCDMaskHideRes              0x7ffffff0
   287 
   288 
   289 /**
   290 T x x   Mask to show Table Type info
   291 
   292 @publishedAll
   293 */
   294 #define KCDMaskShowRecordType       0x7f800000
   295 
   296 
   297 /**
   298 x C x   Mask to show Column Type 
   299 
   300 @publishedAll
   301 */
   302 #define KCDMaskShowFieldType        0x007f0000
   303 
   304 
   305 /**
   306 T C x   Mask to show Table and Column Type 
   307 
   308 @publishedAll
   309 */
   310 #define KCDMaskShowType             0x7fff0000
   311 
   312 
   313 /**
   314 T x R   Mask to show Record id
   315 
   316 @publishedAll - don't use this.  Replace with KCDMaskShowRecordId
   317 */
   318 #define KCDMaskShowInstance         0x0000ff00
   319 
   320 
   321 /**
   322 T x R   Mask to show Record id
   323 Use in place of KCDMaskShowInstance
   324 @publishedAll
   325 */
   326 #define KCDMaskShowRecordId         0x0000ff00
   327 
   328 
   329 /**
   330 T C R   Mask to show Field instance without attributes or reserved bits
   331 
   332 @publishedAll
   333 */
   334 #define KCDMaskShowField            0x7fffff00
   335 
   336 
   337 /**
   338 T C R   Mask for Central Repository to find a single field
   339 
   340 @internalComponent
   341 */
   342 #define KCDMaskFindSingleField		0x7FFFFFFE
   343 
   344 /**
   345 T x R   Mask to show Record Type and Record Id without column type, attributes or reserved bits
   346 
   347 @publishedAll
   348 */
   349 #define KCDMaskShowRecordTypeAndId  (KCDMaskShowRecordType | KCDMaskShowRecordId)
   350 
   351 /**
   352 x C R   Mask to show Column Type and Record Id without Record type, attributes or reserved bits
   353 
   354 @publishedAll
   355 */
   356 #define KCDMaskShowColumnTypeAndRecordId  (KCDMaskShowFieldType |  KCDMaskShowRecordId)
   357 
   358 
   359 /**
   360 Mask to show Attributes
   361 
   362 @publishedAll
   363 */
   364 #define KCDMaskShowAttributes       0x000000f0
   365 
   366 
   367 /**
   368 Mask for all attribute settings that apply to read and write operations
   369 see TCDAttributeFlags
   370 
   371   ECDNoWriteButDelete = 0x0000010                             
   372   ECDHidden           = 0x0000020
   373   ECDPrivate          = 0x0000040
   374   ECDProtectedWrite   = 0x0000080
   375 
   376 @publishedPartner
   377 @released
   378 */
   379 #define KCDMaskShowReadWriteAttributes  (ECDNoWriteButDelete |ECDHidden | ECDPrivate | ECDProtectedWrite)
   380 
   381 /**
   382 Mask for all attribute settings that apply to read operations
   383 see TCDAttributeFlags
   384                           
   385   ECDHidden           = 0x0000020
   386   ECDPrivate          = 0x0000040
   387   
   388 @publishedPartner
   389 @released  
   390 */
   391 #define KCDMaskShowReadAttributes       (ECDHidden| ECDPrivate)     
   392 
   393 /**
   394 Mask to use to show attributes and reserved bits
   395 
   396 @publishedAll
   397 */
   398 #define KCDMaskShowAttrAndRes       0x000000ff
   399 
   400 
   401 /**
   402 Id for the Initial record in a record set
   403 
   404 @publishedAll
   405 */
   406 #define KCDInitialRecordId			0x00000100
   407 
   408 
   409 /**
   410 Id for the Initial table in the database
   411 
   412 @publishedAll
   413 */
   414 #define KCDInitialTableId			0x00800000
   415 
   416 
   417 /**
   418 Id for the Initial User defined table in the database
   419 clients have 64 table ids available to them
   420 
   421 @publishedAll
   422 */
   423 #define KCDInitialUDefRecordType   0x5F800000
   424 
   425 
   426 /**
   427 Id for the Last User defined table in the database.
   428 
   429 @publishedAll
   430 */
   431 #define KCDLastUDefRecordType      0x7F800000
   432 
   433 
   434 /**
   435 Id for the Initial column in a record set
   436 
   437 @publishedAll
   438 */
   439 #define KCDInitialColumnId			0x00010000
   440 
   441 
   442 /**
   443 T C 0   location for default field values
   444 
   445 @publishedAll
   446 */
   447 #define KCDDefaultRecord            0x00000000
   448 
   449 
   450 /**
   451 Combine with table id and Column id to give the location of column type info
   452 
   453 @publishedAll
   454 */
   455 #define KCDColumnTypeInfo           0x0000ff00
   456 
   457 /**
   458 Combine with table id to give the location of table type info
   459 
   460 @publishedPartner
   461 @released
   462 */
   463 #define KCDTableTypeInfo            0x007fff00
   464 
   465 /*
   466 Combine with table id to give location of record type info
   467 */
   468 //#define KCDRecordTypeInfo			0x007f0000
   469 
   470 
   471 /**
   472 Use to request allocation of a new table id.
   473 Should only be called when creating a new user-defined table
   474 
   475 @publishedPartner
   476 @released
   477 */
   478 #define KCDNewTableRequest          0x007fff00
   479 
   480 
   481 /**
   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
   485 
   486 @publishedPartner
   487 @released
   488 */
   489 #define KCDNewColumnRequest			0x0000ff01
   490 
   491 
   492 
   493 /**
   494 Combine with table id to give request for a new record in a table.
   495 The table must already exist.
   496 
   497 @publishedAll
   498 */
   499 #define KCDNewRecordRequest			0x807f0001
   500 
   501 
   502 /**
   503 Combined with CMDBField, it finds the TableId given the table name
   504 
   505 @publishedAll
   506 */
   507 #define KCDMaskGenericTableName			KCDNewTableRequest
   508 
   509 
   510 
   511 /**
   512 Maximum number of tables that can be created in one repository
   513 
   514 @publishedAll
   515 */
   516 #define KCDMaxTables                254
   517 
   518 
   519 /**
   520 Maximum number of User defined tables that can be created in one repository
   521 
   522 @publishedAll
   523 */
   524 #define KCDMaxUserDefTables         64
   525 
   526 
   527 /**
   528 Maximum number of columns that can be created in one table
   529 
   530 @publishedAll
   531 */
   532 #define KCDMaxColumns               126  
   533 
   534 
   535 /**
   536 Maximum number of records that can be stored in one table
   537 
   538 @publishedAll
   539 */
   540 #define KCDMaxRecords               254
   541 
   542 
   543 /**
   544 Maximum number of characters in a field name
   545 
   546 @publishedAll
   547 */
   548 #define KCDMaxFieldNameLength        64
   549 
   550 
   551 
   552 /**
   553 Flag to indicate change in field
   554 Not for use in database.  Just with fields
   555 
   556 @internalComponent
   557 */
   558 #define KCDChangedFlag      0x00000001
   559 
   560 /**
   561 @publishedPartner
   562 @released
   563 */
   564 #define KCDMaxRecordId     0x0000ff00
   565 /**
   566 @publishedPartner
   567 @released
   568 */
   569 #define KCDMaxColumnId     0x007f0000
   570 /**
   571 @publishedPartner
   572 @released
   573 */
   574 #define KCDMaxTableId      0x7f800000
   575 
   576 
   577 
   578 /*
   579 Mask to show only basic type info, 
   580 Masks out all info on links
   581 @internalComponent
   582 */
   583 #define KCDShowBasicTypeInfo  0x000000ff
   584 /**
   585 Typedefs for convenience in meta data definitions
   586 @internalComponent
   587 */
   588 using namespace Meta;
   589 
   590 template <class TYPE> class TMDBVisitor;
   591 class TMDBRecordLinkVisitor;
   592 class TMDBRecordSetVisitor;
   593 class TMDBGenericRecordVisitor;
   594 class CMDBElement;
   595 
   596 /*
   597 Visitors for field values
   598 */
   599 
   600 /**
   601 Typedefs for convenience in meta data definitions
   602 @internalComponent
   603 */
   604  typedef TMDBVisitor<TInt>                           TMDBNum;
   605 
   606 /**
   607 Typedefs for convenience in meta data definitions
   608 @internalComponent
   609 */	
   610  typedef TMDBVisitor<TInt>                           TMDBBool;
   611  
   612 /**
   613 Typedefs for convenience in meta data definitions
   614 @internalComponent
   615 */	
   616  typedef TMDBVisitor<TDesC>                          TMDBDes;	
   617  
   618 /**
   619 Typedefs for convenience in meta data definitions
   620 @internalComponent
   621 */
   622  typedef TMDBVisitor<TDesC8>                         TMDBDes8;	
   623 
   624 /*
   625 Visitors for containers
   626 */
   627 
   628 /**
   629 Typedefs for convenience in meta data definitions
   630 @internalComponent
   631 */
   632 typedef TMDBRecordLinkVisitor						TMDBLink;	
   633 
   634 /**
   635 Typedefs for convenience in meta data definitions
   636 @internalComponent
   637 */		
   638 typedef TMDBRecordSetVisitor                        TMDBRecordSet;
   639 
   640 /**
   641 Typedefs for convenience in meta data definitions
   642 @internalComponent
   643 */		
   644 typedef TMDBGenericRecordVisitor                    TMDBGenRecord;		
   645 
   646 /** UIDs for CommDB event notification */
   647 /**
   648 @publishedPartner
   649 @released
   650 */
   651 const TUid KUidCommDbNotificationEvent = {0x1020762E};
   652 /**
   653 @publishedPartner
   654 @released
   655 */
   656 const TUid KUidCommsDatStatusEvent = {KUidSystemCategoryValue};
   657 /**
   658 @publishedPartner
   659 @released
   660 */
   661 const TInt KCommsDatStatusEventCommitSeq = 0x1020762F;
   662 
   663 /**
   664 Metadatabase container type ids
   665 
   666 @internalComponent
   667 */
   668 #define KCDTIdMDBElement            123
   669 
   670 /**
   671 Metadatabase container type ids
   672 
   673 @internalComponent
   674 */
   675 #define KCDTIdMDBNumFieldBase       223
   676 
   677 /**
   678 Metadatabase container type ids
   679 
   680 @internalComponent
   681 */
   682 #define KCDTIdMDBTextFieldBase      224
   683 
   684 /**
   685 Metadatabase container type ids
   686 
   687 @internalComponent
   688 */
   689 #define KCDTIdMDBBinFieldBase       225
   690 
   691 /**
   692 Metadatabase container type ids
   693 
   694 @internalComponent
   695 */
   696 #define KCDTIdMDBRecordLinkBase     323
   697 
   698 /**
   699 Metadatabase container type ids
   700 
   701 @internalComponent
   702 */
   703 #define KCDTIdMDBRecordSetBase      523
   704 
   705 /**
   706 Metadatabase container type ids
   707 
   708 @internalComponent
   709 */
   710 #define KCDTIdMDBGenericRecord      585
   711 
   712 
   713 /**
   714 Macro for interaction with netmeta
   715 @publishedAll
   716 */
   717 #define X_REGISTER_ATTRIBUTE( thisMetaClass, var, metaType ) \
   718  { _FOFF( thisMetaClass, var ), Meta::metaType##VisitorFactoryL },
   719 
   720 
   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[];
   726 
   727 
   728 /**
   729 Macros used to implement virtual functions from MMetaData interface and construct the v data table
   730 @publishedAll
   731 */
   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) },
   738 
   739 
   740 #define END_ATTRIBUTE_TABLE_BASE_N( baseMetaClass, baseId, entry ) \
   741  { (TInt)((TAny*)(baseMetaClass::GetVDataTableStatic() + entry)), NULL }};
   742 
   743 
   744 } //end namespace CommsDat
   745 #endif