aboutsummaryrefslogtreecommitdiff
path: root/xsd/cxx/tree/generator.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-01-19 10:05:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-01-19 10:06:32 +0200
commit0fdf19714613a82a184f4f6e75fb9a4f9b62f18a (patch)
tree93bb2df0f9d9eab44d36dedf29d4df500ecefcbc /xsd/cxx/tree/generator.cxx
parent45db924dfc19b49b7930522dbddd123fb9575e32 (diff)
Use std::unique_ptr instead of std::auto_ptr in C++11 mode
Diffstat (limited to 'xsd/cxx/tree/generator.cxx')
-rw-r--r--xsd/cxx/tree/generator.cxx111
1 files changed, 63 insertions, 48 deletions
diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx
index b373d31..35c53bc 100644
--- a/xsd/cxx/tree/generator.cxx
+++ b/xsd/cxx/tree/generator.cxx
@@ -188,6 +188,7 @@ namespace CXX
FileList& file_list,
AutoUnlinks& unlinks)
{
+ using cutl::shared_ptr;
typedef cutl::re::regexsub Regex;
typedef vector<Path> Paths;
@@ -711,29 +712,13 @@ namespace CXX
<< "#define " << guard << endl
<< endl;
- // Version check.
- //
- fwd << "#include <xsd/cxx/version.hxx>" << endl
- << endl
- << "#if (XSD_INT_VERSION != " << XSD_INT_VERSION << "L)" << endl
- << "#error XSD runtime version mismatch" << endl
- << "#endif" << endl
- << endl;
-
- fwd << "#include <xsd/cxx/pre.hxx>" << endl
+ if (ctx.std >= cxx_version::cxx11)
+ {
+ fwd << "#ifndef XSD_CXX11" << endl
+ << "#define XSD_CXX11" << endl
+ << "#endif" << endl
<< endl;
-
- // Copy prologue.
- //
- fwd << "// Begin prologue." << endl
- << "//" << endl;
-
- append (fwd, ops.fwd_prologue (), ops.prologue ());
- append (fwd, ops.fwd_prologue_file (), prologue);
-
- fwd << "//" << endl
- << "// End prologue." << endl
- << endl;
+ }
if (ctx.char_type == L"char")
{
@@ -760,6 +745,30 @@ namespace CXX
<< endl;
}
+ // Version check.
+ //
+ fwd << "#include <xsd/cxx/version.hxx>" << endl
+ << endl
+ << "#if (XSD_INT_VERSION != " << XSD_INT_VERSION << "L)" << endl
+ << "#error XSD runtime version mismatch" << endl
+ << "#endif" << endl
+ << endl;
+
+ fwd << "#include <xsd/cxx/pre.hxx>" << endl
+ << endl;
+
+ // Copy prologue.
+ //
+ fwd << "// Begin prologue." << endl
+ << "//" << endl;
+
+ append (fwd, ops.fwd_prologue (), ops.prologue ());
+ append (fwd, ops.fwd_prologue_file (), prologue);
+
+ fwd << "//" << endl
+ << "// End prologue." << endl
+ << endl;
+
// Generate.
//
{
@@ -817,34 +826,16 @@ namespace CXX
<< "#define " << guard << endl
<< endl;
- // Version check.
- //
- hxx << "#include <xsd/cxx/config.hxx>" << endl
- << endl
- << "#if (XSD_INT_VERSION != " << XSD_INT_VERSION << "L)" << endl
- << "#error XSD runtime version mismatch" << endl
- << "#endif" << endl
- << endl;
-
- hxx << "#include <xsd/cxx/pre.hxx>" << endl
- << endl;
-
- // Copy prologue.
- //
- hxx << "// Begin prologue." << endl
- << "//" << endl;
-
- append (hxx, ops.hxx_prologue (), ops.prologue ());
- append (hxx, ops.hxx_prologue_file (), prologue);
-
- hxx << "//" << endl
- << "// End prologue." << endl
- << endl;
-
- // Generate character selection defines.
- //
if (!forward)
{
+ if (ctx.std >= cxx_version::cxx11)
+ {
+ hxx << "#ifndef XSD_CXX11" << endl
+ << "#define XSD_CXX11" << endl
+ << "#endif" << endl
+ << endl;
+ }
+
if (ctx.char_type == L"char")
{
hxx << "#ifndef XSD_USE_CHAR" << endl
@@ -871,6 +862,30 @@ namespace CXX
}
}
+ // Version check.
+ //
+ hxx << "#include <xsd/cxx/config.hxx>" << endl
+ << endl
+ << "#if (XSD_INT_VERSION != " << XSD_INT_VERSION << "L)" << endl
+ << "#error XSD runtime version mismatch" << endl
+ << "#endif" << endl
+ << endl;
+
+ hxx << "#include <xsd/cxx/pre.hxx>" << endl
+ << endl;
+
+ // Copy prologue.
+ //
+ hxx << "// Begin prologue." << endl
+ << "//" << endl;
+
+ append (hxx, ops.hxx_prologue (), ops.prologue ());
+ append (hxx, ops.hxx_prologue_file (), prologue);
+
+ hxx << "//" << endl
+ << "// End prologue." << endl
+ << endl;
+
// Generate.
//
{