summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-11-23 09:43:32 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-11-23 09:43:32 +0000
commita97fc5b65d2a733fe27e7aac8f2dcfafb3bfc5ba (patch)
treefe6838a76566f776ebfe41dac18fb1eb0d1e434e /document
parent7910e750249203f69df10838499ae0263e813f20 (diff)
Avoid exposure to istream and eliminate inlined variants.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/bucket/bucket.cpp11
-rw-r--r--document/src/vespa/document/bucket/bucket.h6
-rw-r--r--document/src/vespa/document/bucket/bucketid.cpp12
-rw-r--r--document/src/vespa/document/bucket/bucketid.h3
-rw-r--r--document/src/vespa/document/bucket/bucketspace.cpp12
-rw-r--r--document/src/vespa/document/bucket/bucketspace.h5
-rw-r--r--document/src/vespa/document/datatype/annotationtype.h16
-rw-r--r--document/src/vespa/document/select/compare.cpp4
-rw-r--r--document/src/vespa/document/select/valuenode.cpp2
9 files changed, 16 insertions, 55 deletions
diff --git a/document/src/vespa/document/bucket/bucket.cpp b/document/src/vespa/document/bucket/bucket.cpp
index e4227298740..b71c0f9f7f6 100644
--- a/document/src/vespa/document/bucket/bucket.cpp
+++ b/document/src/vespa/document/bucket/bucket.cpp
@@ -1,7 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bucket.h"
-#include <iomanip>
namespace document {
@@ -12,19 +11,9 @@ vespalib::string Bucket::toString() const
return os.str();
}
-void Bucket::print(std::ostream& os) const
-{
- os << toString();
-}
-
vespalib::asciistream& operator<<(vespalib::asciistream& os, const Bucket& id)
{
return os << "Bucket(" << id.getBucketSpace() << ", " << id.getBucketId() << ")";
}
-std::ostream& operator<<(std::ostream& os, const Bucket& id)
-{
- return os << id.toString();
-}
-
}
diff --git a/document/src/vespa/document/bucket/bucket.h b/document/src/vespa/document/bucket/bucket.h
index cc7aceb4ea7..4ad5648b8bf 100644
--- a/document/src/vespa/document/bucket/bucket.h
+++ b/document/src/vespa/document/bucket/bucket.h
@@ -7,7 +7,6 @@
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <cstdint>
-#include <iostream>
namespace document {
@@ -30,7 +29,7 @@ public:
BucketSpace getBucketSpace() const noexcept { return _bucketSpace; }
BucketId getBucketId() const noexcept { return _bucketId; }
- void print(std::ostream& os) const;
+ //void print(std::ostream& os) const;
vespalib::string toString() const;
struct hash {
@@ -46,7 +45,6 @@ private:
BucketId _bucketId;
};
-std::ostream& operator<<(std::ostream&, const Bucket&);
vespalib::asciistream& operator<<(vespalib::asciistream&, const Bucket&);
-} \ No newline at end of file
+}
diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp
index 520d3675982..bbb5dede812 100644
--- a/document/src/vespa/document/bucket/bucketid.cpp
+++ b/document/src/vespa/document/bucket/bucketid.cpp
@@ -67,12 +67,6 @@ BucketId::getStripMasks()
std::vector<BucketId::Type> BucketId::_usedMasks = getUsedMasks();
std::vector<BucketId::Type> BucketId::_stripMasks = getStripMasks();
-void
-BucketId::print(std::ostream& out) const
-{
- out << toString();
-}
-
vespalib::string
BucketId::toString() const
{
@@ -134,11 +128,9 @@ vespalib::asciistream& operator<<(vespalib::asciistream& os, const BucketId& id)
std::ostream& operator<<(std::ostream& os, const BucketId& id)
{
- id.print(os);
- return os;
+ return os << id.toString();
}
-
nbostream &
operator<<(nbostream &os, const BucketId &bucketId)
{
@@ -146,7 +138,6 @@ operator<<(nbostream &os, const BucketId &bucketId)
return os;
}
-
nbostream &
operator>>(nbostream &is, BucketId &bucketId)
{
@@ -154,5 +145,4 @@ operator>>(nbostream &is, BucketId &bucketId)
return is;
}
-
} // document
diff --git a/document/src/vespa/document/bucket/bucketid.h b/document/src/vespa/document/bucket/bucketid.h
index 15d02958746..54f7082709e 100644
--- a/document/src/vespa/document/bucket/bucketid.h
+++ b/document/src/vespa/document/bucket/bucketid.h
@@ -64,7 +64,6 @@ public:
bool operator==(const BucketId& id) const { return getId() == id.getId(); }
bool operator!=(const BucketId& id) const { return getId() != id.getId(); }
- void print(std::ostream& out) const;
vespalib::string toString() const;
bool valid() const {
@@ -194,7 +193,7 @@ private:
friend vespalib::nbostream& operator>>(vespalib::nbostream&, BucketId&);
};
-std::ostream& operator<<(std::ostream&, const BucketId&);
vespalib::asciistream& operator<<(vespalib::asciistream&, const BucketId&);
+std::ostream& operator<<(std::ostream&, const BucketId&);
} // document
diff --git a/document/src/vespa/document/bucket/bucketspace.cpp b/document/src/vespa/document/bucket/bucketspace.cpp
index c29d229208f..68d6f7c97a2 100644
--- a/document/src/vespa/document/bucket/bucketspace.cpp
+++ b/document/src/vespa/document/bucket/bucketspace.cpp
@@ -1,10 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bucketspace.h"
-#include <iomanip>
namespace document {
-
vespalib::string BucketSpace::toString() const
{
vespalib::asciistream os;
@@ -12,11 +10,6 @@ vespalib::string BucketSpace::toString() const
return os.str();
}
-void BucketSpace::print(std::ostream& os) const
-{
- os << toString();
-}
-
vespalib::asciistream& operator<<(vespalib::asciistream& os, const BucketSpace& id)
{
vespalib::asciistream::StateSaver stateSaver(os);
@@ -26,9 +19,4 @@ vespalib::asciistream& operator<<(vespalib::asciistream& os, const BucketSpace&
<< ")";
}
-std::ostream& operator<<(std::ostream& os, const BucketSpace& id)
-{
- return os << id.toString();
}
-
-} \ No newline at end of file
diff --git a/document/src/vespa/document/bucket/bucketspace.h b/document/src/vespa/document/bucket/bucketspace.h
index a78004b271b..d0b31fc65ac 100644
--- a/document/src/vespa/document/bucket/bucketspace.h
+++ b/document/src/vespa/document/bucket/bucketspace.h
@@ -6,7 +6,6 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <cstdint>
#include <functional>
-#include <iostream>
namespace document {
@@ -18,12 +17,11 @@ public:
BucketSpace& operator=(const BucketSpace&) noexcept = default;
explicit BucketSpace(Type id) noexcept : _id(id) {}
- bool operator<(const BucketSpace& bucket) const noexcept { return _id < bucket._id; }
+ bool operator <(const BucketSpace& bucket) const noexcept { return _id < bucket._id; }
bool operator==(const BucketSpace& bucket) const noexcept { return _id == bucket._id; }
bool operator!=(const BucketSpace& bucket) const noexcept { return _id != bucket._id; }
Type getId() const noexcept { return _id; }
- void print(std::ostream& out) const;
vespalib::string toString() const;
struct hash {
@@ -35,7 +33,6 @@ private:
Type _id;
};
-std::ostream& operator<<(std::ostream&, const BucketSpace&);
vespalib::asciistream& operator<<(vespalib::asciistream&, const BucketSpace&);
}
diff --git a/document/src/vespa/document/datatype/annotationtype.h b/document/src/vespa/document/datatype/annotationtype.h
index 637bd185f74..ba0c3519ba2 100644
--- a/document/src/vespa/document/datatype/annotationtype.h
+++ b/document/src/vespa/document/datatype/annotationtype.h
@@ -25,6 +25,12 @@ public:
const vespalib::string & getName() const { return _name; }
int getId() const { return _id; }
const DataType *getDataType() const { return _type; }
+ bool operator==(const AnnotationType &a2) const {
+ return getId() != a2.getId() && getName() == a2.getName();
+ }
+ bool operator!=(const AnnotationType &a2) const {
+ return *this != a2;
+ }
static const AnnotationType *const TERM;
static const AnnotationType *const TOKEN_TYPE;
@@ -33,17 +39,11 @@ public:
static std::vector<const AnnotationType *> getDefaultAnnotationTypes();
};
-inline bool operator==(const AnnotationType &a1, const AnnotationType &a2) {
- return a1.getId() == a2.getId() && a1.getName() == a2.getName();
-}
-
-inline bool operator!=(const AnnotationType &a1, const AnnotationType &a2) {
- return !(a1 == a2);
-}
-
+#if 0
inline std::ostream &operator<<(std::ostream &out, const AnnotationType &a) {
return out << "AnnotationType(" << a.getId() << ", " << a.getName() << ")";
}
+#endif
} // namespace document
diff --git a/document/src/vespa/document/select/compare.cpp b/document/src/vespa/document/select/compare.cpp
index d4cddd47be3..473c7f2c810 100644
--- a/document/src/vespa/document/select/compare.cpp
+++ b/document/src/vespa/document/select/compare.cpp
@@ -102,9 +102,9 @@ namespace {
resultList = !resultList;
}
- out << "Checked if " << b << " is ";
+ out << "Checked if " << b.toString() << " is ";
if (op == FunctionOperator::NE) { out << "not "; }
- out << "contained in " << s
+ out << "contained in " << s.toString()
<< ". Result was " << resultList << ".\n";
return resultList;
} else {
diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp
index 70dd075fdac..25842af21c7 100644
--- a/document/src/vespa/document/select/valuenode.cpp
+++ b/document/src/vespa/document/select/valuenode.cpp
@@ -587,7 +587,7 @@ IdValueNode::traceValue(const DocumentId& id, std::ostream& out) const
std::unique_ptr<Value> result(
new IntegerValue(bucket.getId(), true));
out << "Found id.bucket specification. Resolved to "
- << bucket << ".\n";
+ << bucket.toString() << ".\n";
return result;
}
case NS: