예제 #1
0
static 
#if HAVE_SWIFTEN_3
FormField::ref
#else
TextPrivateFormField::ref
#endif
createTextPrivateField(const std::string &name, const std::string &label, bool required) {
#if HAVE_SWIFTEN_3
	FormField::ref field = SWIFTEN_SHRPTR_NAMESPACE::make_shared<FormField>(FormField::TextPrivateType);
#else
	TextPrivateFormField::ref field = TextPrivateFormField::create();
#endif
	field->setName(name);
	field->setLabel(label);
	field->setRequired(required);
	return field;
}
예제 #2
0
static 
#if HAVE_SWIFTEN_3
FormField::ref
#else
BooleanFormField::ref
#endif
createBooleanField(const std::string &name, const std::string &value, const std::string &label, bool required) {
#if HAVE_SWIFTEN_3
	FormField::ref field = SWIFTEN_SHRPTR_NAMESPACE::make_shared<FormField>(FormField::BooleanType, value);
#else
	BooleanFormField::ref field = BooleanFormField::create();
	field->setValue(value == "1");
#endif
	field->setName(name);
	field->setLabel(label);
	field->setRequired(required);
	return field;
}