summaryrefslogtreecommitdiff
path: root/xsd/xsd/cxx/literal-map.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/xsd/cxx/literal-map.cxx')
-rw-r--r--xsd/xsd/cxx/literal-map.cxx80
1 files changed, 23 insertions, 57 deletions
diff --git a/xsd/xsd/cxx/literal-map.cxx b/xsd/xsd/cxx/literal-map.cxx
index c531b5e..24bfc52 100644
--- a/xsd/xsd/cxx/literal-map.cxx
+++ b/xsd/xsd/cxx/literal-map.cxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/literal-map.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <memory> // std::auto_ptr
@@ -9,7 +8,6 @@
#include <iostream>
#include <xercesc/util/XMLUni.hpp>
-#include <xercesc/util/XercesVersion.hpp>
#include <xercesc/framework/LocalFileInputSource.hpp>
@@ -45,7 +43,7 @@ namespace CXX
locator_ = l;
}
- virtual Void
+ virtual void
startElement (const XMLCh* const,
const XMLCh* const lname,
const XMLCh* const,
@@ -81,7 +79,7 @@ namespace CXX
}
}
- virtual Void
+ virtual void
endElement (const XMLCh* const,
const XMLCh* const lname,
const XMLCh* const)
@@ -115,13 +113,8 @@ namespace CXX
state_ = s_entry;
}
-#if _XERCES_VERSION >= 30000
- virtual Void
+ virtual void
characters (const XMLCh* const s, const XMLSize_t length)
-#else
- virtual Void
- characters (const XMLCh* const s, const unsigned int length)
-#endif
{
String str (XML::transcode (s, length));
@@ -131,9 +124,9 @@ namespace CXX
lit_ += str;
else
{
- for (Size i (0); i < str.size (); ++i)
+ for (size_t i (0); i < str.size (); ++i)
{
- WideChar c (str[i]);
+ wchar_t c (str[i]);
if (c != 0x20 && c != 0x0A && c != 0x0D && c != 0x09)
{
@@ -149,44 +142,37 @@ namespace CXX
//
enum Severity {s_warning, s_error, s_fatal};
- virtual Void
+ virtual void
warning (const SAXParseException& e)
{
handle (e, s_warning);
}
- virtual Void
+ virtual void
error (const SAXParseException& e)
{
handle (e, s_error);
}
- virtual Void
+ virtual void
fatalError (const SAXParseException& e)
{
handle (e, s_fatal);
}
- virtual Void
+ virtual void
resetErrors ()
{
}
- Void
+ void
handle (const SAXParseException& e, Severity s)
{
- wcerr << file_ << ":";
-
-#if _XERCES_VERSION >= 30000
- wcerr << e.getLineNumber () << ":" << e.getColumnNumber () << ": ";
-#else
- XMLSSize_t l (e.getLineNumber ());
- XMLSSize_t c (e.getColumnNumber ());
- wcerr << (l == -1 ? 0 : l) << ":" << (c == -1 ? 0 : c) << ": ";
-#endif
-
String msg (XML::transcode (e.getMessage ()));
- wcerr << (s == s_warning ? "warning: " : "error: ") << msg << endl;
+
+ wcerr << file_ << ":"
+ << e.getLineNumber () << ":" << e.getColumnNumber () << ": "
+ << (s == s_warning ? "warning: " : "error: ") << msg << endl;
if (s != s_warning)
throw Failed ();
@@ -195,37 +181,17 @@ namespace CXX
size_t
line () const
{
- size_t r (0);
-
- if (locator_ != 0)
- {
-#if _XERCES_VERSION >= 30000
- r = static_cast<size_t> (locator_->getLineNumber ());
-#else
- XMLSSize_t l (locator_->getLineNumber ());
- r = l == -1 ? 0 : static_cast<size_t> (l);
-#endif
- }
-
- return r;
+ return locator_ != 0
+ ? static_cast<size_t> (locator_->getLineNumber ())
+ : 0;
}
size_t
col () const
{
- size_t r (0);
-
- if (locator_ != 0)
- {
-#if _XERCES_VERSION >= 30000
- r = static_cast<size_t> (locator_->getColumnNumber ());
-#else
- XMLSSize_t c (locator_->getColumnNumber ());
- r = c == -1 ? 0 : static_cast<size_t> (c);
-#endif
- }
-
- return r;
+ return locator_ != 0
+ ? static_cast<size_t> (locator_->getColumnNumber ())
+ : 0;
}
private:
@@ -243,8 +209,8 @@ namespace CXX
String file_;
StringLiteralMap& map_;
- Boolean str_seen_;
- Boolean lit_seen_;
+ bool str_seen_;
+ bool lit_seen_;
String str_;
String lit_;