From 0fdf19714613a82a184f4f6e75fb9a4f9b62f18a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 19 Jan 2014 10:05:08 +0200 Subject: Use std::unique_ptr instead of std::auto_ptr in C++11 mode --- xsd/cxx/tree/elements.hxx | 53 ++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'xsd/cxx/tree/elements.hxx') diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx index b7d6626..deb3a5e 100644 --- a/xsd/cxx/tree/elements.hxx +++ b/xsd/cxx/tree/elements.hxx @@ -1496,6 +1496,24 @@ namespace CXX Traversal::Names names_; }; + // Contructor argument types. + // + struct CtorArgType + { + enum Value + { + type, + complex_auto_ptr, + poly_auto_ptr + }; + + CtorArgType (Value v = Value (0)) : v_ (v) {} + operator Value () const {return v_;} + + private: + Value v_; + }; + // Immediate non-optional member. Note that AnyAttribute is always // mapped to a sequence. // @@ -1504,14 +1522,7 @@ namespace CXX Traversal::Attribute, Context { - enum ArgType - { - arg_type, - arg_complex_auto_ptr, - arg_poly_auto_ptr - }; - - FromBaseCtorArg (Context& c, ArgType, bool arg); + FromBaseCtorArg (Context& c, CtorArgType, bool arg); virtual void traverse (SemanticGraph::Any&); @@ -1523,7 +1534,7 @@ namespace CXX traverse (SemanticGraph::Element&); private: - ArgType arg_type_; + CtorArgType arg_type_; bool arg_; }; @@ -1538,18 +1549,11 @@ namespace CXX Traversal::Attribute, Context { - enum ArgType - { - arg_type, - arg_complex_auto_ptr, - arg_poly_auto_ptr - }; - // The second version outputs the argument name and stores // in in the base_arg string. // - CtorArgs (Context&, ArgType); - CtorArgs (Context&, ArgType, String& base_arg); + CtorArgs (Context&, CtorArgType); + CtorArgs (Context&, CtorArgType, String& base_arg); virtual void traverse (SemanticGraph::Type&); @@ -1571,7 +1575,7 @@ namespace CXX comma (); private: - ArgType arg_type_; + CtorArgType arg_type_; String base_; String* base_arg_; bool first_; @@ -1705,14 +1709,7 @@ namespace CXX Traversal::Attribute, Context { - enum ArgType - { - arg_type, - arg_complex_auto_ptr, - arg_poly_auto_ptr - }; - - CtorArgsWithoutBase (Context& c, ArgType, bool arg, bool first); + CtorArgsWithoutBase (Context& c, CtorArgType, bool arg, bool first); virtual void traverse (SemanticGraph::Any&); @@ -1728,7 +1725,7 @@ namespace CXX comma (); private: - ArgType arg_type_; + CtorArgType arg_type_; bool arg_; bool first_; -- cgit v1.1