cert_store updated to be able to member a non-copyable class

This commit is contained in:
Simon Rozman 2016-08-23 13:52:26 +02:00
parent 8a0799c2b7
commit 2118f92e9a

View File

@ -548,6 +548,25 @@ namespace winstd
class WINSTD_API cert_store : public handle<HCERTSTORE> class WINSTD_API cert_store : public handle<HCERTSTORE>
{ {
public: public:
///
/// Initializes a new class instance with the object handle set to NULL.
///
inline cert_store() : handle<HCERTSTORE>() {}
///
/// Initializes a new class instance with an already available object handle.
///
/// \param[in] h Initial object handle value
///
inline cert_store(_In_opt_ handle_type h) : handle<HCERTSTORE>(h) {}
///
/// Move constructor
///
/// \param[inout] h A rvalue reference of another object
///
inline cert_store(_Inout_ cert_store &&h) : handle<HCERTSTORE>(std::move(h)) {}
/// ///
/// Closes the certificate store. /// Closes the certificate store.
/// ///
@ -555,6 +574,18 @@ namespace winstd
/// ///
virtual ~cert_store(); virtual ~cert_store();
///
/// Move assignment
///
/// \param[inout] h A rvalue reference of another object
///
cert_store& operator=(_Inout_ cert_store &&h)
{
if (this != std::addressof(h))
*(handle<handle_type>*)this = std::move(h);
return *this;
}
/// ///
/// Opens the certificate store. /// Opens the certificate store.
/// ///
@ -593,6 +624,11 @@ namespace winstd
return false; return false;
} }
private:
// This class is noncopyable.
cert_store(_In_ const cert_store &h);
cert_store& operator=(_In_ const cert_store &h);
protected: protected:
/// ///
/// Closes the certificate store. /// Closes the certificate store.