realtimenetprots/sipfw/SIP/Codec/src/TSIPHeaderLookupEntry.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : TSIPHeaderLookupEntry.cpp
       
    15 // Part of       : SIP Codec
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include "TSIPHeaderLookupEntry.h"
       
    23 #include "sipstrconsts.h"
       
    24 #include "sipstrings.h"
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TSIPHeaderLookupEntry::TSIPHeaderLookupEntry 
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 TSIPHeaderLookupEntry::TSIPHeaderLookupEntry 
       
    31 (RStringF aName,
       
    32  RPointerArray<CSIPHeaderBase>(*aDecode)(const TDesC8&),
       
    33  CSIPHeaderBase*(*aInternalize)(RReadStream&))
       
    34 
       
    35  : iName(aName.Copy()),
       
    36    iCompactName(SIPStrings::StringF(SipStrConsts::EEmpty)),
       
    37    iDecodeFunction (aDecode),
       
    38    iInternalizeFunction(aInternalize)
       
    39 	{
       
    40 	}
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // TSIPHeaderLookupEntry::TSIPHeaderLookupEntry 
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TSIPHeaderLookupEntry::TSIPHeaderLookupEntry 
       
    47 (RStringF aName,
       
    48  RStringF aCompactName,
       
    49  RPointerArray<CSIPHeaderBase>(*aDecode)(const TDesC8&),
       
    50  CSIPHeaderBase*(*aInternalize)(RReadStream&))
       
    51 
       
    52  : iName(aName.Copy()),
       
    53    iCompactName(aCompactName.Copy()),
       
    54    iDecodeFunction (aDecode),
       
    55    iInternalizeFunction(aInternalize)
       
    56 	{
       
    57 	}
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // TSIPHeaderLookupEntry::Name
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 RStringF TSIPHeaderLookupEntry::Name() const
       
    64 	{
       
    65 	return iName;
       
    66 	}
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // TSIPHeaderLookupEntry::CompactName
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 RStringF TSIPHeaderLookupEntry::CompactName() const
       
    73 	{
       
    74 	return iCompactName;
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // TSIPHeaderLookupEntry::DecodeL
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 RPointerArray<CSIPHeaderBase> 
       
    82 TSIPHeaderLookupEntry::DecodeL(const TDesC8& aHeaderValue) const
       
    83 	{ 
       
    84 	return (*iDecodeFunction)(aHeaderValue);
       
    85 	}
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // TSIPHeaderLookupEntry::InternalizeL
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 CSIPHeaderBase* 
       
    92 TSIPHeaderLookupEntry::InternalizeL(RReadStream& aReadStream) const
       
    93 	{
       
    94 	if (iInternalizeFunction == 0)
       
    95         {
       
    96         return 0;
       
    97         }
       
    98 	return (*iInternalizeFunction)(aReadStream);
       
    99 	}
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // TSIPHeaderLookupEntry::InternalizeSupported
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TBool TSIPHeaderLookupEntry::InternalizeSupported() const
       
   106     {
       
   107     return (iInternalizeFunction != 0);
       
   108     }