mds_plat/metadata_engine_api/inc/mdenamespacedef.h
changeset 58 fe894bb075c2
parent 51 87e65c44ff3a
child 60 79f826a55db2
equal deleted inserted replaced
51:87e65c44ff3a 58:fe894bb075c2
     1 /*
       
     2 * Copyright (c) 2009 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MDENAMESPACEDEF_H__
       
    19 #define __MDENAMESPACEDEF_H__
       
    20 
       
    21 
       
    22 #include <mdccommon.h>
       
    23 
       
    24 class CMdESession;
       
    25 class CMdCSerializationBuffer;
       
    26 class CMdERelationDef;
       
    27 class CMdEEventDef;
       
    28 class CMdEObjectDef;
       
    29 
       
    30 class TMdCNamespaceDef;
       
    31 
       
    32 
       
    33 /**
       
    34  * Namespace definition.
       
    35  */
       
    36 NONSHARABLE_CLASS(CMdENamespaceDef) : public CBase
       
    37 	{
       
    38 public:
       
    39 	/**
       
    40 	 * Returns whether the namespace is read only.
       
    41 	 *
       
    42 	 * @return  <code>ETrue</code>, if the namespace is read only;
       
    43 	 *          <code>EFalse</code>, otherwise
       
    44 	 */
       
    45 	IMPORT_C TBool ReadOnly() const;
       
    46 
       
    47 	/**
       
    48 	 * Returns the name of the item.
       
    49 	 *
       
    50 	 * @return  name
       
    51 	 */
       
    52 	IMPORT_C const TDesC& Name() const;
       
    53 
       
    54 	/**
       
    55 	 * Compare this namespace definition with other namespace definition.
       
    56 	 *
       
    57 	 * @param aNamespaceDef other namespace definition
       
    58 	 *
       
    59 	 * @return  0 if namespaces are same, 1 or more if this is greater than other 
       
    60 	 *          and -1 or less if this is less than other.
       
    61 	 */
       
    62 	IMPORT_C TInt Compare(const CMdENamespaceDef& aNamespaceDef) const;
       
    63 	
       
    64 	/**
       
    65 	 * Returns the number of object definitions.
       
    66 	 *
       
    67 	 * @return  number of object definitions
       
    68 	 */
       
    69 	IMPORT_C TInt ObjectDefCount() const;
       
    70 
       
    71 	/**
       
    72 	 * Returns the object definition at the specified index.
       
    73 	 *
       
    74 	 * @param aIndex  index
       
    75 	 *
       
    76 	 * @return  object definition or leave, if there is no object definition
       
    77 	 *          with the specified name.	
       
    78 	 *
       
    79 	 * @panics if aIndex is out of bounds	 
       
    80 	 */
       
    81 	IMPORT_C CMdEObjectDef& ObjectDefL(TInt aIndex);
       
    82 
       
    83 	/**
       
    84 	 * Returns the object definition with the specified name.
       
    85 	 *
       
    86 	 * @param aName       name
       
    87 	 *
       
    88 	 * @return  object definition or leave, if there is no object definition
       
    89 	 *          with the specified name.	 
       
    90 	 */
       
    91 	IMPORT_C CMdEObjectDef& GetObjectDefL(const TDesC& aName);
       
    92 		
       
    93 	/**
       
    94 	 * Returns the number of relation definitions.
       
    95 	 *
       
    96 	 * @return  number of relation definitions
       
    97 	 */
       
    98 	IMPORT_C TInt RelationDefCount() const;
       
    99 
       
   100 	/**
       
   101 	 * Returns the relation definition at the specified index.
       
   102 	 *
       
   103 	 * @param aIndex  index
       
   104 	 *
       
   105 	 * @return  relation definition or leave, if there is no object definition
       
   106 	 *          with the specified name.	
       
   107 	 */
       
   108 	IMPORT_C CMdERelationDef& RelationDefL(TInt aIndex);
       
   109 
       
   110 	/**
       
   111 	 * Returns the relation definition with the specified name.
       
   112 	 *
       
   113 	 * @param aName       name
       
   114 	 *
       
   115 	 * @return  relation definition or leave, if there is no object definition
       
   116 	 *          with the specified name.	
       
   117 	 *
       
   118 	 * @panics if aIndex is out of bounds	 
       
   119 	 */
       
   120 	IMPORT_C CMdERelationDef& GetRelationDefL(const TDesC& aName);
       
   121 
       
   122 	/**
       
   123 	 * Returns the number of event definitions. 
       
   124 	 *
       
   125 	 * @return  number of event definitions
       
   126 	 */
       
   127 	IMPORT_C TInt EventDefCount() const;
       
   128 
       
   129 	/**
       
   130 	 * Returns the event definition at the specified index.
       
   131 	 *
       
   132 	 * @param aIndex  index
       
   133 	 *
       
   134 	 * @return  event definition or leave, if there is no object definition
       
   135 	 *          with the specified name.	
       
   136 	 * 
       
   137 	 * @panics if aIndex is out of bounds
       
   138 	 */
       
   139 	IMPORT_C CMdEEventDef& EventDefL(TInt aIndex);
       
   140 
       
   141 	/**
       
   142 	 * Returns the event definition with the specified name.
       
   143 	 *
       
   144 	 * @param aName       name
       
   145 	 *
       
   146 	 * @return  event definition or leave, if there is no object definition
       
   147 	 *          with the specified name.	
       
   148 	 */
       
   149 	IMPORT_C CMdEEventDef& GetEventDefL(const TDesC& aName);
       
   150 
       
   151 public:
       
   152 	static CMdENamespaceDef* NewL(const CMdESession& aMdeSession, 
       
   153 			const TMdCNamespaceDef& aNamespaceDef, 
       
   154 			CMdCSerializationBuffer& aSchemaBuffer);
       
   155 
       
   156 	static CMdENamespaceDef* NewLC(const CMdESession& aMdeSession, 
       
   157 			const TMdCNamespaceDef& aNamespaceDef, 
       
   158 			CMdCSerializationBuffer& aSchemaBuffer);
       
   159 		
       
   160 	/**
       
   161 	 * Destructor.
       
   162 	 */
       
   163 	virtual ~CMdENamespaceDef();
       
   164 	
       
   165 	TDefId Id() const;		
       
   166 	
       
   167 	/**
       
   168 	 * Returns the object definition with the specified id.
       
   169 	 *
       
   170 	 * @param aId       id
       
   171 	 *
       
   172 	 * @return  object definition; or 0, if there is no object definition
       
   173 	 *          with the specified id
       
   174 	 */
       
   175 	CMdEObjectDef* GetObjectDefL(TDefId aId);	
       
   176 
       
   177 	/**
       
   178 	 * Returns the relation definition with the specified id.
       
   179 	 *
       
   180 	 * @param aId       id
       
   181 	 *
       
   182 	 * @return  relation definition; or 0, if there is no relation definition
       
   183 	 *          with the specified id
       
   184 	 */
       
   185 	CMdERelationDef* GetRelationDefL(TDefId aId);
       
   186 
       
   187 	/**
       
   188 	 * Returns the event definition with the specified id.
       
   189 	 *
       
   190 	 * @param aId       id
       
   191 	 *
       
   192 	 * @return  event definition; or 0, if there is no event definition
       
   193 	 *          with the specified id
       
   194 	 */
       
   195 	CMdEEventDef* GetEventDefL(TDefId aId);
       
   196 	
       
   197 	/**
       
   198 	 * Returns the MdE session where namespace definition belongs.
       
   199 	 *
       
   200 	 * @return MdE session
       
   201 	 */
       
   202 	const CMdESession& Session() const;
       
   203 
       
   204 private:
       
   205 	CMdENamespaceDef(const CMdESession& aMdeSession, 
       
   206 			const TMdCNamespaceDef& aNamespaceDef);
       
   207 
       
   208 	void ConstructL(CMdCSerializationBuffer& aSchemaBuffer);
       
   209 
       
   210 private:
       
   211 	const CMdESession& iMdeSession;
       
   212 
       
   213 	const TMdCNamespaceDef& iNamespaceDef;
       
   214 
       
   215 	TPtrC16 iName;
       
   216 
       
   217 	RPointerArray<CMdEObjectDef> iObjectDefs;
       
   218 	RPointerArray<CMdERelationDef> iRelationDefs;
       
   219 	RPointerArray<CMdEEventDef> iEventDefs;
       
   220 	};
       
   221 
       
   222 #endif  // __MDENAMESPACEDEF_H__