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