Files
haiku-beta6/src/apps/haikudepot/util/LocaleUtils.cpp
T
Andrew Lindesay 89b16bb4d2 HaikuDepot: Categories from Server
The list of categories for packages is currently
hard-coded into the HaikuDepot desktop
application.  This change will change that so that
the list is obtained from the HaikuDepot Server
system and is always up to date with the server's
list of categories.

Change-Id: I757732f4d771e1599d6ad9c85cd65905640de928
Reviewed-on: https://review.haiku-os.org/c/1478
Reviewed-by: Adrien Destugues <[email protected]>
2019-05-25 11:10:50 +00:00

36 lines
696 B
C++

/*
* Copyright 2019, Andrew Lindesay <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "LocaleUtils.h"
#include <Collator.h>
#include <Locale.h>
#include <LocaleRoster.h>
BCollator* LocaleUtils::sSharedCollator = NULL;
/*static*/ BCollator*
LocaleUtils::GetSharedCollator()
{
if (sSharedCollator == NULL) {
GetCollator(sSharedCollator);
}
return sSharedCollator;
}
/*static*/ void
LocaleUtils::GetCollator(BCollator* collator)
{
const BLocale* locale = BLocaleRoster::Default()->GetDefaultLocale();
if (B_OK != locale->GetCollator(collator)) {
debugger("unable to get the locale's collator");
exit(EXIT_FAILURE);
}
}