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


C++ perform函数代码示例

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


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


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