strip-space.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_CXX_SECURITY_TRANSFORM_STRIP_SPACE_HPP
23 #define NDN_CXX_SECURITY_TRANSFORM_STRIP_SPACE_HPP
24 
25 #include "transform-base.hpp"
26 #include <bitset>
27 #include <climits>
28 
29 namespace ndn {
30 namespace security {
31 namespace transform {
32 
38 class StripSpace : public Transform
39 {
40 public:
41  static const char* const DEFAULT_WHITESPACES;
42 
43  explicit
44  StripSpace(const char* whitespaces = DEFAULT_WHITESPACES);
45 
46 private:
47  size_t
48  convert(const uint8_t* buf, size_t buflen) final;
49 
50 private:
51  static constexpr size_t CHARMAP_SIZE = 1 << CHAR_BIT;
52  std::bitset<CHARMAP_SIZE> m_isWhitespace; // char => whether char is whitespace
53 };
54 
58 unique_ptr<Transform>
59 stripSpace(const char* whitespaces = StripSpace::DEFAULT_WHITESPACES);
60 
61 } // namespace transform
62 } // namespace security
63 } // namespace ndn
64 
65 #endif // NDN_CXX_SECURITY_TRANSFORM_STRIP_SPACE_HPP
StripSpace(const char *whitespaces=DEFAULT_WHITESPACES)
Definition: strip-space.cpp:30
There are three types of module in a transformation chain: Source, Transform, and Sink...
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
unique_ptr< Transform > stripSpace(const char *whitespaces)
constructs a StripSpace transform
Definition: strip-space.cpp:55
strip whitespace characters from a stream
Definition: strip-space.hpp:38
Abstraction of an intermediate transformation module.
static const char *const DEFAULT_WHITESPACES
Definition: strip-space.hpp:41