Jump to navigation Jump to search

Declarations for Line.cpp

#ifndef LINE_H
#define LINE_H

#include "WDLX_config.h"
#include "DiffEngine.h"
#include <string>

class Line {

      typedef std::basic_string<char, std::char_traits<char>, WDLX_ALLOCATOR<char> > String;
      typedef String::const_iterator Iterator;

      Line(Iterator bs, Iterator be, Iterator se, Iterator te);
      Line(Iterator bs, Iterator be, Iterator se);
      Line(Iterator bs, Iterator be, Iterator se, Iterator te, size_t n);
      Line(Iterator bs, Iterator be, Iterator se, size_t n);
      bool operator==(const Line &o) const;
      bool operator!=(const Line &o) const;
      bool operator<(const Line &o) const;
      operator String() const;
      bool is_Change() const;
      bool is_Copy() const;
      bool is_HardBreak() const;
      bool equals_body() const;
      bool equals_suffix(const Line * o) const;
      bool equals_trailing(const Line * o, size_t i) const;
      String get_body() const;
      Iterator get_bodyBegin() const;
      Iterator get_bodyEnd() const;
      Line * get_counterPart() const;
      int get_diffCode() const;
      size_t get_lineNumber() const;
      size_t get_suffixLength() const;
      size_t get_trailingCount() const;
      size_t get_trailingLength(const size_t i) const;
      void set_diff(int op);
      void set_diff(int op, Line * p);
      void set_diffCopyChange();
      void whitespaceOnly();

      Iterator bodyStart;
      Iterator bodyEnd;
      Iterator suffixEnd;
      Iterator trailingEnd;
      size_t number;
      bool lineHard;
      bool lineBlack;
      // enum(none suffix trailing both) diff
      int op;
      Line * match;
      Iterator point2break(const Iterator point) const;
      Iterator point2break(const size_t i) const;
      size_t count4invisible(Iterator *p, const Iterator pEnd) const;
};   // class Line