summaryrefslogtreecommitdiff
path: root/xsd/xsd/type-map
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/xsd/type-map')
-rw-r--r--xsd/xsd/type-map/lexer.cxx5
-rw-r--r--xsd/xsd/type-map/lexer.hxx19
-rw-r--r--xsd/xsd/type-map/parser.cxx21
-rw-r--r--xsd/xsd/type-map/parser.hxx16
-rw-r--r--xsd/xsd/type-map/type-map.hxx57
5 files changed, 63 insertions, 55 deletions
diff --git a/xsd/xsd/type-map/lexer.cxx b/xsd/xsd/type-map/lexer.cxx
index 96e42de..fe7ecfc 100644
--- a/xsd/xsd/type-map/lexer.cxx
+++ b/xsd/xsd/type-map/lexer.cxx
@@ -1,6 +1,5 @@
// file : xsd/type-map/lexer.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2007-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2007-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <iostream>
@@ -68,7 +67,7 @@ namespace TypeMap
if (is_.eof ())
return Token (Token::eos, L"<end-of-stream>", line_);
- Boolean quote (c == '"');
+ bool quote (c == '"');
if (!quote)
lexeme += c;
diff --git a/xsd/xsd/type-map/lexer.hxx b/xsd/xsd/type-map/lexer.hxx
index 923c85f..0d3af42 100644
--- a/xsd/xsd/type-map/lexer.hxx
+++ b/xsd/xsd/type-map/lexer.hxx
@@ -1,6 +1,5 @@
// file : xsd/type-map/lexer.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2007-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2007-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_TYPE_MAP_LEXER_HXX
@@ -9,13 +8,10 @@
#include <locale>
#include <iosfwd>
-#include <cult/types.hxx>
+#include <types.hxx>
namespace TypeMap
{
- using namespace Cult::Types;
- typedef WideString String;
-
class Lexer
{
public:
@@ -29,7 +25,7 @@ namespace TypeMap
eos
};
- Token (Type type, String const& lexeme, UnsignedLong line)
+ Token (Type type, String const& lexeme, size_t line)
: type_ (type), lexeme_ (lexeme), line_ (line)
{
}
@@ -46,7 +42,7 @@ namespace TypeMap
return lexeme_;
}
- UnsignedLong
+ size_t
line () const
{
return line_;
@@ -55,7 +51,7 @@ namespace TypeMap
private:
Type type_;
String lexeme_;
- UnsignedLong line_;
+ size_t line_;
};
Lexer (std::istream&, String const& path);
@@ -69,12 +65,11 @@ namespace TypeMap
std::locale locale_;
std::istream& is_;
String path_;
- UnsignedLong line_;
+ size_t line_;
String held_lexeme_;
- Boolean comment_;
+ bool comment_;
};
}
#endif // XSD_TYPE_MAP_LEXER_HXX
-
diff --git a/xsd/xsd/type-map/parser.cxx b/xsd/xsd/type-map/parser.cxx
index 9f5e2b5..e391cf7 100644
--- a/xsd/xsd/type-map/parser.cxx
+++ b/xsd/xsd/type-map/parser.cxx
@@ -1,11 +1,10 @@
// file : xsd/type-map/parser.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2007-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2007-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <iostream>
-#include <backend-elements/regex.hxx>
+#include <cutl/re.hxx>
#include <type-map/parser.hxx>
@@ -14,14 +13,14 @@ using std::endl;
namespace TypeMap
{
typedef Lexer::Token Token;
- typedef BackendElements::Regex::Format<WideChar> Format;
+ typedef cutl::re::wformat Format;
Parser::Parser (Lexer& lex, String const& path)
: lex_ (lex), path_ (path), e (std::wcerr)
{
}
- Boolean Parser::
+ bool Parser::
parse (Namespaces& ns)
{
try
@@ -83,7 +82,7 @@ namespace TypeMap
return true;
}
- Boolean Parser::
+ bool Parser::
namespace_ (Namespaces& ns)
{
// First get XML namespace.
@@ -99,7 +98,7 @@ namespace TypeMap
catch (Format const& ex)
{
e << path_ << ":" << t.line () << ": invalid namespace pattern: "
- << ex.description () << endl;
+ << ex.description ().c_str () << endl;
return false;
}
@@ -115,7 +114,7 @@ namespace TypeMap
//
t = lex_.next ();
- Boolean has_cxx_name (false);
+ bool has_cxx_name (false);
String cxx_name;
if (t.type () != Token::token)
@@ -191,7 +190,7 @@ namespace TypeMap
return true;
}
- Boolean Parser::
+ bool Parser::
include (Namespace& n)
{
Token t (lex_.next ());
@@ -222,7 +221,7 @@ namespace TypeMap
return true;
}
- Boolean Parser::
+ bool Parser::
type (Token t, Namespace& n)
{
Pattern xsd_name;
@@ -234,7 +233,7 @@ namespace TypeMap
catch (Format const& ex)
{
e << path_ << ":" << t.line () << ": invalid namespace pattern: "
- << ex.description () << endl;
+ << ex.description ().c_str () << endl;
return false;
}
diff --git a/xsd/xsd/type-map/parser.hxx b/xsd/xsd/type-map/parser.hxx
index 038d2ec..c91bb12 100644
--- a/xsd/xsd/type-map/parser.hxx
+++ b/xsd/xsd/type-map/parser.hxx
@@ -1,21 +1,17 @@
// file : xsd/type-map/parser.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2007-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2007-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_TYPE_MAP_PARSER_HXX
#define XSD_TYPE_MAP_PARSER_HXX
-#include <cult/types.hxx>
+#include <types.hxx>
#include <type-map/type-map.hxx>
#include <type-map/lexer.hxx>
namespace TypeMap
{
- using namespace Cult::Types;
- typedef WideString String;
-
class Parser
{
public:
@@ -23,17 +19,17 @@ namespace TypeMap
// Merge parsed namespaces.
//
- Boolean
+ bool
parse (Namespaces&);
private:
- Boolean
+ bool
namespace_ (Namespaces&);
- Boolean
+ bool
include (Namespace&);
- Boolean
+ bool
type (Lexer::Token, Namespace&);
private:
diff --git a/xsd/xsd/type-map/type-map.hxx b/xsd/xsd/type-map/type-map.hxx
index 34ceefa..cdb8a0c 100644
--- a/xsd/xsd/type-map/type-map.hxx
+++ b/xsd/xsd/type-map/type-map.hxx
@@ -1,25 +1,32 @@
// file : xsd/type-map/type-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2007-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2007-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_TYPE_MAP_TYPE_MAP_HXX
#define XSD_TYPE_MAP_TYPE_MAP_HXX
-#include <cult/types.hxx>
-#include <cult/containers/vector.hxx>
+#include <vector>
-#include <backend-elements/regex.hxx>
+#include <cutl/re.hxx>
+
+#include <types.hxx>
namespace TypeMap
{
- using namespace Cult::Types;
- typedef WideString String;
- typedef BackendElements::Regex::Pattern<WideChar> Pattern;
+ typedef cutl::re::wregex Pattern;
class Type
{
public:
+ Type (String const& xsd_name,
+ String const& cxx_ret_name,
+ String const& cxx_arg_name)
+ : xsd_name_ (xsd_name),
+ cxx_ret_name_ (cxx_ret_name),
+ cxx_arg_name_ (cxx_arg_name)
+ {
+ }
+
Type (Pattern const& xsd_name,
String const& cxx_ret_name,
String const& cxx_arg_name)
@@ -56,6 +63,11 @@ namespace TypeMap
class Namespace
{
public:
+ Namespace (String const& xsd_name)
+ : xsd_name_ (xsd_name), has_cxx_name_ (false)
+ {
+ }
+
Namespace (Pattern const& xsd_name)
: xsd_name_ (xsd_name), has_cxx_name_ (false)
{
@@ -67,7 +79,7 @@ namespace TypeMap
}
Namespace (Pattern const& xsd_name,
- Boolean has_cxx_name,
+ bool has_cxx_name,
String const& cxx_name)
: xsd_name_ (xsd_name),
has_cxx_name_ (has_cxx_name),
@@ -77,8 +89,8 @@ namespace TypeMap
//
//
- typedef Cult::Containers::Vector<String> Includes;
- typedef Includes::ConstIterator IncludesIterator;
+ typedef std::vector<String> Includes;
+ typedef Includes::const_iterator IncludesIterator;
IncludesIterator
includes_begin () const
@@ -92,7 +104,7 @@ namespace TypeMap
return includes_.end ();
}
- Void
+ void
includes_push_back (String const& i)
{
includes_.push_back (i);
@@ -100,8 +112,8 @@ namespace TypeMap
//
//
- typedef Cult::Containers::Vector<Type> Types;
- typedef Types::ConstIterator TypesIterator;
+ typedef std::vector<Type> Types;
+ typedef Types::const_iterator TypesIterator;
TypesIterator
types_begin () const
@@ -115,7 +127,15 @@ namespace TypeMap
return types_.end ();
}
- Void
+ void
+ types_push_back (String const& xsd_type,
+ String const& cxx_ret_type,
+ String const& cxx_arg_type = L"")
+ {
+ types_.push_back (Type (xsd_type, cxx_ret_type, cxx_arg_type));
+ }
+
+ void
types_push_back (Pattern const& xsd_type,
String const& cxx_ret_type,
String const& cxx_arg_type = L"")
@@ -133,7 +153,7 @@ namespace TypeMap
//
//
- Boolean
+ bool
has_cxx_name () const
{
return has_cxx_name_;
@@ -149,12 +169,11 @@ namespace TypeMap
Includes includes_;
Types types_;
Pattern xsd_name_;
- Boolean has_cxx_name_;
+ bool has_cxx_name_;
String cxx_name_;
};
- typedef Cult::Containers::Vector<Namespace> Namespaces;
+ typedef std::vector<Namespace> Namespaces;
}
#endif // XSD_TYPE_MAP_TYPE_MAP_HXX
-