property - first attempt

This commit is contained in:
AndreaRigoni
2026-03-23 12:55:09 +00:00
parent b52ae808b8
commit 94843de711
16 changed files with 482 additions and 63 deletions

View File

@@ -198,20 +198,16 @@ public:
return &bpos;
}
template <class T> Archive &operator<<(T &t) {
template <class T> Archive &operator<<(const T &t) {
// to get access you must redefine save_override by typing
// "using save_override" in archive impl
this->This()->save_override(t);
return *this->This();
}
// the & operator
template <class T> Archive &operator&(T &t) {
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
return *this->This() << const_cast<const T &>(t);
#else
template <class T> Archive &operator&(const T &t) {
return *this->This() << t;
#endif
}
// the == operator
@@ -364,7 +360,6 @@ public:
boost::serialization::hrp<T> &t) {
this->This()->load_start(t.name());
this->detail_common_iarchive::load_override(t.value());
// t.stov();
this->This()->load_end(t.name());
}
@@ -432,8 +427,7 @@ public:
#endif
::boost::serialization::hrp<T> &t) {
this->This()->save_start(t.name());
// t.vtos();
// this->detail_common_oarchive::save_override(t.const_value());
this->detail_common_oarchive::save_override(t.const_value());
this->This()->save_end(t.name());
}
@@ -467,14 +461,10 @@ public:
text_iarchive(std::istream &is, unsigned int flags = 0)
: text_iarchive_impl<Archive>(is, flags) {}
using basic_text_iarchive::load_override;
using base::load_override;
void load_override(boost::archive::object_id_type &t) {}
// class_name_type can't be handled here as it depends upon the
// char type used by the stream. So require the derived implementation.
// derived in this case is xml_iarchive_impl or base ..
using base::load_override;
void load_override(const char *str) {
StringReader sr(basic_text_iprimitive::is);
@@ -532,7 +522,7 @@ public:
hrt_iarchive(std::istream &is, unsigned int flags = 0)
: base(is, flags | boost::archive::no_header) {}
using basic_text_iarchive::load_override;
using base::load_override;
// hide all archive props //
void load_override(boost::archive::object_id_type &t) {}
@@ -544,10 +534,6 @@ public:
void load_override(boost::archive::class_name_type &t) {}
void load_override(boost::archive::tracking_type &t) {}
// class_name_type can't be handled here as it depends upon the
// char type used by the stream. So require the derived implementation.
// derived in this case is xml_iarchive_impl or base ..
using base::load_override;
void load_override(const char *str) {
StringReader sr(basic_text_iprimitive::is);
@@ -583,6 +569,13 @@ public:
void save_override(const char *str) { basic_text_oprimitive::save(str); }
template <class T>
void save_override(const boost::serialization::hrp<T> &t) {
*this << t.name() << ": ";
*this << t.const_value();
*this << "\n";
}
~hrt_oarchive() {}
};
@@ -611,7 +604,7 @@ public:
// basic_text_oprimitive::save(str);
}
template <class T> void save_override(T &t) {
template <class T> void save_override(const T &t) {
base::save_override(boost::serialization::make_nvp(NULL, t));
}
@@ -627,6 +620,10 @@ public:
base::save_override(t);
}
template <class T> void save_override(const boost::serialization::hrp<T> &t) {
base::save_override(boost::serialization::make_nvp(t.name(), t.const_value()));
}
// specific overrides for attributes - not name value pairs so we
// want to trap them before the above "fall through"
// since we don't want to see these in the output - make them no-ops.