- Created ChatRoom class to manage chat room functionalities, including user management, message handling, and game mechanics. - Developed ChatUser class to represent individual users, handling user-specific actions and interactions within chat rooms. - Implemented a Config class for loading configuration settings from a JSON file. - Established a Server class to manage connections, handle requests, and facilitate communication between users and chat rooms. - Introduced a Database class for database interactions, utilizing PostgreSQL for user and room data management. - Added utility functions in the Base class for JSON handling and socket communication. - Created Object classes for Room and User to encapsulate their properties and behaviors. - Updated main function to initialize server and load chat rooms from configuration.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <json/value.h>
|
|
|
|
namespace Yc
|
|
{
|
|
namespace Object
|
|
{
|
|
|
|
class Room
|
|
{
|
|
public:
|
|
Room(const Json::Value &roomJson);
|
|
|
|
int id() const;
|
|
const std::string &title() const;
|
|
int owner_id() const;
|
|
bool is_public() const;
|
|
int gender_restriction_id() const;
|
|
int min_age() const;
|
|
int max_age() const;
|
|
const std::string &password_hash() const;
|
|
bool friends_of_owner_only() const;
|
|
int required_user_right_id() const;
|
|
const std::string &created_at() const;
|
|
const std::string &updated_at() const;
|
|
int room_type_id() const;
|
|
const std::string &room_type_tr() const;
|
|
|
|
private:
|
|
int _id = 0;
|
|
std::string _title;
|
|
int _owner_id = 0;
|
|
bool _is_public = true;
|
|
int _gender_restriction_id = 0;
|
|
int _min_age = 0;
|
|
int _max_age = 0;
|
|
std::string _password_hash;
|
|
bool _friends_of_owner_only = false;
|
|
int _required_user_right_id = 0;
|
|
std::string _created_at;
|
|
std::string _updated_at;
|
|
int _room_type_id = 0;
|
|
std::string _room_type_tr;
|
|
};
|
|
|
|
} // namespace Object
|
|
} // namespace Yc
|