From 044e3b09db0c096bfc67e7dd95101716dae17af5 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 6 Sep 2013 14:17:01 -0700 Subject: [PATCH] Add StringPairArray::swapWith --- .../modules/beast_core/text/beast_StringPairArray.cpp | 7 +++++++ .../beast/modules/beast_core/text/beast_StringPairArray.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.cpp b/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.cpp index f325556f64..70084c4def 100644 --- a/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.cpp +++ b/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.cpp @@ -44,6 +44,13 @@ StringPairArray& StringPairArray::operator= (const StringPairArray& other) return *this; } +void StringPairArray::swapWith (StringPairArray& other) +{ + std::swap (ignoreCase, other.ignoreCase); + keys.swapWith (other.keys); + values.swapWith (other.values); +} + bool StringPairArray::operator== (const StringPairArray& other) const { for (int i = keys.size(); --i >= 0;) diff --git a/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.h b/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.h index 8a46266ff7..a3acd993ec 100644 --- a/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.h +++ b/Subtrees/beast/modules/beast_core/text/beast_StringPairArray.h @@ -49,6 +49,9 @@ public: /** Copies the contents of another string array into this one */ StringPairArray& operator= (const StringPairArray& other); + /** Swap the contents of this array with another. */ + void swapWith (StringPairArray& other); + //============================================================================== /** Compares two arrays. Comparisons are case-sensitive.