⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svn_io.h

📁 linux subdivision ying gai ke yi le ba
💻 H
📖 第 1 页 / 共 3 页
字号:
 */
svn_error_t *
svn_io_read_length_line (apr_file_t *file, char *buf, apr_size_t *limit,
                         apr_pool_t *pool);


/** Set @a *apr_time to the time of last modification of the contents of the
 * file @a path.  @a path is utf8-encoded.
 *
 * Note: this is the APR mtime which corresponds to the traditional mtime
 * on Unix, and the last write time on Windows.
 */
svn_error_t *svn_io_file_affected_time (apr_time_t *apr_time,
                                        const char *path,
                                        apr_pool_t *pool);

/** Set the timestamp of file @a path to @a apr_time.  @a path is
 *  utf8-encoded.
 *
 * Note: this is the APR mtime which corresponds to the traditional mtime
 * on Unix, and the last write time on Windows.
 */
svn_error_t *svn_io_set_file_affected_time (apr_time_t apr_time,
                                            const char *path,
                                            apr_pool_t *pool);



/** Set @a *different_p to non-zero if @a file1 and @a file2 have different
 * sizes, else set to zero.  Both @a file1 and @a file2 are utf8-encoded.
 *
 * Setting @a *different_p to zero does not mean the files definitely
 * have the same size, it merely means that the sizes are not
 * definitely different.  That is, if the size of one or both files
 * cannot be determined, then the sizes are not known to be different,
 * so @a *different_p is set to 0.
 */
svn_error_t *svn_io_filesizes_different_p (svn_boolean_t *different_p,
                                           const char *file1,
                                           const char *file2,
                                           apr_pool_t *pool);


/** Put the md5 checksum of @a file into @a digest.
 * @a digest points to @c APR_MD5_DIGESTSIZE bytes of storage.
 * Use @a pool only for temporary allocations.
 */
svn_error_t *svn_io_file_checksum (unsigned char digest[],
                                   const char *file,
                                   apr_pool_t *pool);


/* Set @a *same to non-zero if @a file1 and @a file2 have the same
 * contents, else set it to zero.  Use @a pool for temporary allocations.
 */
svn_error_t *svn_io_files_contents_same_p (svn_boolean_t *same,
                                           const char *file1,
                                           const char *file2,
                                           apr_pool_t *pool);

/** Create file at @a file with contents @a contents.
 * will be created.  Path @a file is utf8-encoded.
 * Use @a pool for memory allocations.
 */
svn_error_t *svn_io_file_create (const char *file,
                                 const char *contents,
                                 apr_pool_t *pool);

/**
 * @deprecated Provided for backward compatibility with the 1.0.0 API.
 *
 * Lock file at @a lock_file. If @exclusive is TRUE,
 * obtain exclusive lock, otherwise obtain shared lock.
 * Lock will be automaticaly released when @a pool is cleared or destroyed.
 * Use @a pool for memory allocations.
 */
svn_error_t *svn_io_file_lock (const char *lock_file,
                               svn_boolean_t exclusive,
                               apr_pool_t *pool);

/**
 * @since New in 1.1.
 *
 * Lock file at @a lock_file. If @exclusive is TRUE,
 * obtain exclusive lock, otherwise obtain shared lock.
 *
 * If @a nonblocking is TRUE, do not wait for the lock if it
 * is not available: throw an error instead.
 *
 * Lock will be automaticaly released when @a pool is cleared or destroyed.
 * Use @a pool for memory allocations.
 */
svn_error_t *svn_io_file_lock2 (const char *lock_file,
                                svn_boolean_t exclusive,
                                svn_boolean_t nonblocking,
                                apr_pool_t *pool);
/**
 * @since New in 1.1.
 *
 * Flush any unwritten data from @a file to disk.  Use @a pool for
 *  memory allocations.
 */
svn_error_t *svn_io_file_flush_to_disk (apr_file_t *file,
                                        apr_pool_t *pool);

/** Copy file @a file from location @a src_path to location @a dest_path.
 * Use @a pool for memory allocations.
 */
svn_error_t *svn_io_dir_file_copy (const char *src_path, 
                                   const char *dest_path, 
                                   const char *file,
                                   apr_pool_t *pool);


/** Generic byte-streams
 *
 * @defgroup svn_io_byte_streams generic byte streams
 * @{
 */

/** An abstract stream of bytes--either incoming or outgoing or both.
 *
 * The creator of a stream sets functions to handle read and write.
 * Both of these handlers accept a baton whose value is determined at
 * stream creation time; this baton can point to a structure
 * containing data associated with the stream.  If a caller attempts
 * to invoke a handler which has not been set, it will generate a
 * runtime assertion failure.  The creator can also set a handler for
 * close requests so that it can flush buffered data or whatever;
 * if a close handler is not specified, a close request on the stream
 * will simply be ignored.  Note that svn_stream_close() does not
 * deallocate the memory used to allocate the stream structure; free
 * the pool you created the stream in to free that memory.
 *
 * The read and write handlers accept length arguments via pointer.
 * On entry to the handler, the pointed-to value should be the amount
 * of data which can be read or the amount of data to write.  When the
 * handler returns, the value is reset to the amount of data actually
 * read or written.  Handlers are obliged to complete a read or write
 * to the maximum extent possible; thus, a short read with no
 * associated error implies the end of the input stream, and a short
 * write should never occur without an associated error.
 */
typedef struct svn_stream_t svn_stream_t;



/** Read handler function for a generic stream.  */
typedef svn_error_t *(*svn_read_fn_t) (void *baton,
                                       char *buffer,
                                       apr_size_t *len);

/** Write handler function for a generic stream.  */
typedef svn_error_t *(*svn_write_fn_t) (void *baton,
                                        const char *data,
                                        apr_size_t *len);

/** Close handler function for a generic stream.  */
typedef svn_error_t *(*svn_close_fn_t) (void *baton);


/** Creating a generic stream.  */
svn_stream_t *svn_stream_create (void *baton, apr_pool_t *pool);

/** Set @a stream's baton to @a baton */
void svn_stream_set_baton (svn_stream_t *stream, void *baton);

/** Set @a stream's read function to @a read_fn */
void svn_stream_set_read (svn_stream_t *stream, svn_read_fn_t read_fn);

/** Set @a stream's write function to @a write_fn */
void svn_stream_set_write (svn_stream_t *stream, svn_write_fn_t write_fn);

/** Set @a stream's close function to @a close_fn */
void svn_stream_set_close (svn_stream_t *stream, svn_close_fn_t close_fn);


/** Convenience function to create a generic stream which is empty.  */
svn_stream_t *svn_stream_empty (apr_pool_t *pool);


/** Convenience function for creating streams which operate on APR
 * files.  For convenience, if @a file is NULL then @c svn_stream_empty(pool) 
 * is returned.  Note that the stream returned by these operations is not 
 * considered to "own" the underlying file, meaning that @c svn_stream_close() 
 * on the stream will not close the file.
 */
svn_stream_t *svn_stream_from_aprfile (apr_file_t *file, apr_pool_t *pool);

/** Set @a *out to a generic stream connected to stdout, allocated in 
 * @a pool.  The stream and its underlying APR handle will be closed
 * when @a pool is cleared or destroyed.
 */
svn_error_t *svn_stream_for_stdout (svn_stream_t **out, apr_pool_t *pool);

/** Return a generic stream connected to stringbuf @a str.  Allocate the
 * stream in @a pool.
 */
svn_stream_t *svn_stream_from_stringbuf (svn_stringbuf_t *str,
                                         apr_pool_t *pool);

/** Return a stream that decompresses all data read and compresses all
 * data written. The stream @a stream is used to read and write all
 * compressed data. All compression data structures are allocated on
 * @a pool. If compression support is not compiled in then @c
 * svn_stream_compressed() returns @a stream unmodified. Make sure you
 * call @c svn_stream_close() on the stream returned by this function,
 * so that all data are flushed and cleaned up.
 */
svn_stream_t *svn_stream_compressed (svn_stream_t *stream, 
                                     apr_pool_t *pool);

/** Read from a generic stream. */
svn_error_t *svn_stream_read (svn_stream_t *stream, char *buffer,
                              apr_size_t *len);

/** Write to a generic stream. */
svn_error_t *svn_stream_write (svn_stream_t *stream, const char *data,
                               apr_size_t *len);

/** Close a generic stream. */
svn_error_t *svn_stream_close (svn_stream_t *stream);


/** Write to @a stream using a printf-style @a fmt specifier, passed through
 * @c apr_psprintf using memory from @a pool.
 */
svn_error_t *svn_stream_printf (svn_stream_t *stream,
                                apr_pool_t *pool,
                                const char *fmt,
                                ...)
       __attribute__ ((format(printf, 3, 4)));

/** Allocate @a *stringbuf in @a pool, and read into it one line (terminated
 * by @a eol) from @a stream. The line-terminator is read from the stream,
 * but is not added to the end of the stringbuf.  Instead, the stringbuf
 * ends with a usual '\\0'.
 *
 * If @a stream runs out of bytes before encountering a line-terminator,
 * then set @a *eof to @c TRUE, otherwise set @a *eof to FALSE.
 */
svn_error_t *
svn_stream_readline (svn_stream_t *stream,
                     svn_stringbuf_t **stringbuf,
                     const char *eol,
                     svn_boolean_t *eof,
                     apr_pool_t *pool);

/**
 * @since New in 1.1.
 *
 * Read the contents of the readable stream @a from and write them to the
 * writable stream @a to.
 */
svn_error_t *svn_stream_copy (svn_stream_t *from, svn_stream_t *to,
                              apr_pool_t *pool);

/** @} */

/** Sets @a *result to a string containing the contents of @a filename, a
 * utf8-encoded path. 
 *
 * If @a filename is "-", return the error @c SVN_ERR_UNSUPPORTED_FEATURE
 * and don't touch @a *result.
 *
 * ### Someday, "-" will fill @a *result from stdin.  The problem right
 * now is that if the same command invokes the editor, stdin is crap,
 * and the editor acts funny or dies outright.  One solution is to
 * disallow stdin reading and invoking the editor, but how to do that
 * reliably?
 */
svn_error_t *svn_stringbuf_from_file (svn_stringbuf_t **result, 
                                      const char *filename, 
                                      apr_pool_t *pool);

/** Sets @a *result to a string containing the contents of the already opened
 * @a file.  Reads from the current position in file to the end.  Does not
 * close the file or reset the cursor position.
 */
svn_error_t *svn_stringbuf_from_aprfile (svn_stringbuf_t **result,
                                         apr_file_t *file,
                                         apr_pool_t *pool);

/** Remove file @a path, a utf8-encoded path.  This wraps @c apr_file_remove(), 
 * converting any error to a Subversion error.
 */
svn_error_t *svn_io_remove_file (const char *path, apr_pool_t *pool);

/** Recursively remove directory @a path.  @a path is utf8-encoded. */
svn_error_t *svn_io_remove_dir (const char *path, apr_pool_t *pool);


/** Read all of the disk entries in directory @a path, a utf8-encoded
 * path.  Return a @a dirents hash mapping dirent names (<tt>char *</tt>) to
 * enumerated dirent filetypes (@c svn_node_kind_t *).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -