📄 attributeblock.cpp
字号:
// AttributeBlock.cpp: implementation of the AttributeBlock class.
//
//////////////////////////////////////////////////////////////////////
#include <memory.h>
#include "AttributeBlock.h"
#include "api_inte_struct.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
AttributeBlock::AttributeBlock()
{
}
AttributeBlock::~AttributeBlock()
{
}
void AttributeBlock::add_attri_list(table_info *ti,char* attri_head)
{
int i;
char* p = attri_head;
for (i = 0; i < ti->n_attribute; i++)
{
//place order
//attribute name
//type
//type length
//is_unique
memcpy(p,ti->attribute_name[i],sizeof(ti->attribute_name[i]));
p += sizeof(ti->attribute_name[i]);
*(int*) p = ti->type[i];
p += sizeof(int);
*(int*) p = ti->type_length[i];
p += sizeof(int);
*(int*) p = ti->is_unique[i];
p += sizeof(int);
if ( p - attri_head < 0 ) return; // need error handling
}
}
void AttributeBlock::get_attri_list(char *attri_head,struct table_info* ti)
//need modify
//add n_attribute input
{
char* p = attri_head;
int i;
for (i = 0 ; i< ti->n_attribute ; i++)
{
//place order
//attribute name
//type
//type length
//is_unique
memcpy(ti->attribute_name[i], p ,sizeof(ti->attribute_name[i]));
p += sizeof(ti->attribute_name[i]);
ti->type[i] = *(int*) p ;
p += sizeof(int);
ti->type_length[i] = *(int*) p ;
p += sizeof(int);
ti->is_unique[i] = *(int*) p ;
p += sizeof(int);
// need error handling
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -