Commit Graph

9 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
0d24ac2d4a Store Location::lineno as size_t
By storing it as size_t we explicitly disallow negative line numbers,
and keep 0 as an error/empty/undefined location.

A small problem with this is that MessageContainer.error and friends
still accept negative numbers (often without warning) via size_t
implicit conversion and wrap-around.
2016-04-06 11:41:22 +02:00
Jørgen Kvalsvik
3efa5fb90c ParseContext::handleError returns messagetypë́
For more transactional behaviour and to support MessageContainer in
favour of opm-log, this method now returns an enum describing how the
error should be handled, rather than throwing or no-oping. Throwing is
preserved if ParseContext is configured to do so.
2016-04-06 10:39:06 +02:00
Jørgen Kvalsvik
f3bef79562 MessageContainer::const_iterator bound
While the implementation is a simple alias to
std::vector<Message>::const_iterator, it enablese generic lookup of the
iterator type at compile time, and enables us to effortlessly change the
underlying implementation later.
2016-04-06 10:38:19 +02:00
Jørgen Kvalsvik
eb610453b4 MessageContainer::add support
Some phenomenons can be configured as error, warning or debug output,
and is not necessarily known in advanced by the entity adding a message.
To facilite adding a message with runtime-defined warning level, the add
method is supported.
2016-04-06 10:38:18 +02:00
Jørgen Kvalsvik
6c8487ea07 Message::location uses automatic members
By supporting operator bool() we get the same existence checking
capabilities as the unique_ptr implementations, without the hurdles of
non-copyability and manual heap allocation.
2016-04-06 10:38:13 +02:00
Joakim Hove
b778beb507 Renamed enum symbols 2016-03-29 14:18:03 +02:00
Liu Ming
82863ac090 add begin(), end() iterator function. 2016-03-25 09:52:27 +08:00
Liu Ming
6f3d8b0e07 move MessageType definition. add overload functions. 2016-03-25 09:47:57 +08:00
Liu Ming
2865f96eda Add message container. 2016-03-24 13:55:12 +08:00