add solution for hw8

This commit is contained in:
JamesFlare1212
2025-04-07 17:10:37 -04:00
parent 9d1335bc18
commit 9fd32f72f6
6 changed files with 474 additions and 15 deletions

View File

@@ -0,0 +1,41 @@
#ifndef COMMENT_H
#define COMMENT_H
#include <string>
#include <vector>
// Comment class to store information about a YouTube comment
class Comment {
public:
// Comment fields as described in the json file
std::string video_id;
std::string author;
std::string comment_id;
int like_count;
int reply_count;
bool is_reply;
std::string parent_comment_id;
std::string published_date;
std::string crawled_date;
bool is_video_owner;
std::string comment;
// Vector to store child comments (replies to this comment)
std::vector<Comment*> children;
// Constructor
Comment(std::string vid_id, std::string auth, std::string comm_id, int likes,
int replies, bool isReply, std::string parent_id, std::string pub_date,
std::string crawl_date, bool isOwner, std::string comm);
// Destructor - clean up all children
~Comment();
// Add a child comment to this comment
void addChild(Comment* child);
// Like this comment
void like();
};
#endif // COMMENT_H