edbee - Qt Editor Library
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
edbee::LineEnding Class Reference

A special class to perform line-ending detection. More...

#include <lineending.h>

+ Collaboration diagram for edbee::LineEnding:

Public Types

enum  Type { UnixType = 0, WindowsType = 1, MacClassicType = 2, TypeCount }
 

Public Member Functions

virtual LineEnding::Type type () const
 This method returns the type. More...
 
virtual const char * chars () const
 This method returns the chars. More...
 
virtual const char * escapedChars () const
 This method returns the escaped chars. More...
 
virtual const char * name () const
 This method returns the name of the line ending. More...
 

Static Public Member Functions

static LineEndingtypes ()
 This method returns the line endings. More...
 
static int typeCount ()
 
static LineEndingget (int idx)
 This methode returns the line ending from the given type. More...
 
static LineEndingunixType ()
 Returns the unix line ending type. More...
 
static LineEndingwindowsType ()
 
static LineEndingmacClassicType ()
 Returns the Mac class line ending type. More...
 
static LineEndingdetect (const QString &str, LineEnding *unkownEnding=0)
 This method detects the, line endings of a QString. A byte array is tricky because the encoding could be multi-byte. More...
 

Protected Member Functions

 LineEnding (LineEnding::Type ending, const char *chars, const char *escaped_chars, const char *name)
 Constructs a line ending type. More...
 
virtual ~LineEnding ()
 

Detailed Description

A special class to perform line-ending detection.

Member Enumeration Documentation

◆ Type

Enumerator
UnixType 
WindowsType 
MacClassicType 
TypeCount 

Constructor & Destructor Documentation

◆ LineEnding()

edbee::LineEnding::LineEnding ( LineEnding::Type  type,
const char *  chars,
const char *  escaped,
const char *  name 
)
explicitprotected

Constructs a line ending type.

Parameters
typethe type enum constant
charsthe chars used for the line ending
escapedan escaped variant of the characters
namethe name of the line ending

◆ ~LineEnding()

edbee::LineEnding::~LineEnding ( )
protectedvirtual

Member Function Documentation

◆ chars()

virtual const char* edbee::LineEnding::chars ( ) const
inlinevirtual

This method returns the chars.

◆ detect()

LineEnding * edbee::LineEnding::detect ( const QString &  str,
LineEnding unkown = 0 
)
static

This method detects the, line endings of a QString. A byte array is tricky because the encoding could be multi-byte.

Parameters
strthe string to find the line-endings.
unknownthe type to return when the ending is not nown. (defaults to 0)
Returns
the found type or the unkown parameter if not found

◆ escapedChars()

virtual const char* edbee::LineEnding::escapedChars ( ) const
inlinevirtual

This method returns the escaped chars.

◆ get()

LineEnding * edbee::LineEnding::get ( int  idx)
static

This methode returns the line ending from the given type.

◆ macClassicType()

LineEnding * edbee::LineEnding::macClassicType ( )
static

Returns the Mac class line ending type.

◆ name()

virtual const char* edbee::LineEnding::name ( ) const
inlinevirtual

This method returns the name of the line ending.

◆ type()

virtual LineEnding::Type edbee::LineEnding::type ( ) const
inlinevirtual

This method returns the type.

◆ typeCount()

static int edbee::LineEnding::typeCount ( )
inlinestatic

◆ types()

LineEnding * edbee::LineEnding::types ( )
static

This method returns the line endings.

Parameters
typethe type to retrieve

◆ unixType()

LineEnding * edbee::LineEnding::unixType ( )
static

Returns the unix line ending type.

◆ windowsType()

LineEnding * edbee::LineEnding::windowsType ( )
static

The documentation for this class was generated from the following files: