variant.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright (C) 2005-2010 Valeriy Argunov (nporep AT mail DOT ru) */
  2. /*
  3. * This library is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU Lesser General Public License as published by
  5. * the Free Software Foundation; either version 2.1 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public License
  14. * along with this library; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. #include "declarations.h"
  18. #ifndef QSP_VARIANTDEFINES
  19. #define QSP_VARIANTDEFINES
  20. #define QSP_STR(a) (a).Val.Str
  21. #define QSP_NUM(a) (a).Val.Num
  22. #define QSP_PSTR(a) (a)->Val.Str
  23. #define QSP_PNUM(a) (a)->Val.Num
  24. typedef struct
  25. {
  26. union
  27. {
  28. QSP_CHAR *Str;
  29. int Num;
  30. } Val;
  31. QSP_BOOL IsStr;
  32. } QSPVariant;
  33. /* External functions */
  34. void qspFreeVariants(QSPVariant *, int);
  35. QSPVariant qspGetEmptyVariant(QSP_BOOL);
  36. QSP_BOOL qspConvertVariantTo(QSPVariant *, QSP_BOOL);
  37. void qspCopyVariant(QSPVariant *, QSPVariant *);
  38. QSP_BOOL qspIsCanConvertToNum(QSPVariant *);
  39. int qspAutoConvertCompare(QSPVariant *, QSPVariant *);
  40. #endif