Browse Source

[1602] start with doxygen docs

Jelte Jansen 13 years ago
parent
commit
7ac5487d20
2 changed files with 25 additions and 4 deletions
  1. 24 3
      src/lib/dns/labelsequence.cc
  2. 1 1
      src/lib/dns/labelsequence.h

+ 24 - 3
src/lib/dns/labelsequence.cc

@@ -15,13 +15,34 @@
 #include <dns/labelsequence.h>
 #include <exceptions/exceptions.h>
 
-// TODO: REMOVE
-#include <iostream>
+/// Light-weight Accessor to Name object
+///
+/// The purpose of this class is to easily match Names and parts of Names,
+/// without needing to copy the underlying data on each split.
+///
+/// It can only work on existing Name objects, and the Name object MUST
+/// remain in scope during the entire lifetime of its associated
+/// LabelSequence(s)
+///
+/// Upon creation of a LabelSequence, it records the offsets of the
+/// labels in the wireformat data of the Name. When split() is called on
+/// the LabelSequence, no changes in the Name's data occur, but the
+/// internal pointers of the LabelSequence are modified.
+///
+/// LabelSequences can be compared to other LabelSequences, and their
+/// data can be requested (which then points to part of the original
+/// data of the associated Name object).
+///
 
 namespace isc {
 namespace dns {
 
-
+/// \brief Constructs a LabelSequence for the given name
+///
+/// The associated Name MUST remain in scope during the lifetime of
+/// this LabelSequence, since getData() refers to data from the
+/// Name object (the only data the LabelSequence stores are pointers
+/// to the labels in the Name object).
 LabelSequence::LabelSequence(const Name& name) : name_(name),
                              first_label_(0) {
     size_t label_count_ = name.getLabelCount();

+ 1 - 1
src/lib/dns/labelsequence.h

@@ -32,7 +32,7 @@ public:
 
     void split(int i);
 
-    size_t getLabelCount() { return last_label_ - first_label_; }
+    size_t getLabelCount() const { return last_label_ - first_label_; }
 
     const Name& getName() const { return name_; }