Well I would advise not using Poco at all but rather looking at JsonCpp. The design choice Poco made by making you call reset on it is rather odd. That aside, the RAII approach is fairly simple:
template <typename T>
struct ScopedParser {
T& parser; // parser object
ScopedParser(T& p) : parser(p) {} // set parser in constuctor
ScopedParser(ScopedParser&&) = delete; // no moving
ScopedParser(const ScopedParser&) = delete; // no copying
~ScopedParser() {
parser.reset(); // reset it
}
}
Example on how to use it:
void myFunc() {
Poco::JSONParser p;
ScopedParser<Poco::JSONParser> pScoped(p);
}