replace StringBuffer usage by std::ostream and std::string