GME  13
svn_types.h
Go to the documentation of this file.
00001 
00027 #ifndef SVN_TYPES_H
00028 #define SVN_TYPES_H
00029 
00030 /* ### this should go away, but it causes too much breakage right now */
00031 #include <stdlib.h>
00032 #include <limits.h> /* for ULONG_MAX */
00033 
00034 #include <apr.h>         /* for apr_size_t, apr_int64_t, ... */
00035 #include <apr_errno.h>   /* for apr_status_t */
00036 #include <apr_pools.h>   /* for apr_pool_t */
00037 #include <apr_hash.h>    /* for apr_hash_t */
00038 #include <apr_tables.h>  /* for apr_array_push() */
00039 #include <apr_time.h>    /* for apr_time_t */
00040 #include <apr_strings.h> /* for apr_atoi64() */
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif /* __cplusplus */
00045 
00046 
00047 
00052 #ifndef SVN_DEPRECATED
00053 # if !defined(SWIGPERL) && !defined(SWIGPYTHON) && !defined(SWIGRUBY)
00054 #  if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__==3 && __GNUC_MINOR__>=1))
00055 #   define SVN_DEPRECATED __attribute__((deprecated))
00056 #  elif defined(_MSC_VER) && _MSC_VER >= 1300
00057 #   define SVN_DEPRECATED __declspec(deprecated)
00058 #  else
00059 #   define SVN_DEPRECATED
00060 #  endif
00061 # else
00062 #  define SVN_DEPRECATED
00063 # endif
00064 #endif
00065 
00066 
00081 #ifndef SVN_UNALIGNED_ACCESS_IS_OK
00082 # if defined(_M_IX86) || defined(i386) \
00083      || defined(_M_X64) || defined(__x86_64) \
00084      || defined(__powerpc__) || defined(__ppc__)
00085 #  define SVN_UNALIGNED_ACCESS_IS_OK 1
00086 # else
00087 #  define SVN_UNALIGNED_ACCESS_IS_OK 0
00088 # endif
00089 #endif
00090 
00091 
00092 
00094 typedef int svn_boolean_t;
00095 
00096 #ifndef TRUE
00097 
00098 #define TRUE 1
00099 #endif /* TRUE */
00100 
00101 #ifndef FALSE
00102 
00103 #define FALSE 0
00104 #endif /* FALSE */
00105 
00106 
00107 
00113 typedef struct svn_error_t
00114 {
00118   apr_status_t apr_err;
00119 
00131   const char *message;
00132 
00137   struct svn_error_t *child;
00138 
00143   apr_pool_t *pool;
00144 
00148   const char *file;
00149 
00153   long line;
00154 
00155 } svn_error_t;
00156 
00157 
00158 
00159 /* See svn_version.h.
00160    Defined here to avoid including svn_version.h from all public headers. */
00161 typedef struct svn_version_t svn_version_t;
00162 
00163 
00164 
00172 #ifndef APR_ARRAY_IDX
00173 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
00174 #endif
00175 
00177 #ifndef APR_ARRAY_PUSH
00178 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
00179 #endif
00180 
00184 
00194 const void *
00195 svn__apr_hash_index_key(const apr_hash_index_t *hi);
00196 
00198 apr_ssize_t
00199 svn__apr_hash_index_klen(const apr_hash_index_t *hi);
00200 
00202 void *
00203 svn__apr_hash_index_val(const apr_hash_index_t *hi);
00204 
00208 
00213 /* ### These fixes should go into APR. */
00214 #ifndef WIN32
00215 #define SVN__APR_STATUS_IS_ENOTDIR(s)  APR_STATUS_IS_ENOTDIR(s)
00216 #else
00217 #define SVN__APR_STATUS_IS_ENOTDIR(s)  (APR_STATUS_IS_ENOTDIR(s) \
00218                       || ((s) == APR_OS_START_SYSERR + ERROR_DIRECTORY) \
00219                       || ((s) == APR_OS_START_SYSERR + ERROR_INVALID_NAME))
00220 #endif
00221 
00225 
00227 typedef enum svn_node_kind_t
00228 {
00230   svn_node_none,
00231 
00233   svn_node_file,
00234 
00236   svn_node_dir,
00237 
00239   svn_node_unknown,
00240 
00246   svn_node_symlink
00247 } svn_node_kind_t;
00248 
00256 const char *
00257 svn_node_kind_to_word(svn_node_kind_t kind);
00258 
00265 svn_node_kind_t
00266 svn_node_kind_from_word(const char *word);
00267 
00268 
00277 typedef enum svn_tristate_t
00278 {
00280   svn_tristate_false = 2,
00282   svn_tristate_true,
00284   svn_tristate_unknown
00285 } svn_tristate_t;
00286 
00292 const char *
00293 svn_tristate__to_word(svn_tristate_t tristate);
00294 
00301 svn_tristate_t
00302 svn_tristate__from_word(const char * word);
00303 
00304 
00305 
00344 
00346 typedef long int svn_revnum_t;
00347 
00349 #define SVN_IS_VALID_REVNUM(n) ((n) >= 0)
00350 
00352 #define SVN_INVALID_REVNUM ((svn_revnum_t) -1)
00353 
00358 #define SVN_IGNORED_REVNUM ((svn_revnum_t) -1)
00359 
00361 #define SVN_STR_TO_REV(str) ((svn_revnum_t) atol(str))
00362 
00374 svn_error_t *
00375 svn_revnum_parse(svn_revnum_t *rev,
00376                  const char *str,
00377                  const char **endptr);
00378 
00388 #define SVN_REVNUM_T_FMT "ld"
00389 
00390 
00391 
00393 typedef apr_int64_t svn_filesize_t;
00394 
00396 #define SVN_INVALID_FILESIZE ((svn_filesize_t) -1)
00397 
00399 #define SVN_FILESIZE_T_FMT APR_INT64_T_FMT
00400 
00401 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00402 /* Parse a base-10 numeric string into a 64-bit unsigned numeric value. */
00403 /* NOTE: Private. For use by Subversion's own code only. See issue #1644. */
00404 /* FIXME: APR should supply a function to do this, such as "apr_atoui64". */
00405 #define svn__atoui64(X) ((apr_uint64_t) apr_atoi64(X))
00406 #endif
00407 
00408 
00409 
00411 enum svn_recurse_kind
00412 {
00413   svn_nonrecursive = 1,
00414   svn_recursive
00415 };
00416 
00424 typedef enum svn_depth_t
00425 {
00426   /* The order of these depths is important: the higher the number,
00427      the deeper it descends.  This allows us to compare two depths
00428      numerically to decide which should govern. */
00429 
00433   svn_depth_unknown    = -2,
00434 
00444   svn_depth_exclude    = -1,
00445 
00448   svn_depth_empty      =  0,
00449 
00452   svn_depth_files      =  1,
00453 
00457   svn_depth_immediates =  2,
00458 
00463   svn_depth_infinity   =  3
00464 
00465 } svn_depth_t;
00466 
00473 const char *
00474 svn_depth_to_word(svn_depth_t depth);
00475 
00482 svn_depth_t
00483 svn_depth_from_word(const char *word);
00484 
00493 #define SVN_DEPTH_INFINITY_OR_FILES(recurse) \
00494   ((recurse) ? svn_depth_infinity : svn_depth_files)
00495 
00504 #define SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse) \
00505   ((recurse) ? svn_depth_infinity : svn_depth_immediates)
00506 
00515 #define SVN_DEPTH_INFINITY_OR_EMPTY(recurse) \
00516   ((recurse) ? svn_depth_infinity : svn_depth_empty)
00517 
00525 #define SVN_DEPTH_IS_RECURSIVE(depth)                              \
00526   ((depth) == svn_depth_infinity || (depth) == svn_depth_unknown)
00527 
00528 
00529 
00541 #define SVN_DIRENT_KIND        0x00001
00542 
00544 #define SVN_DIRENT_SIZE        0x00002
00545 
00547 #define SVN_DIRENT_HAS_PROPS   0x00004
00548 
00550 #define SVN_DIRENT_CREATED_REV 0x00008
00551 
00553 #define SVN_DIRENT_TIME        0x00010
00554 
00556 #define SVN_DIRENT_LAST_AUTHOR 0x00020
00557 
00559 #define SVN_DIRENT_ALL ~((apr_uint32_t ) 0)
00560 
00570 typedef struct svn_dirent_t
00571 {
00573   svn_node_kind_t kind;
00574 
00576   svn_filesize_t size;
00577 
00579   svn_boolean_t has_props;
00580 
00582   svn_revnum_t created_rev;
00583 
00585   apr_time_t time;
00586 
00588   const char *last_author;
00589 
00590   /* IMPORTANT: If you extend this struct, check svn_dirent_dup(). */
00591 } svn_dirent_t;
00592 
00597 svn_dirent_t *
00598 svn_dirent_dup(const svn_dirent_t *dirent,
00599                apr_pool_t *pool);
00600 
00607 svn_dirent_t *
00608 svn_dirent_create(apr_pool_t *result_pool);
00609 
00610 
00648 #define SVN_KEYWORD_MAX_LEN    255
00649 
00651 #define SVN_KEYWORD_REVISION_LONG    "LastChangedRevision"
00652 
00654 #define SVN_KEYWORD_REVISION_SHORT   "Rev"
00655 
00658 #define SVN_KEYWORD_REVISION_MEDIUM  "Revision"
00659 
00661 #define SVN_KEYWORD_DATE_LONG        "LastChangedDate"
00662 
00664 #define SVN_KEYWORD_DATE_SHORT       "Date"
00665 
00667 #define SVN_KEYWORD_AUTHOR_LONG      "LastChangedBy"
00668 
00670 #define SVN_KEYWORD_AUTHOR_SHORT     "Author"
00671 
00673 #define SVN_KEYWORD_URL_LONG         "HeadURL"
00674 
00676 #define SVN_KEYWORD_URL_SHORT        "URL"
00677 
00679 #define SVN_KEYWORD_ID               "Id"
00680 
00683 #define SVN_KEYWORD_HEADER           "Header"
00684 
00688 
00696 typedef struct svn_commit_info_t
00697 {
00699   svn_revnum_t revision;
00700 
00702   const char *date;
00703 
00705   const char *author;
00706 
00708   const char *post_commit_err;
00709 
00712   const char *repos_root;
00713 
00714 } svn_commit_info_t;
00715 
00730 svn_commit_info_t *
00731 svn_create_commit_info(apr_pool_t *pool);
00732 
00738 svn_commit_info_t *
00739 svn_commit_info_dup(const svn_commit_info_t *src_commit_info,
00740                     apr_pool_t *pool);
00741 
00742 
00743 
00753 typedef struct svn_log_changed_path2_t
00754 {
00756   char action;
00757 
00759   const char *copyfrom_path;
00760 
00762   svn_revnum_t copyfrom_rev;
00763 
00765   svn_node_kind_t node_kind;
00766 
00769   svn_tristate_t text_modified;
00770 
00773   svn_tristate_t props_modified;
00774 
00775   /* NOTE: Add new fields at the end to preserve binary compatibility.
00776      Also, if you add fields here, you have to update
00777      svn_log_changed_path2_dup(). */
00778 } svn_log_changed_path2_t;
00779 
00790 svn_log_changed_path2_t *
00791 svn_log_changed_path2_create(apr_pool_t *pool);
00792 
00798 svn_log_changed_path2_t *
00799 svn_log_changed_path2_dup(const svn_log_changed_path2_t *changed_path,
00800                           apr_pool_t *pool);
00801 
00808 typedef struct svn_log_changed_path_t
00809 {
00811   char action;
00812 
00814   const char *copyfrom_path;
00815 
00817   svn_revnum_t copyfrom_rev;
00818 
00819 } svn_log_changed_path_t;
00820 
00827 SVN_DEPRECATED
00828 svn_log_changed_path_t *
00829 svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
00830                          apr_pool_t *pool);
00831 
00840 typedef struct svn_log_entry_t
00841 {
00850   apr_hash_t *changed_paths;
00851 
00853   svn_revnum_t revision;
00854 
00858   apr_hash_t *revprops;
00859 
00876   svn_boolean_t has_children;
00877 
00893   apr_hash_t *changed_paths2;
00894 
00905   svn_boolean_t non_inheritable;
00906 
00912   svn_boolean_t subtractive_merge;
00913 
00914   /* NOTE: Add new fields at the end to preserve binary compatibility.
00915      Also, if you add fields here, you have to update
00916      svn_log_entry_dup(). */
00917 } svn_log_entry_t;
00918 
00928 svn_log_entry_t *
00929 svn_log_entry_create(apr_pool_t *pool);
00930 
00939 svn_log_entry_t *
00940 svn_log_entry_dup(const svn_log_entry_t *log_entry, apr_pool_t *pool);
00941 
00974 typedef svn_error_t *(*svn_log_entry_receiver_t)(
00975   void *baton,
00976   svn_log_entry_t *log_entry,
00977   apr_pool_t *pool);
00978 
00985 typedef svn_error_t *(*svn_log_message_receiver_t)(
00986   void *baton,
00987   apr_hash_t *changed_paths,
00988   svn_revnum_t revision,
00989   const char *author,
00990   const char *date,  /* use svn_time_from_cstring() if need apr_time_t */
00991   const char *message,
00992   apr_pool_t *pool);
00993 
00994 
00995 
01004 typedef svn_error_t *(*svn_commit_callback2_t)(
01005   const svn_commit_info_t *commit_info,
01006   void *baton,
01007   apr_pool_t *pool);
01008 
01014 typedef svn_error_t *(*svn_commit_callback_t)(
01015   svn_revnum_t new_revision,
01016   const char *date,
01017   const char *author,
01018   void *baton);
01019 
01020 
01021 
01029 #define SVN_STREAM_CHUNK_SIZE 102400
01030 
01031 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01032 /*
01033  * The maximum amount we (ideally) hold in memory at a time when
01034  * processing a stream of data.
01035  *
01036  * For example, when copying data from one stream to another, do it in
01037  * blocks of this size.
01038  *
01039  * NOTE: This is an internal macro, put here for convenience.
01040  * No public API may depend on the particular value of this macro.
01041  */
01042 #define SVN__STREAM_CHUNK_SIZE 16384
01043 #endif
01044 
01046 /* FIXME: Should this be the same as SVN_STREAM_CHUNK_SIZE? */
01047 #define SVN_MAX_OBJECT_SIZE (((apr_size_t) -1) / 2)
01048 
01049 
01050 
01051 /* ### Note: despite being about mime-TYPES, these probably don't
01052  * ### belong in svn_types.h.  However, no other header is more
01053  * ### appropriate, and didn't feel like creating svn_validate.h for
01054  * ### so little.
01055  */
01056 
01069 svn_error_t *
01070 svn_mime_type_validate(const char *mime_type,
01071                        apr_pool_t *pool);
01072 
01078 svn_boolean_t
01079 svn_mime_type_is_binary(const char *mime_type);
01080 
01081 
01082 
01088 typedef svn_error_t *(*svn_cancel_func_t)(void *cancel_baton);
01089 
01090 
01091 
01111 typedef struct svn_lock_t
01112 {
01113   const char *path;              
01114   const char *token;             
01115   const char *owner;             
01116   const char *comment;           
01117   svn_boolean_t is_dav_comment;  
01118   apr_time_t creation_date;      
01119   apr_time_t expiration_date;    
01121 } svn_lock_t;
01122 
01132 svn_lock_t *
01133 svn_lock_create(apr_pool_t *pool);
01134 
01140 svn_lock_t *
01141 svn_lock_dup(const svn_lock_t *lock, apr_pool_t *pool);
01142 
01143 
01144 
01150 const char *
01151 svn_uuid_generate(apr_pool_t *pool);
01152 
01153 
01154 
01160 typedef struct svn_merge_range_t
01161 {
01169   svn_revnum_t start;
01170   svn_revnum_t end;
01171 
01175   svn_boolean_t inheritable;
01176 } svn_merge_range_t;
01177 
01183 svn_merge_range_t *
01184 svn_merge_range_dup(const svn_merge_range_t *range, apr_pool_t *pool);
01185 
01192 svn_boolean_t
01193 svn_merge_range_contains_rev(const svn_merge_range_t *range, svn_revnum_t rev);
01194 
01195 
01196 
01207 typedef struct svn_location_segment_t
01208 {
01211   svn_revnum_t range_start;
01212   svn_revnum_t range_end;
01213 
01216   const char *path;
01217 
01218 } svn_location_segment_t;
01219 
01226 typedef svn_error_t *(*svn_location_segment_receiver_t)(
01227   svn_location_segment_t *segment,
01228   void *baton,
01229   apr_pool_t *pool);
01230 
01236 svn_location_segment_t *
01237 svn_location_segment_dup(const svn_location_segment_t *segment,
01238                          apr_pool_t *pool);
01239 
01243 
01248 typedef unsigned long svn_linenum_t;
01249 
01254 #define SVN_LINENUM_MAX_VALUE ULONG_MAX
01255 
01256 
01257 
01258 #ifdef __cplusplus
01259 }
01260 #endif /* __cplusplus */
01261 
01262 
01263 /*
01264  * Everybody and their brother needs to deal with svn_error_t, the error
01265  * codes, and whatever else. While they *should* go and include svn_error.h
01266  * in order to do that... bah. Let's just help everybody out and include
01267  * that header whenever somebody grabs svn_types.h.
01268  *
01269  * Note that we do this at the END of this header so that its contents
01270  * are available to svn_error.h (our guards will prevent the circular
01271  * include). We also need to do the include *outside* of the cplusplus
01272  * guard.
01273  */
01274 #include "svn_error.h"
01275 
01276 
01277 /*
01278  * Subversion developers may want to use some additional debugging facilities
01279  * while working on the code. We'll pull that in here, so individual source
01280  * files don't have to include this header manually.
01281  */
01282 #ifdef SVN_DEBUG
01283 #include "private/svn_debug.h"
01284 #endif
01285 
01286 
01287 #endif /* SVN_TYPES_H */