Source for comment.hpp

The following are the class declarations and inline members, if you are starting the Tutorial in Part 9.

class CommentType {
   IString UserId,     // ID of comment creator
           Date,       // Date comment was created
           Time,       // Time comment was created
           Text;       // Text of comment
   int LineNum,        // Line to which comment applies
       CommentNum;     // Comment number for this line
   Request* Req;       // Pointer to the current request
   IBoolean Completed;  // Whether the author has completed the comment
   public:
      // Set methods
      void SetUser(IString U) {UserId=U;}
      void SetDate(IString D) {Date=D;}
      void SetTime(IString U) {Time=U;}
      void SetText(IString U) {Text=U;}
      void SetReq(Request* R) {Req=R;}
      void SetLineNum(int L) {LineNum=L;}
      void SetCommentNum(int L) {CommentNum=L;}
      void SetCompleted(IBoolean T) {Completed=T;}
      // Constructors and print function
      CommentType() : LineNum(0), CommentNum(0), Req(0) {}
      CommentType(int Ln, int Ct, Request* R) :
         LineNum(Ln), CommentNum(Ct), Req(R) {}
      IString Print(IBoolean CompleteLink);
   };

class CommentSection {
   protected:
      IString Tag;             // Tag for this section (eg. <p>, <li>)
      IString Text;            // HTML Text following tag
      IBoolean ShowInsert;      // Whether to show the numbered link for adding comments
      IBoolean CompleteLink;    // Whether to show the "Complete" link (used for authors)
      CommentType* Comment;    // Each section can have up to 16 comments
      int Count;               // Count of comments
      Request* Req;            // Pointer to the request
      int Number;              // Number of this comment section (ie. array index)
   public:
      // Constructor
      CommentSection(): Tag(""),
                        Comment(new CommentType[16]),
                        Text(""),
                        Count(-1),
                        Number(0),
                        Req(0),
                        CompleteLink(false),
                        ShowInsert(false) {}
      // Set methods
      void SetTag(IString Tg) {Tag=Tg; }
      void SetComment(IString Text, IString User,
                      IString Date, IString Time,
                      IBoolean Completed);

      void SetText(IString Tx) { Text=Tx; }
      void SetReq(Request* Rq) {Req=Rq;}
      void SetNumber(int Num) {Number=Num;}
      void SetCompleteLink(IBoolean tf) {CompleteLink=tf;}
      void SetShowInsert() {ShowInsert=true;}
      IBoolean IncrementCount() {
         if (Count<16) {Count++; return true; }
         return false;
      }
      IString Print();
};