Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: third_party/libjingle_xmpp/xmllite/qname.cc

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Explicitly use webrtc_overrides/webrtc/base/logging.h Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libjingle_xmpp/xmllite/qname.h ('k') | third_party/libjingle_xmpp/xmllite/qname_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libjingle_xmpp/xmllite/qname.cc
diff --git a/third_party/libjingle_xmpp/xmllite/qname.cc b/third_party/libjingle_xmpp/xmllite/qname.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dee940932f494509e8d7d5d26eb7e46ab8241aef
--- /dev/null
+++ b/third_party/libjingle_xmpp/xmllite/qname.cc
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "third_party/libjingle_xmpp/xmllite/qname.h"
+
+namespace buzz {
+
+QName::QName() {
+}
+
+QName::QName(const QName& qname)
+ : namespace_(qname.namespace_),
+ local_part_(qname.local_part_) {
+}
+
+QName::QName(const StaticQName& const_value)
+ : namespace_(const_value.ns),
+ local_part_(const_value.local) {
+}
+
+QName::QName(const std::string& ns, const std::string& local)
+ : namespace_(ns),
+ local_part_(local) {
+}
+
+QName::QName(const std::string& merged_or_local) {
+ size_t i = merged_or_local.rfind(':');
+ if (i == std::string::npos) {
+ local_part_ = merged_or_local;
+ } else {
+ namespace_ = merged_or_local.substr(0, i);
+ local_part_ = merged_or_local.substr(i + 1);
+ }
+}
+
+QName::~QName() {
+}
+
+std::string QName::Merged() const {
+ if (namespace_[0] == '\0')
+ return local_part_;
+
+ std::string result;
+ result.reserve(namespace_.length() + 1 + local_part_.length());
+ result += namespace_;
+ result += ':';
+ result += local_part_;
+ return result;
+}
+
+bool QName::IsEmpty() const {
+ return namespace_.empty() && local_part_.empty();
+}
+
+int QName::Compare(const StaticQName& other) const {
+ int result = local_part_.compare(other.local);
+ if (result != 0)
+ return result;
+
+ return namespace_.compare(other.ns);
+}
+
+int QName::Compare(const QName& other) const {
+ int result = local_part_.compare(other.local_part_);
+ if (result != 0)
+ return result;
+
+ return namespace_.compare(other.namespace_);
+}
+
+} // namespace buzz
« no previous file with comments | « third_party/libjingle_xmpp/xmllite/qname.h ('k') | third_party/libjingle_xmpp/xmllite/qname_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698