有一个c++的结构体如何转为delphi的,请达人帮忙。

structSequence{//realsequence,ifitisnotstoredswapfile:char*data;//lengthofthesequence... struct Sequence
{
// real sequence, if it is not stored swap file:
char *data;
// length of the sequence:
int size;
int bufsize;

//uint32_t stats;

// if swap != NULL, the sequence is stored in file.
// swap is opened as temporary file, which will be deleted automatically
// after the program is finished:
FILE *swap;
// stream offset of the sequence:
int offset;

// stream offset of the description string in the database:
size_t des_begin;
// length of the description:
int des_length;
// length of the description in quality score part:
int des_length2;
// length of data in fasta file, including line wrapping:
int dat_length;

char *identifier;

// index of the sequence in the original database:
int index;
short state;
int cluster_id;
float identity;
float distance;
int coverage[4];

Sequence();
Sequence( const Sequence & other );
~Sequence();

void Clear();

void operator=( const char *s );
void operator+=( const char *s );

void Resize( int n );
void Reserve( int n );

void Swap( Sequence & other );
int Format();

void ConvertBases();

void SwapIn();
void SwapOut();
void PrintInfo( int id, FILE *fin, FILE *fout, const Options & options, char *buf );
};
展开
 我来答
jeanler
2013-09-06 · 超过38用户采纳过TA的回答
知道小有建树答主
回答量:123
采纳率:0%
帮助的人:67.4万
展开全部
type 
Sequence = class()

public
    // real sequence, if it is not stored swap file:
    data: PChar; //一般可以用string代替 不过如果是用来和C编写的程序交换的话最好使用PChar
    // length of the sequence:
    size: Integer;
    bufsize: Integer;

    //uint32_t stats;

    // if swap != NULL, the sequence is stored in file.
    // swap is opened as temporary file, which will be deleted automatically
    // after the program is finished:
    swap: file;
    // stream offset of the sequence:
    offset: Integer;

    // stream offset of the description string in the database:
    des_begin: Cardinal; //unsigned Integer
    // length of the description:
    des_length: Integer;
    // length of the description in quality score part:
    des_length2: Integer;
    // length of data in fasta file, including line wrapping:
    dat_length: Integer;

    identifier: PChar; 

    // index of the sequence in the original database:
    index: Integer;
    state: Smallint; //short 一般是16位 用Smallint
    cluster_id: Integer;
    identity: Single; //Single 32位浮点 Double 64位浮点
    distance: Single;
    coverage: array[0..4] of Integer;

    constructor Create()// delphi喜欢使用Create来命名构造函数, 无需使用Sequence();
    constructor CreateBySequence(other: Sequence)//个人猜测这个构造函数的意思是用已经存在是实例来构造这个类

    destructor Destroy(); //析构函数

    procedure Clear();

    //delphi 不支持运算符重构 可以用函数来代替
    procedure Assign(s: PChar); //void operator=( const char *s );
procedure Append(s: PChar); //void operator+=( const char *s );

    procedure Resize(n: Integer );
    procedure Reserve(n: Integer);

    procedure Swap(other: Sequence);
    function Format(): Integer;

    procedure ConvertBases();

    procedure SwapIn();
    procedure SwapOut();
    procedure PrintInfo(id:Integer; fin: file; fout file; opt: Options; buf: PChar ); //Options应该是个类型由于delphi是大小写不敏感所以变量改为opt
end; //类定义结束
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式