imgtools/imglib/inc/utf16string.h
changeset 620 ad8ffc8e1982
parent 600 6d08f4a05d93
equal deleted inserted replaced
585:238f4cb8391f 620:ad8ffc8e1982
       
     1 /*
       
     2 * Copyright (c) 2009 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 "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 * @internalComponent * @released
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __UTF16_STRING_H__
       
    20 #define __UTF16_STRING_H__
       
    21 #include <e32std.h> 
       
    22 #include <string>
       
    23 #include <fstream>
       
    24 using namespace std ;
       
    25 
       
    26 class UTF16String {
       
    27 public :
       
    28 	
       
    29 	UTF16String();
       
    30 	UTF16String(const UTF16String& aRight);
       
    31 	UTF16String(const string& aUtf8Str);
       
    32 	UTF16String(const TUint16* aUtf16Str,TInt aLength = -1);
       
    33 	UTF16String(const char* aUtf8Str,TInt aLength = -1);	
       
    34 	~UTF16String();	
       
    35 	
       
    36 	bool FromFile(const char* aFileName);
       
    37 	bool ToUTF8(string& aResult) const ;	
       
    38 	bool Assign(const char* aUtf8Str,TInt aLength = -1);	
       
    39 	inline TUint length() const { return iLength ;} 
       
    40 	inline TUint bytes() const { return (iLength << 1) ;} 
       
    41 	const TUint16* c_str() const ;
       
    42 	inline bool IsEmpty() const { return  (0 == iLength) ;}	
       
    43 	UTF16String& operator = (const UTF16String& aRight);
       
    44 	int Compare(const TUint16* aUtf16Str) const ;
       
    45 	int CompareNoCase(const TUint16* aUtf16Str) const ;
       
    46 	TUint16* Alloc(size_t aNewLen);
       
    47 	
       
    48 protected:
       
    49 	TUint16* iData ;
       
    50 	TUint iLength ;	
       
    51 };
       
    52 #endif