»
         Symbian OS v9.3 »
         Symbian OS reference »
         C++ component reference »
         Application Services VERSIT »
         VersitUtils
      
      
      	   
      
      	   
      
         	   
         
         Location: 
            vstaticutils.h
            
Link against: versit.lib
            
         
         
       
      
      
         class VersitUtils;
         Description
         
         A utility class which provides functions for handling character set conversions, and for the parsing of character strings.
            
         
         
         Members
         
         Defined in VersitUtils:
            
AddEscapedString(), AddEscapedString(), AdditionalPropertyValueFromStorageL(), AllocateAdditionalPropertyStorageL(), CharConvCharSetUid(), CheckAndIgnoreCustomErrorL(), ConArcEncodeL(), ConArcEncodingUid(), DescriptorContainsOnlySevenBitCharacters(), EightBitEncoding(), EightBitEncoding(), FreeAdditionalPropertyStorageL(), IANACharacterSetName(), IANAEncodingName(), IsBeginOrEnd(), IsNoneWhiteSpaceChar(), IsNoneWhiteSpaceWideChar(), IsWhiteSpace(), ParseForArrayPropertiesL(), RemoveEscapeChars(), RemoveEscapeChars(), RemoveEscapeChars(), RemoveEscapeChars(), RequiresEncoding(), StripWhiteSpace(), StripWhiteSpace(), UncodeToNarrowL(), WrapLinesL()
            
         
         
         
       
      
         
         
         
         Member functions
         
      
      
      
      
         static IMPORT_C TBool EightBitEncoding(Versit::TVersitCharSet aCharSet);
         Description
         
         Tests whether the specified character set is encoded using 8 bits or not. For instance ASCII is 7-bit; ISO-8859-1 is 8-bit.
         
         Parameters
         
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the character set uses 8 bits; EFalse if it uses 7 bits.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C TBool EightBitEncoding(TUint aCharSetId);
         Description
         
         Tests whether the character set identified by the specified ID is encoded using 8 bits or not.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TUint aCharSetId | 
                        
                            A character set ID.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the character set uses 8 bits; EFalse if it uses 7 bits.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C TUid ConArcEncodingUid(Versit::TVersitEncoding aEncoding);
         Description
         
         Returns the UID of a character set converter suitable for the specified encoding.
         
         Parameters
         
         
         
         Return value
         
         
            
               
                  
                     
                        TUid
                               | 
                        
                            The UID of a character set converter.  
                         | 
                      
                   
                | 
            
         
         
         See also:
         
         
          
      
      
         static IMPORT_C const TDesC8 &IANACharacterSetName(Versit::TVersitCharSet aCharSet);
         Description
         
         Returns the IANA character set name corresponding to the specified character set identifier.
         
         Parameters
         
         
         
         Return value
         
         
            
               
                  
                     
                        const TDesC8 & | 
                        
                            An IANA character set name.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C const TDesC8 &IANAEncodingName(Versit::TVersitEncoding aEncoding);
         Description
         
         Returns the MIME encoding type corresponding to the specified encoding.
         
         Parameters
         
         
         
         Return value
         
         
            
               
                  
                     
                        const TDesC8 & | 
                        
                            The MIME encoding type corresponding to the specified encoding.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C TUid CharConvCharSetUid(Versit::TVersitCharSet aVersitSet);
         Description
         
         Returns the character converter UID associated with the specified Versit character set identifier.
         
         
         Parameters
         
         
         
         Return value
         
         
            
               
                  
                     
                        TUid
                               | 
                        
                            The character converter UID associated with the specified Versit character set identifier. These UIDs are defined in charconv.h. 
                            
                         | 
                      
                   
                | 
            
         
          
      
         
         
         
         
         DescriptorContainsOnlySevenBitCharacters()
         
       
      
         static IMPORT_C TBool DescriptorContainsOnlySevenBitCharacters(const TDesC &aText);
         Description
         
         Tests whether all of the characters in the specified text can be represented in 7-bit ASCII.
         
         Parameters
         
         
            
               
                  
                     
                        const TDesC &aText | 
                        
                            Text to be tested.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if all of the characters in the specified text can be represented in 7 bit ASCII, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C TBool RequiresEncoding(const TDesC &aText);
         Description
         
         Tests whether the specified text requires encoding.
         
         Parameters
         
         
            
               
                  
                     
                        const TDesC &aText | 
                        
                            Text to be tested.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the specified text needs encoding, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void UncodeToNarrowL(const TDesC &aUnicode, TDes8 &aNarrow, const Versit::TEncodingAndCharset &aEncodingCharset);
         Description
         
         Converts Unicode text to 8-bit, using the specified character set converter.
         
         Parameters
         
         
            
               
                  
                     
                        const TDesC &aUnicode | 
                        
                            The Unicode text to be converted.  
                         | 
                      
                     
                        
                              TDes8 &aNarrow | 
                        
                            On return, the converted text.  
                         | 
                      
                     
                        const Versit::TEncodingAndCharset &aEncodingCharset | 
                        
                            Specifies the character set converter to use.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void AddEscapedString(TDes &aDestination, const TDesC &aTextToEscape, Versit::TVersitCharSet aCharSet);
         Description
         
         Adds an escape character before the semi-colons in a given text string.
         
         Parameters
         
         
          
      
      
         static IMPORT_C void AddEscapedString(TDes &aDestination, const TDesC &aTextToEscape, TUint aCharSetId);
         Description
         
         Adds an escape character before the semi-colons in a given text string.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TDes &aDestination | 
                        
                            On return, the escaped text.  
                         | 
                      
                     
                        const TDesC &aTextToEscape | 
                        
                            Text to be escaped.  
                         | 
                      
                     
                        
                              TUint aCharSetId | 
                        
                            A character set ID. These are defined in charconv.h. 
                            
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void ConArcEncodeL(RReadStream &aSource, CBufBase &aTarget, TUid aConArcEncodingUid);
         Description
         
         Encodes a buffer using the specified character set converter.
         
         Parameters
         
         
          
      
      
         static IMPORT_C void WrapLinesL(CBufBase &aBuffer, TInt aMaxLineLength);
         Description
         
         Ensures that a buffer doesn't contain any lines longer than the specified length.
         
         Any lines longer than the specified length are wrapped.
         
         Parameters
         
         
            
               
                  
                     
                        
                              CBufBase &aBuffer | 
                        
                            Buffer to be wrapped.  
                         | 
                      
                     
                        
                              TInt aMaxLineLength | 
                        
                            The maximum line length.  
                         | 
                      
                   
                | 
            
         
          
      
         
         
         
         
         CheckAndIgnoreCustomErrorL()
         
       
      
         static IMPORT_C TBool CheckAndIgnoreCustomErrorL(TInt aError);
         Description
         
         Tests whether an error code is Versit-specific or not and leaves (with that error code) if it is not.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TInt aError | 
                        
                            Error code to test.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the error code is Versit-specific.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void RemoveEscapeChars(TPtr8 &aText);
         Description
         
         Removes escape characters (backslashes) from the specified 8-bit string.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TPtr8 &aText | 
                        
                            A raw 8-bit string value.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void RemoveEscapeChars(HBufC16 &aText);
         Description
         
         Removes escape characters (backslashes) from the specified 16-bit string.
         
         Parameters
         
         
            
               
                  
                     
                        
                              HBufC16 &aText | 
                        
                            A raw 16-bit string value.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void RemoveEscapeChars(HBufC16 &aText, TUint aCharSetUid);
         Description
         
         Removes escape characters (backslashes or for the Shift-JIS character set, Yen-symbols/backslashes, Shift-JIS behaviour is
            platform dependent) from the specified 16-bit string.
         
         
         Parameters
         
         
            
               
                  
                     
                        
                              HBufC16 &aText | 
                        
                            A raw 16-bit string value.  
                         | 
                      
                     
                        
                              TUint aCharSetUid | 
                        
                            The character set UID of the given 16-bit string; these are defined in charconv.h. This is needed to identify whether or not the character set is Shift-JIS. 
                            
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void RemoveEscapeChars(TPtr16 &aText, TUint aCharSetUid);
         Description
         
         Removes escape characters (backslashes or for the Shift-JIS character set, Yen-symbols/backslashes, Shift-JIS behaviour is
            platform dependent) from the specified 16-bit string.
         
         
         Parameters
         
         
            
               
                  
                     
                        
                              TPtr16 &aText | 
                        
                            A raw 16 bit string value.  
                         | 
                      
                     
                        
                              TUint aCharSetUid | 
                        
                            The character set UID of the aText parameter. This is required to identify the escape character.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C TBool IsNoneWhiteSpaceChar(const TDesC8 &aString);
         Description
         
         Tests whether the specified 8 bit string contains no white spaces.
         
         Any CR/LF pair at the end of the string is disregarded.
         
         Parameters
         
         
            
               
                  
                     
                        const TDesC8 &aString | 
                        
                            The string to test.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the string contains no white spaces, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void StripWhiteSpace(TPtr8 &aString);
         Description
         
         Strips white space from the beginning and end of the specified 8-bit string.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TPtr8 &aString | 
                        
                            A 8-bit string.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static IMPORT_C void StripWhiteSpace(TPtr16 &aString);
         Description
         
         Strips white space from the beginning and end of the specified 16-bit string.
         
         Parameters
         
         
            
               
                  
                     
                        
                              TPtr16 &aString | 
                        
                            A 16-bit string.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static inline TBool IsWhiteSpace(TUint aChar);
         Description
         
         Tests whether the specified character is white space (either a tab or a space character).
         
         Parameters
         
         
            
               
                  
                     
                        
                              TUint aChar | 
                        
                            The character to test.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        
                              TBool
                               | 
                        
                            ETrue if the character is white space, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
      
         static inline TBool IsBeginOrEnd(TUid aUid);
         Description
         
         Tests whether the specified UID is the Versit Begin or End UID (KVersitTokenBeginUid or KVersitTokenEndUid).
         
         
         Parameters
         
         
            
               
                  
                     
                        
                              TUid aUid | 
                        
                            The UID to test.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        
                              TBool
                               | 
                        
                            ETrue if the UID is the Begin or End UID, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
         
         
         
         
         IsNoneWhiteSpaceWideChar()
         
       
      
         static IMPORT_C TBool IsNoneWhiteSpaceWideChar(const TDesC16 &aString);
         Description
         
         Tests whether the specified 16 bit string contains no white spaces.
         
         Any CR/LF pair at the end of the string is disregarded.
         
         Parameters
         
         
            
               
                  
                     
                        const TDesC16 &aString | 
                        
                            The string to test.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        TBool
                               | 
                        
                            ETrue if the string contains no white spaces, otherwise EFalse.  
                         | 
                      
                   
                | 
            
         
          
      
         
         
         
         
         ParseForArrayPropertiesL()
         
       
      
         static IMPORT_C CDesCArray *ParseForArrayPropertiesL(TPtr16 aStringValue, TUint aLineCharacterSetId);
         Description
         
         Parses a compound property value string.
         
         The sub-values found are appended to an array, after removal of escape characters. The array is returned, and ownership is
            transferred to the caller.
         
         
         Parameters
         
         
            
               
                  
                     
                        
                              TPtr16 aStringValue | 
                        
                            Compound property value string to parse for array elements.  
                         | 
                      
                     
                        
                              TUint aLineCharacterSetId | 
                        
                            The character set of the current line. This is required in order to identify the escape character.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
            
               
                  
                     
                        CDesCArray * | 
                        
                            Array of property values found in the string.  
                         | 
                      
                   
                | 
            
         
          
      
         
         
         
         
         AllocateAdditionalPropertyStorageL()
         
       
      
         static IMPORT_C void AllocateAdditionalPropertyStorageL(CVersitTlsData &aTlsData, CParserProperty &aProperty, TPtr16 &aStringValue,
               TUint aLineCharacterSetId);
         Description
         
         Allocates an additional property value object for certain CParserProperty objects.
         
         
         This is needed to support the parsing and storage of Japanese pronunciation SOUND properties. Due to the existing Symbian
            Versit architecture, it was not possible to change the underlying storage type of the SOUND property to an array data type. Therefore,
            this method provides a means of storing the array-based value which can be retrieved when necessary.
         
         
         It is called by CParserVCard::MakePropertyValueSoundL().
         
         
         Parameters
         
         
          
      
         
         
         
         
         FreeAdditionalPropertyStorageL()
         
       
      
         static IMPORT_C void FreeAdditionalPropertyStorageL(const CParserProperty &aProperty);
         Description
         
         Frees any additional storage associated with the specified property.
         
         Additional storage may have previously been allocated using AllocateAdditionalPropertyStorageL().
         
         
         This is called by CParserProperty's destructor.
         
         Parameters
         
         
            
               
                  
                     
                        const CParserProperty &aProperty | 
                        
                            The property which may have additional storage associated with it.  
                         | 
                      
                   
                | 
            
         
         
         See also:
         
         
          
      
         
         
         
         
         AdditionalPropertyValueFromStorageL()
         
       
      
         static IMPORT_C CParserPropertyValue *AdditionalPropertyValueFromStorageL(const CParserProperty &aProperty);
         Description
         
         Retrieves any additional storage property value associated with the specified property.
         
         Parameters
         
         
            
               
                  
                     
                        const CParserProperty &aProperty | 
                        
                            The property that may have additional associated data.  
                         | 
                      
                   
                | 
            
         
         
         Return value
         
         
         
         See also: