-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change datatype class to namespace (#727)
- Loading branch information
1 parent
5de4244
commit da55f85
Showing
5 changed files
with
54 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,35 @@ | ||
#pragma once | ||
|
||
namespace faker | ||
namespace faker::datatype | ||
{ | ||
class Datatype | ||
{ | ||
public: | ||
/** | ||
* @brief Returns a random boolean. | ||
* | ||
* @returns Boolean. | ||
* | ||
* @code | ||
* Datatype::boolean() // "false" | ||
* @endcode | ||
*/ | ||
static bool boolean(); | ||
/** | ||
* @brief Returns a random boolean. | ||
* | ||
* @returns Boolean. | ||
* | ||
* @code | ||
* datatype::boolean() // "false" | ||
* @endcode | ||
*/ | ||
bool boolean(); | ||
|
||
/** | ||
* @brief Returns a random boolean. | ||
* **Note:** | ||
* A probability of `0.75` results in `true` being returned `75%` of the calls; likewise `0.3` => `30%`. | ||
* If the probability is `<= 0.0`, it will always return `false`. | ||
* If the probability is `>= 1.0`, it will always return `true`. | ||
* The probability is limited to two decimal places. | ||
* | ||
* @param probability The probability (`[0.00, 1.00]`) of returning `true`. | ||
* | ||
* @returns Boolean. | ||
* | ||
* @code | ||
* Datatype::boolean() // "false" | ||
* Datatype::boolean(0.9) // "true" | ||
* Datatype::boolean(0.1) // "false" | ||
* @endcode | ||
*/ | ||
static bool boolean(double probability); | ||
}; | ||
/** | ||
* @brief Returns a random boolean. | ||
* **Note:** | ||
* A probability of `0.75` results in `true` being returned `75%` of the calls; likewise `0.3` => `30%`. | ||
* If the probability is `<= 0.0`, it will always return `false`. | ||
* If the probability is `>= 1.0`, it will always return `true`. | ||
* The probability is limited to two decimal places. | ||
* | ||
* @param probability The probability (`[0.00, 1.00]`) of returning `true`. | ||
* | ||
* @returns Boolean. | ||
* | ||
* @code | ||
* datatype::boolean() // "false" | ||
* datatype::boolean(0.9) // "true" | ||
* datatype::boolean(0.1) // "false" | ||
* @endcode | ||
*/ | ||
bool boolean(double probability); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters