/*
* Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef PG_NMTYP_H_
#define PG_NMTYP_H_
#include
#pragma interface
#include
/*
* DATA TYPE
*
* NM() -- numeric value
*/
class NMtyp : public Primtype
{
public:
NMtyp();
NMtyp(int);
NMtyp(long);
NMtyp(unsigned int);
NMtyp(double, int prec = 6);
NMtyp(const char *);
result input(istream&);
void output(ostream&) const;
operator int() const;
operator long() const;
operator unsigned int() const;
operator double() const;
operator class STtyp () const;
operator class IDtyp () const;
bool isfloat();
bool isint();
const NMtyp& operator = (int);
const NMtyp& operator = (long);
const NMtyp& operator = (unsigned int);
const NMtyp& operator = (double);
const NMtyp& operator = (const char *);
bool operator == (const NMtyp&) const;
bool operator != (const NMtyp&) const;
bool operator < (const NMtyp&) const;
bool operator > (const NMtyp&) const;
bool operator <= (const NMtyp&) const;
bool operator >= (const NMtyp&) const;
bool operator == (int) const;
bool operator != (int) const;
bool operator < (int) const;
bool operator > (int) const;
bool operator <= (int) const;
bool operator >= (int) const;
bool operator == (unsigned int) const;
bool operator != (unsigned int) const;
bool operator < (unsigned int) const;
bool operator > (unsigned int) const;
bool operator <= (unsigned int) const;
bool operator >= (unsigned int) const;
bool operator == (long) const;
bool operator != (long) const;
bool operator < (long) const;
bool operator > (long) const;
bool operator <= (long) const;
bool operator >= (long) const;
bool operator == (double) const;
bool operator != (double) const;
bool operator < (double) const;
bool operator > (double) const;
bool operator <= (double) const;
bool operator >= (double) const;
unsigned int getPrecision();
void setPrecision(unsigned int);
private:
bool _is_float;
union {
long _int;
double _float;
};
unsigned int _precision; // number of significant digits
};
#ifndef OUTLINE
# include "NMtyp.icc"
#endif
#endif /* !PG_NMTYP_H_ */