| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 double defaultValue) const { | 337 double defaultValue) const { |
| 338 double result = defaultValue; | 338 double result = defaultValue; |
| 339 getDouble(name, &result); | 339 getDouble(name, &result); |
| 340 return result; | 340 return result; |
| 341 } | 341 } |
| 342 | 342 |
| 343 void JSONObject::remove(const String& name) { | 343 void JSONObject::remove(const String& name) { |
| 344 m_data.erase(name); | 344 m_data.erase(name); |
| 345 for (size_t i = 0; i < m_order.size(); ++i) { | 345 for (size_t i = 0; i < m_order.size(); ++i) { |
| 346 if (m_order[i] == name) { | 346 if (m_order[i] == name) { |
| 347 m_order.remove(i); | 347 m_order.erase(i); |
| 348 break; | 348 break; |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 void JSONObject::writeJSON(StringBuilder* output) const { | 353 void JSONObject::writeJSON(StringBuilder* output) const { |
| 354 output->append('{'); | 354 output->append('{'); |
| 355 for (size_t i = 0; i < m_order.size(); ++i) { | 355 for (size_t i = 0; i < m_order.size(); ++i) { |
| 356 Dictionary::const_iterator it = m_data.find(m_order[i]); | 356 Dictionary::const_iterator it = m_data.find(m_order[i]); |
| 357 CHECK(it != m_data.end()); | 357 CHECK(it != m_data.end()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 DCHECK(value); | 482 DCHECK(value); |
| 483 m_data.push_back(std::move(value)); | 483 m_data.push_back(std::move(value)); |
| 484 } | 484 } |
| 485 | 485 |
| 486 JSONValue* JSONArray::at(size_t index) { | 486 JSONValue* JSONArray::at(size_t index) { |
| 487 DCHECK_LT(index, m_data.size()); | 487 DCHECK_LT(index, m_data.size()); |
| 488 return m_data[index].get(); | 488 return m_data[index].get(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 } // namespace blink | 491 } // namespace blink |
| OLD | NEW |