Translate PlaceholderParser::apply_config to C++.

This gets rid of the string parameter workarounds.

It ended up a lot more code than the original because of types.