本文整理汇总了C++中TextLine::AppendCharacters方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::AppendCharacters方法的具体用法?C++ TextLine::AppendCharacters怎么用?C++ TextLine::AppendCharacters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::AppendCharacters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateTextLinesImpl
void MultiLineTextLayer::PopulateTextLinesImpl(const Real MaxWidth)
{
//if( MaxWidth <= 0 )
// return;
Whole LineIndex = 0;
Boole NewLineDetected = false;
TextLine* CurrLine = this->GetOrCreateTextLine(LineIndex);
if( HorizontalOrder == UI::TO_Left_To_Right ) {
CharacterIterator Start = this->Characters.begin();
CharacterIterator End = this->Characters.begin();
const CharacterIterator CharEnd = this->Characters.end();
do{
if( (*Start)->IsWhiteSpace() ) {
// Find the next non-whitespace character.
while( End != CharEnd )
{
if( (*End)->IsNewLine() ) {
NewLineDetected = true;
++End;
break;
}else if( !(*End)->IsWhiteSpace() ) {
break;
}
++End;
}
// We got our range, append what we can.
CharacterIterator Result = CurrLine->AppendFittingCharacters(Start,End,MaxWidth);
if( Result != End || NewLineDetected ) {
CurrLine = this->GetOrCreateTextLine(++LineIndex);
End = CurrLine->AppendFittingCharacters(Result,End,MaxWidth);
if( Start == End ) {
// If these are the same, then we lack the space to append anything.
break;
}
}
// Clear out the newline for the next iteration.
NewLineDetected = false;
}else{
// Find the next whitespace character.
while( End != CharEnd )
{
if( (*End)->IsWhiteSpace() )
break;
++End;
}
// We got our range, so lets try to insert it.
if( !CurrLine->AppendCharacters(Start,End,MaxWidth) )
{
// If we failed to insert, get the next line and try again.
CurrLine = this->GetOrCreateTextLine(++LineIndex);
if( !CurrLine->AppendCharacters(Start,End,MaxWidth) ) {
End = CurrLine->AppendFittingCharacters(Start,End,MaxWidth);
if( Start == End ) {
// If these are the same, then we lack the space to append anything.
break;
}
}
}
}
Start = End;
}while( Start != CharEnd );
}
else if( HorizontalOrder == UI::TO_Right_To_Left )
{
CharacterIterator Start = --this->Characters.end();
CharacterIterator End = --this->Characters.end();
const CharacterIterator CharEnd = --this->Characters.begin();
CharacterIteratorPair AppendPair;
do{
if( (*End)->IsWhiteSpace() ) {
// Find the next non-whitespace character.
while( Start != CharEnd )
{
if( (*Start)->IsNewLine() ) {
NewLineDetected = true;
++Start;
break;
}else if( !(*Start)->IsWhiteSpace() ) {
break;
}
++Start;
}
AppendPair.first = Start;
AppendPair.second = End;
++AppendPair.first;
++AppendPair.second;
// We got our range, append what we can.
CharacterIterator Result = CurrLine->AppendFittingCharacters(AppendPair,MaxWidth);
if( Result != Start || NewLineDetected ) {
//.........这里部分代码省略.........