ncdengine/provider/server/inc/ncdserveraddress.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     1 /*
       
     2 * Copyright (c) 2006 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:   CNcdServerAddress declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDSERVERADDRESS_H
       
    20 #define C_NCDSERVERADDRESS_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "ncdstoragedataitem.h"
       
    25 
       
    26 
       
    27 /**
       
    28  * Utility class for handling server addresses with validities
       
    29  */
       
    30 class CNcdServerAddress : public CBase, public MNcdStorageDataItem
       
    31     {
       
    32 public:
       
    33 
       
    34     /**
       
    35      * Creates a new CNcdServerAddress-object
       
    36      *
       
    37      * @param aAddress Address
       
    38      * @param aValidity Validity as absolute home time
       
    39      * @note If aValidity is 0, validity is not used for
       
    40      * evaluating whether the address is valid or not. The effect is 
       
    41      * the same as after SetUseValidity( EFalse ) has been used
       
    42      */
       
    43     static CNcdServerAddress* NewL( const TDesC& aAddress, 
       
    44         const TInt64& aValidity );
       
    45 
       
    46     static CNcdServerAddress* NewL( RReadStream& aStream );
       
    47     
       
    48     /**
       
    49      * 
       
    50      */
       
    51 
       
    52     static CNcdServerAddress* NewLC( const TDesC& aAddress, 
       
    53         const TInt64& aValidity );
       
    54 
       
    55 
       
    56     /**
       
    57      * Destructor
       
    58      */
       
    59     virtual ~CNcdServerAddress();
       
    60 
       
    61 
       
    62     /**
       
    63      * Address getter
       
    64      */
       
    65     const TDesC& Address() const;
       
    66     
       
    67     
       
    68     /**
       
    69      * Validity setter
       
    70      *
       
    71      * @param aValidity New validity value
       
    72      */
       
    73     void SetValidity( const TInt64& aValidity );
       
    74     
       
    75     
       
    76     /**
       
    77      * Validity getter
       
    78      */    
       
    79     TInt64 Validity() const;
       
    80        
       
    81 
       
    82     /**
       
    83      * Validity checker
       
    84      *
       
    85      * Compares the validity of the address to current home time
       
    86      *
       
    87      * @return ETrue if the address is valid
       
    88      */        
       
    89     TBool IsValid() const;
       
    90     
       
    91     
       
    92     /**
       
    93      * Sets whether validity value is used when evaluating the
       
    94      * validity of the address
       
    95      *
       
    96      * @param aUseValidity If ETrue, validity value is used
       
    97      */
       
    98     void SetUseValidity( TBool aUseValidity );
       
    99     
       
   100 
       
   101 public: // MNcdStorageDataItem
       
   102 
       
   103     void ExternalizeL( RWriteStream& aStream );
       
   104     void InternalizeL( RReadStream& aStream );
       
   105         
       
   106 protected:
       
   107 
       
   108     CNcdServerAddress( const TInt64& aValidity );
       
   109     void ConstructL( const TDesC& aAddress );
       
   110     
       
   111     
       
   112     // Prevent copy constructor and assignment operator
       
   113     CNcdServerAddress( 
       
   114         const CNcdServerAddress& );
       
   115         
       
   116     CNcdServerAddress& operator=(const CNcdServerAddress& );
       
   117     
       
   118     
       
   119 private: // data
       
   120 
       
   121     HBufC* iAddress;
       
   122     TInt64 iValidity;
       
   123     TBool  iUseValidity;
       
   124     };
       
   125 
       
   126 #endif // C_NCDSERVERADDRESS_H