Merge Master
This commit is contained in:
@@ -57,9 +57,7 @@ using namespace std;
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
|
||||
: DocumentSchema(0), ProgramVersion(""), FileVersion(0), Level(0),
|
||||
CharacterCount(0), ReadType(None), _File(FileName), _valid(false),
|
||||
_verbose(true)
|
||||
: _File(FileName)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
str.imbue(std::locale::empty());
|
||||
@@ -69,13 +67,6 @@ Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
|
||||
|
||||
// create the parser
|
||||
parser = XMLReaderFactory::createXMLReader();
|
||||
//parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false);
|
||||
//parser->setFeature(XMLUni::fgXercesSchema, false);
|
||||
//parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
|
||||
//parser->setFeature(XMLUni::fgXercesIdentityConstraintChecking, false);
|
||||
//parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
|
||||
//parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
|
||||
//parser->setFeature(XMLUni::fgXercesDynamic, true);
|
||||
|
||||
parser->setContentHandler(this);
|
||||
parser->setLexicalHandler(this);
|
||||
@@ -193,48 +184,28 @@ bool Base::XMLReader::read()
|
||||
parser->parseNext(token);
|
||||
}
|
||||
catch (const XMLException& toCatch) {
|
||||
#if 0
|
||||
char* message = XMLString::transcode(toCatch.getMessage());
|
||||
cerr << "Exception message is: \n"
|
||||
<< message << "\n";
|
||||
XMLString::release(&message);
|
||||
return false;
|
||||
#else
|
||||
|
||||
char* message = XMLString::transcode(toCatch.getMessage());
|
||||
std::string what = message;
|
||||
XMLString::release(&message);
|
||||
throw Base::XMLBaseException(what);
|
||||
#endif
|
||||
}
|
||||
catch (const SAXParseException& toCatch) {
|
||||
#if 0
|
||||
char* message = XMLString::transcode(toCatch.getMessage());
|
||||
cerr << "Exception message is: \n"
|
||||
<< message << "\n";
|
||||
XMLString::release(&message);
|
||||
return false;
|
||||
#else
|
||||
|
||||
char* message = XMLString::transcode(toCatch.getMessage());
|
||||
std::string what = message;
|
||||
XMLString::release(&message);
|
||||
throw Base::XMLParseException(what);
|
||||
#endif
|
||||
}
|
||||
catch (...) {
|
||||
#if 0
|
||||
cerr << "Unexpected Exception \n" ;
|
||||
return false;
|
||||
#else
|
||||
throw Base::XMLBaseException("Unexpected XML exception");
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Base::XMLReader::readElement(const char* ElementName)
|
||||
{
|
||||
bool ok;
|
||||
bool ok{};
|
||||
int currentLevel = Level;
|
||||
std::string currentName = LocalName;
|
||||
do {
|
||||
@@ -271,7 +242,7 @@ void Base::XMLReader::readEndElement(const char* ElementName, int level)
|
||||
throw Base::XMLParseException("End of document reached");
|
||||
}
|
||||
|
||||
bool ok;
|
||||
bool ok{};
|
||||
do {
|
||||
ok = read(); if (!ok) break;
|
||||
if (ReadType == EndDocument)
|
||||
@@ -372,7 +343,7 @@ void Base::XMLReader::readBinFile(const char* filename)
|
||||
if (!to)
|
||||
throw Base::FileException("XMLReader::readBinFile() Could not open file!");
|
||||
|
||||
bool ok;
|
||||
bool ok{};
|
||||
do {
|
||||
ok = read(); if (!ok) break;
|
||||
} while (ReadType != EndCDATA);
|
||||
@@ -464,8 +435,8 @@ const std::vector<std::string>& Base::XMLReader::getFilenames() const
|
||||
bool Base::XMLReader::isRegistered(Base::Persistence *Object) const
|
||||
{
|
||||
if (Object) {
|
||||
for (std::vector<FileEntry>::const_iterator it = FileList.begin(); it != FileList.end(); ++it) {
|
||||
if (it->Object == Object)
|
||||
for (const auto & it : FileList) {
|
||||
if (it.Object == Object)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user