query_t objects are now convertible to predicate_t
This commit is contained in:
parent
294bf5a83d
commit
a779751fc7
3 changed files with 14 additions and 2 deletions
|
|
@ -48,6 +48,8 @@
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
|
class query_t;
|
||||||
|
|
||||||
class predicate_t : public expr_t
|
class predicate_t : public expr_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -61,6 +63,7 @@ public:
|
||||||
: expr_t(other), what_to_keep(other.what_to_keep) {
|
: expr_t(other), what_to_keep(other.what_to_keep) {
|
||||||
TRACE_CTOR(predicate_t, "copy");
|
TRACE_CTOR(predicate_t, "copy");
|
||||||
}
|
}
|
||||||
|
predicate_t(const query_t& other);
|
||||||
|
|
||||||
predicate_t(const string& str, const keep_details_t& _what_to_keep,
|
predicate_t(const string& str, const keep_details_t& _what_to_keep,
|
||||||
const parse_flags_t& flags = PARSE_DEFAULT)
|
const parse_flags_t& flags = PARSE_DEFAULT)
|
||||||
|
|
|
||||||
12
src/query.h
12
src/query.h
|
|
@ -254,11 +254,19 @@ public:
|
||||||
: predicate_t(other) {
|
: predicate_t(other) {
|
||||||
TRACE_CTOR(query_t, "copy");
|
TRACE_CTOR(query_t, "copy");
|
||||||
}
|
}
|
||||||
|
query_t(const string& arg,
|
||||||
query_t(const value_t& args,
|
|
||||||
const keep_details_t& _what_to_keep = keep_details_t())
|
const keep_details_t& _what_to_keep = keep_details_t())
|
||||||
: predicate_t(_what_to_keep) {
|
: predicate_t(_what_to_keep) {
|
||||||
TRACE_CTOR(query_t, "string, keep_details_t");
|
TRACE_CTOR(query_t, "string, keep_details_t");
|
||||||
|
if (! arg.empty()) {
|
||||||
|
value_t temp(string_value(arg));
|
||||||
|
parse_args(temp.to_sequence());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
query_t(const value_t& args,
|
||||||
|
const keep_details_t& _what_to_keep = keep_details_t())
|
||||||
|
: predicate_t(_what_to_keep) {
|
||||||
|
TRACE_CTOR(query_t, "value_t, keep_details_t");
|
||||||
if (! args.empty())
|
if (! args.empty())
|
||||||
parse_args(args);
|
parse_args(args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ libledger_expr_la_SOURCES = \
|
||||||
src/option.cc \
|
src/option.cc \
|
||||||
src/format.cc \
|
src/format.cc \
|
||||||
src/query.cc \
|
src/query.cc \
|
||||||
|
src/predicate.cc \
|
||||||
src/scope.cc \
|
src/scope.cc \
|
||||||
src/interactive.cc \
|
src/interactive.cc \
|
||||||
src/expr.cc \
|
src/expr.cc \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue