Jump to content

  • Log In with Google      Sign In   
  • Create Account




- - - - -

Unicode and Error Handling and Other Stuff

Posted by , 20 September 2006 · 211 views

Unicode
During my latest session of GUI programming i have been working out whether or not to cater for multi-byte as well as Unicode. Unicode is pretty much a must nowadays, especially for me during this project because i want to support multiple languages in the GUI.

The conclusion i have arrived at is both multi-byte and unicode should be supported. This is because of the multi-language support and also because the GUI is targeted at beginner programmers who may not be fully aware of what Unicode is.

Error Handling
As well as all this unicode business i have also been working on the error reporting and handling procedures. I have decided, with help and advice from others, that the best way of doing it is to always report an error via a code to a GUI-wide first_error variable. This allows easy retrieval via the accompanying function:

-GetFirstError()

Along with this i have also provided the method:

-UseExceptions( bool val )

This allows the user to specify whether they wish for exceptions to be thrown on top of the normal error logging. All exceptions thrown are of type GUIException, which is derrived from std::exception. GUIException is given the description of the error.

Other things
I have devised a system where, as a pre-build step for the library project, i run another small program. This program takes a text file that contains a listing of all the error codes along with brief description and writes a pair of C++ files, errorstring.h & .cpp. These then get compiled into the GUI library and contain an array of std::string's along with a function for accessing a string at a given index. This enables me to provide a reference to the user of all the error messages and their associated codes and at the same time keep the library code easily updated with the latest error messages that have been added. The user can also 'look up' the description associated with an error code by using the method:

-GetErrorString( Int code );

To Do
- Error logging to file or otherwise
- Geometry instancing code
- DirectX Renderer
- and lots, lot's more

Well that's all for today!

Dave






Recent Entries

Recent Comments