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


C++ EvDocumentClass::load方法代码示例

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


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

示例1:

/**
 * ev_document_load:
 * @document: a #EvDocument
 * @uri: the document's URI
 * @error: a #GError location to store an error, or %NULL
 *
 * Loads @document from @uri.
 *
 * On failure, %FALSE is returned and @error is filled in.
 * If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned.
 * If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID
 * is returned. Other errors are possible too, depending on the backend
 * used to load the document and the URI, e.g. #GIOError, #GFileError, and
 * #GConvertError.
 *
 * Returns: %TRUE on success, or %FALSE on failure.
 */
gboolean
ev_document_load (EvDocument  *document,
                  const char  *uri,
                  GError     **error)
{
    EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
    gboolean retval;
    GError *err = NULL;

    retval = klass->load (document, uri, &err);
    if (!retval) {
        if (err) {
            g_propagate_error (error, err);
        } else {
            g_warning ("%s::EvDocument::load returned FALSE but did not fill in @error; fix the backend!\n",
                       G_OBJECT_TYPE_NAME (document));

            /* So upper layers don't crash */
            g_set_error_literal (error,
                                 EV_DOCUMENT_ERROR,
                                 EV_DOCUMENT_ERROR_INVALID,
                                 "Internal error in backend");
        }
    } else {
        ev_document_setup_cache (document);
        document->priv->uri = g_strdup (uri);
        ev_document_initialize_synctex (document, uri);
    }

    return retval;
}
开发者ID:xbezdick,项目名称:evince-dualhead,代码行数:48,代码来源:ev-document.c

示例2:

/**
 * ev_document_load:
 * @document: a #EvDocument
 * @uri: the document's URI
 * @error: a #GError location to store an error, or %NULL
 *
 * Loads @document from @uri.
 * 
 * On failure, %FALSE is returned and @error is filled in.
 * If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned.
 * If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID
 * is returned. Other errors are possible too, depending on the backend
 * used to load the document and the URI, e.g. #GIOError, #GFileError, and
 * #GConvertError.
 *
 * Returns: %TRUE on success, or %FALSE on failure.
 */
gboolean
ev_document_load (EvDocument  *document,
		  const char  *uri,
		  GError     **error)
{
	EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
	gboolean retval;
	GError *err = NULL;

	retval = klass->load (document, uri, &err);
	if (!retval) {
		if (err) {
			g_propagate_error (error, err);
		} else {
			g_warning ("%s::EvDocument::load returned FALSE but did not fill in @error; fix the backend!\n",
				   G_OBJECT_TYPE_NAME (document));

			/* So upper layers don't crash */
			g_set_error_literal (error,
					     EV_DOCUMENT_ERROR,
					     EV_DOCUMENT_ERROR_INVALID,
					     "Internal error in backend");
		}
	} else {
                EvDocumentPrivate *priv = document->priv;

                ev_document_setup_cache (document);

                priv->uri = g_strdup (uri);
                priv->info = _ev_document_get_info (document);
                if (_ev_document_support_synctex (document)) {
                        gchar *filename;

                        filename = g_filename_from_uri (uri, NULL, NULL);
                        if (filename != NULL) {
                                priv->synctex_scanner =
                                        synctex_scanner_new_with_output_file (filename, NULL, 1);
                                g_free (filename);
                        }
                }
        }

	return retval;
}
开发者ID:sciamp,项目名称:evince-mirror,代码行数:61,代码来源:ev-document.c


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