File indexing completed on 2024-04-14 03:55:05
0001 /* 0002 SPDX-FileCopyrightText: 2017 Grzegorz Szymaszek <gszymaszek@short.pl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef _EDITORCONFIG_H_ 0008 #define _EDITORCONFIG_H_ 0009 0010 #include <QLatin1String> 0011 0012 #include <editorconfig/editorconfig.h> 0013 #include <editorconfig/editorconfig_handle.h> 0014 0015 class KateDocumentConfig; 0016 0017 namespace KTextEditor 0018 { 0019 class DocumentPrivate; 0020 } 0021 0022 class EditorConfig 0023 { 0024 public: 0025 explicit EditorConfig(KTextEditor::DocumentPrivate *document); 0026 ~EditorConfig(); 0027 EditorConfig(const EditorConfig &) = delete; 0028 EditorConfig &operator=(const EditorConfig &) = delete; 0029 /** 0030 * Runs EditorConfig parser and sets proper parent DocumentPrivate 0031 * configuration. Implemented options: charset, end_of_line, indent_size, 0032 * indent_style, insert_final_newline, max_line_length, tab_width, 0033 * trim_trailing_whitespace. 0034 * 0035 * @see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties 0036 * 0037 * @return 0 if EditorConfig library reported successful file parsing, 0038 * positive integer if a parsing error occurred (the return value would be 0039 * the line number of parsing error), negative integer if another error 0040 * occurred. In other words, returns value returned by editorconfig_parse. 0041 */ 0042 int parse(); 0043 0044 private: 0045 KTextEditor::DocumentPrivate *m_document; 0046 editorconfig_handle m_handle; 0047 }; 0048 0049 #endif