-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtransfer_util.cpp
More file actions
47 lines (39 loc) · 1.47 KB
/
Copy pathtransfer_util.cpp
File metadata and controls
47 lines (39 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "transfer_util.h"
void transfer_string_list_contents(cef_string_list_t fromList,
StringList& toList)
{
int size = cef_string_list_size(fromList);
CefString value;
for(int i = 0; i < size; i++) {
cef_string_list_value(fromList, i, value.GetWritableStruct());
toList.push_back(value);
}
}
void transfer_string_list_contents(const StringList& fromList,
cef_string_list_t toList)
{
size_t size = fromList.size();
for(size_t i = 0; i < size; ++i)
cef_string_list_append(toList, fromList[i].GetStruct());
}
void transfer_string_map_contents(cef_string_map_t fromMap,
StringMap& toMap)
{
int size = cef_string_map_size(fromMap);
CefString key, value;
for(int i = 0; i < size; ++i) {
cef_string_map_key(fromMap, i, key.GetWritableStruct());
cef_string_map_value(fromMap, i, value.GetWritableStruct());
toMap.insert(std::pair<CefString, CefString>(key, value));
}
}
void transfer_string_map_contents(const StringMap& fromMap,
cef_string_map_t toMap)
{
StringMap::const_iterator it = fromMap.begin();
for(; it != fromMap.end(); ++it)
cef_string_map_append(toMap, it->first.GetStruct(), it->second.GetStruct());
}