refactor CppGenerator.php