本文整理汇总了C++中WI_STR函数的典型用法代码示例。如果您正苦于以下问题:C++ WI_STR函数的具体用法?C++ WI_STR怎么用?C++ WI_STR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WI_STR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wi_test_host_creation
void wi_test_host_creation(void) {
wi_host_t *host;
host = wi_host();
WI_TEST_ASSERT_NOT_NULL(host, "");
WI_TEST_ASSERT_NOT_NULL(wi_host_address(host), "");
host = wi_host_with_string(WI_STR("localhost"));
WI_TEST_ASSERT_NOT_NULL(host, "");
WI_TEST_ASSERT_NOT_NULL(wi_host_address(host), "");
}
示例2: wi_parse_wired_command
void wi_parse_wired_command(wi_string_t *buffer, wi_string_t **out_command, wi_array_t **out_arguments) {
wi_string_t *string, *substring;
wi_uinteger_t index;
index = wi_string_index_of_string(buffer, WI_STR(_WI_WIRED_MESSAGE_SEPARATOR), WI_STRING_BACKWARDS);
if(index != WI_NOT_FOUND)
string = wi_string_by_deleting_characters_from_index(buffer, index);
else
string = wi_autorelease(wi_copy(buffer));
index = wi_string_index_of_string(string, WI_STR(" "), 0);
if(index != WI_NOT_FOUND) {
*out_command = wi_string_substring_to_index(string, index);
substring = wi_string_substring_from_index(string, index + 1);
*out_arguments = wi_string_components_separated_by_string(substring, WI_STR(_WI_WIRED_FIELD_SEPARATOR));
} else {
*out_command = string;
*out_arguments = wi_array();
}
}
示例3: wi_test_host_runtime_functions
void wi_test_host_runtime_functions(void) {
wi_host_t *host1, *host2, *host3, *host4, *host5, *host6;
host1 = wi_host();
host2 = wi_autorelease(wi_copy(host1));
host3 = wi_host_with_string(WI_STR("localhost"));
host4 = wi_autorelease(wi_copy(host3));
host5 = wi_host_with_string(WI_STR("aab119a592b9e23779b66649677b436d24b35aaa5ad5beadf4c2a945b70577e5.com"));
host6 = wi_autorelease(wi_copy(host5));
WI_TEST_ASSERT_EQUAL_INSTANCES(host1, host2, "");
WI_TEST_ASSERT_EQUAL_INSTANCES(host3, host4, "");
WI_TEST_ASSERT_EQUAL_INSTANCES(host5, host6, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host1, host3, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host2, host3, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host1, host4, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host2, host4, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host1, host5, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host2, host5, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host1, host6, "");
WI_TEST_ASSERT_NOT_EQUAL_INSTANCES(host2, host6, "");
WI_TEST_ASSERT_EQUALS(wi_hash(host1), wi_hash(host2), "");
WI_TEST_ASSERT_EQUALS(wi_hash(host3), wi_hash(host4), "");
WI_TEST_ASSERT_EQUALS(wi_hash(host5), wi_hash(host6), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host1), wi_host_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host2), wi_host_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host3), wi_host_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host4), wi_host_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host5), wi_host_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(host6), wi_host_runtime_id(), "");
#ifdef HAVE_GETIFADDRS
WI_TEST_ASSERT_NOT_EQUALS(wi_string_index_of_string(wi_description(host1), WI_STR("127.0.0.1"), 0), WI_NOT_FOUND, "");
#else
WI_TEST_ASSERT_NOT_EQUALS(wi_string_index_of_string(wi_description(host1), WI_STR("0.0.0.0"), 0), WI_NOT_FOUND, "");
#endif
WI_TEST_ASSERT_NOT_EQUALS(wi_string_index_of_string(wi_description(host3), WI_STR("127.0.0.1"), 0), WI_NOT_FOUND, "");
}
示例4: wr_print_users
void wr_print_users(wr_window_t *window) {
wi_enumerator_t *enumerator;
wi_array_t *users;
wr_user_t *user;
wi_uinteger_t max_length = 0;
if(window->chat == wr_public_chat)
wr_printf_prefix(WI_STR("Users currently online:"));
else
wr_printf_prefix(WI_STR("Users in chat:"));
users = wr_chat_users(window->chat);
enumerator = wi_array_data_enumerator(users);
while((user = wi_enumerator_next_data(enumerator)))
max_length = WI_MAX(max_length, wi_string_length(wr_user_nick(user)));
enumerator = wi_array_data_enumerator(users);
while((user = wi_enumerator_next_data(enumerator)))
wr_print_user(user, max_length);
}
示例5: _wi_config_parse_string
static wi_boolean_t _wi_config_parse_string(wi_config_t *config, wi_string_t *string, wi_string_t **name, wi_string_t **value) {
wi_array_t *array;
array = wi_string_components_separated_by_string(string, WI_STR("="));
if(wi_array_count(array) != 2)
return false;
*name = wi_string_by_deleting_surrounding_whitespace(WI_ARRAY(array, 0));
*value = wi_string_by_deleting_surrounding_whitespace(WI_ARRAY(array, 1));
return true;
}
示例6: wr_commands_completer_for_command
wr_completer_t wr_commands_completer_for_command(wi_string_t *buffer) {
wi_string_t *command, *arguments;
wr_completer_t completer;
wi_uinteger_t index;
if(wi_string_length(buffer) == 0 || !wi_string_has_prefix(buffer, WI_STR("/")))
return WR_COMPLETER_NICKNAME;
if(wi_string_index_of_string(buffer, WI_STR(" "), 0) == WI_NOT_FOUND)
return WR_COMPLETER_COMMAND;
wi_parse_wire_command(buffer, &command, &arguments);
index = wr_commands_index_for_command(command);
if(index == WI_NOT_FOUND)
completer = WR_COMPLETER_NONE;
else
completer = wr_commands[index].completer;
return completer;
}
示例7: wi_test_sha2_digest
void wi_test_sha2_digest(void) {
#ifdef WI_SHA1
wi_sha2_t *sha2;
wi_data_t *data;
unsigned char buffer[WI_SHA2_MAX_LENGTH];
data = wi_data();
wi_sha2_digest(WI_SHA2_256, wi_data_bytes(data), wi_data_length(data), buffer);
WI_TEST_ASSERT_EQUAL_INSTANCES(wi_data_with_bytes(buffer, WI_SHA2_256_LENGTH), wi_data_with_base64_string(WI_STR("47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")), "");
WI_TEST_ASSERT_EQUAL_INSTANCES(wi_sha2_digest_string(WI_SHA2_256, data), WI_STR("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"), "");
sha2 = wi_sha2_with_bits(WI_SHA2_512);
wi_sha2_close(sha2);
wi_sha2_get_data(sha2, buffer);
WI_TEST_ASSERT_EQUAL_INSTANCES(wi_data_with_bytes(buffer, WI_SHA2_512_LENGTH), wi_data_with_base64_string(WI_STR("z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==")), "");
WI_TEST_ASSERT_EQUAL_INSTANCES(wi_sha2_data(sha2), wi_data_with_base64_string(WI_STR("z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==")), "");
#endif
}
示例8: qDebug
void DRFilesTreeModel::receivedMessage(wi_p7_message_t *message, DRServerConnection *connection) {
if(QThread::currentThread() != QApplication::instance()->thread())
qDebug() << "is background thread";
else
qDebug() << "DRFilesTreeModel::receivedMessage is main thread";
if(wi_is_equal(wi_p7_message_name(message), WI_STR("wired.file.file_list"))) {
if(this->loadingItem == NULL)
return;
DRFileItem *parent = this->loadingItem;
QModelIndex parentIndex = parent->getIndex();
int row = parent->childNumber()+1;
QModelIndex childIndex = createIndex(row, 0, parent);
DRFileItem *newChild = new DRFileItem(message, this->connection, this->loadingItem, childIndex);
bool success = false;
qDebug() << newChild;
beginInsertRows(parentIndex, parent->childCount()+1, parent->childCount()+2);
success = this->loadingItem->appendChild(newChild);
endInsertRows();
}
else if(wi_is_equal(wi_p7_message_name(message), WI_STR("wired.file.file_list.done"))) {
//qDebug() << this->loadingItem->childCount();
//emit dataChanged(this->loadingItem->getIndex(), this->loadingItem->getIndex());
//emit rowsInserted(this->loadingItem->getIndex(), 0, 0);
//emit layoutChanged();
this->loadingItem = NULL;
this->connection->removeDelegateForMessage(this, "wired.file.file_list");
this->connection->removeDelegateForMessage(this, "wired.file.file_list.done");
// QObject::disconnect(this->connection, SIGNAL(receivedMessage(wi_p7_message_t*,DRServerConnection*)),
// this, SLOT(receivedMessage(wi_p7_message_t*,DRServerConnection*)));
}
}
示例9: _wb_command_load_with_node
static wb_command_t * _wb_command_load_with_node(wb_command_t *command, xmlNodePtr node) {
wi_string_t *permissions, *activated, *name;
wb_output_t *output;
xmlNodePtr sub_node, next_node;
// get command name
name = wi_xml_node_attribute_with_name(node, WI_STR("name"));
if(name)
command->name = wi_retain(name);
// get command permissions
permissions = wi_xml_node_attribute_with_name(node, WI_STR("permissions"));
if(permissions)
command->permissions = wi_retain(permissions);
// is an activated command ?
activated = wi_xml_node_attribute_with_name(node, WI_STR("activated"));
if(activated)
command->activated = wi_is_equal(activated, WI_STR("true")) ? true : false;
// get rule children: outputs
for(sub_node = node->children; sub_node != NULL; sub_node = next_node) {
next_node = sub_node->next;
if(sub_node->type == XML_ELEMENT_NODE) {
if(strcmp((const char *) sub_node->name, "output") == 0) {
output = wb_output_init(wb_output_alloc(), sub_node);
if(output)
wi_mutable_array_add_data(command->outputs, output);
wi_release(output);
}
}
}
return command;
}
示例10: wi_test_regexp_runtime_functions
void wi_test_regexp_runtime_functions(void) {
wi_regexp_t *regexp1, *regexp2;
regexp1 = wi_regexp_with_pattern(WI_STR("foobar"), 0);
regexp2 = wi_autorelease(wi_copy(regexp1));
WI_TEST_ASSERT_EQUAL_INSTANCES(regexp1, regexp2, "");
WI_TEST_ASSERT_EQUALS(wi_hash(regexp1), wi_hash(regexp2), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(regexp1), wi_regexp_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(regexp2), wi_regexp_runtime_id(), "");
WI_TEST_ASSERT_NOT_EQUALS(wi_string_index_of_string(wi_description(regexp1), wi_regexp_pattern(regexp1), 0), WI_NOT_FOUND, "");
}
示例11: wi_p7_socket_write_message
wi_boolean_t wi_p7_socket_write_message(wi_p7_socket_t *p7_socket, wi_time_interval_t timeout, wi_p7_message_t *p7_message) {
wi_boolean_t result;
wi_p7_message_serialize(p7_message);
wi_log_info(WI_STR("Sending %@"), p7_message);
if(p7_socket->serialization == WI_P7_BINARY)
result = _wi_p7_socket_write_binary_message(p7_socket, timeout, p7_message);
else
result = _wi_p7_socket_write_xml_message(p7_socket, timeout, p7_message);
if(!result)
return false;
wi_log_info(WI_STR("Sent %llu raw bytes, %llu processed bytes, compressed to %.2f%%"),
p7_socket->sent_raw_bytes,
p7_socket->sent_processed_bytes,
((double) p7_socket->sent_raw_bytes / (double) p7_socket->sent_processed_bytes) * 100.0);
return true;
}
示例12: wi_test_dsa_runtime_functions
void wi_test_dsa_runtime_functions(void) {
#ifdef WI_DSA
wi_dsa_t *dsa1, *dsa2;
dsa1 = wi_autorelease(wi_dsa_init_with_bits(wi_dsa_alloc(), 512));
dsa2 = wi_autorelease(wi_copy(dsa1));
WI_TEST_ASSERT_EQUAL_INSTANCES(wi_dsa_private_key(dsa1), wi_dsa_private_key(dsa2), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(dsa1), wi_dsa_runtime_id(), "");
WI_TEST_ASSERT_EQUALS(wi_runtime_id(dsa2), wi_dsa_runtime_id(), "");
WI_TEST_ASSERT_NOT_EQUALS(wi_string_index_of_string(wi_description(dsa1), WI_STR("384"), 0), WI_NOT_FOUND, "");
#endif
}
示例13: wr_command_privchat
static void wr_command_privchat(wi_array_t *arguments) {
wi_p7_message_t *message;
wi_string_t *nick;
wr_user_t *user;
if(wi_array_count(arguments) > 0) {
nick = WI_ARRAY(arguments, 0);
user = wr_chat_user_with_nick(wr_public_chat, nick);
if(!user) {
wr_printf_prefix(WI_STR("privchat: %@: Client not found"),
nick);
return;
}
wr_private_chat_invite_uid = wr_user_id(user);
}
message = wi_p7_message_with_name(WI_STR("wired.chat.create_chat"), wr_p7_spec);
wr_commands_send_message(message, WI_STR("privchat"));
}
示例14: wd_parse_command
static void wd_parse_command(wi_string_t *buffer) {
wd_client_t *client = wd_client();
wi_array_t *arguments;
wi_string_t *command;
unsigned int index;
wi_parse_wired_command(buffer, &command, &arguments);
index = wd_command_index(command);
if(index == WI_NOT_FOUND) {
wd_reply(501, WI_STR("Command Not Recognized"));
return;
}
if(client->state < wd_commands[index].state)
return;
if(wi_array_count(arguments) < wd_commands[index].args) {
wd_reply(503, WI_STR("Syntax Error"));
return;
}
if(wd_commands[index].activate) {
client->idle_time = wi_time_interval();
if(client->idle) {
client->idle = false;
wd_broadcast_lock();
wd_client_broadcast_status(client);
wd_broadcast_unlock();
}
}
((*wd_commands[index].action) (arguments));
}
示例15: wd_cmd_stat
static void wd_cmd_stat(wi_array_t *arguments) {
wd_client_t *client = wd_client();
wi_string_t *path;
path = WI_ARRAY(arguments, 0);
if(!wd_files_path_is_valid(path)) {
wd_reply(520, WI_STR("File or Directory Not Found"));
return;
}
if(!client->account->view_dropboxes) {
if(wd_files_path_is_dropbox(path)) {
wd_reply(520, WI_STR("File or Directory Not Found"));
return;
}
}
wd_files_stat_path(wi_string_by_normalizing_path(path));
}