From e12afe849cba06e206fb11307be2bbcb67a7d881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blar?= Date: Thu, 27 Jun 2024 18:18:40 +0100 Subject: [PATCH] docs: update readme to use namespaces in examples (#748) --- Doxyfile | 2 +- README.md | 15 +++++++++------ examples/basic/main.cpp | 3 +-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Doxyfile b/Doxyfile index 41a11dbfe..156ba955a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -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. diff --git a/README.md b/README.md index 93f121e8a..37b0f6be1 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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; // Lois_Hauck@hotmail.com diff --git a/examples/basic/main.cpp b/examples/basic/main.cpp index d911f0d24..cad6f1643 100644 --- a/examples/basic/main.cpp +++ b/examples/basic/main.cpp @@ -1,7 +1,6 @@ #include #include -#include "faker-cxx/Date.h" #include "faker-cxx/Internet.h" #include "faker-cxx/Location.h" #include "faker-cxx/String.h" @@ -21,4 +20,4 @@ int main() std::cout << streetAddress << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +}