本文整理汇总了C++中c4_Column::Position方法的典型用法代码示例。如果您正苦于以下问题:C++ c4_Column::Position方法的具体用法?C++ c4_Column::Position怎么用?C++ c4_Column::Position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c4_Column
的用法示例。
在下文中一共展示了c4_Column::Position方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iter
void c4_Differ::CreateDiff(int id_, c4_Column &col_) {
_temp.SetSize(0);
#if 0
t4_i32 offset = 0;
t4_i32 savedOff = 0;
t4_i32 savedLen = 0;
c4_Strategy *strat = col_.Persist() != 0 ? &col_.Strategy(): 0;
c4_ColIter iter(col_, 0, col_.ColSize());
while (iter.Next()) {
const t4_byte *p = iter.BufLoad();
if (strat != 0 && strat->_mapStart != 0 && p >= strat->_mapStart && p -
strat->_mapStart < strat->_dataSize) {
t4_i32 nextOff = p - strat->_mapStart;
if (savedLen == 0)
savedOff = nextOff;
if (nextOff == savedOff + savedLen) {
savedLen += iter.BufLen();
continue;
}
if (savedLen > 0)
AddEntry(savedOff, savedLen, c4_Bytes());
savedOff = nextOff;
savedLen = iter.BufLen();
} else {
AddEntry(savedOff, savedLen, c4_Bytes(p, iter.BufLen()));
savedLen = 0;
}
offset += iter.BufLen();
}
c4_View diff = pDiff(_diffs[id_]);
if (_temp.GetSize() != diff.GetSize() || _temp != diff)
#else
c4_Bytes t1;
const t4_byte *p = col_.FetchBytes(0, col_.ColSize(), t1, false);
AddEntry(0, 0, c4_Bytes(p, col_.ColSize()));
#endif
pDiff(_diffs[id_]) = _temp;
pOrig(_diffs[id_]) = col_.Position();
}
示例2: ItemLenOffCol
c4_Column *c4_FormatB::GetNthMemoCol(int index_, bool alloc_) {
t4_i32 start;
c4_Column *col;
int n = ItemLenOffCol(index_, start, col);
if (col == &_data && alloc_) {
col = d4_new c4_Column(_data.Persist());
_memos.SetAt(index_, col);
if (n > 0)
if (_data.IsDirty()) {
c4_Bytes temp;
_data.FetchBytes(start, n, temp, true);
col->SetBuffer(n);
col->StoreBytes(0, temp);
} else
col->SetLocation(_data.Position() + start, n);
}
return col;
}
示例3: StoreValue
bool c4_SaveContext::CommitColumn(c4_Column &col_) {
bool changed = col_.IsDirty() || _fullScan;
t4_i32 sz = col_.ColSize();
StoreValue(sz);
if (sz > 0) {
t4_i32 pos = col_.Position();
if (_differ) {
if (changed) {
int n = pos < 0 ? ~pos: _differ->NewDiffID();
_differ->CreateDiff(n, col_);
d4_assert(n >= 0);
pos = ~n;
}
} else if (_preflight) {
if (changed)
pos = _space->Allocate(sz);
_nextSpace->Occupy(pos, sz);
_newPositions.Add(pos);
} else {
pos = _newPositions.GetAt(_nextPosIndex++);
if (changed)
col_.SaveNow(_strategy, pos);
if (!_fullScan)
col_.SetLocation(pos, sz);
}
StoreValue(pos);
}
return changed;
}
示例4: sizes
void c4_FormatB::OldDefine(char type_, c4_Persist &pers_) {
int rows = Owner().NumRows();
c4_ColOfInts sizes(_data.Persist());
if (type_ == 'M') {
InitOffsets(sizes);
c4_ColOfInts szVec(_data.Persist());
pers_.FetchOldLocation(szVec);
szVec.SetRowCount(rows);
c4_ColOfInts posVec(_data.Persist());
pers_.FetchOldLocation(posVec);
posVec.SetRowCount(rows);
for (int r = 0; r < rows; ++r) {
t4_i32 sz = szVec.GetInt(r);
if (sz > 0) {
c4_Column *mc = d4_new c4_Column(_data.Persist());
d4_assert(mc != 0);
_memos.SetAt(r, mc);
mc->SetLocation(posVec.GetInt(r), sz);
}
}
} else {
pers_.FetchOldLocation(_data);
if (type_ == 'B') {
pers_.FetchOldLocation(sizes);
#if !q4_OLD_IS_ALWAYS_V2
// WARNING - HUGE HACK AHEAD - THIS IS NOT 100% FULLPROOF!
//
// The above is correct for MK versions 2.0 and up, but *NOT*
// for MK 1.8.6 datafiles, which store sizes first (OUCH!!!).
// This means that there is not a 100% safe way to auto-convert
// both 1.8.6 and 2.0 files - since there is no way to detect
// unambiguously which version a datafile is. All we can do,
// is to carefully check both vectors, and *hope* that only one
// of them is valid as sizes vector. This problem applies to
// the 'B' (bytes) property type only, and only pre 2.0 files.
//
// To build a version which *always* converts assuming 1.8.6,
// add flag "-Dq4_OLD_IS_PRE_V2" to the compiler command line.
// Conversely, "-Dq4_OLD_IS_ALWAYS_V2" forces 2.0 conversion.
if (rows > 0) {
t4_i32 s1 = sizes.ColSize();
t4_i32 s2 = _data.ColSize();
#if !q4_OLD_IS_PRE_V2
// if the size vector is clearly impossible, swap vectors
bool fix = c4_ColOfInts::CalcAccessWidth(rows, s1) < 0;
// if the other vector might be valid as well, check further
if (!fix && c4_ColOfInts::CalcAccessWidth(rows, s2) >= 0) {
sizes.SetRowCount(rows);
t4_i32 total = 0;
for (int i = 0; i < rows; ++i) {
t4_i32 w = sizes.GetInt(i);
if (w < 0 || total > s2) {
total = - 1;
break;
}
total += w;
}
// if the sizes don't add up, swap vectors
fix = total != s2;
}
if (fix)
#endif
{
t4_i32 p1 = sizes.Position();
t4_i32 p2 = _data.Position();
_data.SetLocation(p1, s1);
sizes.SetLocation(p2, s2);
}
}
#endif
InitOffsets(sizes);
} else {
d4_assert(type_ == 'S');
sizes.SetRowCount(rows);
t4_i32 pos = 0;
t4_i32 lastEnd = 0;
int k = 0;
c4_ColIter iter(_data, 0, _data.ColSize());
while (iter.Next()) {
const t4_byte *p = iter.BufLoad();
for (int j = 0; j < iter.BufLen(); ++j)
if (!p[j]) {
sizes.SetInt(k++, pos + j + 1-lastEnd);
//.........这里部分代码省略.........