CCIMXDesktop
 
Loading...
Searching...
No Matches
UserInfo Class Reference

Represents a user's profile information, including name, email, phone number, and avatar path. More...

#include <UserInfo.h>

Classes

class  UserInfoBuilder
 A builder class for constructing UserInfo objects. More...
 

Public Member Functions

const QString & get_name () const
 Gets the user's name.
 
const QString & get_email () const
 Gets the user's email address.
 
const QString & get_phone_number () const
 Gets the user's phone number.
 
const QString & get_avatar () const
 Gets the file path to the user's avatar.
 
void set_avator (const QString &av_path)
 Sets the file path for the user's avatar.
 
void set_name (const QString &name)
 Sets the user's name.
 
void set_email (const QString &email)
 Sets the user's email address.
 
void set_phone (const QString &phone)
 Sets the user's phone number.
 
QString serialized () const
 Serializes the UserInfo object into a JSON string.
 
 UserInfo (const UserInfo &)=delete
 
UserInfooperator= (const UserInfo &)=delete
 
 ~UserInfo ()=default
 Default destructor for UserInfo.
 

Friends

class UserInfoBuilder
 Declares UserInfoBuilder as a friend class. This allows UserInfoBuilder to access the private constructor and members of UserInfo for construction purposes.
 

Detailed Description

Represents a user's profile information, including name, email, phone number, and avatar path.

This class is designed to hold immutable user information once constructed, promoting data integrity. It uses a nested UserInfoBuilder class to facilitate the creation of UserInfo objects, especially when dealing with multiple optional fields or deserialization from external sources like JSON. Copying and assignment are explicitly deleted to ensure unique ownership.

Member Function Documentation

◆ get_avatar()

const QString & UserInfo::get_avatar ( ) const

Gets the file path to the user's avatar.

Returns
A constant reference to the avatar file path.

◆ get_email()

const QString & UserInfo::get_email ( ) const

Gets the user's email address.

Returns
A constant reference to the user's email.

◆ get_name()

const QString & UserInfo::get_name ( ) const

Gets the user's name.

Returns
A constant reference to the user's name.

◆ get_phone_number()

const QString & UserInfo::get_phone_number ( ) const

Gets the user's phone number.

Returns
A constant reference to the user's phone number.

◆ serialized()

QString UserInfo::serialized ( ) const

Serializes the UserInfo object into a JSON string.

Returns
A QString containing the JSON representation of the user information.

◆ set_avator()

void UserInfo::set_avator ( const QString &  av_path)

Sets the file path for the user's avatar.

Parameters
av_pathThe new file path to the avatar image.

◆ set_email()

void UserInfo::set_email ( const QString &  email)

Sets the user's email address.

Parameters
emailThe new email address for the user.

◆ set_name()

void UserInfo::set_name ( const QString &  name)

Sets the user's name.

Parameters
nameThe new name for the user.

◆ set_phone()

void UserInfo::set_phone ( const QString &  phone)

Sets the user's phone number.

Parameters
phoneThe new phone number for the user.

The documentation for this class was generated from the following files: