Skip to content

Commit

Permalink
docs: update readme to use namespaces in examples (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Jun 27, 2024
1 parent 59f91e3 commit e12afe8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ NUM_PROC_THREADS = 1
# normally produced when WARNINGS is set to YES.
# The default value is: NO.

EXTRACT_ALL = NO
EXTRACT_ALL = YES

# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation.
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ purposes within C++ applications.
## Usage and Documentation

To properly use Faker C++ you must first consume the Faker library (see Consuming Library with CMake).
Once that is done, you need to include the proper header files depending on the module you wish to generate data from.
Once that is done, you need to include the proper header files depending on the module you wish to generate data from or
use general include file `faker-cxx/Faker.h`.
The module header file names can be found in [docs](https://cieslarmichal.github.io/faker-cxx).

Below is an example of how to use Faker C++ in your code.
Expand All @@ -49,13 +50,15 @@ Below is an example of how to use Faker C++ in your code.
#include "faker-cxx/Location.h"
#include "faker-cxx/String.h"

// or #include "faker-cxx/Faker.h" for all modules

int main()
{
const auto id = faker::String::uuid();
const auto email = faker::Internet::email();
const auto password = faker::Internet::password();
const auto city = faker::Location::city();
const auto streetAddress = faker::Location::streetAddress();
const auto id = faker::string::uuid();
const auto email = faker::internet::email();
const auto password = faker::internet::password();
const auto city = faker::location::city();
const auto streetAddress = faker::location::streetAddress();

std::cout << id << std::endl; // 58018063-ce5a-4fa7-adfd-327eb2e2d9a5
std::cout << email << std::endl; // [email protected]
Expand Down
3 changes: 1 addition & 2 deletions examples/basic/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <cstdlib>
#include <iostream>

#include "faker-cxx/Date.h"
#include "faker-cxx/Internet.h"
#include "faker-cxx/Location.h"
#include "faker-cxx/String.h"
Expand All @@ -21,4 +20,4 @@ int main()
std::cout << streetAddress << std::endl;

return EXIT_SUCCESS;
}
}

0 comments on commit e12afe8

Please sign in to comment.