From 13814591f7b9e328094859e183a5f626eb38dde7 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 29 Jan 2019 23:47:28 +0100
Subject: [PATCH] prepare stringApi for unregistration

---
 alib2str/src/core/stringApi.hpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/alib2str/src/core/stringApi.hpp b/alib2str/src/core/stringApi.hpp
index b47b0c4abb..6e6113a8f3 100644
--- a/alib2str/src/core/stringApi.hpp
+++ b/alib2str/src/core/stringApi.hpp
@@ -75,8 +75,19 @@ private:
 
 public:
 	template < class Type >
-	static void registerStringReader ( ) {
-		parseFunctions ( ).push_back ( std::make_pair ( stringApi < Type >::first, std::unique_ptr < GroupReader > ( new ReaderRegister < Type > ( ) ) ) );
+	static void unregisterStringReader ( ext::list < std::pair < std::function < bool ( std::istream & ) >, std::unique_ptr < GroupReader > > >::const_iterator iter ) {
+		parseFunctions ( ).erase ( iter );
+	}
+
+	template < class Type >
+	static ext::list < std::pair < std::function < bool ( std::istream & ) >, std::unique_ptr < GroupReader > > >::const_iterator registerStringReader ( ) {
+		auto & entries = parseFunctions ( );
+		return entries.insert ( entries.end ( ), std::make_pair ( stringApi < Type >::first, std::unique_ptr < GroupReader > ( new ReaderRegister < Type > ( ) ) ) );
+	}
+
+	template < class Type >
+	static void unregisterStringWriter ( ) {
+		composeFunctions ( ).erase ( ext::to_string < object::AnyObject < Type > > ( ) );
 	}
 
 	template < class Type >
-- 
GitLab