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


C++ Reply类代码示例

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


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

示例1: RedisCommand

int CodisClient::incrby(string key, int incr, int tt)
{

    Reply rep = RedisCommand(Command("INCRBY")(key)(int2string(incr)), tt);

    return (rep.error()) ? 0 : rep.integer();
}
开发者ID:XMAN-WOMBAT,项目名称:CodisClient,代码行数:7,代码来源:CodisClient.cpp

示例2: while

status_t
Server::_Listener()
{
	status_t result;
	uint32 size;
	void* buffer = NULL;

	while (!fThreadCancel) {
		result = fConnection->Receive(&buffer, &size);
		if (result == B_NO_MEMORY)
			continue;
		else if (result != B_OK) {
			fThreadError = result;
			return result;
		}

		ASSERT(buffer != NULL && size > 0);
		Reply* reply = new(std::nothrow) Reply(buffer, size);
		if (reply == NULL) {
			free(buffer);
			continue;
		}

		Request* req = fRequests.FindRequest(reply->GetXID());
		if (req != NULL) {
			*req->fReply = reply;
			req->fDone = true;
			req->fEvent.NotifyAll();
		} else
			delete reply;
	}

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:34,代码来源:RPCServer.cpp

示例3: comm

vector<string> CodisClient::mget(vector<string>& keys, int tt)
{
    vector<string> values;

    Command comm("MGET");
    for (size_t i=0; i<keys.size(); i++)
    {
        comm(keys[i]);
    }


    Reply rep = RedisCommand(comm, tt);

    if (rep.error())
    {
        return values;
    }
    else
    {
        for (size_t i=0; i<rep.elements().size(); i++)
        {
            values.push_back(rep.elements()[i].str());
        }
    }

    return values;
}
开发者ID:XMAN-WOMBAT,项目名称:CodisClient,代码行数:27,代码来源:CodisClient.cpp

示例4: TEST_F

TEST_F(ReplyInterpreterTest, execute_calls_caller) {
    // Register metatypes
    qRegisterMetaType<Reply>();
    qRegisterMetaType<types::QtGpsLocation>();
    MetaTypeRegistrar& registrar = MetaTypeRegistrar::instance();
    registrar.registerReplyMetaType<types::QtGpsLocation>();

    // Create a mock callback
    QSharedPointer<MockCallback<joynr::types::QtGpsLocation>> callback(new MockCallback<joynr::types::QtGpsLocation>());
    int myAltitude = 13;
    EXPECT_CALL(*callback, onSuccess(Property(&types::QtGpsLocation::getAltitude, myAltitude)))
                .Times(1);

    // Create a reply caller
    QSharedPointer<IReplyCaller> icaller(new ReplyCaller<types::QtGpsLocation>(
            [callback](const RequestStatus& status, const types::QtGpsLocation& location) {
                callback->onSuccess(location);
            },
            [](const RequestStatus& status){
            }));

    // Create a reply
    types::QtGpsLocation location;
    location.setAltitude(myAltitude);
    QList<QVariant> response;
    response.append(QVariant::fromValue(location));
    Reply reply;
    reply.setResponse(response);

    // Interpret the reply
    IReplyInterpreter& interpreter = registrar.getReplyInterpreter(Util::getTypeId<types::QtGpsLocation>());
    interpreter.execute(icaller, reply);
}
开发者ID:HSchroeder,项目名称:joynr,代码行数:33,代码来源:ReplyInterpreterTest.cpp

示例5: TEST

TEST(RedisClientTest, getRedisCommand)
{
	vector<string> command;
	command.push_back("get");
	command.push_back("kk");
	Reply ret = client.RedisCommand(command);
	EXPECT_STREQ(ret.str().c_str(), "vv");
}
开发者ID:2221758805,项目名称:RedisSentinelClient,代码行数:8,代码来源:RedisClientTest.cpp

示例6: GetReply

Reply Reply::GetReply(Reply::StatusType status)
{
    Reply reply;
    reply.status = status;
    const ConstBuffer& statusBuffer = Replies::ToBuffer(status);
    reply.content.data.reset(const_cast<char*>(statusBuffer.data), [](const char*){} );
    reply.content.size = statusBuffer.size;
    reply.SetHeaders(reply.content.size, "text/html");
    return reply;
}
开发者ID:mincer,项目名称:simplest_http_server,代码行数:10,代码来源:reply.cpp

示例7: StockReply

Reply Reply::StockReply(Reply::status_type status)
{
    Reply reply;
    reply.status = status;
    reply.content.clear();

    const std::string status_string = reply.ToString(status);
    reply.content.insert(reply.content.end(), status_string.begin(), status_string.end());
    reply.headers.emplace_back("Access-Control-Allow-Origin", "*");
    reply.headers.emplace_back("Content-Length", cast::integral_to_string(reply.content.size()));
    reply.headers.emplace_back("Content-Type", "text/html");
    return reply;
}
开发者ID:AlanBell,项目名称:osrm-backend,代码行数:13,代码来源:Reply.cpp

示例8: HeaderScanner

Scanner::Scanner(std::istream* in, std::unique_ptr<Message>& message) {
    if (!message) {
        lexer_.reset(new HeaderScanner(in));
    } else if (message->is_reply()) {
        Reply* reply = static_cast<Reply*>(message.get());
        if (reply->response_code() == STATUS_SeeOther)
            lexer_.reset(new ErrorScanner(in));
        else
            lexer_.reset(new MessageScanner(in, true));
    }

    if (!lexer_)
        lexer_.reset(new MessageScanner(in));
}
开发者ID:hustaoyang,项目名称:wds,代码行数:14,代码来源:scanner.cpp

示例9: command

int CodisClient::del(vector<string>& keys, int tt)
{
    Command command("DEL");
    Reply rep;
    for (size_t i=0; i<keys.size(); i++)
    {
//		rep = RedisCommand(command(keys[i]));
        command(keys[i]);
    }

    rep = RedisCommand(command, tt);

    return rep.integer();
}
开发者ID:XMAN-WOMBAT,项目名称:CodisClient,代码行数:14,代码来源:CodisClient.cpp

示例10: HandlePortAssignmentResponse

/**
 * Handle a PortAssignment response.
 */
void UsbProDevice::HandlePortAssignmentResponse(RpcController *controller,
                                                string *response,
                                                ConfigureCallback *done,
                                                bool status,
                                                uint8_t port1_assignment,
                                                uint8_t port2_assignment) {
  if (!status) {
    controller->SetFailed("Get Port Assignments failed");
  } else {
    Reply reply;
    reply.set_type(ola::plugin::usbpro::Reply::USBPRO_PORT_ASSIGNMENT_REPLY);
    ola::plugin::usbpro::PortAssignmentReply *port_assignment_reply =
      reply.mutable_port_assignment();
    port_assignment_reply->set_port_assignment1(port1_assignment);
    port_assignment_reply->set_port_assignment2(port2_assignment);
    reply.SerializeToString(response);
  }
  done->Run();
}
开发者ID:Jazeido,项目名称:ola,代码行数:22,代码来源:UsbProDevice.cpp

示例11: StockReply

Reply Reply::StockReply(Reply::status_type status)
{
    Reply rep;
    rep.status = status;
    rep.content.clear();

    const std::string status_string = rep.ToString(status);
    rep.content.insert(rep.content.end(), status_string.begin(), status_string.end());
    rep.headers.resize(3);
    rep.headers[0].name = "Access-Control-Allow-Origin";
    rep.headers[0].value = "*";
    rep.headers[1].name = "Content-Length";

    std::string size_string = IntToString(rep.content.size());

    rep.headers[1].value = size_string;
    rep.headers[2].name = "Content-Type";
    rep.headers[2].value = "text/html";
    return rep;
}
开发者ID:DrVanScott,项目名称:Project-OSRM,代码行数:20,代码来源:Reply.cpp

示例12: ReplyToString

void ReplyToString(Reply& reply, std::string &rep)
{
	stringstream stream;
	stream << reply.type() << ";"
			<< reply.str() << ";"
			<< reply.error() << ";"
			<< reply.integer() << ";";

	std::vector<Reply> elements = reply.elements();

	for (size_t i=0; i<elements.size(); i++)
	{
		stream << elements[i].type() << ";"
				<< elements[i].str() << ";"
				<< elements[i].error() << ";"
				<< elements[i].integer() << ";";
	}

	rep = stream.str();
}
开发者ID:2221758805,项目名称:RedisSentinelClient,代码行数:20,代码来源:com_redis_sentinel_client_RedisClient.cpp


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