BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Parameter.cpp
Go to the documentation of this file.
1#include "Parameter.h"
2#include <strutil.h>
5
6using namespace BPMNOS::Model;
7
9 : element(parameter)
10 , name(parameter->name.value.value)
11 , expression(getExpression(parameter, attributeRegistry))
12{
13}
14
15std::unique_ptr<const Expression> Parameter::getExpression(XML::bpmnos::tParameter* parameter, const AttributeRegistry& attributeRegistry) const {
16 if ( !parameter->value.has_value() || strutil::trim_copy(parameter->value->get().value).empty() ) {
17 return nullptr;
18 }
19
20 return std::make_unique<const Expression>(encodeCollection(encodeQuotedStrings(parameter->value->get().value)),attributeRegistry,true);
21}
22
std::unique_ptr< const Expression > getExpression(XML::bpmnos::tParameter *parameter, const AttributeRegistry &attributeRegistry) const
Definition Parameter.cpp:15
Parameter(XML::bpmnos::tParameter *parameter, const AttributeRegistry &attributeRegistry)
Definition Parameter.cpp:8
std::optional< std::reference_wrapper< Attribute > > value
Attribute value can be expected to be of type 'std::string'.
Definition tParameter.h:47
std::string encodeQuotedStrings(std::string text)
std::string encodeCollection(std::string text)
Function to replace a collection that is not preceded by an alphanumeric or underscore.