本文整理汇总了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;
}
示例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;
}