diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-30 21:44:44 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-12 02:55:41 +0100 |
commit | 488290a83e01cb50029e2c14e02fc7c4bd996aab (patch) | |
tree | 9aa2bb8a7bc7361c799b003f7ab188fb1a83d0f3 /document | |
parent | 602bb910df6998d0f7c56a67d2707c9c6c2e7d58 (diff) |
Targeted include and cast to avoid template generation.
Diffstat (limited to 'document')
-rw-r--r-- | document/src/tests/datatype/datatype_test.cpp | 5 | ||||
-rw-r--r-- | document/src/tests/documentselectparsertest.cpp | 16 | ||||
-rw-r--r-- | document/src/tests/documenttestcase.cpp | 14 | ||||
-rw-r--r-- | document/src/tests/testbytebuffer.cpp | 4 | ||||
-rw-r--r-- | document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp | 4 |
5 files changed, 20 insertions, 23 deletions
diff --git a/document/src/tests/datatype/datatype_test.cpp b/document/src/tests/datatype/datatype_test.cpp index d084e4f90ef..07a660a5e97 100644 --- a/document/src/tests/datatype/datatype_test.cpp +++ b/document/src/tests/datatype/datatype_test.cpp @@ -1,15 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for datatype. -#include <vespa/log/log.h> -LOG_SETUP("datatype_test"); -#include <vespa/fastos/fastos.h> - #include <vespa/document/base/field.h> #include <vespa/document/datatype/arraydatatype.h> #include <vespa/document/datatype/structdatatype.h> #include <vespa/document/fieldvalue/longfieldvalue.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/exceptions.h> using namespace document; diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp index 4effb161ef1..389f33f4765 100644 --- a/document/src/tests/documentselectparsertest.cpp +++ b/document/src/tests/documentselectparsertest.cpp @@ -165,17 +165,17 @@ DocumentSelectParserTest::createDocs() { StructFieldValue sval(_doc.back()->getField("mystruct").getDataType()); sval.set("key", 14); - sval.set("value", "structval"); + sval.set("value", (const char *)"structval"); _doc.back()->setValue("mystruct", sval); ArrayFieldValue aval(_doc.back()->getField("structarray").getDataType()); { StructFieldValue sval1(aval.getNestedType()); sval1.set("key", 15); - sval1.set("value", "structval1"); + sval1.set("value", (const char *)"structval1"); StructFieldValue sval2(aval.getNestedType()); sval2.set("key", 16); - sval2.set("value", "structval2"); + sval2.set("value", (const char *)"structval2"); aval.add(sval1); aval.add(sval2); } @@ -187,19 +187,17 @@ DocumentSelectParserTest::createDocs() mval.put(document::IntFieldValue(7), document::StringFieldValue("c")); _doc.back()->setValue("mymap", mval); - MapFieldValue - amval(_doc.back()->getField("structarrmap").getDataType()); + MapFieldValue amval(_doc.back()->getField("structarrmap").getDataType()); amval.put(StringFieldValue("foo"), aval); - ArrayFieldValue - abval(_doc.back()->getField("structarray").getDataType()); + ArrayFieldValue abval(_doc.back()->getField("structarray").getDataType()); { StructFieldValue sval1(aval.getNestedType()); sval1.set("key", 17); - sval1.set("value", "structval3"); + sval1.set("value", (const char *)"structval3"); StructFieldValue sval2(aval.getNestedType()); sval2.set("key", 18); - sval2.set("value", "structval4"); + sval2.set("value", (const char *)"structval4"); abval.add(sval1); abval.add(sval2); } diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index c42697843db..1af696e53ac 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -1,6 +1,5 @@ // 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 <vespa/document/base/testdocman.h> #include <vespa/document/base/testdocrepo.h> #include <vespa/document/fieldvalue/fieldvalues.h> @@ -17,6 +16,7 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/test_kit.h> #include <fstream> +#include <vespa/document/util/serializableexceptions.h> using vespalib::nbostream; @@ -719,14 +719,14 @@ void DocumentTest::testReadSerializedAllVersions() DocumentId("doc:serializetest:http://test.doc.id/")); doc.set("intfield", 5); doc.set("floatfield", -9.23); - doc.set("stringfield", "This is a string."); + doc.set("stringfield", (const char *)"This is a string."); doc.set("longfield", static_cast<int64_t>(398420092938472983LL)); doc.set("doublefield", 98374532.398820); doc.set("bytefield", -2); doc.setValue("rawfield", RawFieldValue("RAW DATA", 8)); Document docInDoc(*docInDocType, DocumentId("doc:serializetest:http://doc.in.doc/")); - docInDoc.set("stringindocfield", "Elvis is dead"); + docInDoc.set("stringindocfield", (const char *)"Elvis is dead"); //docInDoc.setCompression(CompressionConfig(CompressionConfig::NONE, 0, 0)); doc.setValue("docfield", docInDoc); ArrayFieldValue floatArray(*arrayOfFloatDataType); @@ -876,12 +876,12 @@ void DocumentTest::testGenerateSerializedFile() doc.set("intfield", 5); doc.set("floatfield", -9.23); - doc.set("stringfield", "This is a string."); + doc.set("stringfield", (const char *)"This is a string."); doc.set("longfield", (int64_t) 398420092938472983ll); doc.set("doublefield", 98374532.398820); - doc.set("urifield", "http://this.is.a.test/"); + doc.set("urifield", (const char *)"http://this.is.a.test/"); doc.set("bytefield", -2); - doc.set("rawfield", "RAW DATA"); + doc.set("rawfield", (const char *)"RAW DATA"); const DocumentType *docindoc_type = repo.getDocumentType("docindoc"); CPPUNIT_ASSERT(docindoc_type); @@ -1065,7 +1065,7 @@ DocumentTest::testHasChanged() buf->setPos(0); Document doc2(test_repo.getTypeRepo(), *buf); - doc2.set("hstringval", "bla bla bla bla bla"); + doc2.set("hstringval", (const char *)"bla bla bla bla bla"); CPPUNIT_ASSERT(doc2.hasChanged()); } // Clearing value tags us changed. diff --git a/document/src/tests/testbytebuffer.cpp b/document/src/tests/testbytebuffer.cpp index b4b8eb55e95..911a15da64b 100644 --- a/document/src/tests/testbytebuffer.cpp +++ b/document/src/tests/testbytebuffer.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/* $Id$*/ - -#include <vespa/fastos/fastos.h> #include <vespa/document/util/stringutil.h> #include <vespa/document/util/bytebuffer.h> #include <vespa/document/fieldvalue/serializablearray.h> @@ -10,6 +7,7 @@ #include <iostream> #include "testbytebuffer.h" #include <vespa/vespalib/util/macro.h> +#include <vespa/document/util/bufferexceptions.h> using namespace document; diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp index 405bcb93947..9ee13c1470f 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp @@ -178,4 +178,8 @@ template void StructuredFieldValue::set(const vespalib::stringref & field, const template void StructuredFieldValue::set(const vespalib::stringref & field, const double & value); template void StructuredFieldValue::set(const vespalib::stringref & field, const ConstCharP & value); +template std::unique_ptr<MapFieldValue> StructuredFieldValue::getAs<MapFieldValue>(const Field &field) const; +template std::unique_ptr<ArrayFieldValue> StructuredFieldValue::getAs<ArrayFieldValue>(const Field &field) const; +template std::unique_ptr<WeightedSetFieldValue> StructuredFieldValue::getAs<WeightedSetFieldValue>(const Field &field) const; + } // document |