|
WSF
|
#include <RegexValidator.hpp>


Public Member Functions | |
| RegexValidator ()=default | |
| bool | ParseAndValidate (const usmtf::Field &aField) override |
| void | SetRegexExpression (const std::string &aExpression) |
| Configure to run against regex needs. | |
| void | SetErrorMessage (const std::string &aMessage) |
| Public Member Functions inherited from usmtf::FFIRN_Validator | |
| FFIRN_Validator ()=default | |
| const std::string & | GetRawContent () const noexcept |
| Return the content of the field as it was in the USMTF set. | |
| std::vector< std::string > | SplitOnDelimeter (const std::string &value, const std::string &delimeter) |
| Values separated by delimeter. | |
| const std::string & | GetFieldContent () const noexcept |
| Public Member Functions inherited from usmtf::Validatable | |
| bool | IsValid () const noexcept |
| Public Member Functions inherited from usmtf::ErrorManager | |
| virtual | ~ErrorManager ()=default |
| bool | HasErrors () const noexcept |
| void | LogErrors (std::ostream &aOut) const noexcept |
| const std::vector< ValidationError > & | GetErrors () const |
Static Public Attributes | |
| static const std::string | cAny = R"((.*))" |
| static const std::string | c00to90 = R"(([0-8][0-9]|90))" |
| static const std::string | c00to59 = R"(([0-5][0-9]))" |
| static const std::string | c00to59dec000to999 = R"(([0-5][0-9])(.)([0-9]{3}))" |
| static const std::string | c00to59dec0to9 = R"(([0-5][0-9])(.)([0-9]{1}))" |
| static const std::string | c01to60 = R"(([0-5][1-9]|10|20|30|40|50|60))" |
| static const std::string | cNorS = R"((N|S))" |
| static const std::string | cAtoZ = R"((A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z))" |
| static const std::string | c0to9 = R"(([0-9]))" |
| static const std::string | cHyphenDelimeter = R"((-))" |
| static const std::string | c000to180 = R"((0[0-9]{2}|1[0-7][0-9]|180))" |
| static const std::string | c000to359 = R"((0[0-9]{2}|1[0-9]{2}|2[0-9]{2}|3[0-5][0-9]))" |
| static const std::string | c0to999 = R"(([0-9]{1,3}))" |
| static const std::string | c1to999 = R"(([1-9][0-9]{0,2}))" |
| static const std::string | c000to99999 = R"(([0-9]{3,5}))" |
| static const std::string | cEorW = R"((E|W))" |
| static const std::string | cStart = R"(^)" |
| static const std::string | cEnd = R"($)" |
| static const std::string | cSpace = R"( )" |
Protected Attributes | |
| QRegularExpressionMatch | mMatchResults |
| QRegularExpression | mRegexExpression |
| std::string | mRegexString {"No Regex Provided"} |
| std::string | mErrorMessage {"Failed Regex Validation for: " + mRegexString} |
| Protected Attributes inherited from usmtf::FFIRN_Validator | |
| Field | mField |
Additional Inherited Members | |
| Public Types inherited from usmtf::FFIRN_Validator | |
| using | FFIRN_Func = std::function<bool(void)> |
| using | FFIRN_DescriptorMap = std::unordered_map<std::string, FFIRN_Func> |
| Static Public Member Functions inherited from usmtf::FFIRN_Validator | |
| static bool | IsInSelection (const std::string &aValue, const std::vector< std::string > &choices) noexcept |
| static bool | IsStringLength (const std::string &aValue, size_t aLength) noexcept |
| static size_t | CheckForAnyDelimeter (const std::string &aValue, const std::vector< std::string > &aDelimeters) noexcept |
| Returns the positions of a specified delimiter if present, npos if not. | |
| static size_t | CheckForAnyDelimeter (const std::string &aValue, const std::vector< std::string > &aDelimeters, std::string &aFoundDelimeter) noexcept |
| template<class T> | |
| static bool | IsInRange (T aValue, T aLowerBound, T aUpperBound) noexcept |
| Protected Member Functions inherited from usmtf::FFIRN_Validator | |
| bool | ValidateByDescriptor (const FFIRN_DescriptorMap &aDescriptorMap) |
| Speed up validation if descriptor is present. Runs all functions if it isn't. | |
| void | ClearErrorsIfValid (bool aHasAtLeastOnePassed) noexcept |
| void | SetField (const Field &aField) noexcept |
| Field Setter for internal use only. | |
| Protected Member Functions inherited from usmtf::ErrorManager | |
| void | AddError (const ValidationError &aError) noexcept |
| void | AddError (const std::string &aFailureReason, const std::string &aValueValidatied, const std::string &aOptionalSuggestion="") noexcept |
| void | AddError (const std::string &aErrorMessage) noexcept |
| void | AddErrors (const std::vector< ValidationError > &aErrors) noexcept |
| void | ClearErrors () noexcept |
RegexValidator is intended to hand complex cases which cause headaches with traditional rule building Validators. If this works out it will probably become status quo, we didn't build it early naively thinking that it was unnecessary. But now were spending lots of time codifying parse and extraction variances. It was thought they would be more generically reusable.
were using whole value matching because we want parsing after matching to be simplified. If its valid, you should be able to use static string positions. We can if we need move to search for sub-expressions etc.
|
default |
References ParseAndValidate(), SetErrorMessage(), and SetRegexExpression().
|
overridevirtual |
Run against whole field content. If Matches, safely extract portions. I see this be used in conjunction with variant validator quite a bit to solve complex extraction. Lets see!!
Implements usmtf::FFIRN_Validator.
Reimplemented in usmtf::RelativeBearingRange, usmtf::TacanChannel, usmtf::UTM_Location, usmtf::VerifiedLatLonDS, usmtf::VerifiedLatLonS, and usmtf::VerifiedLatLonTM.
References usmtf::ErrorManager::AddError(), usmtf::Field::GetContent(), mErrorMessage, mMatchResults, mRegexExpression, mRegexString, and usmtf::FFIRN_Validator::SetField().
Referenced by usmtf::VerifiedLatLonS::GetLatMinutes(), usmtf::TacanChannel::GetRecieverChannel(), usmtf::Beacon::GetThird(), usmtf::AircraftControlAgency::ParseAndValidate(), usmtf::FreeText::ParseAndValidate(), usmtf::UTM_Location::ParseAndValidate(), and RegexValidator().
| void usmtf::RegexValidator::SetErrorMessage | ( | const std::string & | aMessage | ) |
Help your users understand by providing them something nice to read when validation doesnt pass.
References mErrorMessage.
Referenced by RegexValidator(), and SetRegexExpression().
| void usmtf::RegexValidator::SetRegexExpression | ( | const std::string & | aExpression | ) |
Configure to run against regex needs.
References mRegexExpression, mRegexString, and SetErrorMessage().
Referenced by usmtf::AerialRefuelingSystem::AerialRefuelingSystem(), usmtf::AircraftControlAgency::AircraftControlAgency(), usmtf::Beacon::Beacon(), usmtf::FreeText::FreeText(), usmtf::FuelType::FuelType(), RegexValidator(), usmtf::RelativeBearingRange::RelativeBearingRange(), usmtf::TacanChannel::TacanChannel(), usmtf::UTM_Location::UTM_Location(), usmtf::VerifiedLatLonDS::VerifiedLatLonDS(), usmtf::VerifiedLatLonS::VerifiedLatLonS(), and usmtf::VerifiedLatLonTM::VerifiedLatLonTM().
|
static |
|
static |
Referenced by usmtf::RelativeBearingRange::RelativeBearingRange().
|
static |
Referenced by usmtf::UTM_Location::UTM_Location().
|
static |
Referenced by usmtf::VerifiedLatLonDS::VerifiedLatLonDS(), and usmtf::VerifiedLatLonS::VerifiedLatLonS().
|
static |
Referenced by usmtf::VerifiedLatLonTM::VerifiedLatLonTM().
|
static |
Referenced by usmtf::VerifiedLatLonDS::VerifiedLatLonDS().
|
static |
|
static |
Referenced by usmtf::UTM_Location::UTM_Location().
|
static |
|
static |
Referenced by usmtf::RelativeBearingRange::RelativeBearingRange().
|
static |
Referenced by usmtf::TacanChannel::TacanChannel().
|
static |
Referenced by usmtf::FreeText::FreeText(), and usmtf::RelativeBearingRange::RelativeBearingRange().
|
static |
|
static |
Referenced by usmtf::AerialRefuelingSystem::AerialRefuelingSystem(), usmtf::AircraftControlAgency::AircraftControlAgency(), usmtf::Beacon::Beacon(), usmtf::FreeText::FreeText(), usmtf::FuelType::FuelType(), usmtf::RelativeBearingRange::RelativeBearingRange(), usmtf::TacanChannel::TacanChannel(), usmtf::UTM_Location::UTM_Location(), usmtf::VerifiedLatLonDS::VerifiedLatLonDS(), usmtf::VerifiedLatLonS::VerifiedLatLonS(), and usmtf::VerifiedLatLonTM::VerifiedLatLonTM().
|
static |
|
static |
|
static |
|
static |
Referenced by usmtf::RelativeBearingRange::RelativeBearingRange().
|
static |
Referenced by usmtf::AerialRefuelingSystem::AerialRefuelingSystem(), usmtf::AircraftControlAgency::AircraftControlAgency(), usmtf::Beacon::Beacon(), usmtf::FreeText::FreeText(), usmtf::FuelType::FuelType(), usmtf::RelativeBearingRange::RelativeBearingRange(), usmtf::TacanChannel::TacanChannel(), usmtf::UTM_Location::UTM_Location(), usmtf::VerifiedLatLonDS::VerifiedLatLonDS(), usmtf::VerifiedLatLonS::VerifiedLatLonS(), and usmtf::VerifiedLatLonTM::VerifiedLatLonTM().
|
protected |
Referenced by ParseAndValidate(), and SetErrorMessage().
|
protected |
|
protected |
Referenced by ParseAndValidate(), and SetRegexExpression().
|
protected |
Referenced by ParseAndValidate(), and SetRegexExpression().