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

Side by Side Diff: base/values.cc

Issue 3033050: Rename DictionaryValue's SetStringFromUTF16() to SetString() (and overload). (Closed)
Patch Set: There shouldn't be wstrings in platform-ind. code. Created 10 years, 4 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') | base/values_unittest.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 void DictionaryValue::SetReal(const std::string& path, double in_value) { 442 void DictionaryValue::SetReal(const std::string& path, double in_value) {
443 Set(path, CreateRealValue(in_value)); 443 Set(path, CreateRealValue(in_value));
444 } 444 }
445 445
446 void DictionaryValue::SetString(const std::string& path, 446 void DictionaryValue::SetString(const std::string& path,
447 const std::string& in_value) { 447 const std::string& in_value) {
448 Set(path, CreateStringValue(in_value)); 448 Set(path, CreateStringValue(in_value));
449 } 449 }
450 450
451 void DictionaryValue::SetStringFromUTF16(const std::string& path, 451 void DictionaryValue::SetString(const std::string& path,
452 const string16& in_value) { 452 const string16& in_value) {
453 Set(path, CreateStringValue(in_value)); 453 Set(path, CreateStringValue(in_value));
454 } 454 }
455 455
456 // TODO(viettrungluu): Deprecated and to be removed: 456 // TODO(viettrungluu): Deprecated and to be removed:
457 void DictionaryValue::SetBoolean(const std::wstring& path, bool in_value) { 457 void DictionaryValue::SetBoolean(const std::wstring& path, bool in_value) {
458 Set(path, CreateBooleanValue(in_value)); 458 Set(path, CreateBooleanValue(in_value));
459 } 459 }
460 460
461 // TODO(viettrungluu): Deprecated and to be removed: 461 // TODO(viettrungluu): Deprecated and to be removed:
462 void DictionaryValue::SetInteger(const std::wstring& path, int in_value) { 462 void DictionaryValue::SetInteger(const std::wstring& path, int in_value) {
463 Set(path, CreateIntegerValue(in_value)); 463 Set(path, CreateIntegerValue(in_value));
464 } 464 }
465 465
466 // TODO(viettrungluu): Deprecated and to be removed: 466 // TODO(viettrungluu): Deprecated and to be removed:
467 void DictionaryValue::SetReal(const std::wstring& path, double in_value) { 467 void DictionaryValue::SetReal(const std::wstring& path, double in_value) {
468 Set(path, CreateRealValue(in_value)); 468 Set(path, CreateRealValue(in_value));
469 } 469 }
470 470
471 // TODO(viettrungluu): Deprecated and to be removed: 471 // TODO(viettrungluu): Deprecated and to be removed:
472 void DictionaryValue::SetString(const std::wstring& path, 472 void DictionaryValue::SetString(const std::wstring& path,
473 const std::string& in_value) { 473 const std::string& in_value) {
474 Set(path, CreateStringValue(in_value)); 474 Set(path, CreateStringValue(in_value));
475 } 475 }
476 476
477 // TODO(viettrungluu): Deprecated and to be removed: 477 // TODO(viettrungluu): Deprecated and to be removed:
478 void DictionaryValue::SetString(const std::wstring& path, 478 void DictionaryValue::SetString(const std::wstring& path,
479 const string16& in_value) {
480 Set(path, CreateStringValue(in_value));
481 }
482
483 #if !defined(WCHAR_T_IS_UTF16)
484 // TODO(viettrungluu): Deprecated and to be removed:
485 void DictionaryValue::SetString(const std::wstring& path,
479 const std::wstring& in_value) { 486 const std::wstring& in_value) {
480 Set(path, CreateStringValue(in_value)); 487 Set(path, CreateStringValue(in_value));
481 } 488 }
482 489 #endif
483 // TODO(viettrungluu): Deprecated and to be removed:
484 void DictionaryValue::SetStringFromUTF16(const std::wstring& path,
485 const string16& in_value) {
486 Set(path, CreateStringValue(in_value));
487 }
488 490
489 void DictionaryValue::SetWithoutPathExpansion(const std::string& key, 491 void DictionaryValue::SetWithoutPathExpansion(const std::string& key,
490 Value* in_value) { 492 Value* in_value) {
491 // If there's an existing value here, we need to delete it, because 493 // If there's an existing value here, we need to delete it, because
492 // we own all our children. 494 // we own all our children.
493 if (HasKey(key)) { 495 if (HasKey(key)) {
494 DCHECK(dictionary_[key] != in_value); // This would be bogus 496 DCHECK(dictionary_[key] != in_value); // This would be bogus
495 delete dictionary_[key]; 497 delete dictionary_[key];
496 } 498 }
497 499
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return false; 1079 return false;
1078 } 1080 }
1079 if (lhs_it != end() || rhs_it != other_list->end()) 1081 if (lhs_it != end() || rhs_it != other_list->end())
1080 return false; 1082 return false;
1081 1083
1082 return true; 1084 return true;
1083 } 1085 }
1084 1086
1085 ValueSerializer::~ValueSerializer() { 1087 ValueSerializer::~ValueSerializer() {
1086 } 1088 }
OLDNEW
« no previous file with comments | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698