25 messages.insert(messages.end(), theMessages.begin(), theMessages.end());
29 positionMessages.insert(positionMessages.end(), thePositionMessages.begin(), thePositionMessages.end());
33 std::initializer_list<PositionMessage> thePositionMessages
35 messages.insert(messages.end(), theMessages.begin(), theMessages.end());
44 return std::any_of(messages.begin(), messages.end(),
45 [=](
const std::string& str) { return 0 == message.compare(str); });
49 messages.push_back(message);
53 return positionMessages;
57 return std::any_of(positionMessages.begin(), positionMessages.end(),
58 [=](
const PositionMessage& pm) { return position == pm.first && 0 == message.compare(pm.second); });
63 std::sort(positionMessages.begin(), positionMessages.end());
71 std::ostringstream os;
72 for(
auto message : messages) {
73 os << prefix <<
" " << message << std::endl ;
75 for(
auto positionMessage : positionMessages) {
76 os << prefix <<
" @" << positionMessage.first <<
": " << positionMessage.second << std::endl ;
const Messages & getMessages() const
std::pair< unsigned int, std::string > PositionMessage
For convenience, we use a pair for the line and message for a position.
bool hasPositionMessage(const unsigned int position, const std::string &message) const
Convenience to test if the positional message has been set at the position.
std::vector< Message > Messages
const PositionMessages & getPositionMessages() const
void addPositionMessage(const unsigned int position, const std::string &message)
Add the positional message.
std::vector< PositionMessage > PositionMessages
void addMessage(const std::string &message)
Add message.
std::string toString() const
bool hasMessage(const std::string &message) const
Convenience to test with message has been set.
Container of Calculator resources.