bbtypes.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef BB_TYPES_H
  2. #define BB_TYPES_H
  3. #include "bbstd.h"
  4. typedef bool bbBool;
  5. typedef signed char bbByte;
  6. typedef unsigned char bbUByte;
  7. typedef signed short bbShort;
  8. typedef unsigned short bbUShort;
  9. typedef signed int bbInt;
  10. typedef unsigned int bbUInt;
  11. typedef signed long long bbLong;
  12. typedef unsigned long long bbULong;
  13. typedef float bbFloat;
  14. typedef double bbDouble;
  15. typedef unsigned short bbChar;
  16. class bbString;
  17. template<class T> class bbFunction;
  18. template<class T,int D=1> class bbArray;
  19. template<class T> struct bbGCVar;
  20. struct bbVariant;
  21. struct bbTypeInfo;
  22. struct bbDeclInfo;
  23. namespace detail{
  24. template<int...I> struct seq { };
  25. template<int N, int...I> struct gen_seq : gen_seq<N-1,N-1,I...> { };
  26. template<int...I> struct gen_seq<0,I...> : seq<I...> { };
  27. template<typename T> struct remove_pointer { typedef T type; };
  28. template<typename T> struct remove_pointer<T*> { typedef typename remove_pointer<T>::type type; };
  29. }
  30. bbString bbTypeName( const char *type );
  31. template<class T> bool operator<( const T &x,const T &y ){
  32. return memcmp( &x,&y,sizeof(T) );
  33. }
  34. template<class X,class Y> int bbCompare( const X &x,const Y &y ){
  35. if( x<y ) return -1;
  36. return y<x;
  37. }
  38. #ifdef NDEBUG
  39. #define BB_CLASS(X) struct X; \
  40. bbTypeInfo *bbGetType(X*const&);
  41. #define BB_STRUCT(X) struct X; \
  42. bbTypeInfo *bbGetType(X const&);
  43. #define BB_ENUM(X) enum class X; \
  44. bbTypeInfo *bbGetType(X const&);
  45. #else
  46. #define BB_CLASS(X) struct X; \
  47. bbTypeInfo *bbGetType(X*const&); \
  48. bbString bbDBType(X**); \
  49. bbString bbDBValue(X**);
  50. #define BB_STRUCT(X) struct X; \
  51. bbTypeInfo *bbGetType(X const&); \
  52. bbString bbDBType(X*); \
  53. bbString bbDBValue(X*);
  54. #define BB_ENUM(X) enum class X; \
  55. bbTypeInfo *bbGetType(X const&); \
  56. bbString bbDBType(X*); \
  57. bbString bbDBValue(X*);
  58. #endif
  59. #endif