A class to manage user data.
More...
#include <storage.hpp>
|
| Storage () |
| Constructor for the Storage class.
|
|
| ~Storage () |
| Destructor for the Storage class.
|
|
bool | addUser (const std::string &username, const std::string &password) |
| Adds a user to the storage.
|
|
bool | removeUser (std::string username) |
| Removes a user from the storage.
|
|
bool | isUserExist (std::string username) |
| Checks if a user exists in the storage.
|
|
std::vector< std::tuple< int, std::string, std::string, std::vector< std::string > > > | getUsers () |
| Gets a list of all users.
|
|
bool | authenticateUser (const std::string &username, const std::string &password) |
| Authenticates a user.
|
|
bool | addTag (std::string username, std::string tag) |
| Adds a tag to a user.
|
|
std::vector< std::string > | getTags (std::string username) |
| Gets a list of tags for a user.
|
|
bool | removeTag (std::string username, std::string tag) |
| delete tag for certain user
|
|
A class to manage user data.
◆ addTag()
bool Storage::addTag |
( |
std::string | username, |
|
|
std::string | tag ) |
Adds a tag to a user.
- Parameters
-
username | The username of the user. |
tag | The tag to add. |
- Returns
- True if the tag was added successfully, false otherwise.
◆ addUser()
bool Storage::addUser |
( |
const std::string & | username, |
|
|
const std::string & | password ) |
Adds a user to the storage.
- Parameters
-
username | The username of the user. |
password | The password of the user. |
- Returns
- True if the user was added successfully, false otherwise.
◆ authenticateUser()
bool Storage::authenticateUser |
( |
const std::string & | username, |
|
|
const std::string & | password ) |
Authenticates a user.
- Parameters
-
username | The username of the user. |
password | The password of the user. |
- Returns
- True if the authentication was successful, false otherwise.
◆ getTags()
std::vector< std::string > Storage::getTags |
( |
std::string | username | ) |
|
Gets a list of tags for a user.
- Parameters
-
username | The username of the user. |
- Returns
- A vector of tags.
◆ getUsers()
std::vector< std::tuple< int, std::string, std::string, std::vector< std::string > > > Storage::getUsers |
( |
| ) |
|
Gets a list of all users.
- Returns
- A vector, whose element is the tuple for each user, including their name password and the tag is return as a vector whose element is string
◆ isUserExist()
bool Storage::isUserExist |
( |
std::string | username | ) |
|
Checks if a user exists in the storage.
- Parameters
-
username | The username to check. |
- Returns
- True if the user exists, false otherwise.
◆ removeTag()
bool Storage::removeTag |
( |
std::string | username, |
|
|
std::string | tag ) |
delete tag for certain user
- Parameters
-
username | The name of user |
tag | the tag wanna to remove |
- Returns
- the bool value if successfully remove the tag
◆ removeUser()
bool Storage::removeUser |
( |
std::string | username | ) |
|
Removes a user from the storage.
- Parameters
-
username | The username of the user to remove. |
- Returns
- True if the user was removed successfully, false otherwise.
The documentation for this class was generated from the following file: