diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 21:53:24 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-06 21:53:24 +0200 |
commit | 35fd3ccbeb4def71b4d8a59dfbb5c31201b099b9 (patch) | |
tree | 915223360aed4743aa6127fde4836aa413a260e5 /zend/valueiterator.cpp | |
parent | da4710512865e6816585ac4ab8edab2fa125e2d8 (diff) |
renamed src directory to zend directory, disabled TSRM debug code
Diffstat (limited to 'zend/valueiterator.cpp')
-rw-r--r-- | zend/valueiterator.cpp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/zend/valueiterator.cpp b/zend/valueiterator.cpp new file mode 100644 index 0000000..65c687c --- /dev/null +++ b/zend/valueiterator.cpp @@ -0,0 +1,100 @@ +/** + * ValueIterator.cpp + * + * Implementation of the value iterator + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2014 Copernica BV + */ +#include "includes.h" + +/** + * Set up namespace + */ +namespace Php { + +/** + * Copy constructor + * @param that + * @param tsrm_ls + */ +ValueIterator::ValueIterator(const ValueIterator &that) : _impl(that._impl->clone()) {} + +/** + * Destructor + */ +ValueIterator::~ValueIterator() +{ + // get rid of implementation + delete _impl; +} + +/** + * Increment position + * @return ValueIterator + */ +ValueIterator &ValueIterator::operator++() +{ + // increment implementation + _impl->increment(); + + // done + return *this; +} + +/** + * Decrement position + * @return ValueIterator + */ +ValueIterator &ValueIterator::operator--() +{ + // decrement implementation + _impl->decrement(); + + // done + return *this; +} + +/** + * Compare with other iterator + * @param that + * @return bool + */ +bool ValueIterator::operator==(const ValueIterator &that) const +{ + return _impl->equals(that._impl); +} + +/** + * Compare with other iterator + * @param that + * @return bool + */ +bool ValueIterator::operator!=(const ValueIterator &that) const +{ + return !_impl->equals(that._impl); +} + +/** + * Derefecence, this returns a std::pair with the current key and value + * @return std::pair + */ +const std::pair<Value,Value> &ValueIterator::operator*() const +{ + return _impl->current(); +} + +/** + * Dereference, this returns a std::pair with the current key and value + * @return std::pair + */ +const std::pair<Value,Value> *ValueIterator::operator->() const +{ + return &_impl->current(); +} + +/** + * End namespace + */ +} + |