]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI_Integer.cpp
Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Integer.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name   : ModelHighAPI_Integer.cpp
3 // Purpose:
4 //
5 // History:
6 // 29/03/16 - Sergey POKHODENKO - Creation of the file
7
8 //--------------------------------------------------------------------------------------
9 #include "ModelHighAPI_Integer.h"
10
11 #include <ModelAPI_AttributeInteger.h>
12 //--------------------------------------------------------------------------------------
13
14 //--------------------------------------------------------------------------------------
15 ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue)
16 : myVariantType(VT_INT)
17 , myInt(theValue)
18 {
19 }
20
21 ModelHighAPI_Integer::ModelHighAPI_Integer(const std::string & theValue)
22 : myVariantType(VT_STRING)
23 , myString(theValue)
24 {
25 }
26
27 ModelHighAPI_Integer::ModelHighAPI_Integer(const char * theValue)
28 : myVariantType(VT_STRING)
29 , myString(theValue)
30 {
31 }
32
33 ModelHighAPI_Integer::~ModelHighAPI_Integer()
34 {
35 }
36
37 //--------------------------------------------------------------------------------------
38 void ModelHighAPI_Integer::fillAttribute(
39     const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute) const
40 {
41   switch(myVariantType) {
42     case VT_INT: theAttribute->setValue(myInt); return;
43     case VT_STRING: theAttribute->setText(myString); return;
44   }
45 }
46
47 int ModelHighAPI_Integer::intValue() const
48 {
49   // needed for array of integer, which supports no text
50   return myInt;
51 }