Salome HOME
Issue #1865 : initial implementation of the "Fields" feature and additional attribute...
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeStringArray.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_AttributeStringArray.h
4 // Created:     14 Nov 2016
5 // Author:      Mikhail Ponikarov
6
7 #ifndef ModelAPI_AttributeStringArray_H_
8 #define ModelAPI_AttributeStringArray_H_
9
10 #include <ModelAPI.h>
11 #include <ModelAPI_Attribute.h>
12
13 #include <string>
14
15 /// \class ModelAPI_AttributeStringArray
16 /// \ingroup DataModel
17 /// \brief API for the attribute that contains several strings in the array inside.
18 class ModelAPI_AttributeStringArray: public ModelAPI_Attribute
19 {
20 public:
21   /// Returns the size of the array (zero means that it is empty)
22   MODELAPI_EXPORT virtual int size() = 0;
23
24   /// Sets the new size of the array. The previous data is erased.
25   MODELAPI_EXPORT virtual void setSize(const int theSize) = 0;
26
27   /// Defines the value of the array by index [0; size-1]
28   MODELAPI_EXPORT virtual void setValue(const int theIndex,
29                                         const std::string theValue) = 0;
30
31   /// Returns the value by the index
32   MODELAPI_EXPORT virtual std::string value(const int theIndex) = 0;
33
34   /// Returns the type of this class of attributes
35   MODELAPI_EXPORT static std::string typeId()
36   {
37     return "StringArray";
38   }
39
40   /// Returns the type of this class of attributes, not static method
41   MODELAPI_EXPORT virtual std::string attributeType();
42
43   /// To virtually destroy the fields of successors
44   MODELAPI_EXPORT virtual ~ModelAPI_AttributeStringArray();
45
46 protected:
47   /// Objects are created for features automatically
48   MODELAPI_EXPORT ModelAPI_AttributeStringArray();
49 };
50
51 /// Pointer on string attribute
52 typedef std::shared_ptr<ModelAPI_AttributeStringArray> AttributeStringArrayPtr;
53
54 #endif