File indexing completed on 2025-01-05 05:23:53

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2003, 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_ABSTRACTCOLUMNTEXTRENDERER_HPP
0010 #define KASTEN_ABSTRACTCOLUMNTEXTRENDERER_HPP
0011 
0012 class QTextStream;
0013 class QString;
0014 
0015 namespace Kasten {
0016 
0017 /**
0018  * interface for the text export of columns
0019  * @author Friedrich W. H. Kossebau <kossebau@kde.org>
0020  */
0021 class AbstractColumnTextRenderer
0022 {
0023 private:
0024     static inline constexpr int DefaultNoOfSublines = 1;
0025 
0026 protected:
0027     static QString whiteSpace(unsigned int length);
0028 
0029 protected:
0030     AbstractColumnTextRenderer() = default;
0031 
0032 public:
0033     AbstractColumnTextRenderer(const AbstractColumnTextRenderer&) = delete;
0034     virtual ~AbstractColumnTextRenderer();
0035 
0036     AbstractColumnTextRenderer& operator=(const AbstractColumnTextRenderer&) = delete;
0037 
0038 public: // API to be implemented
0039     virtual void renderFirstLine(QTextStream* stream, int lineIndex) const = 0;
0040     virtual void renderNextLine(QTextStream* stream, bool isSubline = false) const = 0;
0041     /// default returns 1
0042     virtual int noOfSublinesNeeded() const;
0043 };
0044 
0045 }
0046 
0047 #endif