RDK Documentation (Open Sourced RDK Components)
MockAampJsonObject.h
1 /*
2 * If not stated otherwise in this file or this component's license file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2022 RDK Management
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 
20 #pragma once
21 
22 #include <gmock/gmock.h>
23 #include "AampJsonObject.h"
24 
26 {
27 public:
28  MOCK_METHOD(bool, add, (const std::string& name, const std::string& value, const ENCODING encoding));
29  MOCK_METHOD(bool, add, (const std::string& name, const char *value, const ENCODING encoding));
30  MOCK_METHOD(bool, add, (const std::string& name, const std::vector<std::string>& values));
31  MOCK_METHOD(bool, add, (const std::string& name, const std::vector<uint8_t>& values, const ENCODING encoding));
32  MOCK_METHOD(bool, add, (const std::string& name, AampJsonObject& value));
33  MOCK_METHOD(bool, add, (const std::string& name, std::vector<AampJsonObject*>& values));
34  MOCK_METHOD(bool, add, (const std::string& name, cJSON *value));
35  MOCK_METHOD(bool, add, (const std::string& name, bool value));
36  MOCK_METHOD(bool, add, (const std::string& name, int value));
37  MOCK_METHOD(bool, add, (const std::string& name, long value));
38  MOCK_METHOD(bool, add, (const std::string& name, double value));
39 
40  MOCK_METHOD(bool, set, (AampJsonObject *parent, cJSON *object));
41 
42  MOCK_METHOD(bool, get, (const std::string& name, AampJsonObject &value));
43  MOCK_METHOD(bool, get, (const std::string& name, std::string& value));
44  MOCK_METHOD(bool, get, (const std::string& name, int& value));
45  MOCK_METHOD(bool, get, (const std::string& name, std::vector<std::string>& values));
46  MOCK_METHOD(bool, get, (const std::string& name, std::vector<uint8_t>& values, const ENCODING encoding));
47 };
48 
49 extern std::shared_ptr<MockAampJsonObject> g_mockAampJsonObject;
AampJsonObject::set
bool set(AampJsonObject *parent, cJSON *object)
Set cJSON value.
Definition: AampJsonObject.cpp:229
AampJsonObject::get
bool get(const std::string &name, std::vector< std::string > &values)
Get a string value.
Definition: AampJsonObject.cpp:291
MockAampJsonObject
Definition: MockAampJsonObject.h:25
AampJsonObject.h
File to handle Json format.
AampJsonObject::ENCODING
ENCODING
Definition: AampJsonObject.h:46
AampJsonObject::add
bool add(const std::string &name, const std::string &value, const ENCODING encoding=ENCODING_STRING)
Add a string value.
Definition: AampJsonObject.cpp:69
AampJsonObject
Utility class to construct a JSON string.
Definition: AampJsonObject.h:37