simpleengine/xmlutils/inc/simpleattribute.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2006 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:   SIMPLE attribute
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef simpleattribute_H
       
    22 #define simpleattribute_H
       
    23 
       
    24 #include <e32std.h>
       
    25 // #include "simplecommon.h"
       
    26 #include "msimpleattribute.h"
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class CSenBaseAttribute;
       
    30 
       
    31 
       
    32 /**
       
    33  *  CSimpleAttribute
       
    34  *
       
    35  *  SIMPLE attribute.
       
    36  *
       
    37  *  @lib simplexmlutils
       
    38  *  @since S60 v3.1
       
    39  */
       
    40 
       
    41 class CSimpleAttribute : public CBase, public MSimpleAttribute
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46 
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      * @since S60 v3.1
       
    50      * @param aName:    Name of the attribute
       
    51      * @param aValue:   Attribute's value.
       
    52      * @return CSimpleAttribute
       
    53      */
       
    54     static CSimpleAttribute* NewL(
       
    55         const TDesC8& aName,
       
    56         const TDesC8& aValue );
       
    57 
       
    58     /**
       
    59      * Two-phased constructor.
       
    60      * @since S60 v3.1
       
    61      */
       
    62     static CSimpleAttribute* NewL(
       
    63         CSenBaseAttribute* aAttr );
       
    64 
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     virtual ~CSimpleAttribute();
       
    69 
       
    70     /**
       
    71      * @return Base class implementation
       
    72      */
       
    73     CSenBaseAttribute* BaseElement();
       
    74 
       
    75 // from base class MSimpleAttribute
       
    76 
       
    77     /**
       
    78      * From MSimpleAttribute
       
    79      * Getter for the attribute name.
       
    80      * @since Series60 3.1
       
    81      * @return the attribute name.
       
    82      */
       
    83     const TDesC8& Name();
       
    84 
       
    85     /**
       
    86      * From MSimpleAttribute
       
    87      * Getter for the attribute value.
       
    88      * @since Series60 3.1
       
    89      * @return the attribute value.
       
    90      */
       
    91     const TDesC8& Value();
       
    92 
       
    93     /**
       
    94      * From MSimpleAttribute
       
    95      * Getter for the attribute value in UNICODE.
       
    96      * @since Series60 3.1
       
    97      * @return the attribute value. Ownership is transferred.
       
    98      */
       
    99     HBufC* ValueUniLC();
       
   100 
       
   101     /**
       
   102      * From MSimpleAttribute
       
   103      * Setter for the attribute value.
       
   104      * This makes conversion from 16-bit to 8-bit.
       
   105      *
       
   106      * @since Series60 3.1
       
   107      * @param aValue: value to be set
       
   108      */
       
   109     void SetValueL( const TDesC& aValue );
       
   110 
       
   111 private:
       
   112 
       
   113     /**
       
   114      * Two-phase constructor
       
   115      * @param aName:    Name of the attribute
       
   116      * @param aValue:   Attribute's value.
       
   117      */
       
   118     void ConstructL(
       
   119         const TDesC8& aName,
       
   120         const TDesC8& aValue );
       
   121 
       
   122     /**
       
   123      * Two-phase constructor
       
   124      * @param aAttr:    Base element
       
   125      */
       
   126     void ConstructL(
       
   127         CSenBaseAttribute* aAttr );
       
   128 
       
   129     /**
       
   130      * constructor
       
   131      */
       
   132     CSimpleAttribute();
       
   133 
       
   134 
       
   135 private: // data
       
   136 
       
   137     /**
       
   138      * Base element when created from scratch
       
   139      * Own.
       
   140      */
       
   141     CSenBaseAttribute*    iBase;
       
   142 
       
   143     /**
       
   144      * Base element when only reference to base element
       
   145      * Not own.
       
   146      */
       
   147     CSenBaseAttribute*    iRef;
       
   148 
       
   149     };
       
   150 
       
   151 #endif      // simpleattribute_H
       
   152 
       
   153 // End of File