Add first version
[ric-plt/sdl.git] / include / private / tst / redisreplybuilder.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_TST_REDISREPLYBUILDER_HPP_
18 #define SHAREDDATALAYER_TST_REDISREPLYBUILDER_HPP_
19
20 #include "private/redis/redisgeneral.hpp"
21 #include "private/redis/reply.hpp"
22
23 namespace shareddatalayer
24 {
25     namespace tst
26     {
27         class RedisReplyBuilder
28         {
29         public:
30             RedisReplyBuilder();
31
32             RedisReplyBuilder(const RedisReplyBuilder&) = delete;
33
34             RedisReplyBuilder& operator = (const RedisReplyBuilder&) = delete;
35
36             virtual ~RedisReplyBuilder();
37
38             redisReply& buildNilReply();
39
40             redisReply& buildIntegerReply();
41
42             redisReply& buildStatusReply();
43
44             redisReply& buildStringReply();
45
46             redisReply& buildArrayReply();
47
48             redisReply& buildCommandListQueryReply();
49
50             redisReply& buildIncompleteCommandListQueryReply();
51
52             redisReply& buildErrorReply(const std::string& msg);
53
54         private:
55             std::vector<redisReply*> builtRedisReplies;
56             const std::vector<char> defaultStringValue;
57             std::vector<redisReply*> arrayReplyElements;
58             redisReply arrayReplyElement1;
59             redisReply arrayReplyElement2;
60             char* errorMessage;
61             const std::set<std::string>& requiredRedisModuleCommands;
62             std::vector<redisReply*> commandItems;
63             std::vector<redisReply*> commandListQueryElements;
64
65             void initArrayReplyContent();
66             void initCommandListQueryReplyContent();
67         };
68     }
69 }
70
71 #endif