Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / Config / Config_AttributeMessage.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef ATTRIBUTE_MESSAGE_H
22 #define ATTRIBUTE_MESSAGE_H
23
24 #include <Config_def.h>
25 #include <Config_FeatureMessage.h>
26 #include <Events_Message.h>
27
28 #include <string>
29 #include <list>
30
31 /*!
32  * \class Config_AttributeMessage
33  * \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
34  * \code
35  * <widget id="tool_object" concealment="true" obligatory="0"/>
36  * \endcode
37  */
38 class Config_AttributeMessage : public Events_Message
39 {
40   std::string myAttributeId; ///< Attribute's unique id
41   std::string myFeatureId; ///< Attribute's feature's unique id
42   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
43   bool myIsConcealment; ///< If true, conceals features used as input
44   ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
45   std::list<std::pair<std::string, std::string> > myCases;
46
47 public:
48   /// Same event as Config_FeatureMessage::MODEL_EVENT()
49   inline static const char* MODEL_EVENT()
50   {
51     return Config_FeatureMessage::MODEL_EVENT();
52   }
53
54   /// Constructor
55   CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0);
56   /// Destructor
57   CONFIG_EXPORT virtual ~Config_AttributeMessage();
58
59   //Auto-generated getters/setters
60   /// Returns attribute's unique id
61   CONFIG_EXPORT const std::string& attributeId() const;
62   /// Returns attribute's feature's unique id
63   CONFIG_EXPORT const std::string& featureId() const;
64   /// Returns true if attribute is obligatory:
65   /// Required to be set by user, else it's feature is invalid.
66   CONFIG_EXPORT bool isObligatory() const;
67   /// Returns true if attribute should conceal input features
68   CONFIG_EXPORT bool isConcealment() const;
69   /// Returns container of ids of pair of a case and switches
70   CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
71   /// Sets ids of pair of a case and switches
72   CONFIG_EXPORT void setCases(const std::list<std::pair<std::string, std::string> >& theCases);
73
74   /// Set attribute's unique id
75   CONFIG_EXPORT void setAttributeId(const std::string& theId);
76   /// Set attribute's feature's unique id
77   CONFIG_EXPORT void setFeatureId(const std::string& id);
78   /// Set attribute's concealment state
79   CONFIG_EXPORT void setConcealment(bool isConcealment);
80   /// Set attribute's obligatory state
81   CONFIG_EXPORT void setObligatory(bool isObligatory);
82 };
83
84 #endif // ATTRIBUTE_MESSAGE_H