OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2011 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 20 matching lines...) Expand all Loading... |
31 data->addPair(std::make_pair(String(&open1, 1), String(&close1, 1))); | 31 data->addPair(std::make_pair(String(&open1, 1), String(&close1, 1))); |
32 data->addPair(std::make_pair(String(&open2, 1), String(&close2, 1))); | 32 data->addPair(std::make_pair(String(&open2, 1), String(&close2, 1))); |
33 return data; | 33 return data; |
34 } | 34 } |
35 | 35 |
36 void QuotesData::addPair(std::pair<String, String> quotePair) { | 36 void QuotesData::addPair(std::pair<String, String> quotePair) { |
37 m_quotePairs.push_back(quotePair); | 37 m_quotePairs.push_back(quotePair); |
38 } | 38 } |
39 | 39 |
40 const String QuotesData::getOpenQuote(int index) const { | 40 const String QuotesData::getOpenQuote(int index) const { |
41 ASSERT(index >= 0); | 41 DCHECK_GE(index, 0); |
42 if (!m_quotePairs.size() || index < 0) | 42 if (!m_quotePairs.size() || index < 0) |
43 return emptyString; | 43 return emptyString; |
44 if ((size_t)index >= m_quotePairs.size()) | 44 if ((size_t)index >= m_quotePairs.size()) |
45 return m_quotePairs.back().first; | 45 return m_quotePairs.back().first; |
46 return m_quotePairs.at(index).first; | 46 return m_quotePairs.at(index).first; |
47 } | 47 } |
48 | 48 |
49 const String QuotesData::getCloseQuote(int index) const { | 49 const String QuotesData::getCloseQuote(int index) const { |
50 ASSERT(index >= -1); | 50 DCHECK_GE(index, -1); |
51 if (!m_quotePairs.size() || index < 0) | 51 if (!m_quotePairs.size() || index < 0) |
52 return emptyString; | 52 return emptyString; |
53 if ((size_t)index >= m_quotePairs.size()) | 53 if ((size_t)index >= m_quotePairs.size()) |
54 return m_quotePairs.back().second; | 54 return m_quotePairs.back().second; |
55 return m_quotePairs.at(index).second; | 55 return m_quotePairs.at(index).second; |
56 } | 56 } |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
OLD | NEW |