📄 cls_student2.cpp
字号:
#include "cls_student2.h"
#include "cpp/mycppclasses.h"
EF_BEGIN_DEFINE_FIELD_TABLE(Student2)
EF_FIELD(myT("_姓名"), myT(""), 0, EF_TEXT),
EF_FIELD(myT("_年龄"), myT(""), 0, EF_INT),
EF_END_DEFINE_FIELD_TABLE
struct Student2_FieldsData
{
EFText name;
EFInt age;
};
static Student2_FieldsData* _Student2_GetFieldsData(EFObject* pThis)
{
return (Student2_FieldsData*) EF_GET_OBJECT_FIELDS_DATA_ADDRESS(pThis, IDX_myefn_Student2);
}
//////////////////////////////////////////////////////////////////////////
EFText Student2_GetName(EFObject* pThis)
{
Student2_FieldsData* pFields = _Student2_GetFieldsData(pThis);
return (EFText) EF_INC_REF_COUNT(pFields->name); //返回前增加引用计数
}
EF_BEGIN_DEFINE_ARG_TABLE(Student2, SetName)
EF_ARG(myT("姓名"), myT(""), 0, EF_TEXT),
EF_END_DEFINE_ARG_TABLE
void Student2_SetName(EFObject* pThis, EFText name)
{
Student2_FieldsData* pFields = _Student2_GetFieldsData(pThis);
pFields->name = (EFText) EF_INC_REF_COUNT(name); //存储时增加引用计数
}
EFInt Student2_GetAge(EFObject* pThis)
{
Student2_FieldsData* pFields = _Student2_GetFieldsData(pThis);
return pFields->age;
}
EF_BEGIN_DEFINE_ARG_TABLE(Student2, SetAge)
EF_ARG(myT("年龄"), myT(""), 0, EF_INT),
EF_END_DEFINE_ARG_TABLE
void Student2_SetAge(EFObject* pThis, EFInt age)
{
Student2_FieldsData* pFields = _Student2_GetFieldsData(pThis);
pFields->age = age;
}
EF_BEGIN_DEFINE_ARG_TABLE(Student2, ConstructFromNameAndAge)
EF_ARG(myT("姓名"), myT(""), 0, EF_TEXT),
EF_ARG(myT("年龄"), myT(""), 0, EF_INT),
EF_END_DEFINE_ARG_TABLE
void Student2_ConstructFromNameAndAge(EFObject* pThis, EFText name, EFInt age)
{
Student2_SetName(pThis, name);
Student2_SetAge(pThis, age);
}
EF_BEGIN_DEFINE_METHOD_TABLE(Student2)
EF_METHOD(Student2, ConstructFromNameAndAge, EF_NAME_INIT, myT(""), myT(""), EF_S_PUBLIC|EF_S_M_INIT, EF_NULL),
EF_METHOD_NOARG(Student2, GetName, myT("取姓名"), myT(""), myT(""), EF_S_PUBLIC, EF_TEXT),
EF_METHOD(Student2, SetName, myT("置姓名"), myT(""), myT(""), EF_S_PUBLIC, EF_NULL),
EF_METHOD_NOARG(Student2, GetAge, myT("取年龄"), myT(""), myT(""), EF_S_PUBLIC, EF_INT),
EF_METHOD(Student2, SetAge, myT("置年龄"), myT(""), myT(""), EF_S_PUBLIC, EF_NULL),
EF_END_DEFINE_METHOD_TABLE
EF_DEFINE_CLASS_INFO
(
1.0, // version
Student2, CLS_myefn_Student2, // class_en_name, class_name
myT("类的说明文本"), // help_string
CLS_sys_Object, // base_class_name
0, NULL, // interface_implement_count, interface_implement_table
EF_S_PUBLIC, -1, // state, category_index
myT(""), // properties_list
NULL, // class_init_func
NULL, // object_init_func
NULL, // object_clean_func
EF_METHOD_COUNT(Student2), EF_METHOD_TABLE(Student2), // method_count, method_table
EF_FIELD_COUNT(Student2), EF_FIELD_TABLE(Student2), // element_count, element_table
0, NULL // export_event_count, export_event_table
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -