From cf2f707a2939da5f27f10789854fd44bda7251ad Mon Sep 17 00:00:00 2001 From: BLTA Date: Tue, 3 Dec 2024 10:43:58 -0800 Subject: [PATCH] -- Used clang-format as per contribution guidelines. --- include/faker-cxx/company.h | 22 +++++++++++----------- src/modules/company.cpp | 30 +++++++++++++++++------------- src/modules/company_data.h | 27 ++++++++++++++------------- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/include/faker-cxx/company.h b/include/faker-cxx/company.h index dd4c0704..57058ade 100644 --- a/include/faker-cxx/company.h +++ b/include/faker-cxx/company.h @@ -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 @@ -37,7 +37,7 @@ FAKER_CXX_EXPORT std::string companyName(std::optional format * @brief Returns a random company type. * * @param locale The locale. Defaults to `Locale::en_US`. - * + * * @returns Company type. * * @code @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/modules/company.cpp b/src/modules/company.cpp index 037791a1..98bcfef0 100644 --- a/src/modules/company.cpp +++ b/src/modules/company.cpp @@ -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 format, Locale locale) { const auto& companyDefintion = getCompanyDefinition(locale); @@ -30,11 +32,12 @@ std::string companyName(std::optional 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(), @@ -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) diff --git a/src/modules/company_data.h b/src/modules/company_data.h index 677aa041..81c147ff 100644 --- a/src/modules/company_data.h +++ b/src/modules/company_data.h @@ -1,24 +1,25 @@ #pragma once -#include #include +#include #include namespace faker::company { - struct CompanyDefinition - { - std::span buzzAdjectives; - std::span buzzNouns; - std::span buzzVerbs; - std::span catchPhraseAdjectives; - std::span catchPhraseDescriptors; - std::span catchPhraseNouns; - std::span companyTypes; - std::span companyIndustries; - std::span companySuffixes; - }; +struct CompanyDefinition +{ + std::span buzzAdjectives; + std::span buzzNouns; + std::span buzzVerbs; + std::span catchPhraseAdjectives; + std::span catchPhraseDescriptors; + std::span catchPhraseNouns; + std::span companyTypes; + std::span companyIndustries; + std::span companySuffixes; +}; + const auto enUSbuzzAdjectives = std::to_array({ "24/365", "24/7",