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

C++ var类代码示例

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

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



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

示例1: switch

bool var::ahead::operator()(const var& x, const var& y) const {
    long r = x.primary() - y.primary();
    if (r)
        return r < 0;
    switch (x.primary()) {
    case Primary::Object: {
        r = reinterpret_cast<long>(x.object().type) - reinterpret_cast<long>(y.object().type);
        if (r)
            return r < 0;
        return x.object().compare(y.object()) < 0;
    }
    case Primary::Key:  {
        r = x.key().kind() - y.key().kind();
        if (r)
            return r < 0;
        return x.key().key < y.key().key;
    }
    case Primary::Symbol:
        return x.ptr < y.ptr;
    case Primary::Tuple: {
        r = x.tuple().size - y.tuple().size;
        if (r)
            return r < 0;
        for (uint i = 0; i < x.tuple().size; ++i)
            if ((*this)(x.tuple()[i], y.tuple()[i]))
                return true;
    }
    return false;
    }
    return 0;
}
开发者ID:hyln9,项目名称:nV,代码行数:31,代码来源:var.cpp


示例2: axes

void MQwt::axes(var iXLabel, var iYLabel)
{
    mPlot->setAxisTitle(QwtPlot::xBottom, iXLabel.str());
    mPlot->setAxisTitle(QwtPlot::yLeft, iYLabel.str());
}
开发者ID:pgarner,项目名称:libube,代码行数:5,代码来源:qwt.cpp


示例3: atanh

    /**
     * The inverse hyperbolic tangent function for variables (C99).
     *
     * The derivative is defined by
     *
     * \f$\frac{d}{dx} \mbox{atanh}(x) = \frac{1}{1 - x^2}\f$.
     *
       \f[
       \mbox{atanh}(x) =
       \begin{cases}
         \textrm{NaN} & \mbox{if } x < -1\\
         \tanh^{-1}(x) & \mbox{if } -1\leq x \leq 1 \\
         \textrm{NaN} & \mbox{if } x > 1\\[6pt]
         \textrm{NaN} & \mbox{if } x = \textrm{NaN}
       \end{cases}
       \f]

       \f[
       \frac{\partial\, \mbox{atanh}(x)}{\partial x} =
       \begin{cases}
         \textrm{NaN} & \mbox{if } x < -1\\
         \frac{\partial\, \tanh^{-1}(x)}{\partial x} & \mbox{if } -1\leq x\leq 1 \\
         \textrm{NaN} & \mbox{if } x > 1\\[6pt]
         \textrm{NaN} & \mbox{if } x = \textrm{NaN}
       \end{cases}
       \f]

       \f[
       \tanh^{-1}(x)=\frac{1}{2}\ln\left(\frac{1+x}{1-x}\right)
       \f]

       \f[
       \frac{\partial \, \tanh^{-1}(x)}{\partial x} = \frac{1}{1-x^2}
       \f]
       *
       * @param a The variable.
       * @return Inverse hyperbolic tangent of the variable.
       * @throw std::domain_error if a < -1 or a > 1
       */
    inline var atanh(const var& a) {
      return var(new atanh_vari(atanh(a.val()), a.vi_));
    }
开发者ID:stan-dev,项目名称:math,代码行数:42,代码来源:atanh.hpp


示例4:

 /**
  * Equality operator comparing a variable's value and a double
  * (C++).
  *
  * @param a First variable.  
  * @param b Second value.
  * @return True if the first variable's value is the same as the
  * second value.
  */
 inline bool operator==(const var& a, const double b) {
   return a.val() == b;
 }
开发者ID:Alienfeel,项目名称:stan,代码行数:12,代码来源:operator_equal.hpp


示例5: convertVar

inline static std::string convertVar(const var& val)
{
    const std::type_info* x = &val.GetType();


    if (*x == typeid(int)) {

        /*64Bit*/
        char  str[24];
#ifndef _SAFE_C
        sprintf(str, "%d", val.var_cast<int>());
#else
        sprintf_s(str, "%d", val.var_cast<int>());
#endif

        return std::string(str);
    }

    else if (*x == typeid(double)) {


        char  str[40];
#ifndef _SAFE_C
        sprintf(str, "%.8lf", val.var_cast<double>());
#else
        sprintf_s(str, "%.8lf", val.var_cast<double>());
#endif
        return std::string(str);
    }

    else if(*x == typeid(unsigned int)) {

        /*64Bit*/
        char  str[24];
#ifndef _SAFE_C
        sprintf(str, "0x%x", val.var_cast<unsigned int>());
#else
        sprintf_s(str, "0x%x", val.var_cast<unsigned int>());
#endif
        return std::string(str);
    }

    else if (*x == typeid(std::string)) {
        std::string str = '\"' + val.var_cast<std::string>() + '\"';
        return str;
    }

    else if (*x == typeid(bool)) {
        if (val.var_cast<bool>())
            return std::string("true");
        else
            return std::string("false");
    }

    else if (*x == typeid(char)) {
        char str[2] = { 0 };
        str[0] = val.var_cast<char>();
        return std::string(str);
    }

    else if (*x == typeid(unsigned char)) {
        char str[2] = { 0 };
        str[0] = val.var_cast<unsigned char>();
        return std::string(str);
    }

    else if (*x == typeid(float)) {
        char  str[32];
#ifndef _SAFE_C
        sprintf(str, "%.6f", val.var_cast<unsigned int>());
#else
        sprintf_s(str, "%.6f", val.var_cast<unsigned int>());
#endif
        return std::string(str);
    }

    else if(*x == typeid(short)) {

        char  str[8];
#ifndef _SAFE_C
        sprintf(str, "%d", val.var_cast<short>());
#else
        sprintf_s(str, "%d", val.var_cast<short>());
#endif
        return std::string(str);
    }

    else if (*x==typeid(unsigned short)) {

        char  str[8];
#ifndef _SAFE_C
        sprintf(str, "%d", val.var_cast<unsigned short>());
#else
        sprintf_s(str, "%d", val.var_cast<unsigned short>());
#endif
        return std::string(str);
    }

    else {
        /* Warning */
//.........这里部分代码省略.........
开发者ID:pxllzy,项目名称:QuickConfiguration,代码行数:101,代码来源:ConfigWriter.cpp


示例6:

bool operator== (const var& v1, const String& v2)           { return v1.toString() == v2; }
开发者ID:410pfeliciano,项目名称:plugin-GUI,代码行数:1,代码来源:juce_Variant.cpp


示例7: stan_print

 void stan_print(std::ostream* o, const var& x) {
   *o << x.val();
 }
开发者ID:javaosos,项目名称:stan,代码行数:3,代码来源:stan_print.hpp


示例8: main

function main(in mode0) {

	//WHATSNEW returns in ANS
	ANS="";

	var mode=mode0;

	var keywords = "MEDIA" _VM_ "JOBS" _VM_ "FINANCE" _VM_ "TIMESHEETS" _VM_ "TECHNICAL" _VM_ "USER INTERFACE";

	var nkeywords = keywords.count(VM) + 1;

	if (not(openfile("CHANGELOG", changelog))) {
		call fsmsg();
		return 0;
	}
	if (not(openfile("DICT_CHANGELOG", DICT))) {
		call fsmsg();
		return 0;
	}

	if (mode.a(1) == "SELECTANDLIST") {

		//call changelog.subs('SELECT':fm:data)
		gosub select0(mode);
		if (not LISTACTIVE) {
			call mssg("Error: No records found");
			return 0;
		}

		//call changelog.subs('LIST':fm:data)
		gosub list(mode);

	//returns outputfilename in ANS
	} else if (mode.a(1) == "WHATSNEW") {

		var menucodes = mode.a(2);
		mode = mode.a(1);
		ANS = "";

		var users;
		if (not(users.open("USERS", ""))) {
			return 0;
		}

		var userrec;
		if (userrec.read(users, USERNAME)) {

			//backward compatible ... can be deleted after all upgraded
			//leave in case reloading ancient data
			if (not userrec.a(17)) {
				var changelogkey = "USER*" ^ USERNAME;
				if (changelog.read(DEFINITIONS, changelogkey)) {
					userrec.r(17, changelog.a(8));
					(userrec.a(17)).writev(users, USERNAME, 17);
					var("").writev(DEFINITIONS, changelogkey, 8);
				}
			}

			//mode<2>=changelog<7>
			mode.r(3, userrec.a(17));

			//fix a problem where people were missing most changes
			//due to sv being represented as : eg user:support:technical
			if (mode.a(3) and mode.a(3) < 14773) {
				mode.r(3, 14153);
			}

		}else{

			//show everything the first time they logon
			//mode<3>=iconv('1/1/2004','D/E')

			//show nothing the very first time they logon
			ANS = "";
			return 0;

		}

		//get last upgradedate

		var temp = var(".\\GENERAL\\VERSION.DAT").xlate("DOS", 1, "X");
		var lastupgradedatetime = (temp.trim().field(" ", 2, 999)).iconv("D");
		lastupgradedatetime ^= "." ^ ((temp.trim().field(" ", 1)).iconv("MT")).oconv("R(0)#5");

		//nothing to see if seen after lastupgradedate
		if (mode.a(3) >= lastupgradedatetime) {
			ANS = "";
			return 0;
		}

		lastupgradedatetime.writev(users, USERNAME, 17);

		//build preferences from menus if not specified
		if (not mode.a(2)) {

			//tt=capitalise(menucodes)
			//swap 'Support' with 'Technical' in tt
			//mode<2>=tt
			if (menucodes.index("FINANCE", 1)) {
				mode.r(2, -1, "Finance");
//.........这里部分代码省略.........
开发者ID:exodusdb,项目名称:exodusdb,代码行数:101,代码来源:changelogsubs.cpp


示例9: getColourFromVar

 static Colour getColourFromVar (const var& col)
 {
     return col.isString() ? Colour::fromString (col.toString())
                           : Colours::transparentBlack;
 }
开发者ID:sonic59,项目名称:JuceEditor,代码行数:5,代码来源:juce_ImageButton.cpp


示例10: is_array

bool enigma_user::is_array(const var& v)
{
  //There is no way (currently) to downsize an array from >1 element, so this might not be accurate.
  return (v.array_height() > 1) || (v.array_len() > 1);
}
开发者ID:JustForkMyLifeUpFam,项目名称:enigma-dev,代码行数:5,代码来源:var_array.cpp


示例11: setState

void FilterAudioProcessor::setState(const var & state)
{
	frequency->setValue(state.getProperty("frequency", frequency->getDefaultValue()));
	resonance->setValue(state.getProperty("resonance", resonance->getDefaultValue()));
	setFilterType(state.getProperty("filterType", 0));
}
开发者ID:eriser,项目名称:blankenhain,代码行数:6,代码来源:FilterAudioProcessor.cpp


示例12:

int enigma_user::array_height_2d(const var& v)
{
  return v.array_height();
}
开发者ID:JustForkMyLifeUpFam,项目名称:enigma-dev,代码行数:4,代码来源:var_array.cpp


示例13: is_inf

 /**
  * Returns 1 if the input's value is infinite and 0 otherwise.
  *
  * Delegates to <code>is_inf</code>.
  *
  * @param v Value to test.
  *
  * @return <code>1</code> if the value is infinite and <code>0</code> otherwise.
  */
 inline int is_inf(const var& v) {
   return is_inf(v.val());
 }
开发者ID:stan-dev,项目名称:math,代码行数:12,代码来源:is_inf.hpp


示例14: getOpacityFromVar

 static float getOpacityFromVar (const var& v)
 {
     return v.isVoid() ? 1.0f : static_cast<float> (v);
 }
开发者ID:sonic59,项目名称:JuceEditor,代码行数:4,代码来源:juce_ImageButton.cpp


示例15: main

function main(in mode, in subject0, in body0, in groupids0, in jobids0, in userids0, in options, io emaillog) {

	//options
	//R = [email protected] email address if exists
	//W = Groups by Word eg user with dept MEDIA BUYING matches group MEDIA

	var interactive = not SYSTEM.a(33);

	if (false) print(jobids0);//evade compiler warning on unused argument

	if (mode.field(" ", 1) eq "UPGRADE") {

		var subject = "NEOSYS Upgrade: " ^ SYSTEM.a(23);
		if (SYSTEM.a(17) ne SYSTEM.a(23)) {
			subject ^= " (" ^ SYSTEM.a(17) ^ ")";
		}
		var version = mode.field(" ", 2);
		subject ^= version;

		var body = "";
		body ^= "The NEOSYS system software has been upgraded.";
		body ^= VM;
		body ^= VM ^ "Before you login to NEOSYS, please follow the instructions at";
		body ^= VM ^ "http://userwiki.neosys.com/index.php/cache to avoid errors using NEOSYS.";
		body ^= VM;
		body ^= VM ^ "Please email [email protected] for any assistance.";
		//body:=vm
		//body:=vm:'This is an automated email. You cannot reply to it.'
		body.converter(VM, var().chr(13));

		call emailusers(mode, subject, body, "", "", "", "R", emaillog);

		if (not emaillog) {
			emaillog = "(nobody)";
		}
		emaillog = "Upgrade Notification emailed to:" ^ VM ^ emaillog;
		emaillog.swapper(VM, var().chr(13));

		call sysmsg(emaillog, "Upgrade to version " ^ version);

		return 0;

	} else if (mode ne "") {
		var msg = DQ ^ (mode ^ DQ) ^ " is invalid in EMAILUSERS";
		if (interactive) {
			call mssg(msg);
		}else{
			call sysmsg(msg);
		}
		return 1;
	}

//init:

	//if target and options='' or index(options,'U',1) then
	// end
	var groupword = options.index("W", 1);
	nsent = 0;

	var subject = subject0;
	var body = body0;

	//read fromuser from users,@username else fromuser=''
	var replyto = "";
	if (options.index("R", 1)) {
		if (USERNAME == "NEOSYS" or USERNAME == "ADAGENCY" or USERNAME == "ACCOUNTS") {
			replyto = "[email protected]";
		}else{
			var fromuser = USERNAME.xlate("USERS", "", "X");
			replyto = fromuser.a(7);
			var fromline = "From " ^ fromuser.a(1);
			if (USERNAME ne fromuser.a(1)) {
				fromline ^= " (" ^ USERNAME ^ ")";
			}
			subject.splicer(1, 0, fromline ^ " : ");
		}
	}

	var usercodes = SECURITY.a(1);
	var nusers = usercodes.count(VM) + 1;
	var usern = 0;
	emaillog = "";
	var alreadyemailed = "";
	body.converter(FM ^ VM, var().chr(13) ^ var().chr(13));

	var groupids = groupids0;
	groupids.converter(",", VM);
	var ngroups = groupids.count(VM) + 1;

	var userids = userids0;
	userids.converter(",", VM);

	toemails = "";
	ccemails = "";

	var currdept = "";

	var users;
	if (not(users.open("USERS", ""))) {
		call fsmsg();
//.........这里部分代码省略.........
开发者ID:exodusdb,项目名称:exodusdb,代码行数:101,代码来源:emailusers.cpp


示例16:

 /**
  * Greater than operator comparing variables' values (C++).
  *
    \f[
    \mbox{operator\textgreater}(x, y) =
    \begin{cases}
      0 & \mbox{if } x \leq y\\
      1 & \mbox{if } x > y \\[6pt]
      0 & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN}
    \end{cases}
    \f]
  *
  * @param a First variable.
  * @param b Second variable.
  * @return True if first variable's value is greater than second's.
  */
 inline bool operator>(const var& a, const var& b) {
   return a.val() > b.val();
 }
开发者ID:stan-dev,项目名称:math,代码行数:19,代码来源:operator_greater_than.hpp


示例17: setState

void PanAudioProcessor::setState(const var & state)
{
	panning->setValue(state.getProperty("panning", panning->getDefaultValue()));
}
开发者ID:eriser,项目名称:blankenhain,代码行数:4,代码来源:PanAudioProcessor.cpp


示例18: operator

 bool operator()(const var<Alloc>&   a) const { return a.match(m_pattern, m_binding); }
开发者ID:alepharchives,项目名称:eixx,代码行数:1,代码来源:visit_match.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ var_table_t类代码示例发布时间:2022-05-31
下一篇:
C++ value_type类代码示例发布时间: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