forked from qt-creator/qt-creator
ClangFormat: Move the functions from clangformatutils
- Moved the functions from clangformatutils to the places where it is belong Change-Id: Ia4108c5b096610170e0f9d16d15d40d5538ffbdc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -118,6 +118,18 @@ void ClangFormatFile::saveNewFormat(QByteArray style)
|
||||
m_filePath.writeFileContents(style);
|
||||
}
|
||||
|
||||
void ClangFormatFile::saveStyleToFile(clang::format::FormatStyle style, Utils::FilePath filePath)
|
||||
{
|
||||
std::string styleStr = clang::format::configurationAsText(style);
|
||||
|
||||
// workaround: configurationAsText() add comment "# " before BasedOnStyle line
|
||||
const int pos = styleStr.find("# BasedOnStyle");
|
||||
if (pos != int(std::string::npos))
|
||||
styleStr.erase(pos, 2);
|
||||
styleStr.append("\n");
|
||||
filePath.writeFileContents(QByteArray::fromStdString(styleStr));
|
||||
}
|
||||
|
||||
CppEditor::CppCodeStyleSettings ClangFormatFile::toCppCodeStyleSettings(
|
||||
ProjectExplorer::Project *project) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user