16 enum class TokenType {
35 TokenType type = TokenType::None;
44 std::vector<TokenInfo> _tokens;
47 typedef std::vector<TokenInfo>::const_iterator TokenIterator;
51 const TokenInfo &val)
const;
52 bool filter(
const MessageParser &parser, TokenIterator ¤t_token,
53 const std::function<
void(
const TokenIterator &,
54 const std::string &)> &complete)
const;
57 const std::function<
void(
const TokenIterator &,
const std::string &)>
58 &complete =
nullptr)
const;
63 void assign(
const std::string &query);
65 const std::string &str()
const {
return _query; }
70 mutable std::mutex _subscriber_mutex;
71 std::shared_ptr<Subscriber<Message>> _subscriber;
72 std::function<std::shared_ptr<const Message>()> _message_func;
82 _query = other._query;
85 _query = other._query;
89 const std::string &str()
const {
return _query; }
90 void assign(
const std::string &query) { _query = query; }
92 std::unique_lock<std::mutex> lock(_subscriber_mutex);
93 _subscriber = subscriber;
95 std::shared_ptr<const Message> message()
const {
96 std::unique_lock<std::mutex> lock(_subscriber_mutex);
98 return _subscriber->message();
101 return _message_func();
106 message(
const std::function<std::shared_ptr<const Message>()> &message_func) {
107 std::unique_lock<std::mutex> lock(_subscriber_mutex);
108 _message_func = message_func;
110 bool empty()
const {
return _query.empty(); }
120 return a.str() == b.str();
124 return a.str() != b.str();
128 attributes->complete = [](
const Property &property,
const std::string &text,
130 LOG_DEBUG(
"complete " << text);
132 LOG_DEBUG(
"message found");
135 LOG_DEBUG(
"no message received yet");
136 return std::vector<std::string>();