webservices/wsxml/src/senfiltercondition.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2005 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 // INCLUDES
       
    26 
       
    27 #include "SenFilterCondition.h"
       
    28 
       
    29 #include "SenDebug.h"
       
    30 #include "SenLogger.h"
       
    31 
       
    32 
       
    33 _LIT(KLogFileDir, "WsLog");
       
    34 _LIT(KLogFileName, "SenXml.log");
       
    35 
       
    36 // -------------------------------------------
       
    37 //
       
    38 // Implementation of class CSenFilterCondition
       
    39 //
       
    40 // -------------------------------------------
       
    41 
       
    42 
       
    43 EXPORT_C CSenFilterCondition* CSenFilterCondition::NewL(TInt aIndex, 
       
    44                                                         const TDesC8& aElement, 
       
    45                                                         const TDesC8& aAttribute)
       
    46 {
       
    47     CSenFilterCondition* pNew = new (ELeave) CSenFilterCondition;
       
    48     CleanupStack::PushL(pNew);
       
    49     pNew->ConstructL(aIndex, 
       
    50                      aElement, 
       
    51                      aAttribute);
       
    52     CleanupStack::Pop(); // pNew;
       
    53     return pNew;
       
    54 }
       
    55 
       
    56 
       
    57 void CSenFilterCondition::ConstructL(TInt aIndex, 
       
    58                                      const TDesC8& aElement, 
       
    59                                      const TDesC8& aAttribute)
       
    60 {
       
    61     iIndex = aIndex;
       
    62     ipElement = aElement.AllocL();
       
    63     ipAttribute = aAttribute.AllocL();
       
    64 }
       
    65 
       
    66 
       
    67 CSenFilterCondition::CSenFilterCondition()
       
    68 : ipElement(NULL),
       
    69   ipAttribute(NULL)
       
    70 {
       
    71 		TLSLOG_OPEN(KSenXmlLogChannel, KSenXmlLogLevel, KSenXml, KSenXmlLog);
       
    72 		TLSLOG(KSenXmlLogChannel  , KSenXmlLogLevel , _L8("CSenFilterCondition::CSenFilterCondition(): Log opened"));
       
    73 
       
    74     iCurrentIndex = -1;
       
    75     iIndex = 0;
       
    76 
       
    77 		TLSLOG(KSenXmlLogChannel  , KSenXmlLogLevel , _L8("CSenFilterCondition::CSenFilterCondition(): End"));
       
    78 }
       
    79 
       
    80 
       
    81 CSenFilterCondition::CSenFilterCondition(const CSenFilterCondition& aFilterCondition)
       
    82 {
       
    83     iIndex = aFilterCondition.iIndex;
       
    84     iCurrentIndex = aFilterCondition.iCurrentIndex;
       
    85     
       
    86     if (NULL == aFilterCondition.ipElement) {
       
    87         ipElement = NULL;
       
    88     } else {
       
    89         ipElement = aFilterCondition.ipElement->Alloc();
       
    90     }
       
    91     
       
    92     if (NULL == aFilterCondition.ipAttribute) {
       
    93         ipAttribute = NULL;
       
    94     } else {
       
    95         ipAttribute = aFilterCondition.ipAttribute->Alloc();
       
    96     }
       
    97 }
       
    98 
       
    99 
       
   100 EXPORT_C CSenFilterCondition::~CSenFilterCondition()
       
   101 {
       
   102     delete ipElement;
       
   103     delete ipAttribute;
       
   104 
       
   105     // Close the log file and the connection to the server.
       
   106 		TLSLOG(KSenXmlLogChannel  , KSenXmlLogLevel , _L("Log file closed."));
       
   107 		TLSLOG_CLOSE(KSenXmlLogChannel);
       
   108 }
       
   109 
       
   110 
       
   111 EXPORT_C TBool CSenFilterCondition::Test()
       
   112 {
       
   113     TBool test = EFalse;
       
   114     if ( ++iCurrentIndex == iIndex )
       
   115     {
       
   116         test = ETrue;
       
   117     }
       
   118 
       
   119     return test;
       
   120 }
       
   121 
       
   122 
       
   123 RFileLogger* CSenFilterCondition::Log() const
       
   124     {
       
   125     return (RFileLogger*) &iLog;
       
   126     }
       
   127 
       
   128 
       
   129