1 // Name : ModelHighAPI_Integer.cpp
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Integer.h"
10 #include <ModelAPI_AttributeInteger.h>
11 //--------------------------------------------------------------------------------------
13 //--------------------------------------------------------------------------------------
14 ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue)
19 ModelHighAPI_Integer::ModelHighAPI_Integer(const std::string & theValue)
24 ModelHighAPI_Integer::ModelHighAPI_Integer(const char * theValue)
29 ModelHighAPI_Integer::~ModelHighAPI_Integer()
33 //--------------------------------------------------------------------------------------
34 struct fill_visitor : boost::static_visitor<void>
36 mutable std::shared_ptr<ModelAPI_AttributeInteger> myAttribute;
38 fill_visitor(const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
39 : myAttribute(theAttribute) {}
41 void operator()(int theValue) const { myAttribute->setValue(theValue); }
42 void operator()(const std::string & theValue) const { myAttribute->setText(theValue); }
45 void ModelHighAPI_Integer::fillAttribute(
46 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute) const
48 boost::apply_visitor(fill_visitor(theAttribute), myValue);