Skip to content

Commit

Permalink
-- Used clang-format as per contribution guidelines.
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtApone117 committed Dec 3, 2024
1 parent 3bc611b commit cf2f707
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 37 deletions.
22 changes: 11 additions & 11 deletions include/faker-cxx/company.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum class CompanyNameFormat
* @param format The optional format of the company name.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Company name.
*
* @code
Expand All @@ -37,7 +37,7 @@ FAKER_CXX_EXPORT std::string companyName(std::optional<CompanyNameFormat> format
* @brief Returns a random company type.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Company type.
*
* @code
Expand All @@ -50,7 +50,7 @@ FAKER_CXX_EXPORT std::string_view type(Locale locale = Locale::en_US);
* @brief Returns a random company industry.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Company industry.
*
* @code
Expand All @@ -63,7 +63,7 @@ FAKER_CXX_EXPORT std::string_view industry(Locale locale = Locale::en_US);
* @brief Returns a random buzz phrase.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Buzz phrase.
*
* @code
Expand All @@ -76,7 +76,7 @@ FAKER_CXX_EXPORT std::string buzzPhrase(Locale locale = Locale::en_US);
* @brief Returns a random buzz adjective.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Buzz adjective.
*
* @code
Expand All @@ -89,7 +89,7 @@ FAKER_CXX_EXPORT std::string_view buzzAdjective(Locale locale = Locale::en_US);
* @brief Returns a random buzz noun.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Buzz noun.
*
* @code
Expand All @@ -102,7 +102,7 @@ FAKER_CXX_EXPORT std::string_view buzzNoun(Locale locale = Locale::en_US);
* @brief Returns a random buzz verb.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Buzz verb.
*
* @code
Expand All @@ -115,7 +115,7 @@ FAKER_CXX_EXPORT std::string_view buzzVerb(Locale locale = Locale::en_US);
* @brief Returns a random catch phrase.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Catch phrase.
*
* @code
Expand All @@ -128,7 +128,7 @@ FAKER_CXX_EXPORT std::string catchPhrase(Locale locale = Locale::en_US);
* @brief Returns a random catch phrase adjective.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Catch phrase adjective.
*
* @code
Expand All @@ -141,7 +141,7 @@ FAKER_CXX_EXPORT std::string_view catchPhraseAdjective(Locale locale = Locale::e
* @brief Returns a random catch phrase descriptor.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Catch phrase descriptor.
*
* @code
Expand All @@ -154,7 +154,7 @@ FAKER_CXX_EXPORT std::string_view catchPhraseDescriptor(Locale locale = Locale::
* @brief Returns a random catch phrase noun.
*
* @param locale The locale. Defaults to `Locale::en_US`.
*
*
* @returns Catch phrase noun.
*
* @code
Expand Down
30 changes: 17 additions & 13 deletions src/modules/company.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@

namespace faker::company
{
namespace{
const struct CompanyDefinition& getCompanyDefinition(Locale locale)
{
switch(locale)
{
default:
return enUSCompanyDefinition;
}
}
namespace
{
const struct CompanyDefinition& getCompanyDefinition(Locale locale)
{
switch (locale)
{
default:
return enUSCompanyDefinition;
}
}
}

std::string companyName(std::optional<CompanyNameFormat> format, Locale locale)
{
const auto& companyDefintion = getCompanyDefinition(locale);
Expand All @@ -30,11 +32,12 @@ std::string companyName(std::optional<CompanyNameFormat> format, Locale locale)
switch (nameFormat)
{
case CompanyNameFormat::LastNameSuffix:
companyName = common::format("{} {}", person::lastName(), helper::randomElement(companyDefintion.companySuffixes));
companyName =
common::format("{} {}", person::lastName(), helper::randomElement(companyDefintion.companySuffixes));
break;
case CompanyNameFormat::FirstNameLastNameSuffix:
companyName =
common::format("{} {} {}", person::firstName(), person::lastName(), helper::randomElement(companyDefintion.companySuffixes));
companyName = common::format("{} {} {}", person::firstName(), person::lastName(),
helper::randomElement(companyDefintion.companySuffixes));
break;
case CompanyNameFormat::FirstNameLastNameJobAreaSuffix:
companyName = common::format("{} {} {} {}", person::firstName(), person::lastName(), person::jobArea(),
Expand Down Expand Up @@ -82,7 +85,8 @@ std::string_view buzzVerb(Locale locale)

std::string catchPhrase(Locale locale)
{
return common::format("{} {} {}", catchPhraseAdjective(locale), catchPhraseDescriptor(locale), catchPhraseNoun(locale));
return common::format("{} {} {}", catchPhraseAdjective(locale), catchPhraseDescriptor(locale),
catchPhraseNoun(locale));
}

std::string_view catchPhraseAdjective(Locale locale)
Expand Down
27 changes: 14 additions & 13 deletions src/modules/company_data.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#pragma once

#include <span>
#include <array>
#include <span>
#include <string_view>

namespace faker::company
{

struct CompanyDefinition
{
std::span<const std::string_view> buzzAdjectives;
std::span<const std::string_view> buzzNouns;
std::span<const std::string_view> buzzVerbs;
std::span<const std::string_view> catchPhraseAdjectives;
std::span<const std::string_view> catchPhraseDescriptors;
std::span<const std::string_view> catchPhraseNouns;
std::span<const std::string_view> companyTypes;
std::span<const std::string_view> companyIndustries;
std::span<const std::string_view> companySuffixes;
};
struct CompanyDefinition
{
std::span<const std::string_view> buzzAdjectives;
std::span<const std::string_view> buzzNouns;
std::span<const std::string_view> buzzVerbs;
std::span<const std::string_view> catchPhraseAdjectives;
std::span<const std::string_view> catchPhraseDescriptors;
std::span<const std::string_view> catchPhraseNouns;
std::span<const std::string_view> companyTypes;
std::span<const std::string_view> companyIndustries;
std::span<const std::string_view> companySuffixes;
};

const auto enUSbuzzAdjectives = std::to_array<std::string_view>({
"24/365",
"24/7",
Expand Down

0 comments on commit cf2f707

Please sign in to comment.