[ http://nagoya.apache.org/jira/browse/XERCESC-415?page=history ]
Alberto Massari updated XERCESC-415: ------------------------------------ Priority: Major > InputSource needs copy constructor and assignment operator > ---------------------------------------------------------- > > Key: XERCESC-415 > URL: http://nagoya.apache.org/jira/browse/XERCESC-415 > Project: Xerces-C++ > Type: Bug > Components: SAX/SAX2 > Versions: 1.7.0 > Environment: Operating System: All > Platform: All > Reporter: David Bertoni > Assignee: Xerces-C Developers Mailing List > > 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; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]