OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 | 366 |
367 PassRefPtr<JSONValue> JSONObjectBase::get(const String& name) const | 367 PassRefPtr<JSONValue> JSONObjectBase::get(const String& name) const |
368 { | 368 { |
369 Dictionary::const_iterator it = m_data.find(name); | 369 Dictionary::const_iterator it = m_data.find(name); |
370 if (it == m_data.end()) | 370 if (it == m_data.end()) |
371 return nullptr; | 371 return nullptr; |
372 return it->value; | 372 return it->value; |
373 } | 373 } |
374 | 374 |
| 375 bool JSONObjectBase::booleanProperty(const String& name, bool defaultValue) cons
t |
| 376 { |
| 377 bool result = defaultValue; |
| 378 getBoolean(name, &result); |
| 379 return result; |
| 380 } |
| 381 |
375 void JSONObjectBase::remove(const String& name) | 382 void JSONObjectBase::remove(const String& name) |
376 { | 383 { |
377 m_data.remove(name); | 384 m_data.remove(name); |
378 for (size_t i = 0; i < m_order.size(); ++i) { | 385 for (size_t i = 0; i < m_order.size(); ++i) { |
379 if (m_order[i] == name) { | 386 if (m_order[i] == name) { |
380 m_order.remove(i); | 387 m_order.remove(i); |
381 break; | 388 break; |
382 } | 389 } |
383 } | 390 } |
384 } | 391 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 m_data.append(value); | 532 m_data.append(value); |
526 } | 533 } |
527 | 534 |
528 PassRefPtr<JSONValue> JSONArrayBase::get(size_t index) | 535 PassRefPtr<JSONValue> JSONArrayBase::get(size_t index) |
529 { | 536 { |
530 ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size()); | 537 ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size()); |
531 return m_data[index]; | 538 return m_data[index]; |
532 } | 539 } |
533 | 540 |
534 } // namespace blink | 541 } // namespace blink |
OLD | NEW |