aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/model/base_path.h
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-05-22 13:21:08 -0700
committerGravatar GitHub <noreply@github.com>2018-05-22 13:21:08 -0700
commitd439bbccd4b90583a89d209d2cc81308aabca8ac (patch)
tree13fb14cc905f667e1470bcc14a3c84dfb6a7a109 /Firestore/core/src/firebase/firestore/model/base_path.h
parent476be0ba2ba8340296a5b5b05f27f3ded4bd6c72 (diff)
Add a HARD_ASSERT C++ assertion macro (#1304)
* Add HARD_ASSERT * Use HARD_ASSERT * Remove FIREBASE_ASSERT * Remove StringPrintf
Diffstat (limited to 'Firestore/core/src/firebase/firestore/model/base_path.h')
-rw-r--r--Firestore/core/src/firebase/firestore/model/base_path.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/base_path.h b/Firestore/core/src/firebase/firestore/model/base_path.h
index 58df6f0..7608829 100644
--- a/Firestore/core/src/firebase/firestore/model/base_path.h
+++ b/Firestore/core/src/firebase/firestore/model/base_path.h
@@ -24,7 +24,7 @@
#include <utility>
#include <vector>
-#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h"
+#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
#include "Firestore/core/src/firebase/firestore/util/hashing.h"
namespace firebase {
@@ -57,19 +57,18 @@ class BasePath {
/** Returns i-th segment of the path. */
const std::string& operator[](const size_t i) const {
- FIREBASE_ASSERT_MESSAGE(i < segments_.size(), "index %u out of range", i);
+ HARD_ASSERT(i < segments_.size(), "index %s out of range", i);
return segments_[i];
}
/** Returns the first segment of the path. */
const std::string& first_segment() const {
- FIREBASE_ASSERT_MESSAGE(!empty(),
- "Cannot call first_segment on empty path");
+ HARD_ASSERT(!empty(), "Cannot call first_segment on empty path");
return segments_[0];
}
/** Returns the last segment of the path. */
const std::string& last_segment() const {
- FIREBASE_ASSERT_MESSAGE(!empty(), "Cannot call last_segment on empty path");
+ HARD_ASSERT(!empty(), "Cannot call last_segment on empty path");
return segments_[size() - 1];
}
@@ -117,9 +116,8 @@ class BasePath {
* this path.
*/
T PopFirst(const size_t n = 1) const {
- FIREBASE_ASSERT_MESSAGE(n <= size(),
- "Cannot call PopFirst(%u) on path of length %u", n,
- size());
+ HARD_ASSERT(n <= size(), "Cannot call PopFirst(%s) on path of length %s", n,
+ size());
return T{begin() + n, end()};
}
@@ -128,7 +126,7 @@ class BasePath {
* this path.
*/
T PopLast() const {
- FIREBASE_ASSERT_MESSAGE(!empty(), "Cannot call PopLast() on empty path");
+ HARD_ASSERT(!empty(), "Cannot call PopLast() on empty path");
return T{begin(), end() - 1};
}