AbaKus – a complex calculator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0KB

  1. #ifndef ABAKUS_VALUEMANAGER_H
  2. #define ABAKUS_VALUEMANAGER_H
  3. /*
  4. * valuemanager.h - part of abakus
  5. * Copyright (C) 2004, 2005 Michael Pyne <michael.pyne@kdemail.net>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <tqobject.h>
  22. #include <tqmap.h>
  23. #include <tqstring.h>
  24. #include <tqstringlist.h>
  25. #include "numerictypes.h"
  26. class ValueManager : public TQObject
  27. {
  28. Q_OBJECT
  29. public:
  30. typedef TQMap<TQString, Abakus::number_t> valueMap;
  31. static ValueManager *instance();
  32. Abakus::number_t value(const TQString &name) const;
  33. bool isValueSet(const TQString &name) const;
  34. bool isValueReadOnly(const TQString &name) const;
  35. void setValue(const TQString &name, const Abakus::number_t value);
  36. void removeValue(const TQString &name);
  37. TQStringList valueNames() const;
  38. /**
  39. * Returns a textual description of a constant built-into abakus.
  40. */
  41. static TQString description(const TQString &valueName);
  42. signals:
  43. void signalValueAdded(const TQString &name, Abakus::number_t value);
  44. void signalValueRemoved(const TQString &name);
  45. void signalValueChanged(const TQString &name, Abakus::number_t newValue);
  46. public slots:
  47. void slotRemoveUserVariables();
  48. private:
  49. ValueManager(TQObject *parent = 0, const char *name = "value manager");
  50. static ValueManager *m_manager;
  51. valueMap m_values;
  52. };
  53. #endif
  54. // vim: set et sw=4 ts=8: