Documentation for OpenFLUID 2.2.0
BuilderExtensionSignature.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  @file BuilderExtensionSignature.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_BUILDEREXT_BUILDEREXTENSIONSIGNATURE_HPP__
41 #define __OPENFLUID_BUILDEREXT_BUILDEREXTENSIONSIGNATURE_HPP__
42 
43 
45 #include <openfluid/config.hpp>
46 #include <openfluid/dllexport.hpp>
47 
48 
49 namespace openfluid { namespace builderext {
50 
51 
53 
55 
57 
58 
60 {
61  public:
62 
64 
66 
68 
69  std::string MenuText;
70 
71  std::map<std::string,std::string> ConfigParameters; // NOTE currently not used
72 
73 
76  { }
77 
78  virtual ~BuilderExtensionSignature() = default;
79 
81  {
83  }
84 
85  std::string getModeAsString() const
86  {
87  if (Mode == ExtensionMode::MODAL)
88  {
89  return "modal";
90  }
91  else if (Mode == ExtensionMode::MODELESS)
92  {
93  return "modeless";
94  }
95  else if (Mode == ExtensionMode::WORKSPACE)
96  {
97  return "workspace";
98  }
99  return "";
100  }
101 
102  bool setModeFromString(const std::string& M)
103  {
104  if (M == "modal")
105  {
106  Mode = ExtensionMode::MODAL;
107  return true;
108  }
109  else if (M == "modeless")
110  {
112  return true;
113  }
114  else if (M == "workspace")
115  {
117  return true;
118  }
119  return false;
120  }
121 
122  std::string getCategoryAsString() const
123  {
124  if (Category == ExtensionCategory::MODEL)
125  {
126  return "model";
127  }
128  else if (Category == ExtensionCategory::SPATIAL)
129  {
130  return "spatial";
131  }
132  else if (Category == ExtensionCategory::RESULTS)
133  {
134  return "results";
135  }
136  return "other";
137  }
138 
139  bool setCategoryFromString(const std::string& C)
140  {
141  if (C == "model")
142  {
143  Category = ExtensionCategory::MODEL;
144  return true;
145  }
146  else if (C == "spatial")
147  {
148  Category = ExtensionCategory::SPATIAL;
149  return true;
150  }
151  else if (C == "results")
152  {
153  Category = ExtensionCategory::RESULTS;
154  return true;
155  }
156  else if (C == "other")
157  {
158  Category = ExtensionCategory::OTHER;
159  return true;
160  }
161  return false;
162  }
163 };
164 
165 
166 } } // namespaces
167 
168 
169 #endif /* __OPENFLUID_BUILDEREXT_BUILDEREXTENSIONSIGNATURE_HPP__ */
Definition: BuilderExtensionSignature.hpp:60
bool setCategoryFromString(const std::string &C)
Definition: BuilderExtensionSignature.hpp:139
std::string MenuText
Definition: BuilderExtensionSignature.hpp:69
ExtensionMode Mode
Definition: BuilderExtensionSignature.hpp:65
bool setModeFromString(const std::string &M)
Definition: BuilderExtensionSignature.hpp:102
std::map< std::string, std::string > ConfigParameters
Definition: BuilderExtensionSignature.hpp:71
ExtensionCategory Category
Definition: BuilderExtensionSignature.hpp:63
std::string getCategoryAsString() const
Definition: BuilderExtensionSignature.hpp:122
std::string getModeAsString() const
Definition: BuilderExtensionSignature.hpp:85
BuilderExtensionSignature()
Definition: BuilderExtensionSignature.hpp:74
openfluid::ware::WareType getType() const
Definition: BuilderExtensionSignature.hpp:80
ExtensionRole Role
Definition: BuilderExtensionSignature.hpp:67
Definition: WareSignature.hpp:56
#define OPENFLUID_API
Definition: dllexport.hpp:86
ExtensionMode
Definition: BuilderExtensionSignature.hpp:56
ExtensionCategory
Definition: BuilderExtensionSignature.hpp:52
ExtensionRole
Definition: BuilderExtensionSignature.hpp:54
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47