19 #define mDeclBinDataDescConstr(T,ii,is) \ 20 BinDataDesc( const T* ) { set( ii, is, sizeof(T) ); } \ 21 BinDataDesc( const T& ) { set( ii, is, sizeof(T) ); } 51 : isint_(ii), issigned_(is), nrbytes_(b) {}
53 : isint_(ii), issigned_(is),
54 nrbytes_(nearestByteCount(ii,b)) {}
61 inline bool isSigned()
const {
return issigned_; }
64 { isint_ = ii; issigned_ = is; nrbytes_ = b; }
65 inline void set(
bool ii,
bool is,
int b )
66 { isint_ = ii; issigned_ = is;
67 nrbytes_ = nearestByteCount(ii,b); }
72 { nrbytes_ = nearestByteCount(isint_,n); }
77 virtual void set(
const char*);
78 virtual void dump(
unsigned char&,
unsigned char&)
const;
79 virtual void set(
unsigned char,
unsigned char);
90 inline
bool operator ==( const BinDataDesc& dc )
const 91 {
return isEqual(dc); }
93 {
return !isEqual(dc); }
94 inline bool isEqual(
const BinDataDesc& dc )
const 96 unsigned char c11=0, c12=0, c21=0, c22=0;
97 dump(c11,c12); dc.
dump(c21,c22);
98 return c11 == c21 && c12 == c22;
101 int sizeFor(
int n )
const {
return nrbytes_ * n; }
102 virtual bool convertsWellTo(
const BinDataDesc&)
const;
106 if ( !is_int )
return s > 6 ? N8 : N4;
108 else if ( s > 2 ) s = 4;
109 else if ( s < 2 ) s = 1;
115 if ( s < 0 || s > 8 )
return -1;
116 if ( s == 0 )
return is_int ? 1 : 4;
117 if ( !is_int )
return s == 4 ? 8 : -1;
118 return s == 1 ? 2 : ( s == 2 ? 4 : 8 );
127 void setFrom(
unsigned char,
bool);
131 #undef mDeclBinDataDescConstr #define mExpClass(module)
Definition: commondefs.h:160
BinDataDesc(const char *s)
Definition: bindatadesc.h:57
BinDataDesc(bool ii, bool is, int b)
Definition: bindatadesc.h:52
ByteCount
Definition: bindatadesc.h:47
virtual ~BinDataDesc()
Definition: bindatadesc.h:58
bool isint_
Definition: bindatadesc.h:123
void setInteger(bool yn)
Definition: bindatadesc.h:68
static ByteCount nearestByteCount(bool is_int, int s)
Definition: bindatadesc.h:104
void setSigned(bool yn)
Definition: bindatadesc.h:69
bool isEqual(const BinDataDesc &dc) const
Definition: bindatadesc.h:94
static int nextSize(bool is_int, int s)
Definition: bindatadesc.h:113
ByteCount nrBytes() const
Definition: bindatadesc.h:62
BinDataDesc(bool ii=false, bool is=true, ByteCount b=N4)
Definition: bindatadesc.h:49
ByteCount nrbytes_
Definition: bindatadesc.h:125
void setNrBytes(int n)
Definition: bindatadesc.h:71
bool issigned_
Definition: bindatadesc.h:124
virtual void dump(unsigned char &, unsigned char &) const
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
virtual int maxStringifiedSize() const
Definition: bindatadesc.h:75
bool isInteger() const
Definition: bindatadesc.h:60
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
BinDataDesc(unsigned char c1, unsigned char c2)
Definition: bindatadesc.h:55
#define mDeclBinDataDescConstr(T, ii, is)
Definition: bindatadesc.h:19
int sizeFor(int n) const
Definition: bindatadesc.h:101
Description of binary data.
Definition: bindatadesc.h:43
bool isSigned() const
Definition: bindatadesc.h:61
Export_Basic const char * toString(ViewStyle)
void setNrBytes(ByteCount n)
Definition: bindatadesc.h:70