summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/m_gui.h55
-rw-r--r--include/m_protoint.h6
-rw-r--r--include/m_system.h59
3 files changed, 65 insertions, 55 deletions
diff --git a/include/m_gui.h b/include/m_gui.h
index 5b92502f0b..a62e706a11 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -235,61 +235,6 @@ private:
};
/////////////////////////////////////////////////////////////////////////////////////////
-// Callbacks
-
-struct CCallbackImp
-{
- struct CDummy
- { int foo;
- };
-
-public:
- __inline CCallbackImp(): m_object(nullptr), m_func(nullptr) {}
-
- __inline CCallbackImp(const CCallbackImp &other): m_object(other.m_object), m_func(other.m_func) {}
- __inline CCallbackImp &operator=(const CCallbackImp &other) { m_object = other.m_object; m_func = other.m_func; return *this; }
-
- __inline bool operator==(const CCallbackImp &other) const { return (m_object == other.m_object) && (m_func == other.m_func); }
- __inline bool operator!=(const CCallbackImp &other) const { return (m_object != other.m_object) || (m_func != other.m_func); }
-
- __inline operator bool() const { return m_object && m_func; }
-
- __inline bool CheckObject(void *object) const { return (object == m_object) ? true : false; }
-
-protected:
- template<typename TClass, typename TArgument>
- __inline CCallbackImp(TClass *object, void (TClass::*func)(TArgument *argument)): m_object((CDummy*)object), m_func((TFnCallback)func) {}
-
- __inline void Invoke(void *argument) const { if (m_func && m_object) (m_object->*m_func)(argument); }
-
-private:
- typedef void (CDummy::*TFnCallback)(void *argument);
-
- CDummy* m_object;
- TFnCallback m_func;
-};
-
-template<typename TArgument>
-struct CCallback: public CCallbackImp
-{
- typedef CCallbackImp CSuper;
-
-public:
- __inline CCallback() {}
-
- template<typename TClass>
- __inline CCallback(TClass *object, void (TClass::*func)(TArgument *argument)): CCallbackImp(object, func) {}
-
- __inline CCallback& operator=(const CCallbackImp& x) { CSuper::operator =(x); return *this; }
-
- __inline void operator()(TArgument *argument) const { Invoke((void*)argument); }
-};
-
-template<typename TClass, typename TArgument>
-__inline CCallback<TArgument> Callback(TClass *object, void (TClass::*func)(TArgument *argument))
- { return CCallback<TArgument>(object, func); }
-
-/////////////////////////////////////////////////////////////////////////////////////////
// CDbLink
class MIR_CORE_EXPORT CDataLink
diff --git a/include/m_protoint.h b/include/m_protoint.h
index 8be0fce7f4..9bc9def714 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -288,4 +288,10 @@ template<class T> struct PROTO : public PROTO_INTERFACE
__forceinline void CreateProtoServiceParam(const char *name, MyServiceFuncParam pFunc, LPARAM param) {
::ProtoCreateServiceParam(this, name, (ProtoServiceFuncParam)pFunc, param); }
};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(PROTO_INTERFACE *) Proto_GetInstance(const char *szModule);
+MIR_APP_DLL(PROTO_INTERFACE *) Proto_GetInstance(MCONTACT hContact);
+
#endif // M_PROTOINT_H__
diff --git a/include/m_system.h b/include/m_system.h
index c48b1fcc13..a2f1dae9b8 100644
--- a/include/m_system.h
+++ b/include/m_system.h
@@ -559,6 +559,65 @@ struct WCHAR_PARAM : public PARAM
}
};
+/////////////////////////////////////////////////////////////////////////////////////////
+// Callbacks
+
+class CCallbackImp
+{
+ struct CDummy
+ {
+ int foo;
+ };
+
+ typedef void (CDummy:: *TFnCallback)(void *argument);
+
+ CDummy *m_object;
+ TFnCallback m_func;
+
+protected:
+ template<typename TClass, typename TArgument>
+ __inline CCallbackImp(TClass *object, void (TClass:: *func)(TArgument *argument)) :
+ m_object((CDummy *)object),
+ m_func((TFnCallback)func)
+ {
+ }
+
+ __inline void Invoke(void *argument) const { if (m_func && m_object) (m_object->*m_func)(argument); }
+
+public:
+ __inline CCallbackImp() : m_object(nullptr), m_func(nullptr) {}
+
+ __inline CCallbackImp(const CCallbackImp &other) : m_object(other.m_object), m_func(other.m_func) {}
+ __inline CCallbackImp &operator=(const CCallbackImp &other) { m_object = other.m_object; m_func = other.m_func; return *this; }
+
+ __inline bool operator==(const CCallbackImp &other) const { return (m_object == other.m_object) && (m_func == other.m_func); }
+ __inline bool operator!=(const CCallbackImp &other) const { return (m_object != other.m_object) || (m_func != other.m_func); }
+
+ __inline operator bool() const { return m_object && m_func; }
+};
+
+template<typename TArgument>
+struct CCallback : public CCallbackImp
+{
+ typedef CCallbackImp CSuper;
+
+public:
+ __inline CCallback() {}
+
+ template<typename TClass>
+ __inline CCallback(TClass *object, void (TClass:: *func)(TArgument *argument)) : CCallbackImp(object, func) {}
+
+ __inline CCallback &operator=(const CCallbackImp &x) { CSuper::operator =(x); return *this; }
+
+ __inline void operator()(TArgument *argument) const { Invoke((void *)argument); }
+};
+
+template<typename TClass, typename TArgument>
+__inline CCallback<TArgument> Callback(TClass *object, void (TClass:: *func)(TArgument *argument))
+{
+ return CCallback<TArgument>(object, func);
+}
+
///////////////////////////////////////////////////////////////////////////////
// http support