jmespath.cpp
C++ implementation of JMESPath, a query language for JSON http://jmespath.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
appendutf8action.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Author: Róbert Márki <gsmiko@gmail.com>
4 ** Copyright (c) 2016 Róbert Márki
5 **
6 ** This file is part of the jmespath.cpp project which is distributed under
7 ** the MIT License (MIT).
8 **
9 ** Permission is hereby granted, free of charge, to any person obtaining a copy
10 ** of this software and associated documentation files (the "Software"), to
11 ** deal in the Software without restriction, including without limitation the
12 ** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13 ** sell copies of the Software, and to permit persons to whom the Software is
14 ** furnished to do so, subject to the following conditions:
15 **
16 ** The above copyright notice and this permission notice shall be included in
17 ** all copies or substantial portions of the Software.
18 **
19 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 ** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ** DEALINGS IN THE SOFTWARE.
26 **
27 ****************************************************************************/
28 #ifndef APPENDUTF8ACTION_H
29 #define APPENDUTF8ACTION_H
30 #include "jmespath/types.h"
31 
32 namespace jmespath { namespace parser {
33 
39 {
40 public:
44  using result_type = void;
53  UnicodeChar utf32Char) const
54  {
55  auto outIt = std::back_inserter(utf8String);
56  boost::utf8_output_iterator<decltype(outIt)> utf8OutIt(outIt);
57  *utf8OutIt++ = utf32Char;
58  }
59 };
60 }} // namespace jmespath::parser
61 #endif // APPENDUTF8ACTION_H
void result_type
The action's result type.
Definition: appendutf8action.h:44
std::basic_string< Char > String
UTF-8 encoded string type.
Definition: types.h:44
The AppendUtf8Action class is a functor for appending UTF-32 characters to UTF-8 encoded strings...
Definition: appendutf8action.h:38
char32_t UnicodeChar
32 bit character type
Definition: types.h:48
result_type operator()(String &utf8String, UnicodeChar utf32Char) const
Appends the utf32Char character to the utf8String encoded in UTF-8.
Definition: appendutf8action.h:52