# Properties management utilities

## Data Structures
struct | svn_prop_t
| A general in-memory representation of a single property. More...
## Modules
| Visible properties

| Visible properties.
| Invisible properties

| WC props are props that are invisible to users: they're generated by an RA layer, and stored in secret parts of .svn/.
| Revision properties

| These are reserved properties attached to a "revision" object in the repository filesystem.
## Defines
#define | SVN_PROP_PREFIX "svn:"
| All Subversion property names start with this.
## Typedefs
typedef struct svn_prop_t | svn_prop_t
| A general in-memory representation of a single property.
typedef enum svn_prop_kind | svn_prop_kind_t
| Subversion distinguishes among several kinds of properties, particularly on the client-side.
## Enumerations
enum | svn_prop_kind { svn_prop_entry_kind, svn_prop_wc_kind, svn_prop_regular_kind }
| Subversion distinguishes among several kinds of properties, particularly on the client-side. More...
## Functions
svn_prop_t * | svn_prop_dup (const svn_prop_t *prop, apr_pool_t *pool)
| Return a duplicate of prop, allocated in pool.
apr_array_header_t * | svn_prop_array_dup (const apr_array_header_t *array, apr_pool_t *pool)
| Duplicate an array of svn_prop_t items using pool.
apr_array_header_t * | svn_prop_hash_to_array (apr_hash_t *hash, apr_pool_t *pool)
| Given a hash (keys `const char *` and values `const svn_string_t`) of properties, returns an array of svn_prop_t items using pool.
apr_hash_t * | svn_prop_array_to_hash (const apr_array_header_t *properties, apr_pool_t *result)
| Given an array of svn_prop_t items, return a hash mapping const char * property names to const svn_string_t * values.
apr_hash_t * | svn_prop_hash_dup (apr_hash_t *hash, apr_pool_t *pool)
| Creates a deep copy of hash (keys `const char *` and values `const svn_string_t`) in pool.
const char * | svn_prop_get_value (apr_hash_t *properties, const char *prop_name)
| Return the value of property prop_name as it is in properties, with values `const svn_string_t`.
svn_prop_kind_t | svn_property_kind (int *prefix_len, const char *prop_name)
| Return the prop kind of a property named prop_name, and (if prefix_len is non-`NULL`) set *prefix_len to the length of the prefix of prop_name that was sufficient to distinguish its kind.
svn_boolean_t | svn_prop_is_svn_prop (const char *prop_name)
| Return `TRUE` iff prop_name represents the name of a Subversion property.
svn_boolean_t | svn_prop_has_svn_prop (const apr_hash_t *props, apr_pool_t *pool)
| Return `TRUE` iff props has at least one property whose name represents the name of a Subversion property.
svn_boolean_t | svn_prop_is_boolean (const char *prop_name)
| Return `TRUE` iff prop_name is a Subversion property whose value is interpreted as a boolean.
svn_boolean_t | svn_prop_needs_translation (const char *prop_name)
| If prop_name requires that its value be stored as UTF8/LF in the repository, then return `TRUE`.
svn_error_t * | svn_categorize_props (const apr_array_header_t *proplist, apr_array_header_t **entry_props, apr_array_header_t **wc_props, apr_array_header_t **regular_props, apr_pool_t *pool)
| Given a proplist array of `svn_prop_t` structures, allocate three new arrays in pool.
svn_error_t * | svn_prop_diffs (apr_array_header_t **propdiffs, apr_hash_t *target_props, apr_hash_t *source_props, apr_pool_t *pool)
| Given two property hashes (`const char *name` -> `const svn_string_t *value`), deduce the differences between them (from source_props -> `target_props`).
svn_boolean_t | svn_prop_name_is_valid (const char *prop_name)
| Return `TRUE` iff prop_name is a valid property name.

## Define Documentation

#define SVN_PROP_PREFIX "svn:"

All Subversion property names start with this.

Definition at line 260 of file svn_props.h.

## Typedef Documentation

typedef enum svn_prop_kind svn_prop_kind_t

Subversion distinguishes among several kinds of properties, particularly on the client-side.

There is no "unknown" kind; if there's nothing special about a property name, the default category is `svn_prop_regular_kind`.

typedef struct svn_prop_t svn_prop_t

A general in-memory representation of a single property.

Most of the time, property lists will be stored completely in hashes. But sometimes it's useful to have an "ordered" collection of properties, in which case we use an array of these structures.

Also: sometimes we want a list that represents a set of property *changes*, and in this case, an `apr_hash_t` won't work -- there's no way to represent a property deletion, because we can't store a `NULL` value in a hash. So instead, we use these structures.

## Enumeration Type Documentation

enum svn_prop_kind

Subversion distinguishes among several kinds of properties, particularly on the client-side.

There is no "unknown" kind; if there's nothing special about a property name, the default category is `svn_prop_regular_kind`.

Enumerator:

  svn_prop_entry_kind | In .svn/entries, i.e., author, date, etc.
  svn_prop_wc_kind | Client-side only, stored by specific RA layer.
  svn_prop_regular_kind | Seen if user does "svn proplist"; note that this includes some "svn:" props and all user props, i.e. ones stored in the repository fs.

Definition at line 139 of file svn_props.h.

## Function Documentation

svn_error_t* svn_categorize_props | ( | const apr_array_header_t * | proplist,
|  | apr_array_header_t ** | entry_props,
|  | apr_array_header_t ** | wc_props,
|  | apr_array_header_t ** | regular_props,
|  | apr_pool_t * | pool |
| ) |  |  |

Given a proplist array of `svn_prop_t` structures, allocate three new arrays in pool.

Categorize each property and then create new `svn_prop_t` structures in the proper lists. Each new `svn_prop_t` structure's fields will point to the same data within proplist's structures.

Callers may pass NULL for each of the property lists in which they are uninterested. If no props exist in a certain category, and the property list argument for that category is non-NULL, then that array will come back with `->nelts == 0`.

apr_array_header_t* svn_prop_array_dup | ( | const apr_array_header_t * | array,
|  | apr_pool_t * | pool |
| ) |  |  |

Duplicate an array of svn_prop_t items using pool.

Since:
  New in 1.3.

apr_hash_t* svn_prop_array_to_hash | ( | const apr_array_header_t * | properties,
|  | apr_pool_t * | result |
| ) |  |  |

Given an array of svn_prop_t items, return a hash mapping const char * property names to const svn_string_t * values.

Warning:
  The behaviour on svn_prop_t objects with a `NULL` `svn_prop_t.value` member is undefined.

Since:
  New in 1.7.

svn_error_t* svn_prop_diffs | ( | apr_array_header_t ** | propdiffs,
|  | apr_hash_t * | target_props,
|  | apr_hash_t * | source_props,
|  | apr_pool_t * | pool |
| ) |  |  |

Given two property hashes (`const char *name` -> `const svn_string_t *value`), deduce the differences between them (from source_props -> `target_props`).

Set propdiffs to a new array of `svn_prop_t` structures, with one entry for each property that differs, including properties that exist in source_props or target_props but not both. The `value` field of each entry is that property's value from target_props or NULL if that property only exists in source_props.

Allocate the array from pool. Allocate the contents of the array from pool or by reference to the storage of the input hashes or both.

For note, here's a quick little table describing the logic of this routine:

       source_props    target_props      event
       ------------    ------------      -----
       value = foo     value = NULL      Deletion occurred.
       value = foo     value = bar       Set occurred (modification)
       value = NULL    value = baz       Set occurred (creation)

svn_prop_t* svn_prop_dup | ( | const svn_prop_t * | prop,
|  | apr_pool_t * | pool |
| ) |  |  |

Return a duplicate of prop, allocated in pool.

No part of the new structure will be shared with prop.

Since:
  New in 1.3.

const char* svn_prop_get_value | ( | apr_hash_t * | properties,
|  | const char * | prop_name |
| ) |  |  |

Return the value of property prop_name as it is in properties, with values `const svn_string_t`.

If prop_name is not in properties or properties is NULL, return NULL.

Since:
  New in 1.7.

svn_boolean_t svn_prop_has_svn_prop | ( | const apr_hash_t * | props,
|  | apr_pool_t * | pool |
| ) |  |  |

Return `TRUE` iff props has at least one property whose name represents the name of a Subversion property.

Since:
  New in 1.5.

apr_hash_t* svn_prop_hash_dup | ( | apr_hash_t * | hash,
|  | apr_pool_t * | pool |
| ) |  |  |

Creates a deep copy of hash (keys `const char *` and values `const svn_string_t`) in pool.

Since:
  New in 1.6.

apr_array_header_t* svn_prop_hash_to_array | ( | apr_hash_t * | hash,
|  | apr_pool_t * | pool |
| ) |  |  |

Given a hash (keys `const char *` and values `const svn_string_t`) of properties, returns an array of svn_prop_t items using pool.

Since:
  New in 1.5.

svn_boolean_t svn_prop_is_boolean | ( | const char * | prop_name | ) |

Return `TRUE` iff prop_name is a Subversion property whose value is interpreted as a boolean.

Since:
  New in 1.5

svn_boolean_t svn_prop_name_is_valid | ( | const char * | prop_name | ) |

Return `TRUE` iff prop_name is a valid property name.

For now, "valid" means the ASCII subset of an XML "Name". XML "Name" is defined at http://www.w3.org/TR/REC-xml#sec-common-syn

Since:
  New in 1.5.

svn_boolean_t svn_prop_needs_translation | ( | const char * | prop_name | ) |

If prop_name requires that its value be stored as UTF8/LF in the repository, then return `TRUE`.

Else return `FALSE`. This is for users of libsvn_client or libsvn_fs, since it their responsibility to do this translation in both directions. (See svn_subst_translate_string()/svn_subst_detranslate_string() for help with this task.)

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines