GlsMenu
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
gls_menu_data_factory.h
Go to the documentation of this file.
1
42
#if !defined( GLS_MENUDATAFACTORY_H )
43
# define GLS_MENUDATAFACTORY_H
44
45
# ifdef WIN32
46
# pragma warning( disable : 4786 )
47
# endif
48
49
# include <string>
50
51
# include "
gls_menu_data.h
"
52
53
class
GlsMenuDictionary
;
54
55
//----------------------------------------------------------------------------
75
//----------------------------------------------------------------------------
76
class
GlsMenuDataFactory
:
public
GlsMenuData
77
{
78
public
:
79
//------------------------------------------------------------------------
83
//------------------------------------------------------------------------
84
GlsMenuDataFactory
(
const
std::string& name,
GlsMenuDictionary
& dict );
85
86
//------------------------------------------------------------------------
90
//------------------------------------------------------------------------
91
virtual
~GlsMenuDataFactory
() {}
92
93
//------------------------------------------------------------------------
97
//------------------------------------------------------------------------
98
virtual
std::istream&
ReadValue
( std::istream& instr );
99
100
//------------------------------------------------------------------------
104
//------------------------------------------------------------------------
105
virtual
std::ostream&
WriteValue
( std::ostream& outstr );
106
107
protected
:
109
GlsMenuDictionary
&
_dict
;
110
111
template
<
class
T>
112
class
Data
113
{
114
public
:
115
//----------------------------------------------------------------
119
//----------------------------------------------------------------
120
static
GlsMenuData
*
Create
(
121
const
std::string& name,
122
std::istream& instr )
123
{
124
T dummy;
125
GlsMenuData_T<T>
* data =
new
GlsMenuData_T<T>
( name, dummy );
126
data->
ReadValue
( instr );
127
return
data;
128
}
129
//----------------------------------------------------------------
134
//----------------------------------------------------------------
135
static
GlsMenuData
*
CreateDiscrete
(
136
const
std::string& name,
137
std::istream& instr )
138
{
139
GlsMenuDiscrete_T<T>
* data =
new
GlsMenuDiscrete_T<T>
( name, T( 0 ) );
140
data->
ReadValue
( instr );
141
return
data;
142
}
143
};
144
145
//------------------------------------------------------------------------
151
//------------------------------------------------------------------------
152
virtual
GlsMenuData
*
Create
(
const
std::string& name,
153
const
std::string& type,
154
std::istream& instr );
155
156
};
// end GlsMenuDataFactory
157
158
#endif // GLS_MENUDATAFACTORY_H
gls_menu_data.h
This file defines all menu meta-data classes.
GlsMenuDictionary
Definition:
gls_menu_dictionary.h:61
GlsMenuDataFactory::~GlsMenuDataFactory
virtual ~GlsMenuDataFactory()
Definition:
gls_menu_data_factory.h:91
GlsMenuDataFactory
Definition:
gls_menu_data_factory.h:76
GlsMenuDataFactory::Create
virtual GlsMenuData * Create(const std::string &name, const std::string &type, std::istream &instr)
GlsMenuDataFactory::Data
Definition:
gls_menu_data_factory.h:112
GlsMenuData_T
Definition:
gls_menu_data.h:104
GlsMenuDataFactory::_dict
GlsMenuDictionary & _dict
Data dictionary to add items into.
Definition:
gls_menu_data_factory.h:109
GlsMenuDataFactory::Data::Create
static GlsMenuData * Create(const std::string &name, std::istream &instr)
Definition:
gls_menu_data_factory.h:120
GlsMenuDataFactory::ReadValue
virtual std::istream & ReadValue(std::istream &instr)
GlsMenuDataFactory::Data::CreateDiscrete
static GlsMenuData * CreateDiscrete(const std::string &name, std::istream &instr)
Definition:
gls_menu_data_factory.h:135
GlsMenuData_T::ReadValue
virtual std::istream & ReadValue(std::istream &instr)
GlsMenuDataFactory::WriteValue
virtual std::ostream & WriteValue(std::ostream &outstr)
GlsMenuData
Definition:
gls_menu_data.h:65
GlsMenuDataFactory::GlsMenuDataFactory
GlsMenuDataFactory(const std::string &name, GlsMenuDictionary &dict)
GlsMenuDiscrete_T
Definition:
gls_menu_data.h:257
gls_menu_data_factory.h
Generated by
1.8.10