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

C++ setter函数代码示例

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

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



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

示例1: ar

bool rs::jsapi::Object::Set(JSContext* cx, JS::HandleObject obj, JS::HandleId id, bool strict, JS::MutableHandleValue vp) {
    JSAutoRequest ar(cx);
    auto state = Object::GetState(cx, obj);
    if (state != nullptr && state->setter != nullptr) {
        Value value(cx, vp);
        
        char nameBuffer[256];
        auto name = JSID_TO_STRING(id);                
        auto nameLength = JS_EncodeStringToBuffer(cx, name, nameBuffer, sizeof(nameBuffer) - 1);
        
        try {
            if (nameLength < sizeof(nameBuffer)) {
                nameBuffer[nameLength] = '\0';    
                state->setter(nameBuffer, value);    
            } else {
                std::vector<char> nameVector(nameLength + 1);
                nameLength = JS_EncodeStringToBuffer(cx, name, &nameVector[0], nameVector.size() - 1);
                nameVector[nameLength] = '\0';
                state->setter(&nameVector[0], value);
            }

            return true;
        } catch (const std::exception& ex) {
            JS_ReportError(cx, ex.what());
            return false;
        }
    } else {
        // TODO: what will this do to the JS?
        vp.setUndefined();
        return true;
    }
}
开发者ID:dumganhar,项目名称:libjsapi,代码行数:32,代码来源:object.cpp


示例2: QWidget

MeshesTab::MeshesTab(QWidget *parent) : QWidget(parent) {
    warnDisabledPickingCheck.setChecked(true);
    warnDisabledPickingCheck.setToolTip(tr("Mesh picking is disabled if your graphics driver does not at least support OpenGL 3.0."));
    visibilityGroupLayout.addWidget(&meshInOrthoVPsCheck);
    visibilityGroupLayout.addWidget(&meshIn3DVPCheck);
    visibilityGroup.setLayout(&visibilityGroupLayout);

    static auto opacityControls = [this/* required for GCC8*/](auto & label, auto & slider, auto & spin, auto & layout, auto setter){
        slider.setRange(0, 100);
        slider.setOrientation(Qt::Horizontal);
        spin.setRange(0, 1);
        spin.setSingleStep(0.01);
        spin.setPrefix("×");
        layout.addWidget(&label);
        layout.addWidget(&slider);
        layout.addWidget(&spin);
        QObject::connect(&spin, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [&slider, setter](const double value) {
            {
                QSignalBlocker blocker{slider};
                slider.setValue(value * 100);
            }
            setter(value);
        });
        QObject::connect(&slider, static_cast<void(QSlider::*)(int)>(&QSlider::valueChanged), [&spin, setter](const int value) {
            {
                QSignalBlocker blocker{spin};
                spin.setValue(value/100.);
            }
            setter(spin.value());
        });
    };
    opacityControls(alphaLabel3d, alphaSlider3d, alphaSpin3d, alphaLayout, [](auto val){state->viewer->setMesh3dAlphaFactor(val);});
    opacityControls(alphaLabelSlicing, alphaSliderSlicing, alphaSpinSlicing, alphaLayout, [](auto val){state->viewer->setMeshSlicingAlphaFactor(val);});

    mainLayout.addWidget(&visibilityGroup);
    for (auto * sep : {&separator1, &separator2}) {
        sep->setFrameShape(QFrame::HLine);
        sep->setFrameShadow(QFrame::Sunken);
    }
    mainLayout.addWidget(&separator1);
    mainLayout.addLayout(&alphaLayout);
    mainLayout.addWidget(&separator2);
    mainLayout.addWidget(&warnDisabledPickingCheck);
    mainLayout.setAlignment(Qt::AlignTop);
    setLayout(&mainLayout);
    QObject::connect(&meshInOrthoVPsCheck, &QCheckBox::clicked, [](const bool checked) { state->viewerState->meshDisplay.setFlag(TreeDisplay::ShowInOrthoVPs, checked); });
    QObject::connect(&meshIn3DVPCheck, &QCheckBox::clicked, [](const bool checked) { state->viewerState->meshDisplay.setFlag(TreeDisplay::ShowIn3DVP, checked); });
    QObject::connect(state->viewer, &Viewer::mesh3dAlphaFactorChanged, &alphaSpin3d, &QDoubleSpinBox::setValue);
    QObject::connect(state->viewer, &Viewer::meshSlicingAlphaFactorChanged, &alphaSpinSlicing, &QDoubleSpinBox::setValue);
}
开发者ID:knossos-project,项目名称:knossos,代码行数:50,代码来源:meshestab.cpp


示例3: KSI_CTX_setUri

static int KSI_CTX_setUri(KSI_CTX *ctx,
		const char *uri, const char *loginId, const char *key,
		int (*setter)(KSI_NetworkClient*, const char*, const char *, const char *)){
	int res = KSI_UNKNOWN_ERROR;

	KSI_ERR_clearErrors(ctx);
	if (ctx == NULL || uri == NULL) {
		KSI_pushError(ctx, res = KSI_INVALID_ARGUMENT, NULL);
		goto cleanup;
	}

	if (ctx->isCustomNetProvider){
		KSI_pushError(ctx, res = KSI_INVALID_ARGUMENT, "Unable to set url after initial network provider replacement.");
		goto cleanup;
	}

	res = setter(ctx->netProvider, uri, loginId, key);
	if (res != KSI_OK) {
		KSI_pushError(ctx,res, NULL);
		goto cleanup;
	}

	res = KSI_OK;

cleanup:

	return res;
}
开发者ID:GuardTime,项目名称:libksi,代码行数:28,代码来源:base.c


示例4: brute_nearest

void brute_nearest(DistanceCallback& dcb, const node<P>* query,
		v_array<d_node<P> > zero_set, ScalarType* upper_bound,
		v_array<v_array<P> > &results,
		v_array<v_array<d_node<P> > > &spare_zero_sets)
{
	if (query->num_children > 0)
	{
		v_array<d_node<P> > new_zero_set = pop(spare_zero_sets);
		node<P> * query_chi = query->children;
		brute_nearest(dcb, query_chi, zero_set, upper_bound, results, spare_zero_sets);
		ScalarType* new_upper_bound = alloc_upper();

		node<P> *child_end = query->children + query->num_children;
		for (query_chi++;query_chi != child_end; query_chi++)
		{
			setter(new_upper_bound,*upper_bound + query_chi->parent_dist);
			copy_zero_set(dcb, query_chi, new_upper_bound, zero_set, new_zero_set);
			brute_nearest(dcb, query_chi, new_zero_set, new_upper_bound, results, spare_zero_sets);
		}
		free (new_upper_bound);
		new_zero_set.index = 0;
		push(spare_zero_sets, new_zero_set);
	}
	else
	{
		v_array<P> temp;
		push(temp, query->p);
		d_node<P> *end = zero_set.elements + zero_set.index;
		for (d_node<P> *ele = zero_set.elements; ele != end ; ele++)
			if (ele->dist <= *upper_bound)
				push(temp, ele->n->p);
		push(results,temp);
	}
}
开发者ID:42MachineLearning,项目名称:shogun,代码行数:34,代码来源:covertree.hpp


示例5: setter

nsresult
PeerConnectionMedia::UpdateMediaPipelines()
{
  // The GMP code is all the way on the other side of webrtc.org, and it is not
  // feasible to plumb error information all the way back. So, we set up a
  // handle to the PC (for the duration of this call) in a global variable.
  // This allows the GMP code to report errors to the PC.
  WebrtcGmpPCHandleSetter setter(mParentHandle);

  for (RefPtr<TransceiverImpl>& transceiver : mTransceivers) {
    nsresult rv = transceiver->UpdateConduit();
    if (NS_FAILED(rv)) {
      return rv;
    }

    if (!transceiver->IsVideo()) {
      rv = transceiver->SyncWithMatchingVideoConduits(mTransceivers);
      if (NS_FAILED(rv)) {
        return rv;
      }
      // TODO: If there is no audio, we should probably de-sync. However, this
      // has never been done before, and it is unclear whether it is safe...
    }
  }

  return NS_OK;
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:27,代码来源:PeerConnectionMedia.cpp


示例6: raw_match

void raw_match(Expr ptree, Expr arg, Env* env, Expr*(*setter)(Symbol,Env*)) {
	switch(ptree.type) {
	case IGNORE:
		break;
		
	case SYMBOL:
		*setter(ptree.sym, env) = arg;
		break;
	
	case NIL:
		if(arg.type != NIL)
			error(L"Unmatched nil in parameter tree");
		break;
	
	case PAIR:
		if(arg.type != PAIR)
			error(L"Unmatched pair in parameter tree");
		raw_match(ptree.pair[0], arg.pair[0], env, setter);
		raw_match(ptree.pair[1], arg.pair[1], env, setter);
		break;
	
	default:
		error(L"Unexpected type in parameter tree");
		break;
	}
}
开发者ID:carado,项目名称:plisp,代码行数:26,代码来源:raw_match.c


示例7: setValue

void StringPropertyHandler::setValue(QString value)
{
    if (QMetaObject::invokeMethod(_target, setter().constData(), QGenericArgument("QString", &value)))
    {
        _changed = true;
    }
}
开发者ID:wsaftly,项目名称:SKIRT-1,代码行数:7,代码来源:StringPropertyHandler.cpp


示例8: lqtL_newindexfunc

static int lqtL_newindexfunc (lua_State *L) {
    if (!lua_isuserdata(L, 1) && lua_islightuserdata(L, 1)) return 0;
    lua_getmetatable(L, 1);
    lua_pushliteral(L, "__set");
    lua_rawget(L, -2);
    if (lua_istable(L, -1)) {
        lua_pushvalue(L, 2);
        lua_gettable(L, -2);
        if (lua_isfunction(L, -1)) {
            lua_CFunction setter = lua_tocfunction(L, -1);
            if (!setter) return luaL_error(L, "Invalid setter %s", lua_tostring(L, 2));
            return setter(L);
        }
    }
    lua_settop(L, 3); // (=3)
    lua_getfenv(L, 1); // (+1)
    if (!lua_istable(L, -1)) {
        lua_pop(L, 1); // (+0)
        return 0;
    }
    lua_remove(L, 1); // (+0)
    lua_insert(L, 1); // (+0)
    lua_rawset(L, 1); // (-2)
    return 0;
}
开发者ID:Rocket-Buddha,项目名称:GameCode4,代码行数:25,代码来源:lqt_common.cpp


示例9: GET_FUNC

size_t TSimpleLemmer::CopyFromMystem(MystemAnalysesHandle* analyses, const Wtroka& src, TWLemmaArray& out) {
    size_t count = GET_FUNC(Lib, MystemAnalysesCount)(analyses);

    out.clear();
    out.resize(count);

    for (size_t i = 0; i != count; ++i) {
         MystemLemmaHandle* lemma = GET_FUNC(Lib, MystemLemma)(analyses, i);
         NLemmerAux::TSimpleLemmaSetter setter(out[i]);
         setter.SetLemma(GET_FUNC(Lib, MystemLemmaText)(lemma),
                         GET_FUNC(Lib, MystemLemmaTextLen)(lemma),
                         GET_FUNC(Lib, MystemLemmaForm)(lemma),
                         GET_FUNC(Lib, MystemLemmaFormLen)(lemma),
                         GET_FUNC(Lib, MystemLemmaStemGram)(lemma),
                         GET_FUNC(Lib, MystemLemmaFlexGram)(lemma),
                         GET_FUNC(Lib, MystemLemmaFlexGramNum)(lemma),
                         GET_FUNC(Lib, MystemLemmaFlexLen)(lemma),
                         GET_FUNC(Lib, MystemLemmaRuleId)(lemma),
                         GET_FUNC(Lib, MystemLemmaQuality)(lemma),
                         src);
    }

    DeleteAnalyses(analyses);
    return count;
}
开发者ID:johny-nsk,项目名称:tomita-parser,代码行数:25,代码来源:extlemmer.cpp


示例10: KSI_CTX_setTimeoutSeconds

static int KSI_CTX_setTimeoutSeconds(KSI_CTX *ctx, int timeout, int (*setter)(KSI_NetworkClient*, int)){
	int res = KSI_UNKNOWN_ERROR;
	KSI_NetworkClient *client = NULL;

	KSI_ERR_clearErrors(ctx);
	if (ctx == NULL || ctx->netProvider == NULL) {
		KSI_pushError(ctx, res = KSI_INVALID_ARGUMENT, NULL);
		goto cleanup;
	}

	if (ctx->isCustomNetProvider){
		KSI_pushError(ctx, res = KSI_INVALID_ARGUMENT, "Unable to set timeout after initial network provider replacement.");
		goto cleanup;
	}

	client = ctx->netProvider;

	res = setter(client, timeout);
	if (res != KSI_OK) {
		KSI_pushError(ctx,res, NULL);
		goto cleanup;
	}

	res = KSI_OK;

cleanup:

	return res;
}
开发者ID:GuardTime,项目名称:libksi,代码行数:29,代码来源:base.c


示例11: getAndSetIf

void getAndSetIf(bool conditionalValue, Function&& setter, Keys&&... keys) {
    auto current = get<DataType, Traits>(keys...);
    if (current == conditionalValue) {
        current = not conditionalValue;
        setter();
        set<DataType, Traits>(current, std::forward<Keys>(keys)...);
    }
}
开发者ID:Senspark,项目名称:ee-library,代码行数:8,代码来源:EEDataUtils.hpp


示例12: setCouponPricer

 void setCouponPricer(
               const Leg& leg,
               const boost::shared_ptr<FloatingRateCouponPricer>& pricer) {
     PricerSetter setter(pricer);
     for (Size i=0; i<leg.size(); ++i) {
         leg[i]->accept(setter);
     }
 }
开发者ID:grantathon,项目名称:nquantlib64,代码行数:8,代码来源:couponpricer.cpp


示例13: set_ttymode

static int
set_ttymode(int fd, conmode *t, void (*setter)(conmode *, void *), void *arg)
{
    conmode r;
    if (!getattr(fd, t)) return 0;
    r = *t;
    setter(&r, arg);
    return setattr(fd, &r);
}
开发者ID:takuto-h,项目名称:ruby,代码行数:9,代码来源:console.c


示例14: setter

void playsingle_controller::linger()
{
	LOG_NG << "beginning end-of-scenario linger\n";
	browse_ = true;
	linger_ = true;

	// If we need to set the status depending on the completion state
	// the key to it is here.
	gui_->set_game_mode(game_display::LINGER_SP);

	// this is actually for after linger mode is over -- we don't
	// want to stay stuck in linger state when the *next* scenario
	// is over.
	set_completion setter(gamestate_,"running");

	// change the end-turn button text to its alternate label
	gui_->get_theme().refresh_title2("button-endturn", "title2");
	gui_->invalidate_theme();
	gui_->redraw_everything();

	// End all unit moves
	for (unit_map::iterator u = units_.begin(); u != units_.end(); ++u) {
		u->set_user_end_turn(true);
	}

	start_pass_scenario_anim(get_end_level_data().result);

	try {
		// Same logic as single-player human turn, but
		// *not* the same as multiplayer human turn.
		gui_->enable_menu("endturn", true);
		while(!end_turn_) {
			// Reset the team number to make sure we're the right team.
			player_number_ = first_player_;
			play_slice();
			gui_->draw();
		}
	} catch(game::load_game_exception& lge) {
		// Loading a new game is effectively a quit.
		if (lge.game != "") {
			gamestate_ = game_state();
		}
		throw lge;
	}

	if (gui_->pass_scenario_anim_id() != -1) {
		gui_->erase_screen_anim(gui_->pass_scenario_anim_id());
	}

	// revert the end-turn button text to its normal label
	gui_->get_theme().refresh_title2("button-endturn", "title");
	gui_->invalidate_theme();
	gui_->redraw_everything();
	gui_->set_game_mode(game_display::RUNNING);

	LOG_NG << "ending end-of-scenario linger\n";
}
开发者ID:coolsee,项目名称:War-Of-Kingdom,代码行数:57,代码来源:playsingle_controller.cpp


示例15: addTag

  void addTag(const char *tag, const QString& value) {
    GstTagSetter *s = setter();
    if (!s) {
      return;
    }

    gst_tag_setter_add_tags(s, GST_TAG_MERGE_REPLACE, tag, value.toUtf8().data(), NULL);

    gst_object_unref(s);
  }
开发者ID:ballock,项目名称:cameraplus,代码行数:10,代码来源:qtcammetadata.cpp


示例16: setter

void playsingle_controller::linger()
{
	mouse_handler_.do_right_click(false);

	browse_ = true;
	linger_ = true;

	// If we need to set the status depending on the completion state
	// the key to it is here.
	gui_->set_game_mode(game_display::LINGER_SP);

	// this is actually for after linger mode is over -- we don't
	// want to stay stuck in linger state when the *next* scenario
	// is over.
	set_completion setter(gamestate_,"running");

	// change the end-turn button text to its alternate label
	gui_->redraw_everything();

	// button be reconstruct.
	if (lobby->chat.ready()) {
		refresh_chat_button(*gui_, "misc/network-disconnected.png");
	}

	start_pass_scenario_anim(get_end_level_data().result);

	try {
		// Same logic as single-player human turn, but
		// *not* the same as multiplayer human turn.
		gui_->set_theme_object_active("endturn", true);
		while(!end_turn_) {
			// Reset the team number to make sure we're the right team.
			player_number_ = first_player_;
			play_slice();
			gui_->draw();
		}
	} catch(game::load_game_exception& lge) {
		// Loading a new game is effectively a quit.
		if (lge.game != "") {
			gamestate_ = game_state();
		}
		throw lge;
	}

	if (gui_->pass_scenario_anim_id() != -1) {
		gui_->erase_area_anim(gui_->pass_scenario_anim_id());
	}

	// revert the end-turn button text to its normal label
	gui_->redraw_everything();
	gui_->set_game_mode(game_display::RUNNING);

	LOG_NG << "ending end-of-scenario linger\n";
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:54,代码来源:playsingle_controller.cpp


示例17: getCurrentFrame

void FunctionKeyframeNavigator::toggle() {
  if (!m_curve) return;
  int frame    = getCurrentFrame();
  double value = m_curve->getValue(frame);
  if (m_curve->isKeyframe(frame))
    KeyframeSetter::removeKeyframeAt(m_curve.getPointer(), frame);
  else {
    KeyframeSetter setter(m_curve.getPointer());
    setter.createKeyframe(frame);
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:11,代码来源:functionkeyframenavigator.cpp


示例18: set_random

static void set_random(Tox *m, bool (*setter)(Tox *, const uint8_t *, size_t, TOX_ERR_SET_INFO *), size_t length)
{
    VLA(uint8_t, text, length);
    uint32_t i;

    for (i = 0; i < length; ++i) {
        text[i] = rand();
    }

    setter(m, text, SIZEOF_VLA(text), 0);
}
开发者ID:GrayHatter,项目名称:toxcore,代码行数:11,代码来源:save_friend_test.c


示例19: set_random

static void set_random(Tox *m, bool (*setter)(Tox *, const uint8_t *, size_t, Tox_Err_Set_Info *), size_t length)
{
    VLA(uint8_t, text, length);
    uint32_t i;

    for (i = 0; i < length; ++i) {
        text[i] = random_u08();
    }

    setter(m, text, SIZEOF_VLA(text), nullptr);
}
开发者ID:TokTok,项目名称:toxcore,代码行数:11,代码来源:save_friend_test.c


示例20: setGetter

GetterSetter* GetterSetter::withGetter(VM& vm, JSGlobalObject* globalObject, JSObject* newGetter)
{
    if (isGetterNull()) {
        setGetter(vm, globalObject, newGetter);
        return this;
    }
    
    GetterSetter* result = GetterSetter::create(vm, globalObject);
    result->setGetter(vm, globalObject, newGetter);
    result->setSetter(vm, globalObject, setter());
    return result;
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:12,代码来源:GetterSetter.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ settextstyle函数代码示例发布时间:2022-05-30
下一篇:
C++ settable函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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