php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_enum.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Ilija Tovilo <ilutov@php.net> |
16 +----------------------------------------------------------------------+
17*/
18
19#ifndef ZEND_ENUM_H
20#define ZEND_ENUM_H
21
22#include "zend.h"
23#include "zend_API.h"
24
25#include <stdint.h>
26
28
32
33void zend_register_enum_ce(void);
36zend_object *zend_enum_new(zval *result, zend_class_entry *ce, zend_string *case_name, zval *backing_value_zv);
40
42 const char *name, uint8_t type, const zend_function_entry *functions);
48
49static zend_always_inline zval *zend_enum_fetch_case_name(zend_object *zobj)
50{
51 ZEND_ASSERT(zobj->ce->ce_flags & ZEND_ACC_ENUM);
52 return OBJ_PROP_NUM(zobj, 0);
53}
54
55static zend_always_inline zval *zend_enum_fetch_case_value(zend_object *zobj)
56{
57 ZEND_ASSERT(zobj->ce->ce_flags & ZEND_ACC_ENUM);
58 ZEND_ASSERT(zobj->ce->enum_backing_type != IS_UNDEF);
59 return OBJ_PROP_NUM(zobj, 1);
60}
61
63
64#endif /* ZEND_ENUM_H */
zend_ffi_type * type
Definition ffi.c:3812
HashTable functions
struct _zend_function_entry zend_function_entry
struct _zval_struct zval
#define ZEND_ACC_ENUM
#define OBJ_PROP_NUM(obj, num)
#define ZEND_API
ZEND_API zend_class_entry * zend_ce_unit_enum
Definition zend_enum.c:35
ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_class_entry *ce, zend_long long_key, zend_string *string_key, bool try_from)
Definition zend_enum.c:289
ZEND_API zend_object_handlers zend_enum_object_handlers
Definition zend_enum.c:37
ZEND_API zend_object * zend_enum_get_case(zend_class_entry *ce, zend_string *name)
Definition zend_enum.c:613
void zend_verify_enum(const zend_class_entry *ce)
Definition zend_enum.c:120
ZEND_API zend_class_entry * zend_ce_backed_enum
Definition zend_enum.c:36
ZEND_API zend_class_entry * zend_register_internal_enum(const char *name, uint8_t type, const zend_function_entry *functions)
Definition zend_enum.c:503
zend_result zend_enum_build_backed_enum_table(zend_class_entry *ce)
Definition zend_enum.c:196
void zend_enum_register_funcs(zend_class_entry *ce)
Definition zend_enum.c:439
void zend_enum_register_props(zend_class_entry *ce)
Definition zend_enum.c:474
ZEND_API void zend_enum_add_case_cstr(zend_class_entry *ce, const char *name, zval *value)
Definition zend_enum.c:606
ZEND_API void zend_enum_add_case(zend_class_entry *ce, zend_string *case_name, zval *value)
Definition zend_enum.c:577
void zend_enum_add_interfaces(zend_class_entry *ce)
Definition zend_enum.c:172
ZEND_API zend_object * zend_enum_get_case_cstr(zend_class_entry *ce, const char *name)
Definition zend_enum.c:627
zend_object * zend_enum_new(zval *result, zend_class_entry *ce, zend_string *case_name, zval *backing_value_zv)
Definition zend_enum.c:39
void zend_register_enum_ce(void)
Definition zend_enum.c:159
int32_t zend_long
Definition zend_long.h:42
struct _zend_string zend_string
#define END_EXTERN_C()
#define zend_always_inline
#define ZEND_ASSERT(c)
#define BEGIN_EXTERN_C()
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
#define IS_UNDEF
Definition zend_types.h:600
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64
struct _zend_object_handlers zend_object_handlers
Definition zend_types.h:88
zend_string * name
bool result
value
zend_object * zobj