// file : xsd/xsd.hxx // author : Boris Kolpackov // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_HXX #define XSD_HXX #include #include #include // std::remove #include #include // Path #include typedef std::set WarningSet; typedef std::vector 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 ( new (shared) AutoUnlink (file))); } void cancel () { for (Unlinks::iterator i (unlinks_.begin ()); i != unlinks_.end (); ++i) (*i)->cancel (); } private: typedef std::vector > Unlinks; Unlinks unlinks_; }; #endif // XSD_HXX