Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Oct 1, 2024
1 parent 2d3ff4b commit a0f6021
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libursa/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@ const QString &Query::as_value() const {
if (type != QueryType::PRIMITIVE) {
throw std::runtime_error("This query doesn\'t have any value.");
}

return value;
}

PrimitiveQuery Query::as_ngram() const {
if (type != QueryType::PRIMITIVE) {
throw std::runtime_error("This query doesn\'t contain a ngram.");
}
return ngram;
}

std::string Query::as_string_repr() const {
std::string out = "";
if (value.empty()) {
Expand Down
1 change: 1 addition & 0 deletions libursa/Query.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Query {
std::vector<Query> &as_queries();
const QString &as_value() const;
uint32_t as_count() const;
PrimitiveQuery as_ngram() const;
std::string as_string_repr() const;
const QueryType &get_type() const;
bool operator==(const Query &other) const;
Expand Down

0 comments on commit a0f6021

Please sign in to comment.