epoc32/include/cdbtemp.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2006-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
// CommDb Template Record View
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
 @deprecated since v9.1. Functionality is replaced with commsdat.
williamr@2
    23
*/
williamr@2
    24
williamr@2
    25
#ifndef CDBTEMP_H
williamr@2
    26
#define CDBTEMP_H
williamr@2
    27
williamr@2
    28
#include <d32dbms.h>
williamr@2
    29
williamr@2
    30
class CCommsDatabaseBase;
williamr@2
    31
class CCommsDbTableView;
williamr@2
    32
williamr@2
    33
// Template view class. Uses a supplied `CCommsDatabase` and a
williamr@2
    34
// `CCommsDbTableView` to read and write template records. Created from
williamr@2
    35
// `CCommsDbTableView::ConstructL()` the recursion	is stopped because the
williamr@2
    36
//	template view NewL is called with aUseTemplate set to false.
williamr@2
    37
//	internal "This class is poorly named it should be something like:
williamr@2
    38
//	CCommDbTemplateView"
williamr@2
    39
class CCommsDbTemplateRecord : public CBase
williamr@2
    40
/** The view on a template record of a specific table. 
williamr@2
    41
williamr@2
    42
The view contains only the template record and therefore, unlike the more 
williamr@2
    43
general CCommsDbTableView class, does not contain any navigation functions.
williamr@2
    44
williamr@2
    45
This class does, however, contain the necessary member functions for reading 
williamr@2
    46
and writing to columns.
williamr@2
    47
@publishedAll
williamr@2
    48
@released */
williamr@2
    49
	{
williamr@2
    50
public:
williamr@2
    51
	/** Creates a new template view on the database and table specified. */
williamr@2
    52
	IMPORT_C static CCommsDbTemplateRecord* NewL(CCommsDatabaseBase* aDb,const TDesC& aTableName);
williamr@2
    53
	IMPORT_C ~CCommsDbTemplateRecord();
williamr@2
    54
williamr@2
    55
	/** Modifies the existing template record if there is no template create one.
williamr@2
    56
		StoreModifications() is called to complete the transaction. */
williamr@2
    57
	IMPORT_C TInt Modify();
williamr@2
    58
	/** Removes the template from the table. */
williamr@2
    59
	IMPORT_C TInt Delete();
williamr@2
    60
	/** Stores an new or updated template back to the database. */
williamr@2
    61
	IMPORT_C TInt StoreModifications();
williamr@2
    62
	/** Cancels pending changes since `Modify()`. */
williamr@2
    63
	IMPORT_C void CancelModifications();
williamr@2
    64
williamr@2
    65
	// Access data from the template 
williamr@2
    66
	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue);
williamr@2
    67
	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue);
williamr@2
    68
	IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn);
williamr@2
    69
	IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue);
williamr@2
    70
	IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue);
williamr@2
    71
	IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib);
williamr@2
    72
	IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength);
williamr@2
    73
williamr@2
    74
	// Modify a new or modified template. Must call `StoreModifications()`
williamr@2
    75
	// to store the changes. 
williamr@2
    76
	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue);
williamr@2
    77
	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue);
williamr@2
    78
	IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue);
williamr@2
    79
	IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue);
williamr@2
    80
	IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue);
williamr@2
    81
williamr@2
    82
	/** The name of the table that this template belongs to. */
williamr@2
    83
	IMPORT_C void GetTableName(TDes& aTableName) const;
williamr@2
    84
williamr@2
    85
	/** True if a template exists. */
williamr@2
    86
	IMPORT_C TBool TemplateRecordExists();
williamr@2
    87
	
williamr@2
    88
	// Create a new record based on the contents of the template record 
williamr@2
    89
	IMPORT_C TInt InsertCopy(TUint32& aId);
williamr@2
    90
private:
williamr@2
    91
	CCommsDbTemplateRecord();
williamr@2
    92
	void ConstructL(CCommsDatabaseBase* aDb, const TDesC& aTableName);
williamr@2
    93
	TInt Reposition();
williamr@2
    94
williamr@2
    95
    // Enabling and Desabling client view on template record
williamr@2
    96
    TBool SetHiddenMask();
williamr@2
    97
    void ClearHiddenMask(TBool aClearHiddenMask);
williamr@2
    98
private:
williamr@2
    99
	CCommsDbTableView* iView;
williamr@2
   100
	TBool iRecordExists;
williamr@2
   101
	};
williamr@2
   102
williamr@2
   103
#endif