Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/webdriver-server/command.h
2867 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
// Defines a command for use in the JSON Wire Protocol. The protocol is
18
// defined at http://code.google.com/p/selenium/wiki/JsonWireProtocol.
19
20
#ifndef WEBDRIVER_SERVER_COMMAND_H_
21
#define WEBDRIVER_SERVER_COMMAND_H_
22
23
#include <map>
24
#include <string>
25
#include "json.h"
26
27
namespace webdriver {
28
29
typedef std::map<std::string, Json::Value> ParametersMap;
30
31
class Command {
32
public:
33
Command(void);
34
virtual ~Command(void);
35
std::string Serialize(void);
36
void Deserialize(const std::string& json);
37
void Copy(const Command& source);
38
void Reset(void);
39
40
std::string command_type(void) const { return this->command_type_; }
41
bool is_valid_parameters(void) const { return this->is_valid_parameters_; }
42
ParametersMap command_parameters(void) const {
43
return this->command_parameters_;
44
}
45
46
private:
47
// The type of command this represents.
48
std::string command_type_;
49
// Session ID for this command.
50
std::string session_id_;
51
// Flag indicating that parameters were valid.
52
bool is_valid_parameters_;
53
// Command parameters passed as JSON in the body of the request.
54
ParametersMap command_parameters_;
55
56
DISALLOW_COPY_AND_ASSIGN(Command);
57
};
58
59
} // namespace webdriver
60
61
#endif // WEBDRIVER_SERVER_COMMAND_H_
62
63