Skip to content

Commit

Permalink
improve quality of book module
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal committed Jun 16, 2024
1 parent 3dd30fb commit fa298b2
Show file tree
Hide file tree
Showing 6 changed files with 532 additions and 562 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ All notable changes to this project will be documented in this file

### ⚠ BREAKING CHANGES

* removed `Structure` module
* removed `structure` module
* removed `book.translator` method, use `person.fullName` instead
* removed `book.isbn` method, use `commerce.isbn` instead
* changed std::string to std::string_view in where possible

### Features
Expand Down
22 changes: 0 additions & 22 deletions include/faker-cxx/Book.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,6 @@ class Book
*/
static std::string_view publisher();

/**
* @brief Returns a random book ISBN.
*
* @returns Book ISBN.
*
* @code
* Book::isbn() // "978-83-01-00000-1"
* @endcode
*/
static std::string isbn();

/**
* @brief Returns the full name of a translator
*
* @returns std::string_view full name
*
* @code
* Book::translator() // "Eric Floyd"
* @endcode
*/
static std::string_view translator();

/**
* @brief Returns format of book
*
Expand Down
14 changes: 0 additions & 14 deletions src/modules/book/Book.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#include "faker-cxx/Book.h"

#include <string>
#include <string_view>

#include "../../common/FormatHelper.h"
#include "BookData.h"
#include "faker-cxx/Helper.h"
#include "faker-cxx/String.h"

namespace faker
{
Expand All @@ -30,17 +27,6 @@ std::string_view Book::publisher()
return Helper::arrayElement(publishers);
}

std::string Book::isbn()
{
return FormatHelper::format("{}-{}-{}-{}-{}", String::numeric(3, false), String::numeric(2), String::numeric(2),
String::numeric(5), String::numeric(1));
}

std::string_view Book::translator()
{
return Helper::arrayElement(translators);
}

std::string_view Book::format()
{
return Helper::arrayElement(bookFormats);
Expand Down
Loading

0 comments on commit fa298b2

Please sign in to comment.