diff -r 000000000000 -r f72a12da539e menufw/hierarchynavigator/hnmetadatamodel/inc/hnutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/menufw/hierarchynavigator/hnmetadatamodel/inc/hnutils.h Thu Dec 17 08:40:49 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef C_HNUTILS_H +#define C_HNUTILS_H + +#include + +class CHnMdLocalization; +class CHnMdBaseKey; +class CLiwGenericParamList; +class TLiwVariant; +class CHnSuiteModel; +class TXmlEngElement; + + +/** + * Utils + * + * Utility class. + * + * @lib hnmetadatamodel + * @since S60 3.0 + * @ingroup group_hnmetadatamodel + */ +NONSHARABLE_CLASS( HnUtils ) + { +public: + + /** + * Read file. + * + * @since S60 v3.0 + * @param aPath Path to a file. + * @return Buffer. + */ + IMPORT_C static HBufC8* ReadFileLC(const TDesC& aPath); + + /** + * Read file. + * + * @since S60 v3.0 + * @param aPath Path to a file. + * @return Buffer. + */ + IMPORT_C static HBufC8* ReadFileL(const TDesC& aPath); + + /** + * Locates file. + * + * @since S60 v3.0 + * @param aFile File name. + * @return File path. + */ + IMPORT_C static HBufC* LocateFileLC( const TDesC& aFile ); + + /** + * Locates nearest Language file. + * + * @since S60 v3.0 + * @param aFile File name. + * @return File path. + */ + IMPORT_C static HBufC* LocateNearestLanguageFileLC( const TDesC& aFile ); + + + + /** + * Sets given descriptor using xml element textual value. + * + * @since S60 v5.0 + * @param aElement Xml element. + * @param aAttribute Descriptor to be set using aElement. + */ + IMPORT_C static void SetAttributeL( const TXmlEngElement& aElement, + RBuf8& aAttribute ); + + /** + * Sets given descriptor using xml attribute. + * + * @since S60 v5.0 + * @param aElement Xml element from which the attribute will be retrieved + * by aAttributeName. + * @param aAttributeName The name of the attribute to be read from + * aElement. + * @param aAttribute A descriptor to be set using a value of the attribute + * from aElement. + */ + IMPORT_C static void SetAttributeL( const TXmlEngElement& aElement, + const TDesC8& aAttributeName, RBuf8& aAttribute ); + + /** + * Fetches given columns string. + * + * @since S60 v5.0 + * @param aColumn Which column to fetch. + * @param aSourceText Source texts. + * @param aColumnSeparator Character that separates columns. + */ + IMPORT_C static HBufC8 * GetColumnTextLC(TInt aColumn, const TDesC8 & aSourceText, + TChar aColumnSeparator = TChar('|')); + + /** + * Fetches number of columns. + * + * @since S60 v5.0 + * @param aSourceText Source texts. + * @param aColumnSeparator Character that separates columns. + */ + IMPORT_C static TInt GetColumnTextColumnCount(const TDesC8 & aSourceText, + TChar aColumnSeparator = TChar('|')); + +private: + }; + +#endif // C_HNUTILS_H +