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


C++ TCfg::fld方法代码示例

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


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

示例1: fieldPrmSet

void MTable::fieldPrmSet( TCfg &e_cfg, db_str_rec &n_rec )
{
    memset(&n_rec, 0, sizeof(db_str_rec));

    strncpy(n_rec.name, e_cfg.name().c_str(), 10);
    switch(e_cfg.fld().type())
    {
	case TFld::String:
	    n_rec.tip_fild  = 'C';
	    n_rec.len_fild  = vmin(255,e_cfg.fld().len());
	    n_rec.dec_field = 0;
	    break;
	case TFld::Integer:
	    n_rec.tip_fild = 'N';
	    n_rec.len_fild = (e_cfg.fld().len() == 0) ? 5 : vmin(255,e_cfg.fld().len());
	    n_rec.dec_field = 0;
	    break;
	case TFld::Real:
	    n_rec.tip_fild = 'N';
	    n_rec.len_fild = (e_cfg.fld().len() == 0) ? 7 : vmin(255,e_cfg.fld().len());
	    n_rec.dec_field = (e_cfg.fld().dec() == 0) ? 2 : vmin(255,e_cfg.fld().dec());
	    break;
	case TFld::Boolean:
	    n_rec.tip_fild  = 'L';
	    n_rec.len_fild  = 1;
	    n_rec.dec_field = 0;
	    break;
	default: break;
    }
}
开发者ID:alimon,项目名称:oscada,代码行数:30,代码来源:dbf_mod.cpp

示例2: setVal

void MTable::setVal( TCfg &cf, const string &val, bool tr )
{
    if(!cf.dblVal()) {
	cf.setS(val);
	if(!tr && cf.fld().flg()&TCfg::TransltText && !cf.noTransl()) Mess->translReg(val, "db:"+fullDBName()+"#"+cf.name());
    }
    else cf.setS(val, (tr?TCfg::DblValTwo:TCfg::DblValOne));
}
开发者ID:fidomax,项目名称:openscada-kium,代码行数:8,代码来源:bd_sqlite.cpp

示例3: getVal

string MTable::getVal( TCfg &cfg, uint8_t RqFlg )
{
    string rez = cfg.getS(RqFlg);
    if(rez == EVAL_STR)	return "NULL";
    if(cfg.fld().type() == TFld::String) {
	if(Mess->translDyn() && (cfg.fld().flg()&TFld::TransltText)) rez = trL(rez, Mess->lang2Code());
	string prntRes = rez;
	bool isBin = false;
	for(unsigned iCh = 0; !isBin && iCh < prntRes.size(); ++iCh)
	    switch(prntRes[iCh]) {
		case 0: isBin = true; break;
		case '\'': prntRes.insert(iCh, 1, prntRes[iCh]); ++iCh; break;
	    }
	return isBin ? "X'"+TSYS::strDecode(rez, TSYS::Bin)+"'" : "'"+prntRes+"'";
    }

    return "'" + rez + "'";
}
开发者ID:fidomax,项目名称:openscada,代码行数:18,代码来源:bd_sqlite.cpp

示例4: setVal

void MTable::setVal( TCfg &cfg, const string &val )
{
    switch( cfg.fld().type() )
    {
	case TFld::String:	cfg.setS(val);	break;
	case TFld::Integer:	cfg.setI(atoi(val.c_str()));	break;
	case TFld::Real:	cfg.setR(atof(val.c_str()));	break;
	case TFld::Boolean:	cfg.setB(atoi(val.c_str()));	break;
	default: break;
    }
}
开发者ID:careychow,项目名称:openscada,代码行数:11,代码来源:bd_sqlite.cpp

示例5: setVal

void MTable::setVal( TCfg &cf, const string &ival, bool tr )
{
    string val = (ival==DB_NULL) ? EVAL_STR : ival;
    switch(cf.fld().type()) {
	case TFld::String:
	    if(!cf.extVal()) {
		if(!tr || (cf.fld().flg()&TFld::TransltText && !cf.noTransl())) cf.setS(val);
		if(!tr && cf.fld().flg()&TFld::TransltText && !cf.noTransl()) Mess->translReg(val, "db:"+fullDBName()+"#"+cf.name());
	    }
	    else {
		if(!tr) {
		    cf.setS(val, TCfg::ExtValOne);
		    cf.setS("", TCfg::ExtValTwo);	//!! Sets for clean up from previous Two value
		    cf.setS("db:"+fullDBName()+"#"+cf.name(), TCfg::ExtValThree);
		} else cf.setS(val, TCfg::ExtValTwo);
	    }
	    break;
	default: cf.setS(val); break;
    }
}
开发者ID:fidomax,项目名称:openscada,代码行数:20,代码来源:bd_sqlite.cpp

示例6: getVal

string MTable::getVal( TCfg &cfg )
{
    switch( cfg.fld().type() )
    {
	case TFld::String:	return cfg.getS();
	case TFld::Integer:	return SYS->int2str(cfg.getI());
	case TFld::Real:	return SYS->real2str(cfg.getR());
	case TFld::Boolean:	return SYS->int2str(cfg.getB());
	default: break;
    }
    return "";
}
开发者ID:careychow,项目名称:openscada,代码行数:12,代码来源:bd_sqlite.cpp

示例7:

bool TCfg::operator==( TCfg &cfg )
{
    if(fld().type() == cfg.fld().type())
	switch(fld().type()) {
	    case TFld::String:	return (getS() == cfg.getS());
	    case TFld::Integer:	return (getI() == cfg.getI());
	    case TFld::Real:	return (getR() == cfg.getR());
	    case TFld::Boolean:	return (getB() == cfg.getB());
	    default: break;
	}
    return false;
}
开发者ID:alimon,项目名称:oscada,代码行数:12,代码来源:tconfig.cpp

示例8: setVal

void MTable::setVal( TCfg &cfg, const string &val )
{
    switch(cfg.fld().type()) {
	case TFld::String: {
	    //Remove spaces from end
	    int i;
	    for(i = val.size(); i > 0 && val[i-1] == ' '; i--) ;
	    cfg.setS(Mess->codeConvIn(codepage.c_str(),val.substr(0,i)));
	    break;
	}
	case TFld::Integer:	cfg.setI(s2i(val));	break;
	case TFld::Real:	cfg.setR(s2r(val));	break;
	case TFld::Boolean:	cfg.setB(val.c_str()[0]=='T');	break;
	default: break;
    }
}
开发者ID:alimon,项目名称:oscada,代码行数:16,代码来源:dbf_mod.cpp

示例9: getVal

string MTable::getVal( TCfg &cfg, db_str_rec *fld_rec )
{
    string rez;
    switch(cfg.fld().type()) {
	case TFld::Boolean:	rez = cfg.getB() ? "T" : "F";	break;
	case TFld::Integer:	rez = i2s(cfg.getI());		break;
	case TFld::Real: {
	    if(!fld_rec)	{ rez = r2s(cfg.getR()); break; }

	    char str[200];
	    snprintf(str, sizeof(str), "%*.*f", fld_rec->len_fild, fld_rec->dec_field, cfg.getR());
	    rez = str;
	    break;
	}
	default: rez = Mess->codeConvOut(codepage, cfg.getS());	break;
    }

    return rez;
}
开发者ID:alimon,项目名称:oscada,代码行数:19,代码来源:dbf_mod.cpp

示例10: getVal

string MTable::getVal( TCfg &cfg, bool toEnc, uint8_t RqFlg )
{
    switch(cfg.fld().type()) {
	case TFld::String: {
	    if(!toEnc) return cfg.getS(RqFlg);
	    string prntRes = cfg.getS(RqFlg);
	    bool isBin = false;
	    for(unsigned iCh = 0; !isBin && iCh < prntRes.size(); ++iCh)
		switch(prntRes[iCh]) {
		    case 0: isBin = true; break;
		    case '\'':	prntRes.insert(iCh,1,prntRes[iCh]); ++iCh; break;
		}
	    return isBin ? "X'"+TSYS::strDecode(cfg.getS(RqFlg),TSYS::Bin)+"'" : "'"+prntRes+"'";
	    break;
	}
	default: return toEnc ? "'"+cfg.getS(RqFlg)+"'" : cfg.getS(RqFlg);
    }

    return "";
}
开发者ID:fidomax,项目名称:openscada-kium,代码行数:20,代码来源:bd_sqlite.cpp

示例11: objFunc

TVariant TConfig::objFunc( const string &iid, vector<TVariant> &prms, const string &user )
{
    // ElTp cfg(string nm) - config variable 'nm' get.
    //  nm - config variable name.
    if(iid == "cfg" && prms.size() >= 1) {
	TCfg *cf = at(prms[0].getS(), true);
	if(!cf) return EVAL_REAL;
	return *cf;
    }
    // ElTp cfgSet(string nm, ElTp val) - set config variable 'nm' to 'val'.
    //  nm - config variable name;
    //  val - variable value.
    if(iid == "cfgSet" && prms.size() >= 2) {
	TCfg *cf = at(prms[0].getS(), true);
	if(!cf || (cf->fld().flg()&TFld::NoWrite)) return false;
	*(TVariant*)cf = prms[1];
	return true;
    }

    return TVariant();
}
开发者ID:fidomax,项目名称:openscada,代码行数:21,代码来源:tconfig.cpp

示例12: objFunc

TVariant TConfig::objFunc( const string &iid, vector<TVariant> &prms,
    const string &user, int perm, const string &owner )
{
    // ElTp cfg(string nm) - config variable 'nm' get.
    //  nm - config variable name.
    if(iid == "cfg" && prms.size() >= 1 &&
	    SYS->security().at().access(user,SEC_RD,TSYS::strParse(owner,0,":"),TSYS::strParse(owner,1,":"),perm)) {
	TCfg *cf = at(prms[0].getS(), true);
	if(!cf) return EVAL_REAL;
	return *cf;
    }
    // ElTp cfgSet(string nm, ElTp val) - set config variable 'nm' to 'val'.
    //  nm - config variable name;
    //  val - variable value.
    if(iid == "cfgSet" && prms.size() >= 2 &&
	    SYS->security().at().access(user,SEC_WR,TSYS::strParse(owner,0,":"),TSYS::strParse(owner,1,":"),perm)) {
	TCfg *cf = at(prms[0].getS(), true);
	if(!cf || (cf->fld().flg()&TFld::NoWrite)) return false;
	*(TVariant*)cf = prms[1];
	return true;
    }

    return TVariant();
}
开发者ID:alimon,项目名称:oscada,代码行数:24,代码来源:tconfig.cpp


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