| Flutter iOS Embedder |

connection_collection.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
7
8 #include <cstdint>
9 #include <map>
10 #include <string>
11
12 namespace flutter {
13
14 /// Maintains a current integer assigned to a name (connections).
15 class ConnectionCollection {
16 public:
17 typedef int64_t Connection;
18 static const Connection kInvalidConnection = 0;
19
20 Connection AquireConnection(const std::string& name);
21 ///\returns the name of the channel when cleanup is successful, otherwise
22 /// the empty string.
23 std::string CleanupConnection(Connection connection);
24
25 static bool IsValidConnection(Connection connection);
26
27 static Connection MakeErrorConnection(int errCode);
28
29 private:
30 std::map<std::string, Connection> connections_;
31 Connection counter_ = 0;
32 };
33
34 } // namespace flutter
35
36 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
flutter::ConnectionCollection::Connection
int64_t Connection
Definition: connection_collection.h:17
flutter::ConnectionCollection
Maintains a current integer assigned to a name (connections).
Definition: connection_collection.h:15
flutter::ConnectionCollection::kInvalidConnection
static const Connection kInvalidConnection
Definition: connection_collection.h:18
flutter::ConnectionCollection::CleanupConnection
std::string CleanupConnection(Connection connection)
Definition: connection_collection.mm:14
flutter::ConnectionCollection::MakeErrorConnection
static Connection MakeErrorConnection(int errCode)
Definition: connection_collection.mm:35
flutter
Definition: accessibility_bridge.h:28
flutter::ConnectionCollection::IsValidConnection
static bool IsValidConnection(Connection connection)
Definition: connection_collection.mm:31
flutter::ConnectionCollection::AquireConnection
Connection AquireConnection(const std::string &name)
Definition: connection_collection.mm:8