txCore.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef __txCore_h__
  6. #define __txCore_h__
  7. #include "nscore.h"
  8. #include "nsDebug.h"
  9. #include "nsISupportsImpl.h"
  10. class nsAString;
  11. class txObject
  12. {
  13. public:
  14. txObject()
  15. {
  16. MOZ_COUNT_CTOR(txObject);
  17. }
  18. /**
  19. * Deletes this txObject
  20. */
  21. virtual ~txObject()
  22. {
  23. MOZ_COUNT_DTOR(txObject);
  24. }
  25. };
  26. /**
  27. * Utility class for doubles
  28. */
  29. class txDouble
  30. {
  31. public:
  32. /**
  33. * Converts the value of the given double to a string, and appends
  34. * the result to the destination string.
  35. */
  36. static void toString(double aValue, nsAString& aDest);
  37. /**
  38. * Converts the given String to a double, if the string value does not
  39. * represent a double, NaN will be returned.
  40. */
  41. static double toDouble(const nsAString& aStr);
  42. };
  43. #endif