uitools_plat/cdl_api/inc/CdlCompilerToolkit/CdlTkInterface.h
changeset 0 f58d6ec98e88
child 1 b700e12870ca
equal deleted inserted replaced
-1:000000000000 0:f58d6ec98e88
       
     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:
       
    15 *
       
    16 */
       
    17 #ifndef CDLTKINTERFACE_H
       
    18 #define CDLTKINTERFACE_H
       
    19 #pragma warning (disable:4786)	// disable "identifier was truncated to '255' characters in the browser information" warning
       
    20 
       
    21 
       
    22 #include <vector>
       
    23 #include <set>
       
    24 #include <string>
       
    25 #include <CdlCompilerToolkit/CdlTkUtil.h>
       
    26 
       
    27 namespace CdlCompilerToolkit {
       
    28 
       
    29 class CCdlTkInterface;
       
    30 class CCdlTkFunctionApi;
       
    31 class CCdlTkDataApi;
       
    32 
       
    33 
       
    34 /**
       
    35 * Header information for a CDL interface
       
    36 */
       
    37 class CCdlTkInterfaceHeader
       
    38 	{
       
    39 public:
       
    40 	/**
       
    41 	* A collection of CDL interface flags. This class has operations to allow
       
    42 	* the flags to be manipulated through their textual name, or as an array
       
    43 	* of bits.
       
    44 	*/
       
    45 	class CFlags
       
    46 		{
       
    47 	public:
       
    48 		/**
       
    49 		* constructor
       
    50 		*/
       
    51 		CFlags();
       
    52 		
       
    53 		/**
       
    54 		* Sets a flag to be on
       
    55 		* @param aFlagName the name of the flag to be turned on
       
    56 		*/
       
    57 		void SetFlag(const std::string& aFlagName);
       
    58 		/**
       
    59 		* Sets a flag to be off
       
    60 		* @param aFlagName the name of the flag to be turned off
       
    61 		*/
       
    62 		void ClearFlag(const std::string& aFlagName);
       
    63 		
       
    64 		/**
       
    65 		* Returns a representation of the flags as a 32-bit integer
       
    66 		* @return a 32-bit integer containing a bit patterns representing the flags
       
    67 		*/
       
    68 		int FlagsAsInt() const;
       
    69 		/**
       
    70 		* Returns a string representation of the flags
       
    71 		* @return a string containing the set flags' names combined with the
       
    72 		* C++ bitwise OR operator |.
       
    73 		* If no flags are set, "0" is returned.
       
    74 		*/
       
    75 		std::string FlagsAsString() const;
       
    76 
       
    77 		/**
       
    78 		* Gives the number of bit flags that this class uses.
       
    79 		* @return the  number of bit flags that this class uses.
       
    80 		*/
       
    81 		int Count() const;
       
    82 		/**
       
    83 		* Test whether a flag is set, using a flag index between 0 and Count()-1
       
    84 		* to identify the flag.
       
    85 		* @param aFlagIndex the index of the flag in question
       
    86 		* @return the bool value of the flag
       
    87 		*/
       
    88 		bool IsSet(int aFlagIndex) const;
       
    89 		/**
       
    90 		* Test whether a flag is set, using the flag name to identify the flag
       
    91 		* @param aFlagName the name of the flag in question
       
    92 		* @return the bool value of the flag
       
    93 		*/
       
    94 		bool IsSet(const std::string& aFlagName) const;
       
    95 
       
    96 		/**
       
    97 		* Adds the set flags in another CFlags object to this one.
       
    98 		* @param aOther another CFlags object
       
    99 		* @return this modified object.
       
   100 		*/
       
   101 		CFlags& operator|=(const CFlags& aOther);
       
   102 
       
   103 		/**
       
   104 		* Returns the name of a flag identified by its index
       
   105 		* @param aFlagIndex the index of the flag, between 0 and Count()-1
       
   106 		* @return the name of the flag
       
   107 		*/
       
   108 		std::string FlagName(int aFlagIndex) const;
       
   109 
       
   110 	private:
       
   111 		int IndexToFlagVal(int aIndex) const;
       
   112 		int FlagVal(const std::string& aFlagName) const;
       
   113 
       
   114 	private:
       
   115 		int iFlags;
       
   116 		};
       
   117 
       
   118 	/**
       
   119 	* A version number
       
   120 	*/
       
   121 	class CVersion
       
   122 		{
       
   123 	public:
       
   124 		/**
       
   125 		* constructor
       
   126 		*/
       
   127 		CVersion();
       
   128 		/**
       
   129 		* constructor
       
   130 		* @param aMajor the major version number
       
   131 		* @param aMinor the minor version number
       
   132 		*/
       
   133 		CVersion(int aMajor, int aMinor);
       
   134 	
       
   135 		/**
       
   136 		* Compare two versions
       
   137 		* @param aOther another version number
       
   138 		* @return true if this version is less than the other version
       
   139 		*/
       
   140 		bool operator<(const CVersion aOther) const;
       
   141 		/**
       
   142 		* Compare two versions
       
   143 		* @param aOther another version number
       
   144 		* @return true if the two versions are equal
       
   145 		*/
       
   146 		bool operator==(const CVersion aOther) const;
       
   147 
       
   148 		/**
       
   149 		* The major version number
       
   150 		* @return the major version number
       
   151 		*/
       
   152 		int Major() const;
       
   153 		/**
       
   154 		* Set the major verion number
       
   155 		* @param aMajor the major version number
       
   156 		*/
       
   157 		void SetMajor(int aMajor);
       
   158 		/**
       
   159 		* The minor version number
       
   160 		* @return the minor version number
       
   161 		*/
       
   162 		int Minor() const;
       
   163 		/**
       
   164 		* Set the minor verion number
       
   165 		* @param aMinor the minor version number
       
   166 		*/
       
   167 		void SetMinor(int aMinor);
       
   168 
       
   169 	private:
       
   170 		int iMajor;
       
   171 		int iMinor;
       
   172 		};
       
   173 
       
   174 public:
       
   175 	/**
       
   176     * constructor
       
   177     */
       
   178 	CCdlTkInterfaceHeader();
       
   179 	/**
       
   180     * Merge another header in with this one. This process is normally used
       
   181 	* when colapsing an extended CDL interface into a monolithic one.
       
   182 	* The other header is checked to make sure that it does nothing illegal,
       
   183 	* like change the name or UID, or decrease the version number, before the
       
   184 	* flags are merged and the version number is copied.
       
   185     * @param aOther the header to merge with this one.
       
   186     */
       
   187 	void MergeExtensionHeader(const CCdlTkInterfaceHeader& aOther);
       
   188 
       
   189 	/**
       
   190     * Get the name of the CDL interface
       
   191     * @return the name
       
   192     */
       
   193 	std::string Name() const;
       
   194 	/**
       
   195     * Set the name of the CDL interface
       
   196     * @param aName the name for the CDL interface
       
   197     */
       
   198 	void SetName(const std::string& aName);
       
   199 
       
   200 	/**
       
   201     * Get the UID of the CDL interface
       
   202     * @return the UID
       
   203     */
       
   204 	int Uid() const;
       
   205 	/**
       
   206     * Set the UID of the CDL interface
       
   207     * @param aUid the UID for the CDL interface
       
   208     */
       
   209 	void SetUid(int aUid);
       
   210 
       
   211 	/**
       
   212     * Set the version of the CDL interface.
       
   213     * @param aVersion The version for the interface
       
   214     */
       
   215 	void SetVersion(const CVersion& aVersion);
       
   216 	/**
       
   217     * Get the version of the CDL interface.
       
   218     * @return the version of the CDL interface.
       
   219     */
       
   220 	const CVersion& Version() const;
       
   221 
       
   222 	/**
       
   223     * Get the flags for the CDL interface.
       
   224     * @return the flags
       
   225     */
       
   226 	const CFlags& Flags() const;
       
   227 	/**
       
   228     * Get the flags for the CDL interface.
       
   229     * @return a modifiable flags object
       
   230     */
       
   231 	CFlags& Flags();
       
   232 
       
   233 	/**
       
   234     * Compare this header with another
       
   235     * @param aOther a header to compare this one with
       
   236     * @return true if they are equal
       
   237     */
       
   238 	bool operator==(const CCdlTkInterfaceHeader& aOther) const;
       
   239 
       
   240 private:
       
   241 	std::string iName;
       
   242 	int iUid;
       
   243 	CVersion iVer;
       
   244 	CFlags iFlags;
       
   245 	};
       
   246 
       
   247 
       
   248 /**
       
   249 * A single parameter in a function API in a CDL interface. It contains
       
   250 * a type and a name.
       
   251 */
       
   252 class CCdlTkApiParam
       
   253 	{
       
   254 public:
       
   255 	/**
       
   256     * constructor
       
   257     */
       
   258 	CCdlTkApiParam();
       
   259 	/**
       
   260     * constructor
       
   261     * @param aType the parameter type
       
   262 	* @param aName the parameter name
       
   263     */
       
   264 	CCdlTkApiParam(const std::string& aType, const std::string& aName);
       
   265 	/**
       
   266     * constructor
       
   267     * @param aType the parameter type
       
   268 	* @param aName the parameter name
       
   269 	* @param aDefaultValue the default value - If the supplied value is empty, there will be no default value
       
   270     */
       
   271 	CCdlTkApiParam(const std::string& aType, const std::string& aName, const std::string& aDefaultValue);
       
   272 
       
   273 	/**
       
   274     * Get the parameter type
       
   275     * @return the parameter type
       
   276     */
       
   277 	const std::string& Type() const;
       
   278 	/**
       
   279     * Set the parameter type
       
   280     * @param aType the type for the parameter
       
   281     */
       
   282 	void SetType(const std::string& aType);
       
   283 
       
   284 	/**
       
   285     * Get the parameter name
       
   286     * @return the parameter name
       
   287     */
       
   288 	const std::string& Name() const;
       
   289 	/**
       
   290     * Set the parameter name
       
   291     * @param aName the parameter name
       
   292     */
       
   293 	void SetName(const std::string& aName);
       
   294 
       
   295 	/**
       
   296     * Get the default value
       
   297     * @return the default value - If there is no default value, the return value will be empty
       
   298     */
       
   299 	const std::string& DefaultValue() const;
       
   300 	/**
       
   301     * Set the default value
       
   302     * @param aDefaultValue the default value  - If the supplied value is empty, there will be no default value
       
   303     */
       
   304 	void SetDefaultValue(const std::string& aDefaultValue);
       
   305 
       
   306 	/**
       
   307     * compare two parameters
       
   308     * @param aOther the parameter to compare with
       
   309     * @return true if name, type, and default value are the same
       
   310     */
       
   311 	bool operator==(const CCdlTkApiParam& aOther) const;
       
   312 
       
   313 	/**
       
   314     * compare two parameters
       
   315     * @param aOther the parameter to compare with
       
   316     * @return true if any of name, type, and default value are not the same
       
   317     */
       
   318 	bool operator!=(const CCdlTkApiParam& aOther) const
       
   319 		{
       
   320 		return !(*this == aOther);
       
   321 		}
       
   322 
       
   323 private:
       
   324 	std::string iType;
       
   325 	std::string iName;
       
   326 	std::string iDefaultValue;
       
   327 	};
       
   328 
       
   329 
       
   330 /**
       
   331 * The parameter list for a function API in a CDL interface
       
   332 */
       
   333 class CCdlTkApiParams : public std::vector<CCdlTkApiParam>
       
   334 	{
       
   335 public:
       
   336 	/**
       
   337     * Finds a parameter by its name
       
   338     * @param aParamName the name of the parameter to look for
       
   339     * @return an iterator pointing at the parameter, or end() if not found.
       
   340     */
       
   341 	iterator FindByName(std::string aParamName);
       
   342 	};
       
   343 
       
   344 
       
   345 /**
       
   346 * A CDL data type translation.
       
   347 * Data type translations have three parts.
       
   348 * 1) the type that the translation matches.
       
   349 * 2) the syntax for defining an instance of that type.
       
   350 * 3) the pointer reference syntax for that type.
       
   351 * The type match string may contain the text "aType". This will match against
       
   352 * any content in a type to be matched.
       
   353 * The definition and pointer reference strings may contain the variables
       
   354 * "aName" and "aType". "aName" will be replaced by the instance name.
       
   355 * "aType" will be replaced by the text in the type string that matched "aType".
       
   356 */
       
   357 class CCdlTkDataTypeTranslation
       
   358 	{
       
   359 public:
       
   360 	/**
       
   361     * An enum used to identify the source of a data type translation, whether
       
   362 	* it is built into the CDL compiler toolkit, or it comes from a CDL file.
       
   363     */
       
   364 	enum TTranslationSource
       
   365 		{
       
   366 		EInbuilt,
       
   367 		EFromCdl
       
   368 		};
       
   369 
       
   370 public:
       
   371 	/**
       
   372     * constructor
       
   373     */
       
   374 	CCdlTkDataTypeTranslation();
       
   375 	/**
       
   376     * constructor
       
   377     * @param aType the type that this translation matches
       
   378     */
       
   379 	CCdlTkDataTypeTranslation(const std::string& aType);
       
   380 	/**
       
   381     * constructor
       
   382     * @param aType the type that this translation matches
       
   383 	* @param aDefn the definition syntax for instances of this type.
       
   384 	* @param aPtrRef the pointer reference syntax for instances of this type.
       
   385 	* @param aSource the source of this translation.
       
   386     */
       
   387 	CCdlTkDataTypeTranslation(const std::string& aType, const std::string& aDefn, const std::string& aPtrRef, TTranslationSource aSource);
       
   388 
       
   389 	/**
       
   390     * Get the type match string
       
   391     * @return the type match string
       
   392     */
       
   393 	std::string Type() const;
       
   394 	/**
       
   395     * Set the type match string
       
   396     * @param aType the type match string
       
   397     */
       
   398 	void SetType(const std::string& aType);
       
   399 	/**
       
   400     * Get the definition syntax string
       
   401     * @return the definition syntax string
       
   402     */
       
   403 	std::string Definition() const;
       
   404 	/**
       
   405     * Set the definition syntax string
       
   406     * @param aDefn the definition syntax string
       
   407     */
       
   408 	void SetDefinition(const std::string& aDefn);
       
   409 	/**
       
   410     * Get the pointer reference syntax
       
   411     * @return the pointer reference syntax
       
   412     */
       
   413 	std::string PointerReference() const;
       
   414 	/**
       
   415     * Set the pointer reference syntax
       
   416     * @param aPtrRef the pointer reference syntax
       
   417     */
       
   418 	void SetPointerReference(const std::string& aPtrRef);
       
   419 	/**
       
   420     * Get the source of the translation
       
   421     * @return the source of the translation
       
   422     */
       
   423 	TTranslationSource Source() const;
       
   424 
       
   425 	/**
       
   426     * Attempts to match a type string against the type string in this translation.
       
   427 	* Where this translation doesn't use "aType" in its type string, this is
       
   428 	* a simple comparison between they type strings.
       
   429 	* Where this translation does use "aType" in its type string, that will match
       
   430 	* any text in aType, but the rest of the type strings must match exactly.
       
   431 	* The part of aType that matches the string "aType" will be returned in
       
   432 	* aTypeVar.
       
   433 	* For example, consider when this translation's type is "vector<aType>".
       
   434 	* It will match a type "vector<int>" and "int" will be placed into aTypeVar.
       
   435 	* However it will not match "list<int>", because "list<>" does not match "vector<>".
       
   436     * @param aType the type string to match.
       
   437 	* @param aTypeVar the text in aType that matched the type variable "aType".
       
   438     * @return true if the match succeded.
       
   439     */
       
   440 	bool Match(const std::string& aType, std::string& aTypeVar) const;
       
   441 
       
   442 	/**
       
   443     * Compare two type translations.
       
   444     * @param aOther a translation to compare
       
   445     * @return true if type, definition syntax, pointer reference syntax and
       
   446 	* source are all the same.
       
   447     */
       
   448 	bool operator==(const CCdlTkDataTypeTranslation& aOther) const;
       
   449 
       
   450 private:
       
   451 	std::string iType;
       
   452 	std::string iDefn;
       
   453 	std::string iPtrRef;
       
   454 	TTranslationSource iSource;
       
   455 	// member data used in Match() calculation
       
   456 	std::string iTextBeforeTypeVar;
       
   457 	std::string iTextAfterTypeVar;
       
   458 	int iTypeVarPos;
       
   459 	int iSizeAfterTypeVar;
       
   460 	int iTypeSize;
       
   461 	int iTypeSizeWithoutTypeVar;
       
   462 	};
       
   463 
       
   464 
       
   465 /**
       
   466 * A collection of data type translations
       
   467 */
       
   468 class CCdlTkDataTypeTranslations : public std::vector<CCdlTkDataTypeTranslation>
       
   469 	{
       
   470 public:
       
   471 	/**
       
   472     * constructor
       
   473 	* Adds all the inbuilt translations.
       
   474     */
       
   475 	CCdlTkDataTypeTranslations();
       
   476 	/**
       
   477     * Merges adds another collection of translations to the end of this one.
       
   478 	* Inbuilt translations are ignored, as they will already be in this collection.
       
   479     * @param aOther another collection of translations.
       
   480     */
       
   481 	void MergeExtensionTranslations(const CCdlTkDataTypeTranslations& aOther);
       
   482 	/**
       
   483     * Finds the last translation in the collection that matches the type.
       
   484 	* Note, translations are searched from last to first, so that more recently
       
   485 	* added translations can overrideolder ones.
       
   486     * @param aType the type string to match.
       
   487 	* @param aTypeVar the text in aType that matched the type variable "aType".
       
   488     * @return a pointer to the translation for which the match succeded, or 
       
   489 	* NULL if no match succeded.
       
   490     */
       
   491 	const CCdlTkDataTypeTranslation* Find(const std::string& aType, std::string& aTypeVar) const;
       
   492 	};
       
   493 
       
   494 
       
   495 /**
       
   496 * The base class for an individual API in a CDL interface
       
   497 */
       
   498 class CCdlTkApi
       
   499 	{
       
   500 public:
       
   501 	/**
       
   502     * constructor
       
   503     * @param aInterface the interface that this API belongs to
       
   504     */
       
   505 	CCdlTkApi(CCdlTkInterface& aInterface);
       
   506 	/**
       
   507     * destructor
       
   508     */
       
   509 	virtual ~CCdlTkApi();
       
   510 
       
   511 	/**
       
   512     * Create a new copy of this API
       
   513     * @param aInterface the interface to which the new copy will belong
       
   514     * @return a new copy of this API
       
   515     */
       
   516 	virtual CCdlTkApi* Clone(CCdlTkInterface& aInterface) const = 0;
       
   517 
       
   518 	/**
       
   519     * Get the return type for this API
       
   520     * @return the return type
       
   521     */
       
   522 	const std::string& ReturnType() const;
       
   523 	/**
       
   524     * Set the return type for this API
       
   525     * @param aType the return type
       
   526     */
       
   527 	void SetReturnType(const std::string& aType);
       
   528 	/**
       
   529     * Does this API return void?
       
   530     * @return true if this API returns void.
       
   531     */
       
   532 	bool IsVoidReturn() const;
       
   533 
       
   534 	/**
       
   535     * Get the name of the API
       
   536     * @return the name of the API
       
   537     */
       
   538 	const std::string& Name() const;
       
   539 	/**
       
   540     * Set the name of the API
       
   541     * @param aName the name of the API
       
   542     */
       
   543 	void SetName(const std::string& aName);
       
   544 
       
   545 	/**
       
   546     * Get the line number of the source file where the API appeared
       
   547     * @return the line number of the source file where the API appeared
       
   548     */
       
   549 	int SourceFileLineNum() const;
       
   550 	/**
       
   551     * Set the line number of the source file where the API appeared
       
   552     * @param aLineNum the line number of the source file where the API appeared
       
   553     */
       
   554 	void SetSourceFileLineNum(int aLineNum);
       
   555 
       
   556 	/**
       
   557     * Get the comment text for the API
       
   558     * @return the comment text for the API
       
   559     */
       
   560 	const std::string& Comment() const;
       
   561 	/**
       
   562     * Set the comment text for the API
       
   563     * @param aComment the comment text for the API
       
   564     */
       
   565 	void SetComment(const std::string& aComment);
       
   566 
       
   567 	/**
       
   568     * Get the interface to which this API belongs
       
   569     * @return the interface to which this API belongs
       
   570     */
       
   571 	const CCdlTkInterface& Interface() const;
       
   572 	/**
       
   573     * Get the interface to which this API belongs
       
   574     * @return the interface to which this API belongs
       
   575     */
       
   576 	CCdlTkInterface& Interface();
       
   577 
       
   578 	/**
       
   579     * Return whether this API is a function API
       
   580     * @return true if it is a function API, false if it is a data API
       
   581     */
       
   582 	virtual bool IsFunc() const = 0;
       
   583 	/**
       
   584     * Downcast this object to a function API
       
   585     * @return this object as a function API
       
   586     */
       
   587 	const CCdlTkFunctionApi& AsFunc() const;
       
   588 	/**
       
   589     * Downcast this object to a data API
       
   590     * @return this object as a data API
       
   591     */
       
   592 	const CCdlTkDataApi& AsData() const;
       
   593 
       
   594 	/**
       
   595     * Get the type of a pointer to this API
       
   596     * @return the type of a pointer to this API
       
   597     */
       
   598 	virtual std::string PointerType() const = 0;
       
   599 	/**
       
   600     * Get the type and name list for the paramters to this API, will be
       
   601 	* empty for data APIs.
       
   602     * @return the type and name list for the paramters to this API
       
   603     */
       
   604 	virtual std::string ParamsTypeAndNameList() const = 0;
       
   605 
       
   606 	/**
       
   607     * Test for inequality
       
   608     * @param aOther an API to compare
       
   609     * @return true if not equal
       
   610     */
       
   611 	bool operator!=(const CCdlTkApi& aOther) const;
       
   612 	/**
       
   613     * Test for equality
       
   614     * @param aOther an API to compare
       
   615     * @return true if equal
       
   616     */
       
   617 	virtual bool operator==(const CCdlTkApi& aOther) const;
       
   618 	/**
       
   619     * Assign the contents of another API to this one
       
   620     * @param a 
       
   621     * @return 
       
   622     */
       
   623 	void operator=(const CCdlTkApi& aOther);
       
   624 
       
   625 private:
       
   626 	std::string iReturnType;
       
   627 	std::string iName;
       
   628 	int iSourceFileLineNum;
       
   629 	CCdlTkInterface& iInterface;
       
   630 	std::string iComment;
       
   631 	};
       
   632 
       
   633 
       
   634 /**
       
   635 * An individual data API belonging to a CDL interface
       
   636 */
       
   637 class CCdlTkDataApi : public CCdlTkApi
       
   638 	{
       
   639 public:
       
   640 	/**
       
   641     * constructor
       
   642     * @param aInterface the interface to which this API belongs
       
   643     */
       
   644 	CCdlTkDataApi(CCdlTkInterface& aInterface);
       
   645 	/**
       
   646     * constructor
       
   647     * @param aInterface the interface to which this API belongs
       
   648 	* @param aCopy an API to copy
       
   649     */
       
   650 	CCdlTkDataApi(CCdlTkInterface& aInterface, const CCdlTkDataApi& aCopy);
       
   651 
       
   652 	// from CCdlTkApi
       
   653 	CCdlTkApi* Clone(CCdlTkInterface& aInterface) const;
       
   654 	bool IsFunc() const;
       
   655 	std::string PointerType() const;
       
   656 	std::string ParamsTypeAndNameList() const;
       
   657 	};
       
   658 
       
   659 
       
   660 /**
       
   661 * An individual function API belonging to a CDL interface
       
   662 */
       
   663 class CCdlTkFunctionApi : public CCdlTkApi
       
   664 	{
       
   665 public:
       
   666 	/**
       
   667     * constructor
       
   668     * @param aInterface the interface to which this API belongs
       
   669     */
       
   670 	CCdlTkFunctionApi(CCdlTkInterface& aInterface);
       
   671 	/**
       
   672     * constructor
       
   673     * @param aInterface the interface to which this API belongs
       
   674 	* @param aCopy an API to copy
       
   675     */
       
   676 	CCdlTkFunctionApi(CCdlTkInterface& aInterface, const CCdlTkFunctionApi& aCopy);
       
   677 
       
   678 	/**
       
   679     * Get the parameters list for this function
       
   680     * @return  the parameters list for this function
       
   681     */
       
   682 	CCdlTkApiParams& Params();
       
   683 	/**
       
   684     * Get the parameters list for this function
       
   685     * @return  the parameters list for this function
       
   686     */
       
   687 	const CCdlTkApiParams& Params() const;
       
   688 	/**
       
   689     * Get the list of parameter names as a comma separated string
       
   690     * @return the list of parameter names as a comma separated string
       
   691     */
       
   692 	std::string ParamNameList() const;
       
   693 	/**
       
   694     * Get the list of parameter types as a comma separated string
       
   695     * @return the list of parameter types as a comma separated string
       
   696     */
       
   697 	std::string ParamTypeList() const;
       
   698 	/**
       
   699     * Get a type name for this API.
       
   700     * @return a type name for this API.
       
   701     */
       
   702 	std::string ApiNameAsTypeName() const;
       
   703 
       
   704 	// from CCdlTkApi
       
   705 	CCdlTkApi* Clone(CCdlTkInterface& aInterface) const;
       
   706 	bool IsFunc() const;
       
   707 	std::string PointerType() const;
       
   708 	std::string ParamsTypeAndNameList() const;
       
   709 
       
   710 	bool operator==(const CCdlTkApi& aOther) const;
       
   711 
       
   712 private:
       
   713 	CCdlTkApiParams iParams;
       
   714 	};
       
   715 
       
   716 
       
   717 /**
       
   718 * A set of APIs belonging to a CDL interface
       
   719 */
       
   720 class CCdlTkApiList : public std::vector<CCdlTkApi*>
       
   721 	{
       
   722 public:
       
   723 	/**
       
   724     * constructor
       
   725     */
       
   726 	CCdlTkApiList();
       
   727 	/**
       
   728     * destructor
       
   729     */
       
   730 	~CCdlTkApiList();
       
   731 	/**
       
   732     * Appends API from a CDL interface extension to this API to form a monolithic API
       
   733     * @param aOther The API to add
       
   734     */
       
   735 	void MergeExtendedApi(CCdlTkInterface& aInterface, const CCdlTkApiList& aOther);
       
   736 	/**
       
   737     * Copies APIs from another API list to this one. Existing APIs are removed first.
       
   738 	* @param aOther The API list to copy
       
   739     * @param aInterface The CDL interface to which the new APIs will belong
       
   740     */
       
   741 	void Copy(const CCdlTkApiList& aOther, CCdlTkInterface& aInterface);
       
   742 
       
   743 	/**
       
   744     * Finds an API by name
       
   745     * @param aName the name of the API to find
       
   746     * @return a pointer to the API with that name, or NULL if not found
       
   747     */
       
   748 	CCdlTkApi* Find(const std::string& aName) const;
       
   749 	/**
       
   750     * Compare two API lists
       
   751     * @param aOther the API list to compare
       
   752     * @return true if the API lists are the same, ie the same content in the same order
       
   753     */
       
   754 	bool operator==(const CCdlTkApiList& aOther) const;
       
   755 	/**
       
   756     * Is this API list a subset of another
       
   757     * @param aOther the candiate superset
       
   758     * @return true if this API list does not contain any APIs that do not appear in the other APL list
       
   759     */
       
   760 	bool IsSubsetOf(const CCdlTkApiList& aOther) const;
       
   761 
       
   762 private:
       
   763 	CCdlTkApiList(const CCdlTkApiList& aCopy);
       
   764 	void operator=(const CCdlTkApiList& aCopy);
       
   765 	void DeleteApis();
       
   766 	};
       
   767 
       
   768 
       
   769 /**
       
   770 * The C++ section of a CDL file
       
   771 */
       
   772 class CCdlTkCpp : public std::vector<std::string>
       
   773 	{
       
   774 public:
       
   775 	/**
       
   776     * constructor
       
   777     */
       
   778 	CCdlTkCpp();
       
   779 	/**
       
   780     * Adds the contents of another C++ section to the end of this one.
       
   781 	* @param aOther the other C++ section
       
   782     */
       
   783 	void MergeExtensionCpp(const CCdlTkCpp& aOther);
       
   784 	};
       
   785 
       
   786 
       
   787 /**
       
   788 * a CDL interface
       
   789 */
       
   790 class CCdlTkInterface
       
   791 	{
       
   792 public:
       
   793 	/**
       
   794     * constructor
       
   795     */
       
   796 	CCdlTkInterface();
       
   797 	/**
       
   798     * copy constructor
       
   799     * @param aCopy the CDL interface to copy
       
   800     */
       
   801 	CCdlTkInterface(const CCdlTkInterface& aCopy);
       
   802 	/**
       
   803     * assignment operator
       
   804     * @param aCopy the CDL interface to copy
       
   805     */
       
   806 	void operator=(const CCdlTkInterface& aCopy);
       
   807 	/**
       
   808     * destructor
       
   809     */
       
   810 	~CCdlTkInterface();
       
   811 
       
   812 	/**
       
   813     * Colapse any extended interface into this one to form a monolithic interface
       
   814     */
       
   815 	void MergeExtensions();
       
   816 
       
   817 	/**
       
   818     * Get the CDL interface which this interface extends
       
   819     * @return the CDL interface which this interface extends, or null if this is the base
       
   820     */
       
   821 	CCdlTkInterface* Base() const;
       
   822 	/**
       
   823     * Set the CDL interface which this interface extends
       
   824     * @param aBase the CDL interface which this interface extends
       
   825     */
       
   826 	void SetBase(CCdlTkInterface* aBase);				// does not take ownership
       
   827 	/**
       
   828     * Get the ultimate base CDL interface which this interface extends. That is, the base
       
   829 	* interface which itself has no base.
       
   830     * @return the ultimate base CDL interface which this interface extends, which may be this object itself
       
   831     */
       
   832 	CCdlTkInterface* UltimateBase();
       
   833 	/**
       
   834     * Get the ultimate base CDL interface which this interface extends. That is, the base
       
   835 	* interface which itself has no base.
       
   836     * @return the ultimate base CDL interface which this interface extends, which may be this object itself
       
   837     */
       
   838 	const CCdlTkInterface* UltimateBase() const;
       
   839 
       
   840 	/**
       
   841     * Gets the immediate extension for this interface.
       
   842     * @return the immediate extension for this interface, or null if it's not extended.
       
   843     */
       
   844 	CCdlTkInterface* Extension() const;
       
   845 	/**
       
   846     * Sets the immediate extension for this interface. This function takes ownership of the extension.
       
   847     * @param aExtension the CDL interface to be the extension for this interface.
       
   848     */
       
   849 	void SetExtension(CCdlTkInterface* aExtension);		// takes ownership
       
   850 	/**
       
   851     * Get the tip extension for this interface. Extensions to an interface form a linked
       
   852 	* list. This function traverses to the end of the extension list and returns it.
       
   853     * @return the latest extension for this interface, which may be this interface itself if it's not extended
       
   854     */
       
   855 	CCdlTkInterface* UltimateExtension();
       
   856 	/**
       
   857     * Get the tip extension for this interface. Extensions to an interface form a linked
       
   858 	* list. This function traverses to the end of the extension list and returns it.
       
   859     * @return the latest extension for this interface, which may be this interface itself if it's not extended
       
   860     */
       
   861 	const CCdlTkInterface* UltimateExtension() const;
       
   862 
       
   863 	/**
       
   864     * Get the filename for the CDL file for this CDL interface.
       
   865     * @return the filename for this interface's CDL file.
       
   866     */
       
   867 	std::string FileName() const;
       
   868 	/**
       
   869     * Set the filename for the CDL file for this CDL interface
       
   870     * @param aFileName The file name for this interface's CDL file
       
   871     */
       
   872 	void SetFileName(const std::string& aFileName);
       
   873 
       
   874 	/**
       
   875     * Get the additional comment for this CDL interface
       
   876     * @return the additional comment for this interface's CDL file.
       
   877     */
       
   878 	std::string AdditionalComment() const;
       
   879 	/**
       
   880     * Set the additional comment for this CDL interface
       
   881 	* The caller must provide sufficient annotation for the text to be treated as a 
       
   882 	* comment by the compiler, ensuring that the comment is terminated correctly
       
   883     * @param aAdditionalComment The additional commentfor this interface's CDL file
       
   884     */
       
   885 	void SetAdditionalComment(const std::string& aAdditionalComment);
       
   886 
       
   887 	/**
       
   888     * Get the header for this interface
       
   889     * @return the header for this interface
       
   890     */
       
   891 	CCdlTkInterfaceHeader& Header();
       
   892 	/**
       
   893     * Get the header for this interface
       
   894     * @return the header for this interface
       
   895     */
       
   896 	const CCdlTkInterfaceHeader& Header() const;
       
   897 	/**
       
   898     * Get the C++ section for this CDL interface
       
   899     * @return the C++ section for this CDL interface
       
   900     */
       
   901 	CCdlTkCpp& Cpp();
       
   902 	/**
       
   903     * Get the C++ section for this CDL interface
       
   904     * @return the C++ section for this CDL interface
       
   905     */
       
   906 	const CCdlTkCpp& Cpp() const;
       
   907 	/**
       
   908     * Get the API list for this CDL interface
       
   909     * @return the API list for this CDL interface
       
   910     */
       
   911 	CCdlTkApiList& ApiList();
       
   912 	/**
       
   913     * Get the API list for this CDL interface
       
   914     * @return the API list for this CDL interface
       
   915     */
       
   916 	const CCdlTkApiList& ApiList() const;
       
   917 	/**
       
   918     * Get the data type translations for this CDL interface
       
   919     * @return the data type translations for this CDL interface
       
   920     */
       
   921 	CCdlTkDataTypeTranslations& DataTypeTranslations();
       
   922 	/**
       
   923     * Get the data type translations for this CDL interface
       
   924     * @return the data type translations for this CDL interface
       
   925     */
       
   926 	const CCdlTkDataTypeTranslations& DataTypeTranslations() const;
       
   927 
       
   928 	/**
       
   929     * Get the C++ namespace name for this CDL interface. This is generated from the CDL interface name.
       
   930     * @return the C++ namespace name for this CDL interface.
       
   931     */
       
   932 	std::string NamespaceName() const;
       
   933 
       
   934 	/**
       
   935     * Compare this interface with another
       
   936     * @param aOther The interface to compare
       
   937     * @return true if the interfaces are equal
       
   938     */
       
   939 	bool operator==(const CCdlTkInterface& aOther) const;
       
   940 
       
   941 private:
       
   942 	std::string iFileName;
       
   943 	std::string iAdditionalComment;
       
   944 	CCdlTkInterfaceHeader iHeader;
       
   945 	CCdlTkCpp iCpp;
       
   946 	CCdlTkApiList iApiList;
       
   947 	CCdlTkDataTypeTranslations iDataTypeTranslations;
       
   948 	CCdlTkInterface* iBase;			// not owned
       
   949 	CCdlTkInterface* iExtension;	// owned
       
   950 	};
       
   951 
       
   952 
       
   953 /**
       
   954 * A collection of CDL interfaces
       
   955 */
       
   956 class CCdlTkInterfaceList : public std::vector<CCdlTkInterface*>
       
   957 	{
       
   958 public:
       
   959 	/**
       
   960     * constructor
       
   961     */
       
   962 	CCdlTkInterfaceList();
       
   963 	/**
       
   964     * destructor - deletes the interfaces
       
   965     */
       
   966 	~CCdlTkInterfaceList();
       
   967 
       
   968 private:
       
   969 	CCdlTkInterfaceList(const CCdlTkInterfaceList& aCopy);
       
   970 	void operator=(const CCdlTkInterfaceList& aCopy);
       
   971 	};
       
   972 
       
   973 
       
   974 }	// end of namespace CdlCompilerToolkit
       
   975 
       
   976 #endif