--- /dev/null
+// Roast+ License
+
+/*
+
+*/
+#ifndef __SFJP_ROAST__container__linear_iterator_base_HPP__
+#define __SFJP_ROAST__container__linear_iterator_base_HPP__
+
+#include "roast/container/iterator_base.hpp"
+
+namespace roast
+{
+ /////////////////////////////////////////////////////////
+
+ // !! Not Implemented is_valid() Method. !!
+
+ template <typename T, typename _Self >
+ class _linear_iterator_impl_base
+ {
+ public:
+ typedef T _IteratorType, IteratorType;
+ typedef T _ValueType, ValueType;
+ protected:
+ T m_it;
+
+ public:
+ _linear_iterator_impl_base(){}
+ _linear_iterator_impl_base(const T& _beg)
+ : m_it(_beg)
+ {}
+ ///////////////////////////////////////////////////////////////////////
+
+ void setup(const T& _beg)
+ {
+ m_it = _beg;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+
+ int compare(const _linear_iterator_impl_base& target) const
+ {
+ return m_it - target.m_it;
+ }
+
+ // Next (Like iterator ++)
+ void next() {
+ m_it++;
+ }
+
+ // Value
+ T& get_value_ref() const
+ {
+ return m_it;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+
+ // Arithmetic operators
+
+ _Self operator -(const _Self& target) const
+ {
+ return _Self(m_it - target.m_it);
+ }
+ _Self operator -(const T& target) const
+ {
+ return _Self(m_it - target);
+ }
+ _Self operator -(int n) const
+ {
+ return _Self(m_it - n);
+ }
+ _Self operator --() {
+ _Self old = *this;
+ m_it--;
+ return old;
+ }
+ _Self operator --(int) {
+ m_it--;
+ return *this;
+ }
+
+ _Self operator +(const _Self& target) const
+ {
+ return _Self(m_it + target.m_it);
+ }
+ _Self operator +(const T& target) const
+ {
+ return _Self(m_it + target);
+ }
+ _Self operator +(int n) const
+ {
+ return _Self(m_it + n);
+ }
+ };
+
+ /////////////////////////////////////////////////////////
+
+ template <typename T, typename _Self>
+ class linear_iterator_base :
+ public _iterator< _linear_iterator_impl_base<T,_Self> >
+ {
+ private:
+ typedef _linear_iterator_impl_base<T,_Self> _Impl;
+ typedef _iterator<_Impl> _Base;
+ public:
+ linear_iterator_base(){}
+ linear_iterator_base(const _Impl& impl) : _Base(impl){}
+ linear_iterator_base(T& _beg)
+ : _Base(_Impl(_beg)) {}
+ };
+}
+
+#endif//__SFJP_ROAST__container__linear_iterator_base_HPP__
--- /dev/null
+// Roast+ License
+
+/*
+
+*/
+#ifndef __SFJP_ROAST__container__ptr_iterator_base_HPP__
+#define __SFJP_ROAST__container__ptr_iterator_base_HPP__
+
+#include "roast/container/linear_iterator_base.hpp"
+
+namespace roast
+{
+ /////////////////////////////////////////////////////////
+
+ // !! Not Implemented is_valid() Method. !!
+
+ template <typename T, typename _Self>
+ class _ptr_iterator_impl_base : public _linear_iterator_impl_base<T*,_Self>
+ {
+ public:
+ typedef T _ValueType, ValueType;
+ private:
+ typedef _linear_iterator_impl_base<T*,_Self> _Base;
+ public:
+ _ptr_iterator_impl_base(){}
+ _ptr_iterator_impl_base(T* _beg)
+ : _Base(_beg)
+ {}
+ ///////////////////////////////////////////////////////////////////////
+
+ // Value
+ T& get_value_ref() const
+ {
+ return *m_it;
+ }
+ };
+
+ /////////////////////////////////////////////////////////
+
+ template <typename T, typename _Self>
+ class ptr_iterator_base :
+ public _iterator< _ptr_iterator_impl_base<T,_Self> >
+ {
+ private:
+ typedef _ptr_iterator_impl_base<T,_Self> _Impl;
+ typedef _iterator<_Impl> _Base;
+ public:
+ ptr_iterator_base(){}
+ ptr_iterator_base(const _Impl& impl) : _Base(impl){}
+ ptr_iterator_base(T* _beg)
+ : _Base(_Impl(_beg)) {}
+ };
+}
+
+#endif//__SFJP_ROAST__container__ptr_iterator_base_HPP__
--- /dev/null
+// Roast+ License
+
+/*
+
+*/
+#ifndef __SFJP_ROAST__container__tokenize_HPP__
+#define __SFJP_ROAST__container__tokenize_HPP__
+
+#include <map>
+
+namespace roast
+{
+ //template <typename _Container>
+ template <typename _Iterator, typename _Separaters>
+ class _tokenize_iterator_impl
+ {
+ protected:
+ _Iterator m_token_head;
+ _Iterator m_it;
+ _Separaters m_seps;
+
+ int compare(const _tokenize_iterator_impl& target) const
+ {
+ return m_it - target.m_it;
+ }
+
+ public:
+ typedef ::std::pair<_Iterator,_Iterator> _IteratorPair, IteratorPair, _ValueType, ValueType;
+
+ /////////////////////////////////////////////////
+
+ _tokenize_iterator_impl(){}
+ _tokenize_iterator_impl(const _Iterator& it_start, const _Separaters& _seps)
+ : m_it(it_start), m_seps(_seps)
+ {
+ next();
+ }
+
+ /////////////////////////////////////////////////
+
+ // Next (Like iterator ++)
+ __forceinline void next()
+ {
+ // Head Iterator Backup
+ m_token_head = m_it;
+
+ // Find Separater
+ while( m_it.is_valid() )
+ {
+ m_it++;
+ if ( m_seps.find(*m_it).is_valid() ){
+ m_it++;
+ break;
+ }
+ }
+ }
+
+ // Iterator pointer iValid?
+ bool is_valid() const {
+ //return ( m_it != m_end );
+ //return ( m_token_head != m_end );
+ return m_token_head.is_valid();
+ }
+
+ // Value (::std::pair<HeadIterator, TailIterator>)
+ ValueType get_value_ref() const {
+ return ::std::make_pair(m_token_head, m_it); }
+
+ //////////////////////////////////////////
+ };
+}
+
+#endif//__SFJP_ROAST__container__tokenize_HPP__