28971f72f40f3941b1506004db5235c563ff20e4
[ric-plt/sdl.git] / include / private / redis / contentsbuilder.hpp
1 /*
2    Copyright (c) 2018-2019 Nokia.
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of 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,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 */
16
17 #ifndef SHAREDDATALAYER_REDIS_CONTENTSBUILDER_HPP_
18 #define SHAREDDATALAYER_REDIS_CONTENTSBUILDER_HPP_
19
20 #include "private/asyncconnection.hpp"
21
22 namespace shareddatalayer
23 {
24     namespace redis
25     {
26         struct Contents;
27
28         class ContentsBuilder
29         {
30         public:
31             ContentsBuilder(const char nsKeySeparator);
32
33             ContentsBuilder(const ContentsBuilder&) = delete;
34
35             ContentsBuilder& operator = (const ContentsBuilder&) = delete;
36
37             virtual ~ContentsBuilder();
38
39             virtual Contents build(const std::string& string) const;
40
41             virtual Contents build(const std::string& string,
42                                    const std::string& string2) const;
43
44             virtual Contents build(const std::string& string,
45                                    const std::string& string2,
46                                    const std::string& string3) const;
47
48             virtual Contents build(const std::string& string,
49                                    const AsyncConnection::Namespace& ns,
50                                    const AsyncConnection::DataMap& dataMap) const;
51
52             virtual Contents build(const std::string& string,
53                                    const AsyncConnection::Namespace& ns,
54                                    const AsyncConnection::DataMap& dataMap,
55                                    const std::string& string2,
56                                    const std::string& string3) const;
57
58             virtual Contents build(const std::string& string,
59                                    const AsyncConnection::Namespace& ns,
60                                    const AsyncConnection::Key& key,
61                                    const AsyncConnection::Data& data) const;
62
63             virtual Contents build(const std::string& string,
64                                    const AsyncConnection::Namespace& ns,
65                                    const AsyncConnection::Key& key,
66                                    const AsyncConnection::Data& data,
67                                    const std::string& string2,
68                                    const std::string& string3) const;
69
70             virtual Contents build(const std::string& string,
71                                    const AsyncConnection::Namespace& ns,
72                                    const AsyncConnection::Key& key,
73                                    const AsyncConnection::Data& data,
74                                    const AsyncConnection::Data& data2) const;
75
76             virtual Contents build(const std::string& string,
77                                    const AsyncConnection::Namespace& ns,
78                                    const AsyncConnection::Key& key,
79                                    const AsyncConnection::Data& data,
80                                    const AsyncConnection::Data& data2,
81                                    const std::string& string2,
82                                    const std::string& string3) const;
83
84             virtual Contents build(const std::string& string,
85                                    const AsyncConnection::Namespace& ns,
86                                    const AsyncConnection::Keys& keys) const;
87
88             virtual Contents build(const std::string& string,
89                                    const AsyncConnection::Namespace& ns,
90                                    const AsyncConnection::Keys& keys,
91                                    const std::string& string2,
92                                    const std::string& string3) const;
93
94         private:
95             const char nsKeySeparator;
96
97             void addString(Contents& contents,
98                            const std::string& string) const;
99
100             void addDataMap(Contents& contents,
101                             const AsyncConnection::Namespace& ns,
102                             const AsyncConnection::DataMap& dataMap) const;
103
104             void addKey(Contents& contents,
105                         const AsyncConnection::Namespace& ns,
106                         const AsyncConnection::Key& key) const;
107
108             void addData(Contents& contents,
109                          const AsyncConnection::Data& data) const;
110
111             void addKeys(Contents& contents,
112                          const AsyncConnection::Namespace& ns,
113                          const AsyncConnection::Keys& keys) const;
114         };
115     }
116 }
117
118 #endif