- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# svn_subst.h

Go to the documentation of this file.

    00001 /**
    00002  * @copyright
    00003  * ====================================================================
    00004  *    Licensed to the Apache Software Foundation (ASF) under one
    00005  *    or more contributor license agreements.  See the NOTICE file
    00006  *    distributed with this work for additional information
    00007  *    regarding copyright ownership.  The ASF licenses this file
    00008  *    to you under the Apache License, Version 2.0 (the
    00009  *    "License"); you may not use this file except in compliance
    00010  *    with the License.  You may obtain a copy of the License at
    00011  *
    00012  *      http://www.apache.org/licenses/LICENSE-2.0
    00013  *
    00014  *    Unless required by applicable law or agreed to in writing,
    00015  *    software distributed under the License is distributed on an
    00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    00017  *    KIND, either express or implied.  See the License for the
    00018  *    specific language governing permissions and limitations
    00019  *    under the License.
    00020  * ====================================================================
    00021  * @endcopyright
    00022  *
    00023  * @file svn_subst.h
    00024  * @brief Data substitution (keywords and EOL style)
    00025  */
    00026
    00027
    00028
    00029 #ifndef SVN_SUBST_H
    00030 #define SVN_SUBST_H
    00031
    00032 #include <apr_pools.h>
    00033 #include <apr_hash.h>
    00034 #include <apr_time.h>
    00035
    00036 #include "svn_types.h"
    00037 #include "svn_string.h"
    00038 #include "svn_io.h"
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif /* __cplusplus */
    00043
    00044 /* EOL conversion and keyword expansion. */
    00045
    00046 /** The EOL used in the Repository for "native" files */
    00047 #define SVN_SUBST_NATIVE_EOL_STR "\n"
    00048
    00049 /** Valid states for 'svn:eol-style' property.
    00050  *
    00051  * Property nonexistence is equivalent to 'none'.
    00052  */
    00053 typedef enum svn_subst_eol_style
    00054 {
    00055   /** An unrecognized style */
    00056   svn_subst_eol_style_unknown,
    00057
    00058   /** EOL translation is "off" or ignored value */
    00059   svn_subst_eol_style_none,
    00060
    00061   /** Translation is set to client's native eol */
    00062   svn_subst_eol_style_native,
    00063
    00064   /** Translation is set to one of LF, CR, CRLF */
    00065   svn_subst_eol_style_fixed
    00066
    00067 } svn_subst_eol_style_t;
    00068
    00069 /** Set @a *style to the appropriate @c svn_subst_eol_style_t and @a *eol to
    00070  * the appropriate cstring for a given svn:eol-style property value.
    00071  *
    00072  * Set @a *eol to
    00073  *
    00074  *    - @c NULL for @c svn_subst_eol_style_none, or
    00075  *
    00076  *    - a NULL-terminated C string containing the native eol marker
    00077  *      for this platform, for @c svn_subst_eol_style_native, or
    00078  *
    00079  *    - a NULL-terminated C string containing the eol marker indicated
    00080  *      by the property value, for @c svn_subst_eol_style_fixed.
    00081  *
    00082  * If @a *style is NULL, it is ignored.
    00083  */
    00084 void
    00085 svn_subst_eol_style_from_value(svn_subst_eol_style_t *style,
    00086                                const char **eol,
    00087                                const char *value);
    00088
    00089 /** Indicates whether the working copy and normalized versions of a file
    00090  * with the given the parameters differ.  If @a force_eol_check is TRUE,
    00091  * the routine also accounts for all translations required due to repairing
    00092  * fixed eol styles.
    00093  *
    00094  * @since New in 1.4
    00095  *
    00096  */
    00097 svn_boolean_t
    00098 svn_subst_translation_required(svn_subst_eol_style_t style,
    00099                                const char *eol,
    00100                                apr_hash_t *keywords,
    00101                                svn_boolean_t special,
    00102                                svn_boolean_t force_eol_check);
    00103
    00104
    00105 /** Values used in keyword expansion.
    00106  *
    00107  * @deprecated Provided for backward compatibility with the 1.2 API.
    00108  */
    00109 typedef struct svn_subst_keywords_t
    00110 {
    00111   /**
    00112    * @name svn_subst_keywords_t fields
    00113    * String expansion of the like-named keyword, or NULL if the keyword
    00114    * was not selected in the svn:keywords property.
    00115    * @{
    00116    */
    00117   const svn_string_t *revision;
    00118   const svn_string_t *date;
    00119   const svn_string_t *author;
    00120   const svn_string_t *url;
    00121   const svn_string_t *id;
    00122   /** @} */
    00123 } svn_subst_keywords_t;
    00124
    00125
    00126 /**
    00127  * Set @a *kw to a new keywords hash filled with the appropriate contents
    00128  * given a @a keywords_string (the contents of the svn:keywords
    00129  * property for the file in question), the revision @a rev, the @a url,
    00130  * the @a date the file was committed on, and the @a author of the last
    00131  * commit.  Any of these can be @c NULL to indicate that the information is
    00132  * not present, or @c 0 for @a date.
    00133  *
    00134  * Hash keys are of type <tt>const char *</tt>.
    00135  * Hash values are of type <tt>svn_string_t *</tt>.
    00136  *
    00137  * All memory is allocated out of @a pool.
    00138  *
    00139  * @since New in 1.3.
    00140  */
    00141 svn_error_t *
    00142 svn_subst_build_keywords2(apr_hash_t **kw,
    00143                           const char *keywords_string,
    00144                           const char *rev,
    00145                           const char *url,
    00146                           apr_time_t date,
    00147                           const char *author,
    00148                           apr_pool_t *pool);
    00149
    00150 /** Similar to svn_subst_build_keywords2() except that it populates
    00151  * an existing structure @a *kw instead of creating a keywords hash.
    00152  *
    00153  * @deprecated Provided for backward compatibility with the 1.2 API.
    00154  */
    00155 SVN_DEPRECATED
    00156 svn_error_t *
    00157 svn_subst_build_keywords(svn_subst_keywords_t *kw,
    00158                          const char *keywords_string,
    00159                          const char *rev,
    00160                          const char *url,
    00161                          apr_time_t date,
    00162                          const char *author,
    00163                          apr_pool_t *pool);
    00164
    00165
    00166 /** Return @c TRUE if @a a and @a b do not hold the same keywords.
    00167  *
    00168  * @a a and @a b are hashes of the form produced by
    00169  * svn_subst_build_keywords2().
    00170  *
    00171  * @since New in 1.3.
    00172  *
    00173  * If @a compare_values is @c TRUE, "same" means that the @a a and @a b
    00174  * contain exactly the same set of keywords, and the values of corresponding
    00175  * keywords match as well.  Else if @a compare_values is @c FALSE, then
    00176  * "same" merely means that @a a and @a b hold the same set of keywords,
    00177  * although those keywords' values might differ.
    00178  *
    00179  * @a a and/or @a b may be @c NULL; for purposes of comparison, @c NULL is
    00180  * equivalent to holding no keywords.
    00181  */
    00182 svn_boolean_t
    00183 svn_subst_keywords_differ2(apr_hash_t *a,
    00184                            apr_hash_t *b,
    00185                            svn_boolean_t compare_values,
    00186                            apr_pool_t *pool);
    00187
    00188 /** Similar to svn_subst_keywords_differ2() except that it compares
    00189  * two @c svn_subst_keywords_t structs instead of keyword hashes.
    00190  *
    00191  * @deprecated Provided for backward compatibility with the 1.2 API.
    00192  */
    00193 SVN_DEPRECATED
    00194 svn_boolean_t
    00195 svn_subst_keywords_differ(const svn_subst_keywords_t *a,
    00196                           const svn_subst_keywords_t *b,
    00197                           svn_boolean_t compare_values);
    00198
    00199
    00200 /**
    00201  * Copy and translate the data in @a src_stream into @a dst_stream.  It is
    00202  * assumed that @a src_stream is a readable stream and @a dst_stream is a
    00203  * writable stream.
    00204  *
    00205  * If @a eol_str is non-@c NULL, replace whatever bytestring @a src_stream
    00206  * uses to denote line endings with @a eol_str in the output.  If
    00207  * @a src_stream has an inconsistent line ending style, then: if @a repair
    00208  * is @c FALSE, return @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is
    00209  * @c TRUE, convert any line ending in @a src_stream to @a eol_str in
    00210  * @a dst_stream.  Recognized line endings are: "\n", "\r", and "\r\n".
    00211  *
    00212  * See svn_subst_stream_translated() for details of the keyword substitution
    00213  * which is controlled by the @a expand and @a keywords parameters.
    00214  *
    00215  * Note that a translation request is *required*:  one of @a eol_str or
    00216  * @a keywords must be non-@c NULL.
    00217  *
    00218  * Notes:
    00219  *
    00220  * See svn_wc__get_keywords() and svn_wc__get_eol_style() for a
    00221  * convenient way to get @a eol_str and @a keywords if in libsvn_wc.
    00222  *
    00223  * @since New in 1.3.
    00224  *
    00225  * @deprecated Provided for backward compatibility with the 1.5 API.
    00226  *   Callers should use svn_subst_stream_translated() instead.
    00227  */
    00228 SVN_DEPRECATED
    00229 svn_error_t *
    00230 svn_subst_translate_stream3(svn_stream_t *src_stream,
    00231                             svn_stream_t *dst_stream,
    00232                             const char *eol_str,
    00233                             svn_boolean_t repair,
    00234                             apr_hash_t *keywords,
    00235                             svn_boolean_t expand,
    00236                             apr_pool_t *scratch_pool);
    00237
    00238
    00239 /** Similar to svn_subst_translate_stream3() except relies upon a
    00240  * @c svn_subst_keywords_t struct instead of a hash for the keywords.
    00241  *
    00242  * @deprecated Provided for backward compatibility with the 1.2 API.
    00243  */
    00244 SVN_DEPRECATED
    00245 svn_error_t *
    00246 svn_subst_translate_stream2(svn_stream_t *src_stream,
    00247                             svn_stream_t *dst_stream,
    00248                             const char *eol_str,
    00249                             svn_boolean_t repair,
    00250                             const svn_subst_keywords_t *keywords,
    00251                             svn_boolean_t expand,
    00252                             apr_pool_t *scratch_pool);
    00253
    00254
    00255 /**
    00256  * Same as svn_subst_translate_stream2(), but does not take a @a pool
    00257  * argument, instead creates a temporary subpool of the global pool, and
    00258  * destroys it before returning.
    00259  *
    00260  * @deprecated Provided for backward compatibility with the 1.1 API.
    00261  */
    00262 SVN_DEPRECATED
    00263 svn_error_t *
    00264 svn_subst_translate_stream(svn_stream_t *src_stream,
    00265                            svn_stream_t *dst_stream,
    00266                            const char *eol_str,
    00267                            svn_boolean_t repair,
    00268                            const svn_subst_keywords_t *keywords,
    00269                            svn_boolean_t expand);
    00270
    00271
    00272 /** Return a stream which performs eol translation and keyword
    00273  * expansion when read from or written to.  The stream @a stream
    00274  * is used to read and write all data.
    00275  *
    00276  * Make sure you call svn_stream_close() on the returned stream to
    00277  * ensure all data is flushed and cleaned up (this will also close
    00278  * the provided @a stream).
    00279  *
    00280  * Read operations from and write operations to the stream
    00281  * perform the same operation: if @a expand is @c FALSE, both
    00282  * contract keywords.  One stream supports both read and write
    00283  * operations.  Reads and writes may be mixed.
    00284  *
    00285  * If @a eol_str is non-@c NULL, replace whatever bytestring the input uses
    00286  * to denote line endings with @a eol_str in the output.  If the input has
    00287  * an inconsistent line ending style, then: if @a repair is @c FALSE, then a
    00288  * subsequent read, write or other operation on the stream will return
    00289  * @c SVN_ERR_IO_INCONSISTENT_EOL when the inconsistency is detected, else
    00290  * if @a repair is @c TRUE, convert any line ending to @a eol_str.
    00291  * Recognized line endings are: "\n", "\r", and "\r\n".
    00292  *
    00293  * Expand and contract keywords using the contents of @a keywords as the
    00294  * new values.  If @a expand is @c TRUE, expand contracted keywords and
    00295  * re-expand expanded keywords.  If @a expand is @c FALSE, contract expanded
    00296  * keywords and ignore contracted ones.  Keywords not found in the hash are
    00297  * ignored (not contracted or expanded).  If the @a keywords hash
    00298  * itself is @c NULL, keyword substitution will be altogether ignored.
    00299  *
    00300  * Detect only keywords that are no longer than @c SVN_KEYWORD_MAX_LEN
    00301  * bytes, including the delimiters and the keyword itself.
    00302  *
    00303  * Recommendation: if @a expand is FALSE, then you don't care about the
    00304  * keyword values, so use empty strings as non-NULL signifiers when you
    00305  * build the keywords hash.
    00306  *
    00307  * The stream returned is allocated in @a result_pool.
    00308  *
    00309  * If the inner stream implements resetting via svn_stream_reset(),
    00310  * or marking and seeking via svn_stream_mark() and svn_stream_seek(),
    00311  * the translated stream will too.
    00312  *
    00313  * @since New in 1.4.
    00314  */
    00315 svn_stream_t *
    00316 svn_subst_stream_translated(svn_stream_t *stream,
    00317                             const char *eol_str,
    00318                             svn_boolean_t repair,
    00319                             apr_hash_t *keywords,
    00320                             svn_boolean_t expand,
    00321                             apr_pool_t *result_pool);
    00322
    00323
    00324 /** Set @a *stream to a stream which performs eol translation and keyword
    00325  * expansion when read from or written to.  The stream @a source
    00326  * is used to read and write all data.  Make sure you call
    00327  * svn_stream_close() on @a stream to make sure all data are flushed
    00328  * and cleaned up.
    00329  *
    00330  * When @a stream is closed, then @a source will be closed.
    00331  *
    00332  * Read and write operations perform the same transformation:
    00333  * all data is translated to normal form.
    00334  *
    00335  * @see svn_subst_translate_to_normal_form()
    00336  *
    00337  * @since New in 1.5.
    00338  * @deprecated Provided for backward compatibility with the 1.5 API.
    00339  */
    00340 SVN_DEPRECATED
    00341 svn_error_t *
    00342 svn_subst_stream_translated_to_normal_form(svn_stream_t **stream,
    00343                                            svn_stream_t *source,
    00344                                            svn_subst_eol_style_t eol_style,
    00345                                            const char *eol_str,
    00346                                            svn_boolean_t always_repair_eols,
    00347                                            apr_hash_t *keywords,
    00348                                            apr_pool_t *pool);
    00349
    00350
    00351 /** Set @a *stream to a readable stream containing the "normal form"
    00352  * of the special file located at @a path. The stream will be allocated
    00353  * in @a result_pool, and any temporary allocations will be made in
    00354  * @a scratch_pool.
    00355  *
    00356  * If the file at @a path is in fact a regular file, just read its content,
    00357  * which should be in the "normal form" for a special file.  This enables
    00358  * special files to be written and read on platforms that do not treat them
    00359  * as special.
    00360  *
    00361  * @since New in 1.6.
    00362  */
    00363 svn_error_t *
    00364 svn_subst_read_specialfile(svn_stream_t **stream,
    00365                            const char *path,
    00366                            apr_pool_t *result_pool,
    00367                            apr_pool_t *scratch_pool);
    00368
    00369
    00370 /** Set @a *stream to a writable stream that accepts content in
    00371  * the "normal form" for a special file, to be located at @a path, and
    00372  * will create that file when the stream is closed. The stream will be
    00373  * allocated in @a result_pool, and any temporary allocations will be
    00374  * made in @a scratch_pool.
    00375  *
    00376  * If the platform does not support the semantics of the special file, write
    00377  * a regular file containing the "normal form" text.  This enables special
    00378  * files to be written and read on platforms that do not treat them as
    00379  * special.
    00380  *
    00381  * Note: the target file is created in a temporary location, then renamed
    00382  *   into position, so the creation can be considered "atomic".
    00383  *
    00384  * @since New in 1.6.
    00385  */
    00386 svn_error_t *
    00387 svn_subst_create_specialfile(svn_stream_t **stream,
    00388                              const char *path,
    00389                              apr_pool_t *result_pool,
    00390                              apr_pool_t *scratch_pool);
    00391
    00392
    00393 /** Set @a *stream to a stream which translates the special file at @a path
    00394  * to the internal representation for special files when read from.  When
    00395  * written to, it does the reverse: creating a special file when the
    00396  * stream is closed.
    00397  *
    00398  * @since New in 1.5.
    00399  *
    00400  * @deprecated Provided for backward compatibility with the 1.5 API.
    00401  *   Callers should use svn_subst_read_specialfile or
    00402  *   svn_subst_create_specialfile as appropriate.
    00403  */
    00404 SVN_DEPRECATED
    00405 svn_error_t *
    00406 svn_subst_stream_from_specialfile(svn_stream_t **stream,
    00407                                   const char *path,
    00408                                   apr_pool_t *pool);
    00409
    00410
    00411 /**
    00412  * Copy the contents of file-path @a src to file-path @a dst atomically,
    00413  * either creating @a dst or overwriting @a dst if it exists, possibly
    00414  * performing line ending and keyword translations.
    00415  *
    00416  * The parameters @a *eol_str, @a repair, @a *keywords and @a expand are
    00417  * defined the same as in svn_subst_translate_stream3().
    00418  *
    00419  * In addition, it will create a special file from normal form or
    00420  * translate one to normal form if @a special is @c TRUE.
    00421  *
    00422  * If anything goes wrong during the copy, attempt to delete @a dst (if
    00423  * it exists).
    00424  *
    00425  * If @a eol_str and @a keywords are @c NULL, behavior is just a byte-for-byte
    00426  * copy.
    00427  *
    00428  * @a cancel_func and @a cancel_baton will be called (if not NULL)
    00429  * periodically to check for cancellation.
    00430  *
    00431  * @since New in 1.7.
    00432  */
    00433 svn_error_t *
    00434 svn_subst_copy_and_translate4(const char *src,
    00435                               const char *dst,
    00436                               const char *eol_str,
    00437                               svn_boolean_t repair,
    00438                               apr_hash_t *keywords,
    00439                               svn_boolean_t expand,
    00440                               svn_boolean_t special,
    00441                               svn_cancel_func_t cancel_func,
    00442                               void *cancel_baton,
    00443                               apr_pool_t *pool);
    00444
    00445
    00446 /**
    00447  * Similar to svn_subst_copy_and_translate4() but without a cancellation
    00448  * function and baton.
    00449  *
    00450  * @since New in 1.3.
    00451  * @deprecated Provided for backward compatibility with the 1.6 API.
    00452  */
    00453 SVN_DEPRECATED
    00454 svn_error_t *
    00455 svn_subst_copy_and_translate3(const char *src,
    00456                               const char *dst,
    00457                               const char *eol_str,
    00458                               svn_boolean_t repair,
    00459                               apr_hash_t *keywords,
    00460                               svn_boolean_t expand,
    00461                               svn_boolean_t special,
    00462                               apr_pool_t *pool);
    00463
    00464
    00465 /**
    00466  * Similar to svn_subst_copy_and_translate3() except that @a keywords is a
    00467  * @c svn_subst_keywords_t struct instead of a keywords hash.
    00468  *
    00469  * @deprecated Provided for backward compatibility with the 1.2 API.
    00470  * @since New in 1.1.
    00471  */
    00472 SVN_DEPRECATED
    00473 svn_error_t *
    00474 svn_subst_copy_and_translate2(const char *src,
    00475                               const char *dst,
    00476                               const char *eol_str,
    00477                               svn_boolean_t repair,
    00478                               const svn_subst_keywords_t *keywords,
    00479                               svn_boolean_t expand,
    00480                               svn_boolean_t special,
    00481                               apr_pool_t *pool);
    00482
    00483 /**
    00484  * Similar to svn_subst_copy_and_translate2() except that @a special is
    00485  * always set to @c FALSE.
    00486  *
    00487  * @deprecated Provided for backward compatibility with the 1.0 API.
    00488  */
    00489 SVN_DEPRECATED
    00490 svn_error_t *
    00491 svn_subst_copy_and_translate(const char *src,
    00492                              const char *dst,
    00493                              const char *eol_str,
    00494                              svn_boolean_t repair,
    00495                              const svn_subst_keywords_t *keywords,
    00496                              svn_boolean_t expand,
    00497                              apr_pool_t *pool);
    00498
    00499
    00500 /**
    00501  * Set @a *dst to a copy of the string @a src, possibly performing line
    00502  * ending and keyword translations.
    00503  *
    00504  * This is a variant of svn_subst_translate_stream3() that operates on
    00505  * cstrings.  @see svn_subst_stream_translated() for details of the
    00506  * translation and of @a eol_str, @a repair, @a keywords and @a expand.
    00507  *
    00508  * If @a eol_str and @a keywords are @c NULL, behavior is just a byte-for-byte
    00509  * copy.
    00510  *
    00511  * Allocate @a *dst in @a pool.
    00512  *
    00513  * @since New in 1.3.
    00514  */
    00515 svn_error_t *
    00516 svn_subst_translate_cstring2(const char *src,
    00517                              const char **dst,
    00518                              const char *eol_str,
    00519                              svn_boolean_t repair,
    00520                              apr_hash_t *keywords,
    00521                              svn_boolean_t expand,
    00522                              apr_pool_t *pool);
    00523
    00524 /**
    00525  * Similar to svn_subst_translate_cstring2() except that @a keywords is a
    00526  * @c svn_subst_keywords_t struct instead of a keywords hash.
    00527  *
    00528  * @deprecated Provided for backward compatibility with the 1.2 API.
    00529  */
    00530 SVN_DEPRECATED
    00531 svn_error_t *
    00532 svn_subst_translate_cstring(const char *src,
    00533                             const char **dst,
    00534                             const char *eol_str,
    00535                             svn_boolean_t repair,
    00536                             const svn_subst_keywords_t *keywords,
    00537                             svn_boolean_t expand,
    00538                             apr_pool_t *pool);
    00539
    00540 /**
    00541  * Translate the file @a src in working copy form to a file @a dst in
    00542  * normal form.
    00543  *
    00544  * The values specified for @a eol_style, @a *eol_str, @a keywords and
    00545  * @a special, should be the ones used to translate the file to its
    00546  * working copy form.  Usually, these are the values specified by the
    00547  * user in the files' properties.
    00548  *
    00549  * Inconsistent line endings in the file will be automatically repaired
    00550  * (made consistent) for some eol styles.  For all others, an error is
    00551  * returned.  By setting @a always_repair_eols to @c TRUE, eols will be
    00552  * made consistent even for those styles which don't have it by default.
    00553  *
    00554  * @note To translate a file FROM normal form, use
    00555  *       svn_subst_copy_and_translate3().
    00556  *
    00557  * @since New in 1.4
    00558  * @deprecated Provided for backward compatibility with the 1.5 API
    00559  */
    00560 SVN_DEPRECATED
    00561 svn_error_t *
    00562 svn_subst_translate_to_normal_form(const char *src,
    00563                                    const char *dst,
    00564                                    svn_subst_eol_style_t eol_style,
    00565                                    const char *eol_str,
    00566                                    svn_boolean_t always_repair_eols,
    00567                                    apr_hash_t *keywords,
    00568                                    svn_boolean_t special,
    00569                                    apr_pool_t *pool);
    00570
    00571 /**
    00572  * Set @a *stream_p to a stream that detranslates the file @a src from
    00573  * working copy form to normal form, allocated in @a pool.
    00574  *
    00575  * The values specified for @a eol_style, @a *eol_str, @a keywords and
    00576  * @a special, should be the ones used to translate the file to its
    00577  * working copy form.  Usually, these are the values specified by the
    00578  * user in the files' properties.
    00579  *
    00580  * Inconsistent line endings in the file will be automatically repaired
    00581  * (made consistent) for some eol styles.  For all others, an error is
    00582  * returned.  By setting @a always_repair_eols to @c TRUE, eols will be
    00583  * made consistent even for those styles which don't have it by default.
    00584  *
    00585  * @since New in 1.4.
    00586  *
    00587  * @deprecated Provided for backward compatibility with the 1.5 API.
    00588  *   Use svn_subst_stream_from_specialfile if the source is special;
    00589  *   otherwise, use svn_subst_stream_translated_to_normal_form.
    00590  */
    00591 SVN_DEPRECATED
    00592 svn_error_t *
    00593 svn_subst_stream_detranslated(svn_stream_t **stream_p,
    00594                               const char *src,
    00595                               svn_subst_eol_style_t eol_style,
    00596                               const char *eol_str,
    00597                               svn_boolean_t always_repair_eols,
    00598                               apr_hash_t *keywords,
    00599                               svn_boolean_t special,
    00600                               apr_pool_t *pool);
    00601
    00602
    00603 /* EOL conversion and character encodings */
    00604
    00605 /** Translate the string @a value from character encoding @a encoding to
    00606  * UTF8, and also from its current line-ending style to LF line-endings.  If
    00607  * @a encoding is @c NULL, translate from the system-default encoding.
    00608  *
    00609  * If @a translated_to_utf8 is not @c NULL, then set @a *translated_to_utf8
    00610  * to @c TRUE if at least one character of @a value in the source character
    00611  * encoding was translated to UTF-8, or to @c FALSE otherwise.
    00612  *
    00613  * If @a translated_line_endings is not @c NULL, then set @a
    00614  * *translated_line_endings to @c TRUE if at least one line ending was
    00615  * changed to LF, or to @c FALSE otherwise.
    00616  *
    00617  * If @a value has an inconsistent line ending style, then: if @a repair
    00618  * is @c FALSE, return @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is
    00619  * @c TRUE, convert any line ending in @a value to "\n" in
    00620  * @a *new_value.  Recognized line endings are: "\n", "\r", and "\r\n".
    00621  *
    00622  * Set @a *new_value to the translated string, allocated in @a result_pool.
    00623  *
    00624  * @a scratch_pool is used for temporary allocations.
    00625  *
    00626  * @since New in 1.7.
    00627  */
    00628 svn_error_t *
    00629 svn_subst_translate_string2(svn_string_t **new_value,
    00630                             svn_boolean_t *translated_to_utf8,
    00631                             svn_boolean_t *translated_line_endings,
    00632                             const svn_string_t *value,
    00633                             const char *encoding,
    00634                             svn_boolean_t repair,
    00635                             apr_pool_t *result_pool,
    00636                             apr_pool_t *scratch_pool);
    00637
    00638 /** Similar to svn_subst_translate_string2(), except that the information about
    00639  * whether re-encoding or line ending translation were performed is discarded.
    00640  *
    00641  * @deprecated Provided for backward compatibility with the 1.6 API.
    00642  */
    00643 SVN_DEPRECATED
    00644 svn_error_t *svn_subst_translate_string(svn_string_t **new_value,
    00645                                         const svn_string_t *value,
    00646                                         const char *encoding,
    00647                                         apr_pool_t *pool);
    00648
    00649 /** Translate the string @a value from UTF8 and LF line-endings into native
    00650  * character encoding and native line-endings.  If @a for_output is TRUE,
    00651  * translate to the character encoding of the output locale, else to that of
    00652  * the default locale.
    00653  *
    00654  * Set @a *new_value to the translated string, allocated in @a pool.
    00655  */
    00656 svn_error_t *svn_subst_detranslate_string(svn_string_t **new_value,
    00657                                           const svn_string_t *value,
    00658                                           svn_boolean_t for_output,
    00659                                           apr_pool_t *pool);
    00660
    00661 #ifdef __cplusplus
    00662 }
    00663 #endif /* __cplusplus */
    00664
    00665 #endif /* SVN_SUBST_H */

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines