mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 16:12:13 +00:00
6cbc55a5b5
Avoid dynamic casting.
30 lines
799 B
C++
30 lines
799 B
C++
#ifndef QPDF_REAL_HH
|
|
#define QPDF_REAL_HH
|
|
|
|
#include <qpdf/QPDFValue.hh>
|
|
|
|
class QPDF_Real: public QPDFValue
|
|
{
|
|
public:
|
|
virtual ~QPDF_Real() = default;
|
|
static std::shared_ptr<QPDFObject> create(std::string const& val);
|
|
static std::shared_ptr<QPDFObject>
|
|
create(double value, int decimal_places, bool trim_trailing_zeroes);
|
|
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
|
|
virtual std::string unparse();
|
|
virtual JSON getJSON(int json_version);
|
|
virtual std::string
|
|
getStringValue() const
|
|
{
|
|
return val;
|
|
}
|
|
|
|
private:
|
|
QPDF_Real(std::string const& val);
|
|
QPDF_Real(double value, int decimal_places, bool trim_trailing_zeroes);
|
|
// Store reals as strings to avoid roundoff errors.
|
|
std::string val;
|
|
};
|
|
|
|
#endif // QPDF_REAL_HH
|