ABNF Utilities Library 1.0.1

Delphi 4 to 2009 and Kylix 3 Implementation

by Dieter Köhler


LICENSE

The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at "http://www.mozilla.org/MPL/"

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is "AbnfUtils.pas".

The Initial Developer of the Original Code is Dieter Köhler (Heidelberg, Germany, "http://www.philo.de/"). Portions created by the Initial Developer are Copyright (C) 2003-2008 Dieter Köhler. All Rights Reserved.

Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL or the GPL.


Introduction

The ABNF Utilities Library contains helper functions to check whether a given character, string, wide character or wide string conforms to the Augmented Backus-Naur Form (ABNF) Core Rules. ABNF is specified in: Crocker, D. and P. Overell: "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997, see <http://www.ietf.org/rfc/rfc2234.txt>. The latest version of this software is available at <http://www.philo.de/xml/>.


Using the unit

The ABNF Utilities Library does not contain any components to be registered. So using it from inside your own projects is very simple: Add "AbnfUtils" to the uses clause of your unit and make sure that the path to the location of the AbnfUtils.pas file is included in Delphi's list of library paths. To include it go to the Library section of Delphi's Environment Options dialog (see the menu item: "Tools/Environment Options ...").


Routines for Testing ABNF Core Rules

String and Character Test Functions

The following functions serve to check whether a string S or char C conforms to the respective Augmented Backus-Naur Form (ABNF) core rule (see [RFC 2234], § 6.1). All functions return 'true' if S or C conforms to the rule, otherwise 'false' is returned.

function IsAbnfALPHAChar(C: Char): Boolean;
function IsAbnfBITChar(C: Char): Boolean;
function IsAbnfCHARChar(C: Char): Boolean;
function IsAbnfCRChar(C: Char): Boolean;
function IsAbnfCRLFStr(S: String): Boolean;
function IsAbnfCTLChar(C: Char): Boolean;
function IsAbnfDIGITChar(C: Char): Boolean;
function IsAbnfDQUOTEChar(C: Char): Boolean;
function IsAbnfHEXDIGChar(C: Char): Boolean;
function IsAbnfHTABChar(C: Char): Boolean;
function IsAbnfLFChar(C: Char): Boolean;
function IsAbnfLWSPStr(S: String): Boolean;
function IsAbnfOCTETChar(C: Char): Boolean;
function IsAbnfSPChar(C: Char): Boolean;
function IsAbnfVCHARChar(C: Char): Boolean;
function IsAbnfWSPChar(C: Char): Boolean;

Wide String and Wide Character Test Functions

The following functions serve to check whether a WideString S or WideChar C conforms to the respective Augmented Backus-Naur Form (ABNF) core rule (see [RFC 2234], § 6.1). All functions return 'true' if S or C conforms to the rule, otherwise 'false' is returned.

function IsAbnfALPHAWideChar(C: WideChar): Boolean;
function IsAbnfBITWideChar(C: WideChar): Boolean;
function IsAbnfCHARWideChar(C: WideChar): Boolean;
function IsAbnfCRWideChar(C: WideChar): Boolean;
function IsAbnfCRLFWideStr(S: WideString): Boolean;
function IsAbnfCTLWideChar(C: WideChar): Boolean;
function IsAbnfDIGITWideChar(C: WideChar): Boolean;
function IsAbnfDQUOTEWideChar(C: WideChar): Boolean;
function IsAbnfHEXDIGWideChar(C: WideChar): Boolean;
function IsAbnfHTABWideChar(C: WideChar): Boolean;
function IsAbnfLFWideChar(C: WideChar): Boolean;
function IsAbnfLWSPWideStr(S: WideString): Boolean;
function IsAbnfOCTETWideChar(C: WideChar): Boolean;
function IsAbnfSPWideChar(C: WideChar): Boolean;
function IsAbnfVCHARWideChar(C: WideChar): Boolean;
function IsAbnfWSPWideChar(C: WideChar): Boolean;