epoc32/include/mw/sipparameterheaderbase.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/sipparameterheaderbase.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,181 @@
     1.4 +/*
     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 +* Name        : sipparameterheaderbase.h
    1.19 +* Part of     : SIP Codec
    1.20 +* Interface   : SDK API, SIP Codec API
    1.21 +* Version     : SIP/4.0
    1.22 +*
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +#ifndef CSIPPARAMETERHEADERBASE_H
    1.29 +#define CSIPPARAMETERHEADERBASE_H
    1.30 +
    1.31 +//  INCLUDES
    1.32 +#include "sipheaderbase.h"
    1.33 +#include "_sipcodecdefs.h"
    1.34 +
    1.35 +// FORWARD DECLARATIONS
    1.36 +class CSIPParamContainerBase;
    1.37 +
    1.38 +// CLASS DECLARATION
    1.39 +/**
    1.40 +* @publishedAll
    1.41 +* @released
    1.42 +*
    1.43 +* A base class for SIP headers that have structure
    1.44 +*        "mandatory part"delimiter"parameters"
    1.45 +*
    1.46 +* This is an abstract class and cannot be instantiated.
    1.47 +*
    1.48 +*  @lib sipcodec.lib
    1.49 +*/
    1.50 +class CSIPParameterHeaderBase : public CSIPHeaderBase
    1.51 +    {
    1.52 +    public:    // Constructors and destructor
    1.53 +
    1.54 +        /**
    1.55 +        * Destructor, deletes the resources of CSIPParameterHeaderBase.
    1.56 +        */
    1.57 +        IMPORT_C virtual ~CSIPParameterHeaderBase();
    1.58 +
    1.59 +
    1.60 +    public: // New functions
    1.61 +
    1.62 +        /**
    1.63 +        * Checks if a parameter is present
    1.64 +        * @param aName the name of the parameter
    1.65 +        * @return ETrue if present, otherwise EFalse
    1.66 +        */
    1.67 +        IMPORT_C TBool HasParam(RStringF aName) const;
    1.68 +
    1.69 +        /**
    1.70 +        * Gets a parameter value
    1.71 +        * @pre HasParam(aName) == ETrue
    1.72 +        * @param aName the name of the parameter
    1.73 +        * @return the parameter value if present,
    1.74 +        *         otherwise a zero-length length value.
    1.75 +        */
    1.76 +        IMPORT_C RStringF ParamValue(RStringF aName) const;
    1.77 +
    1.78 +        /**
    1.79 +        * Sets a parameter with a value. 
    1.80 +        * Takes copies of the name and value,
    1.81 +        * so if the RStringFs have been dynamically allocated,
    1.82 +        * they can be closed if necessary after the function returns.
    1.83 +        * @pre HasParam(aName) == EFalse
    1.84 +        * @param aName the name of the parameter
    1.85 +        * @param aValue the parameter value to set
    1.86 +        */
    1.87 +        IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
    1.88 +
    1.89 +        /**
    1.90 +        * Sets a parameter without a value
    1.91 +        * Takes copy of the name,
    1.92 +        * so if the RStringF has been dynamically allocated,
    1.93 +        * it can be closed if necessary after the function returns.
    1.94 +        * @pre HasParam(aName) == EFalse
    1.95 +        * @param aName the parameter name to set
    1.96 +        */
    1.97 +        IMPORT_C void SetParamL(RStringF aName);
    1.98 +
    1.99 +        /**
   1.100 +        * Deletes a parameter
   1.101 +        * @param aName the parameter name to delete
   1.102 +        */
   1.103 +        IMPORT_C void DeleteParam(RStringF aName);
   1.104 +
   1.105 +        /**
   1.106 +        * Gets the count of header parameters
   1.107 +        * @return count of header parameters
   1.108 +        */
   1.109 +        IMPORT_C TInt ParamCount() const;
   1.110 +
   1.111 +        /**
   1.112 +        * Gets a header parameter name by index.
   1.113 +        * This function can be used when looping through
   1.114 +        * all the header parameters.
   1.115 +        * @param aIndex the index of the parameter
   1.116 +        * @param aName copy of the parameter name that must be 
   1.117 +        *        closed by the caller.       
   1.118 +        * @return KErrNotFound if aIndex is invalid. Otherwise EFalse.
   1.119 +        */
   1.120 +        IMPORT_C TInt Param(TInt aIndex, RStringF& aName) const;
   1.121 +
   1.122 +    public: // From CSIPHeaderBase
   1.123 +
   1.124 +        /**
   1.125 +        * From CSIPHeaderBase ToTextValueL
   1.126 +        */
   1.127 +        IMPORT_C HBufC8* ToTextValueL() const;
   1.128 +
   1.129 +
   1.130 +    protected: // Contructors
   1.131 +
   1.132 +        CSIPParameterHeaderBase(const TChar& aSeparator);        
   1.133 +
   1.134 +    protected: // New functions
   1.135 +
   1.136 +        void ParseL(const TDesC8& aValue, 
   1.137 +        				  TBool aIgnoreParenthesis=ETrue, 
   1.138 +        				  TBool aSkipSeparatorsBeforeAt=EFalse);
   1.139 +
   1.140 +    protected: // Virtual functions
   1.141 +
   1.142 +        /**
   1.143 +        * @internalComponent
   1.144 +        */    
   1.145 +        virtual TBool ParamInsertionAllowed() const;
   1.146 +
   1.147 +    protected: // Pure virtual functions
   1.148 +
   1.149 +        /**
   1.150 +        * @internalComponent
   1.151 +        */
   1.152 +        virtual HBufC8* ToTextMandatoryPartLC() const = 0;
   1.153 +        
   1.154 +        /**
   1.155 +        * @internalComponent
   1.156 +        */        
   1.157 +        virtual void ParseMandatoryPartL(const TDesC8& aMandatoryPart) = 0;
   1.158 +        
   1.159 +        /**
   1.160 +        * @internalComponent
   1.161 +        */        
   1.162 +        virtual const CSIPParamContainerBase& Params() const = 0;
   1.163 +        
   1.164 +        /**
   1.165 +        * @internalComponent
   1.166 +        */        
   1.167 +        virtual CSIPParamContainerBase& Params() = 0;
   1.168 +
   1.169 +    private: // Contructors
   1.170 +
   1.171 +        CSIPParameterHeaderBase();
   1.172 +
   1.173 +    private: // Data
   1.174 +    
   1.175 +        TChar iSeparator;
   1.176 +
   1.177 +    private: // For testing purposes
   1.178 +    
   1.179 +        UNIT_TEST(CSIPParameterHeaderBaseTest)
   1.180 +    };
   1.181 +
   1.182 +#endif // CSIPPARAMETERHEADERBASE_H
   1.183 +
   1.184 +// End of File