summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/Message.cpp4
-rw-r--r--cpp/src/qpid/broker/Queue.cpp10
-rw-r--r--cpp/src/qpid/broker/XmlExchange.cpp2
-rw-r--r--cpp/src/qpid/framing/FieldTable.cpp12
-rw-r--r--cpp/src/qpid/framing/FieldTable.h9
-rw-r--r--cpp/src/qpid/management/ManagementBroker.cpp2
-rw-r--r--cpp/src/tests/FieldTable.cpp24
-rw-r--r--cpp/src/tests/MessageTest.cpp2
-rw-r--r--cpp/src/tests/QueueOptionsTest.cpp22
-rw-r--r--cpp/src/tests/topic_listener.cpp2
10 files changed, 45 insertions, 44 deletions
diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp
index 0e37dabe8a..0302bc1dbd 100644
--- a/cpp/src/qpid/broker/Message.cpp
+++ b/cpp/src/qpid/broker/Message.cpp
@@ -273,7 +273,7 @@ bool Message::isExcluded(const std::vector<std::string>& excludes) const
{
const FieldTable* headers = getApplicationHeaders();
if (headers) {
- std::string traceStr = headers->getString(X_QPID_TRACE);
+ std::string traceStr = headers->getAsString(X_QPID_TRACE);
if (traceStr.size()) {
std::vector<std::string> trace = split(traceStr, ", ");
@@ -294,7 +294,7 @@ void Message::addTraceId(const std::string& id)
sys::Mutex::ScopedLock l(lock);
if (isA<MessageTransferBody>()) {
FieldTable& headers = getProperties<MessageProperties>()->getApplicationHeaders();
- std::string trace = headers.getString(X_QPID_TRACE);
+ std::string trace = headers.getAsString(X_QPID_TRACE);
if (trace.empty()) {
headers.setString(X_QPID_TRACE, id);
} else if (trace.find(id) == std::string::npos) {
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index e608ef270b..355f822b57 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -206,7 +206,7 @@ bool Queue::acquire(const QueuedMessage& msg) {
|| (lastValueQueue && i->position == msg.position && i->payload.get() == msg.payload.get())) {
if (lastValueQueue){
const framing::FieldTable* ft = msg.payload->getApplicationHeaders();
- string key = ft->getString(qpidVQMatchProperty);
+ string key = ft->getAsString(qpidVQMatchProperty);
lvq.erase(key);
}
messages.erase(i);
@@ -461,7 +461,7 @@ void Queue::popMsg(QueuedMessage& qmsg)
{
if (lastValueQueue){
const framing::FieldTable* ft = qmsg.payload->getApplicationHeaders();
- string key = ft->getString(qpidVQMatchProperty);
+ string key = ft->getAsString(qpidVQMatchProperty);
lvq.erase(key);
}
messages.pop_front();
@@ -478,7 +478,7 @@ void Queue::push(boost::intrusive_ptr<Message>& msg){
LVQ::iterator i;
if (lastValueQueue){
const framing::FieldTable* ft = msg->getApplicationHeaders();
- string key = ft->getString(qpidVQMatchProperty);
+ string key = ft->getAsString(qpidVQMatchProperty);
i = lvq.find(key);
if (i == lvq.end()){
@@ -625,8 +625,8 @@ void Queue::configure(const FieldTable& _settings)
persistLastNode= _settings.get(qpidPersistLastNode);
if (persistLastNode) QPID_LOG(debug, "Configured queue to Persist data if cluster fails to one node");
- traceId = _settings.getString(qpidTraceIdentity);
- std::string excludeList = _settings.getString(qpidTraceExclude);
+ traceId = _settings.getAsString(qpidTraceIdentity);
+ std::string excludeList = _settings.getAsString(qpidTraceExclude);
if (excludeList.size()) {
split(traceExclude, excludeList, ", ");
}
diff --git a/cpp/src/qpid/broker/XmlExchange.cpp b/cpp/src/qpid/broker/XmlExchange.cpp
index 5095e4a564..0ff5b2fdbf 100644
--- a/cpp/src/qpid/broker/XmlExchange.cpp
+++ b/cpp/src/qpid/broker/XmlExchange.cpp
@@ -78,7 +78,7 @@ XmlExchange::XmlExchange(const std::string& _name, bool _durable,
bool XmlExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable* bindingArguments)
{
- string queryText = bindingArguments->getString("xquery");
+ string queryText = bindingArguments->getAsString("xquery");
try {
RWlock::ScopedWlock l(lock);
diff --git a/cpp/src/qpid/framing/FieldTable.cpp b/cpp/src/qpid/framing/FieldTable.cpp
index 013bcd1797..cf0e03180c 100644
--- a/cpp/src/qpid/framing/FieldTable.cpp
+++ b/cpp/src/qpid/framing/FieldTable.cpp
@@ -127,18 +127,14 @@ T getValue(const FieldTable::ValuePtr value)
return value->get<T>();
}
-std::string FieldTable::getString(const std::string& name) const {
+std::string FieldTable::getAsString(const std::string& name) const {
return getValue<std::string>(get(name));
}
-int FieldTable::getInt(const std::string& name) const {
+int FieldTable::getAsInt(const std::string& name) const {
return getValue<int>(get(name));
}
-//uint64_t FieldTable::getTimestamp(const std::string& name) const {
-// return getValue<uint64_t>(name);
-//}
-
uint64_t FieldTable::getAsUInt64(const std::string& name) const {
return static_cast<uint64_t>( getValue<int64_t>(get(name)));
}
@@ -176,6 +172,10 @@ bool FieldTable::getDouble(const std::string& name, double& value) const {
return getRawFixedWidthValue<double, 8, 0x33>(get(name), value);
}
+//uint64_t FieldTable::getTimestamp(const std::string& name) const {
+// return getValue<uint64_t>(name);
+//}
+
void FieldTable::encode(Buffer& buffer) const{
buffer.putLong(encodedSize() - 4);
buffer.putLong(values.size());
diff --git a/cpp/src/qpid/framing/FieldTable.h b/cpp/src/qpid/framing/FieldTable.h
index f4f130743b..66103448a7 100644
--- a/cpp/src/qpid/framing/FieldTable.h
+++ b/cpp/src/qpid/framing/FieldTable.h
@@ -72,16 +72,17 @@ class FieldTable
void setDouble(const std::string& name, double value);
//void setDecimal(string& name, xxx& value);
- std::string getString(const std::string& name) const;
- int getInt(const std::string& name) const;
-// uint64_t getTimestamp(const std::string& name) const;
+ int getAsInt(const std::string& name) const;
uint64_t getAsUInt64(const std::string& name) const;
int64_t getAsInt64(const std::string& name) const;
+ std::string getAsString(const std::string& name) const;
+
bool getTable(const std::string& name, FieldTable& value) const;
bool getArray(const std::string& name, Array& value) const;
bool getFloat(const std::string& name, float& value) const;
bool getDouble(const std::string& name, double& value) const;
-// void getDecimal(string& name, xxx& value);
+ //bool getTimestamp(const std::string& name, uint64_t& value) const;
+ //bool getDecimal(string& name, xxx& value);
void erase(const std::string& name);
diff --git a/cpp/src/qpid/management/ManagementBroker.cpp b/cpp/src/qpid/management/ManagementBroker.cpp
index 03a9dee94a..4a9882d827 100644
--- a/cpp/src/qpid/management/ManagementBroker.cpp
+++ b/cpp/src/qpid/management/ManagementBroker.cpp
@@ -1083,7 +1083,7 @@ size_t ManagementBroker::validateTableSchema(Buffer& inBuffer)
ft.decode(inBuffer);
if (!ft.isSet("argCount"))
return 0;
- int argCount = ft.getInt("argCount");
+ int argCount = ft.getAsInt("argCount");
for (int mIdx = 0; mIdx < argCount; mIdx++) {
FieldTable aft;
aft.decode(inBuffer);
diff --git a/cpp/src/tests/FieldTable.cpp b/cpp/src/tests/FieldTable.cpp
index 415461676c..bf95cee85a 100644
--- a/cpp/src/tests/FieldTable.cpp
+++ b/cpp/src/tests/FieldTable.cpp
@@ -34,7 +34,7 @@ QPID_AUTO_TEST_CASE(testMe)
{
FieldTable ft;
ft.setString("A", "BCDE");
- BOOST_CHECK(string("BCDE") == ft.getString("A"));
+ BOOST_CHECK(string("BCDE") == ft.getAsString("A"));
char buff[100];
Buffer wbuffer(buff, 100);
@@ -43,7 +43,7 @@ QPID_AUTO_TEST_CASE(testMe)
Buffer rbuffer(buff, 100);
FieldTable ft2;
rbuffer.get(ft2);
- BOOST_CHECK(string("BCDE") == ft2.getString("A"));
+ BOOST_CHECK(string("BCDE") == ft2.getAsString("A"));
}
@@ -57,10 +57,10 @@ QPID_AUTO_TEST_CASE(testAssignment)
b = a;
a.setString("A", "CCCC");
- BOOST_CHECK(string("CCCC") == a.getString("A"));
- BOOST_CHECK(string("BBBB") == b.getString("A"));
- BOOST_CHECK_EQUAL(1234, a.getInt("B"));
- BOOST_CHECK_EQUAL(1234, b.getInt("B"));
+ BOOST_CHECK(string("CCCC") == a.getAsString("A"));
+ BOOST_CHECK(string("BBBB") == b.getAsString("A"));
+ BOOST_CHECK_EQUAL(1234, a.getAsInt("B"));
+ BOOST_CHECK_EQUAL(1234, b.getAsInt("B"));
BOOST_CHECK(IntegerValue(1234) == *a.get("B"));
BOOST_CHECK(IntegerValue(1234) == *b.get("B"));
@@ -76,10 +76,10 @@ QPID_AUTO_TEST_CASE(testAssignment)
Buffer rbuffer(buff, c.encodedSize());
rbuffer.get(d);
BOOST_CHECK_EQUAL(c, d);
- BOOST_CHECK(string("CCCC") == c.getString("A"));
+ BOOST_CHECK(string("CCCC") == c.getAsString("A"));
BOOST_CHECK(IntegerValue(1234) == *c.get("B"));
}
- BOOST_CHECK(string("CCCC") == d.getString("A"));
+ BOOST_CHECK(string("CCCC") == d.getAsString("A"));
BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
}
@@ -110,9 +110,9 @@ QPID_AUTO_TEST_CASE(testNestedValues)
FieldTable b;
Array c;
rbuffer.get(a);
- BOOST_CHECK(string("A") == a.getString("id"));
+ BOOST_CHECK(string("A") == a.getAsString("id"));
a.getTable("B", b);
- BOOST_CHECK(string("B") == b.getString("id"));
+ BOOST_CHECK(string("B") == b.getAsString("id"));
a.getArray("C", c);
std::vector<std::string> items;
c.collect(items);
@@ -141,8 +141,8 @@ QPID_AUTO_TEST_CASE(testFloatAndDouble)
Buffer rbuffer(buff, 100);
FieldTable a;
rbuffer.get(a);
- BOOST_CHECK(string("abc") == a.getString("string"));
- BOOST_CHECK(5672 == a.getInt("int"));
+ BOOST_CHECK(string("abc") == a.getAsString("string"));
+ BOOST_CHECK(5672 == a.getAsInt("int"));
float f2;
BOOST_CHECK(!a.getFloat("string", f2));
BOOST_CHECK(!a.getFloat("int", f2));
diff --git a/cpp/src/tests/MessageTest.cpp b/cpp/src/tests/MessageTest.cpp
index b5c1648caf..f9292ee53e 100644
--- a/cpp/src/tests/MessageTest.cpp
+++ b/cpp/src/tests/MessageTest.cpp
@@ -81,7 +81,7 @@ QPID_AUTO_TEST_CASE(testEncodeDecode)
BOOST_CHECK_EQUAL((uint64_t) data1.size() + data2.size(), msg->contentSize());
BOOST_CHECK_EQUAL((uint64_t) data1.size() + data2.size(), msg->getProperties<MessageProperties>()->getContentLength());
BOOST_CHECK_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
- BOOST_CHECK_EQUAL(string("xyz"), msg->getProperties<MessageProperties>()->getApplicationHeaders().getString("abc"));
+ BOOST_CHECK_EQUAL(string("xyz"), msg->getProperties<MessageProperties>()->getApplicationHeaders().getAsString("abc"));
BOOST_CHECK_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
BOOST_CHECK(msg->isPersistent());
}
diff --git a/cpp/src/tests/QueueOptionsTest.cpp b/cpp/src/tests/QueueOptionsTest.cpp
index 5c1dda697b..a662458b36 100644
--- a/cpp/src/tests/QueueOptionsTest.cpp
+++ b/cpp/src/tests/QueueOptionsTest.cpp
@@ -36,20 +36,20 @@ QPID_AUTO_TEST_CASE(testSizePolicy)
ft.setSizePolicy(REJECT,1,2);
- BOOST_CHECK(QueueOptions::strREJECT == ft.getString(QueueOptions::strTypeKey));
- BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
- BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+ BOOST_CHECK(QueueOptions::strREJECT == ft.getAsString(QueueOptions::strTypeKey));
+ BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strMaxSizeKey));
+ BOOST_CHECK(2 == ft.getAsInt(QueueOptions::strMaxCountKey));
ft.setSizePolicy(FLOW_TO_DISK,0,2);
- BOOST_CHECK(QueueOptions::strFLOW_TO_DISK == ft.getString(QueueOptions::strTypeKey));
- BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
- BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+ BOOST_CHECK(QueueOptions::strFLOW_TO_DISK == ft.getAsString(QueueOptions::strTypeKey));
+ BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strMaxSizeKey));
+ BOOST_CHECK(2 == ft.getAsInt(QueueOptions::strMaxCountKey));
ft.setSizePolicy(RING,1,0);
- BOOST_CHECK(QueueOptions::strRING == ft.getString(QueueOptions::strTypeKey));
+ BOOST_CHECK(QueueOptions::strRING == ft.getAsString(QueueOptions::strTypeKey));
ft.setSizePolicy(RING_STRICT,1,0);
- BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getString(QueueOptions::strTypeKey));
+ BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getAsString(QueueOptions::strTypeKey));
ft.clearSizePolicy();
BOOST_CHECK(!ft.isSet(QueueOptions::strTypeKey));
@@ -65,9 +65,9 @@ QPID_AUTO_TEST_CASE(testFlags)
ft.setPersistLastNode();
ft.setOrdering(LVQ);
- BOOST_CHECK(1 == ft.getInt(QueueOptions::strOptimisticConsume));
- BOOST_CHECK(1 == ft.getInt(QueueOptions::strPersistLastNode));
- BOOST_CHECK(1 == ft.getInt(QueueOptions::strLastValueQueue));
+ BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strOptimisticConsume));
+ BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strPersistLastNode));
+ BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strLastValueQueue));
ft.clearOptimisticConsume();
ft.clearPersistLastNode();
diff --git a/cpp/src/tests/topic_listener.cpp b/cpp/src/tests/topic_listener.cpp
index 636618b6dc..0da26fa2c4 100644
--- a/cpp/src/tests/topic_listener.cpp
+++ b/cpp/src/tests/topic_listener.cpp
@@ -165,7 +165,7 @@ void Listener::received(Message& message){
init = true;
cout << "Batch started." << endl;
}
- string type = message.getHeaders().getString("TYPE");
+ string type = message.getHeaders().getAsString("TYPE");
if(string("TERMINATION_REQUEST") == type){
shutdown();