inc/CPEngNWSessionSlotID2.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  NWSessionSlotID.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CPENGNWSESSIONSLOTID2_H
       
    19 #define __CPENGNWSESSIONSLOTID2_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CPEngNWSessionSlotID2Imp;
       
    27 
       
    28 
       
    29 
       
    30 // CLASS DECLARATION
       
    31 /**
       
    32  * NWSessionSlotID.
       
    33  *
       
    34  * Class encapsulating the NWSessionSlotID.
       
    35  *
       
    36  * @since 3.0
       
    37  * @lib PEngManager2.lib
       
    38  */
       
    39 class CPEngNWSessionSlotID2 : public CBase
       
    40     {
       
    41 
       
    42         //-----------------------------------------------------------------------
       
    43     public: /* Construction */
       
    44 
       
    45         /**
       
    46          * Instantiates NWSessionSlotID object.
       
    47          *
       
    48          * Initially all NWSessionSlotID sub parts are
       
    49          * zero length and no wild fields.
       
    50          *
       
    51          * @return New NWSessionSlotID instance.
       
    52          */
       
    53         IMPORT_C static CPEngNWSessionSlotID2* NewL();
       
    54         IMPORT_C static CPEngNWSessionSlotID2* NewLC();
       
    55 
       
    56 
       
    57         /**
       
    58          * Cloness CPEngNWSessionSlotID2 object.
       
    59          *
       
    60          * @return New CPEngNWSessionSlotID2 copy instance.
       
    61          */
       
    62         IMPORT_C CPEngNWSessionSlotID2* CloneL() const;
       
    63 
       
    64 
       
    65         /**
       
    66          * Destructor.
       
    67          * Virtual by CBase.
       
    68          */
       
    69         ~CPEngNWSessionSlotID2();
       
    70 
       
    71 
       
    72     private:
       
    73 
       
    74         CPEngNWSessionSlotID2();
       
    75 
       
    76 
       
    77 
       
    78         //-----------------------------------------------------------------------
       
    79     public: /* NWSessionSlotID */
       
    80 
       
    81         /**
       
    82          * Sets the NWSessionSlotID sub-part.
       
    83          *
       
    84          * All sub-parts must be properly defined before
       
    85          * the CPEngNWSessionSlotID2 instance can be used
       
    86          * to identify the NWSessionSlot.
       
    87          *
       
    88          * @param aAddress Service address to use.
       
    89          * @param aUserId User id to use.
       
    90          * @param aAppId AppId to use.
       
    91          */
       
    92         IMPORT_C void SetServiceAddressL( const TDesC& aAddress );
       
    93         IMPORT_C void SetUserIdL( const TDesC& aUserId );
       
    94         IMPORT_C void SetAppIdL( const TDesC& aAppId );
       
    95         IMPORT_C void SetAllL( const TDesC& aAddress,
       
    96                                const TDesC& aUserId,
       
    97                                const TDesC& aAppId );
       
    98 
       
    99 
       
   100 
       
   101         /**
       
   102          * Fragment access.
       
   103          *
       
   104          * Return pointer descriptor presenting
       
   105          * requested NWSessionSlotID sub-part.
       
   106          *
       
   107          * Pointed data remains valid untill new data
       
   108          * is assigned with any Set*() method or
       
   109          * NWSessionSlotID is reinitialized with UnPackL().
       
   110          *
       
   111          * @return Requested sub-part.
       
   112          */
       
   113         IMPORT_C TPtrC ServiceAddress() const;
       
   114         IMPORT_C TPtrC UserId() const;
       
   115         IMPORT_C TPtrC AppId() const;
       
   116 
       
   117 
       
   118 
       
   119 
       
   120         //-----------------------------------------------------------------------
       
   121     public: /* Match support */
       
   122 
       
   123         /**
       
   124          * Sets the NWSessionSlotID sub-part as wild.
       
   125          *
       
   126          * If NWSessionSlotID is wanted to be used as
       
   127          * match criteria when e.g. listing NWSessionSlotIDs,
       
   128          * one or more sub-parts can be defined as "wild".
       
   129          * Wild sub-part matches to any data in the matched
       
   130          * NWSessionSlotIDs corresponding sub-part.
       
   131          */
       
   132         IMPORT_C void SetServiceAddressMatchAnyL();
       
   133         IMPORT_C void SetUserIdMatchAnyL();
       
   134         IMPORT_C void SetAppIdMatchAnyL();
       
   135 
       
   136 
       
   137         /**
       
   138          * Tests is certain sub-part defined as wild.
       
   139          *
       
   140          * @return ETrue if requested sub-part is defined as wild.
       
   141          * Else EFalse.
       
   142          */
       
   143         IMPORT_C TBool IsServiceAddressWild() const;
       
   144         IMPORT_C TBool IsUserIdWild() const;
       
   145         IMPORT_C TBool IsAppIdWild() const;
       
   146 
       
   147 
       
   148         /**
       
   149          * Tests is one or more of the sub-parts defined as wild.
       
   150          *
       
   151          * @return ETrue if one or more sub-parts is defined as wild.
       
   152          * Else EFalse.
       
   153          */
       
   154         IMPORT_C TBool IsWild() const;
       
   155 
       
   156 
       
   157         /**
       
   158          * Pattern-matches NWSessionSlotIDs.
       
   159          *
       
   160          * Matching uses common pattern matching between
       
   161          * corresponding subparts. Any of sub-parts can be
       
   162          * defined as wild, in which case that sub part
       
   163          * matches to any data.
       
   164          *
       
   165          * @param aIdToMatch The NWSessionSlotID to match.
       
   166          * @return KErrNone if NWSessionSlotIDs match.
       
   167          * Else KErrNotFound.
       
   168          */
       
   169         IMPORT_C TInt MatchFullId( const CPEngNWSessionSlotID2& aIdToMatch ) const;
       
   170 
       
   171 
       
   172 
       
   173         /**
       
   174          * Pattern-matches NWSessionSlotIDs base parts.
       
   175          * (ServiceAddress and UserId).
       
   176          *
       
   177          * @param aIdToMatch The NWSessionSlotID which base part to match.
       
   178          * @return KErrNone if NWSessionSlotIDs match.
       
   179          * Else KErrNotFound.
       
   180          */
       
   181         IMPORT_C TInt MatchBasePart( const CPEngNWSessionSlotID2& aIdToMatch ) const;
       
   182 
       
   183 
       
   184         /**
       
   185          * Pattern-matches NWSessionSlotIDs AppId parts.
       
   186          * (AppId).
       
   187          *
       
   188          * @param aIdToMatch The NWSessionSlotID which AppId part to match.
       
   189          * @return KErrNone if NWSessionSlotIDs match.
       
   190          * Else KErrNotFound.
       
   191          */
       
   192         IMPORT_C TInt MatchAppIdPart( const CPEngNWSessionSlotID2& aIdToMatch ) const;
       
   193 
       
   194 
       
   195 
       
   196         //-----------------------------------------------------------------------
       
   197     public: /* Serialized presentation */
       
   198 
       
   199 
       
   200 
       
   201         /**
       
   202          * Packs NWSessionSlotIDs state to buffer and
       
   203          * returns buffer to caller. Caller is responsible
       
   204          * of deleting the buffer. PackLC() leaves the created
       
   205          * buffer to CleanupStack.
       
   206          *
       
   207          * @return NWSessionSlotID state buffer.
       
   208          */
       
   209         IMPORT_C HBufC8* PackL() const;
       
   210         IMPORT_C HBufC8* PackLC() const;
       
   211 
       
   212 
       
   213         /**
       
   214          * Initializes NWSessionSlotID state from a package
       
   215          * previously created with PackL() or PackLC().
       
   216          *
       
   217          * If given aPack isn't a valid NWSessionSlotID
       
   218          * package, leaves with KErrCorrupt.
       
   219          *
       
   220          * @param aPack NWSessionSlotID state package.
       
   221          */
       
   222         IMPORT_C void UnPackL( const TDesC8& aPack );
       
   223 
       
   224 
       
   225 
       
   226         //-----------------------------------------------------------------------
       
   227     public: /* Non exported access to implementation */
       
   228 
       
   229         /**
       
   230          * Presence Engine internal access
       
   231          * to NWSessionSlotID implementation.
       
   232          *
       
   233          * @return Implementation.
       
   234          */
       
   235         CPEngNWSessionSlotID2Imp* Implementation();
       
   236         const CPEngNWSessionSlotID2Imp* Implementation() const;
       
   237 
       
   238 
       
   239 
       
   240         //-----------------------------------------------------------------------
       
   241     private: /* Data */
       
   242 
       
   243 
       
   244         //OWN: Implementation
       
   245         CPEngNWSessionSlotID2Imp*     iImp;
       
   246 
       
   247     };
       
   248 
       
   249 
       
   250 #endif //__CPENGNWSESSIONSLOTID2_H
       
   251 
       
   252 
       
   253 //End of file
       
   254 
       
   255 
       
   256 
       
   257