diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-06 01:21:08 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-06 01:21:08 +0200 |
commit | cf8707bf2ede99d8543d806355eee088bdc1376b (patch) | |
tree | 0f1ffc52906d9f66f75631bd97dfb0dcf91989ad /README | |
parent | c0024748e8ff2f46e5d37a054fa349f24ddc497f (diff) | |
download | EpisodeBrowser-cf8707bf2ede99d8543d806355eee088bdc1376b.tar.gz |
Use typedefs when interacting with Win32 API.
It's not like they're ever going to change the definition of
WORD (knock on wood) -- but I guess it's proper to use them as if
their definitions might change.
Diffstat (limited to 'README')
-rw-r--r-- | README | 55 |
1 files changed, 16 insertions, 39 deletions
@@ -30,17 +30,24 @@ Frontend ~~~~~~~~ The graphical interface is implemented in C++ using the Win32 API (see the c folder). The source code is spread across a small number of -files. For an overview of the classes/functions provided by each file, -see defs.h. In summary: +files. In summary: main.cpp Entry point and initialization. Contains the main event handler. -listview.cpp Creates and handles the shared aspects of the two list views. -episodelistview.cpp Defines the interface to the episode list view. -datalistview.cpp Defines the interface to the data list view. -pl.cpp Interface to Prolog backend. -common.cpp Some useful functions that don't fit elsewhere. - -In addition, defs.h itself defines a variety of macros and templates. +listview.* Creates and handles the shared aspects of the two list views. +episodelistview.* Defines the interface to the episode list view. +datalistview.* Defines the interface to the data list view. +layout.* Handles the placement of child windows. +pl.* Interface to Prolog backend. +win.* Helpers for interacting with the Win32 API. +wcharptr.* Defines WcharPtr, a class that owns a wchar_t*. +util.h Simple utility functions. +debug.* Helpers for debugging. + +The code operates under the assumption that "raw" pointers are +non-owning -- i.e., their lifetime is managed by somebody else, such +as Windows or Prolog. When strings need to be heap-allocated, like +when converting from a narrow to a wide string, they are put within a +WcharPtr object, which manages the lifetime of the string. Building ~~~~~~~~ @@ -53,33 +60,3 @@ following additional programs are required: To build b/EpisodeBrowser.exe, issue `make' in the root directory of the project. - -Hacking -~~~~~~~ -Following is a summary of some coding conventions used in the project. - - ... TYPES ... - -Here are some general guidelines for choosing what types to use: - -1) Don't use Windows-specific types that "hide" pointers. -2) Where there is a Windows-specific type with the same name and - function as a standard type (e.g., CHAR = char), prefer the - standard type. -3) Otherwise, prefer the Windows-specific type when interacting with - the Windows API. - -For example, prefer... - - - char* over LPSTR - - char const* over LPCSTR - - LVITEM* over LPLVITEM - - int over INT - - DWORD over unsigned long - (but only when interacting with Windows) - -Note... - - - that the second rule above does not apply to BOOL, which should not - be replaced with bool, as BOOL is an integer that may have other - values than 1 and 0. |