Open GoogleCodeExporter opened 9 years ago
The only workaround I've found is to re-assign to the pointer received from
GetDocument, i.e.
ticpp::Document* doc = node->GetDocument();
... subsequently ...
doc = ticpp::Document();
Original comment by rldu...@gmail.com
on 2 Jun 2014 at 8:47
[deleted comment]
Need to amend previous comment. Instead of:
doc = ticpp::Document();
needs to be:
*doc = ticpp::Document();
Sorry for the typo...
Original comment by rldu...@gmail.com
on 3 Jun 2014 at 3:29
OK, one more note and I'll leave it alone. Here's what I'm using as a work
around:
class DocumentPtr
{
public:
DocumentPtr(ticpp::Node const * node) : document(node->GetDocument()) {}
~DocumentPtr() { *document = ticpp::Document(); }
ticpp::Document* operator->() { return document; }
ticpp::Document& operator*() { return *document; }
operator ticpp::Document&() { return *document; }
operator ticpp::Document*() { return document; }
private:
DocumentPtr(DocumentPtr const&); // No copy construct
DocumentPtr& operator=(DocumentPtr const &); // No copy assignment
ticpp::Document* document;
};
I haven't beat on it a bunch but it works OK in this context:
ticpp::Element const * e = findElement(DocumentPtr(refElem), path);
where
ticpp::Element const * e = findElement(refElem->GetDocument(), path);
didn't.
FWIW the signature for findElement is:
ticpp::Element* findElement(ticpp::Node const *, std::string const&)
Original comment by rldu...@gmail.com
on 3 Jun 2014 at 4:46
Original issue reported on code.google.com by
Pyr...@googlemail.com
on 20 Nov 2010 at 4:53