summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
commit69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch)
tree073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc
parent3467e6464beac3a162839bf7078e22e3a74d73e7 (diff)
downloadtdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz
tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc')
-rw-r--r--kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc48
1 files changed, 24 insertions, 24 deletions
diff --git a/kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc b/kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc
index 626cfa96..ccb08884 100644
--- a/kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc
+++ b/kopete/protocols/jabber/jingle/libjingle/talk/xmllite/qname.cc
@@ -28,14 +28,14 @@
#include <string>
#include "talk/base/common.h"
#include "talk/xmllite/xmlelement.h"
-#include "talk/xmllite/qname.h"
+#include "talk/xmllite/tqname.h"
#include "talk/xmllite/xmlconstants.h"
//#define new TRACK_NEW
namespace buzz {
-static int QName_Hash(const std::string & ns, const char * local) {
+static int TQName_Hash(const std::string & ns, const char * local) {
int result = ns.size() * 101;
while (*local) {
result *= 19;
@@ -46,20 +46,20 @@ static int QName_Hash(const std::string & ns, const char * local) {
}
static const int bits = 9;
-static QName::Data * get_qname_table() {
- static QName::Data qname_table[1 << bits];
+static TQName::Data * get_qname_table() {
+ static TQName::Data qname_table[1 << bits];
return qname_table;
}
-static QName::Data *
+static TQName::Data *
AllocateOrFind(const std::string & ns, const char * local) {
- int index = QName_Hash(ns, local);
+ int index = TQName_Hash(ns, local);
int increment = index >> (bits - 1) | 1;
- QName::Data * qname_table = get_qname_table();
+ TQName::Data * qname_table = get_qname_table();
for (;;) {
index &= ((1 << bits) - 1);
if (!qname_table[index].Occupied()) {
- return new QName::Data(ns, local);
+ return new TQName::Data(ns, local);
}
if (qname_table[index].localPart_ == local &&
qname_table[index].namespace_ == ns) {
@@ -70,11 +70,11 @@ AllocateOrFind(const std::string & ns, const char * local) {
}
}
-static QName::Data *
+static TQName::Data *
Add(const std::string & ns, const char * local) {
- int index = QName_Hash(ns, local);
+ int index = TQName_Hash(ns, local);
int increment = index >> (bits - 1) | 1;
- QName::Data * qname_table = get_qname_table();
+ TQName::Data * qname_table = get_qname_table();
for (;;) {
index &= ((1 << bits) - 1);
if (!qname_table[index].Occupied()) {
@@ -93,25 +93,25 @@ Add(const std::string & ns, const char * local) {
}
}
-QName::~QName() {
+TQName::~TQName() {
data_->Release();
}
-QName::QName() : data_(QN_EMPTY.data_) {
+TQName::TQName() : data_(TQN_EMPTY.data_) {
data_->AddRef();
}
-QName::QName(bool add, const std::string & ns, const char * local) :
+TQName::TQName(bool add, const std::string & ns, const char * local) :
data_(add ? Add(ns, local) : AllocateOrFind(ns, local)) {}
-QName::QName(bool add, const std::string & ns, const std::string & local) :
+TQName::TQName(bool add, const std::string & ns, const std::string & local) :
data_(add ? Add(ns, local.c_str()) : AllocateOrFind(ns, local.c_str())) {}
-QName::QName(const std::string & ns, const char * local) :
+TQName::TQName(const std::string & ns, const char * local) :
data_(AllocateOrFind(ns, local)) {}
static std::string
-QName_LocalPart(const std::string & name) {
+TQName_LocalPart(const std::string & name) {
size_t i = name.rfind(':');
if (i == std::string::npos)
return name;
@@ -119,19 +119,19 @@ QName_LocalPart(const std::string & name) {
}
static std::string
-QName_Namespace(const std::string & name) {
+TQName_Namespace(const std::string & name) {
size_t i = name.rfind(':');
if (i == std::string::npos)
return STR_EMPTY;
return name.substr(0, i);
}
-QName::QName(const std::string & mergedOrLocal) :
- data_(AllocateOrFind(QName_Namespace(mergedOrLocal),
- QName_LocalPart(mergedOrLocal).c_str())) {}
+TQName::TQName(const std::string & mergedOrLocal) :
+ data_(AllocateOrFind(TQName_Namespace(mergedOrLocal),
+ TQName_LocalPart(mergedOrLocal).c_str())) {}
std::string
-QName::Merged() const {
+TQName::Merged() const {
if (data_->namespace_ == STR_EMPTY)
return data_->localPart_;
@@ -143,14 +143,14 @@ QName::Merged() const {
}
bool
-QName::operator==(const QName & other) const {
+TQName::operator==(const TQName & other) const {
return other.data_ == data_ ||
data_->localPart_ == other.data_->localPart_ &&
data_->namespace_ == other.data_->namespace_;
}
int
-QName::Compare(const QName & other) const {
+TQName::Compare(const TQName & other) const {
if (data_ == other.data_)
return 0;