1 #ifndef ROSE_BitFlags_H
2 #define ROSE_BitFlags_H
4 #include <rosePublicConfig.h>
5 #include <boost/format.hpp>
6 #include <boost/serialization/access.hpp>
7 #include <Sawyer/Assert.h>
8 #include <Sawyer/BitFlags.h>
58 template<
typename E,
typename V =
int64_t>
79 std::string
toString(std::vector<int64_t> constants,
const char*(*stringifier)(int64_t))
const {
81 if (this->
vector() != Vector(0)) {
83 std::vector<Enum> members = this->
split(constants, leftovers );
84 for (Enum member: members) {
85 const char *name = stringifier(member);
86 ASSERT_not_null(name);
87 retval += std::string(retval.empty()?
"":
"|") + name;
89 if (leftovers != Vector(0))
90 retval += retval.empty()?
"":
"|" + (boost::format(
"%lx") % (
unsigned long)leftovers).str();
92 if (
const char* name = stringifier(0)) {