summaryrefslogtreecommitdiff
path: root/AK/Weakable.h
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-28 11:53:16 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-28 17:31:20 +0200
commit0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425 (patch)
tree93dbbbeb714f258bd7fb044633eb83bdcd908286 /AK/Weakable.h
parentc11351ac507f863699d78aec46a77bd4d59e743c (diff)
downloadserenity-0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425.zip
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
Diffstat (limited to 'AK/Weakable.h')
-rw-r--r--AK/Weakable.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/AK/Weakable.h b/AK/Weakable.h
index c9590c2be1..d5b55050d3 100644
--- a/AK/Weakable.h
+++ b/AK/Weakable.h
@@ -1,23 +1,29 @@
#pragma once
#include "Assertions.h"
-#include "Retainable.h"
#include "RetainPtr.h"
+#include "Retainable.h"
namespace AK {
-template<typename T> class Weakable;
-template<typename T> class WeakPtr;
+template<typename T>
+class Weakable;
+template<typename T>
+class WeakPtr;
template<typename T>
class WeakLink : public Retainable<WeakLink<T>> {
friend class Weakable<T>;
+
public:
T* ptr() { return static_cast<T*>(m_ptr); }
const T* ptr() const { return static_cast<const T*>(m_ptr); }
private:
- explicit WeakLink(T& weakable) : m_ptr(&weakable) { }
+ explicit WeakLink(T& weakable)
+ : m_ptr(&weakable)
+ {
+ }
T* m_ptr;
};
@@ -25,11 +31,12 @@ template<typename T>
class Weakable {
private:
class Link;
+
public:
WeakPtr<T> make_weak_ptr();
protected:
- Weakable() { }
+ Weakable() {}
~Weakable()
{