<commit_before>/**
 * @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_props.h
 * @brief Subversion properties
 */

/* ==================================================================== */

#ifndef SVN_PROPS_H
#define SVN_PROPS_H

#include <apr_pools.h>   /* for apr_pool_t */
#include <apr_tables.h>  /* for apr_array_header_t */
#include <apr_hash.h>    /* for apr_hash_t */

#include "svn_types.h"   /* for svn_boolean_t, svn_error_t */
#include "svn_string.h"  /* for svn_string_t */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/**
 * @defgroup svn_props_support Properties management utilities
 * @{
 */




/** 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 @c apr_hash_t won't work -- there's no
 * way to represent a property deletion, because we can't store a @c NULL
 * value in a hash.  So instead, we use these structures.
 */
typedef struct svn_prop_t
{
  const char *name;           /**< Property name */
  const svn_string_t *value;  /**< Property value */
} svn_prop_t;


/**
 * Return a duplicate of @a prop, allocated in @a pool. No part of the new
 * structure will be shared with @a prop.
 *
 * @since New in 1.3.
 */
svn_prop_t *
svn_prop_dup(const svn_prop_t *prop,
             apr_pool_t *pool);


/**
 * Duplicate an @a array of svn_prop_t items using @a pool.
 *
 * @since New in 1.3.
 */
apr_array_header_t *
svn_prop_array_dup(const apr_array_header_t *array,
                   apr_pool_t *pool);


/** A structure to represent inherited properties.
 *
 * @since New in 1.8.
 */
typedef struct svn_prop_inherited_item_t
{
  /** The absolute working copy path, relative filesystem path, or URL from
   * which the properties in @a prop_hash are inherited. */
  const char *path_or_url;

  /** A hash of (const char *) inherited property names, and (svn_string_t *)
   * property values. */
  apr_hash_t *prop_hash;

} svn_prop_inherited_item_t;


/**
 * Given a hash (keys <tt>const char *</tt> and values <tt>const
 * svn_string_t</tt>) of properties, returns an array of svn_prop_t
 * items using @a pool.
 *
 * @since New in 1.5.
 */
apr_array_header_t *
svn_prop_hash_to_array(apr_hash_t *hash,
                       apr_pool_t *pool);

/**
 * 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 @c NULL @c
 * svn_prop_t.value member is undefined.
 *
 * @since New in 1.7.
 */
apr_hash_t *
svn_prop_array_to_hash(const apr_array_header_t *properties,
                       apr_pool_t *result);

/**
 * Creates a deep copy of @a hash (keys <tt>const char *</tt> and
 * values <tt>const svn_string_t *</tt>) in @a pool.
 *
 * @since New in 1.6.
 */
apr_hash_t *
svn_prop_hash_dup(apr_hash_t *hash,
                  apr_pool_t *pool);

/**
 * Return the value of property @a prop_name as it is in @a properties,
 * with values <tt>const svn_string_t</tt>. If @a prop_name is not
 * in @a properties or @a properties is NULL, return NULL.
 *
 * @since New in 1.7.
 */
const char *
svn_prop_get_value(apr_hash_t *properties,
                   const char *prop_name);

/**
 * 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 @c svn_prop_regular_kind.
 */
typedef enum svn_prop_kind
{
  /** In .svn/entries, i.e., author, date, etc. */
  svn_prop_entry_kind,

  /** Client-side only, stored by specific RA layer. */
  svn_prop_wc_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.
   */
  svn_prop_regular_kind
} svn_prop_kind_t;

/** Return the property kind of a property named @a prop_name.
 *
 * @since New in 1.8
 */
svn_prop_kind_t
svn_property_kind2(const char *prop_name);

/** Return the prop kind of a property named @a prop_name, and
 * (if @a prefix_len is non-@c NULL) set @a *prefix_len to the length of
 * the prefix of @a prop_name that was sufficient to distinguish its kind.
 *
 * @deprecated Provided for backward compatibility with the 1.7 API.
 */
SVN_DEPRECATED
svn_prop_kind_t
svn_property_kind(int *prefix_len,
                  const char *prop_name);


/** Return @c TRUE iff @a prop_name represents the name of a Subversion
 * property.
 */
svn_boolean_t
svn_prop_is_svn_prop(const char *prop_name);


/** Return @c TRUE iff @a props has at least one property whose name
 * represents the name of a Subversion property.
 *
 * @since New in 1.5.
 */
svn_boolean_t
svn_prop_has_svn_prop(const apr_hash_t *props,
                      apr_pool_t *pool);
<commit_msg>* subversion/include/svn_props.h   (svn_prop_is_svn_prop, svn_prop_has_svn_prop): Clarify doc strings.<commit_after>/**
 * @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_props.h
 * @brief Subversion properties
 */

/* ==================================================================== */

#ifndef SVN_PROPS_H
#define SVN_PROPS_H

#include <apr_pools.h>   /* for apr_pool_t */
#include <apr_tables.h>  /* for apr_array_header_t */
#include <apr_hash.h>    /* for apr_hash_t */

#include "svn_types.h"   /* for svn_boolean_t, svn_error_t */
#include "svn_string.h"  /* for svn_string_t */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/**
 * @defgroup svn_props_support Properties management utilities
 * @{
 */




/** 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 @c apr_hash_t won't work -- there's no
 * way to represent a property deletion, because we can't store a @c NULL
 * value in a hash.  So instead, we use these structures.
 */
typedef struct svn_prop_t
{
  const char *name;           /**< Property name */
  const svn_string_t *value;  /**< Property value */
} svn_prop_t;


/**
 * Return a duplicate of @a prop, allocated in @a pool. No part of the new
 * structure will be shared with @a prop.
 *
 * @since New in 1.3.
 */
svn_prop_t *
svn_prop_dup(const svn_prop_t *prop,
             apr_pool_t *pool);


/**
 * Duplicate an @a array of svn_prop_t items using @a pool.
 *
 * @since New in 1.3.
 */
apr_array_header_t *
svn_prop_array_dup(const apr_array_header_t *array,
                   apr_pool_t *pool);


/** A structure to represent inherited properties.
 *
 * @since New in 1.8.
 */
typedef struct svn_prop_inherited_item_t
{
  /** The absolute working copy path, relative filesystem path, or URL from
   * which the properties in @a prop_hash are inherited. */
  const char *path_or_url;

  /** A hash of (const char *) inherited property names, and (svn_string_t *)
   * property values. */
  apr_hash_t *prop_hash;

} svn_prop_inherited_item_t;


/**
 * Given a hash (keys <tt>const char *</tt> and values <tt>const
 * svn_string_t</tt>) of properties, returns an array of svn_prop_t
 * items using @a pool.
 *
 * @since New in 1.5.
 */
apr_array_header_t *
svn_prop_hash_to_array(apr_hash_t *hash,
                       apr_pool_t *pool);

/**
 * 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 @c NULL @c
 * svn_prop_t.value member is undefined.
 *
 * @since New in 1.7.
 */
apr_hash_t *
svn_prop_array_to_hash(const apr_array_header_t *properties,
                       apr_pool_t *result);

/**
 * Creates a deep copy of @a hash (keys <tt>const char *</tt> and
 * values <tt>const svn_string_t *</tt>) in @a pool.
 *
 * @since New in 1.6.
 */
apr_hash_t *
svn_prop_hash_dup(apr_hash_t *hash,
                  apr_pool_t *pool);

/**
 * Return the value of property @a prop_name as it is in @a properties,
 * with values <tt>const svn_string_t</tt>. If @a prop_name is not
 * in @a properties or @a properties is NULL, return NULL.
 *
 * @since New in 1.7.
 */
const char *
svn_prop_get_value(apr_hash_t *properties,
                   const char *prop_name);

/**
 * 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 @c svn_prop_regular_kind.
 */
typedef enum svn_prop_kind
{
  /** In .svn/entries, i.e., author, date, etc. */
  svn_prop_entry_kind,

  /** Client-side only, stored by specific RA layer. */
  svn_prop_wc_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.
   */
  svn_prop_regular_kind
} svn_prop_kind_t;

/** Return the property kind of a property named @a prop_name.
 *
 * @since New in 1.8
 */
svn_prop_kind_t
svn_property_kind2(const char *prop_name);

/** Return the prop kind of a property named @a prop_name, and
 * (if @a prefix_len is non-@c NULL) set @a *prefix_len to the length of
 * the prefix of @a prop_name that was sufficient to distinguish its kind.
 *
 * @deprecated Provided for backward compatibility with the 1.7 API.
 */
SVN_DEPRECATED
svn_prop_kind_t
svn_property_kind(int *prefix_len,
                  const char *prop_name);


/** Return @c TRUE iff @a prop_name represents the name of a Subversion
 * property.  That is, any property name in Subversion's name space for
 * versioned or unversioned properties, regardless whether the particular
 * property name is recognized.
 */
svn_boolean_t
svn_prop_is_svn_prop(const char *prop_name);


/** Return @c TRUE iff @a props has at least one property whose name
 * represents the name of a Subversion property, in the sense of
 * svn_prop_is_svn_prop().
 *
 * @since New in 1.5.
 */
svn_boolean_t
svn_prop_has_svn_prop(const apr_hash_t *props,
                      apr_pool_t *pool);

{'fraction_non_alphanumeric': 0.12399773224265004, 'fraction_numerical': 0.004049566696363489, 'mean_word_length': 3.388059701492537, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7034466', 'n_tokens_mistral': 4002, 'n_tokens_neox': 3912, 'n_words': 1425}