/**************** Value H Declares Source Code File (.H) ***************/ /* Name: VALUE.H Version 2.4 */ /* */ /* (C) Copyright to the author Olivier BERTRAND 2001-2019 */ /* */ /* This file contains the VALUE and derived classes declares. */ /***********************************************************************/ #ifndef __VALUE__H__ #define __VALUE__H__
/***********************************************************************/ /* Include required application header files */ /* assert.h is header required when using the assert function. */ /* block.h is header containing Block global declarations. */ /***********************************************************************/ #include"assert.h" #include"block.h"
/***********************************************************************/ /* This should list the processors accepting unaligned numeral values.*/ /***********************************************************************/ #ifdefined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(_M_IA64) #define UNALIGNED_OK #endif
/***********************************************************************/ /* Types used in some class definitions. */ /***********************************************************************/ enum CONV {CNV_ANY = 0, /* Convert to any type */
CNV_CHAR = 1, /* Convert to character type */
CNV_NUM = 2}; /* Convert to numeric type */
/***********************************************************************/ /* Types used in some class definitions. */ /***********************************************************************/ class CONSTANT; // For friend setting typedefstruct _datpar *PDTP; // For DTVAL
/***********************************************************************/ /* Utilities used to test types and to allocated values. */ /***********************************************************************/ // Exported functions
DllExport PCSZ GetTypeName(int);
DllExport unsigned GetTypeSize(int, unsigned); #ifdef ODBC_SUPPORT /* This function is exported for use in OEM table type DLLs */
DllExport int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w); #endif
DllExport constchar *GetFormatType(int);
DllExport int GetFormatType(char);
DllExport bool IsTypeChar(int type);
DllExport bool IsTypeNum(int type);
DllExport int ConvertType(int, int, CONV, bool match = false);
DllExport PVAL AllocateValue(PGLOBAL, void *, short, short = 2);
DllExport PVAL AllocateValue(PGLOBAL, PVAL, int = TYPE_VOID, int = 0);
DllExport PVAL AllocateValue(PGLOBAL, int, int len = 0, int prec = 0, bool uns = false, PCSZ fmt = NULL);
DllExport ulonglong CharToNumber(PCSZ, int, ulonglong, bool, bool *minus = NULL, bool *rc = NULL);
DllExport BYTE OpBmp(PGLOBAL g, OPVAL opc);
/* Type for date and timestamps */ typedef longlong dtval_timestamp_t;
/***********************************************************************/ /* Class VALUE represents a constant or variable of any valid type. */ /***********************************************************************/ class DllExport VALUE : public BLOCK { friendclass CONSTANT; // The only object allowed to use SetConstFormat friendclass SWAP; // The only class allowed to access protected public: // Constructors
// Constructor used by derived classes
VALUE(int type, bool un = false);
// Members
PGLOBAL Global; // To reduce arglist constchar *Fmt; constchar *Xfmt; bool Nullable; // True if value can be null bool Null; // True if value is null boolUnsigned; // True if unsigned int Type; // The value type int Clen; // Internal value length int Prec;
}; // end of class VALUE
/***********************************************************************/ /* Class TYPVAL: represents a typed value. */ /***********************************************************************/ template <class TYPE> class DllExport TYPVAL : public VALUE { public: // Constructor
TYPVAL(TYPE n, int type, int prec = 0, bool un = false);
protected: static TYPE MinMaxVal(bool b);
TYPE SafeAdd(TYPE n1, TYPE n2);
TYPE SafeMult(TYPE n1, TYPE n2); bool Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op);
// Default constructor not to be used
TYPVAL(void) : VALUE(TYPE_ERROR) {}
// Specialized functions static ulonglong MaxVal(void);
TYPE GetTypedValue(PVAL vp);
TYPE GetTypedValue(PVBLK blk, int n); // TYPE GetTypedValue(PSZ s);
// Members
TYPE Tval;
}; // end of class TYPVAL
/***********************************************************************/ /* Specific STRING class. */ /***********************************************************************/ template <> class DllExport TYPVAL<PSZ>: public VALUE { friendclass SWAP; // The only class allowed to offsets Strg public: // Constructors
TYPVAL(PSZ s, short c = 0);
TYPVAL(PGLOBAL g, PSZ s, int n, int c);
protected: // Members
PSZ Strp; bool Ci; // true if case insensitive int Len;
}; // end of class TYPVAL<PSZ>
/***********************************************************************/ /* Specific DECIMAL class. */ /***********************************************************************/ class DllExport DECVAL: public TYPVAL<PSZ> { public: // Constructors
DECVAL(PSZ s);
DECVAL(PGLOBAL g, PSZ s, int n, int prec, bool uns);
// Methods bool GetBinValue(void *buf, int buflen, bool go) override; int ShowValue(char *buf, int len) override; bool IsEqual(PVAL vp, bool chktype) override; int CompareValue(PVAL vp) override;
protected: // Members
}; // end of class DECVAL
/***********************************************************************/ /* Specific BINARY class. */ /***********************************************************************/ class DllExport BINVAL: public VALUE { friendclass SWAP; // The only class allowed to offsets pointers public: // Constructors //BINVAL(void *p);
BINVAL(PGLOBAL g, void *p, int cl, int n);
protected: // Members void *Binp; char *Chrp; int Len;
}; // end of class BINVAL
/***********************************************************************/ /* Class DTVAL: represents a time stamp value. */ /***********************************************************************/
class DllExport DTVAL : public TYPVAL<dtval_timestamp_t> { public: // Constructors
DTVAL(PGLOBAL g, int n, int p, PCSZ fmt);
DTVAL(int n); using TYPVAL<dtval_timestamp_t>::SetValue;
// Methods bool MakeDate(PGLOBAL g, int *val, int nval);
struct tm *GetGmTime(struct tm *);
protected: // Default constructor not to be used
DTVAL(void) : TYPVAL<dtval_timestamp_t>() {}
// Members staticint Shift; // Time zone shift in seconds
PDTP Pdtp; // To the DATPAR structure char *Sdate; // Utility char buffer int DefYear; // Used by ExtractDate int Len; // Used by CHAR scalar function
}; // end of class DTVAL
#endif// __VALUE__H__
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.36 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.