CertificateHandlerFactoryMgr.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // CertificateHandlerFactoryMgr.h
  3. //
  4. // Library: NetSSL_OpenSSL
  5. // Package: SSLCore
  6. // Module: CertificateHandlerFactoryMgr
  7. //
  8. // Definition of the CertificateHandlerFactoryMgr class.
  9. //
  10. // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef NetSSL_CertificateHandlerFactoryMgr_INCLUDED
  16. #define NetSSL_CertificateHandlerFactoryMgr_INCLUDED
  17. #include "Poco/Net/NetSSL.h"
  18. #include "Poco/Net/CertificateHandlerFactory.h"
  19. #include "Poco/SharedPtr.h"
  20. #include <map>
  21. namespace Poco {
  22. namespace Net {
  23. class NetSSL_API CertificateHandlerFactoryMgr
  24. /// A CertificateHandlerFactoryMgr manages all existing CertificateHandlerFactories.
  25. {
  26. public:
  27. typedef std::map<std::string, Poco::SharedPtr<CertificateHandlerFactory> > FactoriesMap;
  28. CertificateHandlerFactoryMgr();
  29. /// Creates the CertificateHandlerFactoryMgr.
  30. ~CertificateHandlerFactoryMgr();
  31. /// Destroys the CertificateHandlerFactoryMgr.
  32. void setFactory(const std::string& name, CertificateHandlerFactory* pFactory);
  33. /// Registers the factory. Class takes ownership of the pointer.
  34. /// If a factory with the same name already exists, an exception is thrown.
  35. bool hasFactory(const std::string& name) const;
  36. /// Returns true if for the given name a factory is already registered
  37. const CertificateHandlerFactory* getFactory(const std::string& name) const;
  38. /// Returns NULL if for the given name a factory does not exist, otherwise the factory is returned
  39. void removeFactory(const std::string& name);
  40. /// Removes the factory from the manager.
  41. private:
  42. FactoriesMap _factories;
  43. };
  44. } } // namespace Poco::Net
  45. #endif // NetSSL_CertificateHandlerFactoryMgr_INCLUDED