/src/spotify-json/include/spotify/json/codec/string.hpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2015-2019 Spotify AB |
3 | | * |
4 | | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
5 | | * use this file except in compliance with the License. You may obtain a copy of |
6 | | * the License at |
7 | | * |
8 | | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | * |
10 | | * Unless required by applicable law or agreed to in writing, software |
11 | | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
12 | | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
13 | | * License for the specific language governing permissions and limitations under |
14 | | * the License. |
15 | | */ |
16 | | |
17 | | #pragma once |
18 | | |
19 | | #include <algorithm> |
20 | | #include <spotify/json/decode_context.hpp> |
21 | | #include <spotify/json/default_codec.hpp> |
22 | | #include <spotify/json/encode_context.hpp> |
23 | | |
24 | | namespace spotify { |
25 | | namespace json { |
26 | | namespace codec { |
27 | | |
28 | | class string_t final { |
29 | | public: |
30 | | using object_type = std::string; |
31 | | |
32 | | object_type decode(decode_context &context) const; |
33 | | void encode(encode_context &context, const object_type value) const; |
34 | | }; |
35 | | |
36 | 2.31k | inline string_t string() { |
37 | 2.31k | return string_t(); |
38 | 2.31k | } |
39 | | |
40 | | } // namespace codec |
41 | | |
42 | | template <> |
43 | | struct default_codec_t<std::string> { |
44 | 2.31k | static codec::string_t codec() { |
45 | 2.31k | return codec::string_t(); |
46 | 2.31k | } |
47 | | }; |
48 | | |
49 | | } // namespace json |
50 | | } // namespace spotify |