williamr@2: /* williamr@2: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Name : sipheaderbase.h williamr@2: * Part of : SIP Codec williamr@2: * Interface : SDK API, SIP Codec API williamr@2: * Version : SIP/4.0 williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CSIPHEADERBASE_H williamr@2: #define CSIPHEADERBASE_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * @publishedAll williamr@2: * @released williamr@2: * williamr@2: * Class provides a generic interface for all the SIP headers. williamr@2: * williamr@2: * @lib sipcodec.lib williamr@2: */ williamr@2: class CSIPHeaderBase : public CBase williamr@2: { williamr@2: public: // Constructors and destructors williamr@2: williamr@2: /** williamr@2: * Destructor, deletes the resources of CSIPHeaderBase. williamr@2: */ williamr@2: IMPORT_C virtual ~CSIPHeaderBase(); williamr@2: williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Creates a deep-copy of this CSIPHeaderBase object. williamr@2: * The function has to be implemented in each of the sub-classes. williamr@2: * @return the deep-copied object, the ownership is transferred. williamr@2: */ williamr@2: IMPORT_C virtual CSIPHeaderBase* CloneL() const = 0; williamr@2: williamr@2: /** williamr@2: * Gets the full name of the header williamr@2: * The function is implemented in each of the sub-classes. williamr@2: * @return the full name of the header for example "From" williamr@2: */ williamr@2: IMPORT_C virtual RStringF Name() const = 0; williamr@2: williamr@2: /** williamr@2: * Encodes the header (name and value) into its textual representation. williamr@2: * @return a textual representation of the complete header, williamr@2: * the ownership is transferred williamr@2: */ williamr@2: IMPORT_C HBufC8* ToTextL() const; williamr@2: williamr@2: /** williamr@2: * Encodes the header (name and value) into its textual representation williamr@2: * and pushes it to the CleanupStack. williamr@2: * @return a textual representation of the complete header, williamr@2: * the ownership is transferred williamr@2: */ williamr@2: IMPORT_C HBufC8* ToTextLC() const; williamr@2: williamr@2: /** williamr@2: * Encodes the header's value into its textual representation. williamr@2: * @return a textual representation of the header's value, williamr@2: * the ownership is transferred williamr@2: */ williamr@2: IMPORT_C virtual HBufC8* ToTextValueL() const = 0; williamr@2: williamr@2: /** williamr@2: * Encodes the header's value into its textual representation williamr@2: * and pushes it to the CleanupStack. williamr@2: * @return a textual representation of the header's value, williamr@2: * the ownership is transferred williamr@2: */ williamr@2: IMPORT_C HBufC8* ToTextValueLC() const; williamr@2: williamr@2: /** williamr@2: * Writes the object to a RWriteStream williamr@2: * @param aWriteStream a stream where the object is to be externalized williamr@2: * @param aAddName if ETrue the name of the header is williamr@2: * also written to the stream williamr@2: */ williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aWriteStream, williamr@2: TBool aAddName=ETrue) const; williamr@2: williamr@2: /** williamr@2: * Checks, if the header supports serialization. williamr@2: * In practice all the headers part of the API support it. williamr@2: * @return ETrue, if the header supports serialization, williamr@2: * otherwise EFalse williamr@2: */ williamr@2: IMPORT_C virtual TBool ExternalizeSupported() const; williamr@2: williamr@2: /** williamr@2: * Can be used when a RPointerArray needs to be pushed williamr@2: * to the CleanupStack for ResetAndDestroy. williamr@2: * @param aArray an array of CSIPHeaderBase pointers, williamr@2: * the ownership of the array is transferred williamr@2: */ williamr@2: IMPORT_C static void PushLC(RPointerArray* aArray); williamr@2: williamr@2: williamr@2: public: // For internal use williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: enum TPreferredPlace williamr@2: { williamr@2: ETop, williamr@2: EMiddleTop, williamr@2: EMiddle, williamr@2: EMiddleBottom, williamr@2: EBottom williamr@2: }; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: TSglQueLink iLink; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual TBool EncodeMultipleToOneLine() const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual TBool MoreThanOneAllowed() const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual TBool IsExtensionHeader() const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual TBool HasCompactName() const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual RStringF CompactName() const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual TPreferredPlace PreferredPlaceInMessage() const = 0; williamr@2: williamr@2: protected: // Constructors williamr@2: williamr@2: CSIPHeaderBase(); williamr@2: williamr@2: protected: // New functions williamr@2: williamr@2: void ExternalizeNameL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual void ExternalizeValueL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: // Needed for cleanup of a RPointerArray: williamr@2: static void ResetAndDestroy(TAny* anArray); williamr@2: }; williamr@2: williamr@2: #endif // CSIPHEADERBASE_H williamr@2: williamr@2: // End of File