epoc32/include/fldbase.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
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __FLDBASE_H__
    17 #define __FLDBASE_H__
    18 
    19 #include <e32std.h>
    20 #include <e32base.h>
    21 #include <s32stor.h>
    22 
    23 // Classes defined:
    24 class CTextField;
    25 class MTextFieldFactory;
    26 
    27 
    28 
    29 
    30 class CTextField : public CBase
    31 /** 
    32 Abstract class: derive from this to instantiate a particular type of field (eg date etc)
    33 Abstract base class for all field types.
    34 
    35 A field contains information which relates to a text object and can be automatically 
    36 updated, e.g. page number or current date and time. Fields must implement 
    37 the pure virtual functions defined in this class, including Value() which 
    38 should calculate and return the field's new value, and Type() which returns 
    39 the field's type UID. The type UID identifies the field type to the field 
    40 factory (see class MTextFieldFactory). 
    41 @publishedAll
    42 @released
    43 */
    44 	{
    45 public:
    46 	IMPORT_C virtual TStreamId StoreL(CStreamStore& aStore)const; // calls ExternalizeL()
    47 	IMPORT_C virtual void RestoreL(const CStreamStore& aStore,TStreamId aId); // calls InternalizeL()
    48 	//
    49 	// Should be replaced by concrete derived classes.
    50 	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream)const; // Externalize state info for the field
    51     /** Internalises the field data. Called by RestoreL().
    52 	
    53 	@param aStream Stream from which the field data should be internalised. */
    54 	virtual void InternalizeL(RReadStream& aStream)=0;
    55 	//
    56 	/** Sets aValueText to the current field value if the buffer is large enough. If 
    57 	not, aValueText is not changed, and the function returns the length which 
    58 	is required to hold the field's value.
    59 	
    60 	@param aValueText Descriptor which on return contains the field's updated 
    61 	value. 
    62 	@return Zero on success, otherwise, the length of the buffer which is required 
    63 	to hold the field's updated value. */
    64 	virtual TInt Value(TPtr& aValueText)=0; 
    65 	//	
    66 	/** Returns the field's type UID.
    67 	
    68 	@return The field's type UID. */
    69 	virtual TUid Type()const=0;
    70 	};
    71 
    72 
    73  
    74 
    75 class MTextFieldFactory
    76 /** 
    77 Abstract class that should be derived from by any application that wishes to support fields
    78 Abstract base class for field factories.
    79 
    80 To use fields in editable text,
    81 
    82 1) Define a field factory class (derived from MTextFieldFactory) that implements 
    83 NewFieldL().
    84 
    85 2) Create an instance of the field factory and set this to be the editable 
    86 text object's field factory (see CPlainText::SetFieldFactory(), or you can 
    87 specify a field factory in the text object 's NewL()).
    88 
    89 3) Create a new field (CPlainText::NewTextFieldL()), specifying the field 
    90 type UID (the built in field type UID values are defined in flddef.h). This 
    91 calls the factory's NewFieldL() function.
    92 
    93 4) Insert the field into the text object (CPlainText::InsertFieldL()).
    94 
    95 5) Evaluate the field (CPlainText::UpdateFieldL()) and then re-evaluate when 
    96 required. 
    97 @publishedAll
    98 @released
    99 */
   100 	{
   101 public:
   102 	
   103 	/** Implementations of this function should create a field of the type specified, 
   104 	returning NULL if the field type is not recognised or supported.
   105 	
   106 	@param aFieldType The field's type UID. 
   107 	@return Pointer to the new text field, or NULL if the factory does not recognise 
   108 	or support the field type. */
   109 	virtual CTextField* NewFieldL(TUid aFieldType)=0; 
   110 	// Creates a field of the type specified
   111 	// Returns NULL if it does not recognise/support the field type
   112 	};
   113 
   114 
   115 #endif