JS8Call-Improved master
Loading...
Searching...
No Matches
Maidenhead Namespace Reference

Namespace containing utilities for managing Maidenhead grid locators. More...

Classes

class  Validator
 Custom Qt validator for stateful UI evaluation of Maidenhead strings. More...

Typedefs

using StandardValidator = Validator<2, 3>
 Convenience validator requiring Field and Square, allowing Subsquare.
using ExtendedValidator = Validator<2, 6>
 Convenience validator permitting high fidelity sub-allocations up to Hyper Extended format.

Functions

constexpr char16_t normalize (char16_t const u) noexcept
 Converts a lowercase character code point to uppercase if applicable.
constexpr auto invalidIndex (QStringView const view) noexcept
 Locates the first invalid character index in a locator string view.
template<qsizetype Min = 2, qsizetype Max = 6>
constexpr auto valid (QStringView const view) noexcept
 Assesses whether a complete string view matches acceptable grid lengths and constraints.

Detailed Description

Namespace containing utilities for managing Maidenhead grid locators.

Provides underlying character validation, bounds checking, string validation, and custom Qt input validators.

Typedef Documentation

◆ ExtendedValidator

Convenience validator permitting high fidelity sub-allocations up to Hyper Extended format.

Standard fitment for exact base station grid alignments. Expects between 2 and 6 character pairs.

◆ StandardValidator

Convenience validator requiring Field and Square, allowing Subsquare.

Perfect for basic contact (QSO) logging setups. Expects between 2 and 3 character pairs.

Function Documentation

◆ invalidIndex()

auto Maidenhead::invalidIndex ( QStringView const view)
constexprnoexcept

Locates the first invalid character index in a locator string view.

Scans the provided view character-by-character based on standard and extended Maidenhead format pairs. Validation is case-insensitive.

Note
  • A view that is incomplete, but correct up to its length, is considered valid.
  • Odd-length or zero-length views return their respective sizes, signifying they are valid so far.

Maidenhead Structure Definitions:

  • Pair 1 (Field): [0, 1] -> Range [A-R]
  • Pair 2 (Square): [2, 3] -> Range [0-9]
  • Pair 3 (Subsquare): [4, 5] -> Range [A-X]
  • Pair 4 (Extended): [6, 7] -> Range [0-9]
  • Pair 5 (Ultra Ext): [8, 9] -> Range [A-X]
  • Pair 6 (Hyper Ext): [10, 11] -> Range [0-9]
Parameters
[in]viewThe string view tracking the user input grid locator string.
Returns
The index of the first character breaking format rules, or view.size() if valid so far.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalize()

char16_t Maidenhead::normalize ( char16_t const u)
constexprnoexcept

Converts a lowercase character code point to uppercase if applicable.

Provides a constexpr alternative to QChar::toUpper(), allowing for compile-time evaluation. Non-alphabetic and uppercase characters are returned unchanged.

Parameters
[in]uThe 16-bit Unicode character value to process.
Returns
The uppercase equivalent if u is in the range [a-z]; otherwise u.
Here is the caller graph for this function:

◆ valid()

template<qsizetype Min = 2, qsizetype Max = 6>
auto Maidenhead::valid ( QStringView const view)
constexprnoexcept

Assesses whether a complete string view matches acceptable grid lengths and constraints.

Verifies that the input length is even, fits within the designated bounds, and contains no character validation failures.

Template Parameters
MinThe minimum allowed pairs (Defaults to 2, e.g., Field + Square).
MaxThe maximum allowed pairs (Defaults to 6, up to Hyper-Extended).
Parameters
[in]viewThe complete string view to be evaluated.
Returns
true if completely structured and within bounds, false otherwise.
Here is the call graph for this function: