epoc32/include/app/vstaticutils.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // 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
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __VSTATICUTILS_H__
       
    17 #define __VSTATICUTILS_H__
       
    18 
       
    19 // System includes
       
    20 #include <e32base.h>
       
    21 
       
    22 // User includes
       
    23 #include <versit.h>
       
    24 
       
    25 // Classes referenced
       
    26 class CVersitAdditionalPropertyStorage;
       
    27 
       
    28 class VersitUtils
       
    29 /** A utility class which provides functions for handling character set conversions, 
       
    30 and for the parsing of character strings. 
       
    31 @publishedAll
       
    32 @released
       
    33 */
       
    34 	{
       
    35 public:
       
    36 	IMPORT_C static TBool EightBitEncoding(Versit::TVersitCharSet aCharSet);
       
    37 	IMPORT_C static TBool EightBitEncoding(TUint aCharSetId);
       
    38 	IMPORT_C static TUid ConArcEncodingUid(Versit::TVersitEncoding aEncoding);
       
    39 	IMPORT_C static const TDesC8& IANACharacterSetName(Versit::TVersitCharSet aCharSet);
       
    40 	IMPORT_C static const TDesC8& IANAEncodingName(Versit::TVersitEncoding aEncoding);
       
    41 	IMPORT_C static TUid CharConvCharSetUid(Versit::TVersitCharSet aVersitSet);
       
    42 	static Versit::TVersitCharSet CharSet(TUint aCharConvCharSetUid);
       
    43 	IMPORT_C static TBool DescriptorContainsOnlySevenBitCharacters(const TDesC& aText);
       
    44 	IMPORT_C static TBool RequiresEncoding(const TDesC& aText);
       
    45 	IMPORT_C static void UncodeToNarrowL(const TDesC& aUnicode, TDes8& aNarrow, const Versit::TEncodingAndCharset& aEncodingCharset);
       
    46 	IMPORT_C static void AddEscapedString(TDes& aDestination,const TDesC& aTextToEscape,Versit::TVersitCharSet aCharSet);
       
    47 	IMPORT_C static void AddEscapedString(TDes& aDestination,const TDesC& aTextToEscape,TUint aCharSetId);
       
    48 	IMPORT_C static void ConArcEncodeL(RReadStream& aSource, CBufBase& aTarget, TUid aConArcEncodingUid);
       
    49 	IMPORT_C static void WrapLinesL(CBufBase& aBuffer, TInt aMaxLineLength);
       
    50 	IMPORT_C static TBool CheckAndIgnoreCustomErrorL(TInt aError); 
       
    51 	IMPORT_C static void RemoveEscapeChars(TPtr8& aText);
       
    52 	IMPORT_C static void RemoveEscapeChars(HBufC16& aText);
       
    53 	IMPORT_C static void RemoveEscapeChars(HBufC16& aText, TUint aCharSetUid);
       
    54 	IMPORT_C static void RemoveEscapeChars(TPtr16& aText, TUint aCharSetUid);
       
    55 	IMPORT_C static TBool IsNoneWhiteSpaceChar(const TDesC8& aString);
       
    56 	IMPORT_C static void StripWhiteSpace(TPtr8& aString);
       
    57 	IMPORT_C static void StripWhiteSpace(TPtr16& aString);
       
    58 	static inline TBool IsWhiteSpace(TUint aChar);
       
    59 	static inline TBool IsBeginOrEnd(TUid aUid);
       
    60 	IMPORT_C static TBool IsNoneWhiteSpaceWideChar(const TDesC16& aString);
       
    61     IMPORT_C static CDesCArray* ParseForArrayPropertiesL(TPtr16 aStringValue, TUint aLineCharacterSetId);
       
    62     //
       
    63     IMPORT_C static void AllocateAdditionalPropertyStorageL(CVersitTlsData& aTlsData, CParserProperty& aProperty, TPtr16& aStringValue, TUint aLineCharacterSetId);
       
    64     IMPORT_C static void FreeAdditionalPropertyStorageL(const CParserProperty& aProperty);
       
    65     IMPORT_C static CParserPropertyValue* AdditionalPropertyValueFromStorageL(const CParserProperty& aProperty);
       
    66 
       
    67 private:
       
    68 	static void AddEscapedString(TBool aIsShiftJis,TDes& aDestination,const TDesC& aTextToEscape);
       
    69 	static const TDesC &VersitUtils::EscapeChar(TBool aIsShiftJis);
       
    70 	};
       
    71 
       
    72 inline TBool VersitUtils::IsWhiteSpace(TUint aChar)
       
    73 /** Tests whether the specified character is white space 
       
    74 (either a tab or a space character).
       
    75 
       
    76 @param aChar The character to test.
       
    77 @return ETrue if the character is white space, otherwise EFalse. */
       
    78 	{return (aChar==CVersitParser::ESpace || aChar==CVersitParser::EHTab);}
       
    79 inline TBool VersitUtils::IsBeginOrEnd(TUid aUid)
       
    80 /** Tests whether the specified UID is the Versit Begin or End UID (KVersitTokenBeginUid 
       
    81 or KVersitTokenEndUid).
       
    82 
       
    83 @param aUid The UID to test.
       
    84 @return ETrue if the UID is the Begin or End UID, otherwise EFalse. */
       
    85 	{return (aUid.iUid==KVersitTokenBeginUid || aUid.iUid==KVersitTokenEndUid);}
       
    86 #endif