fx: add interface for comparaing two values
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#include <fx/comparable.h>
|
||||
#include <fx/macros.h>
|
||||
|
||||
FX_TYPE_CLASS_BEGIN(fx_comparable)
|
||||
FX_TYPE_VTABLE_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
||||
FX_INTERFACE_ENTRY(to_string) = NULL;
|
||||
FX_TYPE_VTABLE_INTERFACE_END(fx_object, FX_TYPE_OBJECT)
|
||||
FX_TYPE_CLASS_END(fx_comparable)
|
||||
|
||||
FX_TYPE_DEFINITION_BEGIN(fx_comparable)
|
||||
FX_TYPE_FLAGS(FX_TYPE_F_ABSTRACT);
|
||||
FX_TYPE_ID(0xb25ab0c6, 0xfddb, 0x447f, 0xa54d, 0x44c4a0ef74a1);
|
||||
FX_TYPE_NAME("fx.comparable");
|
||||
FX_TYPE_CLASS(fx_comparable_class);
|
||||
FX_TYPE_DEFINITION_END(fx_comparable)
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef FX_COMPARABLE_H_
|
||||
#define FX_COMPARABLE_H_
|
||||
|
||||
#include <fx/int-primitives.h>
|
||||
#include <fx/macros.h>
|
||||
#include <fx/value.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
#define FX_TYPE_COMPARABLE (fx_comparable_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_comparable);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_comparable)
|
||||
i32 (*c_compare)(const fx_value *a, const fx_value *b);
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_comparable)
|
||||
|
||||
FX_API fx_type_id fx_comparable_get_type(void);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user