epoc32/include/mw/sendateutils.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2002-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:        This utility class provides static methods for conversions
    15 *                between Symbian class types and XSD time-date type
    16 *
    17 */
    18 
    19 
    20 
    21 
    22 
    23 
    24 
    25 
    26 #ifndef SEN_DATE_UTILS_H
    27 #define SEN_DATE_UTILS_H
    28 
    29 //  INCLUDES
    30 #include <e32base.h>
    31 
    32 // CLASS DECLARATION
    33 
    34 /**
    35 * This utility class provides static methods for conversions between Symbian 
    36 * class types and XSD time-date type.
    37 *  @lib SenUtils.lib
    38 *  @since Series60 3.0
    39 */
    40 class SenDateUtils
    41     {
    42     public: 
    43         enum { KXmlDateTimeMaxLength = 31 };
    44 
    45         // New functions
    46         /**
    47         * Convert dateTime (from XML schema) to Symbian TTime. 
    48         * A panic will occur if an attempt is made to set an invalid 
    49         * value for any of the fields. 
    50         * Panics: User 3 if illegal date.
    51         * Leave codes:  KErrUnderflow   Not enough data given or 
    52         *                               negative values
    53         *               KErrOverflow    Too big values for e.g. month
    54         *               KErrGeneral     Invalid date structure
    55         * No check is made upon the validity of the year.
    56         * @since Series60 3.0
    57         * @param aXmlDateTime   source datetime to convert from
    58         * @return The returned time will be in UTC.
    59         */
    60         IMPORT_C static TTime FromXmlDateTimeL(const TDesC8& aXmlDateTime);
    61 
    62         /**
    63         * Convert Symbian TTime to dateTime (from XML schema).
    64         * Leave codes:  KErrOverflow    target descriptor is less than
    65         *               KXmlDateTimeMaxLength (25 bytes)
    66         * @since Series60 3.0
    67         * @param aDest (UTF8) result will be written here. It must be at least
    68         *                KXmlDateTimeMaxLength long.
    69         * @param TTime in UTC.
    70         */
    71         IMPORT_C static void ToXmlDateTimeUtf8L(TDes8& aDest, 
    72                                                 const TTime& aSrc);
    73 
    74         /**
    75         * Convert Symbian TTime to dateTime (from XML schema).
    76         * Leave codes:  KErrOverflow    target descriptor is less than
    77         *               KXmlDateTimeMaxLength (25 bytes)
    78         * @since Series60 5.0
    79         * @param aDest (UTF8) result will be written here. It must be at least
    80         *                KXmlDateTimeMaxLength long.
    81         * @param TTime in UTC.
    82         */
    83 	IMPORT_C static void ToXmlDateTimeUtf82L(TDes8& aDest, const TTime& aSrc) ;
    84 
    85     private:
    86         /**
    87         * Hide default C++ constructor.
    88         */
    89         SenDateUtils() { }
    90 
    91         /**
    92         * Prohibit copy constructor if not deriving from CBase.
    93         */
    94         SenDateUtils( const SenDateUtils& );
    95 
    96         /**
    97         * Prohibit assignment operator if not deriving from CBase.
    98         */
    99         SenDateUtils& operator=( const SenDateUtils& );
   100     };
   101 
   102 #endif // SEN_DATE_UTILS_H
   103 // End of File