2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipparameterheaderbase.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPPARAMETERHEADERBASE_H
26 #define CSIPPARAMETERHEADERBASE_H
29 #include "sipheaderbase.h"
30 #include "_sipcodecdefs.h"
32 // FORWARD DECLARATIONS
33 class CSIPParamContainerBase;
40 * A base class for SIP headers that have structure
41 * "mandatory part"delimiter"parameters"
43 * This is an abstract class and cannot be instantiated.
47 class CSIPParameterHeaderBase : public CSIPHeaderBase
49 public: // Constructors and destructor
52 * Destructor, deletes the resources of CSIPParameterHeaderBase.
54 IMPORT_C virtual ~CSIPParameterHeaderBase();
57 public: // New functions
60 * Checks if a parameter is present
61 * @param aName the name of the parameter
62 * @return ETrue if present, otherwise EFalse
64 IMPORT_C TBool HasParam(RStringF aName) const;
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.
73 IMPORT_C RStringF ParamValue(RStringF aName) const;
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
84 IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
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
94 IMPORT_C void SetParamL(RStringF aName);
98 * @param aName the parameter name to delete
100 IMPORT_C void DeleteParam(RStringF aName);
103 * Gets the count of header parameters
104 * @return count of header parameters
106 IMPORT_C TInt ParamCount() const;
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.
117 IMPORT_C TInt Param(TInt aIndex, RStringF& aName) const;
119 public: // From CSIPHeaderBase
122 * From CSIPHeaderBase ToTextValueL
124 IMPORT_C HBufC8* ToTextValueL() const;
127 protected: // Contructors
129 CSIPParameterHeaderBase(const TChar& aSeparator);
131 protected: // New functions
133 void ParseL(const TDesC8& aValue,
134 TBool aIgnoreParenthesis=ETrue,
135 TBool aSkipSeparatorsBeforeAt=EFalse);
137 protected: // Virtual functions
142 virtual TBool ParamInsertionAllowed() const;
144 protected: // Pure virtual functions
149 virtual HBufC8* ToTextMandatoryPartLC() const = 0;
154 virtual void ParseMandatoryPartL(const TDesC8& aMandatoryPart) = 0;
159 virtual const CSIPParamContainerBase& Params() const = 0;
164 virtual CSIPParamContainerBase& Params() = 0;
166 private: // Contructors
168 CSIPParameterHeaderBase();
174 private: // For testing purposes
176 UNIT_TEST(CSIPParameterHeaderBaseTest)
179 #endif // CSIPPARAMETERHEADERBASE_H