epoc32/include/cdbtemp.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/cdbtemp.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/cdbtemp.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,103 @@
     1.4 -cdbtemp.h
     1.5 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// CommDb Template Record View
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file
    1.26 + @deprecated since v9.1. Functionality is replaced with commsdat.
    1.27 +*/
    1.28 +
    1.29 +#ifndef CDBTEMP_H
    1.30 +#define CDBTEMP_H
    1.31 +
    1.32 +#include <d32dbms.h>
    1.33 +
    1.34 +class CCommsDatabaseBase;
    1.35 +class CCommsDbTableView;
    1.36 +
    1.37 +// Template view class. Uses a supplied `CCommsDatabase` and a
    1.38 +// `CCommsDbTableView` to read and write template records. Created from
    1.39 +// `CCommsDbTableView::ConstructL()` the recursion	is stopped because the
    1.40 +//	template view NewL is called with aUseTemplate set to false.
    1.41 +//	internal "This class is poorly named it should be something like:
    1.42 +//	CCommDbTemplateView"
    1.43 +class CCommsDbTemplateRecord : public CBase
    1.44 +/** The view on a template record of a specific table. 
    1.45 +
    1.46 +The view contains only the template record and therefore, unlike the more 
    1.47 +general CCommsDbTableView class, does not contain any navigation functions.
    1.48 +
    1.49 +This class does, however, contain the necessary member functions for reading 
    1.50 +and writing to columns.
    1.51 +@publishedAll
    1.52 +@released */
    1.53 +	{
    1.54 +public:
    1.55 +	/** Creates a new template view on the database and table specified. */
    1.56 +	IMPORT_C static CCommsDbTemplateRecord* NewL(CCommsDatabaseBase* aDb,const TDesC& aTableName);
    1.57 +	IMPORT_C ~CCommsDbTemplateRecord();
    1.58 +
    1.59 +	/** Modifies the existing template record if there is no template create one.
    1.60 +		StoreModifications() is called to complete the transaction. */
    1.61 +	IMPORT_C TInt Modify();
    1.62 +	/** Removes the template from the table. */
    1.63 +	IMPORT_C TInt Delete();
    1.64 +	/** Stores an new or updated template back to the database. */
    1.65 +	IMPORT_C TInt StoreModifications();
    1.66 +	/** Cancels pending changes since `Modify()`. */
    1.67 +	IMPORT_C void CancelModifications();
    1.68 +
    1.69 +	// Access data from the template 
    1.70 +	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue);
    1.71 +	IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue);
    1.72 +	IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn);
    1.73 +	IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue);
    1.74 +	IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue);
    1.75 +	IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib);
    1.76 +	IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength);
    1.77 +
    1.78 +	// Modify a new or modified template. Must call `StoreModifications()`
    1.79 +	// to store the changes. 
    1.80 +	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue);
    1.81 +	IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue);
    1.82 +	IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue);
    1.83 +	IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue);
    1.84 +	IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue);
    1.85 +
    1.86 +	/** The name of the table that this template belongs to. */
    1.87 +	IMPORT_C void GetTableName(TDes& aTableName) const;
    1.88 +
    1.89 +	/** True if a template exists. */
    1.90 +	IMPORT_C TBool TemplateRecordExists();
    1.91 +	
    1.92 +	// Create a new record based on the contents of the template record 
    1.93 +	IMPORT_C TInt InsertCopy(TUint32& aId);
    1.94 +private:
    1.95 +	CCommsDbTemplateRecord();
    1.96 +	void ConstructL(CCommsDatabaseBase* aDb, const TDesC& aTableName);
    1.97 +	TInt Reposition();
    1.98 +
    1.99 +    // Enabling and Desabling client view on template record
   1.100 +    TBool SetHiddenMask();
   1.101 +    void ClearHiddenMask(TBool aClearHiddenMask);
   1.102 +private:
   1.103 +	CCommsDbTableView* iView;
   1.104 +	TBool iRecordExists;
   1.105 +	};
   1.106 +
   1.107 +#endif