Open Babel  3.0
Public Member Functions | Protected Attributes | List of all members
OBLocale Class Reference

#include <openbabel/locale.h>

Public Member Functions

 OBLocale ()
 
 ~OBLocale ()
 
void SetLocale ()
 
void RestoreLocale ()
 

Protected Attributes

OBLocalePrivate * d
 

Detailed Description

Handle the locale for numeric data parsing.

Many users will utilize Open Babel and tools built on top of the library in non-English locales. In particular, the numeric locale (LC_NUMERIC) is used to determine the parsing of numeric data in files, reference data, etc.

The OBLocale class, and its global variable obLocale handle both internal parsing of data through the ANSI-C numeric locale and can be used for external use as well.

In particular, where available, OBLocale will use the enhanced uselocale() interface, which sets the locale for a particular thread, rather for the entire process. (This is available on Linux, Mac OS X, and other platforms.)

obLocale.SetLocale(); // set the numeric locale before reading data
... // your data processing here
obLocale.RestoreLocale(); // restore the numeric locale

To prevent errors, OBLocale will handle reference counting. If nested function calls all set the locale, only the first call to SetLocale() and the last call to RestoreLocale() will do any work.

Constructor & Destructor Documentation

◆ OBLocale()

OBLocale ( )

◆ ~OBLocale()

~OBLocale ( )

Member Function Documentation

◆ SetLocale()

void SetLocale ( )

◆ RestoreLocale()

void RestoreLocale ( )

Member Data Documentation

◆ d

OBLocalePrivate* d
protected

The documentation for this class was generated from the following files: