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

C++ perform函数代码示例

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

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



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

示例1: switch

ndk::event::result
input_handler::pimpl::on_kbd_common (ndk::keyboard const &ev)
{
  switch (ev.code ())
    {
    case ndk::key::error:
      throw std::runtime_error ("ERR");

    // control actions
    case ndk::key::ctrl_d:
    case ndk::key::q:
      perform (ev.sender (), action::quit);
      return ndk::event::accepted;

    case ndk::key::ctrl_l:
      perform (ev.sender (), action::redraw);
      return ndk::event::accepted;

    case ndk::key::resize:
      perform (ev.sender (), action::resize);
      return ndk::event::accepted;

    case ndk::key::F10:
      perform (ev.sender (), action::maximise);
      return ndk::event::accepted;

    default:
      return ndk::event::ignored;
    }
}
开发者ID:pippijn,项目名称:dclient,代码行数:30,代码来源:input_handler.cpp


示例2: msg

void Trade::agree(Character *c)
{
    // No player agreed
    if (mState == TRADE_CONFIRMED)
    {
        // One player agreed, if it's the player 2, make it player 1
        if (c == mChar2)
        {
            std::swap(mChar1, mChar2);
            std::swap(mItems1, mItems2);
            std::swap(mMoney1, mMoney2);
        }
        // First player agrees.
        mState = TRADE_CONFIRM_WAIT;

        // Send the other player that the first player has confirmed
        MessageOut msg(GPMSG_TRADE_AGREED);
        mChar2->getClient()->send(msg);
        return;
    }

    if (mState == TRADE_AGREE_WAIT && c == mChar1)
    {
        // We don't care about the first player, he already agreed
        return;
    }

    // The second player has agreed

    // Check if both player has the objects in their inventories
    // and enouth money, then swap them.
    Inventory v1(mChar1, true), v2(mChar2, true);
    if (mChar1->getAttribute(mCurrencyId) >= mMoney1 - mMoney2 &&
        mChar2->getAttribute(mCurrencyId) >= mMoney2 - mMoney1 &&
        perform(mItems1, v1, v2) &&
        perform(mItems2, v2, v1))
    {
        mChar1->setAttribute(mCurrencyId, mChar1->getAttribute(mCurrencyId)
                             - mMoney1 + mMoney2);
        mChar2->setAttribute(mCurrencyId, mChar2->getAttribute(mCurrencyId)
                             - mMoney2 + mMoney1);
    }
    else
    {
        v1.cancel();
        v2.cancel();
        cancel();
        return;
    }

    MessageOut msg(GPMSG_TRADE_COMPLETE);
    mChar1->getClient()->send(msg);
    mChar2->getClient()->send(msg);
    delete this;
}
开发者ID:Philipp-S,项目名称:manaserv,代码行数:55,代码来源:trade.cpp


示例3: dashboard_conn_check

		void dashboard_conn_check(std::string cloud_name) {
			if(!msattrs) {
				APIDictionary result(perform("cldshow", cloud_name, "metricstore"));
				host = APIString(result["hostname"]);
				port = APIString(result["port"]);
				msci.connect(host + ":" + port + "/metrics");
				result = APIDictionary(perform("cldshow", cloud_name, "time"));
				username = APIString(result["username"]);
				msattrs = 1;
			}	
		} 	
开发者ID:Leonid99,项目名称:cbtool,代码行数:11,代码来源:api_service_client.hpp


示例4: test

int test(char *URL)
{
  CURLM *multi;
  CURL *easy;

  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
    fprintf(stderr, "curl_global_init() failed\n");
    return TEST_ERR_MAJOR_BAD;
  }

  if ((multi = curl_multi_init()) == NULL) {
    fprintf(stderr, "curl_multi_init() failed\n");
    curl_global_cleanup();
    return TEST_ERR_MAJOR_BAD;
  }

  if ((easy = curl_easy_init()) == NULL) {
    fprintf(stderr, "curl_easy_init() failed\n");
    curl_multi_cleanup(multi);
    curl_global_cleanup();
    return TEST_ERR_MAJOR_BAD;
  }

  curl_multi_setopt(multi, CURLMOPT_PIPELINING, 1);

  curl_easy_setopt(easy, CURLOPT_WRITEFUNCTION, fwrite);
  curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
  curl_easy_setopt(easy, CURLOPT_URL, URL);

  curl_multi_add_handle(multi, easy);
  if (perform(multi) != CURLM_OK)
    printf("retrieve 1 failed\n");

  curl_multi_remove_handle(multi, easy);
  curl_easy_reset(easy);

  curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
  curl_easy_setopt(easy, CURLOPT_URL, arg2);

  curl_multi_add_handle(multi, easy);
  if (perform(multi) != CURLM_OK)
    printf("retrieve 2 failed\n");

  curl_multi_remove_handle(multi, easy);
  curl_easy_cleanup(easy);
  curl_multi_cleanup(multi);
  curl_global_cleanup();

  printf("Finished!\n");

  return 0;
}
开发者ID:blog2i2j,项目名称:greentimer,代码行数:52,代码来源:lib536.c


示例5: config_

LoaderDatabaseConnection::LoaderDatabaseConnection(const LoaderConfiguration & config)
	: pqxx::connection(config.database().pqDatabaseConnection()), config_(new LoaderConfiguration(config))
{
	if ( config.loading().nameSpace.empty() )
		perform ( BeginWci(config.database().user) );
	else if (config.loading().nameSpace == "test" )
		perform ( BeginWci(config.database().user, 999, 999, 999) );
	else if (config.loading().nameSpace == "default" )
		perform ( BeginWci(config.database().user, 0, 0, 0) );
	else
		throw std::logic_error("Unknown name space specification: " + config.loading().nameSpace );

	setup_();
}
开发者ID:michaeloa,项目名称:wdb-libwdbload,代码行数:14,代码来源:LoaderDatabaseConnection.cpp


示例6: assert

DBI::Error Transaction::truncate(const AnyString& tablename)
{
    if (YUNI_UNLIKELY(not IsValidIdentifier(tablename)))
        return errInvalidIdentifier;

    assert(!(!pChannel));

    // the adapter
    ::yn_dbi_adapter& adapter = pChannel->adapter;

    // The DBI interface should provide the most appropriate way for
    // truncating a table (autoincrement / cascade...)
    if (YUNI_LIKELY(adapter.truncate))
    {
        return (DBI::Error) adapter.truncate(adapter.dbh, tablename.c_str(), tablename.size());
    }
    else
    {
        // Fallback to a failsafe method
        // -- stmt << "TRUNCATE " << tablename << ';';
        // The SQL command Truncate is not supported by all databases. `DELETE FROM`
        // is not  the most efficient way for truncating a table
        // but it should work almost everywhere
        String stmt;
        stmt << "DELETE FROM " << tablename << ';';
        return perform(stmt);
    }
}
开发者ID:ollie314,项目名称:libyuni,代码行数:28,代码来源:transaction.cpp


示例7: main

int main(int argc, char *argv[])
{
	toxdump_args_t args = TOXDUMP_INIT_ARGS;
	parse_args(argc, argv, &args);
	int ret = perform(&args);
	return ret;
}
开发者ID:saneki,项目名称:toxfile,代码行数:7,代码来源:toxdump.c


示例8: perform

DisplayWindow *FourierDCT::invert(ComplexArray *ca, QString title, QImage::Format format, QWidget *p)
{
	int w = ca->shape()[1];
	int h = ca->shape()[2];
	perform(ca, true);
	ColorParser cp(format);
	QImage result(w, h, format);
	result.fill(Qt::black);
	if (format == QImage::Format_Indexed8) {
		QVector<QRgb> colors;
		colors.reserve(256);
		for (int i = 0; i < 256; i++) {
			colors << qRgb(i, i, i);
		}
		result.setColorTable(colors);
	}
	for (unsigned int i = 1; i < ca->shape()[0]; i += 2) {
		qreal min = 0;
		qreal max = 0;
		for (unsigned int j = 0; j < ca->shape()[1]; j++) {
			for (unsigned int k = 0; k < ca->shape()[2]; k++) {
				Complex c = (*ca)[i][j][k];
				qreal real = c.real();
				if (real > max) {
					max = real;
				} else if (real < min) {
					min = real;
				}
			}
		}

		for (unsigned int j = 0; j < ca->shape()[1]; j++) {
			for (unsigned int k = 0; k < ca->shape()[2]; k++) {
				Complex c = (*ca)[i][j][k];
				qreal p = (c.real() - min) / (max - min) * 255.0;
				{
					QVector3D oldPixel = cp.pixel(k, j, result);
					QVector3D newPixel;
					switch (i / 2) {
						case 0:
							newPixel.setX(p);
							break;
						case 1:
							newPixel.setY(p);
							break;
						case 2:
							newPixel.setZ(p);
							break;
						default:
							break;
					}
					cp.setPixel(k, j, result, cp.merge(oldPixel, newPixel));
				}
			}
		}
	}
	result = result.rgbSwapped();
	PhotoWindow *pw = new PhotoWindow(result, title + ", IFDCT", p);
	return pw;
}
开发者ID:janisozaur,项目名称:pod,代码行数:60,代码来源:fourierdct.cpp


示例9: initRequest

bool HttpCurl::post(string url, string content)
{
	CURLcode result;

	initRequest(url);

	m_sendBuffer.initialize(content);

	// set request type to post
	if ((result = curl_easy_setopt(m_curl, CURLOPT_POST, 1L)) != 0)
	{
		CurlException ex(result, m_message);
		throw ex;
	}

	if ((result = curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE, content.length())) != 0)
	{
		CurlException ex(result, m_message);
		throw ex;
	}

	perform();

	return true;
}
开发者ID:dupes,项目名称:nghp-http-lib,代码行数:25,代码来源:HttpCurl.cpp


示例10: BinaryImage

// Default constructor
UltimateErodedBinaryImage::UltimateErodedBinaryImage(BinaryImage& img)

  : BinaryImage(img)

{
  perform(this);
}
开发者ID:rentpath,项目名称:qgar,代码行数:8,代码来源:UltimateErodedBinaryImage.cpp


示例11: newPoint

//==============================================================================
void PaintElementPath::movePoint (int index, int pointNumber,
                                  double newX, double newY,
                                  const Rectangle<int>& parentArea,
                                  const bool undoable)
{
    if (PathPoint* const p = points [index])
    {
        PathPoint newPoint (*p);
        jassert (pointNumber < 3 || p->type == Path::Iterator::cubicTo);
        jassert (pointNumber < 2 || p->type == Path::Iterator::cubicTo || p->type == Path::Iterator::quadraticTo);

        RelativePositionedRectangle& pr = newPoint.pos [pointNumber];

        double x, y, w, h;
        pr.getRectangleDouble (x, y, w, h, parentArea, getDocument()->getComponentLayout());
        pr.updateFrom (newX, newY, w, h, parentArea, getDocument()->getComponentLayout());

        if (undoable)
        {
            perform (new ChangePointAction (p, index, newPoint), "Move path point");
        }
        else
        {
            *p = newPoint;
            changed();
        }
    }
}
开发者ID:Krewn,项目名称:LIOS,代码行数:29,代码来源:jucer_PaintElementPath.cpp


示例12: GreyLevelImage

// Default constructor
RegionalMinImage::RegionalMinImage(GreyLevelImage& img)

  : GreyLevelImage(img)

{
  perform(this);
}
开发者ID:rentpath,项目名称:qgar,代码行数:8,代码来源:RegionalMinImage.cpp


示例13: perform

bool RegistrationOperation::performSafely( const RegistrationArguments& args
                                         , RegistrationController& controller
                                         , QWidget* dialogParent )
{
    const QString msgBoxTitle = QString::fromStdString( name );

    QApplication::setOverrideCursor( Qt::WaitCursor );

    try
    {
        perform( args, controller, dialogParent );

        QApplication::restoreOverrideCursor();
        
        return true;
    }
    catch( const std::exception& ex )
    {
        QMessageBox::critical( dialogParent, msgBoxTitle, QString::fromStdString( ex.what() ) );
    }
    catch( ... )
    {
        QMessageBox::critical( dialogParent, msgBoxTitle, "Unknown error" );
    }

    QApplication::restoreOverrideCursor();

    return false;
}
开发者ID:RWTHmediTEC,项目名称:DICOMViewer,代码行数:29,代码来源:RegistrationOperation.cpp


示例14: throw

OpenBinaryImage::OpenBinaryImage(const BinaryImage& anImg,
				 unsigned int anOpenSize)

  throw(QgarErrorDomain)

  : BinaryImage(anImg)

{
  int sqsize = (2 * anOpenSize) + 1;  // Effective mask size

  if ((sqsize > anImg.width()) || (sqsize > anImg.height()))
    {
      std::ostringstream os;
      os << "Opening size ["
	 << sqsize
	 << " X "
	 << sqsize
	 << "] too large for image ["
	 << anImg.width()
	 << " X "
	 << anImg.height()
	 << "]";
      throw QgarErrorDomain(__FILE__, __LINE__,
			    "void qgar::OpenBinaryImage::OpenBinaryImage(const qgar::BinaryImage&, unsigned int)",
			    os.str());
    }

  perform(this, anOpenSize);
}
开发者ID:rentpath,项目名称:qgar,代码行数:29,代码来源:OpenBinaryImage.cpp


示例15: BinaryImage

// Default constructor
RegionalMaxBinaryImage::RegionalMaxBinaryImage(BinaryImage& anImg)

  : BinaryImage(anImg)

{
  perform(this);
}
开发者ID:jlerouge,项目名称:GEMpp,代码行数:8,代码来源:RegionalMaxBinaryImage.cpp


示例16: GreyLevelImage

// Default constructor
CloseImage::CloseImage(GreyLevelImage& anImg, unsigned int aClosingSize)


  : GreyLevelImage(anImg)

{
  int sqsize = (2 * aClosingSize) + 1;  // Effective mask size

  if ((sqsize > anImg.width()) || (sqsize > anImg.height()))
    {
      std::ostringstream os;
      os << "Closing size ["
	 << aClosingSize
	 << " -> "
	 << sqsize
	 << "] too large for image ["
	 << anImg.width()
	 << " X "
	 << anImg.height()
	 << "]";
      throw QgarErrorDomain(__FILE__, __LINE__,
			    "qgar::CloseImage::CloseImage(qgar::GreyLevelImage&, unsigned int)",
			    os.str());
    }

  perform(this, aClosingSize);
}
开发者ID:jlerouge,项目名称:GEMpp,代码行数:28,代码来源:CloseImage.cpp


示例17: throw

// Default constructor
GeodesicRecImage::GeodesicRecImage(GreyLevelImage& aMarkImg,
				   GreyLevelImage& aResImg)
  throw(QgarErrorDomain)
  : GreyLevelImage(aMarkImg)
{
  if (   (aMarkImg.width()  != aResImg.width())
      || (aMarkImg.height() != aResImg.height()))
    {
      std::ostringstream os;
      os << "Marker image size ("
	 << aMarkImg.width()
	 << " X "
	 << aMarkImg.height()
	 << ") does not match result image size ("
	 << aResImg.width()
	 << " X "
	 << aResImg.height()
	 << ')';
      throw QgarErrorDomain(__FILE__, __LINE__,
			    "qgar::GeodesicRecImage::GeodesicRecImage(qgar::GreyLevelImage&, qgar::GreyLevelImage&)",
			    os.str());
    }

  perform(this, &aResImg);
}
开发者ID:rentpath,项目名称:qgar,代码行数:26,代码来源:GeodesicRecImage.cpp


示例18: throw

ErodedBinaryImage::ErodedBinaryImage(BinaryImage& anImg,
				     unsigned int anEroSize)
  throw(QgarErrorDomain)

  : BinaryImage(anImg)

{
  int sqsize = (2 * anEroSize) + 1;  // Effective mask size

  if ((sqsize > anImg.width()) || (sqsize > anImg.height()))
    {
      std::ostringstream os;
      os << "Erosion size ("
	 << sqsize
	 << " X "
	 << sqsize
	 << ") too large for an image "
	 << anImg.width()
	 << " X "
	 << anImg.height();
      throw QgarErrorDomain(__FILE__, __LINE__,
			    "qgar::ErodedBinaryImage::ErodedBinaryImage(qgar::BinaryImage&, unsigned int)",
			    os.str());
    }

  perform(this, anEroSize);
}
开发者ID:rentpath,项目名称:qgar,代码行数:27,代码来源:ErodedBinaryImage.cpp


示例19: createchart

subroutine createchart(io chart, in ledgercode) {

	//clear the last chart record to make a new chart record
	var nmvfns = fin.chartmvfns.dcount(VM);
	for (var fnn = 1; fnn <= nmvfns; ++fnn) {
		chart.r(fin.chartmvfns.a(1, fnn), "");
	};//fnn;

	chart.write(fin.charts, ledgercode);

	chart.write(fin.ledgers, ledgercode);

	//simulate proper ledger creation
	//[email protected]
	//storeorec=orec
	//[email protected]
	//@record=chart
	//orec=''
	//@id=ledgercode
	//cant call directly since contains common variables unlike this subroutine
	//call ledger.subs('WRITE')
	//@id=storeid
	//orec=storerec
	//@record=storerecord

	var storepseudo = PSEUDO;
	PSEUDO = ledgercode ^ FM ^ chart;
	perform("WINDOWSTUB LEDGER.SUBS PSEUDOWRITE");
	PSEUDO = storepseudo;

	return;

}
开发者ID:exodusdb,项目名称:exodusdb,代码行数:33,代码来源:addacc.cpp


示例20: onApply

bool Effect::tryPerform(Unit* owner) {
	if (_firstPerform) {
		onApply(owner);
		_firstPerform = false;
	}

	//if force remove we do not want the effect to get another tick
	if (_forceRemove) {
		//remove me
		onRemoving(owner);
		return false;
	}

	double now = BW_Time::getMilliSecondsCached();
	if (_tickDelay != NOTICK && _lastperform < now - _tickDelay) {
		perform(owner);
		_lastperform += _tickDelay;
	}

	//if timeover we want to give the effect the chance for a last tick
	if (_removeTime != FOREVER && now > _removeTime) {
		//remove me
		onRemoving(owner);
		return false;
	}
	return true;
}
开发者ID:Gwill,项目名称:BaseWar,代码行数:27,代码来源:Effect.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ period函数代码示例发布时间:2022-05-30
下一篇:
C++ perf_print_counter函数代码示例发布时间: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