cbs/CbsServer/ServerInc/CCbsRecDecoder.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 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 "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:  This file contains the header file of the CCbsRecDecoder class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCBSRECDECODER_H
       
    20 #define CCBSRECDECODER_H
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 class CCnvCharacterSetConverter;
       
    30 class CCbsRecMessage;
       
    31 class CCbsRecWcdmaMessage;
       
    32 class CCbsMessage;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *   CCbsRecDecoder handles decoding of message contents.
       
    38 *
       
    39 *   CbsServer receives messages stored in 8-bit descriptors
       
    40 *   from ETel. This class converts them into 16-bit descriptors
       
    41 *   and decodes the message representation into UCS-2 (which
       
    42 *   is used by Symbian OS internally). 
       
    43 *  
       
    44 */
       
    45 class CCbsRecDecoder : public CBase
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48         
       
    49         /**
       
    50         *   Two-phased constructor.
       
    51         *
       
    52         *   @returns                    New instance of CCbsRecDecoder.
       
    53         */
       
    54          static CCbsRecDecoder* NewL();
       
    55         
       
    56         /**
       
    57         *   Destructor.
       
    58         */
       
    59         virtual ~CCbsRecDecoder();
       
    60 
       
    61     public:  // New functions
       
    62 
       
    63         /**
       
    64         *   Decodes message page into Unicode representation.
       
    65         *
       
    66         *   If the message has a language indication prefixed
       
    67         *   in the message body, the indication is removed.
       
    68         *
       
    69         *   Compressed messages are not supported.
       
    70         *   
       
    71         *   Leave reasons:
       
    72         *   KErrNotSupported    Message compressed or of unsupported character
       
    73         *                       coding.
       
    74         *   KErrNoMemory        OOM.
       
    75         *   KErrGeneral         Failed due to other reasons.
       
    76         *
       
    77         *   @param aMessage Message page.
       
    78         */
       
    79         void DecodeL( CCbsMessage& aMessage );
       
    80       
       
    81     private:  // New functions
       
    82 
       
    83         // Default constructor.
       
    84         CCbsRecDecoder();
       
    85 
       
    86         // Prohibited copy constructor.
       
    87         CCbsRecDecoder( const CCbsRecDecoder& );
       
    88 
       
    89         // Prohibited assignment operator.
       
    90         CCbsRecDecoder& operator=( const CCbsRecDecoder& );
       
    91 
       
    92         /**
       
    93         *   2nd-phase constructor. 
       
    94         */
       
    95         void ConstructL();
       
    96 
       
    97         /**
       
    98         *   Decodes the given message's content.
       
    99         *
       
   100         *   @param aMessage             CB message
       
   101         */
       
   102         void DoDecodeL( CCbsMessage& aMessage );
       
   103 
       
   104         /**
       
   105         *   Decodes 8-bit and Unicode message representations.
       
   106         *
       
   107         *   @param aMsg                 CB message encoded in UCS2
       
   108         */
       
   109         void UnicodeDecodeL( CCbsMessage& aMsg );
       
   110 
       
   111         /**
       
   112         *   Decodes 7-bit message representation.
       
   113         *
       
   114         *   @param aMsg                 CB message encoded in 7-bit
       
   115         */
       
   116         void DefaultAlphabetDecodeL( CCbsMessage& aMsg );
       
   117         
       
   118         /**
       
   119         *   Decodes 8-bit message representation.
       
   120         *
       
   121         *   @param aMsg                 CB message encoded in 8-bit
       
   122         */
       
   123         void EightbitAlphabetDecodeL( CCbsMessage& aMsg );
       
   124 
       
   125         /**
       
   126         *   Removes the trailing CRs from a message.
       
   127         *
       
   128         *   @param aText                Text from which the CR is to be removed
       
   129         */
       
   130         TPtrC RemoveTrailingCR( const TDesC& aText );
       
   131         
       
   132         /**
       
   133         *   Removes trailing CRs and LFs from a 7-bit Cell info message.
       
   134         *
       
   135         *   @param aText                Text from which the CR is to be removed
       
   136         *   @return                     Text with no CRs or LFs        
       
   137         */
       
   138         TPtrC8 RemoveTrailingControlChars( const TDesC8& aText );
       
   139         
       
   140    private:    // Data
       
   141         // Own: character converter for 8-bit and UCS2 encodings
       
   142         CCnvCharacterSetConverter* iConverter;
       
   143 
       
   144         // File server session
       
   145         RFs iFs;
       
   146     };
       
   147 
       
   148 #endif      // CBSRECDECODER_H
       
   149             
       
   150 // End of File