1 Star 0 Fork 3

411592004/DesignPatternInC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ComponentWindow.c 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
GoodmanTao 提交于 2019-04-21 22:37 +08:00 . init
#include <stdio.h>
#include "ComponentWindow.h"
//属性、方法声明
struct ComponentWindow_Fld
{
apr_pool_t *m_pPool;
//继承接口
IComponent m_component;
};
static void Free(IComponent **ppComponent)
{
ComponentWindow_Free(&(ComponentWindow *)(*ppComponent)->pImplicit);
*ppComponent = NULL;
}
static void Display(IComponent *pComponent)
{
//ComponentWindow *pInst = (ComponentWindow *)pComponent->pImplicit;
puts("显示窗口.");
}
ComponentWindow * ComponentWindow_New(apr_pool_t * pSupPool)
{
apr_pool_t *pPool;
apr_pool_create(&pPool, pSupPool);
ComponentWindow *pInst = apr_palloc(pPool, sizeof(ComponentWindow));
pInst->pFld = apr_palloc(pPool, sizeof(ComponentWindow_Fld));
pInst->pFld->m_pPool = pPool;
pInst->pFld->m_component.pImplicit = pInst;
pInst->pFld->m_component.Free = Free;
pInst->pFld->m_component.Display = Display;
return pInst;
}
IComponent * ComponentWindow2IComponent(ComponentWindow * pInst)
{
return &(pInst->pFld->m_component);
}
void ComponentWindow_Free(ComponentWindow ** ppInst)
{
apr_pool_destroy((*ppInst)->pFld->m_pPool);
*ppInst = NULL;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/bailingniao_760/DesignPatternInC.git
git@gitee.com:bailingniao_760/DesignPatternInC.git
bailingniao_760
DesignPatternInC
DesignPatternInC
master

搜索帮助