mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Make CEF compliant with Google/Chromium style (issue #473).
- Add a new check_style tool based on Google's cpplint that can be used to verify compliance of pending changes and specific files/directories. - Update existing CEF source code to be compliant with the style requirements. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@463 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -2,50 +2,44 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <map>
|
||||
#include "include/internal/cef_string_multimap.h"
|
||||
#include "base/logging.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
typedef std::multimap<CefString, CefString> StringMultimap;
|
||||
typedef StringMultimap::const_iterator StringMultimapIter;
|
||||
|
||||
CEF_EXPORT cef_string_multimap_t cef_string_multimap_alloc()
|
||||
{
|
||||
CEF_EXPORT cef_string_multimap_t cef_string_multimap_alloc() {
|
||||
return new StringMultimap;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_size(cef_string_multimap_t map)
|
||||
{
|
||||
CEF_EXPORT int cef_string_multimap_size(cef_string_multimap_t map) {
|
||||
DCHECK(map);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
return impl->size();
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_find_count(cef_string_multimap_t map,
|
||||
const cef_string_t* key)
|
||||
{
|
||||
const cef_string_t* key) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
return impl->count(CefString(key));
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_enumerate(cef_string_multimap_t map,
|
||||
const cef_string_t* key,
|
||||
int value_index,
|
||||
cef_string_t* value)
|
||||
{
|
||||
cef_string_t* value) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
DCHECK(value);
|
||||
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
CefString key_str(key);
|
||||
|
||||
DCHECK(value_index >= 0 && value_index < (int)impl->count(key_str));
|
||||
|
||||
if(value_index < 0 || value_index >= (int)impl->count(key_str))
|
||||
DCHECK_GE(value_index, 0);
|
||||
DCHECK_LT(value_index, static_cast<int>(impl->count(key_str)));
|
||||
if (value_index < 0 || value_index >= static_cast<int>(impl->count(key_str)))
|
||||
return 0;
|
||||
|
||||
std::pair<StringMultimap::iterator, StringMultimap::iterator> range_it =
|
||||
@ -63,34 +57,36 @@ CEF_EXPORT int cef_string_multimap_enumerate(cef_string_multimap_t map,
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_key(cef_string_multimap_t map, int index,
|
||||
cef_string_t* key)
|
||||
{
|
||||
cef_string_t* key) {
|
||||
DCHECK(map);
|
||||
DCHECK(key);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
DCHECK_GE(index, 0);
|
||||
DCHECK_LT(index, static_cast<int>(impl->size()));
|
||||
if (index < 0 || index >= static_cast<int>(impl->size()))
|
||||
return 0;
|
||||
|
||||
StringMultimap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index)
|
||||
for (int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if (ct == index)
|
||||
return cef_string_set(it->first.c_str(), it->first.length(), key, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map, int index,
|
||||
cef_string_t* value)
|
||||
{
|
||||
cef_string_t* value) {
|
||||
DCHECK(map);
|
||||
DCHECK(value);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
DCHECK(index >= 0 && index < (int)impl->size());
|
||||
if(index < 0 || index >= (int)impl->size())
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
DCHECK_GE(index, 0);
|
||||
DCHECK_LT(index, static_cast<int>(impl->size()));
|
||||
if (index < 0 || index >= static_cast<int>(impl->size()))
|
||||
return 0;
|
||||
|
||||
StringMultimap::const_iterator it = impl->begin();
|
||||
for(int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if(ct == index) {
|
||||
for (int ct = 0; it != impl->end(); ++it, ct++) {
|
||||
if (ct == index) {
|
||||
return cef_string_set(it->second.c_str(), it->second.length(), value,
|
||||
true);
|
||||
}
|
||||
@ -100,23 +96,21 @@ CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map, int index,
|
||||
|
||||
CEF_EXPORT int cef_string_multimap_append(cef_string_multimap_t map,
|
||||
const cef_string_t* key,
|
||||
const cef_string_t* value)
|
||||
{
|
||||
const cef_string_t* value) {
|
||||
DCHECK(map);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
impl->insert(std::make_pair(CefString(key), CefString(value)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_multimap_clear(cef_string_multimap_t map)
|
||||
{
|
||||
CEF_EXPORT void cef_string_multimap_clear(cef_string_multimap_t map) {
|
||||
DCHECK(map);
|
||||
StringMultimap* impl = (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
impl->clear();
|
||||
}
|
||||
|
||||
CEF_EXPORT void cef_string_multimap_free(cef_string_multimap_t map)
|
||||
{
|
||||
CEF_EXPORT void cef_string_multimap_free(cef_string_multimap_t map) {
|
||||
DCHECK(map);
|
||||
delete (StringMultimap*)map;
|
||||
StringMultimap* impl = reinterpret_cast<StringMultimap*>(map);
|
||||
delete impl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user