jupyter-xeus/cpp-terminal

Simplify platform.hpp

MCWertGaming opened this issue · 6 comments

We should simplify the platform.hpp structure. I would propose to do:

  • Mode.hpp
    • Setting the terminal into raw mode (function)
    • Reverting the Terminal into the previous state (function)
    • The Terminal state as platform universal struct
  • Additions.hpp
    • Functions that are used internally, like the UTF8 encoding / decoding

What about aving a terminal.hpp just for the class terminal... Now the terminal .h is totally free from platform miscellaneous. And we don't need the inheritance now..

I would propose to rename the folder private to platform(s)... The name pricate is misleading at least from what I expect from private code, code necessary to compile but that can be totally ignore (not installed) on the user machine. It seems not to be the case.

But it is nice to keep some folder to put the file who need platform change on it.

What do you think about it?

renaming the folder sounds nice. My idea would be to have a simple header file that just includes the terminal raw mode setting, so people could just grab that one if they only need the raw mode implementation. What do you think about that?

Why not making the terminal in raw mode by default Terminal a; I did some PR to simplify the class to be able to do that on the future

We can look into that of course, we should keep in mind though that users might not need input or raw mode for all use cases

I was thinking on a std::initializer_list as parameter for the terminal and use a enum with the option to put on the initializer_list;

terminal a({RawMode});

`

Sounds nice @flagarde, haven't looked into initializer lists yet, but I think that we should move away from typing and such anyway. I'll look into making the library a bit more dynamic on that side as well in the next days ^^