From 31b183ac653e9ba1e19cbc9b9292e36c660bcb24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 28 May 2011 12:21:15 +0100 Subject: [PATCH] Unify Bitmask::Pair with BitmaskVal. --- gui/apitracecall.cpp | 6 +++--- trace_model.cpp | 8 ++++---- trace_model.hpp | 5 +++-- trace_parser.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp index 6570368..b7694f4 100644 --- a/gui/apitracecall.cpp +++ b/gui/apitracecall.cpp @@ -166,11 +166,11 @@ void ApiBitmask::init(const Trace::Bitmask *bitmask) m_value = bitmask->value; for (Trace::Bitmask::Signature::const_iterator it = bitmask->sig->begin(); it != bitmask->sig->end(); ++it) { - assert(it->second); + assert(it->value); QPair pair; - pair.first = QString::fromStdString(it->first); - pair.second = it->second; + pair.first = QString::fromStdString(it->name); + pair.second = it->value; m_sig.append(pair); } diff --git a/trace_model.cpp b/trace_model.cpp index 75ad9e3..0d2915f 100644 --- a/trace_model.cpp +++ b/trace_model.cpp @@ -258,13 +258,13 @@ public: const Bitmask::Signature *sig = bitmask->sig; bool first = true; for (Bitmask::Signature::const_iterator it = sig->begin(); value != 0 && it != sig->end(); ++it) { - if ((it->second && (value & it->second) == it->second) || - (!it->second && value == 0)) { + if ((it->value && (value & it->value) == it->value) || + (!it->value && value == 0)) { if (!first) { os << " | "; } - os << literal << it->first << normal; - value &= ~it->second; + os << literal << it->name << normal; + value &= ~it->value; first = false; } } diff --git a/trace_model.hpp b/trace_model.hpp index 1864b03..a942ac9 100644 --- a/trace_model.hpp +++ b/trace_model.hpp @@ -38,6 +38,8 @@ #include #include +#include "trace_writer.hpp" + namespace Trace { @@ -190,8 +192,7 @@ public: class Bitmask : public UInt { public: - typedef std::pair Pair; - typedef std::vector Signature; + typedef std::vector Signature; Bitmask(const Signature *_sig, unsigned long long _value) : UInt(_value), sig(_sig) {} diff --git a/trace_parser.cpp b/trace_parser.cpp index e615ed7..17682bd 100644 --- a/trace_parser.cpp +++ b/trace_parser.cpp @@ -328,10 +328,10 @@ Value *Parser::parse_bitmask() { size_t size = read_uint(); sig = new Bitmask::Signature(size); for (Bitmask::Signature::iterator it = sig->begin(); it != sig->end(); ++it) { - it->first = read_string(); - it->second = read_uint(); - if (it->second == 0 && it != sig->begin()) { - std::cerr << "warning: bitmask " << it->first << " is zero but is not first flag\n"; + it->name = read_string(); + it->value = read_uint(); + if (it->value == 0 && it != sig->begin()) { + std::cerr << "warning: bitmask " << it->name << " is zero but is not first flag\n"; } } bitmasks[id] = sig; -- 2.43.0