20 #ifndef _TULIPWITHPARAMETER 21 #define _TULIPWITHPARAMETER 27 #include <tulip/tulipconf.h> 33 template<
class itType >
71 std::string defaultValue;
77 const std::string& help,
const std::string& defaultValue,
79 : name(name), type(type), help(help),
80 defaultValue(defaultValue), mandatory(mandatory),
81 direction(direction) {}
111 defaultValue = defVal;
136 return (direction != OUT_PARAM) ||
138 (type.find(
"Property") != std::string::npos);
163 template<
typename T>
void add(
const std::string& parameterName,
164 const std::string& help,
165 const std::string& defaultValue,
166 bool isMandatory =
true,
168 const std::string &valuesDescription = std::string()) {
169 for (
unsigned int i = 0; i < parameters.size(); ++i) {
170 if (parameters[i].getName() == parameterName) {
172 tlp::warning() <<
"ParameterDescriptionList::add " << parameterName <<
" already exists" << std::endl;
180 generateParameterHTMLDocumentation(parameterName, help,
typeid(T).name(), defaultValue, valuesDescription, direction),
182 isMandatory, direction);
183 parameters.push_back(newParameter);
191 tlp::Iterator<ParameterDescription>* getParameters()
const;
199 const std::string& getDefaultValue(
const std::string& parameterName)
const;
208 void setDefaultValue(
const std::string& parameterName,
209 const std::string& value);
218 void setDirection(
const std::string& parameterName,
227 bool isMandatory(
const std::string& parameterName)
const;
237 void buildDefaultDataSet(
DataSet& ioDataSet,
Graph* inG = NULL)
const;
244 inline unsigned int size()
const {
245 return parameters.size();
254 return parameters.empty();
259 std::string generateParameterHTMLDocumentation(
const std::string &name,
const std::string &help,
260 const std::string &type,
261 const std::string &defaultValue,
262 const std::string &valuesDescription,
264 std::vector<ParameterDescription> parameters;
268 #define HTML_HELP_OPEN() "<!DOCTYPE html><html><head>\ 269 <style type=\"text/css\">.body { font-family: \"Segoe UI\", Candara, \"Bitstream Vera Sans\", \"DejaVu Sans\", \"Bitstream Vera Sans\", \"Trebuchet MS\", Verdana, \"Verdana Ref\", sans-serif; }\ 270 .paramtable { width: 100%; border: 0px; border-bottom: 1px solid #C9C9C9; padding: 5px; }\ 271 .help { font-style: italic; font-size: 90%; }\ 272 .b { padding-left: 5px; }</style>\ 273 </head><body><table border=\"0\" class=\"paramtable\">" 275 #define HTML_HELP_DEF(A,B) "<tr><td><b>" A "</b><td class=\"b\">" B "</td></tr>" 277 #define HTML_HELP_BODY() "</table><p class=\"help\">" 279 #define HTML_HELP_CLOSE() "</p></body></html>" 309 const std::string &help,
310 const std::string &defaultValue,
311 bool isMandatory =
true,
312 const std::string &valuesDescription = std::string()) {
313 parameters.template add<T>(name, help, defaultValue, isMandatory, IN_PARAM, valuesDescription);
328 const std::string &help=std::string(),
329 const std::string &defaultValue = std::string(),
330 bool isMandatory =
true,
331 const std::string &valuesDescription = std::string()) {
332 parameters.template add<T>(name, help, defaultValue, isMandatory, OUT_PARAM, valuesDescription);
347 const std::string &help=std::string(),
348 const std::string &defaultValue = std::string(),
349 bool isMandatory =
true,
350 const std::string &valuesDescription = std::string()) {
351 parameters.template add<T>(name, help, defaultValue, isMandatory, INOUT_PARAM, valuesDescription);
368 const std::string &help=std::string(),
369 const std::string &defaultValue = std::string(),
370 bool isMandatory =
true) {
371 addInParameter<T>(name, help, defaultValue, isMandatory);
379 bool inputRequired()
const;
const std::string & getName() const
bool empty() const
Test if the list is empty.
Interface for Tulip iterators. Allows basic iteration operations only.
void setDirection(ParameterDirection dir)
void addOutParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
Adds an OUT parameter to the plug-in.
A container that can store data from any type.
ParameterDirection getDirection() const
unsigned int size() const
Returns the number of parameters.
void setDefaultValue(const std::string &defVal)
Set the parameter's default value.
ParameterDirection
The ParameterDirection enum describes how a parameter is passed to a plugin The parameter can be seen...
void addParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
Adds an IN parameter to the plug-in (deprecated)
void add(const std::string ¶meterName, const std::string &help, const std::string &defaultValue, bool isMandatory=true, ParameterDirection direction=IN_PARAM, const std::string &valuesDescription=std::string())
Adds a new parameter of type T to the list.
void addInOutParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
Adds an INOUT parameter to the plug-in.
const std::string & getHelp() const
const std::string & getTypeName() const
void addInParameter(const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true, const std::string &valuesDescription=std::string())
Adds an IN parameter to the plug-in.
const std::string & getDefaultValue() const
This class describes parameters taken by a plugin.
Describes a plugin's parameter.
This class describes parameters on a plug-in.