imgtools/imglib/inc/utf16string.h
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 600 6d08f4a05d93
permissions -rw-r--r--
Specify extenal tool with path
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
/*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
* All rights reserved.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
* Initial Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
* Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
* Description: 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
* @internalComponent * @released
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
*/
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#ifndef __UTF16_STRING_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#define __UTF16_STRING_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#include <e32std.h> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
using namespace std ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
class UTF16String {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
public :
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
	UTF16String();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
	UTF16String(const UTF16String& aRight);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
	UTF16String(const string& aUtf8Str);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
	UTF16String(const TUint16* aUtf16Str,TInt aLength = -1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
	UTF16String(const char* aUtf8Str,TInt aLength = -1);	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
	~UTF16String();	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
	bool FromFile(const char* aFileName);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
	bool ToUTF8(string& aResult) const ;	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
	bool Assign(const char* aUtf8Str,TInt aLength = -1);	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
	inline TUint length() const { return iLength ;} 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
	inline TUint bytes() const { return (iLength << 1) ;} 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
	const TUint16* c_str() const ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
	inline bool IsEmpty() const { return  (0 == iLength) ;}	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
	UTF16String& operator = (const UTF16String& aRight);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
	int Compare(const TUint16* aUtf16Str) const ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
	int CompareNoCase(const TUint16* aUtf16Str) const ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
	TUint16* Alloc(size_t aNewLen);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
protected:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
	TUint16* iData ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
	TUint iLength ;	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
#endif