Merge pull request #2212 from unxed/ctrl_yo
[far2l.git] / far2l / src / ViewerPrinter.hpp
blob7488a7aaec92df556475c4f2bae2fde9cac99ebc
1 #pragma once
2 #include <stdint.h>
3 #include <stdlib.h>
5 struct ViewerPrinter
7 void PrintSpaces(size_t cnt);
8 void EnableBOMSkip();
9 void SetSelection(bool selection);
11 virtual ~ViewerPrinter() {};
13 virtual int Length(const wchar_t *str, int limit = -1) = 0;
14 virtual void Print(int skip_len, int print_len, const wchar_t *str) = 0;
16 protected:
18 inline bool ShouldSkip(wchar_t ch) const noexcept
20 if (_bom_skip && ch == 0xFEFF) {
21 return true;
24 return false;
28 bool _bom_skip = false;
29 bool _selection = false;
32 struct PlainViewerPrinter : ViewerPrinter
34 PlainViewerPrinter(int color);
35 virtual ~PlainViewerPrinter();
37 virtual int Length(const wchar_t *str, int limit = -1);
38 virtual void Print(int skip_len, int print_len, const wchar_t *str);
40 private:
41 int _color;