webservices/wsoviplugin/src/wsovihandlercontext.cpp
changeset 0 62f9d29f7211
child 15 32ab7ae9ec94
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2008 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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #include "wsovihandlercontext.h"
       
    26 CWSOviHandlerContext* CWSOviHandlerContext::NewL()
       
    27     {
       
    28     CWSOviHandlerContext* self = new (ELeave) CWSOviHandlerContext();
       
    29     CleanupStack::PushL (self);
       
    30     self->ConstructL();
       
    31     CleanupStack::Pop(self);
       
    32     return self;
       
    33     }
       
    34 
       
    35 // Constructor
       
    36 CWSOviHandlerContext::CWSOviHandlerContext():
       
    37     iCoreServiceManager(NULL),
       
    38     iWSOviPlugin(NULL),
       
    39     iLogger(NULL)
       
    40     {
       
    41     }
       
    42 
       
    43 // Constructor
       
    44 void CWSOviHandlerContext::ConstructL()
       
    45     {
       
    46     }
       
    47 
       
    48 
       
    49 // Destructor
       
    50 CWSOviHandlerContext::~CWSOviHandlerContext()
       
    51     {
       
    52     delete iVersion;
       
    53     delete iDiff;
       
    54     }
       
    55 
       
    56 //from HandlerContext        
       
    57 TInt CWSOviHandlerContext::Add(MSenCoreServiceManager& aValue)
       
    58     {
       
    59     iCoreServiceManager = &aValue;
       
    60     return KErrNone;
       
    61     }
       
    62 
       
    63 MSenCoreServiceManager* CWSOviHandlerContext::GetSenCoreServiceManager()
       
    64     {
       
    65     return iCoreServiceManager;
       
    66     }
       
    67 
       
    68 
       
    69 
       
    70 //from MContext      
       
    71 SenContext::TContextType CWSOviHandlerContext::Type() const
       
    72     {
       
    73     return SenContext::EHandlerContext;
       
    74     }
       
    75 SenContext::TContextDirection CWSOviHandlerContext::Direction() const
       
    76     {
       
    77     return SenContext::EBoth;
       
    78     }
       
    79 TInt CWSOviHandlerContext::Add(const TDesC8& /*aKey*/, const TDesC8& /*aValue*/)
       
    80     {
       
    81     return KErrNotSupported;
       
    82     }
       
    83 TInt CWSOviHandlerContext::Update(const TDesC8& aKey, const TDesC8& aValue)
       
    84     {
       
    85     TInt retVal(KErrNone);
       
    86     //version with makeing of copy
       
    87     if (aKey == HandlerContextKey::KVersion)
       
    88         {
       
    89         delete iVersion;
       
    90         iVersion = NULL;
       
    91         TRAP(retVal,iVersion = aValue.AllocL());
       
    92         }
       
    93     else
       
    94         {
       
    95         retVal = KErrNotFound;
       
    96         }
       
    97     return retVal;    
       
    98     }
       
    99 const TDesC8* CWSOviHandlerContext::GetDesC8L(const TDesC8& aKey)
       
   100     {
       
   101     if (aKey == HandlerContextKey::KVersion)
       
   102         {
       
   103         return iVersion;
       
   104         }
       
   105     else
       
   106         {
       
   107         return NULL;
       
   108         }
       
   109     }
       
   110 TInt CWSOviHandlerContext::Add(const TDesC8& /*aKey*/, TInt /*aValue*/)
       
   111     {
       
   112     return KErrNotSupported;
       
   113     }
       
   114 TInt CWSOviHandlerContext::Update(const TDesC8& aKey, TInt aValue)
       
   115     {
       
   116     TInt retVal(KErrNone);
       
   117     //version with makeing of copy
       
   118     if (aKey == HandlerContextKey::KDiff)
       
   119         {
       
   120         delete iDiff;
       
   121         iDiff = new TInt(aValue);
       
   122         }
       
   123     else
       
   124         {
       
   125         retVal = KErrNotFound;
       
   126         }
       
   127     return retVal;    
       
   128     }
       
   129 const TInt* CWSOviHandlerContext::GetIntL(const TDesC8& aKey)
       
   130     {
       
   131     if (aKey == HandlerContextKey::KDiff)
       
   132         {
       
   133         return iDiff;
       
   134         }
       
   135     else
       
   136         {
       
   137         return NULL;
       
   138         }
       
   139     }
       
   140 TInt CWSOviHandlerContext::Add(const TDesC8& /*aKey*/, CSenElement* /*aValue*/)
       
   141     {
       
   142     return KErrNotSupported;
       
   143     }
       
   144 TInt CWSOviHandlerContext::Update(const TDesC8& /*aKey*/, CSenElement* /*aValue*/)
       
   145     {
       
   146     return KErrNotSupported;
       
   147     }
       
   148 const CSenElement* CWSOviHandlerContext::GetSenElementL(const TDesC8& /*aKey*/)
       
   149     {
       
   150     return NULL;
       
   151     }
       
   152 TInt CWSOviHandlerContext::Add(const TDesC8& aKey, TAny* aValue)
       
   153     {
       
   154     if (aKey == HandlerContextKey::KSIF())
       
   155         {
       
   156         iWSOviPlugin = (CWSOviPlugin*)aValue;
       
   157         return KErrNone;
       
   158         }
       
   159     else if (aKey == HandlerContextKey::KLogger())
       
   160         {
       
   161         iLogger = (RFileLogger*)aValue;
       
   162         return KErrNone;
       
   163         }
       
   164     else
       
   165         {
       
   166         return KErrNotFound;
       
   167         }
       
   168     }
       
   169 
       
   170 TInt CWSOviHandlerContext::Update(const TDesC8& /*aKey*/, TAny* /*aValue*/)
       
   171     {
       
   172     return KErrNotSupported;
       
   173     }
       
   174 TAny* CWSOviHandlerContext::GetAnyL(const TDesC8& aKey)
       
   175     {
       
   176      if (aKey == HandlerContextKey::KSIF())
       
   177         {
       
   178         return (TAny*)iWSOviPlugin;
       
   179         }
       
   180      else if (aKey == HandlerContextKey::KLogger())
       
   181         {
       
   182         return (TAny*)iLogger;
       
   183         }
       
   184     else
       
   185         {
       
   186         return NULL;
       
   187         }
       
   188     }
       
   189 
       
   190 const CSenXmlReader* CWSOviHandlerContext::GetParser()
       
   191     {
       
   192     return NULL;
       
   193     }
       
   194 TInt CWSOviHandlerContext::Remove(const TDesC8& /*aKey*/)  
       
   195     {
       
   196     return KErrNotSupported;
       
   197     }
       
   198 TInt CWSOviHandlerContext::Count() const
       
   199     {
       
   200     return KErrNotSupported;
       
   201     }
       
   202 TPtrC8 CWSOviHandlerContext::KeyAtL(TInt /*aIndex*/)   
       
   203     {
       
   204     return KNullDesC8();
       
   205     }
       
   206 void CWSOviHandlerContext::Reset() 
       
   207     {
       
   208     }
       
   209     
       
   210    
       
   211 // END OF FILE
       
   212