Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76709 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2012-01-26 14:25:00


Author: trademark
Date: 2012-01-26 14:25:00 EST (Thu, 26 Jan 2012)
New Revision: 76709
URL: http://svn.boost.org/trac/boost/changeset/76709

Log:
Provides functors for the first checking step.
Encapsulate some functions of the cctype include.
Added:
   sandbox/SOC/2011/checks/boost/checks/lexical_filter.hpp (contents, props changed)

Added: sandbox/SOC/2011/checks/boost/checks/lexical_filter.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/boost/checks/lexical_filter.hpp 2012-01-26 14:25:00 EST (Thu, 26 Jan 2012)
@@ -0,0 +1,77 @@
+// Boost checks/lexical_filter.hpp header file ------------------------------------//
+// (C) Copyright Pierre Talbot 2012
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org for updates, documentation, and revision history.
+
+/*! \file
+ \brief Provides type encapsulated cctype functions and more for checking sequence.
+*/
+
+#ifndef BOOST_CHECKS_LEXICAL_FILTER_HPP
+#define BOOST_CHECKS_LEXICAL_FILTER_HPP
+
+#ifdef _MSC_VER
+ #pragma once
+#endif
+
+#include <functional>
+#include <cctype>
+
+namespace boost{
+ namespace checks{
+
+/* Check if character is alphanumeric.
+*/
+template <typename value_type>
+struct isalnum : public std::unary_function<value_type, bool>
+{
+ bool operator()(const value_type &x)
+ {
+ return std::isalnum(x);
+ }
+};
+
+/* Check if character is decimal digit plus the special character 'X' (often occurs
+as check digit instead of 10).
+*/
+template <typename value_type>
+struct isdigitx : public std::unary_function<value_type, bool>
+{
+ bool operator()(const value_type &x)
+ {
+ return isdigit(x) || x == 'x' || x == 'X';
+ }
+};
+
+/*
+Check if character is alphabetic.
+*/
+template <typename value_type>
+struct isalpha : public std::unary_function<value_type, bool>
+{
+ bool operator()(const value_type &x)
+ {
+ return isalpha(x);
+ }
+};
+
+/*
+Check if character is decimal digit.
+*/
+template <typename value_type>
+struct isdigit : public std::unary_function<value_type, bool>
+{
+ bool operator()(const value_type &x)
+ {
+ return isdigit(x);
+ }
+};
+
+
+
+}} // namespace boost namespace checks
+
+
+#endif // BOOST_CHECKS_LEXICAL_FILTER_HPP
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk