homescreenpluginsrv/inc/hspsdomattribute.h
changeset 0 79c6a41cd166
child 12 502e5d91ad42
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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 stream constructor.
       
    58         * 
       
    59         * @since S60 5.0
       
    60         * @param aStream        Source stream.
       
    61         * @param aStringPool    Attached string pool.
       
    62         */
       
    63         static ChspsDomAttribute* NewL( 
       
    64             RReadStream& aStream, 
       
    65             ChspsDomStringPool& aStringPool );
       
    66         
       
    67         /**
       
    68         * Destructor.
       
    69         */
       
    70         IMPORT_C virtual ~ChspsDomAttribute();
       
    71 
       
    72     public: // New functions
       
    73         /**
       
    74         * Makes a copy from original attribute.
       
    75         * 
       
    76         * @since S60 5.0
       
    77         * @return Pointer to attribute. Attribute ownership is transferred to a caller.
       
    78         */
       
    79         IMPORT_C ChspsDomAttribute* CloneL();        
       
    80         
       
    81         /**
       
    82         * Makes a copy from original property.
       
    83         * 
       
    84         * @since S60 5.0
       
    85         * @param aStringPool Original string pool clone.
       
    86         * @return Pointer to an attribute. Ownership is transferred to a caller.
       
    87         */
       
    88         ChspsDomAttribute* CloneL( ChspsDomStringPool& aStringPool );        
       
    89         
       
    90         /**
       
    91         * Get the attribute value.
       
    92         * 
       
    93         * @since S60 5.0
       
    94         * @return Pointer to a attribute value string. If value is not set KNullDesC8 is returned. 
       
    95         */
       
    96         IMPORT_C const TDesC8& Value();
       
    97         
       
    98         /**
       
    99         * Set attribute value.
       
   100         * 
       
   101         * @since S60 5.0
       
   102         * @param aValue Attribute string value.
       
   103         */
       
   104         IMPORT_C void SetValueL( const TDesC8& aValue );
       
   105         
       
   106         /**
       
   107         * Get the attributes name string pool index.
       
   108         *  
       
   109         * @since S60 5.0
       
   110         * @return String pool index.
       
   111         */
       
   112         IMPORT_C TInt16 NameStringPoolIndex()const;
       
   113         
       
   114         /**
       
   115         * Get the attributes value string pool index.
       
   116         *  
       
   117         * @since S60 5.0
       
   118         * @return String pool index.
       
   119         */
       
   120         IMPORT_C TInt16 ValueStringPoolIndex()const;
       
   121          
       
   122     public: //From ChspsDomListItem
       
   123         
       
   124         /**
       
   125         * Documented in ChspsDomListItem::Size
       
   126         * 
       
   127         * @since S60 5.0
       
   128         * @return Name.
       
   129         */
       
   130         IMPORT_C const TDesC8& Name();
       
   131         
       
   132        
       
   133         /**
       
   134         * Documented in ChspsDomListItem::Size.
       
   135         */
       
   136         TInt Size() const;
       
   137         
       
   138         /**
       
   139         * Documented in ChspsDomListItem::Size.
       
   140         */
       
   141         void ExternalizeL( RWriteStream& aStream ) const;
       
   142        
       
   143         /**
       
   144         * Internalize property.
       
   145         * 
       
   146         * @since S60 5.0
       
   147         * @param aStream Input stream.
       
   148         */
       
   149         void InternalizeL( RReadStream& aStream );    
       
   150     private:
       
   151         
       
   152         /**
       
   153         * C++ default constructor.
       
   154         */
       
   155         ChspsDomAttribute( ChspsDomStringPool& aStringPool );
       
   156             
       
   157         /**
       
   158         * By default Symbian 2nd phase constructor is private.
       
   159         */
       
   160         void ConstructL( const TDesC8& aName );
       
   161 
       
   162      
       
   163     private:    // Data
       
   164         //String pool to get string for references, not owned.
       
   165         ChspsDomStringPool& iStringPool;
       
   166         
       
   167         //Attribute name reference.
       
   168         TInt16         iNameRef;
       
   169         
       
   170         //Attribute value reference.
       
   171         TInt16         iValueRef;
       
   172 
       
   173     };
       
   174 
       
   175 #endif      // hsps_DOM_ATTRIBUTE_H   
       
   176             
       
   177 // End of File