#include <sys/types.h>
#include <string.h>
#include <stdarg.h>
+#include <iostream>
+#include <sstream>
#ifdef KM_WIN32
#define getpid GetCurrentProcessId
//------------------------------------------------------------------------------------------
+//
+std::basic_ostream<char, std::char_traits<char> >&
+Kumu::operator<<(std::basic_ostream<char, std::char_traits<char> >& strm, LogEntry const& Entry)
+{
+ std::basic_ostringstream<char, std::char_traits<char> > s;
+ s.copyfmt(strm);
+ s.width(0);
+ std::string buf;
+
+ s << Entry.CreateStringWithOptions(buf, LOG_OPTION_ALL);
+
+ strm << s.str();
+ return strm;
+}
+
+//------------------------------------------------------------------------------------------
+
+
//
bool
Kumu::LogEntry::TestFilter(i32_t filter) const
#include <KM_util.h>
#include <stdarg.h>
#include <errno.h>
+#include <iosfwd>
#define LOG_MSG_IMPL(t) \
va_list args; \
bool Unarchive(MemIOReader* Reader);
};
+ //
+ std::basic_ostream<char, std::char_traits<char> >&
+ operator<<(std::basic_ostream<char, std::char_traits<char> >& strm, LogEntry const& Entry);
+
typedef ArchivableList<LogEntry> LogEntryList;
asdcp_init_xml_dom();
+ int errorCount = 0;
SAXParser* parser = new SAXParser();
parser->setDoValidation(true);
parser->setDoNamespaces(true); // optional
char* message = XMLString::transcode(e.getMessage());
DefaultLogSink().Error("Parser error: %s\n", message);
XMLString::release(&message);
- return false;
+ errorCount++;
}
catch (const SAXParseException& e)
{
char* message = XMLString::transcode(e.getMessage());
DefaultLogSink().Error("Parser error: %s at line %d\n", message, e.getLineNumber());
XMLString::release(&message);
- return false;
+ errorCount++;
}
catch (...)
{
DefaultLogSink().Error("Unexpected XML parser error\n");
- return false;
+ errorCount++;
}
- m_NamespaceOwner = (void*)docHandler->TakeNamespaceMap();
+ if ( errorCount == 0 )
+ m_NamespaceOwner = (void*)docHandler->TakeNamespaceMap();
+
delete parser;
delete docHandler;
- return true;
+
+ return errorCount > 0 ? false : true;
}
//