Fetch the repository succeeded.
/*
* table field.cpp
*
* Created on: 20171129
* Author: Administrator
*/
#include"table field.h"
#include<sstream>
using namespace std;
VOID Table_field::initFields(){
fields.clear();
for(UINT i=0,size=field.size() ; i < size; ++i ){
while( i <size && field[i] == ifs && field[ i ] !='\0' ) ++i ;
fields.push_back(i);
while(i <size && field[i]!=ifs && field[ i ] !='\0') ++i ;
if( i< size)
field[ i ] ='\0';
}
}
VOID Table_field::initFieldsStandard(){
fields.clear();
for(UINT i=0,size=field.size() ; i < size; ++i ){
fields.push_back(i);
while(i< size && field[ i ] !='\0'&& field[i]!=ifs ) ++i ;
if( i< size )
field[ i ] = '\0';
}
}
Table_field::Table_field(istream& in , BYTE fs , BOOL st ):ifs(fs),stand(st){
getline(in, field);
if(stand){
initFieldsStandard();
}else{
initFields();
}
}
Table_field::Table_field(string&& s,BYTE fs, BOOL st ):field(s),ifs(fs),stand(st){
if(stand){
initFieldsStandard();
}else{
initFields();
}
}
Table_field::Table_field(string& s,BYTE fs, BOOL st):field(s),ifs(fs),stand(st){
if(stand){
initFieldsStandard();
}else{
initFields();
}
}
WORD Table_field::getWordHex(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
istringstream ssin( field.c_str() + fields[i] );
ssin >> hex >> ret;
return ret;
}
DWORD Table_field::getDWordHex(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
istringstream ssin(field.c_str() + fields[i] );
ssin >> hex >> ret;
return ret;
}
WORD Table_field::getWord(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
const string s=field.c_str() + fields[i] ;
istringstream ssin(field.c_str() + fields[i]);
ssin >> ret;
return ret;
}
DWORD Table_field::getDWord(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
istringstream ssin(field.c_str() + fields[i] );
ssin >> ret;
return ret;
}
BYTE Table_field::getByteHex(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
istringstream ssin(field.c_str() + fields[i] );
ssin >> hex >> ret;
return ret;
}
BYTE Table_field::getByte(UINT i){
DWORD ret;
if(i >= fields.size())return 0;
istringstream ssin(field.c_str() + i );
ssin >> ret;
return ret;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。