sharednumberformat.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. ******************************************************************************
  5. * Copyright (C) 2014, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. ******************************************************************************
  8. * sharednumberformat.h
  9. */
  10. #ifndef __SHARED_NUMBERFORMAT_H__
  11. #define __SHARED_NUMBERFORMAT_H__
  12. #include "unicode/utypes.h"
  13. #include "sharedobject.h"
  14. #include "unifiedcache.h"
  15. U_NAMESPACE_BEGIN
  16. class NumberFormat;
  17. class U_I18N_API SharedNumberFormat : public SharedObject {
  18. public:
  19. SharedNumberFormat(NumberFormat *nfToAdopt) : ptr(nfToAdopt) { }
  20. virtual ~SharedNumberFormat();
  21. const NumberFormat *get() const { return ptr; }
  22. const NumberFormat *operator->() const { return ptr; }
  23. const NumberFormat &operator*() const { return *ptr; }
  24. private:
  25. NumberFormat *ptr;
  26. SharedNumberFormat(const SharedNumberFormat &) = delete;
  27. SharedNumberFormat &operator=(const SharedNumberFormat &) = delete;
  28. };
  29. template<> U_I18N_API
  30. const SharedNumberFormat *LocaleCacheKey<SharedNumberFormat>::createObject(
  31. const void * /*unused*/, UErrorCode &status) const;
  32. U_NAMESPACE_END
  33. #endif