OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_HOST_HOST_ATTRIBUTES_H_ | |
6 #define REMOTING_HOST_HOST_ATTRIBUTES_H_ | |
7 | |
8 #include <map> | |
9 #include <set> | |
10 #include <string> | |
11 | |
12 #include "base/callback.h" | |
13 | |
14 namespace remoting { | |
15 | |
16 class HostAttributes final { | |
17 public: | |
18 HostAttributes(); | |
19 HostAttributes(HostAttributes&& other); | |
20 HostAttributes(const HostAttributes& other); | |
21 ~HostAttributes(); | |
22 | |
23 HostAttributes& operator=(HostAttributes&& other); | |
24 HostAttributes& operator=(const HostAttributes& other); | |
25 | |
26 // Converts the HostAttributes into its text representation, which is a comma- | |
27 // separated string, each field indicates one attribute. | |
28 std::string ToString() const; | |
29 | |
30 // Registers a static value, which will be appended to ToString() result. | |
31 void Register(const std::string& key); | |
32 | |
33 // Registers a dynamic value, which will be evaluated each time ToString() is | |
34 // called. | |
35 void Register(const std::string& key, const base::Callback<bool()>& value); | |
36 | |
37 // Whether the |output| contains the specified attribute as |key|. This | |
38 // function is usually for testing purpose. | |
39 static bool ContainsAttribute(const std::string& output, | |
40 const std::string& key); | |
41 | |
42 private: | |
43 std::set<std::string> static_values_; | |
44 std::map<std::string, base::Callback<bool()>> dynamic_values_; | |
Sergey Ulanov
2016/11/03 22:15:34
I still think we don't need set/map here instead o
Hzj_jie
2016/11/05 05:29:28
I have moved this logic into the test case.
| |
45 }; | |
46 | |
47 } // namespace remoting | |
48 | |
49 #endif // REMOTING_HOST_HOST_ATTRIBUTES_H_ | |
OLD | NEW |