00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #if !defined( _OESS_1__SCHEME__IMPL__SCHEME_IMPL_HPP_ )
00033 #define _OESS_1__SCHEME__IMPL__SCHEME_IMPL_HPP_
00034
00035 #include <oess_1/scheme/h/scheme.hpp>
00036
00037 #include <oess_1/scheme/impl/h/types_impl.hpp>
00038
00039 namespace oess_1 {
00040
00041 namespace scheme {
00042
00043 namespace impl {
00044
00045 class std_scheme_t;
00046
00047
00048
00049
00050
00054 class std_attr_editor_t :
00055 public attr_editor_t {
00056 public :
00057 std_attr_editor_t(
00058 std_scheme_t & scheme );
00059 virtual ~std_attr_editor_t();
00060
00062
00064 void
00065 def(
00066 const std::string & attr_name,
00067 const std::string & type_name,
00069 unsigned int extension_level );
00070
00071
00072
00073 const ref_attr_t &
00074 query_ref_attr() const;
00075
00076 virtual void
00077 make_ptr_kind();
00078
00079 virtual void
00080 make_extension_kind();
00081
00082
00083 virtual void
00084 make_single_obj_kind();
00085
00086 virtual void
00087 make_stl_vector_kind();
00088
00089 virtual void
00090 make_stl_list_kind();
00091
00092 virtual void
00093 make_stl_deque_kind();
00094
00095 virtual void
00096 make_stl_set_kind();
00097
00098 virtual void
00099 make_stl_multiset_kind();
00100
00101
00102 virtual void
00103 make_stl_map_kind(
00104 const std::string & key_type_name );
00105
00106
00107 virtual void
00108 make_stl_multimap_kind(
00109 const std::string & key_type_name );
00110
00111 virtual void
00112 make_fixed_vector_kind(
00113 size_t capacity );
00114
00115 virtual void
00116 set_default_existence(
00117 bool is_optional );
00118
00119 virtual void
00120 set_cpp_default(
00121 const std::string & expr );
00122
00123 virtual void
00124 set_cpp_present_if(
00125 const std::string & expr );
00126
00127 private :
00128 std_scheme_t & m_scheme;
00129 ref_std_attr_t m_ref_attr;
00130
00131 void
00132 set_cont_kind( const ref_attr_cont_kind_t & ref );
00133
00134 const type_t &
00135 find_type(
00136 const std::string & type_name ) const;
00137 };
00138
00139
00140
00141
00142 SMART_REF_3_DECL_REF( std_attr_editor_t, class )
00143
00144
00145
00146
00147 class std_cpp_mapping_editor_t :
00148 public cpp_mapping_editor_t {
00149 public :
00150 std_cpp_mapping_editor_t(
00151 std_cpp_mapping_t & cpp_mapping );
00152 virtual ~std_cpp_mapping_editor_t();
00153
00154 virtual void
00155 set_name( const std::string & name );
00156
00157 private :
00158 std_cpp_mapping_t & m_cpp_mapping;
00159 };
00160
00161
00162
00163
00164 SMART_REF_3_DECL_REF( std_cpp_mapping_editor_t, class )
00165
00166
00167
00168
00169
00170
00173 class std_type_editor_t :
00174 public type_editor_t
00175 {
00176 public :
00177 std_type_editor_t(
00178 std_scheme_t & scheme );
00179 virtual ~std_type_editor_t();
00180
00182
00183 void
00184 def( const std::string & name );
00185
00187
00189 void
00190 make_defined();
00191
00194 virtual void
00195 make_abstract();
00196
00197 virtual void
00198 make_extensible();
00199
00200 virtual void
00201 add_base(
00202 const std::string & name,
00203 bool is_virtual );
00204
00205 virtual void
00206 add_base_as_extension(
00207 const std::string & name );
00208
00209 virtual attr_editor_t &
00210 start_attr_def(
00211 const std::string & attr_name,
00212 const std::string & type_name );
00213
00214 virtual void
00215 commit_attr_def();
00216
00217 virtual void
00218 rollback_attr_def();
00219
00220 virtual cpp_mapping_editor_t &
00221 cpp_mapping();
00222
00223 virtual void
00224 start_extension();
00225
00226 virtual void
00227 turn_subclassing_by_extension_on();
00229
00230 private :
00232 std_scheme_t & m_scheme;
00233
00235 ref_std_type_t m_ref_type;
00236
00238
00242 ref_std_attr_editor_t m_ref_attr_editor;
00243
00246 ref_std_cpp_mapping_editor_t m_ref_cpp_mapping_editor;
00247
00252 unsigned int m_extension_deep;
00253 };
00254
00255
00256
00257
00258 SMART_REF_3_DECL_REF( std_type_editor_t, class )
00259
00260
00261
00262
00263 class std_scheme_t :
00264 public scheme_t {
00265 public :
00266 std_scheme_t();
00267 virtual ~std_scheme_t();
00268
00269
00270
00271
00272 virtual size_t
00273 query_type_count() const;
00274
00275
00276
00277
00278 virtual const type_t &
00279 query_type( size_t index ) const;
00280
00281
00282
00283
00284 virtual const type_t *
00285 find_type( const std::string & name ) const;
00286
00287
00288
00289
00290
00291
00292 virtual type_editor_t &
00293 start_type_def(
00294 const std::string & name );
00295
00296
00297
00298
00299
00300
00301 virtual void
00302 commit_type_def();
00303
00304
00305
00306
00307 virtual void
00308 rollback_type_def();
00309
00310
00311
00312
00313 const ref_std_type_t &
00314 find_or_create_type(
00315 const std::string & name );
00316
00317 private :
00318 typedef std::deque< ref_std_type_t > ref_std_type_deque_t;
00319
00321
00326 ref_std_type_deque_t m_builtin_types;
00327
00328
00329 ref_std_type_deque_t m_user_types;
00330
00331
00332
00333
00334 typedef std::map< std::string, std_type_t *,
00335 std::less< std::string > >
00336 type_map_t;
00337
00338 type_map_t m_type_map;
00339
00340
00341
00342
00343
00344
00345 ref_std_type_editor_t m_ref_type_editor;
00346
00347
00348 void
00349 add_to_map( std_type_t & type );
00350
00351
00352 void
00353 fill_builtin_types();
00354
00355
00356 void
00357 add_builtin_type(
00358 const std::string & name );
00359
00364 void
00365 add_builtin_serializable_t();
00366 };
00367
00368 }
00369
00370 }
00371
00372 }
00373
00374 #endif