add solution for hw8
This commit is contained in:
41
hws/youtube_comments/comment.h
Normal file
41
hws/youtube_comments/comment.h
Normal 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
|
||||
Reference in New Issue
Block a user