Skip to content

Commit

Permalink
C++options: Create QofQueryValue trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Dec 11, 2021
1 parent f26014a commit 947c061
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libgnucash/app-utils/gnc-option-impl.hpp
Expand Up @@ -230,6 +230,18 @@ struct is_QofInstanceValue
template <typename T> inline constexpr bool
is_QofInstanceValue_v = is_QofInstanceValue<T>::value;

template <typename T>
struct is_QofQueryValue
{
static constexpr bool value =
(std::is_same_v<std::decay_t<T>, GncOptionValue<const QofQuery*>> ||
std::is_same_v<std::decay_t<T>,
GncOptionValidatedValue<const QofQuery*>>);
};

template <typename T> inline constexpr bool
is_QofQueryValue_v = is_QofQueryValue<T>::value;

/* These will work when m_value is a built-in class; GnuCash class and container
* values will need specialization unless they happen to define operators << and
* >>.
Expand Down

0 comments on commit 947c061

Please sign in to comment.