Commit af60ff71 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

minor changes

parent dfad61fe
...@@ -135,11 +135,7 @@ struct QBind { ...@@ -135,11 +135,7 @@ struct QBind {
}; };
//!< A pair of T value reference and defaultValue to use instead of null() //!< A pair of T value reference and defaultValue to use instead of null()
template<typename T> template<typename T> struct QBindDefault { T& value; const T& defaultValue; };
struct QBindDefault {
T& value;
const T& defaultValue;
};
// ////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////
// Generic fluent interface for traversing structured values and processing them along the way: // Generic fluent interface for traversing structured values and processing them along the way:
...@@ -170,8 +166,8 @@ public: ...@@ -170,8 +166,8 @@ public:
using TResult = typename T_::TResult; //!< the result of the traversal using TResult = typename T_::TResult; //!< the result of the traversal
operator bool() noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal operator bool() const noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal
TResult* operator->() noexcept { return outer.operator ->(); } TResult* operator->() noexcept { return outer.operator ->(); }
/**/ Val<T_> meta (QIdentifierLiteral& n, QAsciiData& m) { outer->_meta(n,m); return std::move(*this); } /**/ Val<T_> meta (QIdentifierLiteral& n, QAsciiData& m) { outer->_meta(n,m); return std::move(*this); }
...@@ -219,9 +215,8 @@ public: ...@@ -219,9 +215,8 @@ public:
// T_ can be either a TResult or any combination of nested Seq or Rec like Rec<Seq<TResult> // T_ can be either a TResult or any combination of nested Seq or Rec like Rec<Seq<TResult>
using TResult = typename T_::TResult; using TResult = typename T_::TResult;
operator bool() noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal operator bool() const noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal
TResult* operator->() noexcept { return outer.operator ->(); } TResult* operator->() noexcept { return outer.operator ->(); }
TResult result() { return operator TResult(); }
operator TResult() { return out(); /* calls T_::operator TResult() if T_ != TResult */ } operator TResult() { return out(); /* calls T_::operator TResult() if T_ != TResult */ }
/**/ T_ out() { return outer-> _out() ? std::move(outer) : T_ (); } /**/ T_ out() { return outer-> _out() ? std::move(outer) : T_ (); }
...@@ -266,10 +261,9 @@ public: ...@@ -266,10 +261,9 @@ public:
// T_ can be either a TResult or any combination of nested Seq or Rec like Seq<Rec<TResult> // T_ can be either a TResult or any combination of nested Seq or Rec like Seq<Rec<TResult>
using TResult = typename T_::TResult; using TResult = typename T_::TResult;
operator bool() noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal operator bool() const noexcept { return outer.operator bool(); } //!< Drives QBind<T>::bind() traversal
TResult* operator->() noexcept { return outer.operator ->(); } TResult* operator->() noexcept { return outer.operator ->(); }
TResult result() { return operator TResult(); } operator TResult() { return out(); /* calls T_::operator TResult() if T_ != TResult */ }
operator TResult() { return out(); /* calls T_::operator TResult() if T_ != TResult */ }
/**/ T_ out ( ) { return outer->_out ( ) ? std::move(outer) : T_ (); } /**/ T_ out ( ) { return outer->_out ( ) ? std::move(outer) : T_ (); }
Val<Rec<T_>> item(QIdentifier& n) { return outer->_item( n ) ? Val<Rec<T_>>(std::move(*this)) : Val<Rec<T_>>(); } Val<Rec<T_>> item(QIdentifier& n) { return outer->_item( n ) ? Val<Rec<T_>>(std::move(*this)) : Val<Rec<T_>>(); }
...@@ -323,18 +317,16 @@ class Cur ...@@ -323,18 +317,16 @@ class Cur
{ {
Q_DISABLE_COPY(Cur) Q_DISABLE_COPY(Cur)
public: public:
Q_ENABLE_MOVE(Cur, std::swap(impl, o.impl); ) Q_ENABLE_MOVE_DEFAULT(Cur)
using TResult = Cur; using TResult = Cur;
explicit Cur(TImpl* i) : impl(i) { Q_ASSERT(impl); } explicit Cur(TImpl* i) : impl(i) { Q_ASSERT(impl); }
BindMode mode() const noexcept { return impl ? impl->mode() : BindMode::Invalid; } BindMode mode() const noexcept { return impl ? impl->mode() : BindMode::Invalid; }
operator bool() const noexcept { return impl && impl->_isOk(); } //!< Drives QBind<T>::bind() traversal
operator bool() noexcept { return impl && impl->_isOk(); } //!< Drives QBind<T>::bind() traversal Cur* operator ->() noexcept { return this; }
Cur* operator ->() noexcept { return this; } Val<Cur> value() noexcept { return Val<Cur>(std::move(*this)); }
Val<Cur> value() noexcept { return Val<Cur>(std::move(*this)); }
void setChoice (bool c) { if (impl) impl->_setChoice (c); } void setChoice (bool c) { if (impl) impl->_setChoice (c); }
void reportError(QIdentifierLiteral e) { if (impl) impl->_reportError(e); } void reportError(QIdentifierLiteral e) { if (impl) impl->_reportError(e); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment