Salome HOME
Issue #1865 : initial implementation of the "Fields" feature and additional attribute...
[modules/shaper.git] / src / Model / Model_AttributeStringArray.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeStringArray.h
4 // Created:     14 Nov 2016
5 // Author:      Mikhail Ponikarov
6
7 #ifndef Model_AttributeStringArray_H_
8 #define Model_AttributeStringArray_H_
9
10 #include <Model.h>
11 #include <ModelAPI_AttributeStringArray.h>
12 #include <TDataStd_ExtStringArray.hxx>
13 #include <TDF_Label.hxx>
14
15 /// \class Model_AttributeStringArray
16 /// \ingroup DataModel
17 /// \brief API for the attribute that contains several strings in the array inside.
18 class Model_AttributeStringArray: public ModelAPI_AttributeStringArray
19 {
20 public:
21   /// Returns the size of the array (zero means that it is empty)
22   MODEL_EXPORT virtual int size();
23
24   /// Sets the new size of the array. The previous data is erased.
25   MODEL_EXPORT virtual void setSize(const int theSize);
26
27   /// Defines the value of the array by index [0; size-1]
28   MODEL_EXPORT virtual void setValue(const int theIndex,
29                                      const std::string theValue);
30
31   /// Returns the value by the index
32   MODEL_EXPORT virtual std::string value(const int theIndex);
33
34 protected:
35   /// Objects are created for features automatically
36   MODEL_EXPORT Model_AttributeStringArray(TDF_Label& theLabel);
37
38 private:
39   /// The OCCT array that keeps all values.
40   Handle_TDataStd_ExtStringArray myArray;
41
42   /// Stores the label as a field to set array if size is not null (null array is buggy in OCAF)
43   TDF_Label myLab;
44
45   friend class Model_Data;
46 };
47
48 #endif