diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-23 11:32:38 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-23 11:32:38 +0000 |
commit | a7ace0984d67e689d54cc0b1c6e1519fc210a0ee (patch) | |
tree | 35f2da6ba644f9f72dddedb48b9b9bc2464a4843 /document | |
parent | a97fc5b65d2a733fe27e7aac8f2dcfafb3bfc5ba (diff) |
Avoid inlining the iostream stuff.
Diffstat (limited to 'document')
7 files changed, 39 insertions, 37 deletions
diff --git a/document/src/vespa/document/annotation/annotation.cpp b/document/src/vespa/document/annotation/annotation.cpp index f978732f366..86628741816 100644 --- a/document/src/vespa/document/annotation/annotation.cpp +++ b/document/src/vespa/document/annotation/annotation.cpp @@ -30,4 +30,12 @@ Annotation::toString() const { return os.str(); } +bool +Annotation::operator==(const Annotation &a2) const { + return (getType() == a2.getType() && + !(!!getFieldValue() ^ !!a2.getFieldValue()) && + (!getFieldValue() || (*getFieldValue() == *a2.getFieldValue())) + ); +} + } // namespace document diff --git a/document/src/vespa/document/annotation/annotation.h b/document/src/vespa/document/annotation/annotation.h index 6f64df1227e..8f1c6962d01 100644 --- a/document/src/vespa/document/annotation/annotation.h +++ b/document/src/vespa/document/annotation/annotation.h @@ -29,6 +29,8 @@ public: void setSpanNode(const SpanNode &node) { _node = &node; } template <typename T> void setFieldValue(std::unique_ptr<T> value) { _value.reset(value.release()); } + bool operator==(const Annotation &a2) const; + const SpanNode *getSpanNode() const { return _node; } const AnnotationType &getType() const { return *_type; } @@ -38,14 +40,6 @@ public: vespalib::string toString() const; }; -inline bool operator==(const Annotation &a1, const Annotation &a2) { - return (a1.getType() == a2.getType() && - !(!!a1.getFieldValue() ^ !!a2.getFieldValue()) && - (!a1.getFieldValue() || - (*a1.getFieldValue() == *a2.getFieldValue())) - ); -} - std::ostream & operator << (std::ostream & os, const Annotation & span); } // namespace document diff --git a/document/src/vespa/document/datatype/annotationtype.h b/document/src/vespa/document/datatype/annotationtype.h index ba0c3519ba2..860c132196d 100644 --- a/document/src/vespa/document/datatype/annotationtype.h +++ b/document/src/vespa/document/datatype/annotationtype.h @@ -39,11 +39,5 @@ public: static std::vector<const AnnotationType *> getDefaultAnnotationTypes(); }; -#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/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp index f0738f9eb72..dc343ee0128 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp @@ -269,7 +269,17 @@ FieldValue::createArray(const DataType & baseType) } } +bool operator != (const FieldValue::LP & a, const FieldValue::LP & b) { return *a != *b; } +bool operator < (const FieldValue::LP & a, const FieldValue::LP & b) { return *a < *b; } +std::ostream& operator<<(std::ostream& out, const FieldValue & p) { + p.print(out); + return out; +} +XmlOutputStream & operator<<(XmlOutputStream & out, const FieldValue & p) { + p.printXml(out); + return out; +} } // document diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h index dc79743d7e7..34d77364d85 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.h +++ b/document/src/vespa/document/fieldvalue/fieldvalue.h @@ -318,19 +318,12 @@ private: IteratorHandler & handler) const; }; -inline bool operator != (const FieldValue::LP & a, const FieldValue::LP & b) { return *a != *b; } -inline bool operator < (const FieldValue::LP & a, const FieldValue::LP & b) { return *a < *b; } +bool operator != (const FieldValue::LP & a, const FieldValue::LP & b); +bool operator < (const FieldValue::LP & a, const FieldValue::LP & b); -inline std::ostream& operator<<(std::ostream& out, const FieldValue & p) { - p.print(out); - return out; -} - -inline XmlOutputStream & operator<<(XmlOutputStream & out, const FieldValue & p) { - p.printXml(out); - return out; -} +std::ostream& operator<<(std::ostream& out, const FieldValue & p); +XmlOutputStream & operator<<(XmlOutputStream & out, const FieldValue & p); } // document diff --git a/document/src/vespa/document/select/orderingspecification.cpp b/document/src/vespa/document/select/orderingspecification.cpp index f42c057de25..7188c339beb 100644 --- a/document/src/vespa/document/select/orderingspecification.cpp +++ b/document/src/vespa/document/select/orderingspecification.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> #include "orderingspecification.h" -#include <sstream> +#include <vespa/vespalib/stllike/asciistream.h> namespace document { @@ -10,11 +10,18 @@ OrderingSpecification::operator==(const OrderingSpecification& other) const { return _order == other._order && _orderingStart == other._orderingStart && _widthBits == other._widthBits && _divisionBits == other._divisionBits; } -std::string +vespalib::string OrderingSpecification::toString() const { - std::ostringstream ost; + vespalib::asciistream ost; ost << (_order == ASCENDING ? "+" : "-") << "," << _widthBits << "," << _divisionBits << "," << _orderingStart; return ost.str(); } +std::ostream& +operator<<(std::ostream& out, const OrderingSpecification& o) +{ + out << o.toString(); + return out; +} + } diff --git a/document/src/vespa/document/select/orderingspecification.h b/document/src/vespa/document/select/orderingspecification.h index 0fa64862fa0..1d7ea84f86e 100644 --- a/document/src/vespa/document/select/orderingspecification.h +++ b/document/src/vespa/document/select/orderingspecification.h @@ -2,7 +2,7 @@ #pragma once #include <vespa/fastos/types.h> -#include <string> +#include <vespa/vespalib/stllike/string.h> namespace document { @@ -28,7 +28,7 @@ public: bool operator==(const OrderingSpecification& other) const; - std::string toString() const; + vespalib::string toString() const; private: Order _order; @@ -37,11 +37,7 @@ private: uint16_t _divisionBits; }; -inline std::ostream& -operator<<(std::ostream& out, const OrderingSpecification& o) -{ - out << o.toString(); - return out; -} -} +std::ostream& +operator<<(std::ostream& out, const OrderingSpecification& o); +} |