contentstorage/cautils/inc/caentryattribute.h
author hgs
Fri, 28 May 2010 16:17:03 +0300
changeset 96 5d243a69bdda
parent 92 782e3408c2ab
child 107 b34d53f6acdf
permissions -rw-r--r--
201021
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
 * Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
 * Description: Definition of entry attribute
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#ifndef __CAENTRYATTRIBUTE_H__
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define __CAENTRYATTRIBUTE_H__
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
#include <e32base.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
//FORWARD DECLARATIONS
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
class RWriteStream;
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
class RReadStream;
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
/**
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
 *  CA entry attribute.
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
 *  @lib .lib
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
 *  @since S60 v5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
NONSHARABLE_CLASS( CCaEntryAttribute ): public CBase
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
     * Destructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
    virtual ~CCaEntryAttribute();
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
     * Two-phased constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
     * @param aName Attribute name.
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
     * @return The created object.
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
    IMPORT_C static CCaEntryAttribute* NewL( const TDesC& aName );
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
     * Two-phased constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
     * @param aName Attribute name.
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
     * @return The created object.
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    IMPORT_C static CCaEntryAttribute* NewLC( const TDesC& aName );
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
     * Get name.
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
     * @return Name.
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    TPtrC Name() const
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
        return iName;
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
     * Get value.
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
     * @return Value, or NULL if attribute is not set.
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    TPtrC Value() const
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
        return iValue;
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
     * Set value. Sets changed status as appropriate.
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
     * @param aValue Value, or NULL if attribute is not set (==remove attr).
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
     * Ownership taken.
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
    IMPORT_C void SetValueL( const TDesC& aName );
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
     * Externalizes array to the stream
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
     * @param aStream a write stream
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
    void ExternalizeL( RWriteStream& aStream ) const;
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
     * Internalizes stream to the array
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
     * @param aStream a read stream
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
    void InternalizeL( RReadStream& aStream );
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
protected:
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
     * Second phased constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
     * @param aName Attribute name.
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
    void ConstructL( const TDesC& aName );
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
    // data
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
7feec50967db 201003_02
hgs
parents:
diff changeset
   104
    /*
7feec50967db 201003_02
hgs
parents:
diff changeset
   105
     * Attribute name. Own
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
    RBuf iName;
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
    /*
7feec50967db 201003_02
hgs
parents:
diff changeset
   110
     * Attribute value. Own
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
    RBuf iValue;
7feec50967db 201003_02
hgs
parents:
diff changeset
   113
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
    };
7feec50967db 201003_02
hgs
parents:
diff changeset
   115
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
/**
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
 * Attribute array.
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
 *  @lib camenu.lib
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
 *  @since S60 v5.0
7feec50967db 201003_02
hgs
parents:
diff changeset
   120
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   121
NONSHARABLE_CLASS( RCaEntryAttrArray ): public RPointerArray<CCaEntryAttribute>
7feec50967db 201003_02
hgs
parents:
diff changeset
   122
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
   123
7feec50967db 201003_02
hgs
parents:
diff changeset
   124
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
   125
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   126
     * Find attribute by name.
7feec50967db 201003_02
hgs
parents:
diff changeset
   127
     * @param aId Id.
7feec50967db 201003_02
hgs
parents:
diff changeset
   128
     * @param aName Name.
7feec50967db 201003_02
hgs
parents:
diff changeset
   129
     * @param aAttr Attribute value.
7feec50967db 201003_02
hgs
parents:
diff changeset
   130
     * @return TBool ,ETrue if attribute was found
7feec50967db 201003_02
hgs
parents:
diff changeset
   131
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   132
    IMPORT_C TBool Find( const TDesC& aName, TDes& aAttrVal );
7feec50967db 201003_02
hgs
parents:
diff changeset
   133
92
hgs
parents: 85
diff changeset
   134
    /**
hgs
parents: 85
diff changeset
   135
     * Find attribute by name.
hgs
parents: 85
diff changeset
   136
     * @param aId Id.
hgs
parents: 85
diff changeset
   137
     * @param aName Name.
hgs
parents: 85
diff changeset
   138
     * @param aAttr Attribute value.
hgs
parents: 85
diff changeset
   139
     * @return TBool, ETrue if attribute was found
hgs
parents: 85
diff changeset
   140
     */
hgs
parents: 85
diff changeset
   141
    IMPORT_C TBool Find( const TDesC& aName, TPtrC& aAttrVal );
hgs
parents: 85
diff changeset
   142
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   143
    /*
7feec50967db 201003_02
hgs
parents:
diff changeset
   144
     * Check if attribute exists
7feec50967db 201003_02
hgs
parents:
diff changeset
   145
     * @param aId Id
7feec50967db 201003_02
hgs
parents:
diff changeset
   146
     * @param aName Name
7feec50967db 201003_02
hgs
parents:
diff changeset
   147
     * @return ETrue if attribute exists
7feec50967db 201003_02
hgs
parents:
diff changeset
   148
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   149
    IMPORT_C TBool Exist( const TDesC& aName );
7feec50967db 201003_02
hgs
parents:
diff changeset
   150
7feec50967db 201003_02
hgs
parents:
diff changeset
   151
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   152
     * Remove attribute
7feec50967db 201003_02
hgs
parents:
diff changeset
   153
     * @param aId Id.
7feec50967db 201003_02
hgs
parents:
diff changeset
   154
     * @param aAttrName Attribute name
7feec50967db 201003_02
hgs
parents:
diff changeset
   155
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   156
    IMPORT_C void RemoveAttribute( const TDesC& aAttrName );
7feec50967db 201003_02
hgs
parents:
diff changeset
   157
7feec50967db 201003_02
hgs
parents:
diff changeset
   158
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   159
     * Externalizes array to the stream
7feec50967db 201003_02
hgs
parents:
diff changeset
   160
     * @param aStream a write stream
7feec50967db 201003_02
hgs
parents:
diff changeset
   161
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   162
    void ExternalizeL( RWriteStream& aStream ) const;
7feec50967db 201003_02
hgs
parents:
diff changeset
   163
7feec50967db 201003_02
hgs
parents:
diff changeset
   164
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   165
     * Internalizes stream to the array
7feec50967db 201003_02
hgs
parents:
diff changeset
   166
     * @param aStream a read stream
7feec50967db 201003_02
hgs
parents:
diff changeset
   167
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   168
    void InternalizeL( RReadStream& aStream );
7feec50967db 201003_02
hgs
parents:
diff changeset
   169
7feec50967db 201003_02
hgs
parents:
diff changeset
   170
    };
7feec50967db 201003_02
hgs
parents:
diff changeset
   171
7feec50967db 201003_02
hgs
parents:
diff changeset
   172
#endif // __CAENTRYATTRIBUTE_H__