aboutsummaryrefslogtreecommitdiff
path: root/xsde
diff options
context:
space:
mode:
Diffstat (limited to 'xsde')
-rw-r--r--xsde/cxx/elements.cxx6
-rw-r--r--xsde/cxx/hybrid/aggregate-include.hxx5
-rw-r--r--xsde/cxx/hybrid/elements.cxx5
-rw-r--r--xsde/cxx/hybrid/generator.cxx103
-rw-r--r--xsde/cxx/parser/elements.cxx5
-rw-r--r--xsde/cxx/parser/generator.cxx78
-rw-r--r--xsde/cxx/serializer/elements.cxx5
-rw-r--r--xsde/cxx/serializer/generator.cxx78
-rw-r--r--xsde/makefile9
-rw-r--r--xsde/xsde.cxx46
-rw-r--r--xsde/xsde.hxx52
11 files changed, 165 insertions, 227 deletions
diff --git a/xsde/cxx/elements.cxx b/xsde/cxx/elements.cxx
index 07917e6..f1a7760 100644
--- a/xsde/cxx/elements.cxx
+++ b/xsde/cxx/elements.cxx
@@ -291,16 +291,18 @@ namespace CXX
if (!path.empty ())
{
+ path.normalize ();
+
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
//
try
{
- pair = path.string ();
+ pair = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- pair = path.native_file_string ();
+ pair = path.string ();
}
}
diff --git a/xsde/cxx/hybrid/aggregate-include.hxx b/xsde/cxx/hybrid/aggregate-include.hxx
index 01ec3c9..fad7638 100644
--- a/xsde/cxx/hybrid/aggregate-include.hxx
+++ b/xsde/cxx/hybrid/aggregate-include.hxx
@@ -152,6 +152,7 @@ namespace CXX
schemas_.insert (s);
SemanticGraph::Path path (s->used_begin ()->path ());
+ path.normalize ();
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
@@ -159,11 +160,11 @@ namespace CXX
NarrowString path_str;
try
{
- path_str = path.string ();
+ path_str = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- path_str = path.native_file_string ();
+ path_str = path.string ();
}
String inc_path (hxx_expr->replace (path_str));
diff --git a/xsde/cxx/hybrid/elements.cxx b/xsde/cxx/hybrid/elements.cxx
index fe1e533..0f49311 100644
--- a/xsde/cxx/hybrid/elements.cxx
+++ b/xsde/cxx/hybrid/elements.cxx
@@ -592,6 +592,7 @@ namespace CXX
s.context ().count ("renamed")
? s.context ().get<SemanticGraph::Path> ("renamed")
: u.path ());
+ path.normalize ();
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
@@ -599,11 +600,11 @@ namespace CXX
NarrowString path_str;
try
{
- path_str = path.string ();
+ path_str = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- path_str = path.native_file_string ();
+ path_str = path.string ();
}
String inc_path;
diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx
index eac7cf0..e2e0f71 100644
--- a/xsde/cxx/hybrid/generator.cxx
+++ b/xsde/cxx/hybrid/generator.cxx
@@ -3,10 +3,10 @@
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <sstream>
+#include <algorithm>
#include <iostream>
-
-#include <boost/filesystem/fstream.hpp>
+#include <sstream>
+#include <fstream>
#include <cutl/re.hxx>
@@ -56,17 +56,9 @@ using namespace XSDFrontend::SemanticGraph;
//
//
-typedef
-boost::filesystem::wifstream
-WideInputFileStream;
-
-typedef
-boost::filesystem::wofstream
-WideOutputFileStream;
-
-typedef
-boost::filesystem::ifstream
-NarrowInputFileStream;
+typedef std::wifstream WideInputFileStream;
+typedef std::wofstream WideOutputFileStream;
+typedef std::ifstream NarrowInputFileStream;
namespace CXX
{
@@ -434,8 +426,9 @@ namespace CXX
{
try
{
- Path fs_path (path, boost::filesystem::native);
- ifs.open (fs_path, std::ios_base::in | std::ios_base::binary);
+ Path fs_path (path);
+ ifs.open (fs_path.string ().c_str (),
+ std::ios_base::in | std::ios_base::binary);
if (!ifs.is_open ())
{
@@ -569,7 +562,7 @@ namespace CXX
{
if (NarrowString name = ops.extern_xml_schema ())
{
- if (file_path.native_file_string () != name)
+ if (file_path.string () != name)
generate_xml_schema = false;
}
}
@@ -595,7 +588,7 @@ namespace CXX
bool forward (ops.generate_forward () && !generate_xml_schema);
bool source (!generate_xml_schema);
- NarrowString name (file_path.leaf ());
+ NarrowString name (file_path.leaf ().string ());
NarrowString hxx_suffix (ops.hxx_suffix ());
NarrowString ixx_suffix (ops.ixx_suffix ());
@@ -663,10 +656,10 @@ namespace CXX
NarrowString cxx_name (source ? cxx_expr.replace (name) : NarrowString ());
NarrowString fwd_name (forward ? fwd_expr.replace (name) : NarrowString ());
- Path hxx_path (hxx_name, boost::filesystem::native);
- Path ixx_path (ixx_name, boost::filesystem::native);
- Path cxx_path (cxx_name, boost::filesystem::native);
- Path fwd_path (fwd_name, boost::filesystem::native);
+ Path hxx_path (hxx_name);
+ Path ixx_path (ixx_name);
+ Path cxx_path (cxx_name);
+ Path fwd_path (fwd_name);
Path out_dir;
@@ -674,7 +667,7 @@ namespace CXX
{
try
{
- out_dir = Path (dir, boost::filesystem::native);
+ out_dir = Path (dir);
}
catch (InvalidPath const&)
{
@@ -689,7 +682,7 @@ namespace CXX
// unless the user added the directory so that we propagate this
// to the output files.
//
- Path fpt_dir (file_path.branch_path ());
+ Path fpt_dir (file_path.directory ());
if (!fpt_dir.empty ())
out_dir /= fpt_dir;
@@ -705,7 +698,7 @@ namespace CXX
// Open the tree files.
//
- WideOutputFileStream hxx (hxx_path, ios_base::out);
+ WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
WideOutputFileStream ixx;
WideOutputFileStream cxx;
WideOutputFileStream fwd;
@@ -714,7 +707,7 @@ namespace CXX
//
if (forward)
{
- fwd.open (fwd_path, ios_base::out);
+ fwd.open (fwd_path.string ().c_str (), ios_base::out);
if (!fwd.is_open ())
{
@@ -723,7 +716,7 @@ namespace CXX
}
unlinks.add (fwd_path);
- file_list.push_back (fwd_path.native_file_string ());
+ file_list.push_back (fwd_path.string ());
}
if (!hxx.is_open ())
@@ -733,11 +726,11 @@ namespace CXX
}
unlinks.add (hxx_path);
- file_list.push_back (hxx_path.native_file_string ());
+ file_list.push_back (hxx_path.string ());
if (inline_)
{
- ixx.open (ixx_path, ios_base::out);
+ ixx.open (ixx_path.string ().c_str (), ios_base::out);
if (!ixx.is_open ())
{
@@ -746,12 +739,12 @@ namespace CXX
}
unlinks.add (ixx_path);
- file_list.push_back (ixx_path.native_file_string ());
+ file_list.push_back (ixx_path.string ());
}
if (source)
{
- cxx.open (cxx_path, ios_base::out);
+ cxx.open (cxx_path.string ().c_str (), ios_base::out);
if (!cxx.is_open ())
{
@@ -760,7 +753,7 @@ namespace CXX
}
unlinks.add (cxx_path);
- file_list.push_back (cxx_path.native_file_string ());
+ file_list.push_back (cxx_path.string ());
}
// Print copyright and license.
@@ -811,7 +804,7 @@ namespace CXX
NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
- guard_prefix = file_path.branch_path ().native_directory_string ();
+ guard_prefix = file_path.directory ().string ();
if (guard_prefix)
guard_prefix += '_';
@@ -1310,7 +1303,7 @@ namespace CXX
{
if (NarrowString name = ops.extern_xml_schema ())
{
- if (file_path.native_file_string () != name)
+ if (file_path.string () != name)
gen_xml_schema = false;
}
}
@@ -1328,7 +1321,7 @@ namespace CXX
throw Failed ();
}
- NarrowString name (file_path.leaf ());
+ NarrowString name (file_path.leaf ().string ());
NarrowString skel_suffix (ops.pskel_file_suffix ());
NarrowString impl_suffix (ops.pimpl_file_suffix ());
@@ -1387,8 +1380,8 @@ namespace CXX
NarrowString hxx_name (hxx_expr.replace (name));
NarrowString cxx_name (cxx_expr.replace (name));
- Path hxx_path (hxx_name, boost::filesystem::native);
- Path cxx_path (cxx_name, boost::filesystem::native);
+ Path hxx_path (hxx_name);
+ Path cxx_path (cxx_name);
Path out_dir;
@@ -1396,7 +1389,7 @@ namespace CXX
{
try
{
- out_dir = Path (dir, boost::filesystem::native);
+ out_dir = Path (dir);
}
catch (InvalidPath const&)
{
@@ -1411,7 +1404,7 @@ namespace CXX
// unless the user added the directory so that we propagate this
// to the output files.
//
- Path fpt_dir (file_path.branch_path ());
+ Path fpt_dir (file_path.directory ());
if (!fpt_dir.empty ())
out_dir /= fpt_dir;
@@ -1423,8 +1416,8 @@ namespace CXX
cxx_path = out_dir / cxx_path;
}
- WideOutputFileStream hxx (hxx_path, ios_base::out);
- WideOutputFileStream cxx (cxx_path, ios_base::out);
+ WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
+ WideOutputFileStream cxx (cxx_path.string ().c_str (), ios_base::out);
if (!hxx.is_open ())
{
@@ -1433,7 +1426,7 @@ namespace CXX
}
unlinks.add (hxx_path);
- file_list.push_back (hxx_path.native_file_string ());
+ file_list.push_back (hxx_path.string ());
if (!cxx.is_open ())
{
@@ -1442,7 +1435,7 @@ namespace CXX
}
unlinks.add (cxx_path);
- file_list.push_back (cxx_path.native_file_string ());
+ file_list.push_back (cxx_path.string ());
// Print copyright and license.
//
@@ -1484,7 +1477,7 @@ namespace CXX
NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
- guard_prefix = file_path.branch_path ().native_directory_string ();
+ guard_prefix = file_path.directory ().string ();
if (guard_prefix)
guard_prefix += '_';
@@ -1696,7 +1689,7 @@ namespace CXX
{
if (NarrowString name = ops.extern_xml_schema ())
{
- if (file_path.native_file_string () != name)
+ if (file_path.string () != name)
gen_xml_schema = false;
}
}
@@ -1714,7 +1707,7 @@ namespace CXX
throw Failed ();
}
- NarrowString name (file_path.leaf ());
+ NarrowString name (file_path.leaf ().string ());
NarrowString skel_suffix (ops.sskel_file_suffix ());
NarrowString impl_suffix (ops.simpl_file_suffix ());
@@ -1773,8 +1766,8 @@ namespace CXX
NarrowString hxx_name (hxx_expr.replace (name));
NarrowString cxx_name (cxx_expr.replace (name));
- Path hxx_path (hxx_name, boost::filesystem::native);
- Path cxx_path (cxx_name, boost::filesystem::native);
+ Path hxx_path (hxx_name);
+ Path cxx_path (cxx_name);
Path out_dir;
@@ -1782,7 +1775,7 @@ namespace CXX
{
try
{
- out_dir = Path (dir, boost::filesystem::native);
+ out_dir = Path (dir);
}
catch (InvalidPath const&)
{
@@ -1797,7 +1790,7 @@ namespace CXX
// unless the user added the directory so that we propagate this
// to the output files.
//
- Path fpt_dir (file_path.branch_path ());
+ Path fpt_dir (file_path.directory ());
if (!fpt_dir.empty ())
out_dir /= fpt_dir;
@@ -1809,8 +1802,8 @@ namespace CXX
cxx_path = out_dir / cxx_path;
}
- WideOutputFileStream hxx (hxx_path, ios_base::out);
- WideOutputFileStream cxx (cxx_path, ios_base::out);
+ WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
+ WideOutputFileStream cxx (cxx_path.string ().c_str (), ios_base::out);
if (!hxx.is_open ())
{
@@ -1819,7 +1812,7 @@ namespace CXX
}
unlinks.add (hxx_path);
- file_list.push_back (hxx_path.native_file_string ());
+ file_list.push_back (hxx_path.string ());
if (!cxx.is_open ())
{
@@ -1828,7 +1821,7 @@ namespace CXX
}
unlinks.add (cxx_path);
- file_list.push_back (cxx_path.native_file_string ());
+ file_list.push_back (cxx_path.string ());
// Print copyright and license.
//
@@ -1870,7 +1863,7 @@ namespace CXX
NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
- guard_prefix = file_path.branch_path ().native_directory_string ();
+ guard_prefix = file_path.directory ().string ();
if (guard_prefix)
guard_prefix += '_';
diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx
index 46518fa..05bcae0 100644
--- a/xsde/cxx/parser/elements.cxx
+++ b/xsde/cxx/parser/elements.cxx
@@ -267,6 +267,7 @@ namespace CXX
s.context ().count ("renamed")
? s.context ().get<SemanticGraph::Path> ("renamed")
: u.path ());
+ path.normalize ();
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
@@ -274,11 +275,11 @@ namespace CXX
NarrowString path_str;
try
{
- path_str = path.string ();
+ path_str = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- path_str = path.native_file_string ();
+ path_str = path.string ();
}
String inc_path;
diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx
index f78291e..45873ef 100644
--- a/xsde/cxx/parser/generator.cxx
+++ b/xsde/cxx/parser/generator.cxx
@@ -3,9 +3,9 @@
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <algorithm>
#include <iostream>
-
-#include <boost/filesystem/fstream.hpp>
+#include <fstream>
#include <cutl/re.hxx>
@@ -51,17 +51,9 @@ using namespace XSDFrontend::SemanticGraph;
//
//
-typedef
-boost::filesystem::wifstream
-WideInputFileStream;
-
-typedef
-boost::filesystem::wofstream
-WideOutputFileStream;
-
-typedef
-boost::filesystem::ifstream
-NarrowInputFileStream;
+typedef std::wifstream WideInputFileStream;
+typedef std::wofstream WideOutputFileStream;
+typedef std::ifstream NarrowInputFileStream;
namespace CXX
{
@@ -131,8 +123,9 @@ namespace CXX
{
try
{
- Path fs_path (path, boost::filesystem::native);
- ifs.open (fs_path, std::ios_base::in | std::ios_base::binary);
+ Path fs_path (path);
+ ifs.open (fs_path.string ().c_str (),
+ std::ios_base::in | std::ios_base::binary);
if (!ifs.is_open ())
{
@@ -215,7 +208,7 @@ namespace CXX
{
if (NarrowString name = ops.extern_xml_schema ())
{
- if (file_path.native_file_string () != name)
+ if (file_path.string () != name)
generate_xml_schema = false;
}
}
@@ -409,7 +402,7 @@ namespace CXX
bool inline_ (ops.generate_inline () && !generate_xml_schema);
bool source (!generate_xml_schema);
- NarrowString name (file_path.leaf ());
+ NarrowString name (file_path.leaf ().string ());
NarrowString skel_suffix (ops.skel_file_suffix ());
NarrowString impl_suffix (ops.impl_file_suffix ());
@@ -514,9 +507,9 @@ namespace CXX
cxx_driver_name = cxx_driver_expr.replace (name);
}
- Path hxx_path (hxx_name, boost::filesystem::native);
- Path ixx_path (ixx_name, boost::filesystem::native);
- Path cxx_path (cxx_name, boost::filesystem::native);
+ Path hxx_path (hxx_name);
+ Path ixx_path (ixx_name);
+ Path cxx_path (cxx_name);
Path hxx_impl_path;
Path cxx_impl_path;
@@ -524,9 +517,9 @@ namespace CXX
if (impl || driver)
{
- hxx_impl_path = Path (hxx_impl_name, boost::filesystem::native);
- cxx_impl_path = Path (cxx_impl_name, boost::filesystem::native);
- cxx_driver_path = Path (cxx_driver_name, boost::filesystem::native);
+ hxx_impl_path = Path (hxx_impl_name);
+ cxx_impl_path = Path (cxx_impl_name);
+ cxx_driver_path = Path (cxx_driver_name);
}
Path out_dir;
@@ -535,7 +528,7 @@ namespace CXX
{
try
{
- out_dir = Path (dir, boost::filesystem::native);
+ out_dir = Path (dir);
}
catch (InvalidPath const&)
{
@@ -550,7 +543,7 @@ namespace CXX
// unless the user added the directory so that we propagate this
// to the output files.
//
- Path fpt_dir (file_path.branch_path ());
+ Path fpt_dir (file_path.directory ());
if (!fpt_dir.empty ())
out_dir /= fpt_dir;
@@ -581,7 +574,8 @@ namespace CXX
{
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (hxx_impl_path, ios_base::in);
+ WideInputFileStream tmp (
+ hxx_impl_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -593,7 +587,7 @@ namespace CXX
tmp.close ();
}
- hxx_impl.open (hxx_impl_path, ios_base::out);
+ hxx_impl.open (hxx_impl_path.string ().c_str (), ios_base::out);
if (!hxx_impl.is_open ())
{
@@ -603,11 +597,12 @@ namespace CXX
}
unlinks.add (hxx_impl_path);
- file_list.push_back (hxx_impl_path.native_file_string ());
+ file_list.push_back (hxx_impl_path.string ());
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (cxx_impl_path, ios_base::in);
+ WideInputFileStream tmp (
+ cxx_impl_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -619,7 +614,7 @@ namespace CXX
tmp.close ();
}
- cxx_impl.open (cxx_impl_path, ios_base::out);
+ cxx_impl.open (cxx_impl_path.string ().c_str (), ios_base::out);
if (!cxx_impl.is_open ())
{
@@ -629,14 +624,15 @@ namespace CXX
}
unlinks.add (cxx_impl_path);
- file_list.push_back (cxx_impl_path.native_file_string ());
+ file_list.push_back (cxx_impl_path.string ());
}
if (driver)
{
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (cxx_driver_path, ios_base::in);
+ WideInputFileStream tmp (
+ cxx_driver_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -648,7 +644,7 @@ namespace CXX
tmp.close ();
}
- cxx_driver.open (cxx_driver_path, ios_base::out);
+ cxx_driver.open (cxx_driver_path.string ().c_str (), ios_base::out);
if (!cxx_driver.is_open ())
{
@@ -658,12 +654,12 @@ namespace CXX
}
unlinks.add (cxx_driver_path);
- file_list.push_back (cxx_driver_path.native_file_string ());
+ file_list.push_back (cxx_driver_path.string ());
}
// Open the skel files.
//
- WideOutputFileStream hxx (hxx_path, ios_base::out);
+ WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
WideOutputFileStream ixx;
WideOutputFileStream cxx;
@@ -674,11 +670,11 @@ namespace CXX
}
unlinks.add (hxx_path);
- file_list.push_back (hxx_path.native_file_string ());
+ file_list.push_back (hxx_path.string ());
if (inline_)
{
- ixx.open (ixx_path, ios_base::out);
+ ixx.open (ixx_path.string ().c_str (), ios_base::out);
if (!ixx.is_open ())
{
@@ -687,12 +683,12 @@ namespace CXX
}
unlinks.add (ixx_path);
- file_list.push_back (ixx_path.native_file_string ());
+ file_list.push_back (ixx_path.string ());
}
if (source)
{
- cxx.open (cxx_path, ios_base::out);
+ cxx.open (cxx_path.string ().c_str (), ios_base::out);
if (!cxx.is_open ())
{
@@ -701,7 +697,7 @@ namespace CXX
}
unlinks.add (cxx_path);
- file_list.push_back (cxx_path.native_file_string ());
+ file_list.push_back (cxx_path.string ());
}
// Print copyright and license.
@@ -766,7 +762,7 @@ namespace CXX
NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
- guard_prefix = file_path.branch_path ().native_directory_string ();
+ guard_prefix = file_path.directory ().string ();
if (guard_prefix)
guard_prefix += '_';
diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx
index 061a1ae..f021c54 100644
--- a/xsde/cxx/serializer/elements.cxx
+++ b/xsde/cxx/serializer/elements.cxx
@@ -290,6 +290,7 @@ namespace CXX
s.context ().count ("renamed")
? s.context ().get<SemanticGraph::Path> ("renamed")
: u.path ());
+ path.normalize ();
// Try to use the portable representation of the path. If that
// fails, fall back to the native representation.
@@ -297,11 +298,11 @@ namespace CXX
NarrowString path_str;
try
{
- path_str = path.string ();
+ path_str = path.posix_string ();
}
catch (SemanticGraph::InvalidPath const&)
{
- path_str = path.native_file_string ();
+ path_str = path.string ();
}
String inc_path;
diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx
index 1b1a468..94dcaec 100644
--- a/xsde/cxx/serializer/generator.cxx
+++ b/xsde/cxx/serializer/generator.cxx
@@ -3,9 +3,9 @@
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+#include <algorithm>
#include <iostream>
-
-#include <boost/filesystem/fstream.hpp>
+#include <fstream>
#include <cutl/re.hxx>
@@ -49,17 +49,9 @@ using namespace XSDFrontend::SemanticGraph;
//
//
-typedef
-boost::filesystem::wifstream
-WideInputFileStream;
-
-typedef
-boost::filesystem::wofstream
-WideOutputFileStream;
-
-typedef
-boost::filesystem::ifstream
-NarrowInputFileStream;
+typedef std::wifstream WideInputFileStream;
+typedef std::wofstream WideOutputFileStream;
+typedef std::ifstream NarrowInputFileStream;
namespace CXX
{
@@ -129,8 +121,9 @@ namespace CXX
{
try
{
- Path fs_path (path, boost::filesystem::native);
- ifs.open (fs_path, std::ios_base::in | std::ios_base::binary);
+ Path fs_path (path);
+ ifs.open (fs_path.string ().c_str (),
+ std::ios_base::in | std::ios_base::binary);
if (!ifs.is_open ())
{
@@ -213,7 +206,7 @@ namespace CXX
{
if (NarrowString name = ops.extern_xml_schema ())
{
- if (file_path.native_file_string () != name)
+ if (file_path.string () != name)
generate_xml_schema = false;
}
}
@@ -397,7 +390,7 @@ namespace CXX
bool inline_ (ops.generate_inline () && !generate_xml_schema);
bool source (!generate_xml_schema);
- NarrowString name (file_path.leaf ());
+ NarrowString name (file_path.leaf ().string ());
NarrowString skel_suffix (ops.skel_file_suffix ());
NarrowString impl_suffix (ops.impl_file_suffix ());
@@ -503,9 +496,9 @@ namespace CXX
cxx_driver_name = cxx_driver_expr.replace (name);
}
- Path hxx_path (hxx_name, boost::filesystem::native);
- Path ixx_path (ixx_name, boost::filesystem::native);
- Path cxx_path (cxx_name, boost::filesystem::native);
+ Path hxx_path (hxx_name);
+ Path ixx_path (ixx_name);
+ Path cxx_path (cxx_name);
Path hxx_impl_path;
Path cxx_impl_path;
@@ -513,9 +506,9 @@ namespace CXX
if (impl || driver)
{
- hxx_impl_path = Path (hxx_impl_name, boost::filesystem::native);
- cxx_impl_path = Path (cxx_impl_name, boost::filesystem::native);
- cxx_driver_path = Path (cxx_driver_name, boost::filesystem::native);
+ hxx_impl_path = Path (hxx_impl_name);
+ cxx_impl_path = Path (cxx_impl_name);
+ cxx_driver_path = Path (cxx_driver_name);
}
Path out_dir;
@@ -524,7 +517,7 @@ namespace CXX
{
try
{
- out_dir = Path (dir, boost::filesystem::native);
+ out_dir = Path (dir);
}
catch (InvalidPath const&)
{
@@ -539,7 +532,7 @@ namespace CXX
// unless the user added the directory so that we propagate this
// to the output files.
//
- Path fpt_dir (file_path.branch_path ());
+ Path fpt_dir (file_path.directory ());
if (!fpt_dir.empty ())
out_dir /= fpt_dir;
@@ -570,7 +563,8 @@ namespace CXX
{
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (hxx_impl_path, ios_base::in);
+ WideInputFileStream tmp (
+ hxx_impl_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -582,7 +576,7 @@ namespace CXX
tmp.close ();
}
- hxx_impl.open (hxx_impl_path, ios_base::out);
+ hxx_impl.open (hxx_impl_path.string ().c_str (), ios_base::out);
if (!hxx_impl.is_open ())
{
@@ -592,11 +586,12 @@ namespace CXX
}
unlinks.add (hxx_impl_path);
- file_list.push_back (hxx_impl_path.native_file_string ());
+ file_list.push_back (hxx_impl_path.string ());
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (cxx_impl_path, ios_base::in);
+ WideInputFileStream tmp (
+ cxx_impl_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -608,7 +603,7 @@ namespace CXX
tmp.close ();
}
- cxx_impl.open (cxx_impl_path, ios_base::out);
+ cxx_impl.open (cxx_impl_path.string ().c_str (), ios_base::out);
if (!cxx_impl.is_open ())
{
@@ -618,14 +613,15 @@ namespace CXX
}
unlinks.add (cxx_impl_path);
- file_list.push_back (cxx_impl_path.native_file_string ());
+ file_list.push_back (cxx_impl_path.string ());
}
if (driver)
{
if (!ops.force_overwrite ())
{
- WideInputFileStream tmp (cxx_driver_path, ios_base::in);
+ WideInputFileStream tmp (
+ cxx_driver_path.string ().c_str (), ios_base::in);
if (tmp.is_open ())
{
@@ -637,7 +633,7 @@ namespace CXX
tmp.close ();
}
- cxx_driver.open (cxx_driver_path, ios_base::out);
+ cxx_driver.open (cxx_driver_path.string ().c_str (), ios_base::out);
if (!cxx_driver.is_open ())
{
@@ -647,12 +643,12 @@ namespace CXX
}
unlinks.add (cxx_driver_path);
- file_list.push_back (cxx_driver_path.native_file_string ());
+ file_list.push_back (cxx_driver_path.string ());
}
// Open the skel files.
//
- WideOutputFileStream hxx (hxx_path, ios_base::out);
+ WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
WideOutputFileStream ixx;
WideOutputFileStream cxx;
@@ -663,11 +659,11 @@ namespace CXX
}
unlinks.add (hxx_path);
- file_list.push_back (hxx_path.native_file_string ());
+ file_list.push_back (hxx_path.string ());
if (inline_)
{
- ixx.open (ixx_path, ios_base::out);
+ ixx.open (ixx_path.string ().c_str (), ios_base::out);
if (!ixx.is_open ())
{
@@ -676,12 +672,12 @@ namespace CXX
}
unlinks.add (ixx_path);
- file_list.push_back (ixx_path.native_file_string ());
+ file_list.push_back (ixx_path.string ());
}
if (source)
{
- cxx.open (cxx_path, ios_base::out);
+ cxx.open (cxx_path.string ().c_str (), ios_base::out);
if (!cxx.is_open ())
{
@@ -690,7 +686,7 @@ namespace CXX
}
unlinks.add (cxx_path);
- file_list.push_back (cxx_path.native_file_string ());
+ file_list.push_back (cxx_path.string ());
}
// Print copyright and license.
@@ -755,7 +751,7 @@ namespace CXX
NarrowString guard_prefix (ops.guard_prefix ());
if (!guard_prefix)
- guard_prefix = file_path.branch_path ().native_directory_string ();
+ guard_prefix = file_path.directory ().string ();
if (guard_prefix)
guard_prefix += '_';
diff --git a/xsde/makefile b/xsde/makefile
index 358ddfd..d93fcd3 100644
--- a/xsde/makefile
+++ b/xsde/makefile
@@ -114,22 +114,17 @@ $(call import,\
l: cutl.l,cpp-options: cutl.l.cpp-options)
$(call import,\
- $(scf_root)/import/libboost/filesystem/stub.make,\
- l: fs.l,cpp-options: fs.l.cpp-options)
-
-$(call import,\
$(scf_root)/import/libxsd-frontend/stub.make,\
l: xsd_fe.l,cpp-options: xsd_fe.l.cpp-options)
# Build.
#
-$(xsde): $(cxx_obj) $(xsd_fe.l) $(cutl.l) $(fs.l)
+$(xsde): $(cxx_obj) $(xsd_fe.l) $(cutl.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(src_base)
$(cxx_obj) $(cxx_od): \
$(xsd_fe.l.cpp-options) \
- $(cutl.l.cpp-options) \
- $(fs.l.cpp-options)
+ $(cutl.l.cpp-options)
genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
diff --git a/xsde/xsde.cxx b/xsde/xsde.cxx
index 566ce61..e4637dd 100644
--- a/xsde/xsde.cxx
+++ b/xsde/xsde.cxx
@@ -9,8 +9,7 @@
#include <memory> // std::auto_ptr
#include <cstddef> // std::size_t
#include <iostream>
-
-#include <boost/filesystem/fstream.hpp>
+#include <fstream>
#include <cutl/re.hxx>
@@ -424,7 +423,7 @@ main (int argc, char* argv[])
try
{
- tu = SemanticGraph::Path (files[i], boost::filesystem::native);
+ tu = SemanticGraph::Path (files[i]);
}
catch (SemanticGraph::InvalidPath const&)
{
@@ -446,7 +445,7 @@ main (int argc, char* argv[])
{
if (xml_schema_file = common_ops.extern_xml_schema ())
{
- if (tu.native_file_string () != xml_schema_file)
+ if (tu.string () != xml_schema_file)
gen_xml_schema = false;
}
}
@@ -468,8 +467,7 @@ main (int argc, char* argv[])
for (; ai < files.size (); ++ai)
{
if (ai != i && files[ai] != xml_schema_file)
- paths.push_back (
- SemanticGraph::Path (files[ai], boost::filesystem::native));
+ paths.push_back (SemanticGraph::Path (files[ai]));
}
}
catch (SemanticGraph::InvalidPath const&)
@@ -489,8 +487,7 @@ main (int argc, char* argv[])
{
for (; i != extra_files.end (); ++i)
{
- paths.push_back (
- SemanticGraph::Path (*i, boost::filesystem::native));
+ paths.push_back (SemanticGraph::Path (*i));
}
}
catch (SemanticGraph::InvalidPath const&)
@@ -523,7 +520,7 @@ main (int argc, char* argv[])
Transformations::Anonymous trans (anon_translator);
if (multi)
- trans.transform (*schema, "", true);
+ trans.transform (*schema, SemanticGraph::Path (), true);
else
trans.transform (*schema, tu, true);
}
@@ -547,7 +544,7 @@ main (int argc, char* argv[])
Transformations::Simplifier trans;
if (multi)
- trans.transform (*schema, "");
+ trans.transform (*schema, SemanticGraph::Path ());
else
trans.transform (*schema, tu);
}
@@ -560,7 +557,7 @@ main (int argc, char* argv[])
{
if (multi)
CXX::Hybrid::Generator::calculate_size (
- *h_ops, *schema, "", disabled_w);
+ *h_ops, *schema, SemanticGraph::Path (), disabled_w);
else
CXX::Hybrid::Generator::calculate_size (
*h_ops, *schema, tu, disabled_w);
@@ -579,7 +576,9 @@ main (int argc, char* argv[])
Processing::Inheritance::Processor proc;
if (multi)
- proc.process (*schema, "", gen_hybrid ? "fixed" : 0);
+ proc.process (*schema,
+ SemanticGraph::Path (),
+ gen_hybrid ? "fixed" : 0);
else
proc.process (*schema, tu, gen_hybrid ? "fixed" : 0);
}
@@ -597,7 +596,7 @@ main (int argc, char* argv[])
Transformations::Restriction trans;
if (multi)
- trans.transform (*schema, "");
+ trans.transform (*schema, SemanticGraph::Path ());
else
trans.transform (*schema, tu);
}
@@ -810,8 +809,7 @@ main (int argc, char* argv[])
{
try
{
- paths.push_back (
- SemanticGraph::Path (files[i], boost::filesystem::native));
+ paths.push_back (SemanticGraph::Path (files[i]));
}
catch (SemanticGraph::InvalidPath const&)
{
@@ -846,7 +844,7 @@ main (int argc, char* argv[])
try
{
Transformations::Anonymous trans (anon_translator);
- trans.transform (*schema, "", false);
+ trans.transform (*schema, SemanticGraph::Path (), false);
}
catch (Transformations::Anonymous::Failed const&)
{
@@ -859,14 +857,14 @@ main (int argc, char* argv[])
if (gen_hybrid)
{
Transformations::EnumSynthesis trans;
- trans.transform (*schema, "");
+ trans.transform (*schema, SemanticGraph::Path ());
}
// Simplify the schema graph.
//
{
Transformations::Simplifier trans;
- trans.transform (*schema, "");
+ trans.transform (*schema, SemanticGraph::Path ());
}
// Calculate type sizes.
@@ -876,7 +874,7 @@ main (int argc, char* argv[])
try
{
CXX::Hybrid::Generator::calculate_size (
- *h_ops, *schema, "", disabled_w);
+ *h_ops, *schema, SemanticGraph::Path (), disabled_w);
}
catch (CXX::Hybrid::Generator::Failed const&)
{
@@ -891,7 +889,7 @@ main (int argc, char* argv[])
try
{
Transformations::Restriction trans;
- trans.transform (*schema, "");
+ trans.transform (*schema, SemanticGraph::Path ());
}
catch (Transformations::Restriction::Failed const&)
{
@@ -1063,14 +1061,14 @@ main (int argc, char* argv[])
//
if (NarrowString fl = common_ops.file_list ())
{
- typedef boost::filesystem::ofstream OutputFileStream;
+ typedef std::ofstream OutputFileStream;
try
{
OutputFileStream ofs;
SemanticGraph::Path path (fl);
- ofs.open (fl, ios_base::out);
+ ofs.open (path.string ().c_str (), ios_base::out);
if (!ofs.is_open ())
{
@@ -1272,7 +1270,7 @@ AnonymousNameTranslator (NarrowStrings const& regex, bool trace)
catch (RegexFormat const& e)
{
wcerr << "error: invalid anonymous type regex: '" <<
- e.regex () << "': " << e.description () << endl;
+ e.regex () << "': " << e.description ().c_str () << endl;
throw Failed ();
}
@@ -1335,7 +1333,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex,
catch (TypeRegexFormat const& e)
{
wcerr << "error: invalid type file regex: '" <<
- e.regex () << "': " << e.description () << endl;
+ e.regex () << "': " << e.description ().c_str () << endl;
throw Failed ();
}
diff --git a/xsde/xsde.hxx b/xsde/xsde.hxx
index 41b0cba..7ceb3f8 100644
--- a/xsde/xsde.hxx
+++ b/xsde/xsde.hxx
@@ -11,6 +11,7 @@
#include <cstdio> // std::remove
#include <cutl/shared-ptr.hxx>
+#include <cutl/fs/auto-remove.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx> // Path
@@ -19,54 +20,7 @@
typedef std::set<NarrowString> WarningSet;
typedef std::vector<NarrowString> FileList;
-//
-//
-struct AutoUnlink
-{
- AutoUnlink (XSDFrontend::SemanticGraph::Path const& file)
- : file_ (file), canceled_ (false)
- {
- }
-
- ~AutoUnlink ()
- {
- if (!canceled_)
- std::remove (file_.native_file_string ().c_str ());
- }
-
- void
- cancel ()
- {
- canceled_ = true;
- }
-
-private:
- XSDFrontend::SemanticGraph::Path file_;
- bool canceled_;
-};
-
-//
-//
-struct AutoUnlinks
-{
- void
- add (XSDFrontend::SemanticGraph::Path const& file)
- {
- unlinks_.push_back(
- cutl::shared_ptr<AutoUnlink> (
- new (shared) AutoUnlink (file)));
- }
-
- void
- cancel ()
- {
- for (Unlinks::iterator i (unlinks_.begin ()); i != unlinks_.end (); ++i)
- (*i)->cancel ();
- }
-
-private:
- typedef std::vector<cutl::shared_ptr<AutoUnlink> > Unlinks;
- Unlinks unlinks_;
-};
+typedef cutl::fs::auto_remove AutoUnlink;
+typedef cutl::fs::auto_removes AutoUnlinks;
#endif // XSDE_HXX