Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/MariaDB/sql/   (MariaDB Server Version 8.1-8.4©)  Datei vom 1.9.2026 mit Größe 4 kB image not shown  

Quelle  scan_char.h   Sprache: C

 

/* Copyright (c) 2024, MariaDB Corporation.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA */


#ifndef SCAN_CHAR_H
#define SCAN_CHAR_H


/**
  A helper class to store the head character of a string,
  with help of a charlen() call.
*/

class Scan_char
{
  const char *m_ptr; // The start of the character
  int m_length;      // The result:
                     // >0   - the character octet length
                     // <=0  - an error (e.g. end of input, wrong byte sequence)
public:
  Scan_char(CHARSET_INFO *const cs, const char *str, const char *end)
   :m_ptr(str), m_length(cs->charlen(str, end))
  { }
  // Compare if two non-erroneous characters are equal
  bool eq(const Scan_char &rhs) const
  {
    DBUG_ASSERT(m_length > 0);
    DBUG_ASSERT(rhs.m_length > 0);
    return m_length == rhs.m_length &&
           !memcmp(m_ptr, rhs.m_ptr, (size_t) m_length);
  }
  // Compare if two possibly erroneous characters are equal
  bool eq_safe(const Scan_char &rhs) const
  {
    return m_length == rhs.m_length && m_length > 0 &&
           !memcmp(m_ptr, rhs.m_ptr, (size_t) m_length);
  }
  const char *ptr() const { return m_ptr; }
  int length() const { return m_length; }
};


#endif // SCAN_CHAR_H

Messung V0.5 in Prozent
C=84 H=100 G=92

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-10-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.