diff options
author | Tom Tromey <tromey@adacore.com> | 2023-02-23 10:45:47 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-03-14 08:16:39 -0600 |
commit | d0aa28e155baf16ec37afdf0193c3d58816c1927 (patch) | |
tree | cd62ed889ad6e8a5ed1ff19708f8eca92e1de947 /gdb/gmp-utils.h | |
parent | 8176838655f6e1174cae2e3670ba172fa7b232db (diff) | |
download | fsf-binutils-gdb-d0aa28e155baf16ec37afdf0193c3d58816c1927.zip fsf-binutils-gdb-d0aa28e155baf16ec37afdf0193c3d58816c1927.tar.gz fsf-binutils-gdb-d0aa28e155baf16ec37afdf0193c3d58816c1927.tar.bz2 |
Hide the implementation of gdb_mpf
This renames the data member of gdb_mpf and makes it private. It also
adds a single new method to aid in this change. Unlike the earlier
changes here, I did this one all together because gdb_mpf has very few
uses.
Diffstat (limited to 'gdb/gmp-utils.h')
-rw-r--r-- | gdb/gmp-utils.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gdb/gmp-utils.h b/gdb/gmp-utils.h index 66db510..7bb8460 100644 --- a/gdb/gmp-utils.h +++ b/gdb/gmp-utils.h @@ -388,10 +388,8 @@ private: struct gdb_mpf { - mpf_t val; - /* Constructors. */ - gdb_mpf () { mpf_init (val); } + gdb_mpf () { mpf_init (m_val); } DISABLE_COPY_AND_ASSIGN (gdb_mpf); @@ -409,11 +407,20 @@ struct gdb_mpf gdb_mpq tmp_q; tmp_q.read_fixed_point (buf, byte_order, unsigned_p, scaling_factor); - mpf_set_q (val, tmp_q.m_val); + mpf_set_q (m_val, tmp_q.m_val); } + /* Convert this value to a string. FMT is the format to use, and + should have a single '%' substitution. */ + std::string str (const char *fmt) const + { return gmp_string_printf (fmt, m_val); } + /* The destructor. */ - ~gdb_mpf () { mpf_clear (val); } + ~gdb_mpf () { mpf_clear (m_val); } + +private: + + mpf_t m_val; }; /* See declaration above. */ |