Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: base/values.cc

Issue 647016: importer: use FilePath instead of wstring in some places (Closed)
Patch Set: with fixes Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/values.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/values.h" 5 #include "base/values.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 10
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 return true; 348 return true;
349 } 349 }
350 350
351 bool DictionaryValue::HasKey(const std::wstring& key) const { 351 bool DictionaryValue::HasKey(const std::wstring& key) const {
352 ValueMap::const_iterator current_entry = dictionary_.find(key); 352 ValueMap::const_iterator current_entry = dictionary_.find(key);
353 DCHECK((current_entry == dictionary_.end()) || current_entry->second); 353 DCHECK((current_entry == dictionary_.end()) || current_entry->second);
354 return current_entry != dictionary_.end(); 354 return current_entry != dictionary_.end();
355 } 355 }
356 356
357 bool DictionaryValue::HasKeyASCII(const std::string& key) const {
358 return HasKey(ASCIIToWide(key));
359 }
360
357 void DictionaryValue::Clear() { 361 void DictionaryValue::Clear() {
358 ValueMap::iterator dict_iterator = dictionary_.begin(); 362 ValueMap::iterator dict_iterator = dictionary_.begin();
359 while (dict_iterator != dictionary_.end()) { 363 while (dict_iterator != dictionary_.end()) {
360 delete dict_iterator->second; 364 delete dict_iterator->second;
361 ++dict_iterator; 365 ++dict_iterator;
362 } 366 }
363 367
364 dictionary_.clear(); 368 dictionary_.clear();
365 } 369 }
366 370
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 468
465 bool DictionaryValue::GetReal(const std::wstring& path, 469 bool DictionaryValue::GetReal(const std::wstring& path,
466 double* out_value) const { 470 double* out_value) const {
467 Value* value; 471 Value* value;
468 if (!Get(path, &value)) 472 if (!Get(path, &value))
469 return false; 473 return false;
470 474
471 return value->GetAsReal(out_value); 475 return value->GetAsReal(out_value);
472 } 476 }
473 477
478 bool DictionaryValue::GetString(const std::string& path,
479 string16* out_value) const {
480 return GetStringAsUTF16(ASCIIToWide(path), out_value);
481 }
482
483 bool DictionaryValue::GetStringASCII(const std::string& path,
484 std::string* out_value) const {
485 std::string out;
486 if (!GetString(ASCIIToWide(path), &out))
487 return false;
488
489 if (!IsStringASCII(out)) {
490 NOTREACHED();
491 return false;
492 }
493
494 out_value->assign(out);
495 return true;
496 }
497
474 bool DictionaryValue::GetString(const std::wstring& path, 498 bool DictionaryValue::GetString(const std::wstring& path,
475 std::string* out_value) const { 499 std::string* out_value) const {
476 Value* value; 500 Value* value;
477 if (!Get(path, &value)) 501 if (!Get(path, &value))
478 return false; 502 return false;
479 503
480 return value->GetAsString(out_value); 504 return value->GetAsString(out_value);
481 } 505 }
482 506
483 bool DictionaryValue::GetString(const std::wstring& path, 507 bool DictionaryValue::GetString(const std::wstring& path,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 lhs_it != end() && rhs_it != other_list->end(); 856 lhs_it != end() && rhs_it != other_list->end();
833 ++lhs_it, ++rhs_it) { 857 ++lhs_it, ++rhs_it) {
834 if (!(*lhs_it)->Equals(*rhs_it)) 858 if (!(*lhs_it)->Equals(*rhs_it))
835 return false; 859 return false;
836 } 860 }
837 if (lhs_it != end() || rhs_it != other_list->end()) 861 if (lhs_it != end() || rhs_it != other_list->end())
838 return false; 862 return false;
839 863
840 return true; 864 return true;
841 } 865 }
OLDNEW
« no previous file with comments | « base/values.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698