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