javaextensions/satsa/pki/src.s60/tstscharactersetconverter.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TSTSCHARACTERSETCONVERTER_H
       
    21 #define TSTSCHARACTERSETCONVERTER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 *  Provides character set conversion and escape character parsing.
       
    32 *  Converts unicode strings which may contain escaped characters to printable
       
    33 *  strings.
       
    34 *
       
    35 *  @since 3.2
       
    36 */
       
    37 NONSHARABLE_CLASS(TSTSCharacterSetConverter)
       
    38 {
       
    39 public:  // Constructors and destructor
       
    40 
       
    41     /**
       
    42         * C++ default constructor.
       
    43         */
       
    44     TSTSCharacterSetConverter();
       
    45 
       
    46 
       
    47 public: // New functions
       
    48 
       
    49     /**
       
    50         * Converts string from unicode to printable string. String may
       
    51         * contain escaped sequences as defined in RFC2253. Those
       
    52         * sequences are parsed.
       
    53         * If aValue contains characters which are not part of
       
    54         * PrintableString character set, the method leaves with
       
    55         * KSTSErrInvalidCharactersInCAName.
       
    56         * @since 3.2
       
    57         * @param aValue String to be converted
       
    58         * @return string containing only PrintableString characters.
       
    59         * Caller takes ownership.
       
    60         *
       
    61         */
       
    62     HBufC8* EscapedUnicodeToPrintableLC(const TDesC& aValue) const;
       
    63 
       
    64 
       
    65 private:
       
    66 
       
    67     // checks if the given character is "special", i.e. one of:
       
    68     // ",", "+", """, "\", "<", ">" or ";"
       
    69     TBool IsSpecial(const TChar& aChar) const;
       
    70 
       
    71     // checks if the given character is printable, i.e. one of:
       
    72     // A-Z, a-z, 0-9, space, "'", "(", ")", "+", ",", "-",".","/",":","=","?"
       
    73     TBool IsPrintable(const TChar& aChar) const;
       
    74 
       
    75     // Prohibit copy constructor if not deriving from CBase.
       
    76     TSTSCharacterSetConverter(const TSTSCharacterSetConverter&);
       
    77     // Prohibit assigment operator if not deriving from CBase.
       
    78     TSTSCharacterSetConverter& operator=(const TSTSCharacterSetConverter&);
       
    79 
       
    80 };
       
    81 
       
    82 
       
    83 
       
    84 #endif // TSTSCHARACTERSETCONVERTER_H
       
    85 
       
    86 // End of File