1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/vstaticutils.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,86 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __VSTATICUTILS_H__
1.20 +#define __VSTATICUTILS_H__
1.21 +
1.22 +// System includes
1.23 +#include <e32base.h>
1.24 +
1.25 +// User includes
1.26 +#include <versit.h>
1.27 +
1.28 +// Classes referenced
1.29 +class CVersitAdditionalPropertyStorage;
1.30 +
1.31 +class VersitUtils
1.32 +/** A utility class which provides functions for handling character set conversions,
1.33 +and for the parsing of character strings.
1.34 +@publishedAll
1.35 +@released
1.36 +*/
1.37 + {
1.38 +public:
1.39 + IMPORT_C static TBool EightBitEncoding(Versit::TVersitCharSet aCharSet);
1.40 + IMPORT_C static TBool EightBitEncoding(TUint aCharSetId);
1.41 + IMPORT_C static TUid ConArcEncodingUid(Versit::TVersitEncoding aEncoding);
1.42 + IMPORT_C static const TDesC8& IANACharacterSetName(Versit::TVersitCharSet aCharSet);
1.43 + IMPORT_C static const TDesC8& IANAEncodingName(Versit::TVersitEncoding aEncoding);
1.44 + IMPORT_C static TUid CharConvCharSetUid(Versit::TVersitCharSet aVersitSet);
1.45 + static Versit::TVersitCharSet CharSet(TUint aCharConvCharSetUid);
1.46 + IMPORT_C static TBool DescriptorContainsOnlySevenBitCharacters(const TDesC& aText);
1.47 + IMPORT_C static TBool RequiresEncoding(const TDesC& aText);
1.48 + IMPORT_C static void UncodeToNarrowL(const TDesC& aUnicode, TDes8& aNarrow, const Versit::TEncodingAndCharset& aEncodingCharset);
1.49 + IMPORT_C static void AddEscapedString(TDes& aDestination,const TDesC& aTextToEscape,Versit::TVersitCharSet aCharSet);
1.50 + IMPORT_C static void AddEscapedString(TDes& aDestination,const TDesC& aTextToEscape,TUint aCharSetId);
1.51 + IMPORT_C static void ConArcEncodeL(RReadStream& aSource, CBufBase& aTarget, TUid aConArcEncodingUid);
1.52 + IMPORT_C static void WrapLinesL(CBufBase& aBuffer, TInt aMaxLineLength);
1.53 + IMPORT_C static TBool CheckAndIgnoreCustomErrorL(TInt aError);
1.54 + IMPORT_C static void RemoveEscapeChars(TPtr8& aText);
1.55 + IMPORT_C static void RemoveEscapeChars(HBufC16& aText);
1.56 + IMPORT_C static void RemoveEscapeChars(HBufC16& aText, TUint aCharSetUid);
1.57 + IMPORT_C static void RemoveEscapeChars(TPtr16& aText, TUint aCharSetUid);
1.58 + IMPORT_C static TBool IsNoneWhiteSpaceChar(const TDesC8& aString);
1.59 + IMPORT_C static void StripWhiteSpace(TPtr8& aString);
1.60 + IMPORT_C static void StripWhiteSpace(TPtr16& aString);
1.61 + static inline TBool IsWhiteSpace(TUint aChar);
1.62 + static inline TBool IsBeginOrEnd(TUid aUid);
1.63 + IMPORT_C static TBool IsNoneWhiteSpaceWideChar(const TDesC16& aString);
1.64 + IMPORT_C static CDesCArray* ParseForArrayPropertiesL(TPtr16 aStringValue, TUint aLineCharacterSetId);
1.65 + //
1.66 + IMPORT_C static void AllocateAdditionalPropertyStorageL(CVersitTlsData& aTlsData, CParserProperty& aProperty, TPtr16& aStringValue, TUint aLineCharacterSetId);
1.67 + IMPORT_C static void FreeAdditionalPropertyStorageL(const CParserProperty& aProperty);
1.68 + IMPORT_C static CParserPropertyValue* AdditionalPropertyValueFromStorageL(const CParserProperty& aProperty);
1.69 +
1.70 +private:
1.71 + static void AddEscapedString(TBool aIsShiftJis,TDes& aDestination,const TDesC& aTextToEscape);
1.72 + static const TDesC &VersitUtils::EscapeChar(TBool aIsShiftJis);
1.73 + };
1.74 +
1.75 +inline TBool VersitUtils::IsWhiteSpace(TUint aChar)
1.76 +/** Tests whether the specified character is white space
1.77 +(either a tab or a space character).
1.78 +
1.79 +@param aChar The character to test.
1.80 +@return ETrue if the character is white space, otherwise EFalse. */
1.81 + {return (aChar==CVersitParser::ESpace || aChar==CVersitParser::EHTab);}
1.82 +inline TBool VersitUtils::IsBeginOrEnd(TUid aUid)
1.83 +/** Tests whether the specified UID is the Versit Begin or End UID (KVersitTokenBeginUid
1.84 +or KVersitTokenEndUid).
1.85 +
1.86 +@param aUid The UID to test.
1.87 +@return ETrue if the UID is the Begin or End UID, otherwise EFalse. */
1.88 + {return (aUid.iUid==KVersitTokenBeginUid || aUid.iUid==KVersitTokenEndUid);}
1.89 +#endif