Author: brane Date: Fri Jan 4 10:38:53 2019 New Revision: 1850344 URL: http://svn.apache.org/viewvc?rev=1850344&view=rev Log: Move (some of the) standalone types into separate implementation headers so that SVN++ can use them directly without exposing APR or other dependencies.
* subversion/include/svn_opt_impl.h: New file. (svn_opt_revision_kind): Moved here from svn_opt.h * subversion/include/svn_opt.h: Include svn_opt_impl.h. (svn_opt_revision_kind): Moved away. * subversion/include/svn_types_impl.h: New file. (svn_error_t): Forward declaration. (svn_node_kind_t, svn_tristate_t, svn_revnum_t, SVN_INVALID_REVNUM, svn_depth_t): Moved here from svn_types.h. * subversion/include/svn_types.h: Include svn_types_impl.h. (svn_node_kind_t, svn_tristate_t, svn_revnum_t, SVN_INVALID_REVNUM, svn_depth_t): Moved away. [in subversion/bindings/cxx] * include/svnxx/depth.hpp: Include svn_types_impl.h. (depth): Define enum constant values from svn_depth_t. * include/svnxx/exception.hpp: Include svn_types_impl.h. (detail::svn_error): Remove forward declaration. (detail::error_ptr): Use svn_error_t directly. * include/svnxx/revision.hpp: Include svn_opt_impl.h and svn_types_impl.h. (revision::number): Use svn_revnum_t for the underlying type and SVN_INVALID_REVNUM for the 'invalid' enum constant value. (revision::kind): Define enum constant values from svn_opt_revision_kind. * include/svnxx/tristate.hpp: Include svn_types_impl.h. (tristate::value): Define enum constant values from svn_tristate_t. * src/exception.cpp (detail::svn_error): Removed. (impl::checked_call): Use svn_error_t instead of detail::svn_error. Added: subversion/trunk/subversion/include/svn_opt_impl.h (with props) subversion/trunk/subversion/include/svn_types_impl.h (with props) Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/depth.hpp subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp subversion/trunk/subversion/bindings/cxx/include/svnxx/revision.hpp subversion/trunk/subversion/bindings/cxx/include/svnxx/tristate.hpp subversion/trunk/subversion/bindings/cxx/src/exception.cpp subversion/trunk/subversion/include/svn_opt.h subversion/trunk/subversion/include/svn_types.h Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/depth.hpp URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/depth.hpp?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/cxx/include/svnxx/depth.hpp (original) +++ subversion/trunk/subversion/bindings/cxx/include/svnxx/depth.hpp Fri Jan 4 10:38:53 2019 @@ -25,6 +25,8 @@ #ifndef SVNXX_DEPTH_HPP #define SVNXX_DEPTH_HPP +#include "svn_types_impl.h" + #include <cstdint> #include <string> @@ -38,12 +40,12 @@ namespace svnxx { // NOTE: Keep these values identical to those in svn_depth_t! enum class depth : std::int8_t { - unknown = -2, - exclude = -1, - empty = 0, - files = 1, - immediates = 2, - infinity = 3, + unknown = svn_depth_unknown, + exclude = svn_depth_exclude, + empty = svn_depth_empty, + files = svn_depth_files, + immediates = svn_depth_immediates, + infinity = svn_depth_infinity, }; /** Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp (original) +++ subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp Fri Jan 4 10:38:53 2019 @@ -25,6 +25,8 @@ #ifndef SVNXX_EXCEPTION_HPP #define SVNXX_EXCEPTION_HPP +#include "svn_types_impl.h" + #include <exception> #include <memory> #include <new> @@ -106,8 +108,7 @@ private: }; namespace detail { -struct svn_error; -using error_ptr = std::shared_ptr<svn_error>; +using error_ptr = std::shared_ptr<svn_error_t>; } // namespace detail /** Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/revision.hpp URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/revision.hpp?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/cxx/include/svnxx/revision.hpp (original) +++ subversion/trunk/subversion/bindings/cxx/include/svnxx/revision.hpp Fri Jan 4 10:38:53 2019 @@ -25,6 +25,9 @@ #ifndef SVNXX_REVISION_HPP #define SVNXX_REVISION_HPP +#include "svn_opt_impl.h" +#include "svn_types_impl.h" + #include <chrono> #include <cstdint> @@ -47,9 +50,9 @@ public: /** * @brief Revision number type. */ - enum class number : long + enum class number : svn_revnum_t { - invalid = -1, ///< Invalid revision number. + invalid = SVN_INVALID_REVNUM, ///< Invalid revision number. }; /** @@ -69,14 +72,14 @@ public: // NOTE: Keep these values identical to those in svn_opt_revision_kind! enum class kind : std::int8_t { - unspecified, - number, - date, - committed, - previous, - base, - working, - head, + unspecified = svn_opt_revision_unspecified, + number = svn_opt_revision_number, + date = svn_opt_revision_date, + committed = svn_opt_revision_committed, + previous = svn_opt_revision_previous, + base = svn_opt_revision_base, + working = svn_opt_revision_working, + head = svn_opt_revision_head, }; /** Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/tristate.hpp URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/tristate.hpp?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/cxx/include/svnxx/tristate.hpp (original) +++ subversion/trunk/subversion/bindings/cxx/include/svnxx/tristate.hpp Fri Jan 4 10:38:53 2019 @@ -25,6 +25,10 @@ #ifndef SVNXX_TRISTATE_HPP #define SVNXX_TRISTATE_HPP +#include "svn_types_impl.h" + +#include <cstdint> + #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN) #include <boost/logic/tribool.hpp> #endif @@ -132,11 +136,11 @@ public: } private: - // See svn_tristate_t in svn_types.h. - enum: unsigned char { - false_value = 2, - true_value, - unknown_value + // NOTE: Keep these values identical to those in svn_tristate_t! + enum : std::uint8_t { + false_value = svn_tristate_false, + true_value = svn_tristate_true, + unknown_value = svn_tristate_unknown } value; #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN) Modified: subversion/trunk/subversion/bindings/cxx/src/exception.cpp URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/src/exception.cpp?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/cxx/src/exception.cpp (original) +++ subversion/trunk/subversion/bindings/cxx/src/exception.cpp Fri Jan 4 10:38:53 2019 @@ -37,11 +37,6 @@ namespace apache { namespace subversion { namespace svnxx { -namespace detail { -struct svn_error final : svn_error_t {}; -} // namespace detail - - // // checked_call // @@ -50,7 +45,6 @@ namespace impl { void checked_call(svn_error_t* const err) { - using svn_error = detail::svn_error; using error_ptr = detail::error_ptr; if (!err) @@ -58,32 +52,31 @@ void checked_call(svn_error_t* const err struct error_builder final : public error { - explicit error_builder(error_ptr err_) - : error(err_) + explicit error_builder(error_ptr ptr) + : error(ptr) {} }; struct cancelled_builder final : public cancelled { - explicit cancelled_builder(error_ptr err_) - : cancelled(err_) + explicit cancelled_builder(error_ptr ptr) + : cancelled(ptr) {} }; static const auto error_deleter = - [](svn_error* ptr) noexcept + [](svn_error_t* err) noexcept { - svn_error_clear(ptr); + svn_error_clear(err); }; - auto err_ptr = error_ptr(static_cast<svn_error*>(err), error_deleter); for (auto next = err; next; next = next->child) { if (next->apr_err == SVN_ERR_CANCELLED || next->apr_err == SVN_ERR_ITER_BREAK) - throw cancelled_builder(err_ptr); + throw cancelled_builder(error_ptr(err, error_deleter)); } - throw error_builder(err_ptr); + throw error_builder(error_ptr(err, error_deleter)); } } // namespace impl Modified: subversion/trunk/subversion/include/svn_opt.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_opt.h?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_opt.h (original) +++ subversion/trunk/subversion/include/svn_opt.h Fri Jan 4 10:38:53 2019 @@ -27,6 +27,8 @@ #ifndef SVN_OPT_H #define SVN_OPT_H +#include "svn_opt_impl.h" + #include <apr.h> #include <apr_pools.h> #include <apr_getopt.h> @@ -443,43 +445,7 @@ svn_opt_subcommand_help(const char *subc /* Parsing revision and date options. */ - -/** - * Various ways of specifying revisions. - * - * @note - * In contexts where local mods are relevant, the `working' kind - * refers to the uncommitted "working" revision, which may be modified - * with respect to its base revision. In other contexts, `working' - * should behave the same as `committed' or `current'. - */ -enum svn_opt_revision_kind { - /** No revision information given. */ - svn_opt_revision_unspecified, - - /** revision given as number */ - svn_opt_revision_number, - - /** revision given as date */ - svn_opt_revision_date, - - /** rev of most recent change */ - svn_opt_revision_committed, - - /** (rev of most recent change) - 1 */ - svn_opt_revision_previous, - - /** .svn/entries current revision */ - svn_opt_revision_base, - - /** current, plus local mods */ - svn_opt_revision_working, - - /** repository youngest */ - svn_opt_revision_head - - /* please update svn_opt__revision_to_string() when extending this enum */ -}; +/* NOTE: svn_opt_revision_kind is defined in svn_opt_impl.h */ /** * A revision value, which can be specified as a number or a date. Added: subversion/trunk/subversion/include/svn_opt_impl.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_opt_impl.h?rev=1850344&view=auto ============================================================================== --- subversion/trunk/subversion/include/svn_opt_impl.h (added) +++ subversion/trunk/subversion/include/svn_opt_impl.h Fri Jan 4 10:38:53 2019 @@ -0,0 +1,83 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_opt.h + * @brief Option and argument parsing for Subversion command lines + * (common implementation) + */ + +/* NOTE: + * This file *must not* include or depend on any other header except + * the C standard library headers. + */ + +#ifndef SVN_OPT_IMPL_H +#define SVN_OPT_IMPL_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + * Various ways of specifying revisions. + * + * @note + * In contexts where local mods are relevant, the `working' kind + * refers to the uncommitted "working" revision, which may be modified + * with respect to its base revision. In other contexts, `working' + * should behave the same as `committed' or `current'. + */ +/* NOTE: Update svnxx/revision.hpp when changing this enum. */ +enum svn_opt_revision_kind { + /** No revision information given. */ + svn_opt_revision_unspecified, + + /** revision given as number */ + svn_opt_revision_number, + + /** revision given as date */ + svn_opt_revision_date, + + /** rev of most recent change */ + svn_opt_revision_committed, + + /** (rev of most recent change) - 1 */ + svn_opt_revision_previous, + + /** .svn/entries current revision */ + svn_opt_revision_base, + + /** current, plus local mods */ + svn_opt_revision_working, + + /** repository youngest */ + svn_opt_revision_head + + /* please update svn_opt__revision_to_string() when extending this enum */ +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_OPT_IMPL_H */ Propchange: subversion/trunk/subversion/include/svn_opt_impl.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: subversion/trunk/subversion/include/svn_types.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1850344&r1=1850343&r2=1850344&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_types.h (original) +++ subversion/trunk/subversion/include/svn_types.h Fri Jan 4 10:38:53 2019 @@ -27,6 +27,8 @@ #ifndef SVN_TYPES_H #define SVN_TYPES_H +#include "svn_types_impl.h" + /* ### this should go away, but it causes too much breakage right now */ #include <stdlib.h> #include <limits.h> /* for ULONG_MAX */ @@ -303,28 +305,7 @@ apr_hash_this_val(apr_hash_index_t *hi); -/** The various types of nodes in the Subversion filesystem. */ -typedef enum svn_node_kind_t -{ - /** absent */ - svn_node_none, - - /** regular file */ - svn_node_file, - - /** directory */ - svn_node_dir, - - /** something's here, but we don't know what */ - svn_node_unknown, - - /** - * symbolic link - * @note This value is not currently used by the public API. - * @since New in 1.8. - */ - svn_node_symlink -} svn_node_kind_t; +/* NOTE: svn_node_kind_t is defined in svn_types_impl.h */ /** Return a constant string expressing @a kind as an English word, e.g., * "file", "dir", etc. The string is not localized, as it may be used for @@ -346,23 +327,7 @@ svn_node_kind_t svn_node_kind_from_word(const char *word); -/** Generic three-state property to represent an unknown value for values - * that are just like booleans. The values have been set deliberately to - * make tristates disjoint from #svn_boolean_t. - * - * @note It is unsafe to use apr_pcalloc() to allocate these, since '0' is - * not a valid value. - * - * @since New in 1.7. */ -typedef enum svn_tristate_t -{ - /** state known to be false (the constant does not evaulate to false) */ - svn_tristate_false = 2, - /** state known to be true */ - svn_tristate_true, - /** state could be true or false */ - svn_tristate_unknown -} svn_tristate_t; +/* NOTE: svn_tristate_t is defined in svn_types_impl.h */ /** Return a constant string "true", "false" or NULL representing the value of * @a tristate. @@ -422,15 +387,11 @@ svn_tristate__from_word(const char * wor -/** A revision number. */ -typedef long int svn_revnum_t; +/* NOTE: svn_revnum_t and SVN_INVALID_REVNUM are defined in svn_types_impl.h */ /** Valid revision numbers begin at 0 */ #define SVN_IS_VALID_REVNUM(n) ((n) >= 0) -/** The 'official' invalid revision num */ -#define SVN_INVALID_REVNUM ((svn_revnum_t) -1) - /** Not really invalid...just unimportant -- one day, this can be its * own unique value, for now, just make it the same as * #SVN_INVALID_REVNUM. @@ -494,55 +455,7 @@ enum svn_recurse_kind svn_recursive }; -/** The concept of depth for directories. - * - * @note This is similar to, but not exactly the same as, the WebDAV - * and LDAP concepts of depth. - * - * @since New in 1.5. - */ -typedef enum svn_depth_t -{ - /* The order of these depths is important: the higher the number, - the deeper it descends. This allows us to compare two depths - numerically to decide which should govern. */ - - /** Depth undetermined or ignored. In some contexts, this means the - client should choose an appropriate default depth. The server - will generally treat it as #svn_depth_infinity. */ - svn_depth_unknown = -2, - - /** Exclude (i.e., don't descend into) directory D. - @note In Subversion 1.5, svn_depth_exclude is *not* supported - anywhere in the client-side (libsvn_wc/libsvn_client/etc) code; - it is only supported as an argument to set_path functions in the - ra and repos reporters. (This will enable future versions of - Subversion to run updates, etc, against 1.5 servers with proper - svn_depth_exclude behavior, once we get a chance to implement - client-side support for svn_depth_exclude.) - */ - svn_depth_exclude = -1, - - /** Just the named directory D, no entries. Updates will not pull in - any files or subdirectories not already present. */ - svn_depth_empty = 0, - - /** D + its file children, but not subdirs. Updates will pull in any - files not already present, but not subdirectories. */ - svn_depth_files = 1, - - /** D + immediate children (D and its entries). Updates will pull in - any files or subdirectories not already present; those - subdirectories' this_dir entries will have depth-empty. */ - svn_depth_immediates = 2, - - /** D + all descendants (full recursion from D). Updates will pull - in any files or subdirectories not already present; those - subdirectories' this_dir entries will have depth-infinity. - Equivalent to the pre-1.5 default update behavior. */ - svn_depth_infinity = 3 - -} svn_depth_t; +/* NOTE: svn_depth_t is defined in svn_types_impl.h */ /** Return a constant string expressing @a depth as an English word, * e.g., "infinity", "immediates", etc. The string is not localized, Added: subversion/trunk/subversion/include/svn_types_impl.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types_impl.h?rev=1850344&view=auto ============================================================================== --- subversion/trunk/subversion/include/svn_types_impl.h (added) +++ subversion/trunk/subversion/include/svn_types_impl.h Fri Jan 4 10:38:53 2019 @@ -0,0 +1,156 @@ +/** + * @copyright + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * @endcopyright + * + * @file svn_types.h + * @brief Subversion's data types (common implementation) + * This is a @b private implementation-specific header file. + * User code should not include it directly. + */ + +/* NOTE: + * This file *must not* include or depend on any other header except + * the C standard library headers. + */ + +#ifndef SVN_TYPES_IMPL_H +#define SVN_TYPES_IMPL_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#ifndef DOXYGEN +/* Forward declaration of the error object. */ +struct svn_error_t; +#endif + + +/** The various types of nodes in the Subversion filesystem. */ +typedef enum svn_node_kind_t +{ + /** absent */ + svn_node_none, + + /** regular file */ + svn_node_file, + + /** directory */ + svn_node_dir, + + /** something's here, but we don't know what */ + svn_node_unknown, + + /** + * symbolic link + * @note This value is not currently used by the public API. + * @since New in 1.8. + */ + svn_node_symlink +} svn_node_kind_t; + + +/** Generic three-state property to represent an unknown value for values + * that are just like booleans. The values have been set deliberately to + * make tristates disjoint from #svn_boolean_t. + * + * @note It is unsafe to use apr_pcalloc() to allocate these, since '0' is + * not a valid value. + * + * @since New in 1.7. */ +/* NOTE: Update svnxx/tristate.hpp when changing this enum. */ +typedef enum svn_tristate_t +{ + /** state known to be false (the constant does not evaulate to false) */ + svn_tristate_false = 2, + /** state known to be true */ + svn_tristate_true, + /** state could be true or false */ + svn_tristate_unknown +} svn_tristate_t; + + +/** A revision number. */ +/* NOTE: Update svnxx/revision.hpp when changing this typedef. */ +typedef long int svn_revnum_t; + +/** The 'official' invalid revision number. */ +/* NOTE: Update svnxx/revision.hpp when changing this definition. */ +#define SVN_INVALID_REVNUM ((svn_revnum_t) -1) + + +/** The concept of depth for directories. + * + * @note This is similar to, but not exactly the same as, the WebDAV + * and LDAP concepts of depth. + * + * @since New in 1.5. + */ +/* NOTE: Update svnxx/depth.hpp when changing this enum. */ +typedef enum svn_depth_t +{ + /* The order of these depths is important: the higher the number, + the deeper it descends. This allows us to compare two depths + numerically to decide which should govern. */ + + /** Depth undetermined or ignored. In some contexts, this means the + client should choose an appropriate default depth. The server + will generally treat it as #svn_depth_infinity. */ + svn_depth_unknown = -2, + + /** Exclude (i.e., don't descend into) directory D. + @note In Subversion 1.5, svn_depth_exclude is *not* supported + anywhere in the client-side (libsvn_wc/libsvn_client/etc) code; + it is only supported as an argument to set_path functions in the + ra and repos reporters. (This will enable future versions of + Subversion to run updates, etc, against 1.5 servers with proper + svn_depth_exclude behavior, once we get a chance to implement + client-side support for svn_depth_exclude.) + */ + svn_depth_exclude = -1, + + /** Just the named directory D, no entries. Updates will not pull in + any files or subdirectories not already present. */ + svn_depth_empty = 0, + + /** D + its file children, but not subdirs. Updates will pull in any + files not already present, but not subdirectories. */ + svn_depth_files = 1, + + /** D + immediate children (D and its entries). Updates will pull in + any files or subdirectories not already present; those + subdirectories' this_dir entries will have depth-empty. */ + svn_depth_immediates = 2, + + /** D + all descendants (full recursion from D). Updates will pull + in any files or subdirectories not already present; those + subdirectories' this_dir entries will have depth-infinity. + Equivalent to the pre-1.5 default update behavior. */ + svn_depth_infinity = 3 + +} svn_depth_t; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SVN_TYPES_IMPL_H */ Propchange: subversion/trunk/subversion/include/svn_types_impl.h ------------------------------------------------------------------------------ svn:eol-style = native