MCPcopy Create free account
hub / github.com/cutelyst/cutelyst / fileSize

Method fileSize

tests/testvalidator.cpp:736–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734 // ***** Endpoint for ValidatorFileSize ******
735 C_ATTR(fileSize, :Local :AutoArgs)
736 void fileSize(Context *c)
737 {
738 ValidatorFileSize::Option option = ValidatorFileSize::NoOption;
739 const QString opt = c->req()->bodyParameter(u"option"_s);
740 if (opt == u"OnlyBinary") {
741 option = ValidatorFileSize::OnlyBinary;
742 } else if (opt == u"OnlyDecimal") {
743 option = ValidatorFileSize::OnlyDecimal;
744 } else if (opt == u"ForceBinary") {
745 option = ValidatorFileSize::ForceBinary;
746 } else if (opt == u"ForceDecimal") {
747 option = ValidatorFileSize::ForceDecimal;
748 }
749 const double minParam = c->req()->bodyParameter(u"min"_s, u"-1.0"_s).toDouble();
750 const double maxParam = c->req()->bodyParameter(u"max"_s, u"-1.0"_s).toDouble();
751 c->setLocale(QLocale(c->req()->bodyParameter(u"locale"_s, u"C"_s)));
752 Validator v(
753 {new ValidatorFileSize(u"field"_s, option, minParam, maxParam, m_validatorMessages)});
754 checkResponse(c, v.validate(c, Validator::NoTrimming));
755 }
756
757 // ***** Endpoint for ValidatorFileSize with return value check *****
758 C_ATTR(fileSizeValue, :Local :AutoArgs)

Callers

nothing calls this directly

Calls 4

reqMethod · 0.80
setLocaleMethod · 0.80
bodyParameterMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected