94 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 95 #error "Only <final/final.h> can be included directly." 98 #include "final/fconfig.h" 100 #include <sys/ioctl.h> 101 #include <sys/stat.h> 104 #include <langinfo.h> 106 #if defined(F_HAVE_GETTTYNAM) && defined(F_HAVE_TTYENT_H) 114 #include <functional> 120 #include "final/fc.h" 121 #include "final/output/fcolorpalette.h" 122 #include "final/output/tty/ftermdata.h" 123 #include "final/output/tty/fterm_functions.h" 124 #include "final/util/fstring.h" 125 #include "final/util/fsystem.h" 147 using FSetPalette = FColorPalette::FSetPalette;
162 auto operator = (
const FTerm&) ->
FTerm& =
delete;
165 auto operator = (
FTerm&&) noexcept ->
FTerm& =
delete;
168 static auto getClassName() ->
FString;
169 static auto getLineNumber() -> std::size_t;
170 static auto getColumnNumber() -> std::size_t;
171 static auto getKeyName (FKey) ->
FString;
173 static auto getTTYFileDescriptor() -> int;
174 static auto getTermType() -> std::string;
175 static auto getTermFileName() -> std::string;
176 static auto getTabstop() -> int;
177 static auto getMaxColor() -> int;
180 static auto isRaw() -> bool;
181 static auto hasUTF8() -> bool;
182 static auto isMonochron() -> bool;
183 static auto isNewFont() -> bool;
184 static auto isInitialized() -> bool;
185 static auto isCursorHideable() -> bool;
186 static auto isEncodable (
const wchar_t&) -> bool;
187 static auto hasChangedTermSize() -> bool;
188 static auto hasShadowCharacter() -> bool;
189 static auto hasHalfBlockCharacter() -> bool;
190 static auto hasAlternateScreen() -> bool;
191 static auto canChangeColorPalette() -> bool;
194 static void setFSystem (std::unique_ptr<FSystem>&);
195 static void setTermType (
const std::string&);
196 static void setInsertCursor (
bool =
true);
197 static void unsetInsertCursor();
198 static void redefineDefaultColors (
bool =
true);
199 static void setDblclickInterval (
const uInt64);
200 static void useAlternateScreen (
bool =
true);
201 static void setUTF8 (
bool =
true);
202 static void unsetUTF8();
205 static auto setVGAFont() -> bool;
206 static auto setNewFont() -> bool;
207 static auto resetFont() -> bool;
208 static auto openConsole() -> int;
209 static auto closeConsole() -> int;
210 static auto moveCursorString (
int,
int,
int,
int) -> std::string;
211 static auto cursorsVisibilityString (
bool =
true) -> std::string;
212 static void detectTermSize();
213 static void setTermSize (
const FSize&);
214 static void setTermTitle (
const FString&);
215 static void setKDECursor (KdeKonsoleCursorShape);
216 static void saveColorMap();
217 static void resetColorMap();
218 static void clearTerminalAttributes();
219 static void setPalette (FColor,
int,
int,
int);
220 static void setBeep (
int,
int);
221 static void resetBeep();
224 static void setEncoding (Encoding);
225 static auto getEncodingString() -> std::string;
226 static auto charEncode (
const wchar_t&) -> wchar_t;
227 static auto charEncode (
const wchar_t&,
const Encoding&) -> wchar_t;
229 static auto scrollTermForward() -> bool;
230 static auto scrollTermReverse() -> bool;
232 template <
typename... Args>
233 static void paddingPrintf (Args&&...);
234 static void paddingPrint (
const std::string&,
int = 1);
235 static void stringPrint (
const std::string&);
238 static void initScreenSettings();
239 static void changeTermSizeFinished();
244 static void init_global_values();
245 static void init_terminal_device_path();
246 static void oscPrefix();
247 static void oscPostfix();
248 static void init_alt_charset();
249 static void init_pc_charset();
250 static void init_cygwin_charmap();
251 static void updatePCEncodingForCygwin();
252 static void updateCharMappingForCygwin();
253 static void init_teraterm_charmap();
254 static void init_fixed_max_color();
255 static void init_termcap();
256 static void init_quirks();
257 static void init_optiMove();
258 static void init_optiAttr();
259 static auto init_font() -> bool;
260 static void init_locale();
261 static auto init_xterm_locale (
const char*) ->
const char*;
262 static auto init_tera_term_locale (
const char*) ->
const char*;
263 static auto init_kterm_locale (
const char*) ->
const char*;
264 static auto init_sun_locale (
const char*) ->
const char*;
265 static auto init_locale_if_not_found (
const char*) ->
const char*;
266 static void init_encoding();
267 static void init_encoding_set();
268 static void init_term_encoding();
269 static void init_individual_term_encoding();
270 static void init_force_vt100_encoding();
271 static void init_utf8_without_alt_charset();
272 static void init_tab_quirks();
273 static void init_captureFontAndTitle();
274 static auto hasNoFontSettingOption() -> bool;
275 static auto canSetTerminalFont() -> bool;
276 static void setInsertCursorStyle();
277 static void setOverwriteCursorStyle();
278 static auto enableCursorString() -> std::string;
279 static auto disableCursorString() -> std::string;
280 static void enableMouse();
281 static void disableMouse();
282 static void enableApplicationEscKey();
283 static void disableApplicationEscKey();
284 static void enableKeypad();
285 static void disableKeypad();
286 static void enableAlternateCharset();
287 static void useAlternateScreenBuffer();
288 static void useNormalScreenBuffer();
290 auto init_terminal()
const -> bool;
291 void initOSspecifics()
const;
292 void initTermspecifics()
const;
293 void initBaudRate()
const;
295 void finishOSspecifics()
const;
296 void finish_encoding()
const;
297 static void printExitMessage();
298 static void terminalSizeChange();
299 [[noreturn]]
static void processTermination (
int);
300 static void setSignalHandler();
301 static void resetSignalHandler();
302 static void signal_handler (
int);
308 inline auto FTerm::getClassName() ->
FString 312 inline void FTerm::setFSystem (std::unique_ptr<FSystem>& fsystem)
314 FSystem::getInstance().swap(fsystem);
318 inline void FTerm::unsetInsertCursor()
319 { setInsertCursor(
false); }
322 inline void FTerm::unsetUTF8()
326 template <
typename... Args>
327 inline void FTerm::paddingPrintf (Args&&... args)
329 const int size = std::snprintf (
nullptr, 0, args...);
334 std::string buffer{};
335 auto buffer_size = std::size_t(size) + 1;
336 buffer.resize(buffer_size);
337 std::snprintf ( &*buffer.begin(), buffer_size
338 , std::forward<Args>(args)... );
340 buffer.resize(buffer_size);
341 paddingPrint (buffer, 1);
345 inline void FTerm::initTerminal()
351 inline auto operator << (std::ostream& os, finalcut::UniChar c) -> std::ostream&
353 static const auto& data = finalcut::FTermData::getInstance();
355 if ( data.getTerminalEncoding() == finalcut::Encoding::UTF8 )
356 return os << finalcut::unicode_to_utf8(
wchar_t(c));
358 return os << static_cast<char>(uChar(c));
362 inline auto operator << (std::wostream& os, finalcut::UniChar c) -> std::wostream&
364 return os << static_cast<wchar_t>(c);
Definition: ftermdata.h:58
Definition: class_template.cpp:25
Definition: fstartoptions.h:52