switched PRgeHandler where possible to smart pointers.
This commit is contained in:
parent
05c06a071e
commit
823ef087c9
@ -31,6 +31,7 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
@ -345,7 +346,7 @@ PRgeHandler::PRgeHandler(const std::string fln)
|
||||
}
|
||||
|
||||
// create the rge xml handler
|
||||
PXmlRgeHandler *xmlRge = new PXmlRgeHandler();
|
||||
std::unique_ptr<PXmlRgeHandler> xmlRge = std::make_unique<PXmlRgeHandler>();
|
||||
if (xmlRge == nullptr) {
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "**ERROR** couldn't invoke PXmlRgeHandler." << std::endl;
|
||||
@ -355,7 +356,7 @@ PRgeHandler::PRgeHandler(const std::string fln)
|
||||
}
|
||||
|
||||
// create the SAX parser
|
||||
TSAXParser *saxParser = new TSAXParser();
|
||||
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||
if (saxParser == nullptr) {
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "**ERROR** couldn't invoke TSAXParser." << std::endl;
|
||||
@ -366,7 +367,7 @@ PRgeHandler::PRgeHandler(const std::string fln)
|
||||
saxParser->SetStopOnError();
|
||||
|
||||
// connect SAX parser and rge handler
|
||||
saxParser->ConnectToHandler("PXmlRgeHandler", xmlRge);
|
||||
saxParser->ConnectToHandler("PXmlRgeHandler", xmlRge.get());
|
||||
int status = saxParser->ParseFile(fln.c_str());
|
||||
if (status != 0) {
|
||||
std::cerr << std::endl;
|
||||
@ -433,9 +434,6 @@ PRgeHandler::PRgeHandler(const std::string fln)
|
||||
fData.push_back(dataSet);
|
||||
}
|
||||
}
|
||||
|
||||
delete saxParser;
|
||||
delete xmlRge;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user