installationservices/refswinstallationplugin/inc/sifrefpkgparser.h
changeset 24 84a16765cd86
equal deleted inserted replaced
6:aba6b8104af3 24:84a16765cd86
       
     1 /*
       
     2 * Copyright (c) 2008-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 * This file defines a file package parser for the Reference Installer.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  exampleCode
       
    24 */
       
    25 
       
    26 #ifndef __SIFREFPKGPARSER_H__
       
    27 #define __SIFREFPKGPARSER_H__
       
    28 
       
    29 #include <scs/scsclient.h>
       
    30 #include <f32file.h>
       
    31 #include <usif/sif/sifcommon.h>
       
    32 
       
    33 namespace Usif
       
    34 	{
       
    35 	// Helpful typedefs
       
    36 	typedef RArray<TLanguage> RLanguageArray;
       
    37 	typedef RCPointerArray<HBufC> RCHBufCArray;
       
    38 
       
    39 	/**
       
    40 	A package file parser. This refrence implementation reads an entire file into a buffer
       
    41 	and then parses it line by line. The parser operates synchronously and therefore
       
    42 	the processing of a package cannot be cancelled.
       
    43 	*/
       
    44 	class CSifRefPkgParser: public CBase
       
    45 		{
       
    46 	public:
       
    47 		/**
       
    48 		Creates an instance of the parser and parses a package file by file name.
       
    49 		
       
    50 		@param aFileName The name of a package file to be parsed.
       
    51 		@return Pointer to an instance of the parser.
       
    52 		*/
       
    53 		static CSifRefPkgParser* NewL(const TDesC& aFileName);
       
    54 
       
    55 		/**
       
    56 		Destroys an instance of the parser.
       
    57 		*/
       
    58 		virtual ~CSifRefPkgParser();
       
    59 
       
    60 		/**
       
    61 		Gets a reference to an array of languages supported by the package.
       
    62 		*/
       
    63 		const RLanguageArray& Languages() const;
       
    64 
       
    65 		/**
       
    66 		Gets a reference to an array of localized names of a component in the package.
       
    67 		The sequence of the names in the array corresponds to the sequence of
       
    68 		the languages returned by Languages().
       
    69 		*/
       
    70 		const RCHBufCArray& ComponentNames() const;
       
    71 
       
    72 		/**
       
    73 		Gets a reference to an array of localized names of the vendor of a component in
       
    74 		the package. The sequence of the names in the array corresponds to the sequence of
       
    75 		the languages returned by Languages().
       
    76 		*/
       
    77 		const RCHBufCArray& VendorNames() const;
       
    78 
       
    79 		/**
       
    80 		Gets a reference to an array of files of a component in the package.
       
    81 		*/
       
    82 		const RCHBufCArray& Files() const;
       
    83 
       
    84 		/**
       
    85 		Gets the version of a component in the package.
       
    86 		*/
       
    87 		const TVersion& Version() const;
       
    88 
       
    89 		/**
       
    90 		A helper method. Gets the index of aLanguage in the array of languages supported by
       
    91 		a component in the package.
       
    92 		
       
    93 		@param aLanguage Language to be found.
       
    94 		@return The index of aLanguage in the array of supported languages.
       
    95 		*/
       
    96 		TInt GetLanguageIndex(TLanguage aLanguage) const;
       
    97 
       
    98 	private:
       
    99 		CSifRefPkgParser();
       
   100 		CSifRefPkgParser(const CSifRefPkgParser&);
       
   101 		CSifRefPkgParser& operator=(const CSifRefPkgParser&);
       
   102 
       
   103 		void ParseL(const TDesC& aFileName);
       
   104 		void ParseL(RFile& aFileHandle);
       
   105 		void LineHandlerL(const TPtrC8& aName, const TPtrC8& aValue);
       
   106 		void CheckInvariantL() const;
       
   107 
       
   108 		RLanguageArray iLanguages;
       
   109 		RCHBufCArray iComponentNames;
       
   110 		RCHBufCArray iVendorNames;
       
   111 		RCHBufCArray iFiles;
       
   112 		TVersion iVersion;
       
   113 		};
       
   114 
       
   115 	} // namespace Usif
       
   116 
       
   117 #endif // __SIFREFPKGPARSER_H__