表结构类的设计思路

都先生 2012-02-22 09:34:01
我想构建一个类似表的类,该类能够记录字段名称、字段类型、字段值,在表中的纵坐标值、横坐标值

我定如下
TExcelField = class;

TExcelFields = class;

TExcelTable = class
private
public
FFieldCount :Integer;
FRecordCount :Integer;
FExcelFieldList : array[1..RECCOUNT] of TExcelFields;
end;


TExcelField=class(TObject)
private
function GetCFName:string;
function GetFName:string;
function GetFType:string;
function GetValue:string;
public
FCFName: string; //字段中文名称
FFName: string; //字段名称
FFType: string; //字段类型
FValue: string; //字段值


constructor Create(); reintroduce;
destructor Destroy; reintroduce;

property CFName:string read GetCFName;
property FName:string read GetFName;
property FType:string read GetFType;
property Value:string read GetValue;

end;

TExcelFields=class(TObject)
private

public
FExlField: array[1..MAXCOUNT] of TExcelField; //字段序列
end;


有什么不好的地方吗?
...全文
86 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
金卯刀 2012-02-23
  • 打赏
  • 举报
回复
TExcelFields=class(TObject)
可以包装一个List,该list存放Field对象;
提供查找Field方法,添加、删除Field等(依据实际需要)
erhan 2012-02-22
  • 打赏
  • 举报
回复
1.
FCFName: string; //字段中文名称
FFName: string; //字段名称
FFType: string; //字段类型
FValue: string; //字段值
不用public
2.
FExcelFieldList : array[1..RECCOUNT] of TExcelFields;
不灵活,TList好些
3.
FFieldCount :Integer;
FRecordCount :Integer;
原定义是个一维数组,为啥2个count尼

粗看了下,供参考

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧