summaryrefslogtreecommitdiff
path: root/zend/invaliditerator.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-06 21:53:24 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-04-06 21:53:24 +0200
commit35fd3ccbeb4def71b4d8a59dfbb5c31201b099b9 (patch)
tree915223360aed4743aa6127fde4836aa413a260e5 /zend/invaliditerator.h
parentda4710512865e6816585ac4ab8edab2fa125e2d8 (diff)
renamed src directory to zend directory, disabled TSRM debug code
Diffstat (limited to 'zend/invaliditerator.h')
-rw-r--r--zend/invaliditerator.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/zend/invaliditerator.h b/zend/invaliditerator.h
new file mode 100644
index 0000000..388eca8
--- /dev/null
+++ b/zend/invaliditerator.h
@@ -0,0 +1,82 @@
+/**
+ * InvalidIterator.h
+ *
+ * Iterator class that is used for value objects that are not even
+ * iteratable.
+ *
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ * @copyright 2014 Copernica BV
+ */
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+/**
+ * Class definition
+ */
+class InvalidIterator : public ValueIteratorImpl
+{
+public:
+ /**
+ * Clone the object
+ * @param tsrm_ls
+ * @return ValueIteratorImpl
+ */
+ virtual ValueIteratorImpl *clone()
+ {
+ // create a new instance
+ return new InvalidIterator(*this);
+ }
+
+ /**
+ * Increment position (pre-increment)
+ * @param tsrm_ls
+ * @return bool
+ */
+ virtual bool increment() override
+ {
+ return false;
+ }
+
+ /**
+ * Decrement position (pre-decrement)
+ * @return bool
+ */
+ virtual bool decrement() override
+ {
+ return false;
+ }
+
+ /**
+ * Compare with other iterator
+ * @param that
+ * @return bool
+ */
+ virtual bool equals(const ValueIteratorImpl *that) const override
+ {
+ // the other iterator is also an invalid-iterator, and all invalid
+ // iterators are equal
+ return true;
+ }
+
+ /**
+ * Derefecence, this returns a std::pair with the current key and value
+ * @return std::pair
+ */
+ virtual const std::pair<Value,Value> &current() const override
+ {
+ // this method is never called, when it is, we create a static instance
+ static std::pair<Value,Value> result;
+
+ // return it
+ return result;
+ }
+};
+
+/**
+ * End namespace
+ */
+}
+