Skip to main content

svn_subst_stream_translated

Function svn_subst_stream_translated 

Source
pub unsafe extern "C" fn svn_subst_stream_translated(
    stream: *mut svn_stream_t,
    eol_str: *const c_char,
    repair: svn_boolean_t,
    keywords: *mut apr_hash_t,
    expand: svn_boolean_t,
    result_pool: *mut apr_pool_t,
) -> *mut svn_stream_t
Expand description

Return a stream which performs eol translation and keyword expansion when read from or written to. The stream @a stream is used to read and write all data.

Make sure you call svn_stream_close() on the returned stream to ensure all data is flushed and cleaned up (this will also close the provided @a stream).

Read operations from and write operations to the stream perform the same operation: if @a expand is @c FALSE, both contract keywords. One stream supports both read and write operations. Reads and writes may be mixed.

If @a eol_str is non-@c NULL, replace whatever bytestring the input uses to denote line endings with @a eol_str in the output. If the input has an inconsistent line ending style, then: if @a repair is @c FALSE, then a subsequent read, write or other operation on the stream will return @c SVN_ERR_IO_INCONSISTENT_EOL when the inconsistency is detected, else if @a repair is @c TRUE, convert any line ending to @a eol_str. Recognized line endings are: “\n”, “\r”, and “\r\n”.

Expand and contract keywords using the contents of @a keywords as the new values. If @a expand is @c TRUE, expand contracted keywords and re-expand expanded keywords. If @a expand is @c FALSE, contract expanded keywords and ignore contracted ones. Keywords not found in the hash are ignored (not contracted or expanded). If the @a keywords hash itself is @c NULL, keyword substitution will be altogether ignored.

Detect only keywords that are no longer than @c SVN_KEYWORD_MAX_LEN bytes, including the delimiters and the keyword itself.

Recommendation: if @a expand is FALSE, then you don’t care about the keyword values, so use empty strings as non-NULL signifiers when you build the keywords hash.

The stream returned is allocated in @a result_pool.

If the inner stream implements resetting via svn_stream_reset(), or marking and seeking via svn_stream_mark() and svn_stream_seek(), the translated stream will too.

@since New in 1.4.