diff -r 000000000000 -r f58d6ec98e88 aknlayoutcompiler/inc/Layout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aknlayoutcompiler/inc/Layout.h Thu Dec 17 09:14:18 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2002-2004 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 LAYOUT_H +#define LAYOUT_H + +// disable "identifier was truncated to '255' characters in the browser information" warning +#pragma warning (disable:4786) +#include +#include +#include +#include + +using namespace std; + +class TLayoutLine; +class TLayoutTable; +class TLayout; + +extern const string KWindowOutputOrder[]; +extern const string KTextOutputOrder[]; +extern const string KWindowOutputOrderMirrored[]; +extern const string KTextOutputOrderMirrored[]; +extern const int KWindowOutputOrderSize; +extern const int KTextOutputOrderSize; + + +/** +* TLayout +* The core layout class - this represents a complete layout, +* typically loaded from a .lay file +*/ +class TLayout : public vector + { +public: + enum TMergeMode { KMergeModeMerge, KMergeModeVariant, KMergeModeUnion }; + +public: + TLayout(); + TLayout(const TLayout& aOther); + TLayout& operator=(const TLayout& aOther); + + virtual ~TLayout(); + void Merge(TLayout::TMergeMode aMergeMode, TLayout& aLayout); + TLayoutLine* FindLine(const string& aName); + void Compile(); + +public: + string iName; + bool iCanBeMirror; + }; + + +/** +* TValues +* The values stored in a cell in a layout line +*/ +class TValues : public vector + { +// This class is generic with respect to the type of line it is used by +public: + TValues(); + TValues(TLayoutLine* aLine, string aName); + + bool operator==(const TValues& aOther) const; + + void Merge(TValues& aValues); + void Compile(); + string ParamName() const; + static string CppValue(const string& aValue); + +public: + TLayoutLine* iLine; + string iName; + string iParam; + bool iNeedsP; + bool iNeedsIndex; + }; + + +/** +* TLayoutLine +* A layout line +*/ +class TLayoutLine : public map + { +public: + TLayoutLine(TLayoutTable* aTable, int aId); + TLayoutLine(TLayoutTable* aTable, const TLayoutLine& aOther); + + bool operator==(const TLayoutLine& aOther) const; + bool ValuesEqual(const TLayoutLine& aOther) const; + + void Merge(TLayout::TMergeMode aMergeMode, TLayoutLine& aLine); + void Compile(); + string Name() const; + string TableName() const; + bool MatchParams(const TLayoutLine& aLine) const; + bool NeedsParams() const { return iNeedsP || iNeedsIndex; } + + void WarnMergeMismatch(TLayoutLine& aLine); + +public: + int iId; + TLayoutTable* iTable; + bool iNeedsP; + bool iNeedsIndex; + bool iIsUnique; + int iGlobalIndex; + bool iIsMirroredHorizontally; // i.e. l and r are swapped + bool iIsMergedIdentical; + }; + + +/** +* TLayoutTable +* A layout table +*/ +class TLayoutTable : public vector + { +public: + enum TTableType { EUnknownTable, EWindowTable, ETextTable }; + class TLayoutSubTable : public vector + { + public: + TLayoutSubTable(); + bool iIsMergedIdentical; + }; + typedef vector TLayoutSubTables; + +public: + TLayoutTable(TLayout* aTables); + TLayoutTable(TLayout* aTables, const TLayoutTable& aOther); + virtual ~TLayoutTable(); + + void Merge(TLayout::TMergeMode aMergeMode, TLayoutTable& aTable); + TLayoutLine* FindLine(const string& aName); + void Compile(); + void BuildSubTables(); + void DestroySubTables(); + string Name(); + static bool IsValueColumn(string aName); + static bool IsNumericColumn(string aName); + void SetDefaultColumnNames(); + bool IsWorthATableIndex(); + +public: + TLayoutSubTables iSubTables; + vector iColumnNames; + TTableType iType; + TLayout* iTables; + string iName; + TLayoutLine* iParent; + string iParentName; + bool iNeedsP; + bool iNeedsIndex; + int iFirstLineGlobalIndex; + bool iAppend; + bool iNoSubTables; + }; + + +#endif + +// End of File