本文整理汇总了C++中VSTRING::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ VSTRING::empty方法的具体用法?C++ VSTRING::empty怎么用?C++ VSTRING::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VSTRING
的用法示例。
在下文中一共展示了VSTRING::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmd_remove_block
int cmd_remove_block(const VSTRING& param)
{
uint32_t flag = 0;
uint32_t block_id = atoi(param[0].c_str());
uint64_t server_id = 0;
if (param.empty())
{
fprintf(stderr, "invalid parameter, param.empty\n");
return TFS_ERROR;
}
if (param.size() == 1)
{
flag = 1;
}
else if (param.size() == 2 )
{
if (param[1].length() == 1)
flag = atoi(param[1].c_str());
else
{
server_id = Func::get_host_ip(param[1].c_str());
if (0 == server_id)
{
fprintf(stderr, "invalid addr %s\n", param[1].c_str());
return TFS_ERROR;
}
}
}
if (0 == block_id)
{
fprintf(stderr, "invalid blockid %s\n", param[0].c_str());
return TFS_ERROR;
}
ClientCmdMessage req_cc_msg;
req_cc_msg.set_cmd(CLIENT_CMD_EXPBLK);
req_cc_msg.set_value1(server_id);
req_cc_msg.set_value3(block_id);
req_cc_msg.set_value4(flag);
int32_t status = TFS_ERROR;
send_msg_to_server(g_tfs_client->get_server_id(), &req_cc_msg, status);
if (param.size() == 1)
ToolUtil::print_info(status, "removeblock %s", param[0].c_str());
else if (param.size() == 2)
ToolUtil::print_info(status, "removeblock %s %s", param[0].c_str(), param[1].c_str());
return status;
}
示例2: cmd_remove_family
int cmd_remove_family(const VSTRING& param)
{
if (param.empty())
{
fprintf(stderr, "invalid parameter, param.empty\n");
return TFS_ERROR;
}
int64_t family_id = strtoull(param[0].c_str(), NULL, 10);
if (family_id <= 0)
{
fprintf(stderr, "invalid familyid %s\n", param[0].c_str());
return TFS_ERROR;
}
ClientCmdMessage req_cc_msg;
req_cc_msg.set_cmd(CLIENT_CMD_DELETE_FAMILY);
req_cc_msg.set_value3(family_id);
int32_t status = TFS_ERROR;
send_msg_to_server(g_tfs_client->get_server_id(), &req_cc_msg, status);
ToolUtil::print_info(status, "remove family %s, ret: %d", param[0].c_str(), status);
return status;
}
示例3: cmd_remove_block
int cmd_remove_block(const VSTRING& param)
{
uint32_t flag = 0;
if (param.empty())
{
fprintf(stderr, "invalid parameter, param.empty\n");
return TFS_ERROR;
}
uint64_t block_id = strtoull(param[0].c_str(), NULL, 10);
if (0 == block_id)
{
fprintf(stderr, "invalid blockid %s\n", param[0].c_str());
return TFS_ERROR;
}
uint64_t server_id = 0;
if (param.size() == 1)
{
flag = 1;//default
}
else if (param.size() == 2)
{
if (param[1].length() == 1)
{
flag = atoi(param[1].c_str());
if (1 != flag && 2 != flag && 4 != flag)
{
fprintf(stderr, "removeblock's flag parameter invalid\n");
return TFS_ERROR;
}
}
else//ds_ip:port
{
//flag = 8;//HANDLE_DELETE_BLOCK_FLAG_ONLY_ONE_RELATION
server_id = Func::get_host_ip(param[1].c_str());
if (0 == server_id)
{
fprintf(stderr, "invalid addr %s\n", param[1].c_str());
return TFS_ERROR;
}
}
}
else
{
fprintf(stderr, "removeblock's parameter invalid\n");
return TFS_ERROR;
}
ClientCmdMessage req_cc_msg;
req_cc_msg.set_cmd(CLIENT_CMD_EXPBLK);
req_cc_msg.set_value1(server_id);
req_cc_msg.set_value3(block_id);
req_cc_msg.set_value4(flag);
int32_t status = TFS_ERROR;
send_msg_to_server(g_tfs_client->get_server_id(), &req_cc_msg, status);
if (STATUS_MESSAGE_OK == status)
status = TFS_SUCCESS;
else
status = TFS_ERROR;
if (1 == flag || 2 == flag || 4 == flag)
ToolUtil::print_info(status, "removeblock: %s", param[0].c_str());
else//flag=8,ds_ip:port
ToolUtil::print_info(status, "removeblock: %s from ds:%s", param[0].c_str(), param[1].c_str());
return status;
}