Loading libs/nativewindow/include/android/native_window_aidl.h +20 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ #include <android/native_window.h> #include <sys/cdefs.h> #include <sstream> #include <string> __BEGIN_DECLS /** Loading Loading @@ -80,7 +83,7 @@ namespace aidl::android::hardware { * Takes ownership of the ANativeWindow* given to it in reset() and will automatically * destroy it in the destructor, similar to a smart pointer container */ class NativeWindow { class NativeWindow final { public: NativeWindow() noexcept {} explicit NativeWindow(ANativeWindow* _Nullable window) { Loading Loading @@ -123,15 +126,29 @@ public: } mWindow = window; } inline ANativeWindow* _Nullable operator-> () const { return mWindow; } inline ANativeWindow* _Nullable get() const { return mWindow; } inline explicit operator bool () const { return mWindow != nullptr; } NativeWindow& operator=(NativeWindow&& other) noexcept { mWindow = other.release(); // steal ownership from r-value return *this; } inline ANativeWindow* _Nullable operator->() const { return mWindow; } inline explicit operator bool() const { return mWindow != nullptr; } inline bool operator==(const NativeWindow& rhs) const { return mWindow == rhs.mWindow; } inline bool operator!=(const NativeWindow& rhs) const { return !(*this == rhs); } inline bool operator<(const NativeWindow& rhs) const { return mWindow < rhs.mWindow; } inline bool operator>(const NativeWindow& rhs) const { return rhs < *this; } inline bool operator>=(const NativeWindow& rhs) const { return !(*this < rhs); } inline bool operator<=(const NativeWindow& rhs) const { return !(*this > rhs); } std::string toString() const { std::ostringstream ss; ss << "NativeWindow: " << mWindow; return ss.str(); } /** * Stops managing any contained ANativeWindow*, returning it to the caller. Ownership * is released. Loading Loading
libs/nativewindow/include/android/native_window_aidl.h +20 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ #include <android/native_window.h> #include <sys/cdefs.h> #include <sstream> #include <string> __BEGIN_DECLS /** Loading Loading @@ -80,7 +83,7 @@ namespace aidl::android::hardware { * Takes ownership of the ANativeWindow* given to it in reset() and will automatically * destroy it in the destructor, similar to a smart pointer container */ class NativeWindow { class NativeWindow final { public: NativeWindow() noexcept {} explicit NativeWindow(ANativeWindow* _Nullable window) { Loading Loading @@ -123,15 +126,29 @@ public: } mWindow = window; } inline ANativeWindow* _Nullable operator-> () const { return mWindow; } inline ANativeWindow* _Nullable get() const { return mWindow; } inline explicit operator bool () const { return mWindow != nullptr; } NativeWindow& operator=(NativeWindow&& other) noexcept { mWindow = other.release(); // steal ownership from r-value return *this; } inline ANativeWindow* _Nullable operator->() const { return mWindow; } inline explicit operator bool() const { return mWindow != nullptr; } inline bool operator==(const NativeWindow& rhs) const { return mWindow == rhs.mWindow; } inline bool operator!=(const NativeWindow& rhs) const { return !(*this == rhs); } inline bool operator<(const NativeWindow& rhs) const { return mWindow < rhs.mWindow; } inline bool operator>(const NativeWindow& rhs) const { return rhs < *this; } inline bool operator>=(const NativeWindow& rhs) const { return !(*this < rhs); } inline bool operator<=(const NativeWindow& rhs) const { return !(*this > rhs); } std::string toString() const { std::ostringstream ss; ss << "NativeWindow: " << mWindow; return ss.str(); } /** * Stops managing any contained ANativeWindow*, returning it to the caller. Ownership * is released. Loading