diff options
| author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
|---|---|---|
| committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
| commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
| tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/storage/IDBKeyRange.cpp | |
| parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
| download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 | |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/storage/IDBKeyRange.cpp')
| -rw-r--r-- | WebCore/storage/IDBKeyRange.cpp | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/WebCore/storage/IDBKeyRange.cpp b/WebCore/storage/IDBKeyRange.cpp index 6c612cc..142b3bd 100644 --- a/WebCore/storage/IDBKeyRange.cpp +++ b/WebCore/storage/IDBKeyRange.cpp @@ -32,73 +32,53 @@ namespace WebCore { -IDBKeyRange::IDBKeyRange(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, unsigned short flags) - : m_left(left) - , m_right(right) - , m_flags(flags) +IDBKeyRange::IDBKeyRange(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, bool lowerOpen, bool upperOpen) + : m_lower(lower) + , m_upper(upper) + , m_lowerOpen(lowerOpen) + , m_upperOpen(upperOpen) { } PassRefPtr<IDBKeyRange> IDBKeyRange::only(PassRefPtr<IDBKey> prpValue) { RefPtr<IDBKey> value = prpValue; - return IDBKeyRange::create(value, value, IDBKeyRange::SINGLE); + return IDBKeyRange::create(value, value, false, false); } -PassRefPtr<IDBKeyRange> IDBKeyRange::leftBound(PassRefPtr<IDBKey> bound, bool open) +PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool open) { - unsigned short flags = IDBKeyRange::LEFT_BOUND; - if (open) - flags |= IDBKeyRange::LEFT_OPEN; - return IDBKeyRange::create(bound, IDBKey::create(), flags); + return IDBKeyRange::create(bound, 0, open, false); } -PassRefPtr<IDBKeyRange> IDBKeyRange::rightBound(PassRefPtr<IDBKey> bound, bool open) +PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool open) { - unsigned short flags = IDBKeyRange::RIGHT_BOUND; - if (open) - flags |= IDBKeyRange::RIGHT_OPEN; - return IDBKeyRange::create(IDBKey::create(), bound, flags); + return IDBKeyRange::create(0, bound, false, open); } -PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, bool openLeft, bool openRight) +PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, const OptionsObject& options) { - unsigned short flags = IDBKeyRange::LEFT_BOUND | IDBKeyRange::RIGHT_BOUND; - if (openLeft) - flags |= IDBKeyRange::LEFT_OPEN; - if (openRight) - flags |= IDBKeyRange::RIGHT_OPEN; - return IDBKeyRange::create(left, right, flags); + bool lowerOpen = false; + bool upperOpen = false; + options.getKeyBool("lowerOpen", lowerOpen); + options.getKeyBool("upperOpen", upperOpen); + return IDBKeyRange::create(lower, upper, lowerOpen, upperOpen); } -String IDBKeyRange::leftWhereClauseComparisonOperator() const +String IDBKeyRange::lowerWhereClauseComparisonOperator() const { - if (m_flags & LEFT_OPEN) + ASSERT(m_lower); + if (m_lowerOpen) return "<"; - - if (m_flags & LEFT_BOUND) - return "<="; - - if (m_flags == SINGLE) - return "="; - - ASSERT_NOT_REACHED(); - return ""; + return "<="; } -String IDBKeyRange::rightWhereClauseComparisonOperator() const +String IDBKeyRange::upperWhereClauseComparisonOperator() const { - if (m_flags & RIGHT_OPEN) + ASSERT(m_upper); + if (m_upperOpen) return "<"; - - if (m_flags & RIGHT_BOUND) - return "<="; - - if (m_flags == SINGLE) - return "="; - - ASSERT_NOT_REACHED(); - return ""; + return "<="; } } // namespace WebCore |
