MCPcopy Create free account
hub / github.com/KDE/kdiff3 / FileData

Class FileData

src/SourceData.h:86–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84 bool mFromClipBoard = false;
85
86 class FileData
87 {
88 private:
89 friend SourceData;
90 bool mHasBOM = false;
91
92 std::unique_ptr<char[]> m_pBuf; //TODO: Phase out needlessly wastes memory and time by keeping second copy of file data.
93 quint64 mDataSize = 0;
94 qint64 mLineCount = 0; // Number of lines in m_pBuf1 and size of m_v1, m_dv12 and m_dv13
95 QSharedPointer<QString> m_unicodeBuf=QSharedPointer<QString>::create();
96 std::shared_ptr<LineDataVector> m_v=std::make_shared<LineDataVector>();
97 bool m_bIsText = false;
98 bool m_bIncompleteConversion = false;
99 e_LineEndStyle m_eLineEndStyle = eLineEndStyleUndefined;
100 bool mHasEOLTermination = false;
101
102 public:
103 bool readFile(FileAccess& file);
104 bool readFile(const QString& filename);
105 bool writeFile(const QString& filename);
106
107 bool preprocess(const QByteArray& encoding, bool removeComments);
108 void reset();
109 void copyBufFrom(const FileData& src);
110
111 [[nodiscard]] bool isEmpty() const { return mDataSize == 0; }
112
113 [[nodiscard]] bool isText() const { return m_bIsText || isEmpty(); }
114 [[nodiscard]] inline bool hasEOLTermiantion() const { return m_bIsText && mHasEOLTermination; }
115 [[nodiscard]] inline bool hasBOM() const { return mHasBOM; }
116
117 [[nodiscard]] inline qint64 lineCount() const { return mLineCount; }
118 [[nodiscard]] inline qint64 byteCount() const { return mDataSize; }
119 };
120 FileData m_normalData;
121 FileData m_lmppData;
122 QByteArray mEncoding;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected