本文整理汇总了C++中TextLine::size方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::size方法的具体用法?C++ TextLine::size怎么用?C++ TextLine::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blockList
CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlockList& bList )
: blockList(bList),
formatLength(0)
{
length=line.size();
if (line.size() > 0) {
formatLength=1;
int k=1;
// count number of different formats in this text line
Character c = line[0];
while ( k<length )
{
if ( !(line[k].equalsFormat(c)))
{
formatLength++; // format change detected
c=line[k];
}
k++;
}
//kDebug() << "number of different formats in string: " << formatLength;
formatArray = (CharacterFormat*) blockList.allocate(sizeof(CharacterFormat)*formatLength);
Q_ASSERT (formatArray!=nullptr);
text = (quint16*) blockList.allocate(sizeof(quint16)*line.size());
Q_ASSERT (text!=nullptr);
length=line.size();
wrapped=false;
// record formats and their positions in the format array
c=line[0];
formatArray[0].setFormat ( c );
formatArray[0].startPos=0; // there's always at least 1 format (for the entire line, unless a change happens)
k=1; // look for possible format changes
int j=1;
while ( k<length && j<formatLength )
{
if (!(line[k].equalsFormat(c)))
{
c=line[k];
formatArray[j].setFormat(c);
formatArray[j].startPos=k;
//kDebug() << "format entry " << j << " at pos " << formatArray[j].startPos << " " << &(formatArray[j].startPos) ;
j++;
}
k++;
}
// copy character values
for ( int i=0; i<line.size(); i++ )
{
text[i]=line[i].character;
//kDebug() << "char " << i << " at mem " << &(text[i]);
}
}
//kDebug() << "line created, length " << length << " at " << &(length);
}
示例2:
TextFileIterator& TextFileIterator::operator --() {
if (0 < mColumnIndex) {
mColumnIndex--;
} else {
if (0 < mLineIndex) {
mLineIndex--;
TextLine *beforeLine = mFile->mLines[mLineIndex];
mColumnIndex = beforeLine->size() - 1;
}
}
return *this;
}
示例3: sizeof
TextFileIterator& TextFileIterator::operator ++() {
TextLine *line = mFile->mLines[mLineIndex];
if (line->size() - 1 > mColumnIndex) {
mColumnIndex++;
} else {
if (mFile->mLines.size() > mLineIndex) {
bool needChangeLine = false;
const char *lfBytes = line->getLineFeed();
int lfBytesLen = (int) sizeof(lfBytes) - 1;
mLineFeedIndex++;
if (mLineFeedIndex == lfBytesLen) {
mLineFeedIndex = -1;
needChangeLine = true;
}
if (needChangeLine) {
mLineIndex++;
mColumnIndex = 0;
}
}
}
return *this;
}