39 #if !defined(TAWARA_BLOCK_ADDITIONS_H_)
40 #define TAWARA_BLOCK_ADDITIONS_H_
42 #include <boost/operators.hpp>
43 #include <boost/shared_ptr.hpp>
61 public boost::equality_comparable<BlockAdditions>
65 typedef std::pair<uint64_t, std::vector<char> >
Addition;
71 typedef std::vector<AdditionPtr>::size_type
size_type;
73 typedef std::vector<AdditionPtr>::reference
reference;
77 typedef std::vector<AdditionPtr>::iterator
iterator;
83 typedef std::vector<AdditionPtr>::const_reverse_iterator
93 {
return additions_.at(pos); }
98 {
return additions_.at(pos); }
104 {
return additions_[pos]; }
109 {
return additions_[pos]; }
123 {
return additions_.rbegin(); }
134 bool empty()
const {
return additions_.empty(); }
141 void clear() { additions_.clear(); }
145 { additions_.erase(position); }
148 { additions_.erase(first, last); }
151 void push_back(value_type
const& value);
155 { additions_.resize(count); }
169 virtual std::streamsize body_size()
const;
172 virtual std::streamsize write_body(std::ostream& output);
175 virtual std::streamsize read_body(std::istream& input,
176 std::streamsize
size);
179 std::streamsize read_addition(std::istream& input,
180 std::streamsize
size);
190 #endif // TAWARA_BLOCK_ADDITIONS_H_
void erase(iterator position)
Erase the addition at the specified iterator.
value_type const & operator[](size_type pos) const
Get a reference to an addition.
std::vector< AdditionPtr > additions_
std::pair< uint64_t, std::vector< char > > Addition
The type of a single block addition of data.
const_reverse_iterator rbegin() const
Get a reverse iterator to the last addition.
boost::shared_ptr< Addition > AdditionPtr
A pointer to an addition.
void erase(iterator first, iterator last)
Erase a range of additions.
std::streamsize size(ID id)
Get the number of bytes required by an ID.
void swap(BlockAdditions &other)
Swaps the contents of this BlockAdditions with another.
bool empty() const
Check if there are no additions.
reverse_iterator rend()
Get a reverse iterator to the position before the first addition.
iterator end()
Get an iterator to the position past the last addition.
The MasterElement interface.
bool operator==(AttachedFile const &lhs, AttachedFile const &rhs)
Equality operator for the AttachedFile object.
const_iterator begin() const
Get an iterator to the first addition.
reverse_iterator rbegin()
Get a reverse iterator to the last addition.
value_type const & at(size_type pos) const
Get the addition at the given position, with bounds checking.
value_type & at(size_type pos)
Get the addition at the given position, with bounds checking.
size_type max_count() const
Get the maximum number of additions.
value_type & operator[](size_type pos)
Get a reference to an addition.
std::vector< AdditionPtr >::value_type value_type
The value type of this container.
std::vector< AdditionPtr >::const_iterator const_iterator
The constant random access iterator type.
This element is used to specify reference blocks.
std::vector< AdditionPtr >::reverse_iterator reverse_iterator
The reversed random access iterator type.
const_reverse_iterator rend() const
Get a reverse iterator to the position before the first addition.
size_type count() const
Get the number of additions.
const_iterator end() const
Get an iterator to the position past the last addition.
void resize(size_type count)
Resizes the additions storage.
iterator begin()
Get an iterator to the first addition.
std::vector< AdditionPtr >::reference reference
The reference type.
void clear()
Remove all additions.
std::vector< AdditionPtr >::size_type size_type
The size type of this container.
std::vector< AdditionPtr >::const_reference const_reference
The constant reference type.
std::vector< AdditionPtr >::const_reverse_iterator const_reverse_iterator
The constant reversed random access iterator type.
const ID BlockAdditions(0x75A1)
std::vector< AdditionPtr >::iterator iterator
The random access iterator type.