devicesrv_pub/version_info_api/inc/versioninfo.h
changeset 0 4e1aa6a622a0
child 78 3f0699f2e14c
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 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:  Interface for quering system version information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VERSION_INFO_H
       
    21 #define VERSION_INFO_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class RFs;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31 * Class holds system version information. Version Info API provides 
       
    32 * an interface for quering system version information.
       
    33 *
       
    34 * Usage:
       
    35 *  
       
    36 * Get platform version information:
       
    37 * @code
       
    38 * // iFs contains open file server session
       
    39 *
       
    40 * VersionInfo::TPlatformVersion platformVersion;
       
    41 * // Select the overload of VersionInfo::GetVersion() that suits best for 
       
    42 * // the current client.
       
    43 * User::LeaveIfError( VersionInfo::GetVersion( platformVersion, iFs ) );
       
    44 *
       
    45 * // Now platformVersion contains platform version information.
       
    46 *
       
    47 * @endcode
       
    48 *
       
    49 * @lib platformver.lib
       
    50 * @since S60 3.2
       
    51 */
       
    52 
       
    53 NONSHARABLE_CLASS(VersionInfo)
       
    54     {
       
    55 
       
    56 public:
       
    57     /**
       
    58     * Class TVersionBase is a base class for all version information data.
       
    59     * @since S60 3.2
       
    60     */
       
    61     class TVersionBase
       
    62         {
       
    63     friend class VersionInfo;
       
    64 
       
    65     protected:
       
    66         /**
       
    67         * Constructor for subclasses
       
    68         * @since S60 3.2
       
    69         * @param aType Sets type of version info specified by TVersionType
       
    70         */
       
    71         inline TVersionBase( TInt aType );
       
    72 
       
    73     private:
       
    74         /**
       
    75         * C++ default constructor.
       
    76         */
       
    77         TVersionBase();
       
    78 
       
    79     private:
       
    80         /**  Contains type of version info specified by TVersionType */
       
    81         TInt iType;
       
    82         };
       
    83 
       
    84     /**
       
    85     * Class TPlatformVersion stores platform version information.
       
    86     * The class is used as parameter in GetVersionInfo() methods.
       
    87     * @since S60 3.2
       
    88     */
       
    89     class TPlatformVersion : public TVersionBase
       
    90         {
       
    91     public:
       
    92         /**
       
    93          * C++ default constructor.
       
    94         */
       
    95         inline TPlatformVersion();
       
    96 
       
    97     public:
       
    98         /**  Contains the major version. For example 3 if S60 3.2 */
       
    99         TUint16 iMajorVersion;
       
   100 
       
   101         /**  Contains the minor version. For example 2 if S60 3.2 */
       
   102         TUint16 iMinorVersion;
       
   103         };
       
   104 
       
   105     /**
       
   106     * This method gets the version information.
       
   107     *
       
   108     * @since S60 3.2
       
   109     * @param aVersion Stores the version information
       
   110     * @return System wide error code
       
   111     *
       
   112     * @see TVersionBase
       
   113     */
       
   114     IMPORT_C static TInt GetVersion( TVersionBase& aVersion );
       
   115 
       
   116     /**
       
   117     * This method gets the version information. Given file server 
       
   118     * session avoids the overhead of new file server connection. 
       
   119     *
       
   120     * @since S60 3.2
       
   121     * @param aVersion Stores the version information
       
   122     * @param aFs An opened file server session
       
   123     * @return System wide error code
       
   124     *
       
   125     * @see TVersionBase
       
   126     */
       
   127     IMPORT_C static TInt GetVersion( TVersionBase& aVersion, RFs& aFs );
       
   128 
       
   129 private:
       
   130     /**
       
   131      * C++ default constructor.
       
   132      */
       
   133     VersionInfo();
       
   134 
       
   135     /** Used internally to detect type of version info */
       
   136     enum TVersionType
       
   137         {
       
   138         EPlatformVersion = 0
       
   139         };
       
   140     };
       
   141 
       
   142 #include "versioninfo.inl"
       
   143 
       
   144 #endif // VERSION_INFO_H
       
   145 
       
   146 // End of File