Skip to main content
留学咨询

c++代写-Curses Wrapper

By May 15, 2020No Comments

Curses WrapperTime it Took MatthewhoursWhat to SubmitA FOLDER named CursesWrapper that containsA CMakeLists.txt that can compile your programYou should start with the one that I’ve given you in the handoutLikely the only changes that you are going to need to make to it are in the add_library command if you add more files to your solutionAll of the .cpp and .h files in the CursesWrapper subfolder that I have given youAny additional .cpp and .h files that make up your solutionProblem DescriptionYou may have noticed that when you were working with curses that there is a whole suite of functions that begin with w (wmove, waddch, winch, wgetch, etc). All of these functions accept as their first argument a WINDOW* and perform the operation on that window. I bet that you can see that what the creators of curses were trying to do is implement object-oriented programming in C but unfortunately C doesn’t natively support that model. This makes curses much harder to use. So to make using curses easier you are going to create a class called WindowImplementation that wraps a subset of the curses function.WindowImplementation should publicly inherit from Window, an interface that describes what operations I want you to implement. Most of your code is simply going to forward calls to the appropriate curses functions. You can, of course, add more functionality and members if you want/need to. ALL code you create should be inside of the Curses namespace.Fake CursesIn order to be able to test both your code and mine, I had to create a fake implementation of some of the curses functions. You can find this code inside of the FakeCurses folder. The only functions you are allowed to call from curses are the ones inside FakeCurses.h. In your code, if you make sure to #include “ncurses.h” and not . The CMakeLists.txt is already set up to switch between real cuses and fake curses based on the CMake option USE_REAL_CURSES as long as #include “ncurses.h” is used (more on that below).CMake OptionsTo run the test cases you must set the following variables in Cmake-DUSE_REAL_CURSES=OFFThis option controls whether we want to use real curses or use the fake curses code that I’ve provided you. The Google tests have to use the fake curses code to work so this option must be off for them to work. If you just want to experiment on your own and see if it really does work with curses you can set it to ON but make sure not to run the Google tests if you doIn CLion the area to enter these options is under Settings->Build, Execution,Deployment-> Cmake in the CMake options field.

admin

Author admin

More posts by admin