Exemplo n.º 1
0
/**
 * @return false if there is at least one ASCII letter in the string
 */
gcc_pure
static bool
LacksAlphaASCII(const TCHAR *s)
{
  for (; *s != 0; ++s)
    if (IsAlphaASCII(*s))
      return false;

  return true;
}
Exemplo n.º 2
0
/**
 * @return false if there is at least one ASCII letter in the string
 */
gcc_pure
static bool
LacksAlphaASCII(const TCHAR *s)
{
  while (*s) {
    if (IsAlphaASCII(*s))
      return false;

    s++;
  }
  return true;
}
Exemplo n.º 3
0
constexpr
static inline bool
IsAlphaNumericASCII(char ch)
{
  return IsAlphaASCII(ch) || IsDigitASCII(ch);
}
Exemplo n.º 4
0
bool
NMEAParser::ParseLine(const char *string, NMEAInfo &info)
{
    assert(positive(info.clock));

    if (string[0] != '$')
        return false;

    if (!NMEAChecksum(string))
        return false;

    NMEAInputLine line(string);

    char type[16];
    line.Read(type, 16);

    if (IsAlphaASCII(type[1]) && IsAlphaASCII(type[2])) {
        if (StringIsEqual(type + 3, "GSA"))
            return GSA(line, info);

        if (StringIsEqual(type + 3, "GLL"))
            return GLL(line, info);

        if (StringIsEqual(type + 3, "RMC"))
            return RMC(line, info);

        if (StringIsEqual(type + 3, "GGA"))
            return GGA(line, info);

        if (StringIsEqual(type + 3, "HDM"))
            return HDM(line, info);
    }

    // if (proprietary sentence) ...
    if (type[1] == 'P') {
        // Airspeed and vario sentence
        if (StringIsEqual(type + 1, "PTAS1"))
            return PTAS1(line, info);

        // FLARM sentences
        if (StringIsEqual(type + 1, "PFLAE")) {
            ParsePFLAE(line, info.flarm.error, info.clock);
            return true;
        }

        if (StringIsEqual(type + 1, "PFLAV")) {
            ParsePFLAV(line, info.flarm.version, info.clock);
            return true;
        }

        if (StringIsEqual(type + 1, "PFLAA")) {
            ParsePFLAA(line, info.flarm.traffic, info.clock);
            return true;
        }

        if (StringIsEqual(type + 1, "PFLAU")) {
            ParsePFLAU(line, info.flarm.status, info.clock);
            return true;
        }

        // Garmin altitude sentence
        if (StringIsEqual(type + 1, "PGRMZ"))
            return RMZ(line, info);

        return false;
    }

    return false;
}
Exemplo n.º 5
0
gcc_pure gcc_nonnull_all
static constexpr bool
IsDrive(Path::const_pointer p)
{
  return IsAlphaASCII(p[0]) && p[1] == ':';
}
Exemplo n.º 6
0
gcc_pure gcc_nonnull_all
static constexpr bool
IsDrive(const TCHAR *p)
{
    return IsAlphaASCII(p[0]) && p[1] == ':';
}