| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void WebString::assign(const WebUChar* data, size_t length) | 57 void WebString::assign(const WebUChar* data, size_t length) |
| 58 { | 58 { |
| 59 assign(static_cast<WebStringPrivate*>(StringImpl::create8BitIfPossible(data,
length).get())); | 59 assign(static_cast<WebStringPrivate*>(StringImpl::create8BitIfPossible(data,
length).get())); |
| 60 } | 60 } |
| 61 | 61 |
| 62 size_t WebString::length() const | 62 size_t WebString::length() const |
| 63 { | 63 { |
| 64 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; | 64 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; |
| 65 } | 65 } |
| 66 | 66 |
| 67 WebUChar WebString::at(unsigned i) const |
| 68 { |
| 69 ASSERT(m_private); |
| 70 return (*m_private)[i]; |
| 71 } |
| 72 |
| 67 const WebUChar* WebString::data() const | 73 const WebUChar* WebString::data() const |
| 68 { | 74 { |
| 69 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() :
0; | 75 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() :
0; |
| 70 } | 76 } |
| 71 | 77 |
| 72 WebCString WebString::utf8() const | 78 WebCString WebString::utf8() const |
| 73 { | 79 { |
| 74 return WTF::String(m_private).utf8(); | 80 return WTF::String(m_private).utf8(); |
| 75 } | 81 } |
| 76 | 82 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 { | 134 { |
| 129 // Take care to handle the case where m_private == p | 135 // Take care to handle the case where m_private == p |
| 130 if (p) | 136 if (p) |
| 131 p->ref(); | 137 p->ref(); |
| 132 if (m_private) | 138 if (m_private) |
| 133 m_private->deref(); | 139 m_private->deref(); |
| 134 m_private = p; | 140 m_private = p; |
| 135 } | 141 } |
| 136 | 142 |
| 137 } // namespace WebKit | 143 } // namespace WebKit |
| OLD | NEW |