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" 31 #include "common/textconsole.h" 36 enum kSciDebugLevels {
37 kDebugLevelSound = 1 << 7,
42 #pragma mark SciSpanImpl - SciSpanIterator 44 namespace SciSpanInternal {
45 template <
typename Span,
bool IsConst>
48 typedef typename Span::value_type span_value_type;
52 typedef typename Span::difference_type difference_type;
53 typedef typename Common::RemoveConst<span_value_type>::type value_type;
59 inline SciSpanIterator(span_type *span,
const difference_type index) : super_type(span, index) {}
64 super_type::operator=(other);
82 template <
typename ValueType,
template <
typename>
class Derived>
85 typedef Derived<ValueType> derived_type;
87 template <
typename T,
template <
typename>
class U>
friend class SciSpanImpl;
88 #if defined(CXXTEST_RUNNING) && CXXTEST_RUNNING 89 friend class ::SpanTestSuite;
93 typedef typename super_type::value_type value_type;
94 typedef typename super_type::difference_type difference_type;
95 typedef typename super_type::index_type index_type;
96 typedef typename super_type::size_type size_type;
99 typedef typename super_type::pointer pointer;
100 typedef typename super_type::const_pointer const_pointer;
101 typedef typename super_type::reference reference;
102 typedef typename super_type::const_reference const_reference;
107 const size_type size_,
109 const size_type sourceByteOffset_ = 0) :
110 super_type(data_, size_, name_, sourceByteOffset_) {}
112 template <
typename Other>
113 inline SciSpanImpl(
const Other &other) : super_type(other) {}
115 inline const_iterator cbegin()
const {
return const_iterator(&this->impl(), 0); }
116 inline const_iterator cend()
const {
return const_iterator(&this->impl(), this->size()); }
117 inline const_iterator begin()
const {
return const_iterator(&this->impl(), 0); }
118 inline const_iterator end()
const {
return const_iterator(&this->impl(), this->size()); }
119 inline iterator begin() {
return iterator(&this->impl(), 0); }
120 inline iterator end() {
return iterator(&this->impl(), this->size()); }
123 #pragma mark SciSpanImpl - ForwardIterator 133 inline const_reference operator*()
const {
134 this->validate(0,
sizeof(value_type));
138 inline reference operator*() {
139 this->validate(0,
sizeof(value_type));
143 inline mutable_derived_type &operator+=(
const difference_type delta) {
144 this->validate(0, delta *
sizeof(value_type), Common::kValidateSeek);
145 this->_data += delta;
146 this->_size -= delta;
150 inline mutable_derived_type &operator++() {
151 return operator+=(1);
154 inline mutable_derived_type operator++(
int) {
155 mutable_derived_type span(this->impl());
160 inline mutable_derived_type operator+(
const difference_type delta)
const {
161 mutable_derived_type span(this->impl());
167 template <
typename ValueType>
174 inline SciSpan() : super_type() {}
176 inline SciSpan(
const pointer data_,
177 const size_type size_,
179 const size_type sourceByteOffset_ = 0) :
180 super_type(data_, size_, name_, sourceByteOffset_) {}
182 template <
typename Other>
183 inline SciSpan(
const Other &other) : super_type(other) {}
188 #endif // DGDS_UTIL_H
Definition: type-traits.h:28
Definition: scispan.h:168