mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Set eol-style property on all files. Future commits will use the subversion auto-props configuration at http://src.chromium.org/viewvc/chrome/trunk/tools/buildbot/slave/config
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@109 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -1,92 +1,92 @@
|
||||
// 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 "include/cef_string_map.h"
|
||||
#include "base/logging.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
typedef std::map<std::wstring, std::wstring> StringMap;
|
||||
|
||||
CEF_EXPORT cef_string_map_t cef_string_map_alloc()
|
||||
{
|
||||
return new StringMap;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_map_size(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
return impl->size();
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_find(cef_string_map_t map,
|
||||
const wchar_t* key)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
std::wstring keystr;
|
||||
if(key)
|
||||
keystr = key;
|
||||
StringMap::const_iterator it = impl->find(keystr);
|
||||
if(it == impl->end())
|
||||
return NULL;
|
||||
return cef_string_alloc(it->second.c_str());
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_key(cef_string_map_t map, int index)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
return NULL;
|
||||
StringMap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index)
|
||||
return cef_string_alloc(it->first.c_str());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_value(cef_string_map_t map, int index)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
return NULL;
|
||||
StringMap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index)
|
||||
return cef_string_alloc(it->second.c_str());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_append(cef_string_map_t map, const wchar_t* key,
|
||||
const wchar_t* value)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
std::wstring keystr, valstr;
|
||||
if(key)
|
||||
keystr = key;
|
||||
if(value)
|
||||
valstr = value;
|
||||
impl->insert(std::pair<std::wstring, std::wstring>(keystr, valstr));
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
impl->clear();
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_free(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
delete (StringMap*)map;
|
||||
}
|
||||
// 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 "include/cef_string_map.h"
|
||||
#include "base/logging.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
typedef std::map<std::wstring, std::wstring> StringMap;
|
||||
|
||||
CEF_EXPORT cef_string_map_t cef_string_map_alloc()
|
||||
{
|
||||
return new StringMap;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_map_size(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
return impl->size();
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_find(cef_string_map_t map,
|
||||
const wchar_t* key)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
std::wstring keystr;
|
||||
if(key)
|
||||
keystr = key;
|
||||
StringMap::const_iterator it = impl->find(keystr);
|
||||
if(it == impl->end())
|
||||
return NULL;
|
||||
return cef_string_alloc(it->second.c_str());
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_key(cef_string_map_t map, int index)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
return NULL;
|
||||
StringMap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index)
|
||||
return cef_string_alloc(it->first.c_str());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_string_t cef_string_map_value(cef_string_map_t map, int index)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
return NULL;
|
||||
StringMap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index)
|
||||
return cef_string_alloc(it->second.c_str());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_append(cef_string_map_t map, const wchar_t* key,
|
||||
const wchar_t* value)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
std::wstring keystr, valstr;
|
||||
if(key)
|
||||
keystr = key;
|
||||
if(value)
|
||||
valstr = value;
|
||||
impl->insert(std::pair<std::wstring, std::wstring>(keystr, valstr));
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
StringMap* impl = (StringMap*)map;
|
||||
impl->clear();
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_map_free(cef_string_map_t map)
|
||||
{
|
||||
DCHECK(map);
|
||||
delete (StringMap*)map;
|
||||
}
|
||||
|
Reference in New Issue
Block a user