当前位置: 首页>>代码示例>>C++>>正文


C++ Cursor类代码示例

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


在下文中一共展示了Cursor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LanguageType

Global::Global(const Cursor &cursor, const Namespace &currentNamespace, Class *parent)
    : LanguageType(cursor, currentNamespace)
    , m_isConst(cursor.GetType().IsConst())
    , m_hasExplicitGetter(m_metaData.GetFlag(kMetaExplicitGetter))
    , m_hasExplicitSetter(m_metaData.GetFlag(kMetaExplicitSetter))
    , m_parent(parent)
    , m_name(cursor.GetSpelling())
    , m_qualifiedName(utils::GetQualifiedName(cursor, currentNamespace))
    , m_type(cursor.GetType().GetDisplayName())
{
    auto displayName = m_metaData.GetNativeString(kMetaDisplayName);

    if (displayName.empty())
    {
        m_displayName = m_qualifiedName;
    }
    else
    {
        m_displayName = 
            utils::GetQualifiedName(displayName, currentNamespace);
    }

	m_metaData.Check();
}
开发者ID:MaximDanilov,项目名称:sc-machine,代码行数:24,代码来源:Global.cpp

示例2: gtk_widget_get_window

void PageClientImpl::setCursor(const Cursor& cursor)
{
    if (!gtk_widget_get_realized(m_viewWidget))
        return;

    // [GTK] Widget::setCursor() gets called frequently
    // http://bugs.webkit.org/show_bug.cgi?id=16388
    // Setting the cursor may be an expensive operation in some backends,
    // so don't re-set the cursor if it's already set to the target value.
    GdkWindow* window = gtk_widget_get_window(m_viewWidget);
    GdkCursor* currentCursor = gdk_window_get_cursor(window);
    GdkCursor* newCursor = cursor.platformCursor().get();
    if (currentCursor != newCursor)
        gdk_window_set_cursor(window, newCursor);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:15,代码来源:PageClientImpl.cpp

示例3: LanguageType

Field::Field(
    const Cursor &cursor, 
    const Namespace &currentNamespace, 
    Class *parent
)
    : LanguageType( cursor, currentNamespace )
    , m_isConst( cursor.GetType( ).IsConst( ) )
    , m_parent( parent )
    , m_name( cursor.GetSpelling( ) )
    , m_type( cursor.GetType( ).GetDisplayName( ) )
{
    auto displayName = m_metaData.GetNativeString( kMetaDisplayName );

    if (displayName.empty( ))
        m_displayName = m_name;
    else
        m_displayName = displayName;

    m_explicitGetter = m_metaData.GetNativeString( kMetaExplicitGetter );
    m_hasExplicitGetter = !m_explicitGetter.empty( );

    m_explicitSetter = m_metaData.GetNativeString( kMetaExplicitSetter );
    m_hasExplicitSetter = !m_explicitSetter.empty( );
}
开发者ID:NickCullen,项目名称:CPP-Reflection,代码行数:24,代码来源:Field.cpp

示例4: lexStringConstant

/// Lex a string constant using the following regular expression: \"[^\"]*\"
static Cursor lexStringConstant(
    Cursor C,
    function_ref<void(StringRef::iterator Loc, const Twine &)> ErrorCallback) {
    assert(C.peek() == '"');
    for (C.advance(); C.peek() != '"'; C.advance()) {
        if (C.isEOF()) {
            ErrorCallback(
                C.location(),
                "end of machine instruction reached before the closing '\"'");
            return None;
        }
    }
    C.advance();
    return C;
}
开发者ID:Microsoft,项目名称:llvm-1,代码行数:16,代码来源:MILexer.cpp

示例5: doDispatch

void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
{
	switch (cmd.action()) {
	case LFUN_INSET_MODIFY:
		if (cmd.getArg(0) == "ert") {
			cur.recordUndoInset(ATOMIC_UNDO, this);
			setStatus(cur, string2params(to_utf8(cmd.argument())));
			break;
		}
		//fall-through
	default:
		InsetCollapsable::doDispatch(cur, cmd);
		break;
	}

}
开发者ID:315234,项目名称:lyx-retina,代码行数:16,代码来源:InsetERT.cpp

示例6: setCursor

void Widget::setCursor(const Cursor& cursor)
{
    GdkCursor* pcur = cursor.impl();

    // http://bugs.webkit.org/show_bug.cgi?id=16388
    // [GTK] Widget::setCursor() gets called frequently
    //
    // gdk_window_set_cursor() in certain GDK backends seems to be an
    // expensive operation, so avoid it if possible.

    if (pcur == m_data->cursor)
        return;

    gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(root()->hostWindow()->platformWindow())->window, pcur);
    m_data->cursor = pcur;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:16,代码来源:BCWidgetGtk.cpp

示例7: LoadAnonymous

void Enum::LoadAnonymous(
    std::vector<Global*> &output, 
    const Cursor &cursor, 
    const Namespace &currentNamespace
)
{
    for (auto &child : cursor.GetChildren( ))
    {
        if (child.GetKind( ) == CXCursor_EnumConstantDecl)
        {
            output.emplace_back( 
                new Global( child, currentNamespace, nullptr ) 
            );
        }
    }
}
开发者ID:NickCullen,项目名称:CPP-Reflection,代码行数:16,代码来源:Enum.cpp

示例8: maybeLexIndexAndName

static Cursor maybeLexIndexAndName(Cursor C, MIToken &Token, StringRef Rule,
                                   MIToken::TokenKind Kind) {
  if (!C.remaining().startswith(Rule) || !isdigit(C.peek(Rule.size())))
    return None;
  auto Range = C;
  C.advance(Rule.size());
  auto NumberRange = C;
  while (isdigit(C.peek()))
    C.advance();
  StringRef Number = NumberRange.upto(C);
  unsigned StringOffset = Rule.size() + Number.size();
  if (C.peek() == '.') {
    C.advance();
    ++StringOffset;
    while (isIdentifierChar(C.peek()))
      C.advance();
  }
  Token.reset(Kind, Range.upto(C))
      .setIntegerValue(APSInt(Number))
      .setStringValue(Range.upto(C).drop_front(StringOffset));
  return C;
}
开发者ID:BNieuwenhuizen,项目名称:llvm,代码行数:22,代码来源:MILexer.cpp

示例9: doDispatch

void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
{
	LYXERR(Debug::ACTION, "InsetText::doDispatch()"
		<< " [ cmd.action() = " << cmd.action() << ']');

	if (getLayout().isPassThru()) {
		// Force any new text to latex_language FIXME: This
		// should only be necessary in constructor, but new
		// paragraphs that are created by pressing enter at
		// the start of an existing paragraph get the buffer
		// language and not latex_language, so we take this
		// brute force approach.
		cur.current_font.setLanguage(latex_language);
		cur.real_current_font.setLanguage(latex_language);
	}

	switch (cmd.action()) {
	case LFUN_PASTE:
	case LFUN_CLIPBOARD_PASTE:
	case LFUN_SELECTION_PASTE:
	case LFUN_PRIMARY_SELECTION_PASTE:
		text_.dispatch(cur, cmd);
		// If we we can only store plain text, we must reset all
		// attributes.
		// FIXME: Change only the pasted paragraphs
		fixParagraphsFont();
		break;

	case LFUN_INSET_DISSOLVE: {
		bool const main_inset = &buffer().inset() == this;
		bool const target_inset = cmd.argument().empty() 
			|| cmd.getArg(0) == insetName(lyxCode());
		bool const one_cell = nargs() == 1;

		if (!main_inset && target_inset && one_cell) {
			// Text::dissolveInset assumes that the cursor
			// is inside the Inset.
			if (&cur.inset() != this)
				cur.pushBackward(*this);
			cur.beginUndoGroup();
			text_.dispatch(cur, cmd);
			cur.endUndoGroup();
		} else
			cur.undispatched();
		break;
	}

	default:
		text_.dispatch(cur, cmd);
	}
	
	if (!cur.result().dispatched())
		Inset::doDispatch(cur, cmd);
}
开发者ID:rpavlik,项目名称:lyx-lucid-backport,代码行数:54,代码来源:InsetText.cpp

示例10: maybeLexIntegerLiteral

static Cursor maybeLexIntegerLiteral(Cursor C, MIToken &Token) {
    if (!isdigit(C.peek()) && (C.peek() != '-' || !isdigit(C.peek(1))))
        return None;
    auto Range = C;
    C.advance();
    while (isdigit(C.peek()))
        C.advance();
    StringRef StrVal = Range.upto(C);
    Token = MIToken(MIToken::IntegerLiteral, StrVal, APSInt(StrVal));
    return C;
}
开发者ID:Microsoft,项目名称:llvm-1,代码行数:11,代码来源:MILexer.cpp

示例11: hideInline

void GuiCompleter::hideInline(Cursor & cur)
{
	gui_->bufferView().setInlineCompletion(cur, DocIterator(cur.buffer()), docstring());
	inlineVisible_ = false;
	
	if (inline_timer_.isActive())
		inline_timer_.stop();
	
	// Trigger asynchronous part of hideInline. We might be
	// in a dispatcher here and the setModel call might
	// trigger focus events which is are not healthy here.
	QTimer::singleShot(0, this, SLOT(asyncHideInline()));

	// mark that the asynchronous part will reset the model
	if (!popupVisible())
		modelActive_ = false;
}
开发者ID:bsjung,项目名称:Lyx,代码行数:17,代码来源:GuiCompleter.cpp

示例12: lock

    /* must call this on a delete so we clean up the cursors. */
    void ClientCursor::aboutToDelete(const DiskLoc& dl) {
        recursive_scoped_lock lock(ccmutex);

        CCByLoc::iterator j = byLoc.lower_bound(dl);
        CCByLoc::iterator stop = byLoc.upper_bound(dl);
        if ( j == stop )
            return;

        vector<ClientCursor*> toAdvance;

        while ( 1 ) {
            toAdvance.push_back(j->second);
            DEV assert( j->first == dl );
            ++j;
            if ( j == stop )
                break;
        }

        wassert( toAdvance.size() < 5000 );
        
        for ( vector<ClientCursor*>::iterator i = toAdvance.begin(); i != toAdvance.end(); ++i ){
            ClientCursor* cc = *i;
            
            if ( cc->_doingDeletes ) continue;

            Cursor *c = cc->c.get();
            if ( c->capped() ){
                delete cc;
                continue;
            }
            
            c->checkLocation();
            DiskLoc tmp1 = c->refLoc();
            if ( tmp1 != dl ) {
                /* this might indicate a failure to call ClientCursor::updateLocation() */
                problem() << "warning: cursor loc " << tmp1 << " does not match byLoc position " << dl << " !" << endl;
            }
            c->advance();
            if ( c->eof() ) {
                // advanced to end -- delete cursor
                delete cc;
            }
            else {
                wassert( c->refLoc() != dl );
                cc->updateLocation();
            }
        }
    }
开发者ID:erickt,项目名称:mongo,代码行数:49,代码来源:clientcursor.cpp

示例13: popupActivated

void GuiCompleter::popupActivated(const QString & completion)
{
	Cursor cur = gui_->bufferView().cursor();
	cur.screenUpdateFlags(Update::None);
	
	cur.recordUndo();

	docstring prefix = cur.inset().completionPrefix(cur);
	docstring postfix = qstring_to_ucs4(completion.mid(prefix.length()));
	cur.inset().insertCompletion(cur, postfix, true);
	hidePopup(cur);
	hideInline(cur);
	
	if (cur.result().update())
		gui_->bufferView().processUpdateFlags(cur.result().update());
}
开发者ID:bsjung,项目名称:Lyx,代码行数:16,代码来源:GuiCompleter.cpp

示例14: updateModel

void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate)
{
	// value which should be kept selected
	QString old = currentCompletion();
	if (old.length() == 0)
		old = last_selection_;

	// set whether rtl
	bool rtl = false;
	if (cur.inTexted()) {
		Paragraph const & par = cur.paragraph();
		Font const & font =
			par.getFontSettings(cur.bv().buffer().params(), cur.pos());
		rtl = font.isVisibleRightToLeft();
	}
	popup()->setLayoutDirection(rtl ? Qt::RightToLeft : Qt::LeftToRight);

	// set new model
	CompletionList const * list = cur.inset().createCompletionList(cur);
	model_->setList(list);
	modelActive_ = true;
	if (list->sorted())
		setModelSorting(QCompleter::CaseSensitivelySortedModel);
	else
		setModelSorting(QCompleter::UnsortedModel);

	// set prefix
	QString newPrefix = toqstr(cur.inset().completionPrefix(cur));
	if (newPrefix != completionPrefix())
		setCompletionPrefix(newPrefix);

	// show popup
	if (popupUpdate)
		updatePopup(cur);

	// restore old selection
	setCurrentCompletion(old);
	
	// if popup is not empty, the new selection will
	// be our last valid one
	if (popupVisible() || inlineVisible()) {
		QString const & s = currentCompletion();
		if (s.length() > 0)
			last_selection_ = s;
		else
			last_selection_ = old;
	}

	// show inline completion
	if (inlineUpdate)
		updateInline(cur, currentCompletion());
}
开发者ID:bsjung,项目名称:Lyx,代码行数:52,代码来源:GuiCompleter.cpp

示例15: findWordStart

Range CodeCompletionModelControllerInterface::completionRange(View* view, const Cursor &position)
{
    Cursor end = position;

    QString text = view->document()->line(end.line());

    static QRegExp findWordStart( "\\b([_\\w]+)$" );
    static QRegExp findWordEnd( "^([_\\w]*)\\b" );

    Cursor start = end;

    if (findWordStart.lastIndexIn(text.left(end.column())) >= 0)
        start.setColumn(findWordStart.pos(1));

    if (findWordEnd.indexIn(text.mid(end.column())) >= 0)
        end.setColumn(end.column() + findWordEnd.cap(1).length());

    //kDebug()<<"returning:"<<Range(start,end);
    return Range(start, end);
}
开发者ID:ktuan89,项目名称:kate-4.8.0,代码行数:20,代码来源:codecompletionmodelcontrollerinterface.cpp


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