connectivitymodules/SeCon/cntparser/src/cntparserinfolog.cpp
branchRCL_3
changeset 43 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
42:0aa8cc770c8a 43:4a793f564d72
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  CCntParserInfoLog implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32strm.h>
       
    20 #include <f32file.h>
       
    21 #include <s32file.h>
       
    22 
       
    23 #include "cntparserinfolog.h"
       
    24 
       
    25 _LIT8(KNewLine,"\r\n");
       
    26 
       
    27 _LIT8(KMaxRecords,"Maximum-Records:");
       
    28 _LIT8(KTotalRecords,"Total-Records:");
       
    29 
       
    30 //------------------------------------------------------------
       
    31 // CCntParserInfoLog::CCntParserInfoLog()
       
    32 //------------------------------------------------------------
       
    33 CCntParserInfoLog::CCntParserInfoLog()
       
    34     {
       
    35     }
       
    36 
       
    37 //------------------------------------------------------------
       
    38 // CCntParserInfoLog::~CCntParserInfoLog()
       
    39 //------------------------------------------------------------
       
    40 CCntParserInfoLog::~CCntParserInfoLog()
       
    41     {
       
    42     }
       
    43 
       
    44 //------------------------------------------------------------
       
    45 // CCntParserInfoLog::CCntParserInfoLog::NewL()
       
    46 //------------------------------------------------------------
       
    47 EXPORT_C CCntParserInfoLog* CCntParserInfoLog::NewL()
       
    48     {
       
    49     CCntParserInfoLog* self=new (ELeave) CCntParserInfoLog();
       
    50     return self;
       
    51     }
       
    52 
       
    53 //------------------------------------------------------------
       
    54 // CCntParserInfoLog::SaveToFileL(const TDesC& aFileName) const
       
    55 //------------------------------------------------------------
       
    56 EXPORT_C void CCntParserInfoLog::SaveToFileL( const TDesC& aFileName ) const
       
    57     {
       
    58     TInt err = KErrNone;
       
    59     RFs Fs;
       
    60     RFile writer;
       
    61     User::LeaveIfError( Fs.Connect() ); //Connect to the file server
       
    62     CleanupClosePushL( Fs );
       
    63     err = writer.Replace( Fs, aFileName, EFileWrite ); //Open file
       
    64     CleanupClosePushL( writer );
       
    65     
       
    66     if( err == KErrNone )
       
    67         {
       
    68         writer.Write( KMaxRecords );
       
    69         
       
    70         TBuf8<16> numVal;
       
    71         numVal.Num( iMaximumRecords );
       
    72         writer.Write( numVal );
       
    73         
       
    74         writer.Write( KNewLine );
       
    75         
       
    76         writer.Write( KTotalRecords );
       
    77         
       
    78         TBuf8<16> numVal2;
       
    79         numVal2.Num( iTotalRecords );
       
    80         writer.Write( numVal2 );
       
    81         }
       
    82     
       
    83     CleanupStack::PopAndDestroy();  //writer
       
    84     CleanupStack::PopAndDestroy();  //Fs
       
    85     }
       
    86 
       
    87 //------------------------------------------------------------
       
    88 // CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords)
       
    89 //------------------------------------------------------------
       
    90 EXPORT_C void CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords)
       
    91     {
       
    92     iTotalRecords = aTotalRecords;
       
    93     }
       
    94 
       
    95 //------------------------------------------------------------
       
    96 // CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords)
       
    97 //------------------------------------------------------------
       
    98 EXPORT_C void CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords)
       
    99     {
       
   100     iMaximumRecords = aMaximumRecords;
       
   101     }
       
   102 
       
   103 //------------------------------------------------------------
       
   104 // CCntParserInfoLog::TotalRecords() const
       
   105 //------------------------------------------------------------
       
   106 EXPORT_C TInt CCntParserInfoLog::TotalRecords() const
       
   107     {
       
   108     return iTotalRecords;
       
   109     }
       
   110 
       
   111 //------------------------------------------------------------
       
   112 // CCntParserInfoLog::MaximumRecords() const
       
   113 //------------------------------------------------------------
       
   114 EXPORT_C TInt CCntParserInfoLog::MaximumRecords() const
       
   115     {
       
   116     return iMaximumRecords;
       
   117     }
       
   118     
       
   119 // end of file