/[Apache-SVN]
ViewVC logotype

Revision 1664127


Jump to revision: Previous Next
Author: julianfoad
Date: Wed Mar 4 19:46:17 2015 UTC (9 years, 1 month ago)
Changed paths: 2
Log Message:
On the 'move-tracking-2' branch: Provide convenient array and hash iteration
and accessors.

Simpler iteration over an array or a hash, sharing these features:
  - Convenience prioritized over speed.
  - Easy access to this key and this value as iterator member variables.
  - Templated iterator with parameterized element type.
  - Built-in, managed iterpool as an iterator member variable.
  - Iteration in sorted order (optional).

Array of pointers to objects, with
  - Simpler syntax for operations such as make, get, set, push, pop.
  - Efficient duplicators for an array of simple or compound elements.
  - The get and set and iteration functions avoid the need to use the
    non-type-safe APR_ARRAY_IDX. (It does not assert that the sizeof(type)
    matches, let alone (type) itself. Note: When I inserted
    "assert(sizeof(type)==array->elt_size)" in APR's version, the Subversion
    test suite still passed, so that's good.)

Hash table with
  - C-string keys.

TODO:
  - Implement an efficient 'svn_array_extend' method (what's that?)
  - Try making a templated array type with parameterized element type.
  - Add 'svn_hash_this_key/klen/val' and 'svn_hash_this' functions (for
    compatibility)?

* subversion/include/svn_iter.h,
  subversion/libsvn_subr/iter.c
  (svn_iter_t, SVN_ITER_T, SVN_CONST_ITER_T): New.

  (svn_array_t,
   svn_array_make, svn_array_make_n, svn_array_ensure,
   svn_ptr_array_dup_shallow, SVN_PTR_ARRAY_DUP_SIMPLE,
   svn_ptr_array_dup_simple, svn_ptr_array_dup_compound,
   svn_array_get, svn_array_set,
   svn_array_push, svn_array_pop, SVN_ARRAY_PUSH,
   svn_array__first, svn_array__sorted_first, svn_array__next,
   SVN_ARRAY_ITER, SVN_ARRAY_ITER_SORTED,
   SVN_ARRAY_ITER_NO_POOL, SVN_ARRAY_ITER_SORTED_NO_POOL): New.

  (svn_hash__first, svn_hash__sorted_first, svn_hash__next,
   SVN_HASH_ITER, SVN_HASH_ITER_SORTED,
   SVN_HASH_ITER_NO_POOL, SVN_HASH_ITER_SORTED_NO_POOL): New.

  (test_array,
   test_hash): New test functions.


Changed paths

Path Details
Directorysubversion/branches/move-tracking-2/subversion/include/svn_iter.h modified , text changed
Directorysubversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26