Variablen.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include "Variablen.h"
  2. Variable::Variable( VariableTyp typ )
  3. {
  4. this->typ = typ;
  5. ref = 1;
  6. }
  7. Variable::~Variable()
  8. {}
  9. VariableTyp Variable::getVariableTyp() const
  10. {
  11. return typ;
  12. }
  13. Variable *Variable::getThis()
  14. {
  15. ref++;
  16. return this;
  17. }
  18. Variable *Variable::release()
  19. {
  20. if( !--ref )
  21. delete this;
  22. return 0;
  23. }
  24. Integer::Integer( int value, bool taste )
  25. : Variable( taste ? TASTE : INTEGER )
  26. {
  27. this->value = value;
  28. }
  29. void Integer::setValue( int value )
  30. {
  31. this->value = value;
  32. }
  33. int Integer::getValue() const
  34. {
  35. return value;
  36. }
  37. Boolean::Boolean( bool value )
  38. : Variable( BOOLEAN )
  39. {
  40. this->value = value;
  41. }
  42. void Boolean::setValue( bool value )
  43. {
  44. this->value = value;
  45. }
  46. bool Boolean::getValue() const
  47. {
  48. return value;
  49. }
  50. String::String( const char *value, bool richtung )
  51. : Variable( richtung ? RICHTUNG : STRING )
  52. {
  53. this->value = value;
  54. }
  55. void String::setValue( Text value )
  56. {
  57. this->value = value;
  58. }
  59. const Text &String::getValue() const
  60. {
  61. return value;
  62. }
  63. Float::Float( float value )
  64. : Variable( FLOAT )
  65. {
  66. this->value = value;
  67. }
  68. void Float::setValue( float value )
  69. {
  70. this->value = value;
  71. }
  72. float Float::getValue() const
  73. {
  74. return value;
  75. }