#ifndef BASE_SCOPED_NATIVE_LIBRARY_H_
#define BASE_SCOPED_NATIVE_LIBRARY_H_
#include "base/base_export.h"
#include "base/native_library.h"
#include "base/scoped_generic.h"
namespace base {
class FilePath;
struct BASE_EXPORT NativeLibraryTraits {
static NativeLibrary InvalidValue() { return nullptr; }
static void Free(NativeLibrary library);
};
class BASE_EXPORT ScopedNativeLibrary
: public ScopedGeneric<NativeLibrary, NativeLibraryTraits> {
public:
ScopedNativeLibrary();
explicit ScopedNativeLibrary(NativeLibrary library);
explicit ScopedNativeLibrary(const FilePath& library_path);
ScopedNativeLibrary(ScopedNativeLibrary&& scoped_library);
ScopedNativeLibrary& operator=(ScopedNativeLibrary&& scoped_library) =
default;
ScopedNativeLibrary(const ScopedNativeLibrary&) = delete;
ScopedNativeLibrary& operator=(const ScopedNativeLibrary&) = delete;
~ScopedNativeLibrary() override;
void* GetFunctionPointer(const char* function_name) const;
const NativeLibraryLoadError* GetError() const;
private:
NativeLibraryLoadError error_;
};
}
#endif