java_stubs/javaregistry/clientserver/common/inc/javapropertyarray.h
branchRCL_3
changeset 8 014f8c42e1d4
child 11 0fdfe802150c
equal deleted inserted replaced
7:9d598f7f02da 8:014f8c42e1d4
       
     1 /*
       
     2 * Copyright (c) 2005-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:  javapropertyarray definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef JAVAPROPERTYARRAY_H
       
    20 #define JAVAPROPERTYARRAY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <s32strm.h>
       
    24 
       
    25 namespace Java
       
    26 {
       
    27 namespace Manager
       
    28 {
       
    29 namespace Registry
       
    30 {
       
    31 
       
    32 class CJavaProperty;
       
    33 
       
    34 /**
       
    35  * This class is a container of CJavaProperty objects references.
       
    36  * The class can externalize and internalize the contained CJavaProperty
       
    37  * objects.
       
    38  *
       
    39  * @since S60 v3.2
       
    40  */
       
    41 class CJavaPropertyArray :
       
    42         public CBase
       
    43 {
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Static method creates a new object of this class.
       
    49      *
       
    50      * @since S60 v3.2
       
    51      * @return a new object of this class.
       
    52      */
       
    53     static CJavaPropertyArray*  NewL();
       
    54 
       
    55     /**
       
    56      * Static method creates a new object of this class and
       
    57      * leaves it on cleanup stack.
       
    58      *
       
    59      * @since S60 v3.2
       
    60      * @return a new object of this class.
       
    61      */
       
    62     static CJavaPropertyArray*  NewLC();
       
    63 
       
    64     /**
       
    65      * Static method creates a new object of this class and initialize it
       
    66      * by creating JavaProperty objects. For initialization of this class
       
    67      * is used the buffer obtained by serialization of another object of
       
    68      * this class. This object will be a clone of the other object from
       
    69      * which the buffer is obtained. The created JavaProperty objects are
       
    70      * owned by the CJavaPropertyArray object.
       
    71      *
       
    72      * @since S60 v3.2
       
    73      * @see SerializedPropertiesL()
       
    74      * @param aBuffer buffer obtained on serialization of another object
       
    75      *          of this class,
       
    76      */
       
    77     static CJavaPropertyArray*  NewL(TDesC8* aBuffer);
       
    78 
       
    79     /**
       
    80      * Static method creates a new object of this class and initialize it
       
    81      * by creating JavaProperty objects. For initialization of this class
       
    82      * is used the buffer obtained by serialization of another object of
       
    83      * this class. This object will be a clone of the other object from
       
    84      * which the buffer is obtained. The created JavaProperty objects are
       
    85      * owned by the CJavaPropertyArray object.
       
    86      *
       
    87      * @since S60 v3.2
       
    88      * @see SerializedPropertiesL()
       
    89      * @param aBuffer buffer obtained on serialization of another object
       
    90      *          of this class,
       
    91      */
       
    92     static CJavaPropertyArray*  NewLC(TDesC8* aBuffer);
       
    93 
       
    94     /**
       
    95      * Appends a property object reference.
       
    96      * The appended property object are not owned by this object.
       
    97      *
       
    98      * @since S60 v3.2
       
    99      * @param aProperty property object reference to be appended to this
       
   100      *          container
       
   101      * @return error code of the operation
       
   102      */
       
   103     TInt Append(CJavaProperty* aProperty);
       
   104 
       
   105     /**
       
   106      * Returns the number of contained property object references.
       
   107      *
       
   108      * @since S60 v3.2
       
   109      * @return number of contained property references
       
   110      */
       
   111     TInt Count();
       
   112 
       
   113     /**
       
   114      * Returns the property object reference located at a specified position.
       
   115      *
       
   116      * @since S60 v3.2
       
   117      * @param aIndex the position of the property object reference
       
   118      * @return the reference of property object at position aIndex
       
   119      */
       
   120     CJavaProperty*  At(TInt aIndex);
       
   121 
       
   122     /**
       
   123      * Internalizes the property objects. It is used by ">>" operator.
       
   124      *
       
   125      * @since S60 v3.2
       
   126      * @param aStream internalization happens from this stream
       
   127      */
       
   128     virtual void InternalizeL(RReadStream& aStream);
       
   129 
       
   130     /**
       
   131      * Externalizes the property objects. It is used by "<<" operator.
       
   132      *
       
   133      * @since S60 v3.2
       
   134      * @param aStream externalization happens in this stream
       
   135      */
       
   136     virtual void ExternalizeL(RWriteStream& aStream) const;
       
   137 
       
   138     /**
       
   139      * Serializes the property objects in a descriptor buffer. This buffer
       
   140      * will be used to reconstruct a new JavaPropertArray object together
       
   141      * with its JavaProperty objects.
       
   142      *
       
   143      * @since S60 v3.2
       
   144      * @see NewL( TDesC8* aBuffer )
       
   145      * @return a buffer containing the property objects in a serialized form
       
   146      */
       
   147     HBufC8* SerializedPropertiesL() const;
       
   148 
       
   149     /**
       
   150      * Returns the size needed for serialization.
       
   151      *
       
   152      * @since S60 v3.2
       
   153      * @return size needed for serialization
       
   154      * @see SerializedPropertiesL
       
   155      */
       
   156     TInt Size() const;
       
   157 
       
   158     /**
       
   159      * Checks if the given property are contained by the property array.
       
   160      *
       
   161      * @since S60 v3.2
       
   162      * @return true if property array contains the given property
       
   163      */
       
   164     TBool Contains(CJavaProperty& aProperty) const;
       
   165 
       
   166     /**
       
   167      * Finds and returns the position of property with the given id.
       
   168      *
       
   169      * @since S60 v3.2
       
   170      * @return the position of the property with the given id or
       
   171      *              KErrNotFound if property does not exists
       
   172      */
       
   173     TInt Find(TInt32 aPropertyId);
       
   174 
       
   175     /**
       
   176      * Destructor
       
   177      *
       
   178      * @since S60 v3.2
       
   179      */
       
   180     ~CJavaPropertyArray();
       
   181 
       
   182 private:
       
   183 
       
   184     void ConstructL(TDesC8* aBuffer);
       
   185 
       
   186     /**
       
   187      * Deletes the contained java property objects
       
   188      * and remove them from the container.
       
   189      *
       
   190      * @since S60 v3.2
       
   191      */
       
   192     void DeleteProperties();
       
   193 
       
   194 private:    //members
       
   195 
       
   196     // contains the java property refernces
       
   197     RPointerArray<CJavaProperty> iProperties;
       
   198 
       
   199     // indicates if the properties are owned or not by the property array
       
   200     TBool iPropertiesOwned;
       
   201 };
       
   202 
       
   203 }//namespace Registry
       
   204 }//namespace Manager
       
   205 }//namespace Java
       
   206 
       
   207 #endif // JAVAPROPERTYARRAY_H
       
   208