javaextensions/pim/framework/inc.s60/cpimvaluebase.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     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:  Class for holding PIM field values
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPIMVALUEBASE_H
       
    20 #define CPIMVALUEBASE_H
       
    21 
       
    22 // INTERNAL INCLUDES
       
    23 #include "pimtypes.h"
       
    24 
       
    25 // EXTERNAL INCLUDES
       
    26 #include <e32std.h>
       
    27 #include <badesca.h>
       
    28 
       
    29 /**
       
    30  * Class for holding PIM field values
       
    31  * @since S60 v3.1
       
    32  */
       
    33 NONSHARABLE_CLASS(CPIMValueBase) : public CBase
       
    34 {
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Destructor
       
    39      */
       
    40     virtual ~CPIMValueBase();
       
    41 
       
    42 public: // New methods
       
    43 
       
    44     /**
       
    45      * SetValue
       
    46      * Sets new integer value for this field
       
    47      * value holder. The old value will be overwritten
       
    48      *
       
    49      * @param aIntegerValue New value
       
    50      */
       
    51     virtual void SetIntValue(TInt aIntegerValue);
       
    52 
       
    53     /**
       
    54      * SetValue
       
    55      * Sets new boolean value for this field
       
    56      * value holder. The old value will be overwritten
       
    57      *
       
    58      * @param aBooleanValue New value
       
    59      */
       
    60     virtual void SetBooleanValue(TBool aBooleanValue);
       
    61 
       
    62     /**
       
    63      * SetValue
       
    64      * Sets new date value for this field
       
    65      * value holder. The old value will be overwritten
       
    66      *
       
    67      * @param aDateValue New value
       
    68      */
       
    69     virtual void SetDateValue(TPIMDate aDateValue);
       
    70 
       
    71     /**
       
    72      * SetValue
       
    73      * Sets new string value for this field
       
    74      * value holder. The old value will be overwritten
       
    75      * The ownership of the value is transferred to this class
       
    76      *
       
    77      * @param aStringValue New value
       
    78      */
       
    79     virtual void SetStringValue(const HBufC* aStringValue);
       
    80 
       
    81     /**
       
    82      * SetValue
       
    83      * Sets new string array value for this field
       
    84      * value holder. The old value will be overwritten
       
    85      * The ownership of the value is transferred to this class
       
    86      *
       
    87      * @param aStringArrayValue New value
       
    88      */
       
    89     virtual void SetStringArrayValue(
       
    90         const CDesCArray* aStringArrayValue);
       
    91 
       
    92     /**
       
    93      * SetValue
       
    94      * Sets new binary value for this field
       
    95      * value holder. The old value will be overwritten
       
    96      * The ownership of the value is transferred to this class
       
    97      *
       
    98      * @param aBinaryValue New value
       
    99      */
       
   100     virtual void SetBinaryValue(const CPIMByteArray* aBinaryValue);
       
   101 
       
   102     /**
       
   103      * Value. Returns an integer value of this value holder
       
   104      * @return Integer value
       
   105      */
       
   106     virtual TInt IntValue() const;
       
   107 
       
   108     /**
       
   109      * Value. Returns a boolean value of this value holder
       
   110      * @return Boolean value
       
   111      */
       
   112     virtual TBool BooleanValue() const;
       
   113 
       
   114     /**
       
   115      * Value. Returns a date value of this value holder
       
   116      * @return Date value
       
   117      */
       
   118     virtual TPIMDate DateValue() const;
       
   119 
       
   120     /**
       
   121      * Value. Returns a string value of this value holder
       
   122      * Ownership of the value is NOT transferred to the caller
       
   123      * @return String value
       
   124      */
       
   125     virtual const HBufC* StringValue() const;
       
   126 
       
   127     /**
       
   128      * Value. Returns a string array value of this value holder
       
   129      * Ownership of the value is NOT transferred to the caller
       
   130      * @return String array value
       
   131      */
       
   132     virtual const CDesCArray* StringArrayValue() const;
       
   133 
       
   134     /**
       
   135      * Value. Returns a binary value of this value holder
       
   136      * Ownership of the value is NOT transferred to the caller
       
   137      * @return Binary value
       
   138      */
       
   139     virtual const CPIMByteArray* BinaryValue() const;
       
   140 
       
   141     /**
       
   142      * Returns the number of elements in this value
       
   143      * @return Number of elements in this value
       
   144      */
       
   145     virtual TInt NumElements() const;
       
   146 
       
   147 public: // New methods
       
   148 
       
   149     /**
       
   150      * SetInternalAttributes
       
   151      * Sets internal attributes of this value. These are not
       
   152      * accessible via PIM API but must not be lost when item
       
   153      * is converted from the native database
       
   154      *
       
   155      * @param aAttributes New internal attributes. Old ones will
       
   156      *        be overwriten.
       
   157      */
       
   158     void SetInternalAttributes(CArrayFix< TUid>* aInternalAttributes);
       
   159 
       
   160     /**
       
   161      * SetAttributes
       
   162      * Sets attributes of of this value. Used with PIM item
       
   163      * attribute handling
       
   164      *
       
   165      * @param aAttributes New attributes
       
   166      */
       
   167     void SetAttributes(TPIMAttribute aAttributes);
       
   168 
       
   169     /**
       
   170      * Returns the internal attributes of this value.
       
   171      * The returned value can be NULL which indicates that
       
   172      * there is no internal attributes in this field. NOTE the
       
   173      * ownership is NOT transferred to the caller
       
   174      *
       
   175      * @return Internal attributes of this value. NULL is returned
       
   176      *         if there is no internal attributes
       
   177      */
       
   178     const CArrayFix< TUid>& InternalAttributes() const;
       
   179 
       
   180     /**
       
   181      * @return Attributes of this value
       
   182      */
       
   183     const TPIMAttribute& Attributes() const;
       
   184 
       
   185     /**
       
   186      * SetLabels
       
   187      * Sets value labels. The array holds all labels including
       
   188      * string array field labels and normal field labels
       
   189      *
       
   190      * @param aValueLabels New labels for this value
       
   191      */
       
   192     void SetLabels(CDesCArray* aValueLabels);
       
   193 
       
   194     /**
       
   195      * Labels
       
   196      * Returns the labels of this value
       
   197      *
       
   198      * @return Labels of associated with this value
       
   199      */
       
   200     CDesCArray* Labels() const;
       
   201 
       
   202 protected:
       
   203 
       
   204     /**
       
   205      * C++ default constructor
       
   206      */
       
   207     CPIMValueBase(TPIMAttribute aAttributes);
       
   208 
       
   209 protected: // Data
       
   210 
       
   211     // PIM item attributes
       
   212     TPIMAttribute iAttributes;
       
   213 
       
   214     // Labels of this value. Owned
       
   215     CDesCArray* iLabelArray;
       
   216 
       
   217     // Internal attributes. Owned
       
   218     CArrayFix< TUid>* iInternalAttributes;
       
   219 };
       
   220 
       
   221 #endif // CPIMVALUEBASE_H
       
   222 // End of file