ResourceBundle.h File Reference

Go to the source code of this file.

Classes

class  ResourceBundle

Functions

template<class _GRB, class _BC, class _BC_ITER>
_GRB * makeInstance (_BC &bundleCache, const Locale &locale)


Function Documentation

template<class _GRB, class _BC, class _BC_ITER>
_GRB* makeInstance ( _BC &  bundleCache,
const Locale locale 
)

Definition at line 88 of file ResourceBundle.h.

References ResourceBundle::getMutex().

00091 {
00092     RecursiveMutexGuard mutexGuard(ResourceBundle::getMutex());
00093 
00094     _BC_ITER iter = bundleCache.find(locale);
00095     if (iter == bundleCache.end()) {
00096         _GRB *bundle = new _GRB(locale);
00097 
00098         if (locale.hasParentLocale()) {
00099             // lookup the parent bundle
00100             _GRB *parentBundle = makeInstance<_GRB, _BC, _BC_ITER>(
00101                 bundleCache,
00102                 locale.getParentLocale());
00103 
00104             bundle->setParent(parentBundle);
00105         } else if (locale != Locale("")) {
00106             // lookup the default bundle
00107             _GRB *defaultBundle = makeInstance<_GRB, _BC, _BC_ITER>(
00108                 bundleCache,
00109                 Locale(""));
00110 
00111             bundle->setParent(defaultBundle);
00112         }
00113 
00114         bundleCache[locale] = bundle;
00115         return bundle;
00116     }
00117 
00118     return (*iter).second;
00119 }


Generated on Mon Jun 22 04:00:22 2009 for Fennel by  doxygen 1.5.1