@@ -365,39 +365,33 @@ class Module
365
365
// return std::find(from_enum_.begin(), from_enum_.end(), name) != from_enum_.end();
366
366
// }
367
367
368
- // bool create_constant(
369
- // const std::string& name,
370
- // v1_3::DynamicData_ptr value ,
371
- // bool replace = false,
372
- // bool from_enumeration = false)
373
- // {
374
- // if (name.find("::") != std::string::npos)
375
- // {
376
- // return false; // Cannot add a symbol with scoped name.
377
- // }
368
+ bool create_constant (
369
+ const std::string& name,
370
+ DynamicData::_ref_type xdata ,
371
+ bool replace = false ,
372
+ bool from_enumeration = false )
373
+ {
374
+ if (name.find (" ::" ) != std::string::npos)
375
+ {
376
+ return false ; // Cannot add a symbol with scoped name.
377
+ }
378
378
379
- // if (replace)
380
- // {
381
- // auto it = constants_.find(name);
382
- // if (it != constants_.end())
383
- // {
384
- // constants_.erase(it);
385
- // constants_types_.erase(constants_types_.find(name));
386
- // }
387
- // }
379
+ if (replace)
380
+ {
381
+ auto it = constants_.find (name);
382
+ if (it != constants_.end ())
383
+ {
384
+ constants_.erase (it);
385
+ }
386
+ }
388
387
389
- // auto inserted = constants_types_.emplace(name, Type(*this, *value->get_type()));
390
- // if (inserted.second)
391
- // {
392
- // auto result = constants_.emplace(name, value);
393
- // if (result.second && from_enumeration)
394
- // {
395
- // from_enum_.push_back(name);
396
- // }
397
- // return result.second;
398
- // }
399
- // return false;
400
- // }
388
+ auto result = constants_.emplace (name, xdata);
389
+ if (result.second && from_enumeration)
390
+ {
391
+ from_enum_.push_back (name);
392
+ }
393
+ return result.second ;
394
+ }
401
395
402
396
// bool has_enum_32(
403
397
// const std::string& name) const
@@ -533,8 +527,8 @@ class Module
533
527
534
528
std::map<std::string, DynamicTypeBuilder::_ref_type> aliases_;
535
529
// std::map<std::string, Type> constants_types_;
536
- // std::map<std::string, v1_3::DynamicData_ptr > constants_;
537
- // std::vector<std::string> from_enum_;
530
+ std::map<std::string, DynamicData::_ref_type > constants_;
531
+ std::vector<std::string> from_enum_;
538
532
std::map<std::string, DynamicTypeBuilder::_ref_type> enumerations_32_;
539
533
std::map<std::string, DynamicTypeBuilder::_ref_type> structs_;
540
534
std::map<std::string, DynamicTypeBuilder::_ref_type> unions_;
0 commit comments