Re: Custom containers with Spirit X3 (QString)
Mike Gresens <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
And perhaps you will need some more traits to adapt the QString:
namespace boost { namespace spirit { namespace x3 { namespace traits {
// Adapt push_back for QString
template <>
struct push_back_container<QString>
{
template <typename T>
static bool call(QString& c, T&& val)
{
c.push_back(std::move(val));
return true;
}
};
// Adapt append for QString
template <>
struct append_container<QString>
{
template <typename Iterator>
static bool call(QString& c, Iterator first, Iterator last)
{
// Implement a better append here...
c.append(QString::fromUtf8(&*first, std::distance(first, last)));
return true;
}
};
// Adapt empty for QString
template <>
struct is_empty_container<QString>
{
static bool call(QString const& c)
{
return c.isEmpty();
}
};
} } } }
Best regards,
Mike...
--
View this message in context: http://boost.2283326.n4.nabble.com/Custom-containers-with-Spirit-X3-QString-tp4689943p4689997.html
Sent from the spirit-general mailing list archive at Nabble.com.
------------------------------------------------------------------------------