Skip to content

Commit

Permalink
refactor: change company class to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal committed Jun 20, 2024
1 parent 72eeede commit c38ff63
Show file tree
Hide file tree
Showing 5 changed files with 740 additions and 723 deletions.
226 changes: 111 additions & 115 deletions include/faker-cxx/Company.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,130 +2,126 @@

#include <string_view>

namespace faker
namespace faker::company
{
class Company
{
public:
/**
* @brief Returns a random company name.
*
* @returns Company name.
*
* @code
* Company::name() // "Adams Inc"
* @endcode
*/
static std::string name();
/**
* @brief Returns a random company name.
*
* @returns Company name.
*
* @code
* company::name() // "Adams Inc"
* @endcode
*/
std::string name();

/**
* @brief Returns a random company type.
*
* @returns Company type.
*
* @code
* Company::type() // "Nonprofit"
* @endcode
*/
static std::string_view type();
/**
* @brief Returns a random company type.
*
* @returns Company type.
*
* @code
* company::type() // "Nonprofit"
* @endcode
*/
std::string_view type();

/**
* @brief Returns a random company industry.
*
* @returns Company industry.
*
* @code
* Company::industry() // "Biotechnology"
* @endcode
*/
static std::string_view industry();
/**
* @brief Returns a random company industry.
*
* @returns Company industry.
*
* @code
* company::industry() // "Biotechnology"
* @endcode
*/
std::string_view industry();

/**
* @brief Returns a random buzz phrase.
*
* @returns Buzz phrase.
*
* @code
* Company::buzzPhrase() // "cultivate synergistic e-market"
* @endcode
*/
static std::string buzzPhrase();
/**
* @brief Returns a random buzz phrase.
*
* @returns Buzz phrase.
*
* @code
* company::buzzPhrase() // "cultivate synergistic e-market"
* @endcode
*/
std::string buzzPhrase();

/**
* @brief Returns a random buzz adjective.
*
* @returns Buzz adjective.
*
* @code
* Company::buzzAdjective() // "one-to-one"
* @endcode
*/
static std::string_view buzzAdjective();
/**
* @brief Returns a random buzz adjective.
*
* @returns Buzz adjective.
*
* @code
* company::buzzAdjective() // "one-to-one"
* @endcode
*/
std::string_view buzzAdjective();

/**
* @brief Returns a random buzz noun.
*
* @returns Buzz noun.
*
* @code
* Company::buzzNoun() // "paradigms"
* @endcode
*/
static std::string_view buzzNoun();
/**
* @brief Returns a random buzz noun.
*
* @returns Buzz noun.
*
* @code
* company::buzzNoun() // "paradigms"
* @endcode
*/
std::string_view buzzNoun();

/**
* @brief Returns a random buzz verb.
*
* @returns Buzz verb.
*
* @code
* Company::buzzVerb() // "empower"
* @endcode
*/
static std::string_view buzzVerb();
/**
* @brief Returns a random buzz verb.
*
* @returns Buzz verb.
*
* @code
* company::buzzVerb() // "empower"
* @endcode
*/
std::string_view buzzVerb();

/**
* @brief Returns a random catch phrase.
*
* @returns Catch phrase.
*
* @code
* Company::catchPhrase() // "Upgradable systematic flexibility"
* @endcode
*/
static std::string catchPhrase();
/**
* @brief Returns a random catch phrase.
*
* @returns Catch phrase.
*
* @code
* company::catchPhrase() // "Upgradable systematic flexibility"
* @endcode
*/
std::string catchPhrase();

/**
* @brief Returns a random catch phrase adjective.
*
* @returns Catch phrase adjective.
*
* @code
* Company::catchPhraseAdjective() // "Multi-tiered"
* @endcode
*/
static std::string_view catchPhraseAdjective();
/**
* @brief Returns a random catch phrase adjective.
*
* @returns Catch phrase adjective.
*
* @code
* company::catchPhraseAdjective() // "Multi-tiered"
* @endcode
*/
std::string_view catchPhraseAdjective();

/**
* @brief Returns a random catch phrase descriptor.
*
* @returns Catch phrase descriptor.
*
* @code
* Company::catchPhraseDescriptor() // "composite"
* @endcode
*/
static std::string_view catchPhraseDescriptor();
/**
* @brief Returns a random catch phrase descriptor.
*
* @returns Catch phrase descriptor.
*
* @code
* company::catchPhraseDescriptor() // "composite"
* @endcode
*/
std::string_view catchPhraseDescriptor();

/**
* @brief Returns a random catch phrase noun.
*
* @returns Catch phrase noun.
*
* @code
* Company::catchPhraseNoun() // "leverage"
* @endcode
*/
static std::string_view catchPhraseNoun();
};
/**
* @brief Returns a random catch phrase noun.
*
* @returns Catch phrase noun.
*
* @code
* company::catchPhraseNoun() // "leverage"
* @endcode
*/
std::string_view catchPhraseNoun();
}
24 changes: 12 additions & 12 deletions src/modules/company/Company.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include "faker-cxx/Number.h"
#include "faker-cxx/Person.h"

namespace faker
namespace faker::company
{
std::string Company::name()
std::string name()
{
std::string companyName;

Expand All @@ -36,52 +36,52 @@ std::string Company::name()
return companyName;
}

std::string_view Company::type()
std::string_view type()
{
return Helper::arrayElement(companyTypes);
}

std::string_view Company::industry()
std::string_view industry()
{
return Helper::arrayElement(companyIndustries);
}

std::string Company::buzzPhrase()
std::string buzzPhrase()
{
return FormatHelper::format("{} {} {}", buzzVerb(), buzzAdjective(), buzzNoun());
}

std::string_view Company::buzzAdjective()
std::string_view buzzAdjective()
{
return Helper::arrayElement(buzzAdjectives);
}

std::string_view Company::buzzNoun()
std::string_view buzzNoun()
{
return Helper::arrayElement(buzzNouns);
}

std::string_view Company::buzzVerb()
std::string_view buzzVerb()
{
return Helper::arrayElement(buzzVerbs);
}

std::string Company::catchPhrase()
std::string catchPhrase()
{
return FormatHelper::format("{} {} {}", catchPhraseAdjective(), catchPhraseDescriptor(), catchPhraseNoun());
}

std::string_view Company::catchPhraseAdjective()
std::string_view catchPhraseAdjective()
{
return Helper::arrayElement(catchPhraseAdjectives);
}

std::string_view Company::catchPhraseDescriptor()
std::string_view catchPhraseDescriptor()
{
return Helper::arrayElement(catchPhraseDescriptors);
}

std::string_view Company::catchPhraseNoun()
std::string_view catchPhraseNoun()
{
return Helper::arrayElement(catchPhraseNouns);
}
Expand Down
Loading

0 comments on commit c38ff63

Please sign in to comment.