1  /* CFLocale.h
       2     
       3     Copyright (C) 2010 Free Software Foundation, Inc.
       4     
       5     Written by: Stefan Bidigaray
       6     Date: March, 2011
       7     
       8     This file is part of the GNUstep CoreBase Library.
       9     
      10     This library is free software; you can redistribute it and/or
      11     modify it under the terms of the GNU Lesser General Public
      12     License as published by the Free Software Foundation; either
      13     version 2.1 of the License, or (at your option) any later version.
      14  
      15     This library is distributed in the hope that it will be useful,
      16     but WITHOUT ANY WARRANTY; without even the implied warranty of
      17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
      18     Lesser General Public License for more details.
      19  
      20     You should have received a copy of the GNU Lesser General Public
      21     License along with this library; see the file COPYING.LIB.
      22     If not, see <http://www.gnu.org/licenses/> or write to the 
      23     Free Software Foundation, 51 Franklin Street, Fifth Floor, 
      24     Boston, MA 02110-1301, USA.
      25  */
      26  
      27  #ifndef __COREFOUNDATION_CFLOCALE__
      28  #define __COREFOUNDATION_CFLOCALE__ 1
      29  
      30  #include "CFBase.h"
      31  
      32  #include "CFArray.h"
      33  #include "CFDictionary.h"
      34  
      35  #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
      36  
      37  CF_EXTERN_C_BEGIN
      38  
      39  /** \defgroup CFLocaleRef CFLocale Reference
      40      \brief CFLocale provides basic functionality for language and/or region
      41      specific operations.
      42      
      43      Locale-sensitive operations, such as collation, calendars and
      44      capitalization, may use CFLocale objects to provide language and/or region
      45      specific functionality.
      46    
      47      CFLocale is "toll-free bridged" to NSLocale.
      48      
      49      \{
      50   */
      51  typedef const struct __CFLocale *CFLocaleRef;
      52  
      53  /** 
      54   */
      55  enum
      56  {
      57    kCFLocaleLanguageDirectionUnknown     = 0,
      58    kCFLocaleLanguageDirectionLeftToRight = 1,
      59    kCFLocaleLanguageDirectionRightToLeft = 2,
      60    kCFLocaleLanguageDirectionTopToBottom = 3,
      61    kCFLocaleLanguageDirectionBottomToTop = 4
      62  };
      63  typedef CFIndex CFLocaleLanguageDirection;
      64  
      65  /** \name CFLocale Property Keys
      66      \{
      67   */
      68  CF_EXPORT const CFStringRef kCFLocaleMeasurementSystem; /* CFString */
      69  CF_EXPORT const CFStringRef kCFLocaleDecimalSeparator; /* CFString */
      70  CF_EXPORT const CFStringRef kCFLocaleGroupingSeparator; /* CFString */
      71  CF_EXPORT const CFStringRef kCFLocaleCurrencySymbol; /* CFString */
      72  CF_EXPORT const CFStringRef kCFLocaleCurrencyCode; /* CFString */
      73  #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
      74  CF_EXPORT const CFStringRef kCFLocaleIdentifier; /* CFString */
      75  CF_EXPORT const CFStringRef kCFLocaleLanguageCode; /* CFString */
      76  CF_EXPORT const CFStringRef kCFLocaleCountryCode; /* CFString */
      77  CF_EXPORT const CFStringRef kCFLocaleScriptCode; /* CFString */
      78  CF_EXPORT const CFStringRef kCFLocaleVariantCode; /* CFString */
      79  CF_EXPORT const CFStringRef kCFLocaleExemplarCharacterSet; /* CFCharacterSet */
      80  CF_EXPORT const CFStringRef kCFLocaleCalendarIdentifier; /* CFString */
      81  CF_EXPORT const CFStringRef kCFLocaleCalendar; /* CFCalendar */
      82  CF_EXPORT const CFStringRef kCFLocaleCollationIdentifier; /* CFString */
      83  CF_EXPORT const CFStringRef kCFLocaleUsesMetricSystem; /* CFBoolean */
      84  #endif
      85  #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
      86  CF_EXPORT const CFStringRef kCFLocaleCollatorIdentifier; /* CFString */
      87  CF_EXPORT const CFStringRef kCFLocaleQuotationBeginDelimiterKey; /* CFString */
      88  CF_EXPORT const CFStringRef kCFLocaleQuotationEndDelimiterKey; /* CFString */
      89  CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationBeginDelimiterKey; /* CFString */
      90  CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationEndDelimiterKey; /* CFString */
      91  #endif
      92  /** \} */
      93  
      94  /** \name CFCalendar Identifiers
      95      \{
      96   */
      97  CF_EXPORT const CFStringRef kCFGregorianCalendar;
      98  #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
      99  CF_EXPORT const CFStringRef kCFBuddhistCalendar;
     100  CF_EXPORT const CFStringRef kCFChineseCalendar;
     101  CF_EXPORT const CFStringRef kCFHebrewCalendar;
     102  CF_EXPORT const CFStringRef kCFIslamicCalendar;
     103  CF_EXPORT const CFStringRef kCFIslamicCivilCalendar;
     104  CF_EXPORT const CFStringRef kCFJapaneseCalendar;
     105  #endif
     106  #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
     107  CF_EXPORT const CFStringRef kCFRepublicOfChinaCalendar;
     108  CF_EXPORT const CFStringRef kCFPersianCalendar;
     109  CF_EXPORT const CFStringRef kCFIndianCalendar;
     110  CF_EXPORT const CFStringRef kCFISO8601Calendar;
     111  #endif
     112  /** \} */
     113  
     114  /** CFLocale Change Notification
     115   */
     116  CF_EXPORT const CFStringRef kCFLocaleCurrentLocaleDidChangeNotification;
     117  
     118  
     119  
     120  /** \name Creating a Locale
     121      \{
     122   */
     123  CF_EXPORT CFLocaleRef
     124  CFLocaleCopyCurrent (void);
     125  
     126  CF_EXPORT CFLocaleRef
     127  CFLocaleCreate (CFAllocatorRef allocator,
     128                  CFStringRef localeIdent);
     129  
     130  CF_EXPORT CFLocaleRef
     131  CFLocaleCreateCopy (CFAllocatorRef allocator,
     132                      CFLocaleRef locale);
     133  
     134  CF_EXPORT CFLocaleRef
     135  CFLocaleGetSystem (void);
     136  /** \} */
     137  
     138  /** \name Getting System Locale Information
     139      \{
     140   */
     141  #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
     142  CF_EXPORT CFArrayRef
     143  CFLocaleCopyAvailableLocaleIdentifiers (void);
     144  #endif
     145  /** \} */
     146  
     147  /** \name Getting ISO Information
     148      \{
     149   */
     150  #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
     151  CF_EXPORT CFArrayRef
     152  CFLocaleCopyISOCountryCodes (void);
     153  
     154  CF_EXPORT CFArrayRef
     155  CFLocaleCopyISOLanguageCodes (void);
     156  
     157  CF_EXPORT CFArrayRef
     158  CFLocaleCopyISOCurrencyCodes (void);
     159  #endif
     160  
     161  #if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
     162  CF_EXPORT CFArrayRef
     163  CFLocaleCopyCommonISOCurrencyCodes (void);
     164  #endif
     165  /** \{ */
     166  
     167  /** \name Accessing Language Information
     168      \{
     169   */
     170  #if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
     171  CF_EXPORT CFArrayRef
     172  CFLocaleCopyPreferredLanguages (void);
     173  #endif
     174  
     175  #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
     176  CF_EXPORT CFLocaleLanguageDirection
     177  CFLocaleGetLanguageCharacterDirection (CFStringRef isoLangCode);
     178  
     179  CF_EXPORT CFLocaleLanguageDirection
     180  CFLocaleGetLanguageLineDirection (CFStringRef isoLangCode);
     181  #endif
     182  /** \} */
     183  
     184  /** \name Getting Information About a Locale
     185      \{
     186   */
     187  CF_EXPORT CFStringRef
     188  CFLocaleCopyDisplayNameForPropertyValue (CFLocaleRef displayLocale,
     189                                           CFStringRef key,
     190                                           CFStringRef value);
     191  
     192  CF_EXPORT CFTypeRef
     193  CFLocaleGetValue (CFLocaleRef locale,
     194                    CFStringRef key);
     195  
     196  CF_EXPORT CFStringRef
     197  CFLocaleGetIdentifier (CFLocaleRef locale);
     198  /** \} */
     199  
     200  /** \name Getting and Creating Locale Identifiers
     201      \{
     202   */
     203  CF_EXPORT CFStringRef
     204  CFLocaleCreateCanonicalLocaleIdentifierFromString (CFAllocatorRef allocator,
     205                                                     CFStringRef localeIdent);
     206  
     207  #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
     208  CF_EXPORT CFStringRef
     209  CFLocaleCreateCanonicalLanguageIdentifierFromString (CFAllocatorRef allocator,
     210                                                       CFStringRef localeIdent);
     211  
     212  CF_EXPORT CFDictionaryRef
     213  CFLocaleCreateComponentsFromLocaleIdentifier (CFAllocatorRef allocator,
     214                                                CFStringRef localeIdent);
     215  
     216  CF_EXPORT CFStringRef
     217  CFLocaleCreateLocaleIdentifierFromComponents (CFAllocatorRef allocator,
     218                                                CFDictionaryRef dictionary);
     219  #endif
     220  /** \} */
     221  
     222  /** \name Windows Locale Codes
     223      \{
     224   */
     225  #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
     226  CF_EXPORT CFStringRef
     227  CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode (CFAllocatorRef allocator,
     228                                                       UInt32 lcid);
     229  
     230  CF_EXPORT UInt32
     231  CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier (CFStringRef localeIdent);
     232  #endif
     233  /** \} */
     234  
     235  /** \name Getting the CFLocale Type ID
     236      \{
     237   */
     238  CF_EXPORT CFTypeID
     239  CFLocaleGetTypeID (void);
     240  /** \} */
     241  
     242  /** \} */
     243  
     244  CF_EXTERN_C_END
     245  
     246  #endif /* OS_API_VERSION >= MAC_OS_X_VERSION_10_3 */
     247  
     248  #endif /* __COREFOUNDATION_CFLOCALE__ */
     249