GlsMenu  1.5.4
gls_mfd_menu_set.h
Go to the documentation of this file.
1 
42 #if !defined( GLS_MFDMENUSET_H )
43 # define GLS_MFDMENUSET_H
44 
45 # ifdef WIN32
46 # pragma warning( disable : 4786 )
47 # endif
48 
49 # include <sstream>
50 # include <vector>
51 
52 # include "gls_menu_set.h"
53 # include "gls_mfd.h"
54 
55 //----------------------------------------------------------------------------
64 //----------------------------------------------------------------------------
65 template<class MenuType_t, class DataFactory_t>
66 class GlsMFDMenuSet_T : public GlsMenuSet_T<MenuType_t, DataFactory_t>
67 {
68 public:
70 
71  //------------------------------------------------------------------------
75  //------------------------------------------------------------------------
77  : BaseClass( dataDict )
78  , _MFDSide( side )
79  {
80  }
81 
82  //------------------------------------------------------------------------
86  //------------------------------------------------------------------------
87  virtual ~GlsMFDMenuSet_T() {}
88 
89  //------------------------------------------------------------------------
98  //------------------------------------------------------------------------
99  using BaseClass::Read;
100  virtual void Read( std::istream& instr )
101  {
102  std::string MFD_Name( GlsMFD::Name( _MFDSide ) );
103 
104  // Read in the menu script
105  std::stringstream script;
106  script << instr.rdbuf();
107 
108  std::string xls( script.str() );
109  std::string::size_type pos( 0 );
110  while( ( pos = xls.find( "$(MFD)", pos ) ) != std::string::npos )
111  {
112  xls.replace( pos, 6, MFD_Name );
113  }
114  script.str( xls );
115  _menuStructure.Read( script );
116  }
117 
118 protected:
121 
122 private:
123  // = Unimplemented methods, disallow copies
126 
127 }; // end GlsMFDMenuSet
128 
129 #endif // GLS_MFDMENUSET_H
GlsMenuSet_T< MenuType_t, DataFactory_t > BaseClass
GlsMFDMenuSet_T(GlsMFD::Side_t side, GlsMenuDictionary &dataDict)
Side_t
Definition: gls_mfd.h:59
GlsMenuDictionary _menuStructure
Menu structure attribute dictionary contains structure of menu.
Definition: gls_menu_set.h:353
This file defines classes to implement a set of menus.
std::string Name(Side_t side)
Definition: gls_mfd.h:90
virtual ~GlsMFDMenuSet_T()
GlsMFD::Side_t _MFDSide
Which MFD this menu set is for (left or right)
GlsMFDMenuSet_T & operator=(const GlsMFDMenuSet_T &)
virtual void Read(std::istream &instr)
This file defines common MFD types.
virtual void Read(std::istream &instr)
Definition: gls_menu_set.h:231