Main Page   Namespaces   Classes ( Hierarchy )   Functions & Members  

moFileReaderSDK

Compilation with Visual C++ (Express and better)

We provide a project for Visual C++ 2008. You can select 3 Types of Compilation:

Executable (Release or Debug)

This will compile the code as an executable which can lookup strings from every .mo-File you load with it. This can be handy if you want to have a peek into a file or test something etc. I recommend building the release-executable only if you just want to use it.

Dynamic Loaded Library ( ReleaseDLL )

This may be overkill, but perhaps you like it modular. This Configuration will create a dll and an import-library. Do not forget to link against the import-library and please define MOFILE_IMPORT in your preprocessor-settings, otherwise you will receive a bunch of linker-errors. You will find all files in the directory "lib" in the Solutions Directory.

Static Library ( ReleaseLIB )

This will compile the code as a static library with no Entry-Point. This is the recommended usage. But please do not forget to link against moFileReader.static.lib. Otherwise you will receive linker-errors.

Compilation via cmake

cmake will compile the library and moReader[.exe]-binary, which can do lookups in moFiles and export moFiles as HTML. See moReader[.exe] --help for details. You will find the libraries in %projectdir%/lib and the binary in %projectdir%/bin

Compilation via provided batch-files (woe32 only)

None of those?

The last option is to simply add moFileReader.cpp, moFileReader.h and moFileConfig.h to your project. Thats all you have to do. You can safely exclude mo.cpp, since this file keeps the entry-points of the .exe and .dll only.

Usage

This is moFileReader, a simple gettext-replacement. The usage of this library is, hopefully, fairly simple:

 // Instanciate the class
 moFileLib::moFileReader reader;

 // Load a .mo-File.
 if ( reader.ReadFile("myTranslationFile.mo") != moFileLib::moFileReader::EC_SUCCESS )
 {
    // Error Handling
 }

 // Now, you can lookup the strings you stored in the .mo-File:
 std::cout << reader.Lookup("MyTranslationString") << std::endl;  
Thats all! This small code has no dependencies, except the C/C++-runtime of your compiler, so it should work on all machines where a C++-runtime is provided.

Note:
We do not yet support .mo-Files with reversed magic-numbers, since I don't have a file to test it and I hate to release stuff I wasn't able to test. If you can provide such a file with reversed bytes, please compile %projectdir%/bin/i18n/de/moTest.po with gettext or poEdit and send it to scorcher24 [at] gmail [dot] com.

Changelog

Credits

Gettext is part of the GNU-Tools and (C) by the Free Software Foundation.
Visual C++ Express is a registered Trademark of Microsoft, One Microsoft Way, Redmond, USA.
moFileReader is using NSIS for creating the setup-package.
All other Trademarks are property of their respective owners.

Thanks for using this piece of OpenSource-Software.
If you (dis)like it or have suggestions, questions, patches etc, please don't hesitate to write to my email-adress: scorcher24 [at] gmail [dot] com. Submit patches and/or bugs on http://mofilereader.googlecode.com. You must register with googlemail to sign in. Send your flames, dumb comments etc to /dev/null, thank you.


Generated on 17 Jan 2009 for moFileReader by Doxygen1.5.7.1