Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Unicode and Error Handling and Other Stuff

Sign in to follow this  


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:


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!

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!