edbee - Qt Editor Library
lineending.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 namespace edbee {
9 
10 
13 {
14 public:
15 
16  enum Type {
17  UnixType = 0,
21  };
22 
23 
24 protected:
25 
26  explicit LineEnding( LineEnding::Type ending, const char* chars, const char* escaped_chars, const char* name );
27  virtual ~LineEnding();
28 
29 public:
30  static LineEnding* types();
31  static int typeCount() { return TypeCount; }
32  static LineEnding* get( int idx );
33 
34  static LineEnding* unixType();
35  static LineEnding* windowsType();
36  static LineEnding* macClassicType();
37 
38 
39  static LineEnding* detect( const QString& str, LineEnding* unkownEnding=0 );
40 
41 
43  virtual LineEnding::Type type() const { return type_; }
44 
46  virtual const char* chars() const { return charsRef_; }
47 
49  virtual const char* escapedChars() const { return escapedCharsRef_; }
50 
52  virtual const char* name() const { return nameRef_; }
53 
54 
55  // virtual LineEnding detectLineEnding
56 // virtual static QString lineEndingChars( LineEnding::Type endingType );
57 
58 private:
59 
60  LineEnding::Type type_;
61  const char* charsRef_;
62  const char* escapedCharsRef_;
63  const char* nameRef_;
64 };
65 
66 
67 
68 } // edbee
static LineEnding * types()
This method returns the line endings.
Definition: lineending.cpp:15
virtual const char * chars() const
This method returns the chars.
Definition: lineending.h:46
static LineEnding * unixType()
Returns the unix line ending type.
Definition: lineending.cpp:35
static LineEnding * macClassicType()
Returns the Mac class line ending type.
Definition: lineending.cpp:50
virtual const char * name() const
This method returns the name of the line ending.
Definition: lineending.h:52
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
static LineEnding * windowsType()
Definition: lineending.cpp:42
Type
Definition: lineending.h:16
virtual ~LineEnding()
Definition: lineending.cpp:70
Definition: lineending.h:19
static int typeCount()
Definition: lineending.h:31
Definition: lineending.h:18
virtual LineEnding::Type type() const
This method returns the type.
Definition: lineending.h:43
LineEnding(LineEnding::Type ending, const char *chars, const char *escaped_chars, const char *name)
Constructs a line ending type.
Definition: lineending.cpp:61
Definition: lineending.h:17
A special class to perform line-ending detection.
Definition: lineending.h:12
static LineEnding * detect(const QString &str, LineEnding *unkownEnding=0)
This method detects the, line endings of a QString. A byte array is tricky because the encoding could...
Definition: lineending.cpp:82
virtual const char * escapedChars() const
This method returns the escaped chars.
Definition: lineending.h:49
Definition: lineending.h:20