Permalink
Browse files

For comprehensibility, fixed up comments, reordered methods

  • Loading branch information...
1 parent e374e82 commit d42c3f8d86d4012eb2d11119604d0a319f9ae303 @dabrahams dabrahams committed Jan 18, 2013
Showing with 66 additions and 47 deletions.
  1. +31 −19 svn_dump_humanizer.hpp
  2. +8 −8 svn_dump_parser.cpp
  3. +27 −20 svn_dump_parser.hpp
View
@@ -16,42 +16,54 @@ struct svn_dump_humanizer : svn_dump_parser
: svn_dump_parser(pool), rev_num(-1UL) {}
private: // virtual function implementations
- // The parser has discovered a new revision record
- void begin_revision(apr_hash_t *headers, apr_pool_t *pool);
+ //
+ // Top-level events
+ //
+
// The parser has discovered a new uuid record
void uuid_record(const char *uuid, apr_pool_t *pool);
- // The parser has discovered a new node record within the current
- // revision represented by revision_baton.
- void begin_node(apr_hash_t *headers, apr_pool_t *pool);
-
- // set a named property of the current revision to value.
+ // The parser has discovered a new revision record
+ void begin_revision(apr_hash_t *headers, apr_pool_t *pool);
+
+ // the named property of the current revision to was set to value.
void set_revision_property(const char *name, const svn_string_t *value);
+
+ // The parser has reached the end of the current revision
+ void end_revision();
+
+ //
+ // Events within a given revision
+ //
- // set a named property of the current node to value.
+ // The parser has discovered a new node (file) record
+ void begin_node(apr_hash_t *headers, apr_pool_t *pool);
+
+ // The parser has reached the end of the current node
+ void end_node();
+
+ //
+ // Events within a given node
+ //
+ // the named property of the current node was set to value
void set_node_property(const char *name, const svn_string_t *value);
- // delete a named property of the current node
+ // the named property of the current node was deleted
void delete_node_property(const char *name);
- // remove all properties of the current node.
+ // all properties of the current node were deleted
void remove_node_props();
-
+
+ // The given fulltext provides the next section of the node's contents
void write_fulltext_stream(const char *data, apr_size_t *len);
+ // There are no more fulltext sections in this node
void close_fulltext_stream();
- // For a given node_baton, set handler and handler_baton to a window
- // handler and baton capable of receiving a delta against the node's
+ // The given text delta should be applied against the node's
// previous contents.
void apply_textdelta(svn_txdelta_window_t *window);
- // The parser has reached the end of the current node
- void end_node();
-
- // The parser has reached the end of the current revision
- void end_revision();
-
private: // data members
// Revision number
unsigned long rev_num;
View
@@ -45,32 +45,31 @@ struct svn_dump_parser::backdoor
parser->uuid_record(uuid, pool);
}
- // The parser has discovered a new node record within the current
- // revision represented by revision_baton.
+ // The parser has discovered a new node (file) record
static void begin_node(svn_dump_parser* parser, apr_hash_t *headers, apr_pool_t *pool)
{
parser->begin_node(headers, pool);
}
- // set a named property of the current revision to value.
+ // the named property of the current revision to was set to value.
static void set_revision_property(svn_dump_parser* parser, const char *name, const svn_string_t *value)
{
parser->set_revision_property(name, value);
}
- // set a named property of the current node to value.
+ // the named property of the current node was set to value
static void set_node_property(svn_dump_parser* parser, const char *name, const svn_string_t *value)
{
parser->set_node_property(name, value);
}
- // delete a named property of the current node
+ // the named property of the current node was deleted
static void delete_node_property(svn_dump_parser* parser, const char *name)
{
parser->delete_node_property(name);
}
- // remove all properties of the current node.
+ // all properties of the current node were deleted
static void remove_node_props(svn_dump_parser* parser)
{
parser->remove_node_props();
@@ -93,8 +92,7 @@ struct svn_dump_parser::backdoor
svn_stream_set_close(*stream, text_stream_closer);
}
- // For a given node_baton, set handler and handler_baton to a window
- // handler and baton capable of receiving a delta against the node's
+ // The given text delta should be applied against the node's
// previous contents.
static void apply_textdelta(svn_dump_parser* parser, svn_txdelta_window_t *window)
{
@@ -113,11 +111,13 @@ struct svn_dump_parser::backdoor
parser->end_revision();
}
+ // The given fulltext provides the next section of the node's contents
static void write_fulltext_stream(svn_dump_parser* parser, const char *data, apr_size_t *len)
{
parser->write_fulltext_stream(data, len);
}
+ // There are no more fulltext sections in this node
static void close_fulltext_stream(svn_dump_parser* parser)
{
parser->close_fulltext_stream();
View
@@ -23,44 +23,51 @@ struct svn_dump_parser
class backdoor;
private: // virtual functions
- friend class backdoor;
-
+ //
+ // Top-level events
+ //
+ // The parser has discovered a new uuid record
+ virtual void uuid_record(const char *uuid, apr_pool_t *pool) = 0;
+
// The parser has discovered a new revision record
virtual void begin_revision(apr_hash_t *headers, apr_pool_t *pool) = 0;
- // The parser has discovered a new uuid record
- virtual void uuid_record(const char *uuid, apr_pool_t *pool) = 0;
+ // the named property of the current revision to was set to value.
+ virtual void set_revision_property(const char *name, const svn_string_t *value) = 0;
- // The parser has discovered a new node record within the current
- // revision represented by revision_baton.
+ // The parser has reached the end of the current revision
+ virtual void end_revision() = 0;
+
+ //
+ // Events within a given revision
+ //
+ // The parser has discovered a new node (file) record
virtual void begin_node(apr_hash_t *headers, apr_pool_t *pool) = 0;
+
+ // The parser has reached the end of the current node
+ virtual void end_node() = 0;
- // set a named property of the current revision to value.
- virtual void set_revision_property(const char *name, const svn_string_t *value) = 0;
-
- // set a named property of the current node to value.
+ //
+ // Events within a given node
+ //
+ // the named property of the current node was set to value
virtual void set_node_property(const char *name, const svn_string_t *value) = 0;
- // delete a named property of the current node
+ // the named property of the current node was deleted
virtual void delete_node_property(const char *name) = 0;
- // remove all properties of the current node.
+ // all properties of the current node were deleted
virtual void remove_node_props() = 0;
+ // The given fulltext provides the next section of the node's contents
virtual void write_fulltext_stream(const char *data, apr_size_t *len) = 0;
+ // There are no more fulltext sections in this node
virtual void close_fulltext_stream() = 0;
- // For a given node_baton, set handler and handler_baton to a window
- // handler and baton capable of receiving a delta against the node's
+ // The given text delta should be applied against the node's
// previous contents.
virtual void apply_textdelta(svn_txdelta_window_t *window) = 0;
- // The parser has reached the end of the current node
- virtual void end_node() = 0;
-
- // The parser has reached the end of the current revision
- virtual void end_revision() = 0;
-
private:
apr_pool_t* pool;
};

0 comments on commit d42c3f8

Please sign in to comment.