diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-30 19:54:24 -0400 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-30 19:54:24 -0400 |
commit | 6f5e742482eadf055c18bdbe4082450d3161edef (patch) | |
tree | 80f3f5329524599b4c84aecc042ce4c76974c15c /xsd/xsd.hxx | |
parent | 3bf281f54bcf2ee6c2c54f727c3c6c5e6100c8d4 (diff) |
Get rid of dependency on Boost filesystem
Diffstat (limited to 'xsd/xsd.hxx')
-rw-r--r-- | xsd/xsd.hxx | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/xsd/xsd.hxx b/xsd/xsd.hxx index 43f38ea..83bfdfd 100644 --- a/xsd/xsd.hxx +++ b/xsd/xsd.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 // XSD_HXX |