homescreenpluginsrv/inc/hspsdomattribute.h
branchRCL_3
changeset 114 a5a39a295112
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Represent single xmluiml attribute
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef hsps_DOM_ATTRIBUTE_H
       
    21 #define hsps_DOM_ATTRIBUTE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <s32strm.h>
       
    26 #include    "mhspsdomlistitem.h"
       
    27 
       
    28 //CLASS FORWARD
       
    29 
       
    30 class ChspsDomStringPool;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Represent attribute name and value as strings. 
       
    36  *
       
    37  * @lib hspsdomdocument.lib
       
    38  * @since S60 5.0
       
    39  * @ingroup group_group_hspsdom
       
    40  */
       
    41 class ChspsDomAttribute : public CBase, public MhspsDomListItem
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44         
       
    45         /**
       
    46         * Two-phased constructor 8 bit.
       
    47         * 
       
    48         * @since S60 5.0
       
    49         * @param aName          Name of attribute.
       
    50         * @param aStringPool    Attached string pool.
       
    51         */
       
    52         IMPORT_C static ChspsDomAttribute* NewL( 
       
    53             const TDesC8& aName, 
       
    54             ChspsDomStringPool& aStringPool );
       
    55 
       
    56         /**
       
    57         * Two-phased constructor 8 bit.
       
    58         * 
       
    59         * @since S60 5.0
       
    60         * @param aName          Name of attribute (String pool index).
       
    61         * @param aStringPool    Attached string pool.
       
    62         */
       
    63         IMPORT_C static ChspsDomAttribute* NewL( 
       
    64             const TInt aName, 
       
    65             ChspsDomStringPool& aStringPool );        
       
    66         
       
    67         /**
       
    68         * Two-phased stream constructor.
       
    69         * 
       
    70         * @since S60 5.0
       
    71         * @param aStream        Source stream.
       
    72         * @param aStringPool    Attached string pool.
       
    73         */
       
    74         static ChspsDomAttribute* NewL( 
       
    75             RReadStream& aStream, 
       
    76             ChspsDomStringPool& aStringPool );
       
    77         
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         IMPORT_C virtual ~ChspsDomAttribute();
       
    82 
       
    83     public: // New functions
       
    84         /**
       
    85         * Makes a copy from original attribute.
       
    86         * 
       
    87         * @since S60 5.0
       
    88         * @return Pointer to attribute. Attribute ownership is transferred to a caller.
       
    89         */
       
    90         IMPORT_C ChspsDomAttribute* CloneL();        
       
    91         
       
    92         /**
       
    93         * Makes a copy from original property.
       
    94         * 
       
    95         * @since S60 5.0
       
    96         * @param aStringPool Original string pool clone.
       
    97         * @param aFastClone     If ETrue, then fast mode cloning is used.
       
    98         * @return Pointer to an attribute. Ownership is transferred to a caller.
       
    99         */
       
   100         ChspsDomAttribute* CloneL( ChspsDomStringPool& aStringPool,
       
   101                                    const TBool aFastClone = EFalse );        
       
   102         
       
   103         /**
       
   104         * Get the attribute value.
       
   105         * 
       
   106         * @since S60 5.0
       
   107         * @return Pointer to a attribute value string. If value is not set KNullDesC8 is returned. 
       
   108         */
       
   109         IMPORT_C const TDesC8& Value();
       
   110         
       
   111         /**
       
   112         * Set attribute value.
       
   113         * 
       
   114         * @since S60 5.0
       
   115         * @param aValue Attribute string value.
       
   116         */
       
   117         IMPORT_C void SetValueL( const TDesC8& aValue );
       
   118         
       
   119         /**
       
   120         * Set attribute value.
       
   121         * 
       
   122         * @since S60 5.0
       
   123         * @param aValue Attribute ref value.
       
   124         */
       
   125         IMPORT_C void SetValueL( const TInt aValue );
       
   126         
       
   127         /**
       
   128         * Get the attributes name string pool index.
       
   129         *  
       
   130         * @since S60 5.0
       
   131         * @return String pool index.
       
   132         */
       
   133         IMPORT_C TInt16 NameStringPoolIndex()const;
       
   134         
       
   135         /**
       
   136         * Get the attributes value string pool index.
       
   137         *  
       
   138         * @since S60 5.0
       
   139         * @return String pool index.
       
   140         */
       
   141         IMPORT_C TInt16 ValueStringPoolIndex()const;
       
   142          
       
   143     public: //From ChspsDomListItem
       
   144         
       
   145         /**
       
   146         * Documented in ChspsDomListItem::Size
       
   147         * 
       
   148         * @since S60 5.0
       
   149         * @return Name.
       
   150         */
       
   151         IMPORT_C const TDesC8& Name();        
       
   152        
       
   153         /**
       
   154         * Documented in ChspsDomListItem::Size.
       
   155         */
       
   156         TInt Size() const;
       
   157         
       
   158         /**
       
   159         * Documented in ChspsDomListItem::Size.
       
   160         */
       
   161         void ExternalizeL( RWriteStream& aStream ) const;
       
   162        
       
   163         /**
       
   164         * Internalize property.
       
   165         * 
       
   166         * @since S60 5.0
       
   167         * @param aStream Input stream.
       
   168         */
       
   169         void InternalizeL( RReadStream& aStream );    
       
   170     private:
       
   171         
       
   172         /**
       
   173         * C++ default constructor.
       
   174         */
       
   175         ChspsDomAttribute( ChspsDomStringPool& aStringPool );
       
   176             
       
   177         /**
       
   178         * By default Symbian 2nd phase constructor is private.
       
   179         */
       
   180         void ConstructL( const TDesC8& aName );
       
   181 
       
   182         /**
       
   183         * By default Symbian 2nd phase constructor is private.
       
   184         */
       
   185         void ConstructL( const TInt aName );        
       
   186      
       
   187     private:    // Data
       
   188         //String pool to get string for references, not owned.
       
   189         ChspsDomStringPool& iStringPool;
       
   190         
       
   191         //Attribute name reference.
       
   192         TInt16         iNameRef;
       
   193         
       
   194         //Attribute value reference.
       
   195         TInt16         iValueRef;
       
   196 
       
   197     };
       
   198 
       
   199 #endif      // hsps_DOM_ATTRIBUTE_H   
       
   200             
       
   201 // End of File