DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7944>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7944 InputSource needs copy constructor and assignment operator Summary: InputSource needs copy constructor and assignment operator Product: Xerces-C++ Version: 1.7.0 Platform: All OS/Version: All Status: NEW Severity: Blocker Priority: Other Component: SAX/SAX2 AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] InputSource does not have a copy constructor or an assignment operator. Both would be really handy for deriving classes. Current derived classes can either get the behavior by default, or avoid it by explicitly calling the default constructor or not chaining up to the assignment operator. Here's a diff with the implementations: cvs diff InputSource.hpp (in directory V:\xml-xerces\c\src\xercesc\sax\) Index: InputSource.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/sax/InputSource.hpp,v retrieving revision 1.2 diff -r1.2 InputSource.hpp 324a325,334 > /** Copy constructor > * @param src The instance to copy. > */ > InputSource(const InputSource& src); > > /** Assignment operator > * @param src The instance that is the source of the assigment. > */ > InputSource& operator=(const InputSource& src); > 332,337d341 < // ----------------------------------------------------------------------- < // Unimplemented constructors and operators < // ----------------------------------------------------------------------- < InputSource(const InputSource&); < void operator=(const InputSource&); < cvs diff InputSource.cpp (in directory V:\xml-xerces\c\src\xercesc\sax\) Index: InputSource.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/sax/InputSource.cpp,v retrieving revision 1.1.1.1 diff -r1.1.1.1 InputSource.cpp 88a89 > #include <xercesc/util/Janitor.hpp> 177a179,219 > } > > > > InputSource::InputSource(const InputSource& src) : > > fEncoding(src.fEncoding == 0 ? 0 : XMLString::replicate(src.fEncoding)) > , fPublicId(src.fPublicId == 0 ? 0 : XMLString::replicate(src.fPublicId)) > , fSystemId(src.fSystemId == 0 ? 0 : XMLString::replicate(src.fSystemId)) > , fFatalErrorIfNotFound(src.fFatalErrorIfNotFound) > { > } > > InputSource& > InputSource::operator=(const InputSource& src) > { > if (this != &src) > { > // For exception safety, make copies. This only slightly > // less efficient than copying directly into our data members... > ArrayJanitor<XMLCh> tempEncoding(XMLString::replicate(src.fEncoding)); > ArrayJanitor<XMLCh> tempPublicId(XMLString::replicate(src.fPublicId)); > ArrayJanitor<XMLCh> tempSystemId(XMLString::replicate(src.fSystemId)); > > // Swap the pointers... > XMLCh* tempPtr = fEncoding; > fEncoding = tempEncoding.release(); > tempEncoding.reset(tempPtr); > > tempPtr = fPublicId; > fPublicId = tempPublicId.release(); > tempPublicId.reset(tempPtr); > > tempPtr = fSystemId; > fSystemId = tempSystemId.release(); > tempSystemId.reset(tempPtr); > > fFatalErrorIfNotFound = src.fFatalErrorIfNotFound; > } > > return *this; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
