25 #include "common/span.h" 26 #include "common/endian.h" 27 #include "common/file.h" 28 #include "common/memstream.h" 29 #include "common/scummsys.h" 30 #include "common/str.h" 35 enum kSciDebugLevels {
41 #pragma mark SciSpanImpl - SciSpanIterator 43 namespace SciSpanInternal {
44 template <
typename Span,
bool IsConst>
47 typedef typename Span::value_type span_value_type;
51 typedef typename Span::difference_type difference_type;
52 typedef typename Common::remove_const<span_value_type>::type value_type;
58 inline SciSpanIterator(span_type *span,
const difference_type index) : super_type(span, index) {}
63 super_type::operator=(other);
81 template <
typename ValueType,
template <
typename>
class Derived>
84 typedef Derived<ValueType> derived_type;
86 template <
typename T,
template <
typename>
class U>
friend class SciSpanImpl;
87 #if defined(CXXTEST_RUNNING) && CXXTEST_RUNNING 88 friend class ::SpanTestSuite;
92 typedef typename super_type::value_type value_type;
93 typedef typename super_type::difference_type difference_type;
94 typedef typename super_type::index_type index_type;
95 typedef typename super_type::size_type size_type;
98 typedef typename super_type::pointer pointer;
99 typedef typename super_type::const_pointer const_pointer;
100 typedef typename super_type::reference reference;
101 typedef typename super_type::const_reference const_reference;
106 const size_type size_,
108 const size_type sourceByteOffset_ = 0) :
109 super_type(data_, size_, name_, sourceByteOffset_) {}
111 template <
typename Other>
112 inline SciSpanImpl(
const Other &other) : super_type(other) {}
114 inline const_iterator cbegin()
const {
return const_iterator(&this->impl(), 0); }
115 inline const_iterator cend()
const {
return const_iterator(&this->impl(), this->size()); }
116 inline const_iterator begin()
const {
return const_iterator(&this->impl(), 0); }
117 inline const_iterator end()
const {
return const_iterator(&this->impl(), this->size()); }
118 inline iterator begin() {
return iterator(&this->impl(), 0); }
119 inline iterator end() {
return iterator(&this->impl(), this->size()); }
122 #pragma mark SciSpanImpl - ForwardIterator 132 inline const_reference operator*()
const {
133 this->validate(0,
sizeof(value_type));
137 inline reference operator*() {
138 this->validate(0,
sizeof(value_type));
142 inline mutable_derived_type &operator+=(
const difference_type delta) {
143 this->validate(0, delta *
sizeof(value_type), Common::kValidateSeek);
144 this->_data += delta;
145 this->_size -= delta;
149 inline mutable_derived_type &operator++() {
150 return operator+=(1);
153 inline mutable_derived_type operator++(
int) {
154 mutable_derived_type span(this->impl());
159 inline mutable_derived_type operator+(
const difference_type delta)
const {
160 mutable_derived_type span(this->impl());
166 template <
typename ValueType>
171 COMMON_SPAN_TYPEDEFS;
173 inline SciSpan() : super_type() {}
175 inline SciSpan(
const pointer data_,
176 const size_type size_,
178 const size_type sourceByteOffset_ = 0) :
179 super_type(data_, size_, name_, sourceByteOffset_) {}
181 template <
typename Other>
182 inline SciSpan(
const Other &other) : super_type(other) {}
187 #endif // DGDS_UTIL_H
Definition: type_traits.h:44
Definition: scispan.h:167