Skip to content

christophemaymard/php-code

Repository files navigation

PhpCode

Latest Release PHP Version PHP Extensions License

PhpCode provides support to mangle C++ names.

Installation

composer require cmaymard/php-code

Examples

Mangle C++ names (Itanium encoding)

use PhpCode\Language\Cpp\Mangling\ItaniumMangler;
use PhpCode\Language\Cpp\Specification\LanguageContextFactory;
use PhpCode\Language\Cpp\Specification\Standard;

$languageContextFactory = new LanguageContextFactory();
$languageContext = $languageContextFactory->create(Standard::CPP2017);
$mangler = new ItaniumMangler($languageContext);

// '_Z4mainv'
\var_dump($mangler->mangleFunction('main()'));

// '_Z4calcisjlfdi'
\var_dump($mangler->mangleFunction('calc(int, short, unsigned, long, float, double, signed)'));

// '_ZN9Framework7Logging6Logger3logEN3Log5ETypeEbcwz'
\var_dump($mangler->mangleFunction('Framework::Logging::Logger::log(Log::EType, bool, char, wchar_t, ...)'));

For more examples, read the Mangle C++ names documentation.

About

Provides support to mangle C++ names.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published