Kate::TextLoader

Search for usage in LXR

Kate::TextLoader Class Reference

#include <katetextloader.h>

Public Member Functions

 TextLoader (const QString &filename, KEncodingProber::ProberType proberType, int lineLengthLimit)
 
 ~TextLoader ()
 
bool byteOrderMarkFound () const
 
QByteArray digest ()
 
bool eof () const
 
TextBuffer::EndOfLineMode eol () const
 
const QStringmimeTypeForFilterDev () const
 
bool open (const QString &codec)
 
bool readLine (int &offset, int &length, bool &tooLongLinesWrapped, int &longestLineLoaded)
 
QString textCodec () const
 
const QCharunicode () const
 

Detailed Description

File Loader, will handle reading of files + detecting encoding.

Definition at line 33 of file katetextloader.h.

Constructor & Destructor Documentation

◆ TextLoader()

Kate::TextLoader::TextLoader ( const QString & filename,
KEncodingProber::ProberType proberType,
int lineLengthLimit )
inline

Construct file loader for given file.

Parameters
filenamefile to open
proberTypeprober type
lineLengthLimitlimit for lines to load, else we break them up in smaller ones

Definition at line 42 of file katetextloader.h.

◆ ~TextLoader()

Kate::TextLoader::~TextLoader ( )
inline

Destructor.

Definition at line 72 of file katetextloader.h.

Member Function Documentation

◆ byteOrderMarkFound()

bool Kate::TextLoader::byteOrderMarkFound ( ) const
inline

BOM found?

Returns
byte order mark found?

Definition at line 132 of file katetextloader.h.

◆ digest()

QByteArray Kate::TextLoader::digest ( )
inline

Definition at line 405 of file katetextloader.h.

◆ eof()

bool Kate::TextLoader::eof ( ) const
inline

end of file reached?

Returns
end of file reached

Definition at line 113 of file katetextloader.h.

◆ eol()

TextBuffer::EndOfLineMode Kate::TextLoader::eol ( ) const
inline

Detected end of line mode for this file.

Detected during reading, is valid after complete file is read.

Returns
eol mode of this file

Definition at line 123 of file katetextloader.h.

◆ mimeTypeForFilterDev()

const QString & Kate::TextLoader::mimeTypeForFilterDev ( ) const
inline

mime type used to create filter dev

Returns
mime-type of filter device

Definition at line 141 of file katetextloader.h.

◆ open()

bool Kate::TextLoader::open ( const QString & codec)
inline

open file with given codec

Parameters
codeccodec to use, if 0, will do some auto-detect or fallback
Returns
success

Definition at line 82 of file katetextloader.h.

◆ readLine()

bool Kate::TextLoader::readLine ( int & offset,
int & length,
bool & tooLongLinesWrapped,
int & longestLineLoaded )
inline

read a line, return length + offset in Unicode data

Parameters
offsetoffset into internal Unicode data for read line
lengthlength of read line
tooLongLinesWrappedwas a too long line seen?
longestLineLoadedlength of the longest line that hit the limit
Returns
true if no encoding errors occurred

did we read two time but got no stuff? encoding error fixes problem with one character latin-1 files, which lead to crash otherwise! bug 272579

keep track if we have found BOM so that failedToConvertOnce is not erroneously set to true BUG: 440359

reading loop

if no codec given, do autodetection

first: try to get HTML header encoding, includes BOM handling

else: use KEncodingProber

Definition at line 172 of file katetextloader.h.

◆ textCodec()

QString Kate::TextLoader::textCodec ( ) const
inline

Get codec for this loader.

Returns
currently in use codec of this loader

Definition at line 159 of file katetextloader.h.

◆ unicode()

const QChar * Kate::TextLoader::unicode ( ) const
inline

internal Unicode data array

Returns
internal Unicode data

Definition at line 150 of file katetextloader.h.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.