summaryrefslogtreecommitdiff
path: root/ace/Read_Buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Read_Buffer.h')
-rw-r--r--ace/Read_Buffer.h99
1 files changed, 50 insertions, 49 deletions
diff --git a/ace/Read_Buffer.h b/ace/Read_Buffer.h
index 84688f9bc0c..ad1bef9fa32 100644
--- a/ace/Read_Buffer.h
+++ b/ace/Read_Buffer.h
@@ -1,18 +1,15 @@
/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// ace
-//
-// = FILENAME
-// Read_Buffer.h
-//
-// = AUTHOR
-// Doug Schmidt and Seth Widoff
-//
-// ============================================================================
+
+//=============================================================================
+/**
+ * @file Read_Buffer.h
+ *
+ * $Id$
+ *
+ * @author Doug Schmidt and Seth Widoff
+ */
+//=============================================================================
+
#ifndef ACE_READ_BUFFER_H
#define ACE_READ_BUFFER_H
@@ -26,79 +23,83 @@
#include "ace/Malloc.h"
+/**
+ * @class ACE_Read_Buffer
+ *
+ * @brief Efficiently reads an artibrarily large buffer from an input
+ * stream up to and including a termination character. Also
+ * performs search/replace on single occurrences a character in
+ * the buffer using the principles of Integrated Layer
+ * Processing.
+ *
+ * This implementation is optimized to do a single dynamic
+ * allocation and make only one copy of the data. It uses
+ * recursion and the run-time stack to accomplish this
+ * efficiently.
+ */
class ACE_Export ACE_Read_Buffer
{
- // = TITLE
- // Efficiently reads an artibrarily large buffer from an input
- // stream up to and including a termination character. Also
- // performs search/replace on single occurrences a character in
- // the buffer using the principles of Integrated Layer
- // Processing.
- //
- // = DESCRIPTION
- // This implementation is optimized to do a single dynamic
- // allocation and make only one copy of the data. It uses
- // recursion and the run-time stack to accomplish this
- // efficiently.
public:
// = Initialization and termination methods.
+ /// Read from a FILE *.
ACE_Read_Buffer (FILE *fp,
int close_on_delete = 0,
ACE_Allocator * = 0);
- // Read from a FILE *.
+ /// Read from an open HANDLE.
ACE_Read_Buffer (ACE_HANDLE handle,
int close_on_delete = 0,
ACE_Allocator * = 0);
- // Read from an open HANDLE.
+ /// Closes the FILE *.
~ACE_Read_Buffer (void);
- // Closes the FILE *.
+ /**
+ * Returns a pointer dynamically allocated with
+ * <ACE_Allocator::malloc> to data from the input stream up to (and
+ * including) the <terminator>. If <search> is >= 0 then all
+ * occurrences of the <search> value are substituted with the
+ * <replace> value. The last of the byte of data is a 0, so that
+ * <strlen> can be used on it. The caller is responsible for
+ * freeing the pointer returned from this method using the
+ * <ACE_Allocator::free>.
+ */
char *read (int terminator = EOF,
int search = '\n',
int replace = '\0');
- // Returns a pointer dynamically allocated with
- // <ACE_Allocator::malloc> to data from the input stream up to (and
- // including) the <terminator>. If <search> is >= 0 then all
- // occurrences of the <search> value are substituted with the
- // <replace> value. The last of the byte of data is a 0, so that
- // <strlen> can be used on it. The caller is responsible for
- // freeing the pointer returned from this method using the
- // <ACE_Allocator::free>.
+ /// Returns the number of characters replaced during a <read>.
size_t replaced (void) const;
- // Returns the number of characters replaced during a <read>.
+ /// Returns the size of the allocated buffer obtained during a
+ /// <read>, not including the null terminator.
size_t size (void) const;
- // Returns the size of the allocated buffer obtained during a
- // <read>, not including the null terminator.
+ /// Returns a pointer to its allocator.
ACE_Allocator *alloc (void) const;
- // Returns a pointer to its allocator.
+ /// Dump the state of the object.
void dump (void) const;
- // Dump the state of the object.
private:
+ /// Recursive helper method that does the work...
char *rec_read (int term, int search, int replace);
- // Recursive helper method that does the work...
+ /// The total number of characters in the buffer.
size_t size_;
- // The total number of characters in the buffer.
+ /// The total number of characters replaced.
size_t occurrences_;
- // The total number of characters replaced.
+ /// The stream we are reading from.
FILE *stream_;
- // The stream we are reading from.
+ /// Keeps track of whether we should close the FILE in the
+ /// destructor.
int close_on_delete_;
- // Keeps track of whether we should close the FILE in the
- // destructor.
+ /// Pointer to the allocator.
ACE_Allocator *allocator_;
- // Pointer to the allocator.
// = Disallow copying and assignment...
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Read_Buffer &))