Jump to content

User:PerfektesChaos/WikidiffLX/coding/Line.h

From mediawiki.org

Declarations for Line.cpp


#ifndef LINE_H
#define LINE_H

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

class Line {

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

#ifdef NO_LINE_NUMBERS
      Line(Iterator bs, Iterator be, Iterator se, Iterator te);
      Line(Iterator bs, Iterator be, Iterator se);
#else
      Line(Iterator bs, Iterator be, Iterator se, Iterator te, size_t n);
      Line(Iterator bs, Iterator be, Iterator se, size_t n);
#endif
      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();

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

#endif