| 256 | } |
| 257 | |
| 258 | QString AStylePlugin::formatSourceWithStyle(const SourceFormatterStyle& style, |
| 259 | const QString& text, |
| 260 | const QUrl& /*url*/, |
| 261 | const QMimeType& mime, |
| 262 | const QString& leftContext, |
| 263 | const QString& rightContext) const |
| 264 | { |
| 265 | if(mime.inherits(QStringLiteral("text/x-java"))) |
| 266 | m_formatter->setJavaStyle(); |
| 267 | else if(mime.inherits(QStringLiteral("text/x-csharp"))) |
| 268 | m_formatter->setSharpStyle(); |
| 269 | else |
| 270 | m_formatter->setCStyle(); |
| 271 | |
| 272 | if (style.content().isEmpty()) { |
| 273 | m_formatter->predefinedStyle(style.name()); |
| 274 | } else { |
| 275 | m_formatter->loadStyle(style.content()); |
| 276 | } |
| 277 | |
| 278 | return m_formatter->formatSource(text, leftContext, rightContext); |
| 279 | } |
| 280 | |
| 281 | static SourceFormatterStyle createPredefinedStyle(const QString& name, const QString& caption = QString()) |
| 282 | { |
no test coverage detected