From b590b12a2f48f93d92a71d4fac2f2711189ce4ef Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 10 Oct 2008 22:18:42 +0000 Subject: QPID-1350 - Object reference following in the QMF console API git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@703588 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/management/ManagementObject.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'cpp/src/qpid/management/ManagementObject.cpp') diff --git a/cpp/src/qpid/management/ManagementObject.cpp b/cpp/src/qpid/management/ManagementObject.cpp index b31fff83ae..09abbeb0ca 100644 --- a/cpp/src/qpid/management/ManagementObject.cpp +++ b/cpp/src/qpid/management/ManagementObject.cpp @@ -57,15 +57,26 @@ ObjectId::ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq, uint64_ ObjectId::ObjectId(std::istream& in) : agent(0) { -#define FIELDS 5 string text; + in >> text; + fromString(text); +} + +ObjectId::ObjectId(const string& text) : agent(0) +{ + fromString(text); +} + +void ObjectId::fromString(const string& text) +{ +#define FIELDS 5 + string copy(text.c_str()); char* cText; char* field[FIELDS]; bool atFieldStart = true; int idx = 0; - in >> text; - cText = const_cast(text.c_str()); + cText = const_cast(copy.c_str()); for (char* cursor = cText; *cursor; cursor++) { if (atFieldStart) { if (idx >= FIELDS) @@ -90,6 +101,7 @@ ObjectId::ObjectId(std::istream& in) : agent(0) second = atoll(field[4]); } + bool ObjectId::operator==(const ObjectId &other) const { uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL; -- cgit v1.2.1