10 #ifndef IWAFIELD_H_INCLUDED
11 #define IWAFIELD_H_INCLUDED
17 #include <boost/container/deque.hpp>
18 #include <boost/optional.hpp>
53 virtual Tag tag()
const = 0;
56 virtual bool empty()
const = 0;
57 virtual std::size_t
size()
const = 0;
60 virtual bool is()
const = 0;
61 operator bool()
const;
72 template<IWAField::Tag TagV,
typename ValueT,
typename Reader>
99 bool is()
const override
107 throw std::logic_error(
"the field is unset");
118 std::size_t
size()
const override
126 throw std::out_of_range(
"index is out of range");
170 const long start = input->tell();
171 while (!input->isEnd() && (length >
static_cast<unsigned long>(input->tell() -
start)))
189 template<IWAField::Tag TagV,
typename ValueT,
typename Reader>
195 template<IWAField::Tag TagV,
typename ValueT,
typename Reader>
198 return bool(field) ? field.
get() :
value;
201 template<IWAField::Tag TagV,
typename ValueT,
typename Reader,
typename DefaultValueT>
204 return bool(field) ? field.
get() : ValueT(value);
virtual bool empty() const =0
Definition: IWORKToken.h:412
const IWAUInt64Field & uint64(std::size_t field) const
Definition: IWAField.cpp:35
std::size_t size() const override
Definition: IWAField.h:118
const IWAFixed32Field & fixed32(std::size_t field) const
Definition: IWAField.cpp:75
const std::deque< value_type > repeated() const
Definition: IWAField.h:153
Definition: IWAField.h:44
detail::IWAFieldImpl< IWAField::TAG_FIXED64, uint64_t, IWAReader::Fixed64 > IWAFixed64Field
Definition: IWAField.h:213
Definition: IWAField.h:33
const_reference_type operator[](const std::size_t index) const
Definition: IWAField.h:123
detail::IWAFieldImpl< IWAField::TAG_BOOL, bool, IWAReader::Bool > IWABoolField
Definition: IWAField.h:211
detail::IWAFieldImpl< IWAField::TAG_STRING, std::string, IWAReader::String > IWAStringField
Definition: IWAField.h:216
bool operator!() const
Definition: IWAField.cpp:25
detail::IWAFieldImpl< IWAField::TAG_UINT64, uint64_t, IWAReader::UInt64 > IWAUInt64Field
Definition: IWAField.h:208
boost::container::deque< ValueT > container_type
Definition: IWAField.h:75
Definition: IWAField.h:37
detail::IWAFieldImpl< IWAField::TAG_UINT32, uint32_t, IWAReader::UInt32 > IWAUInt32Field
Definition: IWAField.h:207
Definition: IWAField.h:34
virtual std::size_t size() const =0
Definition: IWORKToken.h:631
const IWASInt32Field & sint32(std::size_t field) const
Definition: IWAField.cpp:40
Definition: IWORKToken.h:571
virtual bool is() const =0
virtual ~IWAField()=0
Definition: IWAField.cpp:16
Definition: IWAField.h:32
ValueT value_type
Definition: IWAField.h:78
Definition: IWORKToken.h:674
Definition: IWAField.h:46
virtual void parse(const RVNGInputStreamPtr_t &input, unsigned long length, bool allowEmpty)=0
detail::IWAFieldImpl< IWAField::TAG_FLOAT, float, IWAReader::Float > IWAFloatField
Definition: IWAField.h:220
Definition: IWAField.h:31
detail::IWAFieldImpl< IWAField::TAG_SINT32, int32_t, IWAReader::SInt32 > IWASInt32Field
Definition: IWAField.h:209
Tag
Definition: IWAField.h:29
Definition: IWAField.h:41
Definition: IWAField.h:45
detail::IWAFieldImpl< IWAField::TAG_BYTES, RVNGInputStreamPtr_t, IWAReader::Bytes > IWABytesField
Definition: IWAField.h:217
IWAField::Tag tag() const override
Definition: IWAField.h:92
container_type m_values
Definition: IWAField.h:184
detail::IWAFieldImpl< IWAField::TAG_DOUBLE, double, IWAReader::Double > IWADoubleField
Definition: IWAField.h:214
Definition: IWAField.h:47
IWAFieldImpl()
Definition: IWAField.h:85
container_type::const_reverse_iterator const_reverse_iterator
Definition: IWAField.h:82
Definition: IWAField.h:43
const ValueT & get_optional_value_or(const detail::IWAFieldImpl< TagV, ValueT, Reader > &field, const ValueT &value)
Definition: IWAField.h:196
const IWASInt64Field & sint64(std::size_t field) const
Definition: IWAField.cpp:45
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:82
const IWAUInt32Field & uint32(std::size_t field) const
Definition: IWAField.cpp:30
const_reverse_iterator rend() const
Definition: IWAField.h:145
const IWADoubleField & double_(std::size_t field) const
Definition: IWAField.cpp:60
Definition: IWAField.h:36
void parse(const RVNGInputStreamPtr_t &input, const unsigned long length, const bool allowEmpty) override
Definition: IWAField.h:166
const IWABoolField & bool_(std::size_t field) const
Definition: IWAField.cpp:50
Definition: IWAField.h:73
bool empty() const override
Definition: IWAField.h:113
const ValueT & const_reference_type
Definition: IWAField.h:80
Definition: IWAField.h:222
Definition: IWAField.h:40
const_reverse_iterator rbegin() const
Definition: IWAField.h:140
const IWAMessageField & message(std::size_t field) const
Definition: IWAField.cpp:70
const IWAFixed64Field & fixed64(std::size_t field) const
Definition: IWAField.cpp:55
Definition: IWAField.h:26
ValueT & reference_type
Definition: IWAField.h:79
Definition: IWAField.h:35
bool is() const override
Definition: IWAField.h:99
const IWABytesField & bytes(std::size_t field) const
Definition: IWAMessage.h:21
detail::IWAFieldImpl< IWAField::TAG_SINT64, int64_t, IWAReader::SInt64 > IWASInt64Field
Definition: IWAField.h:210
Definition: IWAField.h:42
const_reference_type get() const
Definition: IWAField.h:104
const IWAFloatField & float_(std::size_t field) const
Definition: IWAField.cpp:80
const boost::optional< value_type > optional() const
Definition: IWAField.h:159
Definition: IWAField.h:38
Definition: IWAField.h:39
container_type::const_iterator const_iterator
Definition: IWAField.h:81
std::shared_ptr< IWAField > IWAFieldPtr_t
Definition: IWAField.h:67
const_iterator begin() const
Definition: IWAField.h:130
detail::IWAFieldImpl< IWAField::TAG_FIXED32, uint32_t, IWAReader::Fixed32 > IWAFixed32Field
Definition: IWAField.h:219
virtual Tag tag() const =0
const IWAStringField & string(std::size_t field) const
Definition: IWAField.cpp:65
const_iterator end() const
Definition: IWAField.h:135