bintools/rcomp/inc/ASTRING.H
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 1997-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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __ASTRING_H__
       
    20 #define __ASTRING_H__
       
    21 
       
    22 #if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
       
    23 #include <iostream>
       
    24 using std::ostream;
       
    25 #else //!__MSVCDOTNET__
       
    26 #include <iostream.h>
       
    27 #endif //__MSVCDOTNET__
       
    28 
       
    29 #include "ARRAY.H"
       
    30 
       
    31 #include "wide.h"
       
    32 
       
    33 enum ValueIfSubStringNotFound { EStringNotFound = -1 } ;
       
    34 
       
    35 class RCBinaryStream;
       
    36 class NumericValue;
       
    37 
       
    38 class String : public ArrayItem
       
    39 	{
       
    40 	friend ostream& operator<< ( ostream& os, const String & a);
       
    41 	friend class NumericValue;
       
    42 	friend class RCBinaryStream;
       
    43 public:
       
    44     enum CharacterSet { UNKNOWN, ASCII, CP1252, CP850, ISOLatin1, ShiftJIS, Unicode, UTF8 };
       
    45 
       
    46 	String();
       
    47 	String(const char* pszText);
       
    48 	String(const String& SourceString);
       
    49 	~String();
       
    50 	void Reset();
       
    51 	char& operator[] (unsigned long CharIndex) const;
       
    52 	String& operator= (const String & SourceString);
       
    53 	String& operator+= (const String & SourceString);
       
    54 	String& operator+= (char * SourceChar);
       
    55 	int operator== (const String & CompareString) const; 
       
    56 	int operator!= (const String & CompareString) const; 
       
    57 	String operator+ (const String & SecondString) const;
       
    58 	unsigned long Length() const;
       
    59 	const char * GetBuffer() const;
       
    60 	const char * GetAssertedNonEmptyBuffer() const;
       
    61 	int IsDecNatural() const;	// Returns TRUE(1) if all decimal digits (disregards leading -).
       
    62 	String& Upper();
       
    63     const unsigned char* UCRep (unsigned long aIndex) const;
       
    64 	int FindSubString(String aSubString, int aStart=0);
       
    65 	String ExtractSubString(const unsigned int aStart, const unsigned int aFinish);
       
    66 	int Atoi();
       
    67 
       
    68     // export string to caller-supplied buffer mapping from fromchset.
       
    69     int Export( UTF16 *buffer, int& length, CharacterSet fromchset ) const;
       
    70     unsigned long ExportLength( CharacterSet tochset, CharacterSet fromchset ) const;
       
    71 
       
    72 private:
       
    73 	char* iRep;
       
    74 	unsigned long iLength;
       
    75 	};
       
    76 
       
    77 // Compares the binary representation of two strings.
       
    78 class StringLess
       
    79 	{
       
    80 public:
       
    81 	bool operator()(const String&, const String&) const;
       
    82 	};
       
    83 
       
    84 extern String::CharacterSet SourceCharacterSet;
       
    85 extern String::CharacterSet TargetCharacterSet;
       
    86 
       
    87 #endif // __ASTRING_H__