All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
CollapseWsPipe.h
Go to the documentation of this file.
1 // Copyright 2015 Thomas Trapp
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef HEXT_COLLAPSEWSPIPE_H_INCLUDED
16 #define HEXT_COLLAPSEWSPIPE_H_INCLUDED
17 
18 /// @file
19 /// Declares hext::CollapseWsPipe
20 
21 #include "hext/Cloneable.h"
22 #include "hext/StringPipe.h"
23 
24 #include <string>
25 
26 
27 namespace hext {
28 
29 
30 /// Removes whitespace from beginning and end and collapses multiple whitespace
31 /// to a single space.
32 ///
33 /// @par Example:
34 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 /// " Like\na Rolling\n\tStone "
36 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 /// becomes
38 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 /// "Like a Rolling Stone"
40 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 class CollapseWsPipe final : public hext::Cloneable<CollapseWsPipe, StringPipe>
42 {
43 public:
44  /// Collapses multiple whitespace to a single space
45  std::string transform(std::string str) const override;
46 };
47 
48 
49 } // namespace hext
50 
51 
52 #endif // HEXT_COLLAPSEWSPIPE_H_INCLUDED
53 
Declares hext::StringPipe.
Curiously recurring template pattern that extends a base class to provide a virtual method Cloneable:...
Definition: Cloneable.h:34
std::string transform(std::string str) const override
Collapses multiple whitespace to a single space.
Defines template hext::Cloneable.
Removes whitespace from beginning and end and collapses multiple whitespace to a single space...