• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TextLine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TextLine的典型用法代码示例。如果您正苦于以下问题:C++ TextLine类的具体用法?C++ TextLine怎么用?C++ TextLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextLine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:lxde,项目名称:qtermwidget,代码行数:60,代码来源:History.cpp


示例2: ASFUNCTIONBODY

ASFUNCTIONBODY(TextBlock, createTextLine)
{
	TextBlock* th=static_cast<TextBlock*>(obj);
	_NR<TextLine> previousLine;
	int32_t width;
	ARG_UNPACK (previousLine, NullRef) (width, MAX_LINE_WIDTH);

	if (argslen > 2)
		LOG(LOG_NOT_IMPLEMENTED, "TextBlock::createTextLine ignored some parameters");

	if (width <= 0 || width > MAX_LINE_WIDTH)
		throw Class<ArgumentError>::getInstanceS("Invalid width");

	if (!previousLine.isNull())
	{
		LOG(LOG_NOT_IMPLEMENTED, "TextBlock::createTextLine supports a single line only");
		return getSys()->getNullRef();
	}

	th->incRef();
	TextLine *textLine = Class<TextLine>::getInstanceS(th->content, _MNR(th));
	textLine->width = (uint32_t)width;
	textLine->updateSizes();
	return textLine;
}
开发者ID:ajasmin,项目名称:lightspark,代码行数:25,代码来源:flashtextengine.cpp


示例3: Line

void TextDisplay::HideCaret () {
    if (Interactor::ValidCanvas(canvas) &&
	caretline >= topline && caretline <= bottomline
    ) {
        TextLine* l = Line(caretline, true);
        l->Draw(this, caretline, caretindex-1, caretindex);
    }
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:8,代码来源:textdisplay.cpp


示例4: Line

IntCoord TextDisplay::Right (int line, int index) {
    TextLine* l = Line(line, false);
    if (l == nil) {
        return xmin + x0;
    } else {
        return xmin + x0 + l->Offset(this, index+1) - 1;
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:8,代码来源:textdisplay.c


示例5: parent

void Text::layout()
      {
      if (styled() && !_editMode) {
            SimpleText::layout();
            }
      else {
            _doc->setDefaultFont(textStyle().font(spatium()));
            qreal w = -1.0;
            qreal x = 0.0;
            qreal y = 0.0;
            if (parent() && layoutToParentWidth()) {
                  w = parent()->width();
                  if (parent()->type() == HBOX || parent()->type() == VBOX || parent()->type() == TBOX) {
                        Box* box = static_cast<Box*>(parent());
                        x += box->leftMargin() * MScore::DPMM;
                        y += box->topMargin() * MScore::DPMM;
                        w = box->width()   - ((box->leftMargin() + box->rightMargin()) * MScore::DPMM);
                        }
                  }

            QTextOption to = _doc->defaultTextOption();
            to.setUseDesignMetrics(true);
            to.setWrapMode(w <= 0.0 ? QTextOption::NoWrap : QTextOption::WrapAtWordBoundaryOrAnywhere);
            _doc->setDefaultTextOption(to);

            if (w < 0.0)
                  w = _doc->idealWidth();
            _doc->setTextWidth(w);

            setbbox(QRectF(QPointF(0.0, 0.0), _doc->size()));
            if (hasFrame())
                  layoutFrame();
            _doc->setModified(false);
            textStyle().layout(this);      // process alignment

#if 0 // TODO  TEXT_STYLE_TEXTLINE
            if ((textStyle().align() & ALIGN_VCENTER) && (textStyle() == TEXT_STYLE_TEXTLINE)) {
                  // special case: vertically centered text with TextLine needs to
                  // take into account the line width
                  TextLineSegment* tls = static_cast<TextLineSegment*>(parent());
                  TextLine* tl = tls->textLine();
                  if (tl) {
                        qreal textlineLineWidth = point(tl->lineWidth());
                        rypos() -= textlineLineWidth * .5;
                        }
                  }
#endif
            rxpos() += x;
            rypos() += y;
            }
      if (parent() && parent()->type() == SEGMENT) {
            Segment* s = static_cast<Segment*>(parent());
            rypos() += s ? s->measure()->system()->staff(staffIdx())->y() : 0.0;
            }
      adjustReadPos();
      }
开发者ID:guifre2,项目名称:MuseScore,代码行数:56,代码来源:text.cpp


示例6:

void
LineRenderer::refresh_tokens( TextLine & line ) { 
	
	if ( AudicleWindow::main()->m_syntax_query->parseLine ( line.str(), tokenized ) ) { 
	//if ( fakeTokenizer( line.str() , tokenized ) ) { 
		line.tokens() = tokenized;
	}
	
	line.dirty() = false;
}
开发者ID:ccrma,项目名称:audicle,代码行数:10,代码来源:audicle_ui_editor.cpp


示例7: PDFTextWordInterop

	PDFTextWordInterop *PDFTextLineInterop::getWords()
	{
		if(_words == NULL)
		{
			TextLine *line = (TextLine *)_textLine;
			TextWord *words = line->getWords();
			_words = new PDFTextWordInterop(_textBlock, this, words, 0);
		}
		return _words;
	}
开发者ID:NickSerg,项目名称:PDFLibNet,代码行数:10,代码来源:PDFTextBlockInterop.cpp


示例8: sizeof

const char& TextFileIterator::operator *() const {
	if (mLineIndex == mFile->getLineCount()) {
		return *"\0";
	}
	TextLine *line = mFile->mLines[mLineIndex];
	if (mLineFeedIndex != -1) {
		const char *lfBytes = line->getLineFeed();
		assert((size_t) mLineFeedIndex < sizeof(lfBytes) - 1);
		return lfBytes[mLineFeedIndex];
	}
	return (*line)[mColumnIndex];
}
开发者ID:satosystems,项目名称:me,代码行数:12,代码来源:TextFileIterator.cpp


示例9: PDFTextLineInterop

	PDFTextLineInterop *PDFTextLineInterop::getNext()
	{
		if(next == NULL)
		{
			TextLine *line = (TextLine *)_textLine;
			TextLine *nextLine = line->getNext();
			if(nextLine == NULL)
				return NULL;
			next = new PDFTextLineInterop(_textBlock, nextLine, _currentLine +1);
		}
		return next;
	}
开发者ID:NickSerg,项目名称:PDFLibNet,代码行数:12,代码来源:PDFTextBlockInterop.cpp


示例10:

TextFileIterator& TextFileIterator::operator --() {
	if (0 < mColumnIndex) {
		mColumnIndex--;
	} else {
		if (0 < mLineIndex) {
			mLineIndex--;
			TextLine *beforeLine = mFile->mLines[mLineIndex];
			mColumnIndex = beforeLine->size() - 1;
		}
	}
	return *this;
}
开发者ID:satosystems,项目名称:me,代码行数:12,代码来源:TextFileIterator.cpp


示例11: Q_ASSERT

void TextCursor::setPosition(const KTextEditor::Cursor& position, bool init)
{
  // any change or init? else do nothing
  if (!init && position.line() == line() && position.column() == m_column)
    return;

  // remove cursor from old block in any case
  if (m_block)
    m_block->removeCursor (this);

  // first: validate the line and column, else invalid
  if (position.column() < 0 || position.line () < 0 || position.line () >= m_buffer.lines ()) {
    if (!m_range)
      m_buffer.m_invalidCursors.insert (this);
    m_block = 0;
    m_line = m_column = -1;
    return;
  }

  // else, find block
  TextBlock *block = m_buffer.blockForIndex (m_buffer.blockForLine (position.line()));
  Q_ASSERT(block);

  // get line
  TextLine textLine = block->line (position.line());

#if 0 // this is no good idea, smart cursors don't do that, too, for non-wrapping cursors
  // now, validate column, else stay invalid
  if (position.column() > textLine->text().size()) {
    if (!m_range)
      m_buffer.m_invalidCursors.insert (this);
    m_block = 0;
    m_line = m_column = -1;
    return;
  }
#endif

  // if cursor was invalid before, remove it from invalid cursor list
  if (!m_range && !m_block && !init) {
    Q_ASSERT(m_buffer.m_invalidCursors.contains (this));
    m_buffer.m_invalidCursors.remove (this);
  }

  // else: valid cursor
  m_block = block;
  m_line = position.line () - m_block->startLine ();
  m_column = position.column ();
  m_block->insertCursor (this);
}
开发者ID:dividedmind,项目名称:kate,代码行数:49,代码来源:katetextcursor.cpp


示例12: getWordCount

	int PDFTextLineInterop::getWordCount()
	{
		if(_wordCount == -1)
		{
			TextLine *line = (TextLine *)_textLine;
			TextWord *words = line->getWords();
			TextWord *word = NULL;
			_wordCount = 0;
			while(words)
			{
				word = words;
				words = words->getNext();
				_wordCount++;
			}
		}
		return _wordCount;
	}
开发者ID:NickSerg,项目名称:PDFLibNet,代码行数:17,代码来源:PDFTextBlockInterop.cpp


示例13: towstring

stl::wstring towstring (const TextLine& line)
{
  if (sizeof (wchar_t) == 4)
    return stl::wstring ((const wchar_t*)line.TextUtf32 (), line.TextLength ());

  stl::wstring result;
  
  result.fast_resize (line.TextLength ());

  const void* source           = line.TextUtf32 ();
  size_t      source_size      = line.TextLength () * sizeof (unsigned int);
  void*       destination      = &result [0];
  size_t      destination_size = result.size () * sizeof (wchar_t);

  convert_encoding (common::Encoding_UTF32LE, source, source_size, common::Encoding_UTF16LE, destination, destination_size);  
  
  return result;
}
开发者ID:untgames,项目名称:funner,代码行数:18,代码来源:text_line.cpp


示例14: glLineWidth

void 
ShellContent::drawPromptLine( TextLine &s ) { 


    glLineWidth ( _fontWeight * 1.0 );
    bufferFont->draw_sub( _prompt + "% " ); // we lose kerning from one to the next, but otherwise this is pretty legal. 
    glLineWidth ( _fontWeight * 2.0 );
    bufferFont->draw_sub( s.str() );

}
开发者ID:ccrma,项目名称:audicle,代码行数:10,代码来源:audicle_ui_console.cpp


示例15: if

void
TextBuffer::addTextLine( TextLine &t, int pos ) { 
    if ( empty() ) 
        _lines[0] = t; 
    else if ( pos > (int)_lines.size() || pos == -1 )
        _lines.push_back(t);
    else 
        _lines.insert(_lines.begin()+pos, t ); 
	t.dirty() = true;
}
开发者ID:ccrma,项目名称:audicle,代码行数:10,代码来源:audicle_text_buffer.cpp


示例16: XCreateGC

void TextEdit::drawCursor(int cx, int cy, bool on, bool createGC /* = false */)
{
    bool cursorOn = on;
    if (!focusIn || inputDisabled) cursorOn = false;
    if (cx < windowX || cy < windowY || cx >= windowX + windowWidth || cy >= windowY + windowHeight) return;         // Cursor outside of window

    GC savedGC;
    if (createGC) {
        // Save the previous graphic contex, create a temporary GC
        savedGC = m_GC;
        m_GC = XCreateGC(m_Display, m_Window, 0, 0);
        setFont(textFont);
    }

    if (cursorOn) setForeground(fgColor);
    else setForeground(bgColor);

    int x = leftMargin + (cx - windowX) * dx;
    int y = topMargin + (cy - windowY) * dy;

    fillRectangle(I2Rectangle(x, y, dx, ascent + descent));

    if (cursorOn) setForeground(bgColor);
    else setForeground(fgColor);

    if (cy <= text.size())
    {
        TextLine* line;
        if (cy == text.size()) { line = &(endOfText); } else { line = &(text.getLine(cy)); }

        if (cx < line->length()) { drawString(x, y + ascent, line->getString() + cx, 1); }
    }

    if (createGC)
    {
        // Release the temporary graphic contex, restore the previous GC
        XFreeGC(m_Display, m_GC);
        m_GC = savedGC;
    }
}
开发者ID:tokar1,项目名称:mech-math,代码行数:40,代码来源:TextEdit.cpp


示例17: LineNumber

void TextDisplay::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) {
    if (canvas != nil) {
        int first = LineNumber(t);
        int last = LineNumber(b);
        for (int i = first; i <= last; ++i) {
            int begin = LineIndex(i, l, false);
            int end = LineIndex(i, r, false);
            TextLine* line = Line(i, false);
            if (line != nil) {
                line->Draw(this, i, begin, end);
            } else {
                IntCoord base = Base(i);
                IntCoord top = Top(i);
                painter->ClearRect(
		    canvas, l, Math::max(base, b), r, Math::min(top, t)
		);
            }
            if (caretline == i && caretindex >= begin && caretindex <= end) {
                ShowCaret();
            }
        }
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:23,代码来源:textdisplay.c


示例18: start

// ------------------------------------------------------
// StartWork
// ------------------------------------------------------
bool UpgradeWork::start(Island* island, const TextLine& line) {
	int x = line.get_int(1);
	int y = line.get_int(2);
	Tiles* tiles = island->getTiles();
	int idx = x + y * tiles->width;
	if ( tiles->getBuildingID(idx) == -1 ) {
		gContext->messages.report_error("There is no building at %d %d",x,y);
		return false;
	}
	// FIXME: check if there is only a regular work item
	if ( tiles->isActive(idx)) {
		gContext->messages.report_error("The building is active - upgrade is not available");
		return false;
	}
	if (island->checkRequirements(tiles->getBuildingID(idx), tiles->getLevel(idx) + 1)) {
		tiles->set_state(x,y,TS_ACTIVE);
		island->createWork(PT_UPGRADE,x,y,tiles->getBuildingID(idx),tiles->getLevel(idx)+1);
		return true;
	}
	return false;
}
开发者ID:amecky,项目名称:space,代码行数:24,代码来源:UpgradeWork.cpp


示例19: Slur


//.........这里部分代码省略.........
      ottava->setLen(w);
      ottava->setPlacement(Element::Placement::BELOW);
      sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "8vb"));

      ottava = new Ottava(gscore);
      ottava->setOttavaType(Ottava::Type::OTTAVA_15MA);
      ottava->setLen(w);
      sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "15ma"));

      ottava = new Ottava(gscore);
      ottava->setOttavaType(Ottava::Type::OTTAVA_15MB);
      ottava->setLen(w);
      ottava->setPlacement(Element::Placement::BELOW);
      sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "15mb"));

      ottava = new Ottava(gscore);
      ottava->setOttavaType(Ottava::Type::OTTAVA_22MA);
      ottava->setLen(w);
      sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "22ma"));

      ottava = new Ottava(gscore);
      ottava->setOttavaType(Ottava::Type::OTTAVA_22MB);
      ottava->setLen(w);
      sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "22mb"));


      Pedal* pedal = new Pedal(gscore);
      pedal->setLen(w);
      pedal->setBeginText("<sym>keyboardPedalPed</sym>");
      sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal"));
      pedal->setEndHook(true);

      pedal = new Pedal(gscore);
      pedal->setLen(w);
      pedal->setBeginHook(true);
      pedal->setEndHook(true);
      sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal"));

      pedal = new Pedal(gscore);
      pedal->setLen(w);
      pedal->setBeginHook(true);
      pedal->setEndHook(true);
      pedal->setEndHookType(HookType::HOOK_45);
      sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal"));

      pedal = new Pedal(gscore);
      pedal->setLen(w);
      pedal->setBeginHook(true);
      pedal->setBeginHookType(HookType::HOOK_45);
      pedal->setEndHook(true);
      pedal->setEndHookType(HookType::HOOK_45);
      sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal"));

      pedal = new Pedal(gscore);
      pedal->setLen(w);
      pedal->setBeginHook(true);
      pedal->setBeginHookType(HookType::HOOK_45);
      pedal->setEndHook(true);
      sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal"));

      Trill* trill = new Trill(gscore);
      trill->setLen(w);
      sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Trill line"));

      trill = new Trill(gscore);
      trill->setTrillType("upprall");
      trill->setLen(w);
      sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Upprall line"));

      trill = new Trill(gscore);
      trill->setTrillType("downprall");
      trill->setLen(w);
      sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Downprall line"));

      trill = new Trill(gscore);
      trill->setTrillType("prallprall");
      trill->setLen(w);
      sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Prallprall line"));

      trill = new Trill(gscore);
      trill->setTrillType("pure");
      trill->setLen(w);
      sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Wavy line"));

      TextLine* textLine = new TextLine(gscore);
      textLine->setLen(w);
      textLine->setBeginText("VII");
      textLine->setEndHook(true);
      sp->append(textLine, QT_TRANSLATE_NOOP("Palette", "Text line"));

      TextLine* line = new TextLine(gscore);
      line->setLen(w);
      line->setDiagonal(true);
      sp->append(line, QT_TRANSLATE_NOOP("Palette", "Line"));

      Ambitus* a = new Ambitus(gscore);
      sp->append(a, QT_TRANSLATE_NOOP("Palette", "Ambitus"));

      return sp;
      }
开发者ID:jasonmarkbeaton,项目名称:MuseScore,代码行数:101,代码来源:menus.cpp


示例20: newLine

void CompactHistoryScroll::addCells ( const Character a[], int count )
{
  TextLine newLine ( count );
  qCopy ( a,a+count,newLine.begin() );
  addCellsVector ( newLine );
}
开发者ID:permosegaard,项目名称:qtermwidget,代码行数:6,代码来源:History.cpp



注:本文中的TextLine类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TextNode类代码示例发布时间:2022-05-31
下一篇:
C++ TextLayout类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap