diff options
Diffstat (limited to 'src/support/error')
| -rw-r--r-- | src/support/error/error_capacitor.cc | 4 | ||||
| -rw-r--r-- | src/support/error/error_capacitor.h | 7 | ||||
| -rw-r--r-- | src/support/error/warning_capacitor.cc | 10 | ||||
| -rw-r--r-- | src/support/error/warning_capacitor.h | 2 | 
4 files changed, 12 insertions, 11 deletions
| diff --git a/src/support/error/error_capacitor.cc b/src/support/error/error_capacitor.cc index cc7dd01..22ec45d 100644 --- a/src/support/error/error_capacitor.cc +++ b/src/support/error/error_capacitor.cc @@ -4,7 +4,7 @@ namespace InputXSLT {  ErrorCapacitor::ErrorCapacitor(ErrorMultiplexer* multiplexer):  	ErrorMultiplexer::receiver(multiplexer), -	error_cache_(new error_cache()) { } +	error_cache_(std::make_unique<error_cache>()) { }  void ErrorCapacitor::discharge() {  	if ( !this->error_cache_->empty() ) { @@ -21,7 +21,7 @@ void ErrorCapacitor::receive(  	}  } -ErrorCapacitor::exception::exception(error_cache_ptr ptr): +ErrorCapacitor::exception::exception(std::unique_ptr<error_cache> ptr):  	error_cache_(std::move(ptr)) { }  auto ErrorCapacitor::exception::operator*() const -> const error_cache& { diff --git a/src/support/error/error_capacitor.h b/src/support/error/error_capacitor.h index 1c225e9..03f155d 100644 --- a/src/support/error/error_capacitor.h +++ b/src/support/error/error_capacitor.h @@ -12,7 +12,6 @@ class ErrorCapacitor : public ErrorMultiplexer::receiver {  		class exception;  		typedef std::vector<std::string> error_cache; -		typedef std::unique_ptr<error_cache> error_cache_ptr;  		ErrorCapacitor(ErrorMultiplexer*); @@ -24,18 +23,18 @@ class ErrorCapacitor : public ErrorMultiplexer::receiver {  		);  	private: -		error_cache_ptr error_cache_; +		std::unique_ptr<error_cache> error_cache_;  };  class ErrorCapacitor::exception {  	public: -		exception(error_cache_ptr); +		exception(std::unique_ptr<error_cache>);  		const error_cache& operator*() const;  	private: -		error_cache_ptr error_cache_; +		std::unique_ptr<error_cache> error_cache_;  }; diff --git a/src/support/error/warning_capacitor.cc b/src/support/error/warning_capacitor.cc index f8d2b99..0d98977 100644 --- a/src/support/error/warning_capacitor.cc +++ b/src/support/error/warning_capacitor.cc @@ -4,14 +4,16 @@ namespace InputXSLT {  WarningCapacitor::WarningCapacitor(ErrorMultiplexer* multiplexer):  	ErrorMultiplexer::receiver(multiplexer), -	warning_cache_(new warning_cache()) { } +	warning_cache_(std::make_unique<warning_cache>()) { }  auto WarningCapacitor::discharge() -> warning_cache_ptr { -	warning_cache_ptr tmp(std::move(this->warning_cache_)); +	warning_cache_ptr tmp( +		std::make_unique<warning_cache>() +	); -	this->warning_cache_.reset(new warning_cache()); +	std::swap(tmp, this->warning_cache_); -	return std::move(tmp); +	return tmp;  }  void WarningCapacitor::receive( diff --git a/src/support/error/warning_capacitor.h b/src/support/error/warning_capacitor.h index 6b7058b..70f979b 100644 --- a/src/support/error/warning_capacitor.h +++ b/src/support/error/warning_capacitor.h @@ -9,7 +9,7 @@ namespace InputXSLT {  class WarningCapacitor : public ErrorMultiplexer::receiver {  	public: -		typedef std::vector<std::string> warning_cache; +		typedef std::vector<std::string>       warning_cache;  		typedef std::unique_ptr<warning_cache> warning_cache_ptr;  		WarningCapacitor(ErrorMultiplexer*); | 
