aknlayoutcompiler/inc/LayoutConfig.h
changeset 0 f58d6ec98e88
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 LAYOUTCONFIG_H
       
    18 #define LAYOUTCONFIG_H
       
    19 
       
    20 #include <set>
       
    21 #include <string>
       
    22 #include <iosfwd>
       
    23 #include <vector>
       
    24 
       
    25 class LayoutConfig
       
    26 	{
       
    27 public:
       
    28 	class Size
       
    29 		{
       
    30 	public:
       
    31 		enum TOrientation { EPortrait, ELandscape, ESquare };
       
    32 	public:
       
    33 		Size();
       
    34 		TOrientation Orientation() const;
       
    35 		bool operator>(const Size& aRhs) const;
       
    36 	public:
       
    37 		int iWidth;
       
    38 		int iHeight;
       
    39 		};
       
    40 	typedef std::set<Size, std::greater<Size> > Sizes;
       
    41 
       
    42 	enum TTarget { EPlatform, EProduct };
       
    43 	enum TLegacyMode { ENoLegacyMode, ELegacyMode };
       
    44 
       
    45 public:
       
    46 	static int Process(const std::vector<std::string>& args);
       
    47 	static void ShowHelp(std::ostream& stream);
       
    48 
       
    49 	~LayoutConfig();
       
    50 
       
    51 protected:
       
    52 	LayoutConfig();
       
    53 
       
    54 	void ParseArgs(const std::vector<std::string>& args);
       
    55 	void ParseOpt(const std::string& opt);
       
    56 
       
    57 	void SetFlags(TTarget aTarget, TLegacyMode aLegacyMode);
       
    58 
       
    59 	const Sizes& AllSizes() const;
       
    60 	const Sizes& ConfiguredSizes() const;
       
    61 	const Sizes& SizesForTarget() const;
       
    62 
       
    63 //	static int TestLayoutConfig();
       
    64 
       
    65 private: // to be overridden
       
    66 	virtual int Process() = 0;
       
    67 
       
    68 private:
       
    69 	void LoadAllSizes();
       
    70 	void LoadConfiguredSizes();
       
    71 	void OpenBldCfg(std::ifstream& aBldCfg);
       
    72 	bool ParseSize(const std::string& aLine, Size& aSize) const;
       
    73 
       
    74 private:
       
    75 	Sizes iAll;
       
    76 	Sizes iConf;
       
    77 	TTarget iTarget;
       
    78 	TLegacyMode iLegacyMode;
       
    79 	std::string iTargetFileName;
       
    80 	std::string iBaseFileName;
       
    81 	};
       
    82 
       
    83 
       
    84 class WsiniConfig : public LayoutConfig
       
    85 	{
       
    86 private: // from LayoutConfig
       
    87 	virtual int Process();
       
    88 	};
       
    89 
       
    90 
       
    91 #endif