epoc32/include/metadatabase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// Meta-database declarations for use in storing comms data
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/**
williamr@2
    21
 @file
williamr@2
    22
 @publishedPartner
williamr@2
    23
 @released
williamr@2
    24
*/
williamr@2
    25
williamr@2
    26
williamr@2
    27
#if (!defined METADATABASE_H)
williamr@2
    28
#define       METADATABASE_H
williamr@2
    29
williamr@2
    30
williamr@2
    31
williamr@2
    32
// NetMeta headers
williamr@2
    33
#include <comms-infras/metadata.h>
williamr@2
    34
#include <comms-infras/metatype.h>
williamr@2
    35
williamr@2
    36
// CommsDat headers
williamr@2
    37
#include <commsdat.h>
williamr@2
    38
williamr@2
    39
williamr@2
    40
williamr@2
    41
/**@plaintext
williamr@2
    42
williamr@2
    43
This file contains :
williamr@2
    44
williamr@2
    45
1/  Class for expressing a session with the storage server
williamr@2
    46
williamr@2
    47
			CMDBSession
williamr@2
    48
williamr@2
    49
		This class contains functions to create and close a session, to set the dataset version
williamr@2
    50
		and to request database actions such as locking for a transaction.
williamr@2
    51
williamr@2
    52
2/  Generic database functionality interface
williamr@2
    53
williamr@2
    54
			MMetaDatabase
williamr@2
    55
williamr@2
    56
		This class uses a CMDBSession object
williamr@2
    57
williamr@2
    58
williamr@2
    59
3/  General base class that inherits from MMetaDatabase to express any database element
williamr@2
    60
williamr@2
    61
			CMDBElement
williamr@2
    62
williamr@2
    63
		This class contains the ElementId for each MetaDatabase object
williamr@2
    64
		An element id locates stored data in the comms database.
williamr@2
    65
williamr@2
    66
williamr@2
    67
4/  Data classes that each inherit from CMDBElement
williamr@2
    68
williamr@2
    69
	a) Fields
williamr@2
    70
williamr@2
    71
			CMDBField<T>
williamr@2
    72
williamr@2
    73
		where T is a basic type value of the field (TInt, TDes, TBool etc)
williamr@2
    74
		
williamr@2
    75
		This class derives from
williamr@2
    76
williamr@2
    77
			CMDBElement
williamr@2
    78
williamr@2
    79
		to implement the thin template idiom
williamr@2
    80
williamr@2
    81
williamr@2
    82
			CMDBRecordLink<T>
williamr@2
    83
williamr@2
    84
		where T is a record of a particular type.  This class expresses a soft-link
williamr@2
    85
		from a field in one record to a record of a different type (i.e. in another table).
williamr@2
    86
		The TMDBElementId value stored in this field in the repository is the id of an instance 
williamr@2
    87
		of the record of type T
williamr@2
    88
williamr@2
    89
		This class derives from
williamr@2
    90
williamr@2
    91
			CMDBRecordLinkBase
williamr@2
    92
williamr@2
    93
		to implement the thin template idiom
williamr@2
    94
williamr@2
    95
williamr@2
    96
	b) Field Containers
williamr@2
    97
williamr@2
    98
williamr@2
    99
			CCDRecord
williamr@2
   100
williamr@2
   101
		base class for record containing specific list of fields - see CommsDatTypesv1_1.h
williamr@2
   102
williamr@2
   103
williamr@2
   104
			CMDBRecordSet<T>
williamr@2
   105
williamr@2
   106
		an array of records where T is the record type.  This can represent a Table in a database.
williamr@2
   107
williamr@2
   108
williamr@2
   109
williamr@2
   110
williamr@2
   111
5/  Other support classes and type definitions
williamr@2
   112
williamr@2
   113
			TMDBElementId
williamr@2
   114
williamr@2
   115
		The TMDBElementId locates a data object or set of data objects in the database.
williamr@2
   116
williamr@2
   117
		A TMDBElementId expresses
williamr@2
   118
williamr@2
   119
		<TableId><ColumnId><RecordId><Attributes>
williamr@2
   120
williamr@2
   121
		A TMDBElementId has a different format depending on the data type it expresses
williamr@2
   122
williamr@2
   123
			Table       <TableId><0><0>
williamr@2
   124
			Column      <TableId><ColumnId><0>
williamr@2
   125
williamr@2
   126
			Record      <TableId><0><RecordId>
williamr@2
   127
			Field       <TAbleId><ColumnId><RecordId>
williamr@2
   128
williamr@2
   129
williamr@2
   130
			TMDBAttributeFlags
williamr@2
   131
williamr@2
   132
		Attribute settings for any storable element.
williamr@2
   133
		Attributes express access control for data in the database
williamr@2
   134
williamr@2
   135
*/
williamr@2
   136
williamr@2
   137
williamr@2
   138
williamr@2
   139
namespace CommsDat
williamr@2
   140
{
williamr@2
   141
williamr@2
   142
using namespace Meta;
williamr@2
   143
williamr@2
   144
williamr@2
   145
// Private to implementation
williamr@2
   146
//@internalTechnology
williamr@2
   147
//@released
williamr@2
   148
class CMDBSessionImpl;
williamr@2
   149
williamr@2
   150
// Forward declarations
williamr@2
   151
class MMetaDatabase;
williamr@2
   152
class CMDBElement;
williamr@2
   153
williamr@2
   154
/**
williamr@2
   155
Attribute flags for an element in the Meta Database
williamr@2
   156
Attributes describe access rights to the data in the database
williamr@2
   157
@publishedAll
williamr@2
   158
@released
williamr@2
   159
*/
williamr@2
   160
typedef TUint32         TMDBAttributeFlags;	
williamr@2
   161
williamr@2
   162
williamr@2
   163
/**
williamr@2
   164
The identifier for any entry in the MetaDatabase.
williamr@2
   165
It can specify
williamr@2
   166
	<TableId><ColumnId><RecordId>
williamr@2
   167
This identifies 
williamr@2
   168
    The data location in the database
williamr@2
   169
    The meaning of the data within in the data schema
williamr@2
   170
    The type of the data
williamr@2
   171
williamr@2
   172
@publishedAll
williamr@2
   173
@released
williamr@2
   174
*/
williamr@2
   175
typedef TUint32         TMDBElementId;
williamr@2
   176
williamr@2
   177
class CMDBSession : public CBase
williamr@2
   178
/*
williamr@2
   179
A session with the underlying storage server
williamr@2
   180
@publishedAll
williamr@2
   181
@released
williamr@2
   182
*/
williamr@2
   183
{
williamr@2
   184
public:
williamr@2
   185
williamr@2
   186
	/**
williamr@2
   187
	Open a session with the storage server and establish data format version in use
williamr@2
   188
	CommsDat always attempts to support the required version of the client-facing data set.
williamr@2
   189
    The client must carefully choose the dataset version as it affects binary compatibility
williamr@2
   190
williamr@2
   191
    @params aRequiredVersion  
williamr@2
   192
            If the requested version is deprecated but still supported, mapping will be performed 
williamr@2
   193
            within CommsDat to maintain Data and Binary compatibility for the client
williamr@2
   194
            If the requested version is the latest version, no mapping will be performed
williamr@2
   195
            and deprecated fields will be ignored 
williamr@2
   196
            A client that needs to maintain BC must use a specific version
williamr@2
   197
            A client that always wants to use the latest dataset can start the session with KCDLatestVersion
williamr@2
   198
            
williamr@2
   199
    @leave  KErrUnsupported If an old unsupported version is requested
williamr@2
   200
    @leave  System-wide error codes if there is an unexpected error
williamr@2
   201
    
williamr@2
   202
    @pre    None
williamr@2
   203
    @post   on success a session has been created and initialised
williamr@2
   204
williamr@2
   205
    @publishedAll
williamr@2
   206
	*/
williamr@2
   207
	IMPORT_C static CMDBSession* NewL(TVersion aRequiredVersion);
williamr@2
   208
williamr@2
   209
	/**
williamr@2
   210
	As NewL and adds Session to the CleanupStack
williamr@2
   211
williamr@2
   212
	@publishedAll
williamr@2
   213
	*/
williamr@2
   214
	IMPORT_C static CMDBSession* NewLC(TVersion aRequiredVersion);
williamr@2
   215
williamr@2
   216
	/**
williamr@2
   217
	Virtual Destructor
williamr@2
   218
williamr@2
   219
	@publishedAll
williamr@2
   220
	*/
williamr@2
   221
	IMPORT_C ~CMDBSession();
williamr@2
   222
williamr@2
   223
williamr@2
   224
	/**
williamr@2
   225
	Close session with storage server.
williamr@2
   226
williamr@2
   227
	@publishedAll
williamr@2
   228
	@deprecated v9.1 Destructor is all that is required
williamr@2
   229
	*/
williamr@2
   230
	IMPORT_C void Close();
williamr@2
   231
williamr@2
   232
williamr@2
   233
	/**
williamr@2
   234
	Lookup latest data format version
williamr@2
   235
williamr@2
   236
	@pre   None
williamr@2
   237
    @post  None
williamr@2
   238
	@publishedAll
williamr@2
   239
	*/
williamr@2
   240
	IMPORT_C static TVersion LatestVersion();
williamr@2
   241
williamr@2
   242
williamr@2
   243
	/**
williamr@2
   244
	Lookup data format version currently in use by client
williamr@2
   245
williamr@2
   246
	@publishedAll
williamr@2
   247
	*/
williamr@2
   248
	IMPORT_C TVersion VersionInUse();
williamr@2
   249
williamr@2
   250
williamr@2
   251
	/**
williamr@2
   252
	Open Transaction with storage server and obtain write lock - if not already set
williamr@2
   253
williamr@2
   254
    @capability WriteDeviceData
williamr@2
   255
williamr@2
   256
    @leave	Will leave with KErrNotAvailable if Database write locked by another process
williamr@2
   257
	@leave  Will report KErrAlreadyInTransaction if transaction this session is already in a transaction
williamr@2
   258
    @leave  Will leave with a system-wide error code if an error occurs during commit
williamr@2
   259
williamr@2
   260
	@pre    None
williamr@2
   261
    @post   on success the session has exclusive write access to the database
williamr@2
   262
williamr@2
   263
	@publishedAll
williamr@2
   264
	*/
williamr@2
   265
	IMPORT_C void OpenTransactionL();
williamr@2
   266
williamr@2
   267
williamr@2
   268
	/**
williamr@2
   269
	Commit Transaction in database.
williamr@2
   270
williamr@2
   271
    @leave	Will leave with KErrNotFound if not in transaction
williamr@2
   272
    @leave  Will leave with a system-wide error code if an error occurs during commit
williamr@2
   273
williamr@2
   274
	@pre    None
williamr@2
   275
williamr@2
   276
	@post   On success the database is updated with data added, modified or deleted during the transaction
williamr@2
   277
    @post   On failure, any open data containers may not be in sync with the database and should be discarded or reloaded
williamr@2
   278
	@publishedAll
williamr@2
   279
	*/
williamr@2
   280
	IMPORT_C void CommitTransactionL();
williamr@2
   281
williamr@2
   282
williamr@2
   283
	/**
williamr@2
   284
	Cancel Transaction with database and rollback all associated changes
williamr@2
   285
        Will not make any changes to the client's containers
williamr@2
   286
williamr@2
   287
    @leave	Will fail with KErrNotFound if not in transaction
williamr@2
   288
williamr@2
   289
    @pre    None - though for correct usage, ensure a transaction is already open
williamr@2
   290
	@post   Any open data containers may not be in sync with the database and should be discarded or reloaded
williamr@2
   291
	@publishedAll
williamr@2
   292
	*/
williamr@2
   293
	IMPORT_C void RollbackTransactionL();
williamr@2
   294
williamr@2
   295
   /**
williamr@2
   296
	Query if this session is in a transaction with the database
williamr@2
   297
	Return code will indicate
williamr@2
   298
		Not in transaction,
williamr@2
   299
		Already in transaction for this session,
williamr@2
   300
		Write-lock not available.  Another session has it.
williamr@2
   301
williamr@2
   302
    @pre None
williamr@2
   303
	@publishedAll
williamr@2
   304
	*/
williamr@2
   305
	IMPORT_C TInt IsInTransaction();
williamr@2
   306
williamr@2
   307
	
williamr@2
   308
    /**
williamr@2
   309
	Set attributes to ignore for all database operations during this session 
williamr@2
   310
williamr@2
   311
    @params aAttributeFlags indicates the requested access level to stored data.
williamr@2
   312
            Attributes set by this call will be ignored as restrictions in all database interactions,
williamr@2
   313
	        providing the client has enough platform security capabilities to back up the request
williamr@2
   314
	
williamr@2
   315
    @pre None
williamr@2
   316
	@publishedAll
williamr@2
   317
	*/
williamr@2
   318
	IMPORT_C void SetAttributeMask(TMDBAttributeFlags aAttributeFlags);
williamr@2
   319
williamr@2
   320
	
williamr@2
   321
	/**
williamr@2
   322
	Check flags in attribute mask
williamr@2
   323
    @params aAttributeFlags indicates the requested access level to stored data
williamr@2
   324
            Attribute flags that have been set will be ignored as restrictions in all database interactions, 
williamr@2
   325
            providing the client has enough platform security capabilities to back up the request
williamr@2
   326
williamr@2
   327
    @return ETrue if the flag is set in the session mask 
williamr@2
   328
            This means that the attribute is ignored in database interactions for this session
williamr@2
   329
williamr@2
   330
    @return EFalse if the flag is not set in the session mask 
williamr@2
   331
            This means that the attribute is obeyed in all database interactions for this session
williamr@2
   332
williamr@2
   333
    @pre None
williamr@2
   334
	@publishedAll
williamr@2
   335
	*/
williamr@2
   336
	IMPORT_C TBool IsSetAttributeMask(TMDBAttributeFlags aAttributeFlags);
williamr@2
   337
williamr@2
   338
    
williamr@2
   339
    /**
williamr@2
   340
	Clear attribute mask settings, indicating required access level to stored data
williamr@2
   341
	Clear flags in the attribute mask for this session
williamr@2
   342
    
williamr@2
   343
        Flags indicate the requested access level to stored data
williamr@2
   344
	    
williamr@2
   345
        Attribute flags that have been set in this function will be cleared from the session's 
williamr@2
   346
        attribute mask and will be obeyed as restrictions in all database interactions, 
williamr@2
   347
        providing the client has enough platform security capabilities to back up the request
williamr@2
   348
        
williamr@2
   349
    @pre None
williamr@2
   350
	
williamr@2
   351
	@publishedAll
williamr@2
   352
	*/
williamr@2
   353
	IMPORT_C void ClearAttributeMask(TMDBAttributeFlags aAttributeFlags);
williamr@2
   354
williamr@2
   355
williamr@2
   356
williamr@2
   357
	/**
williamr@2
   358
	Cancel all notification requests that are outstanding from calls to 
williamr@2
   359
        MMetaDatabase::RequestNotification
williamr@2
   360
    Individual requests can be cancelled via MMetaDatabase::CancelNotify.
williamr@2
   361
williamr@2
   362
    @return KErrNone on success or a system-wide error code
williamr@2
   363
    
williamr@2
   364
    @pre  None
williamr@2
   365
williamr@2
   366
	@publishedAll
williamr@2
   367
	*/
williamr@2
   368
	IMPORT_C TInt CancelAllNotifications();
williamr@2
   369
williamr@2
   370
williamr@2
   371
    /**
williamr@2
   372
	Attempt to create publish/subscribe properties if not already defined.
williamr@2
   373
    
williamr@2
   374
        This function is normally called as a setup activity by System components
williamr@2
   375
williamr@2
   376
    @capability WriteDeviceData - since these properties are created in KUidSystemCategory category.  
williamr@2
   377
williamr@2
   378
    @return KErrNone on success.  Otherwise a system-wide error code
williamr@2
   379
    	
williamr@2
   380
    @pre None
williamr@2
   381
williamr@2
   382
    @internalComponent
williamr@2
   383
	*/	
williamr@2
   384
	IMPORT_C TInt PublishProperties();
williamr@2
   385
williamr@2
   386
private:
williamr@2
   387
williamr@2
   388
    TInt ConstructL( TVersion aRequiredVersion );
williamr@2
   389
williamr@2
   390
	CMDBSession();
williamr@2
   391
williamr@2
   392
private:
williamr@2
   393
williamr@2
   394
	CMDBSessionImpl* iMDBSessionImpl;
williamr@2
   395
	
williamr@2
   396
	friend class MMetaDatabase;
williamr@2
   397
};
williamr@2
   398
williamr@2
   399
williamr@2
   400
williamr@2
   401
williamr@2
   402
williamr@2
   403
class MMetaDatabase : public Meta::MMetaData
williamr@2
   404
/*
williamr@2
   405
Interface for interaction with a database server
williamr@2
   406
Inherited by each data set type that can be stored
williamr@2
   407
@publishedAll
williamr@2
   408
*/
williamr@2
   409
{
williamr@2
   410
public:
williamr@2
   411
williamr@2
   412
	IMPORT_C virtual ~MMetaDatabase();
williamr@2
   413
williamr@2
   414
williamr@2
   415
	/**
williamr@2
   416
	LoadL - Load this container with data from the database
williamr@2
   417
		
williamr@2
   418
        Any data in the container will be discarded 
williamr@2
   419
williamr@2
   420
        Individual fields may legitimately be NULL in the database, but if no data at all
williamr@2
   421
        is found for an entire table or record, LoadL will leave with 
williamr@2
   422
            KErrNotFound
williamr@2
   423
williamr@2
   424
        The client can request to ignore access control flags by setting the attribute mask
williamr@2
   425
            CMDBSession::SetAttributeMask()
williamr@2
   426
		However, only fields that the client has capabilities to write will be stored in the database
williamr@2
   427
		A request to read data from an unauthorised area of the database will cause the function to leave.with 
williamr@2
   428
            KErrPermissionDenied
williamr@2
   429
        
williamr@2
   430
        In a record, fields in an unauthorised column may be silently ignored and returned as NULL
williamr@2
   431
        
williamr@2
   432
        May also leave with KErrNoMemory or other general error codes
williamr@2
   433
	
williamr@2
   434
        On failure, the container should be discarded or reloaded before it is used again
williamr@2
   435
williamr@2
   436
    @pre
williamr@2
   437
williamr@2
   438
        Ensure the ElementId for this container fully identifies the target data in the database
williamr@2
   439
            <Table><Column><Record>
williamr@2
   440
        Ensure that the session object has been initialised with the correct dataset version
williamr@2
   441
        Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   442
williamr@2
   443
	@publishedAll
williamr@2
   444
	*/
williamr@2
   445
	IMPORT_C void LoadL(CMDBSession& aSession);
williamr@2
   446
williamr@2
   447
williamr@2
   448
	/**
williamr@2
   449
	FindL - Find and Load the data set(s) that match all the data values entered by the 
williamr@2
   450
    client in this container
williamr@2
   451
	     
williamr@2
   452
        Client can request to ignore access control flags by setting the attribute mask,
williamr@2
   453
            CMDBSession::SetAttributeMask()
williamr@2
   454
		However will not load data that the client is not authorised to see (by platsec)
williamr@2
   455
        even if the client has sets the appropriate attribute mask
williamr@2
   456
williamr@2
   457
		Will return
williamr@2
   458
			ETrue on success
williamr@2
   459
			EFalse if no data found that the client is authorised to view
williamr@2
   460
            
williamr@2
   461
        May also leave with KErrGeneral or other general error codes.
williamr@2
   462
williamr@2
   463
        On failure, the container should be discarded or repopulated before it is used again
williamr@2
   464
williamr@2
   465
    @pre
williamr@2
   466
williamr@2
   467
        Populate this container where necessary with valid data to match during the find operation
williamr@2
   468
        Ensure the ElementId for this container correcty identifies the target table in the database
williamr@2
   469
            <Table><Column>
williamr@2
   470
        Ensure that the session object has been initialised with the correct dataset version
williamr@2
   471
        Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   472
	@publishedAll
williamr@2
   473
	 */
williamr@2
   474
	IMPORT_C TBool FindL(CMDBSession& aSession);
williamr@2
   475
williamr@2
   476
williamr@2
   477
	/**
williamr@2
   478
	Refresh all fields in the container that have not been changed by the client
williamr@2
   479
williamr@2
   480
		The client can request to ignore access control flags by setting the attribute mask,
williamr@2
   481
            CMDBSession::SetAttributeMask()
williamr@2
   482
		However, only data that the client has capabilities to view will be loaded
williamr@2
   483
		Unauthorised data elements will be silently ignored and will remain NULL
williamr@2
   484
williamr@2
   485
		If no data at all is found the functon will leave with 
williamr@2
   486
			KErrNotFound
williamr@2
   487
williamr@2
   488
		If fields are not accessible for reading the function may leave with 
williamr@2
   489
            KErrPermissionDenied
williamr@2
   490
	    
williamr@2
   491
        May also leave with other general error codes if there are unexpected 
williamr@2
   492
        problems (e.g. KErrNoMemory when out of memory)
williamr@2
   493
williamr@2
   494
        On failure, the container should be discarded or reloaded before it is used again
williamr@2
   495
williamr@2
   496
	@pre
williamr@2
   497
williamr@2
   498
        Ensure the ElementId for this container fully identifies the target data in the database
williamr@2
   499
            <Table><Column><Record>
williamr@2
   500
        Ensure that the session object has been initialised with the correct dataset version
williamr@2
   501
        Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   502
	@publishedAll
williamr@2
   503
	*/
williamr@2
   504
	IMPORT_C void RefreshL(CMDBSession& aSession);
williamr@2
   505
williamr@2
   506
williamr@2
   507
	/**
williamr@2
   508
	StoreL - Store all fields in the database that have been changed in this container and 
williamr@2
   509
    create new records where necessary.
williamr@2
   510
williamr@2
   511
        StoreL is atomic for this container.  An internal transaction is used even if 
williamr@2
   512
        no overall transaction is set by client.
williamr@2
   513
            All changed fields in the element are stored in the database on success.  
williamr@2
   514
            No fields or records are stored in the database if the function leaves
williamr@2
   515
williamr@2
   516
        If a client has an open transaction in the session, the stored data will be available to this session as 
williamr@2
   517
        soon as StoreL completes but will not be visible to other sessions until the transaction completes successfully
williamr@2
   518
williamr@2
   519
		The client can request to ignore access control flags by setting the attribute mask
williamr@2
   520
            CMDBSession::SetAttributeMask()
williamr@2
   521
		However, only fields that the client has capabilities to write will be stored in the database
williamr@2
   522
		A request to modify data in an unauthorised area of the database will cause the function to leave.with 
williamr@2
   523
            KErrPermissionDenied
williamr@2
   524
        
williamr@2
   525
    	If a field already exists, StoreL will leave with
williamr@2
   526
	        KErrAlreadyExists
williamr@2
   527
williamr@2
   528
        May also leave with other general error codes if there are unexpected 
williamr@2
   529
        problems (e.g. KErrNoMemory when out of memory)
williamr@2
   530
williamr@2
   531
williamr@2
   532
        If StoreL fails or the later commit is not successful, The data in the container will not
williamr@2
   533
        match the data in the database.  
williamr@2
   534
williamr@2
   535
        On failure, the container should be discarded or repopulated before it is used again
williamr@2
   536
williamr@2
   537
	@pre
williamr@2
   538
williamr@2
   539
        Populate this container with valid data for storage
williamr@2
   540
        Ensure the ElementId for this container fully identifies the target location in the database
williamr@2
   541
            <Table><Column><Record>
williamr@2
   542
        Ensure that the session object has been initialised with the correct dataset version
williamr@2
   543
        Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   544
        
williamr@2
   545
	@publishedAll
williamr@2
   546
	*/
williamr@2
   547
	IMPORT_C void StoreL(CMDBSession& aSession);
williamr@2
   548
williamr@2
   549
williamr@2
   550
	/**
williamr@2
   551
	Modify all fields in the database that have been changed in this container by the caller
williamr@2
   552
        
williamr@2
   553
        Only modifies existing data in the database, won't create new fields  VCT - is this true?? don't think so
williamr@2
   554
	
williamr@2
   555
        Modification is atomic for this container.  It uses an internal transaction even if 
williamr@2
   556
        no overall transaction set by client.
williamr@2
   557
            All changed fields in the element are modified in database on success.  
williamr@2
   558
            No fields are altered in the database if the function leaves
williamr@2
   559
williamr@2
   560
        Client can request to ignore access control flags by setting the attribute mask
williamr@2
   561
            CMDBSession::SetAttributeMask()
williamr@2
   562
		However, only fields that the client has capabilities to alter will be modified.in the database
williamr@2
   563
		A request to modify data in an unauthorised area will cause the function to leave.with 
williamr@2
   564
            KErrPermissionDenied
williamr@2
   565
williamr@2
   566
        If field does not exist, the function will leave with 
williamr@2
   567
            KErrNotFound [VCT - surely not]
williamr@2
   568
williamr@2
   569
		May also leave with other general error codes if there are unexpected 
williamr@2
   570
        problems (e.g. KErrNoMemory when out of memory)
williamr@2
   571
williamr@2
   572
        On failure, the container should be discarded or repopulated before it is used again
williamr@2
   573
williamr@2
   574
    @pre
williamr@2
   575
williamr@2
   576
        Populate this container with valid data for storage
williamr@2
   577
        Ensure the ElementId for this container fully identifies the target data in the database
williamr@2
   578
            <Table><Column><Record>
williamr@2
   579
        Ensure that the session object has been initialised with the correct dataset version
williamr@2
   580
        Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   581
	@publishedAll
williamr@2
   582
	*/
williamr@2
   583
	IMPORT_C void ModifyL(CMDBSession& aSession);
williamr@2
   584
williamr@2
   585
williamr@2
   586
	/**
williamr@2
   587
	Delete fields from the database.
williamr@2
   588
williamr@2
   589
		Client can request to ignore access control flags by setting the attribute mask,
williamr@2
   590
		but only fields that the client has capabilities to delete will be removed.
williamr@2
   591
williamr@2
   592
		A request to delete data in unauthorised area will cause the function to leave
williamr@2
   593
williamr@2
   594
	@leave	If client not authorised to read or write the data, will leave with 
williamr@2
   595
	        	KErrPermissionDenied 
williamr@2
   596
            May also leave with other general error codes if there are unexpected 
williamr@2
   597
            problems (e.g. KErrNoMemory when out of memory)
williamr@2
   598
williamr@2
   599
    @pre    Ensure the ElementId for this container fully identifies the target data in the database
williamr@2
   600
                <Table><Column><Record>
williamr@2
   601
            Ensure that the session object has appropriate access control attributes to manage the target data in the database
williamr@2
   602
            Ensure the ElementId for this container correcty identifies the target data in the database
williamr@2
   603
williamr@2
   604
	@publishedAll
williamr@2
   605
	*/
williamr@2
   606
	IMPORT_C void DeleteL(CMDBSession& aSession);
williamr@2
   607
williamr@2
   608
williamr@2
   609
	/**
williamr@2
   610
	RequestNotification - Register for notification of events from all clients of the database
williamr@2
   611
williamr@2
   612
        aRequestStatus will be completed when the following events occur
williamr@2
   613
            TransactionComplete
williamr@2
   614
            TransactionRollback
williamr@2
   615
            SessionClose
williamr@2
   616
        
williamr@2
   617
        this aRequestStatus can be cancelled by a call to 
williamr@2
   618
            
williamr@2
   619
            MMetaDatabase::CancelNotification
williamr@2
   620
williamr@2
   621
        all outstanding aRequestStatus can be cancelled by a call to
williamr@2
   622
            
williamr@2
   623
            CMDBSession::CancelAllNotifications
williamr@2
   624
williamr@2
   625
    @capability WriteDeviceData
williamr@2
   626
    
williamr@2
   627
    @return KErrNone on success.  A system wide error on failure
williamr@2
   628
williamr@2
   629
    @params aSession        a valid session object
williamr@2
   630
    @params aRequestStatus  the requestStatus object that will be completed on notification
williamr@2
   631
    
williamr@2
   632
    @pre    None
williamr@2
   633
    @post   A notification request will be outstanding
williamr@2
   634
williamr@2
   635
	@publishedAll
williamr@2
   636
	*/
williamr@2
   637
	IMPORT_C TInt RequestNotification(CMDBSession&          aSession,
williamr@2
   638
									  TRequestStatus&        aRequestStatus);
williamr@2
   639
williamr@2
   640
	/**
williamr@2
   641
	CancelNotification - cancel an outstanding notification request
williamr@2
   642
        
williamr@2
   643
        note that all outstanding notification requests can be cancelled by a call to
williamr@2
   644
            
williamr@2
   645
            CMDBSession::CancelAllNotifications
williamr@2
   646
williamr@2
   647
    @pres
williamr@2
   648
         
williamr@2
   649
        There is an outstanding notification request
williamr@2
   650
williamr@2
   651
	@publishedAll
williamr@2
   652
	*/
williamr@2
   653
	IMPORT_C TInt CancelNotification(CMDBSession&       aSession,
williamr@2
   654
									 TRequestStatus&     aRequestStatus);
williamr@2
   655
williamr@2
   656
williamr@2
   657
protected:
williamr@2
   658
williamr@2
   659
williamr@2
   660
	explicit MMetaDatabase();
williamr@2
   661
williamr@2
   662
private:
williamr@2
   663
williamr@2
   664
    /*
williamr@2
   665
    @internalComponent
williamr@2
   666
    */
williamr@2
   667
    void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes);
williamr@2
   668
williamr@2
   669
    /*
williamr@2
   670
    @internalComponent
williamr@2
   671
    */
williamr@2
   672
    void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes, RArray<TUint32>& aMatches);
williamr@2
   673
williamr@2
   674
    /*
williamr@2
   675
    @internalComponent
williamr@2
   676
    */
williamr@2
   677
    void DoFindL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, RArray<TUint32>& candidates, RArray<TUint32>& matches);
williamr@2
   678
williamr@2
   679
    /*
williamr@2
   680
    @internalComponent
williamr@2
   681
    */
williamr@2
   682
    void DoRefreshL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
williamr@2
   683
williamr@2
   684
    /*
williamr@2
   685
    @internalComponent
williamr@2
   686
    */
williamr@2
   687
    void DoStoreL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
williamr@2
   688
williamr@2
   689
    /*
williamr@2
   690
    @internalComponent
williamr@2
   691
    */
williamr@2
   692
    void DoModifyL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
williamr@2
   693
williamr@2
   694
};
williamr@2
   695
williamr@2
   696
williamr@2
   697
williamr@2
   698
williamr@2
   699
williamr@2
   700
class CMDBElement : public CBase, public MMetaDatabase
williamr@2
   701
/*
williamr@2
   702
Every item stored in the database is represented as a CMDBElement
williamr@2
   703
This class contains the id and attributes of every item in the database
williamr@2
   704
and for individual fields it also contains the value.
williamr@2
   705
williamr@2
   706
@publishedAll
williamr@2
   707
@released
williamr@2
   708
*/
williamr@2
   709
{
williamr@2
   710
public:
williamr@2
   711
williamr@2
   712
williamr@2
   713
	/**
williamr@2
   714
	Default Constructor
williamr@2
   715
williamr@2
   716
	@publishedAll
williamr@2
   717
	*/
williamr@2
   718
	IMPORT_C CMDBElement();
williamr@2
   719
williamr@2
   720
williamr@2
   721
	/**
williamr@2
   722
	Constructor
williamr@2
   723
williamr@2
   724
	@publishedAll
williamr@2
   725
	*/
williamr@2
   726
	IMPORT_C CMDBElement(TMDBElementId aElementId);
williamr@2
   727
	
williamr@2
   728
	
williamr@2
   729
	/**
williamr@2
   730
	Destructor
williamr@2
   731
williamr@2
   732
	@publishedAll
williamr@2
   733
	*/
williamr@2
   734
	IMPORT_C ~CMDBElement();
williamr@2
   735
williamr@2
   736
williamr@2
   737
	// Accessors
williamr@2
   738
williamr@2
   739
	/**
williamr@2
   740
	Returns the ElementId of an object of this type.
williamr@2
   741
williamr@2
   742
	The TypeId is
williamr@2
   743
williamr@2
   744
	<TableId><ColumnId><RecordId>
williamr@2
   745
williamr@2
   746
	This identifies the meaning of the field in the database schema
williamr@2
   747
	It also identifies the type of the data stored in this element
williamr@2
   748
	and the instance of the type
williamr@2
   749
williamr@2
   750
	@publishedAll
williamr@2
   751
	*/
williamr@2
   752
	IMPORT_C TMDBElementId ElementId() const;
williamr@2
   753
williamr@2
   754
williamr@2
   755
	/**
williamr@2
   756
	Returns the TypeId of an object of this type.
williamr@2
   757
williamr@2
   758
	The TypeId is
williamr@2
   759
williamr@2
   760
	<TableId><ColumnId><x>
williamr@2
   761
williamr@2
   762
	This identifies the meaning of the data in this element in the database schema
williamr@2
   763
	It also identifies the type of the data contained in this element
williamr@2
   764
williamr@2
   765
    For an element that is a Table or a Record, the ColumnId field will be set to 
williamr@2
   766
williamr@2
   767
    KCDMaxColumnId
williamr@2
   768
	@publishedAll
williamr@2
   769
	*/
williamr@2
   770
	IMPORT_C TMDBElementId  TypeId() const;
williamr@2
   771
williamr@2
   772
williamr@2
   773
	/**
williamr@2
   774
	Returns the TableId of an object of this type.
williamr@2
   775
williamr@2
   776
	The TableId is part of the ElementId
williamr@2
   777
williamr@2
   778
	<TableId><x><x>
williamr@2
   779
williamr@2
   780
	It identifies the table in the database that holds the data contained in this element
williamr@2
   781
williamr@2
   782
	@publishedAll
williamr@2
   783
	*/
williamr@2
   784
	IMPORT_C TMDBElementId  TableId() const;
williamr@2
   785
williamr@2
   786
    
williamr@2
   787
    /**
williamr@2
   788
	Returns the RecordId of an object of this type.
williamr@2
   789
williamr@2
   790
	The RecordId is part of the ElementId <x><x><RecordId>
williamr@2
   791
williamr@2
   792
	It identifies a particular instance of this type of Element in the database
williamr@2
   793
williamr@2
   794
	@publishedAll
williamr@2
   795
	*/
williamr@2
   796
	IMPORT_C TInt RecordId() const;
williamr@2
   797
williamr@2
   798
williamr@2
   799
	/**
williamr@2
   800
	Returns the Attributes of an object of this type.
williamr@2
   801
williamr@2
   802
	Attributes express database access rights for the data of this element
williamr@2
   803
williamr@2
   804
	@publishedAll
williamr@2
   805
	*/
williamr@2
   806
	IMPORT_C TMDBAttributeFlags Attributes() const;
williamr@2
   807
williamr@2
   808
    // SETTER FUNCTIONS
williamr@2
   809
williamr@2
   810
	/**
williamr@2
   811
	Sets the ElementId
williamr@2
   812
williamr@2
   813
	@publishedAll
williamr@2
   814
	*/
williamr@2
   815
	IMPORT_C void SetElementId(TMDBElementId aElementId);
williamr@2
   816
williamr@2
   817
williamr@2
   818
	/**
williamr@2
   819
	Sets the TypeId
williamr@2
   820
williamr@2
   821
	@publishedAll
williamr@2
   822
	*/
williamr@2
   823
	IMPORT_C void SetTypeId(TMDBElementId aElementId);
williamr@2
   824
williamr@2
   825
williamr@2
   826
	/**
williamr@2
   827
	Sets the RecordId
williamr@2
   828
williamr@2
   829
	@publishedAll
williamr@2
   830
	*/
williamr@2
   831
	IMPORT_C void SetRecordId(TInt aRecordId);
williamr@2
   832
williamr@2
   833
williamr@2
   834
	/**
williamr@2
   835
	Sets one or more attributes
williamr@2
   836
williamr@2
   837
	@publishedAll
williamr@2
   838
	*/
williamr@2
   839
	IMPORT_C void SetAttributes(TMDBAttributeFlags aAttributes);
williamr@2
   840
williamr@2
   841
williamr@2
   842
	/**
williamr@2
   843
	Clears one or more attributes
williamr@2
   844
williamr@2
   845
	@publishedAll
williamr@2
   846
	*/
williamr@2
   847
	IMPORT_C void ClearAttributes(TMDBAttributeFlags aAttributes);
williamr@2
   848
williamr@2
   849
williamr@2
   850
	/**
williamr@2
   851
	Queries the attributes
williamr@2
   852
williamr@2
   853
	Returns ETrue if all queried attributes are set
williamr@2
   854
	Returns EFalse if any queried attribute is not set.
williamr@2
   855
williamr@2
   856
	@publishedAll
williamr@2
   857
	*/
williamr@2
   858
	IMPORT_C TBool IsSetAttribute(TMDBAttributeFlags aAttributes) const;
williamr@2
   859
williamr@2
   860
williamr@2
   861
	/**
williamr@2
   862
	Queries the state of the field value
williamr@2
   863
williamr@2
   864
	Returns ETrue if the value of the element is not set
williamr@2
   865
	Returns EFalse if the element contains a value
williamr@2
   866
williamr@2
   867
	@publishedAll
williamr@2
   868
	*/
williamr@2
   869
	IMPORT_C TBool IsNull() const;	
williamr@2
   870
	
williamr@2
   871
	
williamr@2
   872
	
williamr@2
   873
    EXP_DATA_VTABLE
williamr@2
   874
	
williamr@2
   875
    /**
williamr@2
   876
	Queries the type of the field value
williamr@2
   877
williamr@2
   878
	Returns the enumeration TCDFieldValueTypes that represents the value that can be stored in this element
williamr@2
   879
williamr@2
   880
	@publishedAll
williamr@2
   881
	*/
williamr@2
   882
williamr@2
   883
	virtual TCDFieldValueTypes Type()=0;
williamr@2
   884
williamr@2
   885
	/**
williamr@2
   886
	@internalComponent
williamr@2
   887
	*/
williamr@2
   888
    TMDBElementId* Data(){return &iElementId;}
williamr@2
   889
    
williamr@2
   890
	/**
williamr@2
   891
	@internalComponent
williamr@2
   892
	*/
williamr@2
   893
    const TMDBElementId* CData(){return &iElementId;}
williamr@2
   894
    
williamr@2
   895
williamr@2
   896
	
williamr@2
   897
protected:
williamr@2
   898
williamr@2
   899
	TMDBElementId     iElementId;
williamr@2
   900
	
williamr@2
   901
    TAny*             iValue;
williamr@2
   902
    
williamr@2
   903
    };
williamr@2
   904
williamr@2
   905
williamr@2
   906
williamr@2
   907
williamr@2
   908
///////////////////////////////////////////////////////////////////////////////////////
williamr@2
   909
//  COMMSDAT CONTAINERS
williamr@2
   910
//
williamr@2
   911
williamr@2
   912
/**
williamr@2
   913
Commsdat Container classes qualifying numeric values
williamr@2
   914
@internalComponent 
williamr@2
   915
*/
williamr@2
   916
class CMDBNumFieldBase : public CMDBElement
williamr@2
   917
{
williamr@2
   918
public:
williamr@2
   919
	/**
williamr@2
   920
	Default Constructor
williamr@2
   921
	*/
williamr@2
   922
    IMPORT_C CMDBNumFieldBase();
williamr@2
   923
williamr@2
   924
williamr@2
   925
   	/**
williamr@2
   926
	Constructor setting Field's ElementId
williamr@2
   927
	*/
williamr@2
   928
	IMPORT_C CMDBNumFieldBase(TMDBElementId aFieldId);
williamr@2
   929
		
williamr@2
   930
williamr@2
   931
    /**
williamr@2
   932
	Assignment operator for field value
williamr@2
   933
	*/
williamr@2
   934
	IMPORT_C CMDBNumFieldBase& operator=(const TInt aValue);
williamr@2
   935
	
williamr@2
   936
    IMPORT_C void SetMaxLengthL(TInt aLength);
williamr@2
   937
    TMDBElementId GetL();
williamr@2
   938
	     
williamr@2
   939
    EXP_DATA_VTABLE
williamr@2
   940
williamr@2
   941
	virtual TCDFieldValueTypes Type()
williamr@2
   942
		{
williamr@2
   943
		return EInt;
williamr@2
   944
		}    
williamr@2
   945
    
williamr@2
   946
};
williamr@2
   947
williamr@2
   948
template<class TYPE>
williamr@2
   949
class CMDBField : public CMDBNumFieldBase
williamr@2
   950
/**
williamr@2
   951
A thin template that guards typed data access in a single CMDBElement
williamr@2
   952
This class describes a single numeric field in the database
williamr@2
   953
williamr@2
   954
@publishedAll
williamr@2
   955
*/
williamr@2
   956
{
williamr@2
   957
public:
williamr@2
   958
williamr@2
   959
	/**
williamr@2
   960
	Default Constructor
williamr@2
   961
williamr@2
   962
	@publishedAll
williamr@2
   963
	*/
williamr@2
   964
	inline CMDBField()
williamr@2
   965
		{
williamr@2
   966
		}
williamr@2
   967
williamr@2
   968
	/**
williamr@2
   969
	Constructor setting Field's ElementId
williamr@2
   970
williamr@2
   971
	@publishedAll
williamr@2
   972
	*/
williamr@2
   973
	inline CMDBField(TMDBElementId aFieldId)
williamr@2
   974
		: CMDBNumFieldBase(aFieldId)
williamr@2
   975
		{
williamr@2
   976
		}
williamr@2
   977
williamr@2
   978
williamr@2
   979
	/**
williamr@2
   980
	Assignment operator for field value
williamr@2
   981
williamr@2
   982
	@publishedAll
williamr@2
   983
	*/
williamr@2
   984
	inline CMDBField<TYPE>& operator=(const TYPE& aValue)
williamr@2
   985
	{
williamr@2
   986
    	return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=((TInt&)aValue);
williamr@2
   987
	}
williamr@2
   988
williamr@2
   989
williamr@2
   990
    inline CMDBField<TYPE>& operator=(const CMDBField<TYPE>& aValue)
williamr@2
   991
	{
williamr@2
   992
	    return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=(aValue);
williamr@2
   993
	}
williamr@2
   994
	
williamr@2
   995
	/**
williamr@2
   996
	Conversion operator for field value
williamr@2
   997
williamr@2
   998
	@publishedAll
williamr@2
   999
	*/
williamr@2
  1000
	inline operator TYPE&()
williamr@2
  1001
	{
williamr@2
  1002
		return (TYPE&)iValue;
williamr@2
  1003
	}
williamr@2
  1004
	
williamr@2
  1005
	/**
williamr@2
  1006
	Conversion operator for field value
williamr@2
  1007
williamr@2
  1008
	@publishedAll
williamr@2
  1009
	*/
williamr@2
  1010
	inline CMDBField<TYPE>& GetL()
williamr@2
  1011
	{
williamr@2
  1012
		if(IsNull() && !(ElementId() & KCDChangedFlag))
williamr@2
  1013
			{
williamr@2
  1014
			User::Leave(KErrNotFound); //todo commsdat specific error code
williamr@2
  1015
			}
williamr@2
  1016
williamr@2
  1017
		return (TYPE&)iValue;
williamr@2
  1018
	}
williamr@2
  1019
	
williamr@2
  1020
	/**
williamr@2
  1021
	Function for setting a value
williamr@2
  1022
williamr@2
  1023
	@publishedAll
williamr@2
  1024
	*/
williamr@2
  1025
	inline void SetL(const TYPE& aValue)
williamr@2
  1026
	{
williamr@2
  1027
	CMDBNumFieldBase::operator=(aValue);
williamr@2
  1028
	}
williamr@2
  1029
	
williamr@2
  1030
};
williamr@2
  1031
williamr@2
  1032
williamr@2
  1033
williamr@2
  1034
//////////////////
williamr@2
  1035
/**
williamr@2
  1036
Base Container class qualifying a text field
williamr@2
  1037
@internalComponent
williamr@2
  1038
*/
williamr@2
  1039
class CMDBTextFieldBase : public CMDBElement
williamr@2
  1040
{
williamr@2
  1041
public:
williamr@2
  1042
	/**
williamr@2
  1043
	Default Constructor
williamr@2
  1044
	*/
williamr@2
  1045
	IMPORT_C CMDBTextFieldBase();
williamr@2
  1046
williamr@2
  1047
	/**
williamr@2
  1048
	Constructor setting Field's ElementId
williamr@2
  1049
	*/
williamr@2
  1050
	IMPORT_C CMDBTextFieldBase(TMDBElementId aFieldId);    
williamr@2
  1051
	
williamr@2
  1052
	
williamr@2
  1053
	/**
williamr@2
  1054
	Destructor that deletes the field value
williamr@2
  1055
	*/
williamr@2
  1056
	IMPORT_C ~CMDBTextFieldBase();    
williamr@2
  1057
	
williamr@2
  1058
	
williamr@2
  1059
	/**
williamr@2
  1060
	Assignment Operator setting Field's value
williamr@2
  1061
	*/
williamr@2
  1062
	IMPORT_C CMDBTextFieldBase& operator=(const TDesC& aValue);
williamr@2
  1063
	
williamr@2
  1064
	    	
williamr@2
  1065
    IMPORT_C void SetMaxLengthL(TInt aLength);
williamr@2
  1066
williamr@2
  1067
    EXP_DATA_VTABLE
williamr@2
  1068
    
williamr@2
  1069
	virtual TCDFieldValueTypes Type()
williamr@2
  1070
		{
williamr@2
  1071
		return EText;
williamr@2
  1072
		}    
williamr@2
  1073
williamr@2
  1074
};
williamr@2
  1075
williamr@2
  1076
williamr@2
  1077
williamr@2
  1078
williamr@2
  1079
williamr@2
  1080
williamr@2
  1081
williamr@2
  1082
template<>
williamr@2
  1083
class CMDBField<TDesC> : public CMDBTextFieldBase
williamr@2
  1084
/**
williamr@2
  1085
A thin template that guards typed data access in a single CMDBElement
williamr@2
  1086
This class describes a single field in the database
williamr@2
  1087
williamr@2
  1088
@publishedAll
williamr@2
  1089
*/
williamr@2
  1090
{
williamr@2
  1091
public:
williamr@2
  1092
williamr@2
  1093
	/**
williamr@2
  1094
	Default Constructor
williamr@2
  1095
williamr@2
  1096
	@publishedAll
williamr@2
  1097
	*/
williamr@2
  1098
	inline CMDBField()
williamr@2
  1099
		{
williamr@2
  1100
		}
williamr@2
  1101
williamr@2
  1102
	/**
williamr@2
  1103
	Constructor setting Field's ElementId
williamr@2
  1104
williamr@2
  1105
	@publishedAll
williamr@2
  1106
	*/
williamr@2
  1107
	inline CMDBField(TMDBElementId aFieldId)
williamr@2
  1108
		: CMDBTextFieldBase(aFieldId)
williamr@2
  1109
		{
williamr@2
  1110
		}
williamr@2
  1111
williamr@2
  1112
williamr@2
  1113
    inline void SetMaxLengthL(TInt aLength)
williamr@2
  1114
	// create a new buffer if necessary.
williamr@2
  1115
	{
williamr@2
  1116
	    CMDBTextFieldBase::SetMaxLengthL(aLength);
williamr@2
  1117
	}
williamr@2
  1118
	
williamr@2
  1119
    inline CMDBField<TDesC>& operator=(const TDesC& aValue)
williamr@2
  1120
	{
williamr@2
  1121
        CMDBTextFieldBase::operator=(aValue);	   
williamr@2
  1122
        return *this; 
williamr@2
  1123
	}
williamr@2
  1124
williamr@2
  1125
    inline CMDBField<TDesC>& operator=(CMDBField<TDesC>& aValue)
williamr@2
  1126
	{
williamr@2
  1127
        CMDBTextFieldBase::operator=((const TDesC&)aValue);	
williamr@2
  1128
        return *this;   
williamr@2
  1129
	}
williamr@2
  1130
williamr@2
  1131
	/**
williamr@2
  1132
	Conversion operator for field value
williamr@2
  1133
williamr@2
  1134
	@publishedAll
williamr@2
  1135
	*/
williamr@2
  1136
	inline operator const TDesC&()
williamr@2
  1137
	{
williamr@2
  1138
        if (! iValue)
williamr@2
  1139
            return KNullDesC;
williamr@2
  1140
williamr@2
  1141
		return *(HBufC*)iValue;
williamr@2
  1142
	}
williamr@2
  1143
	
williamr@2
  1144
	/**
williamr@2
  1145
	Conversion operator for field value
williamr@2
  1146
williamr@2
  1147
	@publishedAll
williamr@2
  1148
	*/
williamr@2
  1149
	inline TDesC& GetL()
williamr@2
  1150
	{
williamr@2
  1151
		if(IsNull() && !(ElementId() & KCDChangedFlag))
williamr@2
  1152
			{
williamr@2
  1153
			User::Leave(KErrNotFound); //todo commsdat specific error code
williamr@2
  1154
			}
williamr@2
  1155
williamr@2
  1156
		return *(HBufC*)iValue;
williamr@2
  1157
	}
williamr@2
  1158
	
williamr@2
  1159
	/**
williamr@2
  1160
	Function for setting a value
williamr@2
  1161
williamr@2
  1162
	@publishedAll
williamr@2
  1163
	*/
williamr@2
  1164
	inline void SetL(const TDesC& aValue)
williamr@2
  1165
	{
williamr@2
  1166
	SetMaxLengthL(aValue.Length());
williamr@2
  1167
	CMDBTextFieldBase::operator=(aValue);
williamr@2
  1168
	}
williamr@2
  1169
	
williamr@2
  1170
	
williamr@2
  1171
};
williamr@2
  1172
williamr@2
  1173
williamr@2
  1174
//////////////////
williamr@2
  1175
/**
williamr@2
  1176
Container class for qualifying binary values
williamr@2
  1177
@internalComponent 
williamr@2
  1178
*/
williamr@2
  1179
class CMDBBinFieldBase : public CMDBElement
williamr@2
  1180
{
williamr@2
  1181
public:
williamr@2
  1182
	/**
williamr@2
  1183
	Default Constructor
williamr@2
  1184
	*/
williamr@2
  1185
	IMPORT_C CMDBBinFieldBase();
williamr@2
  1186
williamr@2
  1187
	
williamr@2
  1188
	/**
williamr@2
  1189
	Constructor setting Field's ElementId
williamr@2
  1190
	*/
williamr@2
  1191
	IMPORT_C CMDBBinFieldBase(TMDBElementId aFieldId);    
williamr@2
  1192
	
williamr@2
  1193
	
williamr@2
  1194
	/**
williamr@2
  1195
	Destructor that deletes the field value
williamr@2
  1196
	*/
williamr@2
  1197
	IMPORT_C ~CMDBBinFieldBase();    
williamr@2
  1198
	
williamr@2
  1199
	
williamr@2
  1200
	/**
williamr@2
  1201
	Assignment Operator setting Field's value
williamr@2
  1202
	*/
williamr@2
  1203
	IMPORT_C CMDBBinFieldBase& operator=(const TDesC8& aValue);
williamr@2
  1204
	    	
williamr@2
  1205
    /**
williamr@2
  1206
	To allocate space for field data.
williamr@2
  1207
	*/
williamr@2
  1208
	IMPORT_C void SetMaxLengthL(TInt aLength);
williamr@2
  1209
williamr@2
  1210
    EXP_DATA_VTABLE
williamr@2
  1211
    
williamr@2
  1212
	virtual TCDFieldValueTypes Type()
williamr@2
  1213
		{
williamr@2
  1214
		return EDesC8;
williamr@2
  1215
		}    
williamr@2
  1216
};
williamr@2
  1217
williamr@2
  1218
williamr@2
  1219
template<>
williamr@2
  1220
class CMDBField<TDesC8> : public CMDBBinFieldBase
williamr@2
  1221
/**
williamr@2
  1222
A thin template that guards typed data access in a single CMDBElement
williamr@2
  1223
This class describes a single field in the database
williamr@2
  1224
williamr@2
  1225
@publishedAll
williamr@2
  1226
*/
williamr@2
  1227
{
williamr@2
  1228
public:
williamr@2
  1229
williamr@2
  1230
	/**
williamr@2
  1231
	Default Constructor
williamr@2
  1232
williamr@2
  1233
	@publishedAll
williamr@2
  1234
	*/
williamr@2
  1235
	inline CMDBField()
williamr@2
  1236
		{
williamr@2
  1237
		}
williamr@2
  1238
williamr@2
  1239
	/**
williamr@2
  1240
	Constructor setting Field's ElementId
williamr@2
  1241
williamr@2
  1242
	@publishedAll
williamr@2
  1243
	*/
williamr@2
  1244
	inline CMDBField(TMDBElementId aFieldId)
williamr@2
  1245
		: CMDBBinFieldBase(aFieldId)
williamr@2
  1246
		{
williamr@2
  1247
		}
williamr@2
  1248
williamr@2
  1249
    inline void SetMaxLengthL(TInt aLength)
williamr@2
  1250
	// create a new buffer if necessary.
williamr@2
  1251
    	{
williamr@2
  1252
    	    CMDBBinFieldBase::SetMaxLengthL(aLength);
williamr@2
  1253
    	}
williamr@2
  1254
	
williamr@2
  1255
	
williamr@2
  1256
    inline CMDBField<TDesC8>& operator=(const TDesC8& aValue)
williamr@2
  1257
    	{
williamr@2
  1258
            return (CMDBField<TDesC8>&)CMDBBinFieldBase::operator=(aValue);	    
williamr@2
  1259
    	}
williamr@2
  1260
	
williamr@2
  1261
	
williamr@2
  1262
    inline CMDBField<TDesC8>& operator=(CMDBField<TDesC8>& aValue)
williamr@2
  1263
	// Copy assignment
williamr@2
  1264
        {
williamr@2
  1265
            return (CMDBField<TDesC8>&)CMDBBinFieldBase::operator=((const TDesC8&)aValue);	    
williamr@2
  1266
    	}
williamr@2
  1267
williamr@2
  1268
williamr@2
  1269
	/**
williamr@2
  1270
	Conversion operator for field value
williamr@2
  1271
williamr@2
  1272
	@publishedAll
williamr@2
  1273
	*/
williamr@2
  1274
	inline operator const TDesC8&()
williamr@2
  1275
    	{
williamr@2
  1276
		    if (! iValue)
williamr@2
  1277
                return KNullDesC8;
williamr@2
  1278
williamr@2
  1279
    		return *(HBufC8*)iValue;
williamr@2
  1280
    	}
williamr@2
  1281
    	
williamr@2
  1282
    /**
williamr@2
  1283
	Conversion operator for field value
williamr@2
  1284
williamr@2
  1285
	@publishedAll
williamr@2
  1286
	*/
williamr@2
  1287
	inline TDesC8& GetL()
williamr@2
  1288
	{
williamr@2
  1289
		if(IsNull() && !(ElementId() & KCDChangedFlag))
williamr@2
  1290
			{
williamr@2
  1291
			User::Leave(KErrNotFound); //todo commsdat specific error code
williamr@2
  1292
			}
williamr@2
  1293
williamr@2
  1294
    	return *(HBufC8*)iValue;
williamr@2
  1295
	}
williamr@2
  1296
	
williamr@2
  1297
	/**
williamr@2
  1298
	Function for setting a value
williamr@2
  1299
williamr@2
  1300
	@publishedAll
williamr@2
  1301
	*/
williamr@2
  1302
	inline void SetL(const TDesC8& aValue)
williamr@2
  1303
	{
williamr@2
  1304
	SetMaxLengthL(aValue.Length());
williamr@2
  1305
	CMDBBinFieldBase::operator=(aValue);
williamr@2
  1306
	}
williamr@2
  1307
	
williamr@2
  1308
};
williamr@2
  1309
williamr@2
  1310
williamr@2
  1311
williamr@2
  1312
///////////////////////////////////////////////////////////////////////////////////////////////
williamr@2
  1313
williamr@2
  1314
/**
williamr@2
  1315
Base class for CMDBRecordLink
williamr@2
  1316
@internalComponent 
williamr@2
  1317
*/
williamr@2
  1318
class CMDBRecordLinkBase : public CMDBNumFieldBase
williamr@2
  1319
{
williamr@2
  1320
public :	
williamr@2
  1321
williamr@2
  1322
	IMPORT_C CMDBRecordLinkBase();
williamr@2
  1323
williamr@2
  1324
	IMPORT_C CMDBRecordLinkBase(TMDBElementId aLinkingFieldId);
williamr@2
  1325
williamr@2
  1326
	IMPORT_C CMDBRecordLinkBase(TMDBElementId aLinkingFieldId, CMDBElement* aLinkedRecord);
williamr@2
  1327
williamr@2
  1328
williamr@2
  1329
	IMPORT_C ~CMDBRecordLinkBase();
williamr@2
  1330
williamr@2
  1331
	/**
williamr@2
  1332
	Assignment operator for field value
williamr@2
  1333
	which sets the id of the element list
williamr@2
  1334
	*/
williamr@2
  1335
	IMPORT_C CMDBRecordLinkBase& operator=(const TMDBElementId aValue);
williamr@2
  1336
williamr@2
  1337
williamr@2
  1338
	/**
williamr@2
  1339
	Conversion operator for field value
williamr@2
  1340
	which gets the id of the element list
williamr@2
  1341
	*/
williamr@2
  1342
	IMPORT_C operator TMDBElementId();
williamr@2
  1343
williamr@2
  1344
    TCDFieldValueTypes Type()
williamr@2
  1345
		{
williamr@2
  1346
		return ELink;
williamr@2
  1347
		}    
williamr@2
  1348
williamr@2
  1349
protected:
williamr@2
  1350
williamr@2
  1351
	EXP_DATA_VTABLE
williamr@2
  1352
williamr@2
  1353
public:
williamr@2
  1354
    
williamr@2
  1355
	// the record referenced by the link id stored in the value of this field.
williamr@2
  1356
	CMDBElement*     iLinkedRecord;
williamr@2
  1357
williamr@2
  1358
};
williamr@2
  1359
williamr@2
  1360
williamr@2
  1361
template<class RECORD_TYPE>
williamr@2
  1362
class CMDBRecordLink : public CMDBRecordLinkBase
williamr@2
  1363
/**
williamr@2
  1364
 This container expresses a 'soft-link' to a record in another table.
williamr@2
  1365
williamr@2
  1366
 The value of a CMDBRecordLink field as stored in the database is the 
williamr@2
  1367
 ElementId (<Table><Record>) of the linked record.
williamr@2
  1368
williamr@2
  1369
 The linked record itself can be viewed via the iLinkedRecord member and its accessors
williamr@2
  1370
 
williamr@2
  1371
 iLinkedRecord must be created explicitly by the client - either on construction, 
williamr@2
  1372
 or by use of the CreateLinkL or SetLinkL functions. Often the linked record is not 
williamr@2
  1373
 required by a caller.  So creating it automatically would just waste memory
williamr@2
  1374
 
williamr@2
  1375
 When instantiating iLinkedRecord directly take care to match the object's type to the Type 
williamr@2
  1376
 ID that will be found at the linking element.  It is better to use the CreateLinkL or 
williamr@2
  1377
 SetLinkL functions to ensure type safety
williamr@2
  1378
 
williamr@2
  1379
 Calling MMetaDatabase functions on a CMDRecordLink field directly will perform the operation
williamr@2
  1380
 on the field and also the linked record if it is present 
williamr@2
  1381
@publishedAll
williamr@2
  1382
@released
williamr@2
  1383
*/
williamr@2
  1384
{
williamr@2
  1385
public :
williamr@2
  1386
	/**
williamr@2
  1387
	Constructor/Destructor
williamr@2
  1388
williamr@2
  1389
	@publishedAll
williamr@2
  1390
	*/
williamr@2
  1391
williamr@2
  1392
	inline CMDBRecordLink()
williamr@2
  1393
		: CMDBRecordLinkBase() {}
williamr@2
  1394
williamr@2
  1395
	/**
williamr@2
  1396
	Constructor
williamr@2
  1397
williamr@2
  1398
	@publishedAll
williamr@2
  1399
	*/
williamr@2
  1400
	inline CMDBRecordLink(TMDBElementId aLinkingFieldId)
williamr@2
  1401
		: CMDBRecordLinkBase(aLinkingFieldId) {}
williamr@2
  1402
williamr@2
  1403
	/**
williamr@2
  1404
	Constructor
williamr@2
  1405
williamr@2
  1406
	@publishedAll
williamr@2
  1407
	*/
williamr@2
  1408
	inline CMDBRecordLink(TMDBElementId aLinkingFieldId, RECORD_TYPE* aLinkedRecord)
williamr@2
  1409
		: CMDBRecordLinkBase(aLinkingFieldId, (CMDBElement*)aLinkedRecord) {}
williamr@2
  1410
williamr@2
  1411
	/**
williamr@2
  1412
	@publishedAll
williamr@2
  1413
	*/
williamr@2
  1414
	inline CMDBRecordLink& operator=(const TMDBElementId aValue)
williamr@2
  1415
	{
williamr@2
  1416
		return (CMDBRecordLink&)CMDBRecordLinkBase::operator=(aValue);
williamr@2
  1417
	}
williamr@2
  1418
	
williamr@2
  1419
williamr@2
  1420
    // SETTERS
williamr@2
  1421
williamr@2
  1422
	/**
williamr@2
  1423
	Set the field value (this will be validated on StoreL)
williamr@2
  1424
williamr@2
  1425
	@publishedAll
williamr@2
  1426
	*/
williamr@2
  1427
	inline void SetL(const TMDBElementId aValue)
williamr@2
  1428
		{
williamr@2
  1429
		CMDBRecordLinkBase::operator=(aValue);
williamr@2
  1430
		}
williamr@2
  1431
		
williamr@2
  1432
williamr@2
  1433
    // OPERATORS
williamr@2
  1434
williamr@2
  1435
	/**
williamr@2
  1436
	conversion operator for linked record of this type
williamr@2
  1437
williamr@2
  1438
	@publishedAll
williamr@2
  1439
	*/
williamr@2
  1440
	inline operator RECORD_TYPE*()
williamr@2
  1441
	{
williamr@2
  1442
		return static_cast<RECORD_TYPE*>(iLinkedRecord);
williamr@2
  1443
	}	
williamr@2
  1444
williamr@2
  1445
};
williamr@2
  1446
williamr@2
  1447
enum TFieldTypeAttributes
williamr@2
  1448
/**
williamr@2
  1449
To express type information for all MetaDatabase fields
williamr@2
  1450
@publishedAll
williamr@2
  1451
@released
williamr@2
  1452
*/
williamr@2
  1453
	{
williamr@2
  1454
	ENoAttrs,	///< No attributes associated with this field.
williamr@2
  1455
	ENotNull, 	///< Ensures the field contains a value and must not be null.	
williamr@2
  1456
	};
williamr@2
  1457
williamr@2
  1458
typedef struct
williamr@2
  1459
/**
williamr@2
  1460
To express type information for all MetaDatabase fields
williamr@2
  1461
@publishedAll
williamr@2
  1462
@released
williamr@2
  1463
*/
williamr@2
  1464
	{
williamr@2
  1465
		const TMDBElementId	        iTypeId;		///< Identifier for the field.	
williamr@2
  1466
		const TInt                  iValType;		///< The field type value e.g.EText, EMedText.
williamr@2
  1467
	    const TFieldTypeAttributes	iTypeAttr;		///< The field attribute, either ENoAttrs or ENotNull.
williamr@2
  1468
        const TText * const         iTypeName;		///< Name of the field type.
williamr@2
  1469
	    
williamr@2
  1470
	} SRecordTypeInfo;
williamr@2
  1471
williamr@2
  1472
williamr@2
  1473
#define MDB_GENERIC_TYPE_INFO(a, b, c, d) SGenericRecordTypeInfo(a, b, c, d)
williamr@2
  1474
williamr@2
  1475
typedef TBuf<64> TGenericTypeName;
williamr@2
  1476
williamr@2
  1477
typedef struct SGenericRecordTypeInfoTag
williamr@2
  1478
/**
williamr@2
  1479
To express type information for all MetaDatabase fields
williamr@2
  1480
@publishedAll
williamr@2
  1481
@released
williamr@2
  1482
*/
williamr@2
  1483
	{
williamr@2
  1484
	     SGenericRecordTypeInfoTag()
williamr@2
  1485
    	     : iTypeId(0), iValType(0), iTypeAttr(ENoAttrs) {}
williamr@2
  1486
williamr@2
  1487
	     SGenericRecordTypeInfoTag(TMDBElementId        aId,
williamr@2
  1488
	                               TInt                 aVal,
williamr@2
  1489
	                               TFieldTypeAttributes aAttrType)
williamr@2
  1490
   	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType)
williamr@2
  1491
    	        {
williamr@2
  1492
    	        }
williamr@2
  1493
williamr@2
  1494
	     SGenericRecordTypeInfoTag(TMDBElementId        aId,
williamr@2
  1495
	                               TInt                 aVal,
williamr@2
  1496
	                               TFieldTypeAttributes aAttrType,
williamr@2
  1497
	                               TText * const        aTypeName)
williamr@2
  1498
    	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName)
williamr@2
  1499
    	        {
williamr@2
  1500
    	        
williamr@2
  1501
    	        }
williamr@2
  1502
williamr@2
  1503
williamr@2
  1504
	     SGenericRecordTypeInfoTag(      TMDBElementId        aId,
williamr@2
  1505
	                                     TInt                 aVal,
williamr@2
  1506
	                                     TFieldTypeAttributes aAttrType,
williamr@2
  1507
	                               const TGenericTypeName&    aTypeName)
williamr@2
  1508
    	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName) {}
williamr@2
  1509
williamr@2
  1510
williamr@2
  1511
		 TMDBElementId	       iTypeId;			///< Identifier for the field type.	
williamr@2
  1512
		 TInt                  iValType;		///< The field type value e.g.EText, EMedText.
williamr@2
  1513
	     TFieldTypeAttributes  iTypeAttr;		///< The type's attribute, either ENoAttrs or ENotNull
williamr@2
  1514
         TGenericTypeName	   iTypeName;		///< Name of the field type.
williamr@2
  1515
	} SGenericRecordTypeInfo;
williamr@2
  1516
	
williamr@2
  1517
	
williamr@2
  1518
williamr@2
  1519
class CMDBRecordBase : public CMDBNumFieldBase
williamr@2
  1520
/**
williamr@2
  1521
Base class for all MetaDatabase records
williamr@2
  1522
@publishedAll
williamr@2
  1523
@released
williamr@2
  1524
*/
williamr@2
  1525
	{
williamr@2
  1526
	public:
williamr@2
  1527
williamr@2
  1528
		inline CMDBRecordBase(){}
williamr@2
  1529
		inline CMDBRecordBase(TMDBElementId aElementId)
williamr@2
  1530
			: CMDBNumFieldBase(aElementId | KCDMaskShowFieldType){}
williamr@2
  1531
			
williamr@2
  1532
		IMPORT_C virtual CMDBElement* GetFieldByNameL(const TPtrC& aFieldName, TInt& aValType );
williamr@2
  1533
williamr@2
  1534
		IMPORT_C virtual CMDBElement* GetFieldByIdL(TMDBElementId aId);
williamr@2
  1535
		
williamr@2
  1536
		IMPORT_C virtual const SRecordTypeInfo* GetRecordInfo();
williamr@2
  1537
		
williamr@2
  1538
	};
williamr@2
  1539
williamr@2
  1540
williamr@2
  1541
williamr@2
  1542
class CMDBGenericRecord : public CMDBRecordBase
williamr@2
  1543
/**
williamr@2
  1544
Container for data and type information in a MetaDatabase record
williamr@2
  1545
For use to contain user-defined records as an alternative to declaring a 
williamr@2
  1546
specific record class of type CCDRecordBase
williamr@2
  1547
williamr@2
  1548
@publishedAll
williamr@2
  1549
@released
williamr@2
  1550
*/
williamr@2
  1551
    {
williamr@2
  1552
friend class TMDBGenericRecordVisitor;  
williamr@2
  1553
friend class CMDBSessionImpl;  
williamr@2
  1554
	public:
williamr@2
  1555
williamr@2
  1556
williamr@2
  1557
		EXP_DATA_VTABLE
williamr@2
  1558
		    
williamr@2
  1559
		explicit inline CMDBGenericRecord(TMDBElementId aElementId)
williamr@2
  1560
			: CMDBRecordBase(aElementId) {}
williamr@2
  1561
williamr@2
  1562
        IMPORT_C ~CMDBGenericRecord();
williamr@2
  1563
williamr@2
  1564
		IMPORT_C virtual CMDBElement* GetFieldByNameL(const TPtrC& aFieldName, TInt& aValType );
williamr@2
  1565
williamr@2
  1566
		IMPORT_C CMDBElement* GetFieldByIdL(TMDBElementId aId);
williamr@2
  1567
		
williamr@2
  1568
		
williamr@2
  1569
		IMPORT_C void InitializeL(const TDesC& aTableName, const SGenericRecordTypeInfo*  aNewTableInfo);
williamr@2
  1570
		
williamr@2
  1571
williamr@2
  1572
	private:
williamr@2
  1573
williamr@2
  1574
        /*
williamr@2
  1575
        The name of this record type
williamr@2
  1576
        */
williamr@2
  1577
	    TBuf<KCDMaxFieldNameLength>   	iRecordType; 
williamr@2
  1578
        
williamr@2
  1579
        /*
williamr@2
  1580
        array of type information about fields in this record
williamr@2
  1581
        order of field info should match order of fields
williamr@2
  1582
        */
williamr@2
  1583
        RArray<SGenericRecordTypeInfo>  iRecordInfo;
williamr@2
  1584
        /*
williamr@2
  1585
        array of fields in this record
williamr@2
  1586
        order of fields should match order of field info
williamr@2
  1587
        */
williamr@2
  1588
		RPointerArray<CMDBElement>      iFields;
williamr@2
  1589
	};
williamr@2
  1590
williamr@2
  1591
williamr@2
  1592
williamr@2
  1593
class CMDBRecordSetBase : public CMDBTextFieldBase
williamr@2
  1594
/**
williamr@2
  1595
Use this class to express a list of records MetaDatabase Element type
williamr@2
  1596
Records can be ordered using the standard RPointerArray functions
williamr@2
  1597
williamr@2
  1598
@publishedAll
williamr@2
  1599
@released
williamr@2
  1600
*/
williamr@2
  1601
    {
williamr@2
  1602
    public:
williamr@2
  1603
		/**
williamr@2
  1604
		@internalComponent
williamr@2
  1605
		*/
williamr@2
  1606
    	IMPORT_C CMDBRecordSetBase();
williamr@2
  1607
williamr@2
  1608
		/**
williamr@2
  1609
		@internalComponent
williamr@2
  1610
		*/
williamr@2
  1611
    	IMPORT_C CMDBRecordSetBase(TMDBElementId aElementId);
williamr@2
  1612
williamr@2
  1613
		/**
williamr@2
  1614
		@internalComponent
williamr@2
  1615
		*/
williamr@2
  1616
    	IMPORT_C ~CMDBRecordSetBase();
williamr@2
  1617
williamr@2
  1618
        inline CMDBRecordSetBase& operator=(const TPtrC& aValue)
williamr@2
  1619
        {
williamr@2
  1620
        return (CMDBRecordSetBase&)CMDBTextFieldBase::operator=(aValue);
williamr@2
  1621
        }
williamr@2
  1622
	
williamr@2
  1623
	protected:
williamr@2
  1624
williamr@2
  1625
    	EXP_DATA_VTABLE
williamr@2
  1626
williamr@2
  1627
    public:
williamr@2
  1628
       
williamr@2
  1629
    	RPointerArray<CMDBRecordBase> iRecords;
williamr@2
  1630
williamr@2
  1631
    };
williamr@2
  1632
williamr@2
  1633
williamr@2
  1634
williamr@2
  1635
template <class TYPE>
williamr@2
  1636
class CMDBRecordSet : public CMDBRecordSetBase
williamr@2
  1637
/**
williamr@2
  1638
Use this class to express a list of records of a particular MetaDatabase Element type
williamr@2
  1639
Records can be ordered using the standard RPointerArray functions
williamr@2
  1640
williamr@2
  1641
@publishedAll
williamr@2
  1642
*/
williamr@2
  1643
{
williamr@2
  1644
public:
williamr@2
  1645
williamr@2
  1646
	inline CMDBRecordSet(){}
williamr@2
  1647
williamr@2
  1648
	inline CMDBRecordSet(TMDBElementId aElementId)
williamr@2
  1649
		: CMDBRecordSetBase(aElementId) {}
williamr@2
  1650
		
williamr@2
  1651
	inline CMDBRecordSet<TYPE>& operator=(const TPtrC& aValue)
williamr@2
  1652
	{
williamr@2
  1653
		return (CMDBRecordSet<TYPE>&)CMDBRecordSetBase::operator=(aValue);
williamr@2
  1654
	}
williamr@2
  1655
    		
williamr@2
  1656
	inline TYPE* operator [](const TInt i)
williamr@2
  1657
	{
williamr@2
  1658
		return (TYPE*)iRecords[i];
williamr@2
  1659
	}
williamr@2
  1660
williamr@2
  1661
private:
williamr@2
  1662
williamr@2
  1663
};
williamr@2
  1664
williamr@2
  1665
williamr@2
  1666
williamr@2
  1667
williamr@2
  1668
} //end namespace CommsDat
williamr@2
  1669
williamr@2
  1670
#endif  // METADATABASE_H