diff --git a/headers/os/LocaleKit.h b/headers/os/LocaleKit.h index 110113e437..50764df7d2 100644 --- a/headers/os/LocaleKit.h +++ b/headers/os/LocaleKit.h @@ -7,12 +7,9 @@ #include #include #include -#include -#include #include #include #include #include -#include #include #include diff --git a/headers/os/locale/DateTimeFormat.h b/headers/os/locale/DateTimeFormat.h index 5a0e3a05e4..ded8059745 100644 --- a/headers/os/locale/DateTimeFormat.h +++ b/headers/os/locale/DateTimeFormat.h @@ -7,7 +7,6 @@ #include -#include class BString; diff --git a/headers/os/locale/Format.h b/headers/os/locale/Format.h index ff24c5d228..ecc5872e51 100644 --- a/headers/os/locale/Format.h +++ b/headers/os/locale/Format.h @@ -5,7 +5,6 @@ #ifndef _B_FORMAT_H_ #define _B_FORMAT_H_ -#include #include #include #include diff --git a/headers/os/locale/FormatImpl.h b/headers/os/locale/FormatImpl.h deleted file mode 100644 index 789dd1b2a5..0000000000 --- a/headers/os/locale/FormatImpl.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _B_FORMAT_IMPL_H_ -#define _B_FORMAT_IMPL_H_ - -#include - -class BFormatParameters; - -class BFormatImpl { -public: - BFormatImpl(); - virtual ~BFormatImpl(); - - virtual BFormatParameters *DefaultFormatParameters() = 0; - virtual const BFormatParameters *DefaultFormatParameters() - const = 0; -}; - -#endif // _B_FORMAT_IMPL_H_ diff --git a/headers/os/locale/FormatParameters.h b/headers/os/locale/FormatParameters.h deleted file mode 100644 index 45623982d6..0000000000 --- a/headers/os/locale/FormatParameters.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _B_FORMAT_PARAMETERS_H_ -#define _B_FORMAT_PARAMETERS_H_ - -#include - -enum format_alignment { - B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT? - B_ALIGN_FORMAT_RIGHT, -}; - -class BFormatParameters { -public: - BFormatParameters(const BFormatParameters *parent = NULL); - BFormatParameters(const BFormatParameters &other); - ~BFormatParameters(); - - void SetAlignment(format_alignment alignment); - format_alignment Alignment() const; - - void SetFormatWidth(size_t width); - size_t FormatWidth() const; - - const BFormatParameters *ParentParameters() const; - - BFormatParameters &operator=(const BFormatParameters &other); - -protected: - void SetParentParameters(const BFormatParameters *parent); - -private: - const BFormatParameters *fParent; - format_alignment fAlignment; - size_t fWidth; - uint32 fFlags; -}; - -#endif // _B_FORMAT_PARAMETERS_H_ diff --git a/headers/os/locale/NumberFormatParameters.h b/headers/os/locale/NumberFormatParameters.h deleted file mode 100644 index b83a7cd43a..0000000000 --- a/headers/os/locale/NumberFormatParameters.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _B_NUMBER_FORMAT_PARAMETERS_H_ -#define _B_NUMBER_FORMAT_PARAMETERS_H_ - -#include - -enum number_format_sign_policy { - B_USE_NEGATIVE_SIGN_ONLY, - B_USE_SPACE_FOR_POSITIVE_SIGN, - B_USE_POSITIVE_SIGN, -}; - -enum number_format_base { - B_DEFAULT_BASE = -1, // locale default, usually decimal, but - // may be something like roman as well - B_FLEXIBLE_DECIMAL_BASE = 0, // same as B_DECIMAL_BASE when formatting, - // but recognizes octal and hexadecimal - // numbers by prefix when parsing - B_OCTAL_BASE = 8, - B_DECIMAL_BASE = 10, - B_HEXADECIMAL_BASE = 16, -}; - -class BNumberFormatParameters : public BFormatParameters { -public: - BNumberFormatParameters(const BNumberFormatParameters *parent = NULL); - BNumberFormatParameters(const BNumberFormatParameters &other); - ~BNumberFormatParameters(); - - void SetUseGrouping(bool useGrouping); - bool UseGrouping() const; - - void SetSignPolicy(number_format_sign_policy policy); - number_format_sign_policy SignPolicy() const; - - void SetBase(number_format_base base); - number_format_base Base() const; - - void SetUseBasePrefix(bool useBasePrefix); - bool UseBasePrefix() const; - - void SetMinimalIntegerDigits(size_t minIntegerDigits); - size_t MinimalIntegerDigits() const; - - void SetUseZeroPadding(bool zeroPadding); - bool UseZeroPadding() const; - - const BNumberFormatParameters *ParentNumberParameters() const; - - BNumberFormatParameters &operator=( - const BNumberFormatParameters &other); - -protected: - void SetParentNumberParameters(const BNumberFormatParameters *parent); - -private: - const BNumberFormatParameters *fParent; - bool fUseGrouping; - number_format_sign_policy fSignPolicy; - number_format_base fBase; - bool fUseBasePrefix; - size_t fMinimalIntegerDigits; - bool fUseZeroPadding; - uint32 fFlags; -}; - -#endif // _B_NUMBER_FORMAT_PARAMETERS_H_ diff --git a/src/kits/locale/FormatImpl.cpp b/src/kits/locale/FormatImpl.cpp deleted file mode 100644 index 2306052688..0000000000 --- a/src/kits/locale/FormatImpl.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -// constructor -BFormatImpl::BFormatImpl() -{ -} - -// destructor -BFormatImpl::~BFormatImpl() -{ -} - diff --git a/src/kits/locale/FormatParameters.cpp b/src/kits/locale/FormatParameters.cpp deleted file mode 100644 index 871fa6e524..0000000000 --- a/src/kits/locale/FormatParameters.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include - -// defaults -static const format_alignment kDefaultAlignment = B_ALIGN_FORMAT_RIGHT; -static const size_t kDefaultFormatWidth = 1; - -// flags -enum { - ALIGNMENT_SET = 0x01, - WIDTH_SET = 0x02, -}; - -// constructor -BFormatParameters::BFormatParameters(const BFormatParameters *parent) - : fParent(parent), - fFlags(0) -{ -} - -// copy constructor -BFormatParameters::BFormatParameters(const BFormatParameters &other) - : fParent(other.fParent), - fAlignment(other.fAlignment), - fWidth(other.fWidth), - fFlags(other.fFlags) -{ -} - -// destructor -BFormatParameters::~BFormatParameters() -{ -} - -// SetAlignment -void -BFormatParameters::SetAlignment(format_alignment alignment) -{ - fAlignment = alignment; - fFlags |= ALIGNMENT_SET; -} - -// Alignment -format_alignment -BFormatParameters::Alignment() const -{ - if (fFlags & ALIGNMENT_SET) - return fAlignment; - if (fParent) - return fParent->Alignment(); - return kDefaultAlignment; -} - -// SetFormatWidth -void -BFormatParameters::SetFormatWidth(size_t width) -{ - fWidth = width; - fFlags |= WIDTH_SET; -} - -// FormatWidth -size_t -BFormatParameters::FormatWidth() const -{ - if (fFlags & WIDTH_SET) - return fWidth; - if (fParent) - return fParent->FormatWidth(); - return kDefaultFormatWidth; -} - -// SetParentParameters -void -BFormatParameters::SetParentParameters(const BFormatParameters *parent) -{ - fParent = parent; -} - -// ParentParameters -const BFormatParameters * -BFormatParameters::ParentParameters() const -{ - return fParent; -} - -// = -BFormatParameters & -BFormatParameters::operator=(const BFormatParameters &other) -{ - fParent = other.fParent; - fAlignment = other.fAlignment; - fWidth = other.fWidth; - fFlags = other.fFlags; - return *this; -} - diff --git a/src/kits/locale/Jamfile b/src/kits/locale/Jamfile index 9fabd30115..73b764621c 100644 --- a/src/kits/locale/Jamfile +++ b/src/kits/locale/Jamfile @@ -34,11 +34,6 @@ local sources = TimeUnitFormat.cpp Format.cpp # Used by some of the above. UnicodeChar.cpp # Already used in FirstBootPrompt. - - # old, needs investigation - # FormatImpl.cpp - # FormatParameters.cpp - # NumberFormatParameters.cpp ; local architectureObject ; diff --git a/src/kits/locale/NumberFormatParameters.cpp b/src/kits/locale/NumberFormatParameters.cpp deleted file mode 100644 index 53a91bb3b1..0000000000 --- a/src/kits/locale/NumberFormatParameters.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include - -// defaults -static const bool kDefaultUseGrouping = false; -static const number_format_sign_policy kDefaultSignPolicy - = B_USE_NEGATIVE_SIGN_ONLY; -static const number_format_base kDefaultBase = B_DEFAULT_BASE; -static const bool kDefaultUseBasePrefix = false; -static const size_t kDefaultMinimalIntegerDigits = 1; -static const bool kDefaultUseZeroPadding = false; - -// flags -enum { - USE_GROUPING_SET = 0x01, - SIGN_POLICY_SET = 0x02, - BASE_SET = 0x04, - USE_BASE_PREFIX_SET = 0x08, - MINIMAL_INTEGER_DIGITS_SET = 0x10, - USE_ZERO_PADDING_SET = 0x20, -}; - -// constructor -BNumberFormatParameters::BNumberFormatParameters( - const BNumberFormatParameters *parent) - : BFormatParameters(parent), - fParent(parent), - fFlags(0) -{ -} - -// copy constructor -BNumberFormatParameters::BNumberFormatParameters( - const BNumberFormatParameters &other) - : BFormatParameters(other), - fParent(other.fParent), - fUseGrouping(other.fUseGrouping), - fSignPolicy(other.fSignPolicy), - fBase(other.fBase), - fUseBasePrefix(other.fUseBasePrefix), - fMinimalIntegerDigits(other.fMinimalIntegerDigits), - fFlags(other.fFlags) -{ -} - -// destructor -BNumberFormatParameters::~BNumberFormatParameters() -{ -} - -// SetUseGrouping -void -BNumberFormatParameters::SetUseGrouping(bool useGrouping) -{ - fUseGrouping = useGrouping; - fFlags |= USE_GROUPING_SET; -} - -// UseGrouping -bool -BNumberFormatParameters::UseGrouping() const -{ - if (fFlags & USE_GROUPING_SET) - return fUseGrouping; - if (fParent) - return fParent->UseGrouping(); - return kDefaultUseGrouping; -} - -// SetSignPolicy -void -BNumberFormatParameters::SetSignPolicy(number_format_sign_policy policy) -{ - fSignPolicy = policy; - fFlags |= SIGN_POLICY_SET; -} - -// SignPolicy -number_format_sign_policy -BNumberFormatParameters::SignPolicy() const -{ - if (fFlags & SIGN_POLICY_SET) - return fSignPolicy; - if (fParent) - return fParent->SignPolicy(); - return kDefaultSignPolicy; -} - -// SetBase -void -BNumberFormatParameters::SetBase(number_format_base base) -{ - fBase = base; - fFlags |= BASE_SET; -} - -// Base -number_format_base -BNumberFormatParameters::Base() const -{ - if (fFlags & BASE_SET) - return fBase; - if (fParent) - return fParent->Base(); - return kDefaultBase; -} - -// SetUseBasePrefix -void -BNumberFormatParameters::SetUseBasePrefix(bool useBasePrefix) -{ - fUseBasePrefix = useBasePrefix; - fFlags |= USE_BASE_PREFIX_SET; -} - -// UseBasePrefix -bool -BNumberFormatParameters::UseBasePrefix() const -{ - if (fFlags & USE_BASE_PREFIX_SET) - return fUseBasePrefix; - if (fParent) - return fParent->UseBasePrefix(); - return kDefaultUseBasePrefix; -} - -// SetMinimalIntegerDigits -void -BNumberFormatParameters::SetMinimalIntegerDigits(size_t minIntegerDigits) -{ - fMinimalIntegerDigits = minIntegerDigits; - fFlags |= MINIMAL_INTEGER_DIGITS_SET; -} - -// MinimalIntegerDigits -size_t -BNumberFormatParameters::MinimalIntegerDigits() const -{ - if (fFlags & MINIMAL_INTEGER_DIGITS_SET) - return fMinimalIntegerDigits; - if (fParent) - return fParent->MinimalIntegerDigits(); - return kDefaultMinimalIntegerDigits; -} - -// SetUseZeroPadding -void -BNumberFormatParameters::SetUseZeroPadding(bool useZeroPadding) -{ - fUseZeroPadding = useZeroPadding; - fFlags |= USE_ZERO_PADDING_SET; -} - -// UseZeroPadding -bool -BNumberFormatParameters::UseZeroPadding() const -{ - if (fFlags & USE_ZERO_PADDING_SET) - return fUseZeroPadding; - if (fParent) - return fParent->UseZeroPadding(); - return kDefaultUseZeroPadding; -} - -// SetParentNumberParameters -void -BNumberFormatParameters::SetParentNumberParameters( - const BNumberFormatParameters *parent) -{ - fParent = parent; - SetParentParameters(parent); -} - -// ParentNumberParameters -const BNumberFormatParameters * -BNumberFormatParameters::ParentNumberParameters() const -{ - return fParent; -} - -// = -BNumberFormatParameters & -BNumberFormatParameters::operator=(const BNumberFormatParameters &other) -{ - BFormatParameters::operator=(other); - fParent = other.fParent; - fUseGrouping = other.fUseGrouping; - fSignPolicy = other.fSignPolicy; - fBase = other.fBase; - fUseBasePrefix = other.fUseBasePrefix; - fMinimalIntegerDigits = other.fMinimalIntegerDigits; - fFlags = other.fFlags; - fUseZeroPadding = other.fUseZeroPadding; - return *this; -} -