epoc32/include/sipparameterheaderbase.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * 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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Name        : sipparameterheaderbase.h
    16 * Part of     : SIP Codec
    17 * Interface   : SDK API, SIP Codec API
    18 * Version     : SIP/4.0
    19 *
    20 */
    21 
    22 
    23 
    24 
    25 #ifndef CSIPPARAMETERHEADERBASE_H
    26 #define CSIPPARAMETERHEADERBASE_H
    27 
    28 //  INCLUDES
    29 #include "sipheaderbase.h"
    30 #include "_sipcodecdefs.h"
    31 
    32 // FORWARD DECLARATIONS
    33 class CSIPParamContainerBase;
    34 
    35 // CLASS DECLARATION
    36 /**
    37 * @publishedAll
    38 * @released
    39 *
    40 * A base class for SIP headers that have structure
    41 *        "mandatory part"delimiter"parameters"
    42 *
    43 * This is an abstract class and cannot be instantiated.
    44 *
    45 *  @lib sipcodec.lib
    46 */
    47 class CSIPParameterHeaderBase : public CSIPHeaderBase
    48     {
    49     public:    // Constructors and destructor
    50 
    51         /**
    52         * Destructor, deletes the resources of CSIPParameterHeaderBase.
    53         */
    54         IMPORT_C virtual ~CSIPParameterHeaderBase();
    55 
    56 
    57     public: // New functions
    58 
    59         /**
    60         * Checks if a parameter is present
    61         * @param aName the name of the parameter
    62         * @return ETrue if present, otherwise EFalse
    63         */
    64         IMPORT_C TBool HasParam(RStringF aName) const;
    65 
    66         /**
    67         * Gets a parameter value
    68         * @pre HasParam(aName) == ETrue
    69         * @param aName the name of the parameter
    70         * @return the parameter value if present,
    71         *         otherwise a zero-length length value.
    72         */
    73         IMPORT_C RStringF ParamValue(RStringF aName) const;
    74 
    75         /**
    76         * Sets a parameter with a value. 
    77         * Takes copies of the name and value,
    78         * so if the RStringFs have been dynamically allocated,
    79         * they can be closed if necessary after the function returns.
    80         * @pre HasParam(aName) == EFalse
    81         * @param aName the name of the parameter
    82         * @param aValue the parameter value to set
    83         */
    84         IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
    85 
    86         /**
    87         * Sets a parameter without a value
    88         * Takes copy of the name,
    89         * so if the RStringF has been dynamically allocated,
    90         * it can be closed if necessary after the function returns.
    91         * @pre HasParam(aName) == EFalse
    92         * @param aName the parameter name to set
    93         */
    94         IMPORT_C void SetParamL(RStringF aName);
    95 
    96         /**
    97         * Deletes a parameter
    98         * @param aName the parameter name to delete
    99         */
   100         IMPORT_C void DeleteParam(RStringF aName);
   101 
   102         /**
   103         * Gets the count of header parameters
   104         * @return count of header parameters
   105         */
   106         IMPORT_C TInt ParamCount() const;
   107 
   108         /**
   109         * Gets a header parameter name by index.
   110         * This function can be used when looping through
   111         * all the header parameters.
   112         * @param aIndex the index of the parameter
   113         * @param aName copy of the parameter name that must be 
   114         *        closed by the caller.       
   115         * @return KErrNotFound if aIndex is invalid. Otherwise EFalse.
   116         */
   117         IMPORT_C TInt Param(TInt aIndex, RStringF& aName) const;
   118 
   119     public: // From CSIPHeaderBase
   120 
   121         /**
   122         * From CSIPHeaderBase ToTextValueL
   123         */
   124         IMPORT_C HBufC8* ToTextValueL() const;
   125 
   126 
   127     protected: // Contructors
   128 
   129         CSIPParameterHeaderBase(const TChar& aSeparator);        
   130 
   131     protected: // New functions
   132 
   133         void ParseL(const TDesC8& aValue, 
   134         				  TBool aIgnoreParenthesis=ETrue, 
   135         				  TBool aSkipSeparatorsBeforeAt=EFalse);
   136 
   137     protected: // Virtual functions
   138 
   139         /**
   140         * @internalComponent
   141         */    
   142         virtual TBool ParamInsertionAllowed() const;
   143 
   144     protected: // Pure virtual functions
   145 
   146         /**
   147         * @internalComponent
   148         */
   149         virtual HBufC8* ToTextMandatoryPartLC() const = 0;
   150         
   151         /**
   152         * @internalComponent
   153         */        
   154         virtual void ParseMandatoryPartL(const TDesC8& aMandatoryPart) = 0;
   155         
   156         /**
   157         * @internalComponent
   158         */        
   159         virtual const CSIPParamContainerBase& Params() const = 0;
   160         
   161         /**
   162         * @internalComponent
   163         */        
   164         virtual CSIPParamContainerBase& Params() = 0;
   165 
   166     private: // Contructors
   167 
   168         CSIPParameterHeaderBase();
   169 
   170     private: // Data
   171     
   172         TChar iSeparator;
   173 
   174     private: // For testing purposes
   175     
   176         UNIT_TEST(CSIPParameterHeaderBaseTest)
   177     };
   178 
   179 #endif // CSIPPARAMETERHEADERBASE_H
   180 
   181 // End of File