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