secureswitools/swisistools/source/sisxlibrary/sisif.h
changeset 0 ba25891c3a9e
child 26 04d4a7bbc3e0
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 the License "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 * As specified in SGL.GT0188.251
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @publishedPartner
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __SISIF_H__
       
    27 #define __SISIF_H__
       
    28 
       
    29 
       
    30 #include "sisexpression.h"
       
    31 #include "sisinstallblock.h"
       
    32 #include "siselseif.h"
       
    33 #include "sisarray.h"
       
    34 
       
    35 class CSISIf : public CStructure <CSISFieldRoot::ESISIf>
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	 * Default constructor
       
    40 	 */
       
    41 	CSISIf ();
       
    42 	/**
       
    43 	 * Copy constructor
       
    44 	 */
       
    45 	CSISIf (const CSISIf& aInitialiser);
       
    46 
       
    47 public:
       
    48 	/**
       
    49 	 * Class name
       
    50 	 */
       
    51 	virtual std::string Name () const;
       
    52 	/**
       
    53 	 * Expression corresponds to this if block.
       
    54 	 * @return CSISExpression
       
    55 	 */
       
    56 	const CSISExpression& Expression () const;
       
    57 	/**
       
    58 	 * Expression corresponds to this if block.
       
    59 	 * @return CSISExpression
       
    60 	 */
       
    61 	CSISExpression& Expression ();
       
    62 	/**
       
    63 	 * Add else-if block
       
    64 	 */
       
    65 	void AddElseIf ();
       
    66 	/**
       
    67 	 * Add else block
       
    68 	 */
       
    69 	void AddElse ();
       
    70 	/**
       
    71 	 * Retrieves the last elseif block
       
    72 	 */
       
    73 	const CSISElseIf& ElseIf () const;
       
    74 	/**
       
    75 	 * Retrieves the last elseif block
       
    76 	 */
       
    77 	CSISElseIf& ElseIf ();
       
    78 	/**
       
    79 	 * Retrieves the elseif block pointed by the index.
       
    80 	 * @param aIndex index
       
    81 	 */
       
    82 	const CSISElseIf& ElseIf (const unsigned aIndex) const;
       
    83 	/**
       
    84 	 * Retrieves the elseif block pointed by the index.
       
    85 	 * @param aIndex index
       
    86 	 */
       
    87 	CSISElseIf& ElseIf (const unsigned aIndex);
       
    88 	/**
       
    89 	 * Count of else-if block.
       
    90 	 */
       
    91 	inline TUint32 ElseIfCount() const;
       
    92 	/**
       
    93 	 * Expression corresponds to the last else-if block
       
    94 	 */
       
    95 	const CSISExpression& ElseIfExpression () const;
       
    96 	/**
       
    97 	 * Expression corresponds to the last else-if block
       
    98 	 */
       
    99 	CSISExpression& ElseIfExpression ();
       
   100 	/**
       
   101 	 * @return Install block of this if block
       
   102 	 */
       
   103 	CSISInstallBlock& InstallBlock ();
       
   104 	/**
       
   105 	 * @return Install block of this if block
       
   106 	 */
       
   107 	const CSISInstallBlock& InstallBlock () const;
       
   108 	/**
       
   109 	 * Adds package entry related to this if block.
       
   110 	 * @param aStream stream into which the package details need to be written.
       
   111 	 * @param aVerbose If this option is set then detail description of pkg
       
   112 	 * 			will be written into the stream.
       
   113 	 */
       
   114 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
   115 	/**
       
   116 	 * Retrieves the list of files present in the if block.
       
   117 	 * @param aFileList this will be filled by this function.
       
   118 	 */
       
   119 	void GetFileList(TFileDescList& aFileList) const;
       
   120 	/**
       
   121 	 * Retrieves the list of embedded sis files present in the if block.
       
   122 	 * @param aFileList this will be filled by this function.
       
   123 	 */
       
   124 	void GetEmbeddedControllers(TControllerMap& aControllers) const;
       
   125 
       
   126 private:
       
   127 	void InsertMembers ();
       
   128 
       
   129 private:
       
   130 	CSISExpression										iExpression;
       
   131 	CSISInstallBlock									iInstallBlock;
       
   132 	CSISArray <CSISElseIf, CSISFieldRoot::ESISElseIf>	iElseIfs;
       
   133 
       
   134 	};
       
   135 
       
   136 
       
   137 inline std::string CSISIf::Name () const
       
   138 	{
       
   139 	return "If";
       
   140 	}
       
   141 
       
   142 inline void CSISIf::InsertMembers ()
       
   143 	{
       
   144 	InsertMember (iExpression);
       
   145 	InsertMember (iInstallBlock);
       
   146 	InsertMember (iElseIfs);
       
   147 	}
       
   148 
       
   149 inline CSISIf::CSISIf ()
       
   150 	{ 
       
   151 	InsertMembers (); 
       
   152 	}
       
   153 
       
   154 inline CSISIf::CSISIf (const CSISIf& aInitialiser) :
       
   155 		iExpression (aInitialiser.iExpression),
       
   156 		iInstallBlock (aInitialiser.iInstallBlock),
       
   157 		iElseIfs (aInitialiser.iElseIfs)
       
   158 	{ 
       
   159 	InsertMembers (); 
       
   160 	}
       
   161 
       
   162 inline const CSISExpression& CSISIf::Expression () const
       
   163 	{ 
       
   164 	return iExpression; 
       
   165 	}
       
   166 
       
   167 inline CSISExpression& CSISIf::Expression ()
       
   168 	{ 
       
   169 	return iExpression; 
       
   170 	}
       
   171 
       
   172 inline void CSISIf::AddElseIf ()
       
   173 	{ 
       
   174 	iElseIfs.Push (CSISElseIf ()); 
       
   175 	}
       
   176 
       
   177 inline void CSISIf::AddElse ()
       
   178 	{ 
       
   179 	AddElseIf (); ElseIf ().SetElse (); 
       
   180 	} 
       
   181 
       
   182 inline const CSISElseIf& CSISIf::ElseIf () const
       
   183 	{ 
       
   184 	return iElseIfs.Last (); 
       
   185 	}
       
   186 
       
   187 inline CSISElseIf& CSISIf::ElseIf ()
       
   188 	{ 
       
   189 	return iElseIfs.Last (); 
       
   190 	}
       
   191 
       
   192 inline const CSISElseIf& CSISIf::ElseIf (const unsigned aIndex) const
       
   193 	{ 
       
   194 	return iElseIfs [aIndex]; 
       
   195 	}
       
   196 
       
   197 inline CSISElseIf& CSISIf::ElseIf (const unsigned aIndex)
       
   198 	{ 
       
   199 	return iElseIfs [aIndex]; 
       
   200 	}
       
   201 
       
   202 inline const CSISExpression& CSISIf::ElseIfExpression () const
       
   203 	{ 
       
   204 	return iElseIfs.Last ().Expression (); 
       
   205 	}
       
   206 
       
   207 inline CSISExpression& CSISIf::ElseIfExpression ()
       
   208 	{ 
       
   209 	return iElseIfs.Last ().Expression (); 
       
   210 	}
       
   211 
       
   212 inline CSISInstallBlock& CSISIf::InstallBlock ()
       
   213 	{ 
       
   214 	return iInstallBlock; 
       
   215 	}
       
   216 
       
   217 inline const CSISInstallBlock& CSISIf::InstallBlock () const
       
   218 	{ 
       
   219 	return iInstallBlock; 
       
   220 	}
       
   221 
       
   222 inline TUint32 CSISIf::ElseIfCount () const
       
   223 	{ 
       
   224 	return iElseIfs.size(); 
       
   225 	}
       
   226 #endif // __SISIF_H__
       
   227