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


C++ plist_get_string_val函数代码示例

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


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

示例1: np_get_notification

/**
 * Checks if a notification has been sent by the device.
 *
 * @param client NP to get a notification from
 * @param notification Pointer to a buffer that will be allocated and filled
 *  with the notification that has been received.
 *
 * @return 0 if a notification has been received or nothing has been received,
 *         or a negative value if an error occured.
 *
 * @note You probably want to check out np_set_notify_callback
 * @see np_set_notify_callback
 */
static int np_get_notification(np_client_t client, char **notification)
{
	int res = 0;
	plist_t dict = NULL;

	if (!client || !client->parent || *notification)
		return -1;

	np_lock(client);

	property_list_service_error_t perr = property_list_service_receive_plist_with_timeout(client->parent, &dict, 500);
	if (perr == PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT) {
		debug_info("NotificationProxy: no notification received!");
		res = 0;
	} else if (perr != PROPERTY_LIST_SERVICE_E_SUCCESS) {
		debug_info("NotificationProxy: error %d occured!", perr);
		res = perr;
	}
	if (dict) {
		char *cmd_value = NULL;
		plist_t cmd_value_node = plist_dict_get_item(dict, "Command");

		if (plist_get_node_type(cmd_value_node) == PLIST_STRING) {
			plist_get_string_val(cmd_value_node, &cmd_value);
		}

		if (cmd_value && !strcmp(cmd_value, "RelayNotification")) {
			char *name_value = NULL;
			plist_t name_value_node = plist_dict_get_item(dict, "Name");

			if (plist_get_node_type(name_value_node) == PLIST_STRING) {
				plist_get_string_val(name_value_node, &name_value);
			}

			res = -2;
			if (name_value_node && name_value) {
				*notification = name_value;
				debug_info("got notification %s", __func__, name_value);
				res = 0;
			}
		} else if (cmd_value && !strcmp(cmd_value, "ProxyDeath")) {
			debug_info("NotificationProxy died!");
			res = -1;
		} else if (cmd_value) {
			debug_info("unknown NotificationProxy command '%s' received!", cmd_value);
			res = -1;
		} else {
			res = -2;
		}
		if (cmd_value) {
			free(cmd_value);
		}
		plist_free(dict);
		dict = NULL;
	}

	np_unlock(client);

	return res;
}
开发者ID:libimobiledevice-win32,项目名称:libimobiledevice,代码行数:73,代码来源:notification_proxy.c

示例2: build_manifest_print_information

void build_manifest_print_information(plist_t build_manifest) {
	char* value = NULL;
	plist_t node = NULL;

	node = plist_dict_get_item(build_manifest, "ProductVersion");
	if (!node || plist_get_node_type(node) != PLIST_STRING) {
		error("ERROR: Unable to find ProductVersion node\n");
		return;
	}
	plist_get_string_val(node, &value);

	info("Product Version: %s\n", value);
	free(value);

	node = plist_dict_get_item(build_manifest, "ProductBuildVersion");
	if (!node || plist_get_node_type(node) != PLIST_STRING) {
		error("ERROR: Unable to find ProductBuildVersion node\n");
		return;
	}
	plist_get_string_val(node, &value);

	info("Product Build: %s\n", value);
	free(value);

	node = NULL;
}
开发者ID:AssassinSxXxCreed,项目名称:idevicerestore,代码行数:26,代码来源:idevicerestore.c

示例3: minst_client

void minst_client(const char *operation, plist_t status, void *unused) {
    cb++;
    if (cb == 8) {
    }
    if (status && operation) {
        plist_t npercent = plist_dict_get_item(status, "PercentComplete");
        plist_t nstatus = plist_dict_get_item(status, "Status");
        plist_t nerror = plist_dict_get_item(status, "Error");
        int percent = 0;
        char *status_msg = NULL;
        if (npercent) {
            uint64_t val = 0;
            plist_get_uint_val(npercent, &val);
            percent = val;
        }
        if (nstatus) {
            plist_get_string_val(nstatus, &status_msg);
            if (!strcmp(status_msg, "Complete")) {
                sleep(1);
                installing = 0;
            }
        }

        if (nerror) {
            char *err_msg = NULL;
            plist_get_string_val(nerror, &err_msg);
            free(err_msg);
            installing = 0;
            installError = 1;
        }
    } else {
    }
}
开发者ID:jevinskie,项目名称:OpenSun-C,代码行数:33,代码来源:openiapp.c

示例4: instproxy_get_app_path_by_name

LIBIMOBILEDEVICE_API instproxy_error_t instproxy_get_app_path_by_name(instproxy_client_t client, const char* app_name, char ** app_path, char ** exec_path)
{
    instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
    plist_t apps = NULL;
    plist_t client_options = instproxy_client_options_new();
    instproxy_client_options_add(client_options, "ApplicationType", "Any", NULL);
    
    res = instproxy_browse(client, client_options, &apps);
    
    instproxy_client_options_free(client_options);
    
    int app_count = plist_array_get_size(apps);
    for(int app_index = 0; app_index < app_count; app_index++){
        
        plist_t app_info_plist = plist_array_get_item(apps, app_index);
        plist_t app_bundle_display_name_plist = plist_dict_get_item(app_info_plist, "CFBundleDisplayName");
        
        char* app_name_tmp = NULL;
        plist_t app_path_plist = NULL;
        plist_t exec_path_plist = NULL;
        
        if (app_bundle_display_name_plist) {
            plist_get_string_val(app_bundle_display_name_plist, &app_name_tmp);
        }
        
        if (app_name_tmp == NULL || strcasecmp(app_name_tmp, app_name) != 0) {
            continue;
        }
        
        char * app_path_tmp = NULL;
        char * exec_path_tmp = NULL;
        
        app_path_plist = plist_dict_get_item(app_info_plist, "Path");
        if (app_path_plist) {
            plist_get_string_val(app_path_plist, &app_path_tmp);
        }
        
        exec_path_plist = plist_dict_get_item(app_info_plist, "CFBundleExecutable");
        if (exec_path_plist) {
            plist_get_string_val(exec_path_plist, &exec_path_tmp);
        }
        
        size_t app_path_length = strlen(app_path_tmp);
        size_t exec_path_length = strlen(exec_path_tmp);
        
        *app_path = (char *)alloca(app_path_length + 1);
        *exec_path = (char *)alloca(exec_path_length + 1);
        
        memset(*app_path, 0, app_path_length + 1);
        memset(*exec_path, 0, exec_path_length + 1);
        
        memcpy(*app_path, app_path_tmp, strlen(app_path_tmp));
        memcpy(*exec_path, exec_path_tmp, strlen(exec_path_tmp));
        break;
        
    }
    return res;
}
开发者ID:pyraman,项目名称:DeviceCenter,代码行数:58,代码来源:installation_proxy.c

示例5: plist_to_xml

void ibrowserAPI::installCallback(const char *operation, plist_t status, void *user_data) {
    char *xml_doc=NULL;
    uint32_t xml_length;
    
    Callback *cb = (Callback *)user_data;
    
    FB::JSObjectPtr pcb = cb->get("pcb");
    FB::JSObjectPtr scb = cb->get("scb");
    FB::JSObjectPtr ecb = cb->get("ecb");
    
    if(pcb)
    {
        plist_to_xml(status, &xml_doc, &xml_length);
        pcb->InvokeAsync("", FB::variant_list_of(xml_doc));
        free(xml_doc);
    }
    
    plist_dict_iter it = NULL;
	char* key = NULL;
    char*   s = NULL;
	plist_t subnode = NULL;
	plist_dict_new_iter(status, &it);
	plist_dict_next_item(status, it, &key, &subnode);
	while (subnode)
	{
		if(strcmp(key, "Error") == 0)
        {
            plist_get_string_val(subnode, &s);
            if(ecb)
                ecb->InvokeAsync("", FB::variant_list_of(s));
            
        }else if(strcmp(key, "Status") == 0){
            plist_get_string_val(subnode, &s);
            if(strcmp(s, "Complete") == 0){
                if(scb)
                    scb->InvokeAsync("", FB::variant_list_of(NULL));
            }
        }
		plist_dict_next_item(status, it, &key, &subnode);
        
	}

    if(key)
        free(key);
    if(s)
        free(s);
	free(it);
    return;
}
开发者ID:Y1Fo,项目名称:ibrowser_plugin,代码行数:49,代码来源:ibrowserAPI.cpp

示例6: status_cb

static void status_cb(const char *operation, plist_t status)
#endif
{
	if (status && operation) {
		plist_t npercent = plist_dict_get_item(status, "PercentComplete");
		plist_t nstatus = plist_dict_get_item(status, "Status");
		plist_t nerror = plist_dict_get_item(status, "Error");
		int percent = 0;
		char *status_msg = NULL;
		if (npercent) {
			uint64_t val = 0;
			plist_get_uint_val(npercent, &val);
			percent = val;
		}
		if (nstatus) {
			plist_get_string_val(nstatus, &status_msg);
			if (!strcmp(status_msg, "Complete")) {
				op_completed = 1;
			}
		}
		if (!nerror) {
			if (last_status && (strcmp(last_status, status_msg))) {
				printf("\r");
			}

			if (!npercent) {
				printf("%s - %s\n", operation, status_msg);
			} else {
				printf("%s - %s (%d%%)\n", operation, status_msg, percent);
			}
		} else {
			char *err_msg = NULL;
			plist_get_string_val(nerror, &err_msg);
			printf("%s - Error occured: %s\n", operation, err_msg);
			free(err_msg);
			err_occured = 1;
		}
		if (last_status) {
			free(last_status);
			last_status = NULL;
		}
		if (status_msg) {
			last_status = strdup(status_msg);
			free(status_msg);
		}
	} else {
		printf("%s: called with invalid data!\n", __func__);
	}
}
开发者ID:NitzanDavari,项目名称:ideviceinstaller,代码行数:49,代码来源:ideviceinstaller.c

示例7: isManifestSignedForDevice

int isManifestSignedForDevice(char *buildManifestPath, char **device, uint64_t ecid, int checkBaseband, char **version){
    int isSigned = 0;
#define reterror(a ...) {error(a); isSigned = -1; goto error;}
    plist_t manifest = NULL;
    plist_t ProductVersion = NULL;
    plist_t SupportedProductTypes = NULL;
    plist_t mDevice = NULL;
    
    info("[TSSC] opening %s\n",buildManifestPath);
    //filehandling
    FILE *fmanifest = fopen(buildManifestPath, "r");
    if (!fmanifest) reterror("[TSSC] ERROR: file %s nof found!\n",buildManifestPath);
    fseek(fmanifest, 0, SEEK_END);
    long fsize = ftell(fmanifest);
    fseek(fmanifest, 0, SEEK_SET);
    char *bufManifest = (char*)malloc(fsize + 1);
    fread(bufManifest, fsize, 1, fmanifest);
    fclose(fmanifest);
    
    plist_from_xml(bufManifest, (unsigned)strlen(bufManifest), &manifest);
    if (version && !*version){
        if (!manifest){
            warning("[TSSC] WARNING: could not find ProductVersion in BuildManifest.plist, failing to properly display iOS version\n");
        }else{
            ProductVersion = plist_dict_get_item(manifest, "ProductVersion");
            plist_get_string_val(ProductVersion, version);
        }
    }
    if (!*device) {
        if (manifest){
            SupportedProductTypes = plist_dict_get_item(manifest, "SupportedProductTypes");
            if (SupportedProductTypes) {
                mDevice = plist_array_get_item(SupportedProductTypes, 0);
                plist_get_string_val(mDevice, device);
            }
        }
        if (!*device) reterror("[TSSR] ERROR: device wasn't specified and could not be fetched from BuildManifest\n")
        else info("[TSSR] requesting ticket for %s\n",*device);
    }
    
    isSigned = isManifestBufSignedForDevice(bufManifest, *device, ecid, checkBaseband);
    
error:
    if (manifest) plist_free(manifest);
    free(bufManifest);
    return isSigned;
#undef reterror
}
开发者ID:K0smas,项目名称:tsschecker,代码行数:48,代码来源:tsschecker.c

示例8: restored_check_result

/**
 * Internally used function for checking the result from restore's answer
 * plist to a previously sent request.
 *
 * @param dict The plist to evaluate.
 * @param query_match Name of the request to match.
 *
 * @return RESULT_SUCCESS when the result is 'Success',
 *         RESULT_FAILURE when the result is 'Failure',
 *         or a negative value if an error occured during evaluation.
 */
static int restored_check_result(plist_t dict)
{
	int ret = -1;
	plist_t result_node = plist_dict_get_item(dict, "Result");
	if (!result_node) {
		return ret;
	}

	plist_type result_type = plist_get_node_type(result_node);

	if (result_type == PLIST_STRING) {

		char *result_value = NULL;

		plist_get_string_val(result_node, &result_value);

		if (result_value) {
			if (!strcmp(result_value, "Success")) {
				ret = RESULT_SUCCESS;
			} else if (!strcmp(result_value, "Failure")) {
				ret = RESULT_FAILURE;
			} else {
				debug_info("ERROR: unknown result value '%s'", result_value);
			}
		}
		if (result_value)
			free(result_value);
	}
	return ret;
}
开发者ID:AmongOthers,项目名称:libimobiledevice-win32,代码行数:41,代码来源:restore.c

示例9: instproxy_client_options_new

DeviceStatus Device::getApps() {
    plist_t apps = NULL;
    plist_t opts;
    opts = instproxy_client_options_new();
    instproxy_client_options_add(opts, "ApplicationType", "Any", NULL);
    if (instproxy_browse(this->mInstProxy, opts, &apps) != INSTPROXY_E_SUCCESS) {
        instproxy_client_options_free(opts);
        return StatusError;
    }
    int count = plist_array_get_size(apps) / 2;
    for (int i = 0; i < count; i++) {
        plist_t app;
        app = plist_array_get_item(apps, i);
        plist_t appId;
        appId = plist_dict_get_item(app, "CFBundleIdentifier");
        char *sAppId;
        plist_get_string_val(appId, &sAppId);
        this->mApps.insert(sAppId);
        //cout << i << "\t" << sAppId << endl;
        free(sAppId);
        plist_free(appId);
        plist_free(app);
    }
    plist_free(apps);
    instproxy_client_options_free(opts);
    return StatusOK;
}
开发者ID:monstersb,项目名称:iOS-Tool,代码行数:27,代码来源:device.cpp

示例10: plist_array_get_item

/**
 * Internally used function to extract the message string from a DLMessage*
 * plist.
 *
 * @param dl_msg The DeviceLink property list to parse.
 *
 * @return An allocated char* with the DLMessage from the given plist,
 *     or NULL when the plist does not contain any DLMessage. It is up to
 *     the caller to free the allocated memory.
 */
static char *device_link_service_get_message(plist_t dl_msg)
{
    uint32_t cnt = 0;
    plist_t cmd = 0;
    char *cmd_str = NULL;

    /* sanity check */
    if ((plist_get_node_type(dl_msg) != PLIST_ARRAY) || ((cnt = plist_array_get_size(dl_msg)) < 1)) {
        return NULL;
    }

    /* get dl command */
    cmd = plist_array_get_item(dl_msg, 0);
    if (!cmd || (plist_get_node_type(cmd) != PLIST_STRING)) {
        return NULL;
    }

    plist_get_string_val(cmd, &cmd_str);
    if (!cmd_str) {
        return NULL;
    }

    if ((strlen(cmd_str) < (strlen("DLMessage")+1))
            || (strncmp(cmd_str, "DLMessage", strlen("DLMessage")))) {
        free(cmd_str);
        return NULL;
    }

    /* we got a DLMessage* command */
    return cmd_str;
}
开发者ID:0xFireball,项目名称:libiphone,代码行数:41,代码来源:device_link_service.c

示例11: device_link_service_get_message

/**
 * Internally used function to extract the message string from a DL* message
 * plist.
 *
 * @param dl_msg The DeviceLink property list to parse.
 * @param message A pointer that will be set to a newly allocated char*
 *     containing the DLMessage* string from the given plist. It is up to
 *     the caller to free the allocated memory. If this parameter is NULL
 *     it will be ignored.
 *
 * @return 1 if the given plist is a DL* message, or 0 if the plist does not
 *     contain any DL* message.
 */
static int device_link_service_get_message(plist_t dl_msg, char **message)
{
	plist_t cmd = NULL;
	char *cmd_str = NULL;

	/* sanity check */
	if ((plist_get_node_type(dl_msg) != PLIST_ARRAY) || (plist_array_get_size(dl_msg) < 1)) {
		return 0;
	}

	/* get dl command */
	cmd = plist_array_get_item(dl_msg, 0);
	if (!cmd || (plist_get_node_type(cmd) != PLIST_STRING)) {
		return 0;
	}

	plist_get_string_val(cmd, &cmd_str);
	if (!cmd_str) {
		return 0;
	}

	if ((strlen(cmd_str) < 9) || (strncmp(cmd_str, "DL", 2))) {
		free(cmd_str);
		return 0;
	}

	if (message)
		*message = cmd_str;

	/* we got a DL* message */
	return 1;
}
开发者ID:MCE-KobyBo,项目名称:libimobiledevice,代码行数:45,代码来源:device_link_service.c

示例12: mobileactivation_send_command_plist

static mobileactivation_error_t mobileactivation_send_command_plist(mobileactivation_client_t client, plist_t command, plist_t *result)
{
	if (!client || !command)
		return MOBILEACTIVATION_E_INVALID_ARG;

	plist_t cmd = plist_dict_get_item(command, "Command");
	char* command_str = NULL;
	if (cmd) {
		plist_get_string_val(cmd, &command_str);
	}
	if (!command_str)
		return MOBILEACTIVATION_E_INVALID_ARG;

	mobileactivation_error_t ret = MOBILEACTIVATION_E_UNKNOWN_ERROR;
	*result = NULL;

	ret = mobileactivation_error(property_list_service_send_binary_plist(client->parent, command));

	plist_t dict = NULL;
	ret = mobileactivation_error(property_list_service_receive_plist(client->parent, &dict));
	if (!dict) {
		debug_info("ERROR: Did not get reply for %s command", command_str);
		free(command_str);
		return MOBILEACTIVATION_E_PLIST_ERROR;
	}

	*result = dict;
	ret = mobileactivation_check_result(dict, command_str);
	free(command_str);
	return ret;
}
开发者ID:Tatsh,项目名称:libimobiledevice,代码行数:31,代码来源:mobileactivation.c

示例13: mobilebackup_request_backup

/**
 * Request a backup from the connected device.
 *
 * @param client The connected MobileBackup client to use.
 * @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
 *    containing the backup state of the last backup. For a first-time backup
 *    set this parameter to NULL.
 * @param base_path The base path on the device to use for the backup
 *    operation, usually "/".
 * @param proto_version A string denoting the version of the backup protocol
 *    to use. Latest known version is "1.6"
 *
 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 *    one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
 *    backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
 *    if a communication error occurs, MOBILEBACKUP_E_REPLY_NOT_OK
 */
mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist_t backup_manifest, const char *base_path, const char *proto_version)
{
	if (!client || !client->parent || !base_path || !proto_version)
		return MOBILEBACKUP_E_INVALID_ARG;

	if (backup_manifest && (plist_get_node_type(backup_manifest) != PLIST_DICT))
		return MOBILEBACKUP_E_PLIST_ERROR;

	mobilebackup_error_t err;

	/* construct request plist */
	plist_t dict = plist_new_dict();
	if (backup_manifest)
		plist_dict_insert_item(dict, "BackupManifestKey", plist_copy(backup_manifest));
	plist_dict_insert_item(dict, "BackupComputerBasePathKey", plist_new_string(base_path));
	plist_dict_insert_item(dict, "BackupMessageTypeKey", plist_new_string("BackupMessageBackupRequest"));
	plist_dict_insert_item(dict, "BackupProtocolVersion", plist_new_string(proto_version));

	/* send request */
	err = mobilebackup_send_message(client, NULL, dict);
	plist_free(dict);
	dict = NULL;
	if (err != MOBILEBACKUP_E_SUCCESS) {
		debug_info("ERROR: Could not send backup request message (%d)!", err);
		goto leave;
	}

	/* now receive and hopefully get a BackupMessageBackupReplyOK */
	err = mobilebackup_receive_message(client, "BackupMessageBackupReplyOK", &dict);
	if (err != MOBILEBACKUP_E_SUCCESS) {
		debug_info("ERROR: Could not receive BackupReplyOK message (%d)!", err);
		goto leave;
	}

	plist_t node = plist_dict_get_item(dict, "BackupProtocolVersion");
	if (node) {
		char *str = NULL;
		plist_get_string_val(node, &str);
		if (str) {
			if (strcmp(str, proto_version) != 0) {
				err = MOBILEBACKUP_E_BAD_VERSION;
			}
			free(str);
		}
	}
	if (err != MOBILEBACKUP_E_SUCCESS)
		goto leave;

	/* BackupMessageBackupReplyOK received, send it back */
	err = mobilebackup_send_message(client, NULL, dict);
	if (err != MOBILEBACKUP_E_SUCCESS) {
		debug_info("ERROR: Could not send BackupReplyOK ACK (%d)", err);
	}

leave:
	if (dict)
		plist_free(dict);
	return err;
}
开发者ID:Cunzhang,项目名称:libimobiledevice,代码行数:76,代码来源:mobilebackup.c

示例14: instproxy_command_get_name

LIBIMOBILEDEVICE_API void instproxy_command_get_name(plist_t command, char** name)
{
	*name = NULL;
	plist_t node = plist_dict_get_item(command, "Command");
	if (node) {
		plist_get_string_val(node, name);
	}
}
开发者ID:pyraman,项目名称:DeviceCenter,代码行数:8,代码来源:installation_proxy.c

示例15: fill_in_info

int fill_in_info()
{
	plist_t *node=NULL;
	char* type=NULL;
	char* version=NULL;
	char* name=NULL;

	char* img=NULL;

	lockdownd_get_device_name(client, &name);

	lockdownd_get_value(client, NULL, "ProductType", &node);
	plist_get_string_val(node, &type);
	plist_free(node);
	node=NULL;

	lockdownd_get_value(client, NULL, "ProductVersion", &node);
	plist_get_string_val(node, &version);
	plist_free(node);
	node=NULL;

	plist_from_xml(img_plist, strlen(img_plist), &node);
	plist_t devNode=plist_dict_get_item(node, type);
	if (!devNode)
	{
		printf("ERROR: Unknown device!\n");
	}
	plist_get_string_val(devNode, &img);
	plist_free(node);
	node=NULL;
	strcpy(data, "");

	gtk_image_set_from_file(devImg, img);

	//gtk_label_set_use_underline(dName, TRUE);

	char devL[512]="";

	snprintf(devL, 512, "<b>%s</b>", name);

	gtk_label_set_text(dName, name);
	gtk_label_set_markup(dName, devL);
	gtk_label_set_text(fV, version);

	return 0;
}
开发者ID:Ebenstein,项目名称:iDeviceActivator,代码行数:46,代码来源:gtk-activator.c


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