📄 wrapper_template.h
字号:
/** * @copyright * ==================================================================== * Copyright (c) 2005 CollabNet. All rights reserved. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://subversion.tigris.org/license-1.html. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://subversion.tigris.org/. * ==================================================================== * @endcopyright *//* This file is a template for a compatibility wrapper for an RA library. * It contains an svn_ra_plugin_t and wrappers for all of its functions, * implemented in terms of svn_ra__vtable_t functions. It also contains * the implementations of an svn_ra_FOO_init for the FOO RA library. * * A file in the RA library includes this file, providing the * following macros before inclusion: * * NAME The library name, e.g. "ra_local". * DESCRIPTION The short library description as a string constant. * VTBL The name of an svn_ra_vtable_t object for the library. * INITFUNC The init function for the library, e.g. svn_ra_local__init. * COMPAT_INITFUNC The compatibility init function, e.g. svn_ra_local_init. *//* Check that all our "arguments" are defined. */#if ! defined(NAME) || ! defined(DESCRIPTION) || ! defined(VTBL) \ || ! defined(INITFUNC) || ! defined(COMPAT_INITFUNC)#error Missing define for RA compatibility wrapper.#endifstatic svn_error_t *compat_open(void **session_baton, const char *repos_URL, const svn_ra_callbacks_t *callbacks, void *callback_baton, apr_hash_t *config, apr_pool_t *pool){ /* Here, we should be calling svn_ra_create_callbacks to initialize * the svn_ra_callbacks2_t structure. However, doing that * introduces a circular dependancy between libsvn_ra and * libsvn_ra_{local,dav,svn}, which include wrapper_template.h. In * turn, circular dependancies break the build on win32 (and * possibly other systems). * * In order to avoid this happening at all, the code of * svn_ra_create_callbacks is duplicated here. This is evil, but * the alternative (creating a new ra_util library) would be massive * overkill for the time being. Just be sure to keep the following * line and the code of svn_ra_create_callbacks in sync. */ svn_ra_callbacks2_t *callbacks2 = apr_pcalloc(pool, sizeof(*callbacks2)); svn_ra_session_t *sess = apr_pcalloc(pool, sizeof(svn_ra_session_t)); sess->vtable = &VTBL; sess->pool = pool; callbacks2->open_tmp_file = callbacks->open_tmp_file; callbacks2->auth_baton = callbacks->auth_baton; callbacks2->get_wc_prop = callbacks->get_wc_prop; callbacks2->set_wc_prop = callbacks->set_wc_prop; callbacks2->push_wc_prop = callbacks->push_wc_prop; callbacks2->invalidate_wc_props = callbacks->invalidate_wc_props; callbacks2->progress_func = NULL; callbacks2->progress_baton = NULL; SVN_ERR(VTBL.open(sess, repos_URL, callbacks2, callback_baton, config, pool)); *session_baton = sess; return SVN_NO_ERROR;}static svn_error_t *compat_get_latest_revnum(void *session_baton, svn_revnum_t *latest_revnum, apr_pool_t *pool){ return VTBL.get_latest_revnum(session_baton, latest_revnum, pool);}static svn_error_t *compat_get_dated_revision(void *session_baton, svn_revnum_t *revision, apr_time_t tm, apr_pool_t *pool){ return VTBL.get_dated_revision(session_baton, revision, tm, pool);}static svn_error_t *compat_change_rev_prop(void *session_baton, svn_revnum_t rev, const char *propname, const svn_string_t *value, apr_pool_t *pool){ return VTBL.change_rev_prop(session_baton, rev, propname, value, pool);}static svn_error_t *compat_rev_proplist(void *session_baton, svn_revnum_t rev, apr_hash_t **props, apr_pool_t *pool){ return VTBL.rev_proplist(session_baton, rev, props, pool);}static svn_error_t *compat_rev_prop(void *session_baton, svn_revnum_t rev, const char *propname, svn_string_t **value, apr_pool_t *pool){ return VTBL.rev_prop(session_baton, rev, propname, value, pool);}static svn_error_t *compat_get_commit_editor(void *session_baton, const svn_delta_editor_t **editor, void **edit_baton, const char *log_msg, svn_commit_callback_t callback, void *callback_baton, apr_pool_t *pool){ svn_commit_callback2_t callback2; void *callback2_baton; svn_compat_wrap_commit_callback(&callback2, &callback2_baton, callback, callback_baton, pool); return VTBL.get_commit_editor(session_baton, editor, edit_baton, log_msg, callback2, callback2_baton, NULL, TRUE, pool);}static svn_error_t *compat_get_file(void *session_baton, const char *path, svn_revnum_t revision, svn_stream_t *stream, svn_revnum_t *fetched_rev, apr_hash_t **props, apr_pool_t *pool){ return VTBL.get_file(session_baton, path, revision, stream, fetched_rev, props, pool);}static svn_error_t *compat_get_dir(void *session_baton, const char *path, svn_revnum_t revision, apr_hash_t **dirents, svn_revnum_t *fetched_rev, apr_hash_t **props, apr_pool_t *pool){ return VTBL.get_dir(session_baton, dirents, fetched_rev, props, path, revision, SVN_DIRENT_ALL, pool);}struct compat_report_baton { const svn_ra_reporter2_t *reporter; void *baton;};static svn_error_t *compat_set_path(void *report_baton, const char *path, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool){ struct compat_report_baton *crb = report_baton; return crb->reporter->set_path(crb->baton, path, revision, start_empty, NULL, pool);}static svn_error_t *compat_delete_path(void *report_baton, const char *path, apr_pool_t *pool){ struct compat_report_baton *crb = report_baton; return crb->reporter->delete_path(crb->baton, path, pool);}static svn_error_t *compat_link_path(void *report_baton, const char *path, const char *url, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool){ struct compat_report_baton *crb = report_baton; return crb->reporter->link_path(crb->baton, path, url, revision, start_empty, NULL, pool);}static svn_error_t *compat_finish_report(void *report_baton, apr_pool_t *pool){ struct compat_report_baton *crb = report_baton; return crb->reporter->finish_report(crb->baton, pool);}static svn_error_t *compat_abort_report(void *report_baton, apr_pool_t *pool){ struct compat_report_baton *crb = report_baton; return crb->reporter->abort_report(crb->baton, pool);}static const svn_ra_reporter_t compat_reporter = { compat_set_path, compat_delete_path, compat_link_path,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -