]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/winutil.cpp
2 ********************************************************************************
3 * Copyright (C) 2005-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
9 ********************************************************************************
12 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_FORMATTING
21 # define WIN32_LEAN_AND_MEAN
30 static Win32Utilities::LCIDRecord
*lcidRecords
= NULL
;
31 static int32_t lcidCount
= 0;
32 static int32_t lcidMax
= 0;
34 BOOL CALLBACK
EnumLocalesProc(LPSTR lpLocaleString
)
36 UErrorCode status
= U_ZERO_ERROR
;
38 if (lcidCount
>= lcidMax
) {
39 Win32Utilities::LCIDRecord
*newRecords
= new Win32Utilities::LCIDRecord
[lcidMax
+ 32];
41 for (int i
= 0; i
< lcidMax
; i
+= 1) {
42 newRecords
[i
] = lcidRecords
[i
];
46 lcidRecords
= newRecords
;
50 sscanf(lpLocaleString
, "%8x", &lcidRecords
[lcidCount
].lcid
);
52 lcidRecords
[lcidCount
].localeID
= uprv_convertToPosix(lcidRecords
[lcidCount
].lcid
, &status
);
59 Win32Utilities::LCIDRecord
*Win32Utilities::getLocales(int32_t &localeCount
)
63 EnumSystemLocalesA(EnumLocalesProc
, LCID_INSTALLED
);
65 localeCount
= lcidCount
;
68 lcidCount
= lcidMax
= 0;
74 void Win32Utilities::freeLocales(LCIDRecord
*records
)
79 #endif /* #if !UCONFIG_NO_FORMATTING */
81 #endif /* #ifdef U_WINDOWS */