-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTopic.h
33 lines (27 loc) · 933 Bytes
/
Topic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include "User.h"
#include "Question.h"
class Topic
{
MyString _title;
unsigned _idxOfAuthor;
MyString _content;
unsigned _id;
MyVector<Question> _questions;
int getQuestionIdx(const MyString& title) const;
int getQuestionIdx(unsigned id) const;
public:
Topic() = default;
Topic(const MyString& title, unsigned idxOfAuthor, const MyString& content, unsigned id);
void addQuestion(unsigned idxOfAuthor, const MyString& title, const MyString& content);
bool containsText(const MyString& text) const;
void printTopicInfo() const;
const MyString& getTitle() const;
unsigned getId() const;
void printTopicData(const User* author) const;
void printQuestions() const;
void getCurrentQ(const MyString& title, Question*& currentQ);
void getCurrentQ(unsigned id, Question*& currentQ);
void writeToFile(std::ofstream& ofs) const;
void readFromFiLe(std::ifstream& ifs);
};