epoc32/include/mw/sipparameterheaderbase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.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 
    31 // FORWARD DECLARATIONS
    32 class CSIPParamContainerBase;
    33 
    34 // CLASS DECLARATION
    35 /**
    36 * @publishedAll
    37 * @released
    38 *
    39 * A base class for SIP headers that have structure
    40 *        "mandatory part"delimiter"parameters"
    41 *
    42 * This is an abstract class and cannot be instantiated.
    43 *
    44 *  @lib sipcodec.lib
    45 */
    46 class CSIPParameterHeaderBase : public CSIPHeaderBase
    47     {
    48     public:    // Constructors and destructor
    49 
    50         /**
    51         * Destructor, deletes the resources of CSIPParameterHeaderBase.
    52         */
    53         IMPORT_C virtual ~CSIPParameterHeaderBase();
    54 
    55 
    56     public: // New functions
    57 
    58         /**
    59         * Checks if a parameter is present
    60         * @param aName the name of the parameter
    61         * @return ETrue if present, otherwise EFalse
    62         */
    63         IMPORT_C TBool HasParam(RStringF aName) const;
    64 
    65         /**
    66         * Gets a parameter value
    67         * @pre HasParam(aName) == ETrue
    68         * @param aName the name of the parameter
    69         * @return the parameter value if present,
    70         *         otherwise a zero-length length value.
    71         */
    72         IMPORT_C RStringF ParamValue(RStringF aName) const;
    73 
    74         /**
    75         * Sets a parameter with a value. 
    76         * Takes copies of the name and value,
    77         * so if the RStringFs have been dynamically allocated,
    78         * they can be closed if necessary after the function returns.
    79         * @pre HasParam(aName) == EFalse
    80         * @param aName the name of the parameter
    81         * @param aValue the parameter value to set
    82         */
    83         IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
    84 
    85         /**
    86         * Sets a parameter without a value
    87         * Takes copy of the name,
    88         * so if the RStringF has been dynamically allocated,
    89         * it can be closed if necessary after the function returns.
    90         * @pre HasParam(aName) == EFalse
    91         * @param aName the parameter name to set
    92         */
    93         IMPORT_C void SetParamL(RStringF aName);
    94 
    95         /**
    96         * Deletes a parameter
    97         * @param aName the parameter name to delete
    98         */
    99         IMPORT_C void DeleteParam(RStringF aName);
   100 
   101         /**
   102         * Gets the count of header parameters
   103         * @return count of header parameters
   104         */
   105         IMPORT_C TInt ParamCount() const;
   106 
   107         /**
   108         * Gets a header parameter name by index.
   109         * This function can be used when looping through
   110         * all the header parameters.
   111         * @param aIndex the index of the parameter
   112         * @param aName copy of the parameter name that must be 
   113         *        closed by the caller.       
   114         * @return KErrNotFound if aIndex is invalid. Otherwise EFalse.
   115         */
   116         IMPORT_C TInt Param(TInt aIndex, RStringF& aName) const;
   117 
   118     public: // From CSIPHeaderBase
   119 
   120         /**
   121         * From CSIPHeaderBase ToTextValueL
   122         */
   123         IMPORT_C HBufC8* ToTextValueL() const;
   124 
   125 
   126     protected: // Contructors
   127 
   128         CSIPParameterHeaderBase(const TChar& aSeparator);        
   129 
   130     protected: // New functions
   131 
   132         void ParseL(const TDesC8& aValue, 
   133         				  TBool aIgnoreParenthesis=ETrue, 
   134         				  TBool aSkipSeparatorsBeforeAt=EFalse);
   135 
   136     protected: // Virtual functions
   137 
   138         /**
   139         * @internalComponent
   140         */    
   141         virtual TBool ParamInsertionAllowed() const;
   142 
   143     protected: // Pure virtual functions
   144 
   145         /**
   146         * @internalComponent
   147         */
   148         virtual HBufC8* ToTextMandatoryPartLC() const = 0;
   149         
   150         /**
   151         * @internalComponent
   152         */        
   153         virtual void ParseMandatoryPartL(const TDesC8& aMandatoryPart) = 0;
   154         
   155         /**
   156         * @internalComponent
   157         */        
   158         virtual const CSIPParamContainerBase& Params() const = 0;
   159         
   160         /**
   161         * @internalComponent
   162         */        
   163         virtual CSIPParamContainerBase& Params() = 0;
   164 
   165     private: // Contructors
   166 
   167         CSIPParameterHeaderBase();
   168 
   169     private: // Data
   170     
   171         TChar iSeparator;
   172 
   173     private: // For testing purposes
   174 #ifdef CPPUNIT_TEST 
   175         friend class CSIPParameterHeaderBaseTest;
   176 #endif
   177     };
   178 
   179 #endif // CSIPPARAMETERHEADERBASE_H
   180 
   181 // End of File