diff --git a/config/src/apps/vespa-configproxy-cmd/main.cpp b/config/src/apps/vespa-configproxy-cmd/main.cpp index e5c823d8d247..efd66478a943 100644 --- a/config/src/apps/vespa-configproxy-cmd/main.cpp +++ b/config/src/apps/vespa-configproxy-cmd/main.cpp @@ -40,7 +40,7 @@ Application::parseOpts(int argc, char **argv) const Method method = methods::find(_flags.method); if (optind + method.args <= argc) { for (int i = 0; i < method.args; ++i) { - vespalib::string arg = argv[optind++]; + std::string arg = argv[optind++]; _flags.args.push_back(arg); } } else { diff --git a/config/src/apps/vespa-configproxy-cmd/methods.cpp b/config/src/apps/vespa-configproxy-cmd/methods.cpp index 51b7b70df73f..2cfba9c17e58 100644 --- a/config/src/apps/vespa-configproxy-cmd/methods.cpp +++ b/config/src/apps/vespa-configproxy-cmd/methods.cpp @@ -18,7 +18,7 @@ const Method methods[] = { { 0, 0, 0} }; -const Method find(const vespalib::string &name) { +const Method find(const std::string &name) { for (size_t i = 0; methods[i].shortName != 0; ++i) { if (name == methods[i].shortName) { return methods[i]; diff --git a/config/src/apps/vespa-configproxy-cmd/methods.h b/config/src/apps/vespa-configproxy-cmd/methods.h index bcb8edd78df4..08bf835ec1fd 100644 --- a/config/src/apps/vespa-configproxy-cmd/methods.h +++ b/config/src/apps/vespa-configproxy-cmd/methods.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include struct Method { const char *shortName; @@ -11,7 +11,7 @@ struct Method { namespace methods { -const Method find(const vespalib::string &name); +const Method find(const std::string &name); void dump(); }; diff --git a/config/src/apps/vespa-configproxy-cmd/proxycmd.cpp b/config/src/apps/vespa-configproxy-cmd/proxycmd.cpp index 33d832bd98b1..49a74c9e94df 100644 --- a/config/src/apps/vespa-configproxy-cmd/proxycmd.cpp +++ b/config/src/apps/vespa-configproxy-cmd/proxycmd.cpp @@ -56,7 +56,7 @@ void ProxyCmd::printArray(FRT_Values *rvals) { } } -vespalib::string ProxyCmd::makeSpec() { +std::string ProxyCmd::makeSpec() { return vespalib::make_string("tcp/%s:%d", _flags.targethost.c_str(), _flags.portnumber); } @@ -65,7 +65,7 @@ void ProxyCmd::autoPrint() { std::cerr << "FAILURE ["<< _req->GetMethodName() <<"]: " << _req->GetErrorMessage() << std::endl; return; } - vespalib::string retspec = _req->GetReturnSpec(); + std::string retspec = _req->GetReturnSpec(); FRT_Values *rvals = _req->GetReturn(); if (retspec == "S") { printArray(rvals); @@ -81,7 +81,7 @@ void ProxyCmd::autoPrint() { int ProxyCmd::action() { int errors = 0; initRPC(); - vespalib::string spec = makeSpec(); + std::string spec = makeSpec(); _target = _server->supervisor().GetTarget(spec.c_str()); _req->SetMethodName(_flags.method.c_str()); FRT_Values ¶ms = *_req->GetParams(); diff --git a/config/src/apps/vespa-configproxy-cmd/proxycmd.h b/config/src/apps/vespa-configproxy-cmd/proxycmd.h index 839babffe4d1..d6367962ad54 100644 --- a/config/src/apps/vespa-configproxy-cmd/proxycmd.h +++ b/config/src/apps/vespa-configproxy-cmd/proxycmd.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include +#include class FRT_Target; class FRT_RPCRequest; @@ -12,9 +12,9 @@ class FRT_Values; namespace fnet::frt { class StandaloneFRT; } struct Flags { - vespalib::string method; - std::vector args; - vespalib::string targethost; + std::string method; + std::vector args; + std::string targethost; int portnumber; Flags(const Flags &); Flags & operator=(const Flags &); @@ -34,7 +34,7 @@ class ProxyCmd void invokeRPC(); void finiRPC(); void printArray(FRT_Values *rvals); - vespalib::string makeSpec(); + std::string makeSpec(); void autoPrint(); public: ProxyCmd(const Flags& flags); diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp index bb13d4b2b410..18de70c9d52c 100644 --- a/config/src/tests/configagent/configagent.cpp +++ b/config/src/tests/configagent/configagent.cpp @@ -29,7 +29,7 @@ class MyConfigResponse : public ConfigResponse { public: MyConfigResponse(const ConfigKey & key, ConfigValue value, bool valid, int64_t timestamp, - const vespalib::string & xxhash64, const std::string & errorMsg, int errorC0de, bool iserror) + const std::string & xxhash64, const std::string & errorMsg, int errorC0de, bool iserror) : _key(key), _value(std::move(value)), _fillCalled(false), @@ -46,7 +46,7 @@ class MyConfigResponse : public ConfigResponse bool hasValidResponse() const override { return _valid; } bool validateResponse() override { return _valid; } void fill() override { _fillCalled = true; } - vespalib::string errorMessage() const override { return _errorMessage; } + std::string errorMessage() const override { return _errorMessage; } int errorCode() const override { return _errorCode; } bool isError() const override { return _isError; } const Trace & getTrace() const override { return _trace; } @@ -56,13 +56,13 @@ class MyConfigResponse : public ConfigResponse bool _fillCalled; bool _valid; const ConfigState _state; - vespalib::string _errorMessage; + std::string _errorMessage; int _errorCode; bool _isError; Trace _trace; - static std::unique_ptr createOKResponse(const ConfigKey & key, const ConfigValue & value, uint64_t timestamp = 10, const vespalib::string & xxhash64 = "a") + static std::unique_ptr createOKResponse(const ConfigKey & key, const ConfigValue & value, uint64_t timestamp = 10, const std::string & xxhash64 = "a") { return std::make_unique(key, value, true, timestamp, xxhash64, "", 0, false); } diff --git a/config/src/tests/configgen/map_inserter.cpp b/config/src/tests/configgen/map_inserter.cpp index b4e416325ad8..90e12adbc42b 100644 --- a/config/src/tests/configgen/map_inserter.cpp +++ b/config/src/tests/configgen/map_inserter.cpp @@ -21,7 +21,7 @@ struct MyType{ }; TEST("require that map of ints can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); root.setLong("foo", 3); @@ -36,7 +36,7 @@ TEST("require that map of ints can be inserted") { } TEST("require that map of struct can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); Cursor & one = root.setObject("foo"); @@ -55,7 +55,7 @@ TEST("require that map of struct can be inserted") { } TEST("require that map of long can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); root.setLong("foo", 3); @@ -70,7 +70,7 @@ TEST("require that map of long can be inserted") { } TEST("require that map of double can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); root.setDouble("foo", 3.1); @@ -85,7 +85,7 @@ TEST("require that map of double can be inserted") { } TEST("require that map of bool can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); root.setBool("foo", true); @@ -100,13 +100,13 @@ TEST("require that map of bool can be inserted") { } TEST("require that map of string can be inserted") { - std::map map; + std::map map; Slime slime; Cursor & root = slime.setObject(); root.setString("foo", "baz"); root.setString("bar", "bar"); root.setString("baz", "foo"); - MapInserter inserter(map); + MapInserter inserter(map); root.traverse(inserter); ASSERT_EQUAL(3u, map.size()); ASSERT_EQUAL("foo", map["baz"]); diff --git a/config/src/tests/configgen/vector_inserter.cpp b/config/src/tests/configgen/vector_inserter.cpp index ab999c3f9b0b..52b75f43cccd 100644 --- a/config/src/tests/configgen/vector_inserter.cpp +++ b/config/src/tests/configgen/vector_inserter.cpp @@ -117,7 +117,7 @@ verify_vector_strings_can_be_inserted(V vector) { } TEST("require that different vectors of strings can be inserted") { - verify_vector_strings_can_be_inserted(std::vector()); + verify_vector_strings_can_be_inserted(std::vector()); verify_vector_strings_can_be_inserted(StringVector()); } diff --git a/config/src/tests/configparser/configparser.cpp b/config/src/tests/configparser/configparser.cpp index f2a216ba967f..38787b5d27f4 100644 --- a/config/src/tests/configparser/configparser.cpp +++ b/config/src/tests/configparser/configparser.cpp @@ -13,7 +13,7 @@ using vespalib::asciistream; namespace { - void writeFile(const vespalib::string & fileName, const vespalib::string & data) + void writeFile(const std::string & fileName, const std::string & data) { std::ofstream of; of.open(fileName.c_str()); @@ -21,7 +21,7 @@ namespace { of.close(); } - ConfigValue readConfig(const vespalib::string & fileName) + ConfigValue readConfig(const std::string & fileName) { asciistream is(asciistream::createFromFile(fileName)); return ConfigValue(getlines(is), ""); @@ -105,7 +105,7 @@ TEST("require that array lengths may be specified") TEST("require that escaped values are properly unescaped") { StringVector payload; payload.push_back("foo \"a\\nb\\rc\\\\d\\\"e\x42g\""); - vespalib::string value(ConfigParser::parse("foo", payload)); + std::string value(ConfigParser::parse("foo", payload)); ASSERT_EQUAL("a\nb\rc\\d\"eBg", value); } diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp index c189810275ac..1b18a6fbd548 100644 --- a/config/src/tests/configretriever/configretriever.cpp +++ b/config/src/tests/configretriever/configretriever.cpp @@ -150,7 +150,7 @@ FixedPayload::~FixedPayload() = default; } -ConfigValue createKeyValueV2(const vespalib::string & key, const vespalib::string & value) +ConfigValue createKeyValueV2(const std::string & key, const std::string & value) { auto payload = std::make_unique(); payload->getData().setObject().setString(key, Memory(value)); @@ -175,7 +175,7 @@ TEST_F("require that basic retriever usage works", ConfigTestFixture("myid")) { { ConfigKeySet componentKeys; for (size_t i = 0; i < bootstrapConfig->component.size(); i++) { - const vespalib::string & configId(bootstrapConfig->component[i].configid); + const std::string & configId(bootstrapConfig->component[i].configid); componentKeys.add(configId); } configs = ret.getConfigs(componentKeys); @@ -186,7 +186,7 @@ TEST_F("require that basic retriever usage works", ConfigTestFixture("myid")) { { ConfigKeySet componentKeys; for (size_t i = 0; i < bootstrapConfig->component.size(); i++) { - const vespalib::string & configId(bootstrapConfig->component[i].configid); + const std::string & configId(bootstrapConfig->component[i].configid); componentKeys.add(configId); } configs = ret.getConfigs(componentKeys); @@ -197,7 +197,7 @@ TEST_F("require that basic retriever usage works", ConfigTestFixture("myid")) { { ConfigKeySet componentKeys; for (size_t i = 0; i < bootstrapConfig->component.size(); i++) { - const vespalib::string & configId(bootstrapConfig->component[i].configid); + const std::string & configId(bootstrapConfig->component[i].configid); componentKeys.add(configId); componentKeys.add(configId); } @@ -339,7 +339,7 @@ TEST_FF("require that getConfigs throws exception when closed", ConfigTestFixtur std::unique_ptr bootstrapConfig = configs.getConfig(f1.configId); ConfigKeySet componentKeys; for (size_t i = 0; i < bootstrapConfig->component.size(); i++) { - const vespalib::string & configId(bootstrapConfig->component[i].configid); + const std::string & configId(bootstrapConfig->component[i].configid); componentKeys.add(configId); componentKeys.add(configId); } diff --git a/config/src/tests/configuri/configuri_test.cpp b/config/src/tests/configuri/configuri_test.cpp index 08f6963ae617..5f7f7b24ad2d 100644 --- a/config/src/tests/configuri/configuri_test.cpp +++ b/config/src/tests/configuri/configuri_test.cpp @@ -28,11 +28,11 @@ TEST("Require that URI can be created from std::string") { assertConfigId("", ConfigUri(std::string("dir:."))); } -TEST("Require that URI can be created from vespalib::string") { - assertConfigId("foo/bar", ConfigUri(vespalib::string("foo/bar"))); - assertConfigId("myfile", ConfigUri(vespalib::string("file:myfile.cfg"))); - assertConfigId("", ConfigUri(vespalib::string("raw:myraw"))); - assertConfigId("", ConfigUri(vespalib::string("dir:."))); +TEST("Require that URI can be created from std::string") { + assertConfigId("foo/bar", ConfigUri(std::string("foo/bar"))); + assertConfigId("myfile", ConfigUri(std::string("file:myfile.cfg"))); + assertConfigId("", ConfigUri(std::string("raw:myraw"))); + assertConfigId("", ConfigUri(std::string("dir:."))); } TEST("Require that URI can be created from instance") { diff --git a/config/src/tests/failover/failover.cpp b/config/src/tests/failover/failover.cpp index a679b2a0ecd4..50afb85534cb 100644 --- a/config/src/tests/failover/failover.cpp +++ b/config/src/tests/failover/failover.cpp @@ -23,7 +23,7 @@ using namespace vespalib; namespace { -int get_port(const vespalib::string &spec) { +int get_port(const std::string &spec) { const char *port = (spec.data() + spec.size()); while ((port > spec.data()) && (port[-1] >= '0') && (port[-1] <= '9')) { --port; @@ -31,8 +31,8 @@ int get_port(const vespalib::string &spec) { return atoi(port); } -const vespalib::string requestTypes = "s"; -const vespalib::string responseTypes = "sx"; +const std::string requestTypes = "s"; +const std::string responseTypes = "sx"; struct RPCServer : public FRT_Invokable { vespalib::Barrier barrier; @@ -72,7 +72,7 @@ struct RPCServer : public FRT_Invokable { SimpleBuffer pbuf; JsonFormat::encode(payload, pbuf, false); - vespalib::string d = pbuf.get().make_string(); + std::string d = pbuf.get().make_string(); ret.AddData(d.c_str(), d.size()); LOG(info, "Answering..."); } @@ -94,8 +94,8 @@ struct ServerFixture { std::unique_ptr frt; RPCServer server; Barrier b; - const vespalib::string listenSpec; - ServerFixture(const vespalib::string & ls) + const std::string listenSpec; + ServerFixture(const std::string & ls) : frt(), server(), b(2), @@ -134,7 +134,7 @@ struct NetworkFixture { std::vector serverList; ServerSpec spec; bool running; - NetworkFixture(const std::vector & serverSpecs) + NetworkFixture(const std::vector & serverSpecs) : spec(serverSpecs), running(true) { for (size_t i = 0; i < serverSpecs.size(); i++) { @@ -258,7 +258,7 @@ struct ConfigReloadFixture { }; struct ThreeServersFixture { - std::vector specs; + std::vector specs; ThreeServersFixture() : specs() { specs.push_back("tcp/localhost:18590"); specs.push_back("tcp/localhost:18592"); @@ -267,7 +267,7 @@ struct ThreeServersFixture { }; struct OneServerFixture { - std::vector specs; + std::vector specs; OneServerFixture() : specs() { specs.push_back("tcp/localhost:18590"); } diff --git a/config/src/tests/file_acquirer/file_acquirer_test.cpp b/config/src/tests/file_acquirer/file_acquirer_test.cpp index 5b309a6b94bb..c6d290d234df 100644 --- a/config/src/tests/file_acquirer/file_acquirer_test.cpp +++ b/config/src/tests/file_acquirer/file_acquirer_test.cpp @@ -12,7 +12,7 @@ struct ServerFixture : FRT_Invokable { fnet::frt::StandaloneFRT server; FNET_Transport transport; FRT_Supervisor &orb; - vespalib::string spec; + std::string spec; void init_rpc() { FRT_ReflectionBuilder rb(&orb); diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index a2cad6483e95..d3dd950dd6d7 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -33,14 +33,14 @@ using namespace config::protocol::v3; namespace { struct Response { - vespalib::string defName; - vespalib::string defMd5; - vespalib::string configId; - vespalib::string configXxhash64; + std::string defName; + std::string defMd5; + std::string configId; + std::string configXxhash64; int changed; long generation; StringVector payload; - vespalib::string ns; + std::string ns; void encodeResponse(FRT_RPCRequest * req) const { FRT_Values & ret = *req->GetReturn(); @@ -108,7 +108,7 @@ struct Response { fnet::frt::StandaloneFRT server; FRT_Supervisor & supervisor; FNET_Scheduler scheduler; - vespalib::string address; + std::string address; ConnectionMock() : ConnectionMock(std::unique_ptr()) { } ConnectionMock(std::unique_ptr answer); ~ConnectionMock(); @@ -124,7 +124,7 @@ struct Response { else waiter->RequestDone(req); } - const vespalib::string & getAddress() const override { return address; } + const std::string & getAddress() const override { return address; } }; ConnectionMock::ConnectionMock(std::unique_ptr answer) @@ -257,9 +257,9 @@ TEST_FF("require that request is config task is scheduled", SourceFixture(), FRT TEST("require that v3 request is correctly initialized") { ConnectionMock conn; ConfigKey key = ConfigKey::create("foobi"); - vespalib::string xxhash64 = "myxxhash64"; + std::string xxhash64 = "myxxhash64"; int64_t currentGeneration = 3; - vespalib::string hostName = "myhost"; + std::string hostName = "myhost"; duration timeout = 3s; Trace traceIn(3); traceIn.trace(2, "Hei"); @@ -311,9 +311,9 @@ struct V3RequestFixture { Cursor & root; FRT_RPCRequest * req; ConfigKey key; - vespalib::string xxhash64; + std::string xxhash64; int64_t generation; - vespalib::string hostname; + std::string hostname; Trace traceIn; V3RequestFixture() diff --git a/config/src/tests/misc/misc.cpp b/config/src/tests/misc/misc.cpp index d12df5be66e4..d65a48b21826 100644 --- a/config/src/tests/misc/misc.cpp +++ b/config/src/tests/misc/misc.cpp @@ -186,7 +186,7 @@ TEST("require that source spec parses compression type") { TEST("require that vespa version is set") { VespaVersion vespaVersion = VespaVersion::getCurrentVersion(); - vespalib::string str = vespaVersion.toString(); + std::string str = vespaVersion.toString(); EXPECT_TRUE(str.length() > 0); } diff --git a/config/src/vespa/config/common/compressiontype.cpp b/config/src/vespa/config/common/compressiontype.cpp index 8b88cc0a62e2..c9c1b23d537e 100644 --- a/config/src/vespa/config/common/compressiontype.cpp +++ b/config/src/vespa/config/common/compressiontype.cpp @@ -3,7 +3,7 @@ namespace config { -vespalib::string +std::string compressionTypeToString(const CompressionType & compressionType) { switch (compressionType) { @@ -15,7 +15,7 @@ compressionTypeToString(const CompressionType & compressionType) } CompressionType -stringToCompressionType(const vespalib::string & type) +stringToCompressionType(const std::string & type) { if (type.compare("UNCOMPRESSED") == 0) { return CompressionType::UNCOMPRESSED; diff --git a/config/src/vespa/config/common/compressiontype.h b/config/src/vespa/config/common/compressiontype.h index 70b784b2c58b..db6e134b8d95 100644 --- a/config/src/vespa/config/common/compressiontype.h +++ b/config/src/vespa/config/common/compressiontype.h @@ -1,13 +1,13 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace config { enum class CompressionType {UNCOMPRESSED, LZ4}; -vespalib::string compressionTypeToString(const CompressionType & compressionType); -CompressionType stringToCompressionType(const vespalib::string & type); +std::string compressionTypeToString(const CompressionType & compressionType); +CompressionType stringToCompressionType(const std::string & type); } diff --git a/config/src/vespa/config/common/configdefinition.cpp b/config/src/vespa/config/common/configdefinition.cpp index 43c1369d1e24..aa2a416be911 100644 --- a/config/src/vespa/config/common/configdefinition.cpp +++ b/config/src/vespa/config/common/configdefinition.cpp @@ -32,7 +32,7 @@ ConfigDefinition::deserialize(const Inspector & inspector) } } -vespalib::string +std::string ConfigDefinition::asString() const { vespalib::asciistream as; diff --git a/config/src/vespa/config/common/configdefinition.h b/config/src/vespa/config/common/configdefinition.h index da99f57368de..f08f88b77def 100644 --- a/config/src/vespa/config/common/configdefinition.h +++ b/config/src/vespa/config/common/configdefinition.h @@ -18,7 +18,7 @@ class ConfigDefinition { ConfigDefinition(StringVector schema); void deserialize(const vespalib::slime::Inspector & inspector); void serialize(vespalib::slime::Cursor & cursor) const; - vespalib::string asString() const; + std::string asString() const; private: StringVector _schema; }; diff --git a/config/src/vespa/config/common/configkey.cpp b/config/src/vespa/config/common/configkey.cpp index 98f1a8271b46..2417c4fea310 100644 --- a/config/src/vespa/config/common/configkey.cpp +++ b/config/src/vespa/config/common/configkey.cpp @@ -55,16 +55,16 @@ ConfigKey::operator==(const ConfigKey & rhs) const return _key.compare(rhs._key) == 0; } -const vespalib::string & ConfigKey::getDefName() const { return _defName; } -const vespalib::string & ConfigKey::getConfigId() const { return _configId; } -const vespalib::string & ConfigKey::getDefNamespace() const { return _defNamespace; } -const vespalib::string & ConfigKey::getDefMd5() const { return _defMd5; } +const std::string & ConfigKey::getDefName() const { return _defName; } +const std::string & ConfigKey::getConfigId() const { return _configId; } +const std::string & ConfigKey::getDefNamespace() const { return _defNamespace; } +const std::string & ConfigKey::getDefMd5() const { return _defMd5; } const StringVector & ConfigKey::getDefSchema() const { return _defSchema; } -const vespalib::string +const std::string ConfigKey::toString() const { - vespalib::string s; + std::string s; s.append("name="); s.append(_defNamespace); s.append("."); diff --git a/config/src/vespa/config/common/configkey.h b/config/src/vespa/config/common/configkey.h index 5e525cbe0a65..b7eb0c7a641b 100644 --- a/config/src/vespa/config/common/configkey.h +++ b/config/src/vespa/config/common/configkey.h @@ -29,10 +29,10 @@ class ConfigKey { bool operator>(const ConfigKey & rhs) const; bool operator==(const ConfigKey & rhs) const; - const vespalib::string & getDefName() const; - const vespalib::string & getConfigId() const; - const vespalib::string & getDefNamespace() const; - const vespalib::string & getDefMd5() const; + const std::string & getDefName() const; + const std::string & getConfigId() const; + const std::string & getDefNamespace() const; + const std::string & getDefMd5() const; const StringVector & getDefSchema() const; template @@ -44,14 +44,14 @@ class ConfigKey { ConfigType::CONFIG_DEF_SCHEMA); } - const vespalib::string toString() const; + const std::string toString() const; private: - vespalib::string _configId; - vespalib::string _defName; - vespalib::string _defNamespace; - vespalib::string _defMd5; + std::string _configId; + std::string _defName; + std::string _defNamespace; + std::string _defMd5; StringVector _defSchema; - vespalib::string _key; + std::string _key; }; } //namespace config diff --git a/config/src/vespa/config/common/configparser.cpp b/config/src/vespa/config/common/configparser.cpp index 8007f59abb17..01fb3fc5cbad 100644 --- a/config/src/vespa/config/common/configparser.cpp +++ b/config/src/vespa/config/common/configparser.cpp @@ -4,6 +4,7 @@ #include "exceptions.h" #include "misc.h" #include +#include #include namespace config { @@ -13,8 +14,8 @@ void ConfigParser::throwNoDefaultValue(std::string_view key) { "default value and is not specified in config", VESPA_STRLOC); } -vespalib::string -ConfigParser::deQuote(const vespalib::string & source) +std::string +ConfigParser::deQuote(const std::string & source) { const char *src = source.c_str(); const char *s = src; @@ -79,13 +80,13 @@ ConfigParser::deQuote(const vespalib::string & source) } } *d = 0; - return vespalib::string(dst.data(), d - dst.data()); + return std::string(dst.data(), d - dst.data()); } namespace { bool -getValueForKey(std::string_view key, std::string_view line, vespalib::string& retval) +getValueForKey(std::string_view key, std::string_view line, std::string& retval) { if (line.length() <= key.length()) { return false; @@ -128,7 +129,7 @@ ConfigParser::getLinesForKey(std::string_view key, Cfg lines) StringVector retval; for (uint32_t i = 0; i < lines.size(); i++) { - vespalib::string value; + std::string value; if (getValueForKey(key, lines[i], value)) { retval.push_back(value); @@ -138,11 +139,11 @@ ConfigParser::getLinesForKey(std::string_view key, Cfg lines) return retval; } -std::set +std::set ConfigParser::getUniqueNonWhiteSpaceLines(Cfg config) { - std::set unique; + std::set unique; for (uint32_t i = 0; i < config.size(); i++) { - vespalib::string line = stripWhitespace(config[i]); + std::string line = stripWhitespace(config[i]); if (!line.empty()) { unique.insert(line); } @@ -152,9 +153,9 @@ ConfigParser::getUniqueNonWhiteSpaceLines(Cfg config) { void ConfigParser::stripLinesForKey(std::string_view key, - std::set& config) + std::set& config) { - vespalib::string value; + std::string value; for (auto it = config.begin(); it != config.end();) { if (getValueForKey(key, *it, value)) { it = config.erase(it); @@ -164,27 +165,27 @@ ConfigParser::stripLinesForKey(std::string_view key, } } -std::map +std::map ConfigParser::splitMap(Cfg config) { - std::map items; + std::map items; - vespalib::string lastValue; + std::string lastValue; // First line contains item count, skip that. for (uint32_t i = 0; i < config.size(); i++) { size_t pos = config[i].find("}"); if (config[i].size() < 3 || config[i][0] != '{' - || pos == vespalib::string::npos) + || pos == std::string::npos) { throw InvalidConfigException( "Value '" + config[i] + "' is not a valid map " "specification.", VESPA_STRLOC); } - vespalib::string key = deQuote(config[i].substr(1, pos - 1)); - vespalib::string value = config[i].substr(pos + 1); + std::string key = deQuote(config[i].substr(1, pos - 1)); + std::string value = config[i].substr(pos + 1); if (key != lastValue) { items[key] = StringVector(); @@ -205,22 +206,22 @@ ConfigParser::splitArray(Cfg config) { std::vector items; - vespalib::string lastValue; + std::string lastValue; // First line contains item count, skip that. for (uint32_t i = 0; i < config.size(); i++) { size_t pos = config[i].find("]"); if (config[i].size() < 3 || config[i][0] != '[' - || pos == vespalib::string::npos) + || pos == std::string::npos) { throw InvalidConfigException( "Value '" + config[i] + "' is not a valid array " "specification.", VESPA_STRLOC); } - vespalib::string key = config[i].substr(1, pos - 1); - vespalib::string value = config[i].substr(pos + 1); + std::string key = config[i].substr(1, pos - 1); + std::string value = config[i].substr(pos + 1); if (key != lastValue) { items.emplace_back(); @@ -236,12 +237,12 @@ ConfigParser::splitArray(Cfg config) return items; } -vespalib::string +std::string ConfigParser::stripWhitespace(std::string_view source) { // Remove leading spaces and return. if (source.empty()) { - return vespalib::string(source); + return std::string(source); } size_t start = 0; bool found = false; @@ -274,7 +275,7 @@ ConfigParser::stripWhitespace(std::string_view source) return std::string(source.substr(start, stop - start + 1)); } -vespalib::string +std::string ConfigParser::arrayToString(Cfg array) { vespalib::asciistream ost; @@ -296,7 +297,7 @@ ConfigParser::convert(const StringVector & config) throw InvalidConfigException("Expected single line with bool value, " "got " + arrayToString(config), VESPA_STRLOC); } - vespalib::string value = stripWhitespace(deQuote(config[0])); + std::string value = stripWhitespace(deQuote(config[0])); if (value == "true") { return true; @@ -316,7 +317,7 @@ ConfigParser::convert(const StringVector & config) throw InvalidConfigException("Expected single line with int32_t value, " "got " + arrayToString(config), VESPA_STRLOC); } - vespalib::string value(deQuote(stripWhitespace(config[0]))); + std::string value(deQuote(stripWhitespace(config[0]))); const char *startp = value.c_str(); char *endp; @@ -336,7 +337,7 @@ ConfigParser::convert(const StringVector & config) throw InvalidConfigException("Expected single line with int64_t value, " "got " + arrayToString(config), VESPA_STRLOC); } - vespalib::string value(deQuote(stripWhitespace(config[0]))); + std::string value(deQuote(stripWhitespace(config[0]))); const char *startp = value.c_str(); char *endp; @@ -356,7 +357,7 @@ ConfigParser::convert(const StringVector & config) throw InvalidConfigException("Expected single line with double value, " "got " + arrayToString(config), VESPA_STRLOC); } - vespalib::string value(deQuote(stripWhitespace(config[0]))); + std::string value(deQuote(stripWhitespace(config[0]))); const char *startp = value.c_str(); char *endp; @@ -370,15 +371,15 @@ ConfigParser::convert(const StringVector & config) } template<> -vespalib::string -ConfigParser::convert(const StringVector & config) +std::string +ConfigParser::convert(const StringVector & config) { if (config.size() != 1) { throw InvalidConfigException("Expected single line with string value, " "got " + arrayToString(config), VESPA_STRLOC); } - vespalib::string value = stripWhitespace(config[0]); + std::string value = stripWhitespace(config[0]); return deQuote(value); } diff --git a/config/src/vespa/config/common/configparser.h b/config/src/vespa/config/common/configparser.h index bd0c22b0efd7..345c2be884e7 100644 --- a/config/src/vespa/config/common/configparser.h +++ b/config/src/vespa/config/common/configparser.h @@ -16,35 +16,35 @@ class ConfigParser { public: class Cfg { public: - Cfg(const std::vector & v) + Cfg(const std::vector & v) : _cfg(v.empty() ? nullptr : &v[0]), _sz(v.size()) { } - Cfg(const std::vector> & v) : + Cfg(const std::vector> & v) : _cfg(v.empty() ? nullptr : &v[0]), _sz(v.size()) { } size_t size() const noexcept { return _sz; } - const vespalib::string & operator[] (size_t idx) const noexcept { + const std::string & operator[] (size_t idx) const noexcept { return _cfg[idx]; } private: - const vespalib::string * _cfg; + const std::string * _cfg; size_t _sz; }; private: static StringVector getLinesForKey(std::string_view key, Cfg config); static std::vector splitArray(Cfg config); - static std::map splitMap(Cfg config); + static std::map splitMap(Cfg config); - static vespalib::string deQuote(const vespalib::string & source); + static std::string deQuote(const std::string & source); static void throwNoDefaultValue(std::string_view key); template static T convert(const StringVector & config); - static vespalib::string arrayToString(Cfg config); + static std::string arrayToString(Cfg config); template static T parseInternal(std::string_view key, Cfg config); @@ -54,14 +54,14 @@ class ConfigParser { template static V parseArrayInternal(std::string_view key, Cfg config); template - static std::map parseMapInternal(std::string_view key, Cfg config); + static std::map parseMapInternal(std::string_view key, Cfg config); template static T parseStructInternal(std::string_view key, Cfg config); public: - static void stripLinesForKey(std::string_view key, std::set& config); - static std::set getUniqueNonWhiteSpaceLines(Cfg config); - static vespalib::string stripWhitespace(std::string_view source); + static void stripLinesForKey(std::string_view key, std::set& config); + static std::set getUniqueNonWhiteSpaceLines(Cfg config); + static std::string stripWhitespace(std::string_view source); template static T parse(std::string_view key, Cfg config) { @@ -78,7 +78,7 @@ class ConfigParser { } template - static std::map parseMap(std::string_view key, Cfg config) { + static std::map parseMap(std::string_view key, Cfg config) { return parseMapInternal(key, config); } @@ -121,13 +121,13 @@ ConfigParser::convert(const StringVector & lines) { } template -std::map +std::map ConfigParser::parseMapInternal(std::string_view key, Cfg config) { StringVector lines = getLinesForKey(key, config); - using SplittedMap = std::map; + using SplittedMap = std::map; SplittedMap s = splitMap(lines); - std::map retval; + std::map retval; for (const auto & e : s) { retval[e.first] = convert(e.second); } @@ -176,8 +176,8 @@ double ConfigParser::convert(const StringVector & config); template<> -vespalib::string -ConfigParser::convert(const StringVector & config); +std::string +ConfigParser::convert(const StringVector & config); } // config diff --git a/config/src/vespa/config/common/configresponse.h b/config/src/vespa/config/common/configresponse.h index 973f77ef6159..f73938b82e72 100644 --- a/config/src/vespa/config/common/configresponse.h +++ b/config/src/vespa/config/common/configresponse.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace config { @@ -43,7 +43,7 @@ class ConfigResponse { virtual void fill() = 0; /** @return Error message if a request has failed, null otherwise. */ - virtual vespalib::string errorMessage() const = 0; + virtual std::string errorMessage() const = 0; virtual int errorCode() const = 0; diff --git a/config/src/vespa/config/common/configstate.h b/config/src/vespa/config/common/configstate.h index 4c61e87bb1d2..1b948ca29091 100644 --- a/config/src/vespa/config/common/configstate.h +++ b/config/src/vespa/config/common/configstate.h @@ -16,13 +16,13 @@ struct ConfigState generation(0), applyOnRestart(false) { } - ConfigState(const vespalib::string & xxhash, int64_t gen, bool _applyOnRestart) + ConfigState(const std::string & xxhash, int64_t gen, bool _applyOnRestart) : xxhash64(xxhash), generation(gen), applyOnRestart(_applyOnRestart) { } - vespalib::string xxhash64; + std::string xxhash64; int64_t generation; bool applyOnRestart; diff --git a/config/src/vespa/config/common/configsystem.cpp b/config/src/vespa/config/common/configsystem.cpp index 65540b6e9504..26b79e23b8f9 100644 --- a/config/src/vespa/config/common/configsystem.cpp +++ b/config/src/vespa/config/common/configsystem.cpp @@ -10,7 +10,7 @@ namespace config { namespace { -vespalib::string getConfigProxyFileName() { +std::string getConfigProxyFileName() { return vespa::Defaults::underVespaHome("var/run/configproxy.pid"); } diff --git a/config/src/vespa/config/common/configsystem.h b/config/src/vespa/config/common/configsystem.h index d04cb771929c..6606e6029423 100644 --- a/config/src/vespa/config/common/configsystem.h +++ b/config/src/vespa/config/common/configsystem.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace config { @@ -11,7 +11,7 @@ class ConfigSystem { bool isUp() const; private: bool isConfigProxyRunning() const; - vespalib::string _configProxyPidFile; + std::string _configProxyPidFile; }; } diff --git a/config/src/vespa/config/common/configvalue.cpp b/config/src/vespa/config/common/configvalue.cpp index 4df0e1edc0e3..58025efaa053 100644 --- a/config/src/vespa/config/common/configvalue.cpp +++ b/config/src/vespa/config/common/configvalue.cpp @@ -7,7 +7,7 @@ namespace config { -ConfigValue::ConfigValue(StringVector lines, const vespalib::string & xxhash) +ConfigValue::ConfigValue(StringVector lines, const std::string & xxhash) : _payload(), _lines(std::move(lines)), _xxhash64(xxhash) @@ -25,7 +25,7 @@ ConfigValue::ConfigValue() _xxhash64() { } -ConfigValue::ConfigValue(PayloadPtr payload, const vespalib::string & xxhash) +ConfigValue::ConfigValue(PayloadPtr payload, const std::string & xxhash) : _payload(std::move(payload)), _lines(), _xxhash64(xxhash) @@ -61,7 +61,7 @@ ConfigValue::getLegacyFormat() const return lines; } -vespalib::string +std::string ConfigValue::asJson() const { if (_payload) { const vespalib::slime::Inspector & payload(_payload->getSlimePayload()); diff --git a/config/src/vespa/config/common/configvalue.h b/config/src/vespa/config/common/configvalue.h index f184b35a8e08..3a9b15ed1797 100644 --- a/config/src/vespa/config/common/configvalue.h +++ b/config/src/vespa/config/common/configvalue.h @@ -18,8 +18,8 @@ typedef std::shared_ptr PayloadPtr; class ConfigValue { public: explicit ConfigValue(StringVector lines); - ConfigValue(StringVector lines, const vespalib::string & xxhash); - ConfigValue(PayloadPtr data, const vespalib::string & xxhash); + ConfigValue(StringVector lines, const std::string & xxhash); + ConfigValue(PayloadPtr data, const std::string & xxhash); ConfigValue(); ConfigValue(ConfigValue &&) noexcept = default; ConfigValue & operator = (ConfigValue &&) noexcept = default; @@ -31,11 +31,11 @@ class ConfigValue { int operator!=(const ConfigValue & rhs) const; size_t numLines() const { return _lines.size(); } - const vespalib::string & getLine(int i) const { return _lines.at(i); } + const std::string & getLine(int i) const { return _lines.at(i); } const StringVector & getLines() const { return _lines; } StringVector getLegacyFormat() const; - vespalib::string asJson() const; - const vespalib::string& getXxhash64() const { return _xxhash64; } + std::string asJson() const; + const std::string& getXxhash64() const { return _xxhash64; } void serializeV1(::vespalib::slime::Cursor & cursor) const; void serializeV2(::vespalib::slime::Cursor & cursor) const; @@ -46,7 +46,7 @@ class ConfigValue { private: PayloadPtr _payload; StringVector _lines; - vespalib::string _xxhash64; + std::string _xxhash64; }; } //namespace config diff --git a/config/src/vespa/config/common/errorcode.cpp b/config/src/vespa/config/common/errorcode.cpp index 74627c65dbc0..5787169b2f1f 100644 --- a/config/src/vespa/config/common/errorcode.cpp +++ b/config/src/vespa/config/common/errorcode.cpp @@ -4,7 +4,7 @@ namespace config { -vespalib::string ErrorCode::getName(int error) { +std::string ErrorCode::getName(int error) { switch(error) { case UNKNOWN_CONFIG: return "UNKNOWN_CONFIG"; case UNKNOWN_DEFINITION: return "UNKNOWN_DEFINITION"; diff --git a/config/src/vespa/config/common/errorcode.h b/config/src/vespa/config/common/errorcode.h index 1cdf55fd7657..7e8ce7190aac 100644 --- a/config/src/vespa/config/common/errorcode.h +++ b/config/src/vespa/config/common/errorcode.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace config { @@ -45,7 +45,7 @@ class ErrorCode { static const int INCONSISTENT_CONFIG_MD5 = UNKNOWN_CONFIG + 400; - static vespalib::string getName(int error); + static std::string getName(int error); }; } diff --git a/config/src/vespa/config/common/misc.cpp b/config/src/vespa/config/common/misc.cpp index 817b67c259ab..984bc4afa3be 100644 --- a/config/src/vespa/config/common/misc.cpp +++ b/config/src/vespa/config/common/misc.cpp @@ -13,10 +13,10 @@ using vespalib::Memory; namespace config { -vespalib::string +std::string calculateContentXxhash64(const StringVector & fileContents) { - vespalib::string normalizedLines; + std::string normalizedLines; XXH64_hash_t xxhash64; vespalib::asciistream s; std::stringstream ss; diff --git a/config/src/vespa/config/common/misc.h b/config/src/vespa/config/common/misc.h index a9f30daeaa6f..9e1f1583ca5b 100644 --- a/config/src/vespa/config/common/misc.h +++ b/config/src/vespa/config/common/misc.h @@ -18,7 +18,7 @@ namespace config { /** * Miscellaneous utility functions specific to config. */ -vespalib::string calculateContentXxhash64(const StringVector & fileContents); +std::string calculateContentXxhash64(const StringVector & fileContents); bool isGenerationNewer(int64_t newGen, int64_t oldGen); diff --git a/config/src/vespa/config/common/payload_converter.cpp b/config/src/vespa/config/common/payload_converter.cpp index 788b2d78c6a9..a022106d90d7 100644 --- a/config/src/vespa/config/common/payload_converter.cpp +++ b/config/src/vespa/config/common/payload_converter.cpp @@ -130,7 +130,7 @@ PayloadConverter::encodeValue(const Inspector & value) } void -PayloadConverter::encodeString(const vespalib::string & value) +PayloadConverter::encodeString(const std::string & value) { _buf << value; } @@ -140,7 +140,7 @@ void PayloadConverter::encodeDouble(double value) { _buf << value; } void PayloadConverter::encodeBool(bool value) { _buf << (value ? "true" : "false"); } void -PayloadConverter::encodeQuotedString(const vespalib::string & value) +PayloadConverter::encodeQuotedString(const std::string & value) { encodeString("\""); encodeString(value); diff --git a/config/src/vespa/config/common/payload_converter.h b/config/src/vespa/config/common/payload_converter.h index 4bbf9df802ee..13479e8edced 100644 --- a/config/src/vespa/config/common/payload_converter.h +++ b/config/src/vespa/config/common/payload_converter.h @@ -26,17 +26,17 @@ class PayloadConverter : public vespalib::slime::ObjectTraverser, public vespali void encodeObject(const vespalib::Memory & symbol, const vespalib::slime::Inspector & object); void encodeArray(const vespalib::Memory & symbol, const vespalib::slime::Inspector & object); void encodeValue(const vespalib::slime::Inspector & value); - void encodeString(const vespalib::string & value); - void encodeQuotedString(const vespalib::string & value); + void encodeString(const std::string & value); + void encodeQuotedString(const std::string & value); void encodeLong(long value); void encodeDouble(double value); void encodeBool(bool value); struct Node { - vespalib::string name; + std::string name; int arrayIndex; - Node(const vespalib::string & nm, int idx) : name(nm), arrayIndex(idx) {} + Node(const std::string & nm, int idx) : name(nm), arrayIndex(idx) {} Node(int idx) : name(""), arrayIndex(idx) {} - Node(const vespalib::string & nm) : name(nm), arrayIndex(-1) {} + Node(const std::string & nm) : name(nm), arrayIndex(-1) {} }; using NodeStack = std::vector; const vespalib::slime::Inspector & _inspector; diff --git a/config/src/vespa/config/common/trace.cpp b/config/src/vespa/config/common/trace.cpp index 9aa44fbb653d..5542c04974d0 100644 --- a/config/src/vespa/config/common/trace.cpp +++ b/config/src/vespa/config/common/trace.cpp @@ -71,7 +71,7 @@ Trace::shouldTrace(uint32_t level) const } void -Trace::trace(uint32_t level, const vespalib::string & message) +Trace::trace(uint32_t level, const std::string & message) { if (shouldTrace(level)) { _root.addChild(message, _clock.currentTime()); @@ -95,7 +95,7 @@ Trace::serializeTraceLog(Cursor & array) const } } -vespalib::string +std::string Trace::toString() const { Slime slime; diff --git a/config/src/vespa/config/common/trace.h b/config/src/vespa/config/common/trace.h index 99602a25ab71..fd44554d08d6 100644 --- a/config/src/vespa/config/common/trace.h +++ b/config/src/vespa/config/common/trace.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace vespalib::slime { struct Cursor; @@ -32,13 +32,13 @@ class Trace Trace(uint32_t traceLevel, const Clock & clock); bool shouldTrace(uint32_t level) const; - void trace(uint32_t level, const vespalib::string & message); + void trace(uint32_t level, const std::string & message); void serialize(vespalib::slime::Cursor & cursor) const; void deserialize(const vespalib::slime::Inspector & inspector); const vespalib::TraceNode & getRoot() const { return _root; } - vespalib::string toString() const; + std::string toString() const; private: void serializeTraceLog(vespalib::slime::Cursor & array) const; void deserializeTraceLog(const vespalib::slime::Inspector & inspector); diff --git a/config/src/vespa/config/common/types.h b/config/src/vespa/config/common/types.h index 192cf98dfcc5..8c385922f51b 100644 --- a/config/src/vespa/config/common/types.h +++ b/config/src/vespa/config/common/types.h @@ -1,22 +1,22 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include -#include #include +#include +#include namespace config { -using StringVector = std::vector>; +using StringVector = std::vector>; using BoolVector = std::vector; using DoubleVector = std::vector; using LongVector = std::vector; using IntVector = std::vector; -using StringMap = std::map; -using BoolMap = std::map; -using DoubleMap = std::map; -using LongMap = std::map; -using IntMap = std::map; +using StringMap = std::map; +using BoolMap = std::map; +using DoubleMap = std::map; +using LongMap = std::map; +using IntMap = std::map; } diff --git a/config/src/vespa/config/common/vespa_version.cpp b/config/src/vespa/config/common/vespa_version.cpp index 781b324c938b..3bf0b77d2abe 100644 --- a/config/src/vespa/config/common/vespa_version.cpp +++ b/config/src/vespa/config/common/vespa_version.cpp @@ -5,20 +5,20 @@ namespace config { -const VespaVersion currentVersion(VespaVersion::fromString(vespalib::string(vespalib::VersionTagComponent))); +const VespaVersion currentVersion(VespaVersion::fromString(std::string(vespalib::VersionTagComponent))); VespaVersion::VespaVersion(const VespaVersion & vespaVersion) = default; VespaVersion & VespaVersion::operator=(const VespaVersion &rhs) = default; -VespaVersion::VespaVersion(const vespalib::string & versionString) +VespaVersion::VespaVersion(const std::string & versionString) : _versionString(versionString) { } VespaVersion -VespaVersion::fromString(const vespalib::string & versionString) +VespaVersion::fromString(const std::string & versionString) { return VespaVersion(versionString); } @@ -28,7 +28,7 @@ VespaVersion::getCurrentVersion() { return currentVersion; } -const vespalib::string & +const std::string & VespaVersion::toString() const { return _versionString; diff --git a/config/src/vespa/config/common/vespa_version.h b/config/src/vespa/config/common/vespa_version.h index d58a35d58138..c663c2eb0f0d 100644 --- a/config/src/vespa/config/common/vespa_version.h +++ b/config/src/vespa/config/common/vespa_version.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace config { @@ -11,14 +11,14 @@ namespace config { struct VespaVersion { public: - static VespaVersion fromString(const vespalib::string & versionString); + static VespaVersion fromString(const std::string & versionString); static const VespaVersion & getCurrentVersion(); VespaVersion(const VespaVersion & version); VespaVersion &operator=(const VespaVersion &rhs); - const vespalib::string & toString() const; + const std::string & toString() const; private: - VespaVersion(const vespalib::string & versionString); - vespalib::string _versionString; + VespaVersion(const std::string & versionString); + std::string _versionString; }; } // namespace config diff --git a/config/src/vespa/config/configgen/configinstance.h b/config/src/vespa/config/configgen/configinstance.h index f8a3343376f9..a37df6a186a4 100644 --- a/config/src/vespa/config/configgen/configinstance.h +++ b/config/src/vespa/config/configgen/configinstance.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include namespace config { @@ -16,9 +16,9 @@ class ConfigInstance { typedef std::unique_ptr UP; typedef std::shared_ptr SP; // Static for this instance's type - virtual const vespalib::string & defName() const = 0; - virtual const vespalib::string & defMd5() const = 0; - virtual const vespalib::string & defNamespace() const = 0; + virtual const std::string & defName() const = 0; + virtual const std::string & defMd5() const = 0; + virtual const std::string & defNamespace() const = 0; virtual void serialize(ConfigDataBuffer & buffer) const = 0; diff --git a/config/src/vespa/config/configgen/map_inserter.h b/config/src/vespa/config/configgen/map_inserter.h index 3eb708301048..0fa4f1065902 100644 --- a/config/src/vespa/config/configgen/map_inserter.h +++ b/config/src/vespa/config/configgen/map_inserter.h @@ -3,18 +3,18 @@ #include "value_converter.h" #include -#include #include +#include namespace config::internal { template > class MapInserter : public ::vespalib::slime::ObjectTraverser { public: - MapInserter(std::map & map); + MapInserter(std::map & map); void field(const ::vespalib::Memory & symbol, const ::vespalib::slime::Inspector & inspector) override; private: - std::map & _map; + std::map & _map; }; } diff --git a/config/src/vespa/config/configgen/map_inserter.hpp b/config/src/vespa/config/configgen/map_inserter.hpp index e9090e1d5daa..8ed3a55f8001 100644 --- a/config/src/vespa/config/configgen/map_inserter.hpp +++ b/config/src/vespa/config/configgen/map_inserter.hpp @@ -7,7 +7,7 @@ namespace config::internal { template -MapInserter::MapInserter(std::map & map) +MapInserter::MapInserter(std::map & map) : _map(map) {} diff --git a/config/src/vespa/config/configgen/value_converter.cpp b/config/src/vespa/config/configgen/value_converter.cpp index 6905b770334c..237dd686ae01 100644 --- a/config/src/vespa/config/configgen/value_converter.cpp +++ b/config/src/vespa/config/configgen/value_converter.cpp @@ -2,6 +2,7 @@ #include "value_converter.h" #include #include +#include #include using namespace vespalib; @@ -44,14 +45,14 @@ bool convertValue(const ::vespalib::slime::Inspector & __inspector) { switch (__inspector.type().getId()) { case BOOL::ID: return __inspector.asBool(); case STRING::ID: - vespalib::string s(__inspector.asString().make_string()); + std::string s(__inspector.asString().make_string()); return s.compare("true") == 0 ? true : false; } throw InvalidConfigException(make_string("Expected bool, but got incompatible config type %u", __inspector.type().getId())); } template<> -vespalib::string convertValue(const ::vespalib::slime::Inspector & __inspector) { return __inspector.asString().make_string(); } +std::string convertValue(const ::vespalib::slime::Inspector & __inspector) { return __inspector.asString().make_string(); } void requireValid(std::string_view __fieldName, const ::vespalib::slime::Inspector & __inspector) { diff --git a/config/src/vespa/config/configgen/value_converter.h b/config/src/vespa/config/configgen/value_converter.h index 361cec738d6a..700889628834 100644 --- a/config/src/vespa/config/configgen/value_converter.h +++ b/config/src/vespa/config/configgen/value_converter.h @@ -2,8 +2,8 @@ #pragma once #include "configpayload.h" -#include #include +#include namespace config::internal { @@ -25,7 +25,7 @@ template<> bool convertValue(const ::vespalib::slime::Inspector & __inspector); template<> -vespalib::string convertValue(const ::vespalib::slime::Inspector & __inspector); +std::string convertValue(const ::vespalib::slime::Inspector & __inspector); template struct ValueConverter { diff --git a/config/src/vespa/config/configgen/vector_inserter.h b/config/src/vespa/config/configgen/vector_inserter.h index fc72010fd4fa..21060fe63f6d 100644 --- a/config/src/vespa/config/configgen/vector_inserter.h +++ b/config/src/vespa/config/configgen/vector_inserter.h @@ -3,7 +3,7 @@ #include "value_converter.h" #include -#include +#include namespace config::internal { diff --git a/config/src/vespa/config/file/filesource.cpp b/config/src/vespa/config/file/filesource.cpp index 5f52377f2e18..2f4e37b7b7f1 100644 --- a/config/src/vespa/config/file/filesource.cpp +++ b/config/src/vespa/config/file/filesource.cpp @@ -11,7 +11,7 @@ using vespalib::asciistream; namespace config { -FileSource::FileSource(std::shared_ptr holder, const vespalib::string & fileName) +FileSource::FileSource(std::shared_ptr holder, const std::string & fileName) : _holder(std::move(holder)), _fileName(fileName), _lastLoaded(-1), @@ -41,7 +41,7 @@ FileSource::reload(int64_t generation) } int64_t -FileSource::getLast(const vespalib::string & fileName) +FileSource::getLast(const std::string & fileName) { struct stat filestat; memset(&filestat, 0, sizeof(filestat)); @@ -50,7 +50,7 @@ FileSource::getLast(const vespalib::string & fileName) } StringVector -FileSource::readConfigFile(const vespalib::string & fileName) +FileSource::readConfigFile(const std::string & fileName) { asciistream is(asciistream::createFromFile(fileName)); return getlines(is); diff --git a/config/src/vespa/config/file/filesource.h b/config/src/vespa/config/file/filesource.h index 7a47ec168011..130b916a07b8 100644 --- a/config/src/vespa/config/file/filesource.h +++ b/config/src/vespa/config/file/filesource.h @@ -14,15 +14,15 @@ class FileSource : public Source { private: std::shared_ptr _holder; - const vespalib::string _fileName; + const std::string _fileName; int64_t _lastLoaded; int64_t _generation; - StringVector readConfigFile(const vespalib::string & fileName); - int64_t getLast(const vespalib::string & fileName); + StringVector readConfigFile(const std::string & fileName); + int64_t getLast(const std::string & fileName); public: - FileSource(std::shared_ptr holder, const vespalib::string & fileName); + FileSource(std::shared_ptr holder, const std::string & fileName); FileSource(const FileSource &) = delete; FileSource & operator = (const FileSource &) = delete; ~FileSource() override; diff --git a/config/src/vespa/config/file/filesourcefactory.cpp b/config/src/vespa/config/file/filesourcefactory.cpp index 9a0effe3f1f7..0a8e3f41b60c 100644 --- a/config/src/vespa/config/file/filesourcefactory.cpp +++ b/config/src/vespa/config/file/filesourcefactory.cpp @@ -25,7 +25,7 @@ DirSourceFactory::DirSourceFactory(const DirSpec & dirSpec) std::unique_ptr DirSourceFactory::createSource(std::shared_ptr holder, const ConfigKey & key) const { - vespalib::string fileId(key.getDefName()); + std::string fileId(key.getDefName()); if (!key.getConfigId().empty()) { fileId += "." + key.getConfigId(); } @@ -41,7 +41,7 @@ DirSourceFactory::createSource(std::shared_ptr holder, const Conf if ( !found ) { LOG(warning, "Filename '%s' was expected in the spec, but does not exist.", fileId.c_str()); } - vespalib::string fName = _dirName; + std::string fName = _dirName; if (!fName.empty()) fName += "/"; fName += fileId; return std::make_unique(std::move(holder), fName); diff --git a/config/src/vespa/config/file/filesourcefactory.h b/config/src/vespa/config/file/filesourcefactory.h index 1177d204b27e..417fa6029e6c 100644 --- a/config/src/vespa/config/file/filesourcefactory.h +++ b/config/src/vespa/config/file/filesourcefactory.h @@ -22,7 +22,7 @@ class FileSourceFactory : public SourceFactory */ std::unique_ptr createSource(std::shared_ptr holder, const ConfigKey & key) const override; private: - vespalib::string _fileName; + std::string _fileName; }; /** @@ -38,7 +38,7 @@ class DirSourceFactory : public SourceFactory */ std::unique_ptr createSource(std::shared_ptr holder, const ConfigKey & key) const override; private: - vespalib::string _dirName; + std::string _dirName; StringVector _fileNames; }; diff --git a/config/src/vespa/config/file_acquirer/file_acquirer.cpp b/config/src/vespa/config/file_acquirer/file_acquirer.cpp index 67bc2911524a..b30426a713b9 100644 --- a/config/src/vespa/config/file_acquirer/file_acquirer.cpp +++ b/config/src/vespa/config/file_acquirer/file_acquirer.cpp @@ -11,15 +11,15 @@ LOG_SETUP(".config.file_acquirer"); namespace config { -RpcFileAcquirer::RpcFileAcquirer(FNET_Transport & transport, const vespalib::string &spec) +RpcFileAcquirer::RpcFileAcquirer(FNET_Transport & transport, const std::string &spec) : _orb(std::make_unique(&transport)), _spec(spec) { } -vespalib::string -RpcFileAcquirer::wait_for(const vespalib::string &file_ref, double timeout_s) +std::string +RpcFileAcquirer::wait_for(const std::string &file_ref, double timeout_s) { - vespalib::string path; + std::string path; FRT_Target *target = _orb->GetTarget(_spec.c_str()); FRT_RPCRequest *req = _orb->AllocRPCRequest(); req->SetMethodName("waitFor"); diff --git a/config/src/vespa/config/file_acquirer/file_acquirer.h b/config/src/vespa/config/file_acquirer/file_acquirer.h index e556f7d400bd..ad695cb434c1 100644 --- a/config/src/vespa/config/file_acquirer/file_acquirer.h +++ b/config/src/vespa/config/file_acquirer/file_acquirer.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include class FRT_Supervisor; class FNET_Transport; @@ -14,7 +14,7 @@ namespace config { * references to concrete paths. **/ struct FileAcquirer { - virtual vespalib::string wait_for(const vespalib::string &file_ref, double timeout_s) = 0; + virtual std::string wait_for(const std::string &file_ref, double timeout_s) = 0; virtual ~FileAcquirer() {} }; @@ -26,10 +26,10 @@ class RpcFileAcquirer : public FileAcquirer { private: std::unique_ptr _orb; - vespalib::string _spec; + std::string _spec; public: - RpcFileAcquirer(FNET_Transport & transport, const vespalib::string &spec); - vespalib::string wait_for(const vespalib::string &file_ref, double timeout_s) override; + RpcFileAcquirer(FNET_Transport & transport, const std::string &spec); + std::string wait_for(const std::string &file_ref, double timeout_s) override; ~RpcFileAcquirer() override; }; diff --git a/config/src/vespa/config/frt/connection.h b/config/src/vespa/config/frt/connection.h index cc5165036b4c..b5c553673036 100644 --- a/config/src/vespa/config/frt/connection.h +++ b/config/src/vespa/config/frt/connection.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include class FRT_RPCRequest; class FRT_IRequestWait; @@ -15,7 +15,7 @@ class Connection { virtual FRT_RPCRequest * allocRPCRequest() = 0; virtual void setError(int errorCode) = 0; virtual void invoke(FRT_RPCRequest * req, duration timeout, FRT_IRequestWait * waiter) = 0; - virtual const vespalib::string & getAddress() const = 0; + virtual const std::string & getAddress() const = 0; virtual ~Connection() = default; }; diff --git a/config/src/vespa/config/frt/frtconfigrequestfactory.h b/config/src/vespa/config/frt/frtconfigrequestfactory.h index e50294b7449c..b8593c4a9ea6 100644 --- a/config/src/vespa/config/frt/frtconfigrequestfactory.h +++ b/config/src/vespa/config/frt/frtconfigrequestfactory.h @@ -28,7 +28,7 @@ class FRTConfigRequestFactory private: const int _traceLevel; const VespaVersion _vespaVersion; - vespalib::string _hostName; + std::string _hostName; const CompressionType _compressionType; }; diff --git a/config/src/vespa/config/frt/frtconfigrequestv3.cpp b/config/src/vespa/config/frt/frtconfigrequestv3.cpp index 7ba4f2e8411e..6f3375570f24 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv3.cpp +++ b/config/src/vespa/config/frt/frtconfigrequestv3.cpp @@ -11,9 +11,9 @@ namespace config { FRTConfigRequestV3::FRTConfigRequestV3(Connection * connection, const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, vespalib::duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, diff --git a/config/src/vespa/config/frt/frtconfigrequestv3.h b/config/src/vespa/config/frt/frtconfigrequestv3.h index 8ccf51527682..696bf3e89964 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv3.h +++ b/config/src/vespa/config/frt/frtconfigrequestv3.h @@ -17,9 +17,9 @@ class FRTConfigRequestV3 : public SlimeConfigRequest { public: FRTConfigRequestV3(Connection * connection, const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, diff --git a/config/src/vespa/config/frt/frtconfigresponse.cpp b/config/src/vespa/config/frt/frtconfigresponse.cpp index 523126ee8359..515c39f0c9a6 100644 --- a/config/src/vespa/config/frt/frtconfigresponse.cpp +++ b/config/src/vespa/config/frt/frtconfigresponse.cpp @@ -38,7 +38,7 @@ FRTConfigResponse::hasValidResponse() const return (_responseState == OK); } -vespalib::string FRTConfigResponse::errorMessage() const { return _request->GetErrorMessage(); } +std::string FRTConfigResponse::errorMessage() const { return _request->GetErrorMessage(); } int FRTConfigResponse::errorCode() const { return _request->GetErrorCode(); } bool FRTConfigResponse::isError() const { return _request->IsError(); } diff --git a/config/src/vespa/config/frt/frtconfigresponse.h b/config/src/vespa/config/frt/frtconfigresponse.h index 0591999ab180..cacfbe02ed56 100644 --- a/config/src/vespa/config/frt/frtconfigresponse.h +++ b/config/src/vespa/config/frt/frtconfigresponse.h @@ -21,10 +21,10 @@ class FRTConfigResponse : public ConfigResponse { bool validateResponse() override; bool hasValidResponse() const override; - vespalib::string errorMessage() const override; + std::string errorMessage() const override; int errorCode() const override; bool isError() const override; - virtual const vespalib::string & getResponseTypes() const = 0; + virtual const std::string & getResponseTypes() const = 0; private: enum ResponseState { EMPTY, OK, ERROR }; diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp index 70d6456d433b..8cf13cd8427f 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp +++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp @@ -37,14 +37,14 @@ class V3Payload : public Payload Slime::UP _data; }; -const vespalib::string FRTConfigResponseV3::RESPONSE_TYPES = "sx"; +const std::string FRTConfigResponseV3::RESPONSE_TYPES = "sx"; FRTConfigResponseV3::FRTConfigResponseV3(FRT_RPCRequest * request) : SlimeConfigResponse(request) { } -const vespalib::string & +const std::string & FRTConfigResponseV3::getResponseTypes() const { return RESPONSE_TYPES; @@ -53,7 +53,7 @@ FRTConfigResponseV3::getResponseTypes() const ConfigValue FRTConfigResponseV3::readConfigValue() const { - vespalib::string xxhash64(_data->get()[RESPONSE_CONFIG_XXHASH64].asString().make_string()); + std::string xxhash64(_data->get()[RESPONSE_CONFIG_XXHASH64].asString().make_string()); CompressionInfo info; info.deserialize(_data->get()[RESPONSE_COMPRESSION_INFO]); auto slime = std::make_unique(); diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.h b/config/src/vespa/config/frt/frtconfigresponsev3.h index 46f69f8b20d9..f14aad695e9f 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.h +++ b/config/src/vespa/config/frt/frtconfigresponsev3.h @@ -20,8 +20,8 @@ class FRTConfigResponseV3 : public SlimeConfigResponse { FRTConfigResponseV3(FRT_RPCRequest * request); private: - static const vespalib::string RESPONSE_TYPES; - const vespalib::string & getResponseTypes() const override; + static const std::string RESPONSE_TYPES; + const std::string & getResponseTypes() const override; ConfigValue readConfigValue() const override; }; diff --git a/config/src/vespa/config/frt/frtconnection.cpp b/config/src/vespa/config/frt/frtconnection.cpp index d9b48bc8bbe3..076d868f27ca 100644 --- a/config/src/vespa/config/frt/frtconnection.cpp +++ b/config/src/vespa/config/frt/frtconnection.cpp @@ -12,7 +12,7 @@ using namespace vespalib; namespace config { -FRTConnection::FRTConnection(const vespalib::string& address, FRT_Supervisor& supervisor, const TimingValues & timingValues) +FRTConnection::FRTConnection(const std::string& address, FRT_Supervisor& supervisor, const TimingValues & timingValues) : _address(address), _transientDelay(timingValues.transientDelay), _fatalDelay(timingValues.fatalDelay), diff --git a/config/src/vespa/config/frt/frtconnection.h b/config/src/vespa/config/frt/frtconnection.h index c49c9369bbee..e02cc9e7712e 100644 --- a/config/src/vespa/config/frt/frtconnection.h +++ b/config/src/vespa/config/frt/frtconnection.h @@ -16,14 +16,14 @@ class FRTConnection : public Connection { typedef std::shared_ptr SP; enum ErrorType { TRANSIENT, FATAL }; - FRTConnection(const vespalib::string & address, FRT_Supervisor & supervisor, const TimingValues & timingValues); + FRTConnection(const std::string & address, FRT_Supervisor & supervisor, const TimingValues & timingValues); FRTConnection(const FRTConnection&) = delete; FRTConnection& operator=(const FRTConnection&) = delete; ~FRTConnection() override; FRT_RPCRequest * allocRPCRequest() override; void invoke(FRT_RPCRequest * req, duration timeout, FRT_IRequestWait * waiter) override; - const vespalib::string & getAddress() const override { return _address; } + const std::string & getAddress() const override { return _address; } vespalib::steady_time getSuspendedUntil() const { return _suspendedUntil; } void setError(int errorCode) override; void setSuccess(); @@ -32,7 +32,7 @@ class FRTConnection : public Connection { void calculateSuspension(ErrorType type); - const vespalib::string _address; + const std::string _address; const duration _transientDelay; const duration _fatalDelay; FRT_Supervisor& _supervisor; diff --git a/config/src/vespa/config/frt/frtconnectionpool.cpp b/config/src/vespa/config/frt/frtconnectionpool.cpp index d531a7590042..f6cb7ab2e0af 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.cpp +++ b/config/src/vespa/config/frt/frtconnectionpool.cpp @@ -11,7 +11,7 @@ LOG_SETUP(".config.frt.frtconnectionpool"); namespace config { -FRTConnectionPool::FRTConnectionKey::FRTConnectionKey(int idx, const vespalib::string& hostname) +FRTConnectionPool::FRTConnectionKey::FRTConnectionKey(int idx, const std::string& hostname) : _idx(idx), _hostname(hostname) { @@ -95,7 +95,7 @@ namespace { * @param s the string to compute the hash from * @return the hash value */ -int hashCode(const vespalib::string & s) { +int hashCode(const std::string & s) { unsigned int hashval = 0; for (int i = 0; i < (int) s.length(); i++) { diff --git a/config/src/vespa/config/frt/frtconnectionpool.h b/config/src/vespa/config/frt/frtconnectionpool.h index 2356af672c52..a3468c809e40 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.h +++ b/config/src/vespa/config/frt/frtconnectionpool.h @@ -22,17 +22,17 @@ class FRTConnectionPool : public ConnectionFactory { class FRTConnectionKey { private: int _idx; - vespalib::string _hostname; + std::string _hostname; public: FRTConnectionKey() : FRTConnectionKey(0, "") {} - FRTConnectionKey(int idx, const vespalib::string& hostname); + FRTConnectionKey(int idx, const std::string& hostname); int operator<(const FRTConnectionKey& right) const; int operator==(const FRTConnectionKey& right) const; }; std::unique_ptr _supervisor; int _selectIdx; - vespalib::string _hostname; + std::string _hostname; using ConnectionMap = std::map; ConnectionMap _connections; @@ -54,7 +54,7 @@ class FRTConnectionPool : public ConnectionFactory { * * @param hostname the hostname */ - void setHostname(const vespalib::string & hostname) { _hostname = hostname; } + void setHostname(const std::string & hostname) { _hostname = hostname; } FNET_Scheduler * getScheduler() override; diff --git a/config/src/vespa/config/frt/protocol.cpp b/config/src/vespa/config/frt/protocol.cpp index 6a7e807f1876..f6cdfa474c5a 100644 --- a/config/src/vespa/config/frt/protocol.cpp +++ b/config/src/vespa/config/frt/protocol.cpp @@ -141,7 +141,7 @@ readProtocolCompressionType() CompressionType type = CompressionType::LZ4; char *compressionTypeStringPtr = getenv("VESPA_CONFIG_PROTOCOL_COMPRESSION"); if (compressionTypeStringPtr != NULL) { - type = stringToCompressionType(vespalib::string(compressionTypeStringPtr)); + type = stringToCompressionType(std::string(compressionTypeStringPtr)); } return type; } diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h index 82afbe0882f6..309372f6d81b 100644 --- a/config/src/vespa/config/frt/protocol.h +++ b/config/src/vespa/config/frt/protocol.h @@ -2,9 +2,9 @@ #pragma once #include -#include #include #include +#include namespace vespalib { class Slime; diff --git a/config/src/vespa/config/frt/slimeconfigrequest.cpp b/config/src/vespa/config/frt/slimeconfigrequest.cpp index 7450c05b3612..758fa764f53f 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.cpp +++ b/config/src/vespa/config/frt/slimeconfigrequest.cpp @@ -21,15 +21,15 @@ namespace config { SlimeConfigRequest::SlimeConfigRequest(Connection * connection, const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, int64_t protocolVersion, const CompressionType & compressionType, - const vespalib::string & methodName) + const std::string & methodName) : FRTConfigRequest(connection, key), _data() { @@ -49,9 +49,9 @@ SlimeConfigRequest::verifyState(const ConfigState & state) const void SlimeConfigRequest::populateSlimeRequest(const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, @@ -75,7 +75,7 @@ SlimeConfigRequest::populateSlimeRequest(const ConfigKey & key, root.setString(REQUEST_VESPA_VERSION, Memory(vespaVersion.toString())); } -vespalib::string +std::string SlimeConfigRequest::createJsonFromSlime(const Slime & data) { SimpleBuffer buf; diff --git a/config/src/vespa/config/frt/slimeconfigrequest.h b/config/src/vespa/config/frt/slimeconfigrequest.h index 3508a495dcd0..e817dded6356 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.h +++ b/config/src/vespa/config/frt/slimeconfigrequest.h @@ -22,29 +22,29 @@ class SlimeConfigRequest : public FRTConfigRequest { using duration = vespalib::duration; SlimeConfigRequest(Connection * connection, const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, int64_t protocolVersion, const CompressionType & compressionType, - const vespalib::string & methodName); + const std::string & methodName); ~SlimeConfigRequest(); bool verifyState(const ConfigState & state) const override; virtual std::unique_ptr createResponse(FRT_RPCRequest * request) const override = 0; private: void populateSlimeRequest(const ConfigKey & key, - const vespalib::string & configXxhash64, + const std::string & configXxhash64, int64_t currentGeneration, - const vespalib::string & hostName, + const std::string & hostName, duration serverTimeout, const Trace & trace, const VespaVersion & vespaVersion, int64_t protocolVersion, const CompressionType & compressionType); - static vespalib::string createJsonFromSlime(const vespalib::Slime & data); + static std::string createJsonFromSlime(const vespalib::Slime & data); vespalib::Slime _data; }; diff --git a/config/src/vespa/config/frt/slimeconfigresponse.cpp b/config/src/vespa/config/frt/slimeconfigresponse.cpp index 543376033c17..b0d9876c1406 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.cpp +++ b/config/src/vespa/config/frt/slimeconfigresponse.cpp @@ -2,7 +2,8 @@ #include "slimeconfigresponse.h" #include #include -#include +#include + #include LOG_SETUP(".config.frt.slimeconfigresponse"); @@ -71,7 +72,7 @@ SlimeConfigResponse::readState() const data.get()[RESPONSE_APPLY_ON_RESTART].asBool()); } -vespalib::string +std::string SlimeConfigResponse::getHostName() const { Inspector & root(_data->get()); diff --git a/config/src/vespa/config/frt/slimeconfigresponse.h b/config/src/vespa/config/frt/slimeconfigresponse.h index d3b88a124eed..79561501e13a 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.h +++ b/config/src/vespa/config/frt/slimeconfigresponse.h @@ -29,7 +29,7 @@ class SlimeConfigResponse : public FRTConfigResponse { const ConfigState & getConfigState() const override { return _state; } const Trace & getTrace() const override { return _trace; } - vespalib::string getHostName() const; + std::string getHostName() const; void fill() override; diff --git a/config/src/vespa/config/helper/legacy.h b/config/src/vespa/config/helper/legacy.h index f61569095461..d9a43e1c3306 100644 --- a/config/src/vespa/config/helper/legacy.h +++ b/config/src/vespa/config/helper/legacy.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace config { diff --git a/config/src/vespa/config/helper/legacysubscriber.h b/config/src/vespa/config/helper/legacysubscriber.h index 306a05379bcb..30a6be007b37 100644 --- a/config/src/vespa/config/helper/legacysubscriber.h +++ b/config/src/vespa/config/helper/legacysubscriber.h @@ -14,7 +14,7 @@ class LegacySubscriber public: LegacySubscriber(); ~LegacySubscriber(); - const vespalib::string & id() const { return _configId; } + const std::string & id() const { return _configId; } template void subscribe(const std::string & configId, IFetcherCallback * callback); @@ -22,7 +22,7 @@ class LegacySubscriber void close(); private: std::unique_ptr _fetcher; - vespalib::string _configId; + std::string _configId; }; } // namespace config diff --git a/config/src/vespa/config/print/asciiconfigreader.hpp b/config/src/vespa/config/print/asciiconfigreader.hpp index da02198f9308..72d14625d373 100644 --- a/config/src/vespa/config/print/asciiconfigreader.hpp +++ b/config/src/vespa/config/print/asciiconfigreader.hpp @@ -30,7 +30,7 @@ std::unique_ptr AsciiConfigReader::read() { StringVector lines; - vespalib::string line; + std::string line; while (getline(_is, line)) { lines.push_back(line); } diff --git a/config/src/vespa/config/print/configdatabuffer.h b/config/src/vespa/config/print/configdatabuffer.h index 35cf35e959ab..062067cbd191 100644 --- a/config/src/vespa/config/print/configdatabuffer.h +++ b/config/src/vespa/config/print/configdatabuffer.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace vespalib { class Slime; @@ -24,11 +24,11 @@ class ConfigDataBuffer ~ConfigDataBuffer(); vespalib::Slime & slimeObject() { return *_slime; } const vespalib::Slime & slimeObject() const { return *_slime; } - const vespalib::string & getEncodedString() const { return _encoded; } + const std::string & getEncodedString() const { return _encoded; } void setEncodedString(std::string_view encoded) { _encoded = encoded; } private: std::unique_ptr _slime; - vespalib::string _encoded; + std::string _encoded; }; } // namespace config diff --git a/config/src/vespa/config/print/fileconfigreader.h b/config/src/vespa/config/print/fileconfigreader.h index d2894e6e0ed6..91970c822332 100644 --- a/config/src/vespa/config/print/fileconfigreader.h +++ b/config/src/vespa/config/print/fileconfigreader.h @@ -8,7 +8,7 @@ namespace config { template class FileConfigReader : public ConfigReader { public: - FileConfigReader(const vespalib::string & fileName); + FileConfigReader(const std::string & fileName); // Implements ConfigReader std::unique_ptr read(const ConfigFormatter & formatter) override; @@ -20,7 +20,7 @@ class FileConfigReader : public ConfigReader { */ std::unique_ptr read(); private: - const vespalib::string _fileName; + const std::string _fileName; }; } // namespace config diff --git a/config/src/vespa/config/print/fileconfigreader.hpp b/config/src/vespa/config/print/fileconfigreader.hpp index 374825624f7e..77d165f46e24 100644 --- a/config/src/vespa/config/print/fileconfigreader.hpp +++ b/config/src/vespa/config/print/fileconfigreader.hpp @@ -11,7 +11,7 @@ namespace config { template -FileConfigReader::FileConfigReader(const vespalib::string & fileName) +FileConfigReader::FileConfigReader(const std::string & fileName) : _fileName(fileName) { } diff --git a/config/src/vespa/config/print/fileconfigsnapshotreader.cpp b/config/src/vespa/config/print/fileconfigsnapshotreader.cpp index c936a9672b3f..68d3abb9d508 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotreader.cpp +++ b/config/src/vespa/config/print/fileconfigsnapshotreader.cpp @@ -8,7 +8,7 @@ namespace config { -FileConfigSnapshotReader::FileConfigSnapshotReader(const vespalib::string & fileName) +FileConfigSnapshotReader::FileConfigSnapshotReader(const std::string & fileName) : _fileName(fileName) { } diff --git a/config/src/vespa/config/print/fileconfigsnapshotreader.h b/config/src/vespa/config/print/fileconfigsnapshotreader.h index 604d58754991..85b9d38c4521 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotreader.h +++ b/config/src/vespa/config/print/fileconfigsnapshotreader.h @@ -2,7 +2,7 @@ #pragma once #include "configsnapshotreader.h" -#include +#include namespace config { @@ -11,7 +11,7 @@ namespace config { */ class FileConfigSnapshotReader : public ConfigSnapshotReader { public: - FileConfigSnapshotReader(const vespalib::string & fileName); + FileConfigSnapshotReader(const std::string & fileName); /** * Read a config snapshot. @@ -20,7 +20,7 @@ class FileConfigSnapshotReader : public ConfigSnapshotReader { */ ConfigSnapshot read() override; private: - const vespalib::string _fileName; + const std::string _fileName; }; } // namespace config diff --git a/config/src/vespa/config/print/fileconfigsnapshotwriter.cpp b/config/src/vespa/config/print/fileconfigsnapshotwriter.cpp index 574e8c537f07..6959665798c0 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotwriter.cpp +++ b/config/src/vespa/config/print/fileconfigsnapshotwriter.cpp @@ -7,7 +7,7 @@ namespace config { -FileConfigSnapshotWriter::FileConfigSnapshotWriter(const vespalib::string & fileName) +FileConfigSnapshotWriter::FileConfigSnapshotWriter(const std::string & fileName) : _fileName(fileName) { } diff --git a/config/src/vespa/config/print/fileconfigsnapshotwriter.h b/config/src/vespa/config/print/fileconfigsnapshotwriter.h index 0bf0a86ac820..03130d67f0ec 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotwriter.h +++ b/config/src/vespa/config/print/fileconfigsnapshotwriter.h @@ -2,7 +2,7 @@ #pragma once #include "configsnapshotwriter.h" -#include +#include namespace config { @@ -11,10 +11,10 @@ namespace config { */ class FileConfigSnapshotWriter : public ConfigSnapshotWriter { public: - FileConfigSnapshotWriter(const vespalib::string & fileName); + FileConfigSnapshotWriter(const std::string & fileName); bool write(const ConfigSnapshot & snapshot) override; private: - const vespalib::string _fileName; + const std::string _fileName; }; } // namespace config diff --git a/config/src/vespa/config/print/fileconfigwriter.cpp b/config/src/vespa/config/print/fileconfigwriter.cpp index 218bec27a0cd..f70219a9e829 100644 --- a/config/src/vespa/config/print/fileconfigwriter.cpp +++ b/config/src/vespa/config/print/fileconfigwriter.cpp @@ -8,7 +8,7 @@ namespace config { -FileConfigWriter::FileConfigWriter(const vespalib::string & fileName) +FileConfigWriter::FileConfigWriter(const std::string & fileName) : _fileName(fileName) { } diff --git a/config/src/vespa/config/print/fileconfigwriter.h b/config/src/vespa/config/print/fileconfigwriter.h index 9c5e69ca8887..2c3650413662 100644 --- a/config/src/vespa/config/print/fileconfigwriter.h +++ b/config/src/vespa/config/print/fileconfigwriter.h @@ -3,7 +3,7 @@ #include "configwriter.h" #include "configformatter.h" -#include +#include namespace config { @@ -12,12 +12,12 @@ namespace config { */ class FileConfigWriter : public ConfigWriter { public: - FileConfigWriter(const vespalib::string & fileName); + FileConfigWriter(const std::string & fileName); // Implements ConfigWriter bool write(const ConfigInstance & config) override; bool write(const ConfigInstance & config, const ConfigFormatter & formatter) override; private: - const vespalib::string _fileName; + const std::string _fileName; }; } // namespace config diff --git a/config/src/vespa/config/raw/rawsource.cpp b/config/src/vespa/config/raw/rawsource.cpp index 343c0a8cdaa2..c32bd91a2be3 100644 --- a/config/src/vespa/config/raw/rawsource.cpp +++ b/config/src/vespa/config/raw/rawsource.cpp @@ -9,7 +9,7 @@ namespace config { RawSource::~RawSource() = default; -RawSource::RawSource(std::shared_ptr holder, const vespalib::string & payload) +RawSource::RawSource(std::shared_ptr holder, const std::string & payload) : _holder(std::move(holder)), _payload(payload) { diff --git a/config/src/vespa/config/raw/rawsource.h b/config/src/vespa/config/raw/rawsource.h index f3189c61413f..4c1437877b9c 100644 --- a/config/src/vespa/config/raw/rawsource.h +++ b/config/src/vespa/config/raw/rawsource.h @@ -12,7 +12,7 @@ class IConfigHolder; */ class RawSource : public Source { public: - RawSource(std::shared_ptr holder, const vespalib::string & payload); + RawSource(std::shared_ptr holder, const std::string & payload); RawSource(const RawSource &) = delete; RawSource & operator = (const RawSource &) = delete; ~RawSource() override; @@ -22,7 +22,7 @@ class RawSource : public Source { private: std::shared_ptr _holder; StringVector readConfig(); - const vespalib::string _payload; + const std::string _payload; }; } diff --git a/config/src/vespa/config/raw/rawsourcefactory.h b/config/src/vespa/config/raw/rawsourcefactory.h index c1aa95a6511b..49b45ac10a36 100644 --- a/config/src/vespa/config/raw/rawsourcefactory.h +++ b/config/src/vespa/config/raw/rawsourcefactory.h @@ -10,13 +10,13 @@ namespace config { */ class RawSourceFactory : public SourceFactory { public: - RawSourceFactory(const vespalib::string & payload) + RawSourceFactory(const std::string & payload) : _payload(payload) { } std::unique_ptr createSource(std::shared_ptr holder, const ConfigKey & key) const override; private: - const vespalib::string _payload; + const std::string _payload; }; } diff --git a/config/src/vespa/config/retriever/configkeyset.h b/config/src/vespa/config/retriever/configkeyset.h index 276662ba296f..60fd371979d7 100644 --- a/config/src/vespa/config/retriever/configkeyset.h +++ b/config/src/vespa/config/retriever/configkeyset.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include +#include namespace config { @@ -21,7 +21,7 @@ class ConfigKeySet : public std::set * @return *this for chaining. */ template - ConfigKeySet & add(const vespalib::string & configId); + ConfigKeySet & add(const std::string & configId); /** * Add add another key set to this set. @@ -32,7 +32,7 @@ class ConfigKeySet : public std::set ConfigKeySet & add(const ConfigKeySet & configKeySet); private: template - void addImpl(const vespalib::string & configId); + void addImpl(const std::string & configId); }; } // namespace config diff --git a/config/src/vespa/config/retriever/configkeyset.hpp b/config/src/vespa/config/retriever/configkeyset.hpp index 8adbe175e8b3..e0d8cc56f236 100644 --- a/config/src/vespa/config/retriever/configkeyset.hpp +++ b/config/src/vespa/config/retriever/configkeyset.hpp @@ -5,7 +5,7 @@ namespace config { template ConfigKeySet & -ConfigKeySet::add(const vespalib::string & configId) +ConfigKeySet::add(const std::string & configId) { addImpl(configId); return *this; @@ -13,7 +13,7 @@ ConfigKeySet::add(const vespalib::string & configId) template void -ConfigKeySet::addImpl(const vespalib::string & configId) +ConfigKeySet::addImpl(const std::string & configId) { insert(ConfigKey::create(configId)); if constexpr(sizeof...(ConfigTypes) > 0) { diff --git a/config/src/vespa/config/retriever/configretriever.h b/config/src/vespa/config/retriever/configretriever.h index 82f4460cbedd..a703e90d6d87 100644 --- a/config/src/vespa/config/retriever/configretriever.h +++ b/config/src/vespa/config/retriever/configretriever.h @@ -6,8 +6,8 @@ #include "fixedconfigsubscriber.h" #include #include -#include #include +#include namespace config { diff --git a/config/src/vespa/config/retriever/configsnapshot.cpp b/config/src/vespa/config/retriever/configsnapshot.cpp index 69abdc8b0716..f16687e1ce7e 100644 --- a/config/src/vespa/config/retriever/configsnapshot.cpp +++ b/config/src/vespa/config/retriever/configsnapshot.cpp @@ -134,7 +134,7 @@ ConfigSnapshot::serializeKeyV1(Cursor & cursor, const ConfigKey & key) const cursor.setString("defNamespace", Memory(key.getDefNamespace())); cursor.setString("defMd5", Memory(key.getDefMd5())); Cursor & defSchema(cursor.setArray("defSchema")); - for (const vespalib::string & line : key.getDefSchema()) { + for (const std::string & line : key.getDefSchema()) { defSchema.addString(vespalib::Memory(line)); } } @@ -250,7 +250,7 @@ std::pair ConfigSnapshot::deserializeValueV2(Inspector & inspector) const { int64_t lastChanged = static_cast(inspector["lastChanged"].asDouble()); - vespalib::string xxhash64(inspector["xxhash64"].asString().make_string()); + std::string xxhash64(inspector["xxhash64"].asString().make_string()); auto payload = std::make_unique(); copySlimeObject(inspector["payload"], payload->getData().setObject()); return Value(lastChanged, ConfigValue(std::move(payload), xxhash64)); diff --git a/config/src/vespa/config/retriever/configsnapshot.h b/config/src/vespa/config/retriever/configsnapshot.h index 9a4c86b87dab..5afdc8d5ca5e 100644 --- a/config/src/vespa/config/retriever/configsnapshot.h +++ b/config/src/vespa/config/retriever/configsnapshot.h @@ -48,7 +48,7 @@ class ConfigSnapshot * @throws IllegalConfigKeyException if the config does not exist. */ template - std::unique_ptr getConfig(const vespalib::string & configId) const; + std::unique_ptr getConfig(const std::string & configId) const; /** * Query snapshot to check if a config of type ConfigType and id configId is @@ -61,7 +61,7 @@ class ConfigSnapshot * @throws IllegalConfigKeyException if the config does not exist. */ template - bool isChanged(const vespalib::string & configId, int64_t currentGeneration) const; + bool isChanged(const std::string & configId, int64_t currentGeneration) const; ConfigSnapshot & operator = (const ConfigSnapshot & rhs); void swap(ConfigSnapshot & rhs); @@ -74,7 +74,7 @@ class ConfigSnapshot * @return true if exists, false if not. */ template - bool hasConfig(const vespalib::string & configId) const; + bool hasConfig(const std::string & configId) const; /** * Create a new snapshot as a subset of this snapshot based on a set of keys. diff --git a/config/src/vespa/config/retriever/configsnapshot.hpp b/config/src/vespa/config/retriever/configsnapshot.hpp index 475df2eaaed9..63321eef36a9 100644 --- a/config/src/vespa/config/retriever/configsnapshot.hpp +++ b/config/src/vespa/config/retriever/configsnapshot.hpp @@ -9,7 +9,7 @@ namespace config { template std::unique_ptr -ConfigSnapshot::getConfig(const vespalib::string & configId) const +ConfigSnapshot::getConfig(const std::string & configId) const { ConfigKey key(ConfigKey::create(configId)); return find(key)->second.second.newInstance(); @@ -17,7 +17,7 @@ ConfigSnapshot::getConfig(const vespalib::string & configId) const template bool -ConfigSnapshot::isChanged(const vespalib::string & configId, int64_t currentGeneration) const +ConfigSnapshot::isChanged(const std::string & configId, int64_t currentGeneration) const { ConfigKey key(ConfigKey::create(configId)); return currentGeneration < find(key)->second.first; @@ -25,7 +25,7 @@ ConfigSnapshot::isChanged(const vespalib::string & configId, int64_t currentGene template bool -ConfigSnapshot::hasConfig(const vespalib::string & configId) const +ConfigSnapshot::hasConfig(const std::string & configId) const { ConfigKey key(ConfigKey::create(configId)); return (_valueMap.find(key) != _valueMap.end()); diff --git a/config/src/vespa/config/set/configsetsource.cpp b/config/src/vespa/config/set/configsetsource.cpp index bb52aff52c16..c447d146ce68 100644 --- a/config/src/vespa/config/set/configsetsource.cpp +++ b/config/src/vespa/config/set/configsetsource.cpp @@ -32,7 +32,7 @@ ConfigSetSource::getConfig() AsciiConfigWriter writer(ss); writer.write(*instance); StringVector lines(getlines(ss)); - vespalib::string currentXxhash64(calculateContentXxhash64(lines)); + std::string currentXxhash64(calculateContentXxhash64(lines)); if (isGenerationNewer(_generation, _lastState.generation) && currentXxhash64.compare(_lastState.xxhash64) != 0) { LOG(debug, "New generation, updating"); diff --git a/config/src/vespa/config/subscription/configuri.cpp b/config/src/vespa/config/subscription/configuri.cpp index d23c5776150c..eb234b708e84 100644 --- a/config/src/vespa/config/subscription/configuri.cpp +++ b/config/src/vespa/config/subscription/configuri.cpp @@ -13,7 +13,7 @@ ConfigUri::ConfigUri(std::string_view configId) { } -ConfigUri::ConfigUri(const vespalib::string &configId, std::shared_ptr context) +ConfigUri::ConfigUri(const std::string &configId, std::shared_ptr context) : _configId(configId), _context(std::move(context)), _empty(false) @@ -23,12 +23,12 @@ ConfigUri::ConfigUri(const vespalib::string &configId, std::shared_ptr & ConfigUri::getContext() const { return _context; } ConfigUri @@ -45,7 +45,7 @@ ConfigUri::createEmpty() return uri; } -ConfigUri ConfigUri::createFromSpec(const vespalib::string& configId, const SourceSpec& spec) +ConfigUri ConfigUri::createFromSpec(const std::string& configId, const SourceSpec& spec) { return ConfigUri(configId, std::make_shared(spec)); } diff --git a/config/src/vespa/config/subscription/configuri.h b/config/src/vespa/config/subscription/configuri.h index 90c39428b54b..657127e58363 100644 --- a/config/src/vespa/config/subscription/configuri.h +++ b/config/src/vespa/config/subscription/configuri.h @@ -29,7 +29,7 @@ class ConfigUri { * @param configId The config id. * @param context A context object that can be shared with multiple URIs. */ - ConfigUri(const vespalib::string &configId, std::shared_ptr context); + ConfigUri(const std::string &configId, std::shared_ptr context); ~ConfigUri(); @@ -39,7 +39,7 @@ class ConfigUri { * @param configId The config id to give the new URI. * @return A new config URI. */ - ConfigUri createWithNewId(const vespalib::string & configId) const; + ConfigUri createWithNewId(const std::string & configId) const; /** * Create a config uri from a config instance. The instance does not need @@ -55,7 +55,7 @@ class ConfigUri { * @param configId The config id to subscribe to. * @param spec The source spec pointing to the config source. */ - static ConfigUri createFromSpec(const vespalib::string & configId, + static ConfigUri createFromSpec(const std::string & configId, const SourceSpec & spec); /** @@ -67,7 +67,7 @@ class ConfigUri { * Get this URIs config id. Used by subscriber. * @return The config id of this uri. */ - const vespalib::string & getConfigId() const; + const std::string & getConfigId() const; /** * Get the context for this uri. Used by subscriber. @@ -82,7 +82,7 @@ class ConfigUri { bool empty() const { return _empty; } private: - vespalib::string _configId; + std::string _configId; std::shared_ptr _context; bool _empty; }; diff --git a/config/src/vespa/config/subscription/sourcespec.cpp b/config/src/vespa/config/subscription/sourcespec.cpp index 0c3767299897..0aaca86a7830 100644 --- a/config/src/vespa/config/subscription/sourcespec.cpp +++ b/config/src/vespa/config/subscription/sourcespec.cpp @@ -40,7 +40,7 @@ FileSpec::FileSpec(std::string_view fileName) } void -FileSpec::verifyName(const vespalib::string & fileName) +FileSpec::verifyName(const std::string & fileName) { if (fileName.length() > 4) { std::string ending(fileName.substr(fileName.length() - 4, 4)); @@ -78,7 +78,7 @@ ServerSpec::ServerSpec() { char* cfgSourcesPtr = getenv("VESPA_CONFIG_SOURCES"); if (cfgSourcesPtr != nullptr) { - vespalib::string cfgSourcesStr(cfgSourcesPtr); + std::string cfgSourcesStr(cfgSourcesPtr); initialize(cfgSourcesStr); } else { initialize("localhost"); @@ -91,7 +91,7 @@ ServerSpec::initialize(std::string_view hostSpec) typedef vespalib::StringTokenizer tokenizer; tokenizer tok(hostSpec, ","); for (tokenizer::Iterator it = tok.begin(); it != tok.end(); it++) { - vespalib::string srcHost(*it); + std::string srcHost(*it); vespalib::asciistream spec; if (srcHost.find("tcp/") == std::string::npos) { spec << "tcp/"; @@ -160,7 +160,7 @@ ConfigSet::createSourceFactory(const TimingValues & ) const } void -ConfigSet::addBuilder(const vespalib::string & configId, ConfigInstance * builder) +ConfigSet::addBuilder(const std::string & configId, ConfigInstance * builder) { assert(builder != nullptr); BuilderMap & builderMap(*_builderMap); diff --git a/config/src/vespa/config/subscription/sourcespec.h b/config/src/vespa/config/subscription/sourcespec.h index 0e93c576cfe2..aafbd206c3d9 100644 --- a/config/src/vespa/config/subscription/sourcespec.h +++ b/config/src/vespa/config/subscription/sourcespec.h @@ -3,9 +3,9 @@ #pragma once #include -#include -#include #include +#include +#include class FNET_Transport; @@ -15,7 +15,7 @@ class ConfigInstance; class SourceFactory; struct TimingValues; -typedef vespalib::string SourceSpecKey; +typedef std::string SourceSpecKey; /** * A source spec is a user provided specification of which sources to fetch @@ -62,9 +62,9 @@ class RawSpec : public SourceSpec * * @return the config in a string. */ - const vespalib::string & toString() const { return _config; } + const std::string & toString() const { return _config; } private: - vespalib::string _config; + std::string _config; }; /** @@ -87,12 +87,12 @@ class FileSpec : public SourceSpec * * @return the filename from which to serve config. */ - const vespalib::string & getFileName() const { return _fileName; } + const std::string & getFileName() const { return _fileName; } std::unique_ptr createSourceFactory(const TimingValues & timingValues) const override; private: - void verifyName(const vespalib::string & fileName); - vespalib::string _fileName; + void verifyName(const std::string & fileName); + std::string _fileName; }; /** @@ -115,11 +115,11 @@ class DirSpec : public SourceSpec * * @return the directory from which to serve config. */ - const vespalib::string & getDirName() const { return _dirName; } + const std::string & getDirName() const { return _dirName; } std::unique_ptr createSourceFactory(const TimingValues & timingValues) const override; private: - vespalib::string _dirName; + std::string _dirName; }; /** @@ -130,7 +130,7 @@ class ServerSpec : public SourceSpec { public: /// A list of host specifications - using HostSpecList = std::vector; + using HostSpecList = std::vector; /** * Construct a ServerSpec that fetches the host specs from the @@ -167,7 +167,7 @@ class ServerSpec : public SourceSpec * * @param i the spec element to retrieve. */ - const vespalib::string & getHost(size_t i) const { return _hostList[i]; } + const std::string & getHost(size_t i) const { return _hostList[i]; } /** * Get the protocol version as parsed by this source spec. @@ -230,7 +230,7 @@ class ConfigSet : public SourceSpec * @param builder A builder instance that you can use to change config later * and then call reload on the ConfigContext object. */ - void addBuilder(const vespalib::string & configId, ConfigInstance * builder); + void addBuilder(const std::string & configId, ConfigInstance * builder); std::unique_ptr createSourceFactory(const TimingValues & timingValues) const override; private: diff --git a/configd/src/apps/sentinel/connectivity.h b/configd/src/apps/sentinel/connectivity.h index 6fd2d3b96f68..133fe5c3fba3 100644 --- a/configd/src/apps/sentinel/connectivity.h +++ b/configd/src/apps/sentinel/connectivity.h @@ -6,8 +6,8 @@ #include "cc-result.h" #include #include -#include #include +#include using cloud::config::SentinelConfig; using cloud::config::ModelConfig; diff --git a/configd/src/apps/sentinel/manager.cpp b/configd/src/apps/sentinel/manager.cpp index 9ee259bb892a..45da3c84ab84 100644 --- a/configd/src/apps/sentinel/manager.cpp +++ b/configd/src/apps/sentinel/manager.cpp @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include #include LOG_SETUP(".sentinel.manager"); @@ -88,7 +88,7 @@ Manager::doConfigure() ServiceMap services; for (unsigned int i = 0; i < config.service.size(); ++i) { const SentinelConfig::Service& serviceConfig = config.service[i]; - const vespalib::string name(serviceConfig.name); + const std::string name(serviceConfig.name); auto found(_services.find(name)); if (found == _services.end()) { services[name] = std::make_unique(serviceConfig, config.application, _outputConnections, _env.metrics()); @@ -237,7 +237,7 @@ Manager::serviceByPid(pid_t pid) } Service * -Manager::serviceByName(const vespalib::string & name) +Manager::serviceByName(const std::string & name) { auto found(_services.find(name)); if (found != _services.end()) { diff --git a/configd/src/apps/sentinel/manager.h b/configd/src/apps/sentinel/manager.h index 6967e078dd96..d9aab2d2a665 100644 --- a/configd/src/apps/sentinel/manager.h +++ b/configd/src/apps/sentinel/manager.h @@ -30,7 +30,7 @@ class OutputConnection; **/ class Manager { private: - typedef std::map ServiceMap; + typedef std::map ServiceMap; Env &_env; ServiceMap _services; @@ -41,7 +41,7 @@ class Manager { Manager& operator =(const Manager&) = delete; Service *serviceByPid(pid_t pid); - Service *serviceByName(const vespalib::string & name); + Service *serviceByName(const std::string & name); void handleCommands(); void handleCmd(const Cmd& cmd); void handleOutputs(); diff --git a/configd/src/apps/sentinel/outward-check.h b/configd/src/apps/sentinel/outward-check.h index 8e4858e972de..6271186e1c3b 100644 --- a/configd/src/apps/sentinel/outward-check.h +++ b/configd/src/apps/sentinel/outward-check.h @@ -3,13 +3,13 @@ #pragma once #include "cc-result.h" -#include #include #include #include #include #include #include +#include namespace config::sentinel { diff --git a/configd/src/apps/sentinel/peer-check.h b/configd/src/apps/sentinel/peer-check.h index 041f8a68be16..0bb097e966c3 100644 --- a/configd/src/apps/sentinel/peer-check.h +++ b/configd/src/apps/sentinel/peer-check.h @@ -3,11 +3,11 @@ #pragma once #include "status-callback.h" -#include #include #include #include #include +#include namespace config::sentinel { diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index 2c51eff3dca4..430dc306a0d7 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -28,8 +29,8 @@ namespace config::sentinel { namespace { -vespalib::string getVespaTempDir() { - vespalib::string tmp = getenv("ROOT"); +std::string getVespaTempDir() { + std::string tmp = getenv("ROOT"); tmp += "/var/db/vespa/tmp"; return tmp; } @@ -143,7 +144,7 @@ Service::terminate(bool catchable, bool dumpState) return 0; } else { if (dumpState && _state != KILLING) { - vespalib::string pstackCmd = make_string("ulimit -c 0; pstack %d > %s/%s.pstack.%d 2>&1", + std::string pstackCmd = make_string("ulimit -c 0; pstack %d > %s/%s.pstack.%d 2>&1", _pid, getVespaTempDir().c_str(), name().c_str(), _pid); LOG(info, "%s:%d failed to stop. Stack dumping with %s", name().c_str(), _pid, pstackCmd.c_str()); int pstackRet = system(pstackCmd.c_str()); @@ -383,7 +384,7 @@ Service::runChild() std::_Exit(EXIT_FAILURE); } -const vespalib::string & +const std::string & Service::name() const { return _config->name; diff --git a/configd/src/apps/sentinel/service.h b/configd/src/apps/sentinel/service.h index 2300ccb0e135..bea06bf9ecdb 100644 --- a/configd/src/apps/sentinel/service.h +++ b/configd/src/apps/sentinel/service.h @@ -2,10 +2,10 @@ #pragma once #include "metrics.h" -#include #include #include #include +#include using cloud::config::SentinelConfig; @@ -59,7 +59,7 @@ class Service void start(); void remove(); void youExited(int status); // Call this if waitpid says it exited - const vespalib::string & name() const; + const std::string & name() const; const char *stateName() const { return stateName(_state); } bool isRunning() const; bool wantsRestart() const; diff --git a/configutil/src/apps/configstatus/main.cpp b/configutil/src/apps/configstatus/main.cpp index c5d79f1bc64e..7fd039c430fe 100644 --- a/configutil/src/apps/configstatus/main.cpp +++ b/configutil/src/apps/configstatus/main.cpp @@ -13,10 +13,10 @@ LOG_SETUP("vespa-config-status"); class Application { ConfigStatus::Flags _flags; - vespalib::string _cfgId; - vespalib::string _specString; + std::string _cfgId; + std::string _specString; int parseOpts(int argc, char **argv); - vespalib::string getSources(); + std::string getSources(); HostFilter parse_host_set(std::string_view raw_arg) const; public: void usage(const char *self); @@ -94,8 +94,8 @@ int Application::main(int argc, char **argv) { return status.action(); } -vespalib::string Application::getSources() { - vespalib::string specs; +std::string Application::getSources() { + std::string specs; for (std::string v : vespa::Defaults::vespaConfigSourcesRpcAddrs()) { if (! specs.empty()) specs += ","; specs += v; diff --git a/configutil/src/apps/modelinspect/main.cpp b/configutil/src/apps/modelinspect/main.cpp index 3e6d9a4ee36c..f1515d695537 100644 --- a/configutil/src/apps/modelinspect/main.cpp +++ b/configutil/src/apps/modelinspect/main.cpp @@ -14,10 +14,10 @@ LOG_SETUP("vespa-model-inspect"); class Application { ModelInspect::Flags _flags; - vespalib::string _cfgId; - vespalib::string _specString; + std::string _cfgId; + std::string _specString; int parseOpts(int argc, char **argv); - vespalib::string getSources(); + std::string getSources(); config::ConfigUri getConfigUri(); public: void usage(const char *self); @@ -65,10 +65,10 @@ Application::parseOpts(int argc, char **argv) return optind; } -vespalib::string +std::string Application::getSources() { - vespalib::string specs; + std::string specs; for (std::string v : vespa::Defaults::vespaConfigSourcesRpcAddrs()) { if (! specs.empty()) specs += ","; specs += v; diff --git a/configutil/src/lib/configstatus.h b/configutil/src/lib/configstatus.h index e5e979598856..4a409964c537 100644 --- a/configutil/src/lib/configstatus.h +++ b/configutil/src/lib/configstatus.h @@ -3,8 +3,8 @@ #include "hostfilter.h" #include -#include #include +#include class ConfigStatus { diff --git a/configutil/src/lib/modelinspect.cpp b/configutil/src/lib/modelinspect.cpp index b9823ad6ea2d..d6126e9a9deb 100644 --- a/configutil/src/lib/modelinspect.cpp +++ b/configutil/src/lib/modelinspect.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -44,8 +45,8 @@ ModelInspect::ModelInspect(Flags flags, const config::ConfigUri &uri, std::ostre ModelInspect::~ModelInspect() = default; void -ModelInspect::printPort(const vespalib::string &host, int port, - const vespalib::string &tags) +ModelInspect::printPort(const std::string &host, int port, + const std::string &tags) { if (_flags.tagfilt) { for (size_t i = 0; i < _flags.tagFilter.size(); ++i) { @@ -62,14 +63,14 @@ ModelInspect::printPort(const vespalib::string &host, int port, if (_flags.tagfilt) { _out << "\n"; } else { - vespalib::string upper = upcase(tags); + std::string upper = upcase(tags); _out << " (" << upper << ")\n"; } } void ModelInspect::printService(const cloud::config::ModelConfig::Hosts::Services &svc, - const vespalib::string &host) + const std::string &host) { if (!_flags.tagfilt) { _out << svc.name << " @ " << host << " : " << svc.clustertype << std::endl; @@ -83,7 +84,7 @@ ModelInspect::printService(const cloud::config::ModelConfig::Hosts::Services &sv int ModelInspect::action(int cnt, char **argv) { - const vespalib::string cmd = vespalib::safe_char_2_string(*argv++); + const std::string cmd = vespalib::safe_char_2_string(*argv++); if (cnt == 1) { if (cmd == "yamldump") { yamlDump(); @@ -122,7 +123,7 @@ ModelInspect::action(int cnt, char **argv) } } if (cnt == 2) { - vespalib::string arg = vespalib::safe_char_2_string(*argv++); + std::string arg = vespalib::safe_char_2_string(*argv++); if (cmd == "host") { return listHost(arg); } @@ -131,7 +132,7 @@ ModelInspect::action(int cnt, char **argv) } if (cmd == "service") { size_t colon = arg.find(':'); - if (colon != vespalib::string::npos) { + if (colon != std::string::npos) { return listService(arg.substr(0, colon), arg.substr(colon + 1)); } else { @@ -143,8 +144,8 @@ ModelInspect::action(int cnt, char **argv) } } if (cnt == 3) { - vespalib::string arg1 = vespalib::safe_char_2_string(*argv++); - vespalib::string arg2 = vespalib::safe_char_2_string(*argv++); + std::string arg1 = vespalib::safe_char_2_string(*argv++); + std::string arg2 = vespalib::safe_char_2_string(*argv++); if (cmd == "get-index-of") { return getIndexOf(arg1, arg2); } @@ -155,7 +156,7 @@ ModelInspect::action(int cnt, char **argv) void ModelInspect::dumpService(const cloud::config::ModelConfig::Hosts::Services &svc, - const vespalib::string &host) + const std::string &host) { _out << "- servicename: " << svc.name << "\n"; _out << " servicetype: " << svc.type << "\n"; @@ -188,7 +189,7 @@ ModelInspect::yamlDump() void ModelInspect::listHosts() { - std::vector hosts; + std::vector hosts; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { const cloud::config::ModelConfig::Hosts &hconf = _cfg->hosts[i]; hosts.push_back(hconf.name); @@ -202,7 +203,7 @@ ModelInspect::listHosts() void ModelInspect::listServices() { - typedef std::set Set; + typedef std::set Set; Set services; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { const cloud::config::ModelConfig::Hosts &hconf = _cfg->hosts[i]; @@ -218,7 +219,7 @@ ModelInspect::listServices() void ModelInspect::listClusters() { - typedef std::set Set; + typedef std::set Set; Set clusters; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { const cloud::config::ModelConfig::Hosts &hconf = _cfg->hosts[i]; @@ -234,7 +235,7 @@ ModelInspect::listClusters() void ModelInspect::listConfigIds() { - std::vector configids; + std::vector configids; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { const cloud::config::ModelConfig::Hosts &hconf = _cfg->hosts[i]; for (size_t j = 0; j < hconf.services.size(); ++j) { @@ -248,7 +249,7 @@ ModelInspect::listConfigIds() } int -ModelInspect::listHost(const vespalib::string host) +ModelInspect::listHost(const std::string host) { for (size_t i = 0; i < _cfg->hosts.size(); ++i) { const cloud::config::ModelConfig::Hosts &hconf = _cfg->hosts[i]; @@ -264,7 +265,7 @@ ModelInspect::listHost(const vespalib::string host) } int -ModelInspect::listCluster(const vespalib::string cluster) +ModelInspect::listCluster(const std::string cluster) { bool found = false; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { @@ -294,7 +295,7 @@ ModelInspect::listAllPorts() } int -ModelInspect::listService(const vespalib::string svctype) +ModelInspect::listService(const std::string svctype) { bool found = false; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { @@ -313,8 +314,8 @@ ModelInspect::listService(const vespalib::string svctype) int -ModelInspect::listService(const vespalib::string cluster, - const vespalib::string svctype) +ModelInspect::listService(const std::string cluster, + const std::string svctype) { bool found = false; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { @@ -334,7 +335,7 @@ ModelInspect::listService(const vespalib::string cluster, } int -ModelInspect::listConfigId(const vespalib::string configid) +ModelInspect::listConfigId(const std::string configid) { bool found = false; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { @@ -352,7 +353,7 @@ ModelInspect::listConfigId(const vespalib::string configid) } int -ModelInspect::getIndexOf(const vespalib::string service, const vespalib::string host) +ModelInspect::getIndexOf(const std::string service, const std::string host) { bool found = false; for (size_t i = 0; i < _cfg->hosts.size(); ++i) { diff --git a/configutil/src/lib/modelinspect.h b/configutil/src/lib/modelinspect.h index eeb28b2e84b1..1a0652dbc5dd 100644 --- a/configutil/src/lib/modelinspect.h +++ b/configutil/src/lib/modelinspect.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include +#include class ModelInspect @@ -11,7 +11,7 @@ class ModelInspect bool verbose; bool makeuri; bool tagfilt; - std::vector tagFilter; + std::vector tagFilter; Flags(); Flags(const Flags &); Flags & operator = (const Flags &); @@ -30,14 +30,14 @@ class ModelInspect virtual void listServices(); virtual void listClusters(); virtual void listConfigIds(); - virtual int listHost(const vespalib::string host); - virtual int listCluster(const vespalib::string cluster); + virtual int listHost(const std::string host); + virtual int listCluster(const std::string cluster); virtual int listAllPorts(); - virtual int listService(const vespalib::string svctype); - virtual int listService(const vespalib::string cluster, - const vespalib::string svctype); - virtual int listConfigId(const vespalib::string configid); - virtual int getIndexOf(const vespalib::string service, const vespalib::string host); + virtual int listService(const std::string svctype); + virtual int listService(const std::string cluster, + const std::string svctype); + virtual int listConfigId(const std::string configid); + virtual int getIndexOf(const std::string service, const std::string host); private: std::unique_ptr _cfg; @@ -45,10 +45,10 @@ class ModelInspect std::ostream &_out; void printService(const cloud::config::ModelConfig::Hosts::Services &svc, - const vespalib::string &host); - void printPort(const vespalib::string &host, int port, - const vespalib::string &tags); + const std::string &host); + void printPort(const std::string &host, int port, + const std::string &tags); void dumpService(const cloud::config::ModelConfig::Hosts::Services &svc, - const vespalib::string &host); + const std::string &host); }; diff --git a/configutil/src/lib/tags.cpp b/configutil/src/lib/tags.cpp index 5a96102e164d..d31b5238559a 100644 --- a/configutil/src/lib/tags.cpp +++ b/configutil/src/lib/tags.cpp @@ -1,14 +1,14 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "tags.h" -#include #include +#include namespace configdefinitions { -vespalib::string upcase(const vespalib::string &orig) +std::string upcase(const std::string &orig) { - vespalib::string upper(orig); + std::string upper(orig); for (size_t i = 0; i < orig.size(); ++i) { int l = (unsigned char)orig[i]; upper[i] = (unsigned char)std::toupper(l); @@ -16,14 +16,14 @@ vespalib::string upcase(const vespalib::string &orig) return upper; } -bool tagsContain(const vespalib::string &tags, const vespalib::string &tag) +bool tagsContain(const std::string &tags, const std::string &tag) { - vespalib::string allupper = upcase(tags); - vespalib::string tagupper = upcase(tag); + std::string allupper = upcase(tags); + std::string tagupper = upcase(tag); for (;;) { size_t pos = allupper.rfind(' '); - if (pos == vespalib::string::npos) { + if (pos == std::string::npos) { break; } if (allupper.substr(pos+1) == tagupper) { diff --git a/configutil/src/lib/tags.h b/configutil/src/lib/tags.h index 836e20a7f4fc..f87ee4538b6f 100644 --- a/configutil/src/lib/tags.h +++ b/configutil/src/lib/tags.h @@ -1,12 +1,12 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace configdefinitions { -vespalib::string upcase(const vespalib::string &orig); -bool tagsContain(const vespalib::string &tags, const vespalib::string &tag); +std::string upcase(const std::string &orig); +bool tagsContain(const std::string &tags, const std::string &tag); } diff --git a/configutil/src/tests/model_inspect/model_inspect_test.cpp b/configutil/src/tests/model_inspect/model_inspect_test.cpp index 7ab570242cab..f4535d24560f 100644 --- a/configutil/src/tests/model_inspect/model_inspect_test.cpp +++ b/configutil/src/tests/model_inspect/model_inspect_test.cpp @@ -45,7 +45,7 @@ class MakeUriFlags : public ModelInspect::Flags { class TagFilterFlags : public ModelInspect::Flags { public: - TagFilterFlags(vespalib::string tag) : ModelInspect::Flags() { + TagFilterFlags(std::string tag) : ModelInspect::Flags() { tagfilt = true; tagFilter.push_back(tag); } @@ -88,13 +88,13 @@ class ModelDummy : public ModelInspect { void listServices() override { _listServices = true; }; void listClusters() override { _listClusters = true; }; void listConfigIds() override { _listConfigIds = true; }; - int listHost(const vespalib::string) override { _listHost = true; return 0; }; + int listHost(const std::string) override { _listHost = true; return 0; }; int listAllPorts() override { _listAllPorts = true; return 0; }; - int listCluster(const vespalib::string) override { _listCluster = true; return 0; }; - int listService(const vespalib::string) override { _listService = true; return 0; }; - int listService(const vespalib::string, const vespalib::string) override { _listService2 = true; return 0; }; - int listConfigId(const vespalib::string) override { _listConfigId = true; return 0; }; - int getIndexOf(const vespalib::string, const vespalib::string) override { _getIndexOf = true; return 0; }; + int listCluster(const std::string) override { _listCluster = true; return 0; }; + int listService(const std::string) override { _listService = true; return 0; }; + int listService(const std::string, const std::string) override { _listService2 = true; return 0; }; + int listConfigId(const std::string) override { _listConfigId = true; return 0; }; + int getIndexOf(const std::string, const std::string) override { _getIndexOf = true; return 0; }; ~ModelDummy() {}; }; diff --git a/configutil/src/tests/tags/tags_test.cpp b/configutil/src/tests/tags/tags_test.cpp index b311f8dbd8fc..912a22ef9209 100644 --- a/configutil/src/tests/tags/tags_test.cpp +++ b/configutil/src/tests/tags/tags_test.cpp @@ -5,8 +5,8 @@ using namespace configdefinitions; TEST("upcase") { - EXPECT_EQUAL(vespalib::string("A"), upcase(vespalib::string("a"))); - EXPECT_EQUAL(vespalib::string("A"), upcase(vespalib::string("A"))); + EXPECT_EQUAL(std::string("A"), upcase(std::string("a"))); + EXPECT_EQUAL(std::string("A"), upcase(std::string("A"))); } TEST("tagsContain") { diff --git a/document/src/tests/base/documentid_benchmark.cpp b/document/src/tests/base/documentid_benchmark.cpp index d0220f010f51..79ff86ed6cad 100644 --- a/document/src/tests/base/documentid_benchmark.cpp +++ b/document/src/tests/base/documentid_benchmark.cpp @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) if (argc < 3) { fprintf(stderr, "Usage %s \n", argv[0]); } - vespalib::string s(argv[1]); + std::string s(argv[1]); uint64_t n = strtoul(argv[2], nullptr, 0); printf("Creating documentid '%s' %" PRIu64 " times\n", s.c_str(), n); printf("sizeof(IdString)=%ld, sizeof(IdIdString)=%ld\n", sizeof(IdString), sizeof(IdString)); diff --git a/document/src/tests/base/documentid_test.cpp b/document/src/tests/base/documentid_test.cpp index 66632fc1bf6c..879c76d007a2 100644 --- a/document/src/tests/base/documentid_test.cpp +++ b/document/src/tests/base/documentid_test.cpp @@ -6,7 +6,7 @@ #include using namespace document; -using vespalib::string; +using std::string; namespace { diff --git a/document/src/tests/buckettest.cpp b/document/src/tests/buckettest.cpp index 837bad81d3e6..890f09838e90 100644 --- a/document/src/tests/buckettest.cpp +++ b/document/src/tests/buckettest.cpp @@ -30,7 +30,7 @@ TEST(BucketTest, testBucketId) EXPECT_TRUE(!(id1 < id2) && !(id2 < id1)); EXPECT_EQ(Hex(0), Hex(id1.getId())); EXPECT_EQ(Hex(0), Hex(id1.getRawId())); - EXPECT_EQ(vespalib::string("BucketId(0x0000000000000000)"), + EXPECT_EQ(std::string("BucketId(0x0000000000000000)"), id1.toString()); EXPECT_EQ(0u, id1.getUsedBits()); @@ -40,7 +40,7 @@ TEST(BucketTest, testBucketId) EXPECT_TRUE((id1 < id2) && !(id2 < id1)); EXPECT_EQ(Hex(0x4000000000000123ull), Hex(id2.getId())); EXPECT_EQ(Hex(0x4000000000000123ull), Hex(id2.getRawId())); - EXPECT_EQ(vespalib::string("BucketId(0x4000000000000123)"), + EXPECT_EQ(std::string("BucketId(0x4000000000000123)"), id2.toString()); EXPECT_EQ(16u, id2.getUsedBits()); @@ -223,10 +223,10 @@ TEST(BucketTest, testContains) TEST(BucketTest, testToString) { BucketSpace bucketSpace(0x123450006789ULL); - EXPECT_EQ(vespalib::string("BucketSpace(0x0000123450006789)"), bucketSpace.toString()); + EXPECT_EQ(std::string("BucketSpace(0x0000123450006789)"), bucketSpace.toString()); Bucket bucket(bucketSpace, BucketId(0x123456789ULL)); EXPECT_EQ( - vespalib::string("Bucket(BucketSpace(0x0000123450006789), BucketId(0x0000000123456789))"), + std::string("Bucket(BucketSpace(0x0000123450006789), BucketId(0x0000000123456789))"), bucket.toString()); } diff --git a/document/src/tests/datatype/datatype_test.cpp b/document/src/tests/datatype/datatype_test.cpp index 9ed863788831..4f5c0905a6e7 100644 --- a/document/src/tests/datatype/datatype_test.cpp +++ b/document/src/tests/datatype/datatype_test.cpp @@ -59,12 +59,12 @@ class TensorDataTypeFixture { ~TensorDataTypeFixture(); - void setup(const vespalib::string &spec) + void setup(const std::string &spec) { _tensorDataType = TensorDataType::fromSpec(spec); } - bool isAssignableType(const vespalib::string &spec) const + bool isAssignableType(const std::string &spec) const { auto assignType = ValueType::from_spec(spec); return _tensorDataType->isAssignableType(assignType); diff --git a/document/src/tests/document_type_repo_factory/document_type_repo_factory_test.cpp b/document/src/tests/document_type_repo_factory/document_type_repo_factory_test.cpp index 4db2ea38d7ee..d2d3a017d12d 100644 --- a/document/src/tests/document_type_repo_factory/document_type_repo_factory_test.cpp +++ b/document/src/tests/document_type_repo_factory/document_type_repo_factory_test.cpp @@ -3,11 +3,11 @@ #include #include #include -#include #include #include +#include -using vespalib::string; +using std::string; using namespace document::config_builder; using namespace document; diff --git a/document/src/tests/documentidtest.cpp b/document/src/tests/documentidtest.cpp index b22e5e8f1f15..335a5a51b1a7 100644 --- a/document/src/tests/documentidtest.cpp +++ b/document/src/tests/documentidtest.cpp @@ -44,7 +44,7 @@ TEST(DocumentIdTest, generateJavaComplianceFile) TEST(DocumentIdTest, testOutput) { DocumentId id("id:ns:news::crawler:http://www.yahoo.com"); - vespalib::string expected("id:ns:news::crawler:http://www.yahoo.com"); + std::string expected("id:ns:news::crawler:http://www.yahoo.com"); EXPECT_EQ(expected, id.toString()); } @@ -86,7 +86,7 @@ TEST(DocumentIdTest, testCopying) TEST(DocumentIdTest, checkNtnuGlobalId) { DocumentId id("id:ns:news::crawler:http://www.ntnu.no/"); - EXPECT_EQ(vespalib::string("gid(0x1e9d7fc69ac6c1da44dd87e0)"), id.getGlobalId().toString()); + EXPECT_EQ(std::string("gid(0x1e9d7fc69ac6c1da44dd87e0)"), id.getGlobalId().toString()); } TEST(DocumentIdTest, freestandingLocationFromGroupNameFuncMatchesIdLocation) diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp index 0ea7f85120d0..b2e760583492 100644 --- a/document/src/tests/documentselectparsertest.cpp +++ b/document/src/tests/documentselectparsertest.cpp @@ -359,8 +359,8 @@ TEST_F(DocumentSelectParserTest, testParseTerminals) const auto & fnode = dynamic_cast(compnode.getLeft()); const auto & vnode = dynamic_cast(compnode.getRight()); - EXPECT_EQ(vespalib::string("headerval"), fnode.getFieldName()); - EXPECT_EQ(vespalib::string("test"), vnode.getValue()); + EXPECT_EQ(std::string("headerval"), fnode.getFieldName()); + EXPECT_EQ(std::string("test"), vnode.getValue()); // Test whitespace verifyParse("testdoctype1.headerval == \"te st \""); verifyParse(" \t testdoctype1.headerval\t== \t \"test\"\t", @@ -374,7 +374,7 @@ TEST_F(DocumentSelectParserTest, testParseTerminals) node = _parser->parse("testdoctype1.headerval == \"\\tt\\x48 \\n\""); select::Compare& escapednode(dynamic_cast(*node)); const auto & escval = dynamic_cast(escapednode.getRight()); - EXPECT_EQ(vespalib::string("\ttH \n"), escval.getValue()); + EXPECT_EQ(std::string("\ttH \n"), escval.getValue()); // Test <= <, > >= verifyParse("testdoctype1.headerval >= 123"); verifyParse("testdoctype1.headerval > 123"); @@ -1288,7 +1288,7 @@ char_from_u8(const char * p) { TEST_F(DocumentSelectParserTest, testUtf8) { createDocs(); - vespalib::string utf8name = char_from_u8(u8"H\u00e5kon"); + std::string utf8name = char_from_u8(u8"H\u00e5kon"); EXPECT_EQ(size_t(6), utf8name.size()); /// \todo TODO (was warning): UTF8 test for glob/regex support in selection language disabled. Known not to work @@ -1309,22 +1309,22 @@ DocumentSelectParserTest::parseFieldValue(const std::string& expression) { TEST_F(DocumentSelectParserTest, testThatSimpleFieldValuesHaveCorrectFieldName) { EXPECT_EQ( - vespalib::string("headerval"), + std::string("headerval"), parseFieldValue("testdoctype1.headerval")->getRealFieldName()); } TEST_F(DocumentSelectParserTest, testThatComplexFieldValuesHaveCorrectFieldNames) { - EXPECT_EQ(vespalib::string("headerval"), + EXPECT_EQ(std::string("headerval"), parseFieldValue("testdoctype1.headerval{test}")->getRealFieldName()); - EXPECT_EQ(vespalib::string("headerval"), + EXPECT_EQ(std::string("headerval"), parseFieldValue("testdoctype1.headerval[42]")->getRealFieldName()); - EXPECT_EQ(vespalib::string("headerval"), + EXPECT_EQ(std::string("headerval"), parseFieldValue("testdoctype1.headerval.meow.meow{test}")->getRealFieldName()); - EXPECT_EQ(vespalib::string("headerval"), + EXPECT_EQ(std::string("headerval"), parseFieldValue("testdoctype1.headerval .meow.meow{test}")->getRealFieldName()); } @@ -1537,8 +1537,8 @@ TEST_F(DocumentSelectParserTest, test_can_build_field_value_from_field_expr_node auto lhs = std::make_unique("mydoctype"); auto root = std::make_unique(std::move(lhs), "foo"); auto fv = root->convert_to_field_value(); - EXPECT_EQ(vespalib::string("mydoctype"), fv->getDocType()); - EXPECT_EQ(vespalib::string("foo"), fv->getFieldName()); + EXPECT_EQ(std::string("mydoctype"), fv->getDocType()); + EXPECT_EQ(std::string("foo"), fv->getFieldName()); } { // Nested field expression @@ -1546,8 +1546,8 @@ TEST_F(DocumentSelectParserTest, test_can_build_field_value_from_field_expr_node auto lhs2 = std::make_unique(std::move(lhs1), "foo"); auto root = std::make_unique(std::move(lhs2), "bar"); auto fv = root->convert_to_field_value(); - EXPECT_EQ(vespalib::string("mydoctype"), fv->getDocType()); - EXPECT_EQ(vespalib::string("foo.bar"), fv->getFieldName()); + EXPECT_EQ(std::string("mydoctype"), fv->getDocType()); + EXPECT_EQ(std::string("foo.bar"), fv->getFieldName()); } } @@ -1562,8 +1562,8 @@ TEST_F(DocumentSelectParserTest, test_can_build_function_call_from_field_expr_no auto lhs2 = std::make_unique(std::move(lhs1), "foo"); auto root = std::make_unique(std::move(lhs2), "lowercase"); auto func = root->convert_to_function_call(); - EXPECT_EQ(vespalib::string("lowercase"), func->getFunctionName()); - // TODO vespalib::string? + EXPECT_EQ(std::string("lowercase"), func->getFunctionName()); + // TODO std::string? EXPECT_EQ(std::string("(FIELD mydoctype foo)"), node_to_string(func->getChild())); } } @@ -1576,7 +1576,7 @@ TEST_F(DocumentSelectParserTest, test_function_call_on_doctype_throws_exception) try { root->convert_to_function_call(); } catch (const vespalib::IllegalArgumentException& e) { - EXPECT_EQ(vespalib::string("Cannot call function 'lowercase' directly on document type"), + EXPECT_EQ(std::string("Cannot call function 'lowercase' directly on document type"), e.getMessage()); } } diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index 6a5cc0cea2aa..d31d1b226e3d 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -47,10 +47,10 @@ TEST(DocumentTest, testSizeOf) EXPECT_EQ(24u, sizeof(vespalib::alloc::Alloc)); EXPECT_EQ(24u, sizeof(ByteBuffer)); EXPECT_EQ(32u, sizeof(vespalib::GrowableByteBuffer)); - EXPECT_EQ(24u + sizeof(vespalib::string), sizeof(IdString)); - EXPECT_EQ(40ul + sizeof(vespalib::string), sizeof(DocumentId)); - EXPECT_EQ(192ul + sizeof(vespalib::string), sizeof(Document)); - EXPECT_EQ(16ul + sizeof(vespalib::string), sizeof(NumericDataType)); + EXPECT_EQ(24u + sizeof(std::string), sizeof(IdString)); + EXPECT_EQ(40ul + sizeof(std::string), sizeof(DocumentId)); + EXPECT_EQ(192ul + sizeof(std::string), sizeof(Document)); + EXPECT_EQ(16ul + sizeof(std::string), sizeof(NumericDataType)); EXPECT_EQ(24ul, sizeof(LongFieldValue)); EXPECT_EQ(104ul, sizeof(StructFieldValue)); EXPECT_EQ(24ul, sizeof(StructuredFieldValue)); @@ -59,7 +59,7 @@ TEST(DocumentTest, testSizeOf) TEST(DocumentTest, testFieldPath) { - const vespalib::string testValues[] = { "{}", "", "", + const std::string testValues[] = { "{}", "", "", "{}r", "", "r", "{{}}", "{", "}", "{{}}r", "{", "}r", @@ -75,9 +75,9 @@ TEST(DocumentTest, testFieldPath) }; for (size_t i(0); i < sizeof(testValues)/sizeof(testValues[0]); i+=3) { std::string_view tmp = testValues[i]; - vespalib::string key = FieldPathEntry::parseKey(tmp); + std::string key = FieldPathEntry::parseKey(tmp); EXPECT_EQ(testValues[i+1], key); - EXPECT_EQ(testValues[i+2], vespalib::string(tmp)); + EXPECT_EQ(testValues[i+2], std::string(tmp)); } } @@ -441,7 +441,7 @@ TEST(DocumentTest, testSimpleUsage) EXPECT_EQ(value, value2); value2.setValue(strF, StringFieldValue("foo")); EXPECT_TRUE(value2.hasValue(strF)); - EXPECT_EQ(vespalib::string("foo"), + EXPECT_EQ(std::string("foo"), value2.getValue(strF)->getAsString()); EXPECT_TRUE(value != value2); value2.assign(value); @@ -534,7 +534,7 @@ void verifyJavaDocument(Document& doc) StringFieldValue stringVal(""); EXPECT_TRUE(doc.getValue(doc.getField("stringfield"), stringVal)); - EXPECT_EQ(vespalib::string("This is a string."), + EXPECT_EQ(std::string("This is a string."), stringVal.getAsString()); LongFieldValue longVal; @@ -772,7 +772,7 @@ TEST(DocumentTest,testReadSerializedAllVersions) StringFieldValue stringVal(""); EXPECT_TRUE(doc.getValue(doc.getField("stringfield"), stringVal)); - EXPECT_EQ(vespalib::string("This is a string."), + EXPECT_EQ(std::string("This is a string."), stringVal.getAsString()); LongFieldValue longVal; @@ -798,7 +798,7 @@ TEST(DocumentTest,testReadSerializedAllVersions) EXPECT_TRUE(docInDoc.getValue( docInDoc.getField("stringindocfield"), stringVal)); - EXPECT_EQ(vespalib::string("Elvis is dead"), + EXPECT_EQ(std::string("Elvis is dead"), stringVal.getAsString()); } @@ -1031,7 +1031,7 @@ TEST(DocumentTest, testAnnotationDeserialization) EXPECT_EQ(strVal.toString(), strVal2.toString()); EXPECT_EQ(strVal.toString(true), strVal2.toString(true)); - EXPECT_EQ(vespalib::string("help me help me i'm stuck inside a computer!"), + EXPECT_EQ(std::string("help me help me i'm stuck inside a computer!"), strVal.getAsString()); StringFieldValue::SpanTrees trees = strVal.getSpanTrees(); const SpanTree *span_tree = StringFieldValue::findTree(trees, "fruits"); diff --git a/document/src/tests/documenttypetestcase.cpp b/document/src/tests/documenttypetestcase.cpp index e9d479825b6f..e6567753c2a6 100644 --- a/document/src/tests/documenttypetestcase.cpp +++ b/document/src/tests/documenttypetestcase.cpp @@ -117,13 +117,13 @@ TEST(DocumentTypeTest, testMultipleInheritance) doc.setValue(doc.getField("tmp"), stringVal); EXPECT_TRUE(doc.getValue(doc.getField("nalle"))->getAsInt()==3); - EXPECT_EQ(vespalib::string("tmp"), + EXPECT_EQ(std::string("tmp"), doc.getValue(doc.getField("tmp"))->getAsString()); } namespace { -bool containsField(const DocumentType::FieldSet &fieldSet, const vespalib::string &field) { +bool containsField(const DocumentType::FieldSet &fieldSet, const std::string &field) { return fieldSet.getFields().find(field) != fieldSet.getFields().end(); } diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 82523d583c05..bbdfe80bd420 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -830,9 +830,9 @@ struct TensorUpdateFixture { TestDocMan docMan; Document::UP emptyDoc; Document updatedDoc; - vespalib::string fieldName; + std::string fieldName; const TensorDataType &tensorDataType; - vespalib::string tensorType; + std::string tensorType; const TensorDataType &extractTensorDataType() { const auto &dataType = emptyDoc->getField(fieldName).getDataType(); @@ -843,7 +843,7 @@ struct TensorUpdateFixture { return emptyDoc->getField("title"); } - TensorUpdateFixture(const vespalib::string &fieldName_ = "sparse_tensor") + TensorUpdateFixture(const std::string &fieldName_ = "sparse_tensor") : docMan(), emptyDoc(docMan.createDocument()), updatedDoc(*emptyDoc), @@ -1125,7 +1125,7 @@ TEST_F(DocumentUpdateTest, tensor_modify_update_on_float_tensor_can_be_roundtrip TEST_F(DocumentUpdateTest, tensor_modify_update_on_dense_tensor_can_be_roundtrip_serialized) { TensorUpdateFixture f("dense_tensor"); - vespalib::string sparseType("tensor(x{})"); + std::string sparseType("tensor(x{})"); TensorDataType sparseTensorType(ValueType::from_spec(sparseType)); auto sparseTensor = makeTensorFieldValue(TensorSpec(sparseType).add({{"x","0"}}, 2), sparseTensorType); f.assertRoundtripSerialize(TensorModifyUpdate(TensorModifyUpdate::Operation::REPLACE, std::move(sparseTensor))); @@ -1171,7 +1171,7 @@ struct TensorUpdateSerializeFixture { std::unique_ptr repo; const DocumentType &docType; - const TensorDataType &extractTensorDataType(const vespalib::string &fieldName) { + const TensorDataType &extractTensorDataType(const std::string &fieldName) { const auto &dataType = docType.getField(fieldName).getDataType(); return dynamic_cast(dataType); } @@ -1198,7 +1198,7 @@ struct TensorUpdateSerializeFixture { extractTensorDataType("sparse_tensor")); } - const Field &getField(const vespalib::string &name) { + const Field &getField(const std::string &name) { return docType.getField(name); } @@ -1220,12 +1220,12 @@ struct TensorUpdateSerializeFixture { return result; } - void serializeUpdateToFile(const DocumentUpdate &update, const vespalib::string &fileName) { + void serializeUpdateToFile(const DocumentUpdate &update, const std::string &fileName) { nbostream buf = serializeHEAD(update); TestDataBase::write_buffer_to_file(buf, fileName); } - DocumentUpdate::UP deserializeUpdateFromFile(const vespalib::string &fileName) { + DocumentUpdate::UP deserializeUpdateFromFile(const std::string &fileName) { auto stream = TestDataBase::read_buffer_from_file(fileName); return DocumentUpdate::createHEAD(*repo, stream); } @@ -1362,9 +1362,9 @@ TEST_F(DocumentUpdateTest, array_element_update_applies_to_specified_element) auto result_array = f.doc->getAs(f.array_field); ASSERT_EQ(size_t(3), result_array->size()); - EXPECT_EQ(vespalib::string("foo"), (*result_array)[0].getAsString()); - EXPECT_EQ(vespalib::string("bar"), (*result_array)[1].getAsString()); - EXPECT_EQ(vespalib::string("blarg"), (*result_array)[2].getAsString()); + EXPECT_EQ(std::string("foo"), (*result_array)[0].getAsString()); + EXPECT_EQ(std::string("bar"), (*result_array)[1].getAsString()); + EXPECT_EQ(std::string("blarg"), (*result_array)[2].getAsString()); } TEST_F(DocumentUpdateTest, array_element_update_for_invalid_index_is_ignored) diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index 9c555928c7cc..fea7fd824834 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -136,7 +136,7 @@ TEST_F(FieldPathUpdateTestCase, testRemoveField) auto doc = std::make_unique(*_repo, *_foobar_type, DocumentId("id:ns:foobar::things:thangs")); EXPECT_TRUE(doc->hasValue("strfoo") == false); doc->setValue("strfoo", StringFieldValue("cocacola")); - EXPECT_EQ(vespalib::string("cocacola"), doc->getValue("strfoo")->getAsString()); + EXPECT_EQ(std::string("cocacola"), doc->getValue("strfoo")->getAsString()); DocumentUpdate docUp(*_repo, *_foobar_type, DocumentId("id:ns:foobar::barbar:foofoo")); docUp.addFieldPathUpdate(std::make_unique("strfoo")); docUp.applyTo(*doc); @@ -162,8 +162,8 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList) { std::unique_ptr strArray = doc->getAs(doc->getField("strarray")); ASSERT_EQ(std::size_t(2), strArray->size()); - EXPECT_EQ(vespalib::string("crouching tiger, hidden field"), (*strArray)[0].getAsString()); - EXPECT_EQ(vespalib::string("hello hello"), (*strArray)[1].getAsString()); + EXPECT_EQ(std::string("crouching tiger, hidden field"), (*strArray)[0].getAsString()); + EXPECT_EQ(std::string("hello hello"), (*strArray)[1].getAsString()); } } @@ -186,7 +186,7 @@ TEST_F(FieldPathUpdateTestCase, testApplyRemoveMultiList2) { std::unique_ptr strArray = doc->getAs(doc->getField("strarray")); ASSERT_EQ(std::size_t(1), strArray->size()); - EXPECT_EQ(vespalib::string("hello hello"), (*strArray)[0].getAsString()); + EXPECT_EQ(std::string("hello hello"), (*strArray)[0].getAsString()); } } @@ -239,12 +239,12 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignSingle) docUp.addFieldPathUpdate(std::make_unique(*doc->getDataType(), "strfoo", std::string(), StringFieldValue::make("himert"))); docUp.applyTo(*doc); EXPECT_TRUE(doc->hasValue("strfoo")); - EXPECT_EQ(vespalib::string("himert"), doc->getValue("strfoo")->getAsString()); + EXPECT_EQ(std::string("himert"), doc->getValue("strfoo")->getAsString()); // Test overwriting existing DocumentUpdate docUp2(*_repo, *_foobar_type, DocumentId("id:ns:foobar::barbar:foofoo")); docUp2.addFieldPathUpdate(std::make_unique(*doc->getDataType(), "strfoo", std::string(), StringFieldValue::make("wunderbaum"))); docUp2.applyTo(*doc); - EXPECT_EQ(vespalib::string("wunderbaum"), doc->getValue("strfoo")->getAsString()); + EXPECT_EQ(std::string("wunderbaum"), doc->getValue("strfoo")->getAsString()); } TEST_F(FieldPathUpdateTestCase, testApplyAssignMath) @@ -407,8 +407,8 @@ TEST_F(FieldPathUpdateTestCase, testApplyAssignMultiList) { std::unique_ptr strArray = doc->getAs(doc->getField("strarray")); ASSERT_EQ(std::size_t(2), strArray->size()); - EXPECT_EQ(vespalib::string("assigned val 0"), (*strArray)[0].getAsString()); - EXPECT_EQ(vespalib::string("assigned val 1"), (*strArray)[1].getAsString()); + EXPECT_EQ(std::string("assigned val 0"), (*strArray)[0].getAsString()); + EXPECT_EQ(std::string("assigned val 1"), (*strArray)[1].getAsString()); } } @@ -517,17 +517,17 @@ TEST_F(FieldPathUpdateTestCase, testAddAndAssignList) { std::unique_ptr strArray = doc->getAs(doc->getField("strarray")); ASSERT_EQ(std::size_t(3), strArray->size()); - EXPECT_EQ(vespalib::string("hello hello"), (*strArray)[0].getAsString()); - EXPECT_EQ(vespalib::string("assigned val 1"), (*strArray)[1].getAsString()); - EXPECT_EQ(vespalib::string("new value"), (*strArray)[2].getAsString()); + EXPECT_EQ(std::string("hello hello"), (*strArray)[0].getAsString()); + EXPECT_EQ(std::string("assigned val 1"), (*strArray)[1].getAsString()); + EXPECT_EQ(std::string("new value"), (*strArray)[2].getAsString()); } } namespace { struct Keys { - vespalib::string key1; - vespalib::string key2; - vespalib::string key3; + std::string key1; + std::string key2; + std::string key3; Keys(); ~Keys(); }; diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp index 7edd021ac787..6490dc12189f 100644 --- a/document/src/tests/fieldsettest.cpp +++ b/document/src/tests/fieldsettest.cpp @@ -267,7 +267,7 @@ TEST_F(FieldSetTest, testSerialize) for (const char * fieldSet : fieldSets) { auto fs = FieldSetRepo::parse(docRepo, fieldSet); - EXPECT_EQ(vespalib::string(fieldSet), FieldSetRepo::serialize(*fs)); + EXPECT_EQ(std::string(fieldSet), FieldSetRepo::serialize(*fs)); } } @@ -305,7 +305,7 @@ TEST(FieldCollectionTest, testHash ) { } TEST(FieldTest, testSizeOf) { - EXPECT_EQ(sizeof(Field), 24u + sizeof(vespalib::string)); + EXPECT_EQ(sizeof(Field), 24u + sizeof(std::string)); } } // document diff --git a/document/src/tests/fieldvalue/fieldvalue_test.cpp b/document/src/tests/fieldvalue/fieldvalue_test.cpp index dd9a756ebe64..432eb81dc0b5 100644 --- a/document/src/tests/fieldvalue/fieldvalue_test.cpp +++ b/document/src/tests/fieldvalue/fieldvalue_test.cpp @@ -24,7 +24,7 @@ TEST("require that FieldValues does not change their storage size.") { EXPECT_EQUAL(16u, sizeof(FieldValue)); EXPECT_EQUAL(16u, sizeof(IntFieldValue)); EXPECT_EQUAL(24u, sizeof(LongFieldValue)); - EXPECT_EQUAL(40u + sizeof(vespalib::string), sizeof(StringFieldValue)); + EXPECT_EQUAL(40u + sizeof(std::string), sizeof(StringFieldValue)); } } // namespace diff --git a/document/src/tests/globalidtest.cpp b/document/src/tests/globalidtest.cpp index fa4378a3303c..af9d9d2fb924 100644 --- a/document/src/tests/globalidtest.cpp +++ b/document/src/tests/globalidtest.cpp @@ -55,12 +55,12 @@ TEST_F(GlobalIdTest, testNormalUsage) } { // Test printing and parsing GlobalId id1("LIN!#LNKASD#!MYL#&NK"); - EXPECT_EQ(vespalib::string("gid(0x4c494e21234c4e4b41534423)"), + EXPECT_EQ(std::string("gid(0x4c494e21234c4e4b41534423)"), id1.toString()); GlobalId id2 = GlobalId::parse(id1.toString()); EXPECT_EQ(id1, id2); // Verify string representation too, to verify that operator== works - EXPECT_EQ(vespalib::string("gid(0x4c494e21234c4e4b41534423)"), + EXPECT_EQ(std::string("gid(0x4c494e21234c4e4b41534423)"), id2.toString()); } } diff --git a/document/src/tests/positiontypetest.cpp b/document/src/tests/positiontypetest.cpp index 1f77a0c71cfa..4a7f6e7a99ee 100644 --- a/document/src/tests/positiontypetest.cpp +++ b/document/src/tests/positiontypetest.cpp @@ -7,7 +7,7 @@ namespace document { TEST(PositionTypeTest, requireThatNameIsCorrect) { const StructDataType &type = PositionDataType::getInstance(); - EXPECT_EQ(vespalib::string("position"), type.getName()); + EXPECT_EQ(std::string("position"), type.getName()); } TEST(PositionTypeTest, requireThatExpectedFieldsAreThere) @@ -22,7 +22,7 @@ TEST(PositionTypeTest, requireThatExpectedFieldsAreThere) TEST(PositionTypeTest, requireThatZCurveFieldMatchesJava) { - EXPECT_EQ(vespalib::string("foo_zcurve"), PositionDataType::getZCurveFieldName("foo")); + EXPECT_EQ(std::string("foo_zcurve"), PositionDataType::getZCurveFieldName("foo")); EXPECT_TRUE( ! PositionDataType::isZCurveFieldName("foo")); EXPECT_TRUE( ! PositionDataType::isZCurveFieldName("_zcurve")); EXPECT_TRUE( PositionDataType::isZCurveFieldName("x_zcurve")); diff --git a/document/src/tests/predicate/predicate_test.cpp b/document/src/tests/predicate/predicate_test.cpp index ccd4048c1a79..ac4b06402fe0 100644 --- a/document/src/tests/predicate/predicate_test.cpp +++ b/document/src/tests/predicate/predicate_test.cpp @@ -6,8 +6,8 @@ #include #include -#include #include +#include #include LOG_SETUP("predicate_test"); diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp index 40203d911641..11f9aa7262f1 100644 --- a/document/src/tests/primitivefieldvaluetest.cpp +++ b/document/src/tests/primitivefieldvaluetest.cpp @@ -342,7 +342,7 @@ TEST(PrimitiveFieldValueTest, testNumerics) EXPECT_EQ(-1, (int) b1.getValue()); b1 = "53"; EXPECT_EQ(53, (int) b1.getValue()); - EXPECT_EQ(vespalib::string("53"), b1.getAsString()); + EXPECT_EQ(std::string("53"), b1.getAsString()); try{ b1 = "-129"; diff --git a/document/src/tests/repo/doctype_config_test.cpp b/document/src/tests/repo/doctype_config_test.cpp index c3c0d375a954..aea6bde1a21d 100644 --- a/document/src/tests/repo/doctype_config_test.cpp +++ b/document/src/tests/repo/doctype_config_test.cpp @@ -13,11 +13,11 @@ #include #include #include -#include -#include -#include #include #include +#include +#include +#include #include LOG_SETUP("doctype_config_test"); @@ -27,7 +27,7 @@ using std::set; using std::vector; using vespalib::Identifiable; using vespalib::IllegalArgumentException; -using vespalib::string; +using std::string; using namespace document::config_builder; using namespace document; diff --git a/document/src/tests/repo/documenttyperepo_test.cpp b/document/src/tests/repo/documenttyperepo_test.cpp index a26b65f73f72..8c6d23973a9b 100644 --- a/document/src/tests/repo/documenttyperepo_test.cpp +++ b/document/src/tests/repo/documenttyperepo_test.cpp @@ -13,9 +13,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -25,7 +25,7 @@ using std::set; using std::vector; using vespalib::Identifiable; using vespalib::IllegalArgumentException; -using vespalib::string; +using std::string; using namespace document::config_builder; using namespace document; diff --git a/document/src/tests/select/select_test.cpp b/document/src/tests/select/select_test.cpp index 72d1867b64f0..7880b45c078d 100644 --- a/document/src/tests/select/select_test.cpp +++ b/document/src/tests/select/select_test.cpp @@ -58,7 +58,7 @@ class DocumentSelectTest : public ::testing::Test public: DocumentSelectTest(); ~DocumentSelectTest() override; - void check_select(const Document &doc, const vespalib::string &expression, const Result &exp_result); + void check_select(const Document &doc, const std::string &expression, const Result &exp_result); }; DocumentSelectTest::DocumentSelectTest() @@ -76,7 +76,7 @@ DocumentSelectTest::DocumentSelectTest() DocumentSelectTest::~DocumentSelectTest() = default; void -DocumentSelectTest::check_select(const Document& doc, const vespalib::string& expression, const Result &exp_result) +DocumentSelectTest::check_select(const Document& doc, const std::string& expression, const Result &exp_result) { auto node = _parser->parse(expression); EXPECT_EQ(node->contains(doc), exp_result); diff --git a/document/src/tests/serialization/vespadocumentserializer_test.cpp b/document/src/tests/serialization/vespadocumentserializer_test.cpp index ae711d81bd2e..bccc410261f0 100644 --- a/document/src/tests/serialization/vespadocumentserializer_test.cpp +++ b/document/src/tests/serialization/vespadocumentserializer_test.cpp @@ -227,7 +227,7 @@ void checkLiteralFieldValue(nbostream &stream, const string &val) { stream >> read_coding >> size; EXPECT_EQUAL(0, read_coding); size &= (SizeType(-1) >> 1); // Clear MSB. - vespalib::string read_val; + std::string read_val; read_val.assign(stream.peek(), size); stream.adjustReadPos(size); EXPECT_EQUAL(val.size(), read_val.size()); @@ -800,7 +800,7 @@ TEST("Require that tensors can be serialized") const int tensor_doc_type_id = 321; const string tensor_field_name = "my_tensor"; -DocumenttypesConfig getTensorDocTypesConfig(const vespalib::string &tensorType) { +DocumenttypesConfig getTensorDocTypesConfig(const std::string &tensorType) { DocumenttypesConfigBuilderHelper builder; builder.document(tensor_doc_type_id, "my_type", Struct("my_type.header"), diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp index 99ee151c3c12..32d4bce2a1ac 100644 --- a/document/src/tests/structfieldvaluetest.cpp +++ b/document/src/tests/structfieldvaluetest.cpp @@ -130,7 +130,7 @@ TEST_F(StructFieldValueTest, testStruct) EXPECT_EQ(value, value2); value2.setValue(strF, StringFieldValue("foo")); EXPECT_TRUE(value2.hasValue(strF)); - EXPECT_EQ(vespalib::string("foo"), value2.getValue(strF)->getAsString()); + EXPECT_EQ(std::string("foo"), value2.getValue(strF)->getAsString()); EXPECT_TRUE(value != value2); value2.assign(value); EXPECT_EQ(value, value2); diff --git a/document/src/tests/tensor_fieldvalue/partial_add/partial_add_test.cpp b/document/src/tests/tensor_fieldvalue/partial_add/partial_add_test.cpp index 3e773a4a2410..b7002f223c0f 100644 --- a/document/src/tests/tensor_fieldvalue/partial_add/partial_add_test.cpp +++ b/document/src/tests/tensor_fieldvalue/partial_add/partial_add_test.cpp @@ -15,7 +15,7 @@ using namespace vespalib::eval::test; using vespalib::make_string_short::fmt; -std::vector> add_layouts = { +std::vector> add_layouts = { { "x4_1", "x4_2" }, { "x4_2y4_1", "x4_1y4_2" }, { "x3y4_1", "x3y4_2" } @@ -64,7 +64,7 @@ TEST(PartialAddTest, partial_add_works_for_simple_values) { } } -std::vector> bad_layouts = { +std::vector> bad_layouts = { { "x3", "x3y1" }, { "x3y1", "x3" }, { "x3y3", "x3y3_1" }, diff --git a/document/src/tests/tensor_fieldvalue/partial_modify/partial_modify_test.cpp b/document/src/tests/tensor_fieldvalue/partial_modify/partial_modify_test.cpp index 566e525e9944..bb50c231c027 100644 --- a/document/src/tests/tensor_fieldvalue/partial_modify/partial_modify_test.cpp +++ b/document/src/tests/tensor_fieldvalue/partial_modify/partial_modify_test.cpp @@ -15,7 +15,7 @@ using namespace vespalib::eval::test; using vespalib::make_string_short::fmt; -std::vector> modify_layouts = { +std::vector> modify_layouts = { { "x4_1", "x4_1" }, { "x4_1", "x4_2" }, { "x4", "x4_2" }, @@ -79,8 +79,8 @@ TensorSpec perform_partial_modify_with_defaults(const TensorSpec &a, const Tenso return spec_from_value(*up); } -void expect_modify_with_defaults(const vespalib::string& lhs_expr, const vespalib::string& rhs_expr, - join_fun_t fun, double default_cell_value, const vespalib::string& exp_expr) { +void expect_modify_with_defaults(const std::string& lhs_expr, const std::string& rhs_expr, + join_fun_t fun, double default_cell_value, const std::string& exp_expr) { auto lhs = TensorSpec::from_expr(lhs_expr); auto rhs = TensorSpec::from_expr(rhs_expr); auto exp = TensorSpec::from_expr(exp_expr); @@ -137,7 +137,7 @@ TEST(PartialModifyTest, partial_modify_with_defauls) { "tensor(x[3]):{{x:0}:2,{x:1}:3,{x:2}:0}"); } -std::vector> bad_layouts = { +std::vector> bad_layouts = { { "x3", "x3" }, { "x3y4_1", "x3y4_1" }, { "x4_1", "x4_1y4_1" }, diff --git a/document/src/tests/tensor_fieldvalue/partial_remove/partial_remove_test.cpp b/document/src/tests/tensor_fieldvalue/partial_remove/partial_remove_test.cpp index b16f8873ace8..b931aea0c2cb 100644 --- a/document/src/tests/tensor_fieldvalue/partial_remove/partial_remove_test.cpp +++ b/document/src/tests/tensor_fieldvalue/partial_remove/partial_remove_test.cpp @@ -15,7 +15,7 @@ using namespace vespalib::eval::test; using vespalib::make_string_short::fmt; -std::vector> remove_layouts = { +std::vector> remove_layouts = { { "x4_1", "x4_2" }, { "x4_2y4_1", "x4_1y4_2" }, { "x3y4_1", "y4_2" } @@ -71,7 +71,7 @@ TEST(PartialRemoveTest, partial_remove_works_for_simple_values) { } } -std::vector> bad_layouts = { +std::vector> bad_layouts = { { "x3", "x3" }, { "x3y4_1", "x3" }, { "x3y4_1", "x3y4_2" }, diff --git a/document/src/tests/testdocmantest.cpp b/document/src/tests/testdocmantest.cpp index 5691dbb49326..5889268c9806 100644 --- a/document/src/tests/testdocmantest.cpp +++ b/document/src/tests/testdocmantest.cpp @@ -37,13 +37,13 @@ TEST(TestDocManTest, testSimpleUsage) std::string(sval.getValue().c_str())); } EXPECT_EQ( - vespalib::string("id:mail:testdoctype1:n=51019:192.html"), + std::string("id:mail:testdoctype1:n=51019:192.html"), doc1->getId().toString()); EXPECT_EQ( - vespalib::string("id:mail:testdoctype1:n=51019:192.html"), + std::string("id:mail:testdoctype1:n=51019:192.html"), doc2->getId().toString()); EXPECT_EQ( - vespalib::string("id:mail:testdoctype1:n=10744:245.html"), + std::string("id:mail:testdoctype1:n=10744:245.html"), doc3->getId().toString()); } diff --git a/document/src/tests/teststringutil.cpp b/document/src/tests/teststringutil.cpp index 71e02be080d3..e61f2ee0473d 100644 --- a/document/src/tests/teststringutil.cpp +++ b/document/src/tests/teststringutil.cpp @@ -4,7 +4,7 @@ #include using namespace document; -using vespalib::string; +using std::string; TEST(StringUtilTest, test_escape) { diff --git a/document/src/vespa/document/annotation/annotation.cpp b/document/src/vespa/document/annotation/annotation.cpp index f19991541dec..a9fe4d6fcc9a 100644 --- a/document/src/vespa/document/annotation/annotation.cpp +++ b/document/src/vespa/document/annotation/annotation.cpp @@ -15,7 +15,7 @@ std::ostream & operator << (std::ostream & os, const Annotation &annotation) { Annotation::~Annotation() = default; -vespalib::string +std::string Annotation::toString() const { vespalib::asciistream os; os << "Annotation(" << *_type; diff --git a/document/src/vespa/document/annotation/annotation.h b/document/src/vespa/document/annotation/annotation.h index b18dc26f2a14..b6f7148cce84 100644 --- a/document/src/vespa/document/annotation/annotation.h +++ b/document/src/vespa/document/annotation/annotation.h @@ -37,7 +37,7 @@ class Annotation { bool valid() const { return _type != nullptr; } int32_t getTypeId() const { return _type->getId(); } const FieldValue *getFieldValue() const { return _value.get(); } - vespalib::string toString() const; + std::string toString() const; }; std::ostream & operator << (std::ostream & os, const Annotation & span); diff --git a/document/src/vespa/document/annotation/spannode.cpp b/document/src/vespa/document/annotation/spannode.cpp index c639d202d276..a931c31a66e4 100644 --- a/document/src/vespa/document/annotation/spannode.cpp +++ b/document/src/vespa/document/annotation/spannode.cpp @@ -17,7 +17,7 @@ class ToStringVisitor : public SpanTreeVisitor { std::string str() const { return _os.str(); } private: vespalib::asciistream _os; - vespalib::string _indent; + std::string _indent; void newline() { _os << "\n" << _indent; @@ -43,7 +43,7 @@ class ToStringVisitor : public SpanTreeVisitor { void visit(const SpanList & list) override { _os << "SpanList("; if (list.size() > 1) { - vespalib::string oldIndent(_indent); + std::string oldIndent(_indent); _indent += " "; visitChildren(list); _indent = oldIndent; @@ -56,7 +56,7 @@ class ToStringVisitor : public SpanTreeVisitor { void visit(const SimpleSpanList & list) override { _os << "SimpleSpanList("; if (list.size() > 1) { - vespalib::string oldIndent(_indent); + std::string oldIndent(_indent); _indent += " "; visitChildren(list); _indent = oldIndent; @@ -68,7 +68,7 @@ class ToStringVisitor : public SpanTreeVisitor { } void visit(const AlternateSpanList & list) override { _os << "AlternateSpanList("; - vespalib::string oldIndent(_indent); + std::string oldIndent(_indent); _indent += " "; for (size_t i = 0; i < list.getNumSubtrees(); ++i) { newline(); @@ -86,7 +86,7 @@ ToStringVisitor::~ToStringVisitor() = default; } -vespalib::string +std::string SpanNode::toString() const { ToStringVisitor os; accept(os); diff --git a/document/src/vespa/document/annotation/spannode.h b/document/src/vespa/document/annotation/spannode.h index 0e5f0cd7f5bd..e9cb82202a79 100644 --- a/document/src/vespa/document/annotation/spannode.h +++ b/document/src/vespa/document/annotation/spannode.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace document { struct SpanTreeVisitor; @@ -13,7 +13,7 @@ struct SpanNode { virtual ~SpanNode() = default; - vespalib::string toString() const; + std::string toString() const; virtual void accept(SpanTreeVisitor &visitor) const = 0; }; diff --git a/document/src/vespa/document/annotation/spantree.cpp b/document/src/vespa/document/annotation/spantree.cpp index fab4d2b49da8..b19dfc9d73f1 100644 --- a/document/src/vespa/document/annotation/spantree.cpp +++ b/document/src/vespa/document/annotation/spantree.cpp @@ -38,7 +38,7 @@ SpanTree::compare(const SpanTree &other) const { return toString().compare(other.toString()); } -vespalib::string +std::string SpanTree::toString() const { vespalib::asciistream os; os << "SpanTree(\"" << _name << "\"" << "\n "; diff --git a/document/src/vespa/document/annotation/spantree.h b/document/src/vespa/document/annotation/spantree.h index 0c81975c21c2..f1f6d5474db9 100644 --- a/document/src/vespa/document/annotation/spantree.h +++ b/document/src/vespa/document/annotation/spantree.h @@ -11,7 +11,7 @@ struct SpanTreeVisitor; class SpanTree { using AnnotationVector = std::vector; - vespalib::string _name; + std::string _name; std::unique_ptr _root; std::vector _annotations; @@ -36,14 +36,14 @@ class SpanTree { void accept(SpanTreeVisitor &visitor) const; - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } const SpanNode &getRoot() const { return *_root; } size_t numAnnotations() const { return _annotations.size(); } void reserveAnnotations(size_t sz) { _annotations.resize(sz); } const_iterator begin() const { return _annotations.begin(); } const_iterator end() const { return _annotations.end(); } int compare(const SpanTree &other) const; - vespalib::string toString() const; + std::string toString() const; }; } // namespace document diff --git a/document/src/vespa/document/base/documentcalculator.cpp b/document/src/vespa/document/base/documentcalculator.cpp index 1a986dfd4265..18ab2a7742fa 100644 --- a/document/src/vespa/document/base/documentcalculator.cpp +++ b/document/src/vespa/document/base/documentcalculator.cpp @@ -10,7 +10,7 @@ namespace document { -DocumentCalculator::DocumentCalculator(const IDocumentTypeRepo& repo, const vespalib::string & expression) +DocumentCalculator::DocumentCalculator(const IDocumentTypeRepo& repo, const std::string & expression) { BucketIdFactory factory; select::Parser parser(repo, factory); diff --git a/document/src/vespa/document/base/documentcalculator.h b/document/src/vespa/document/base/documentcalculator.h index 8aa2caf34eaf..54d98af26e4d 100644 --- a/document/src/vespa/document/base/documentcalculator.h +++ b/document/src/vespa/document/base/documentcalculator.h @@ -11,7 +11,7 @@ class IDocumentTypeRepo; class DocumentCalculator { public: - DocumentCalculator(const IDocumentTypeRepo& repo, const vespalib::string& expression); + DocumentCalculator(const IDocumentTypeRepo& repo, const std::string& expression); ~DocumentCalculator(); double evaluate(const Document& doc, std::unique_ptr variables); diff --git a/document/src/vespa/document/base/documentid.cpp b/document/src/vespa/document/base/documentid.cpp index 77de33ea327c..09f254257d09 100644 --- a/document/src/vespa/document/base/documentid.cpp +++ b/document/src/vespa/document/base/documentid.cpp @@ -31,7 +31,7 @@ DocumentId::DocumentId(const DocumentId & rhs) = default; DocumentId & DocumentId::operator = (const DocumentId & rhs) = default; DocumentId::~DocumentId() noexcept = default; -vespalib::string +std::string DocumentId::toString() const { return _id.toString(); } @@ -51,7 +51,7 @@ DocumentId::getSerializedSize() const void DocumentId::calculateGlobalId() const { - vespalib::string id(_id.toString()); + std::string id(_id.toString()); unsigned char key[16]; fastc_md5sum(reinterpret_cast(id.c_str()), id.size(), key); diff --git a/document/src/vespa/document/base/documentid.h b/document/src/vespa/document/base/documentid.h index 91e2a6260489..fb06dc2a9c99 100644 --- a/document/src/vespa/document/base/documentid.h +++ b/document/src/vespa/document/base/documentid.h @@ -58,7 +58,7 @@ class DocumentId /** Hides the printable toString() for effiency reasons. */ - vespalib::string toString() const; + std::string toString() const; bool operator==(const DocumentId& other) const { return _id == other._id; } bool operator!=(const DocumentId& other) const { return ! (_id == other._id); } diff --git a/document/src/vespa/document/base/exceptions.cpp b/document/src/vespa/document/base/exceptions.cpp index 3d395ed1847b..6c28dd98c1d0 100644 --- a/document/src/vespa/document/base/exceptions.cpp +++ b/document/src/vespa/document/base/exceptions.cpp @@ -20,7 +20,7 @@ VESPA_IMPLEMENT_EXCEPTION_SPINE(FieldNotFoundException); InvalidDataTypeException::InvalidDataTypeException( const DataType& actual, const DataType& expected, - const vespalib::string& location) + const std::string& location) : IllegalStateException(fmt("Got %s while expecting %s. These types are not compatible.", actual.toString().c_str(), expected.toString().c_str()), location, 1), @@ -33,7 +33,7 @@ InvalidDataTypeException::~InvalidDataTypeException() = default; InvalidDataTypeConversionException::InvalidDataTypeConversionException( const DataType &actual, const DataType &expected, - const vespalib::string& location) + const std::string& location) : IllegalStateException(fmt("%s can not be converted to %s.", actual.toString().c_str(), expected.toString().c_str()), location, 1), @@ -41,34 +41,34 @@ InvalidDataTypeConversionException::InvalidDataTypeConversionException( _expected(expected) { } -DocumentTypeNotFoundException::DocumentTypeNotFoundException(vespalib::string name, const vespalib::string& location) +DocumentTypeNotFoundException::DocumentTypeNotFoundException(std::string name, const std::string& location) : Exception("Document type "+name+" not found", location, 1), _type(std::move(name)) { } -DataTypeNotFoundException::DataTypeNotFoundException(int id, const vespalib::string& location) +DataTypeNotFoundException::DataTypeNotFoundException(int id, const std::string& location) : Exception(fmt("Data type with id %d not found", id), location, 1) { } -DataTypeNotFoundException::DataTypeNotFoundException(const vespalib::string& name, const vespalib::string& location) +DataTypeNotFoundException::DataTypeNotFoundException(const std::string& name, const std::string& location) : Exception("Data type with name "+name+" not found.", location, 1) { } DataTypeNotFoundException::~DataTypeNotFoundException() = default; -AnnotationTypeNotFoundException::AnnotationTypeNotFoundException(int id, const vespalib::string& location) +AnnotationTypeNotFoundException::AnnotationTypeNotFoundException(int id, const std::string& location) : Exception(fmt("Data type with id %d not found", id), location, 1) { } FieldNotFoundException:: -FieldNotFoundException(vespalib::string fieldName, const vespalib::string& location) +FieldNotFoundException(std::string fieldName, const std::string& location) : Exception("Field with name " + fieldName + " not found", location, 1), _fieldName(std::move(fieldName)), _fieldId(0) { } FieldNotFoundException:: -FieldNotFoundException(int fieldId, int16_t serializationVersion, const vespalib::string& location) +FieldNotFoundException(int fieldId, int16_t serializationVersion, const std::string& location) : Exception((serializationVersion < Document::getNewestSerializationVersion()) ? fmt("Field with id %i (serialization version %d) not found", fieldId, serializationVersion) : fmt("Field with id %i not found", fieldId), diff --git a/document/src/vespa/document/base/exceptions.h b/document/src/vespa/document/base/exceptions.h index 8d3baf63dad7..a1db79c59fc3 100644 --- a/document/src/vespa/document/base/exceptions.h +++ b/document/src/vespa/document/base/exceptions.h @@ -21,7 +21,7 @@ class InvalidDataTypeException : public vespalib::IllegalStateException public: InvalidDataTypeException(const DataType &actual, const DataType &wanted, - const vespalib::string & location); + const std::string & location); ~InvalidDataTypeException() override; const DataType& getActualDataType() const { return _actual; } @@ -47,7 +47,7 @@ class InvalidDataTypeConversionException public: InvalidDataTypeConversionException(const DataType &actual, const DataType &wanted, - const vespalib::string & location); + const std::string & location); ~InvalidDataTypeConversionException() override; const DataType& getActualDataType() const { return _actual; } @@ -70,17 +70,17 @@ class InvalidDataTypeConversionException class DocumentTypeNotFoundException : public vespalib::Exception { private: - vespalib::string _type; + std::string _type; public: - DocumentTypeNotFoundException(vespalib::string name, const vespalib::string& location); + DocumentTypeNotFoundException(std::string name, const std::string& location); DocumentTypeNotFoundException(const DocumentTypeNotFoundException &); DocumentTypeNotFoundException & operator = (const DocumentTypeNotFoundException &); DocumentTypeNotFoundException(DocumentTypeNotFoundException &&) noexcept = default; DocumentTypeNotFoundException & operator = (DocumentTypeNotFoundException &&) noexcept = default; ~DocumentTypeNotFoundException() override; - const vespalib::string& getDocumentTypeName() const { return _type; } + const std::string& getDocumentTypeName() const { return _type; } VESPA_DEFINE_EXCEPTION_SPINE(DocumentTypeNotFoundException); }; @@ -94,8 +94,8 @@ class DocumentTypeNotFoundException : public vespalib::Exception class DataTypeNotFoundException : public vespalib::Exception { public: - DataTypeNotFoundException(int id, const vespalib::string& location); - DataTypeNotFoundException(const vespalib::string& name, const vespalib::string& location); + DataTypeNotFoundException(int id, const std::string& location); + DataTypeNotFoundException(const std::string& name, const std::string& location); ~DataTypeNotFoundException() override; VESPA_DEFINE_EXCEPTION_SPINE(DataTypeNotFoundException); @@ -110,7 +110,7 @@ class DataTypeNotFoundException : public vespalib::Exception class AnnotationTypeNotFoundException : public vespalib::Exception { public: - AnnotationTypeNotFoundException(int id, const vespalib::string& location); + AnnotationTypeNotFoundException(int id, const std::string& location); ~AnnotationTypeNotFoundException() override; VESPA_DEFINE_EXCEPTION_SPINE(AnnotationTypeNotFoundException); @@ -126,19 +126,19 @@ class AnnotationTypeNotFoundException : public vespalib::Exception class FieldNotFoundException : public vespalib::Exception { private: - vespalib::string _fieldName; + std::string _fieldName; int32_t _fieldId; public: - FieldNotFoundException(vespalib::string fieldName, const vespalib::string& location); - FieldNotFoundException(int32_t fieldId, int16_t serializationVersion, const vespalib::string& location); + FieldNotFoundException(std::string fieldName, const std::string& location); + FieldNotFoundException(int32_t fieldId, int16_t serializationVersion, const std::string& location); FieldNotFoundException(const FieldNotFoundException &); FieldNotFoundException & operator = (const FieldNotFoundException &); FieldNotFoundException(FieldNotFoundException &&) noexcept = default; FieldNotFoundException & operator = (FieldNotFoundException &&) noexcept = default; ~FieldNotFoundException() override; - const vespalib::string& getFieldName() const { return _fieldName; } + const std::string& getFieldName() const { return _fieldName; } int32_t getFieldId() const { return _fieldId; }; VESPA_DEFINE_EXCEPTION_SPINE(FieldNotFoundException); diff --git a/document/src/vespa/document/base/field.cpp b/document/src/vespa/document/base/field.cpp index 8741099f9219..b40b70b756ec 100644 --- a/document/src/vespa/document/base/field.cpp +++ b/document/src/vespa/document/base/field.cpp @@ -55,7 +55,7 @@ Field::createValue() const { return _dataType->createFieldValue(); } -vespalib::string +std::string Field::toString(bool verbose) const { vespalib::asciistream out; diff --git a/document/src/vespa/document/base/field.h b/document/src/vespa/document/base/field.h index 82639f18c730..4519b9833c3c 100644 --- a/document/src/vespa/document/base/field.h +++ b/document/src/vespa/document/base/field.h @@ -11,8 +11,8 @@ */ #pragma once -#include #include +#include #include namespace document { @@ -22,7 +22,7 @@ class DataType; class Field final : public FieldSet { - vespalib::string _name; + std::string _name; const DataType *_dataType; int _fieldId; public: @@ -98,9 +98,9 @@ class Field final : public FieldSet const DataType &getDataType() const { return *_dataType; } int getId() const noexcept { return _fieldId; } - const vespalib::string & getName() const noexcept { return _name; } + const std::string & getName() const noexcept { return _name; } - vespalib::string toString(bool verbose=false) const; + std::string toString(bool verbose=false) const; bool contains(const FieldSet& fields) const override; Type getType() const override { return Type::FIELD; } bool valid() const noexcept { return _fieldId != 0; } diff --git a/document/src/vespa/document/base/fieldpath.cpp b/document/src/vespa/document/base/fieldpath.cpp index c4e5f2593482..150257eea6a3 100644 --- a/document/src/vespa/document/base/fieldpath.cpp +++ b/document/src/vespa/document/base/fieldpath.cpp @@ -136,10 +136,10 @@ FieldPathEntry::stealFieldValueToSet() const return std::move(_fillInVal); } -vespalib::string +std::string FieldPathEntry::parseKey(std::string_view & key) { - vespalib::string v; + std::string v; const char *c = key.data(); const char *e = c + key.size(); for(;(c < e) && std::isspace(static_cast(c[0])); c++); @@ -158,7 +158,7 @@ FieldPathEntry::parseKey(std::string_view & key) c++; } else { throw IllegalArgumentException(make_string("Escaped key '%s' is incomplete. No matching '\"'", - vespalib::string(key).c_str()), VESPA_STRLOC); + std::string(key).c_str()), VESPA_STRLOC); } } else { const char * start = c; @@ -172,11 +172,11 @@ FieldPathEntry::parseKey(std::string_view & key) key = std::string_view(c + 1, e - (c + 1)); } else { throw IllegalArgumentException(make_string("Key '%s' is incomplete. No matching '}'", - vespalib::string(key).c_str()), VESPA_STRLOC); + std::string(key).c_str()), VESPA_STRLOC); } } else { throw IllegalArgumentException(make_string("key '%s' does not start with '{'", - vespalib::string(key).c_str()), VESPA_STRLOC); + std::string(key).c_str()), VESPA_STRLOC); } return v; } diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h index c2fc68624725..fb7edc8966a7 100644 --- a/document/src/vespa/document/base/fieldpath.h +++ b/document/src/vespa/document/base/fieldpath.h @@ -57,7 +57,7 @@ class FieldPathEntry { FieldPathEntry(const DataType & dataType, std::string_view variableName); Type getType() const { return _type; } - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } const DataType& getDataType() const; @@ -68,7 +68,7 @@ class FieldPathEntry { const FieldValue & getLookupKey() const { return *_lookupKey; } - const vespalib::string& getVariableName() const { return _variableName; } + const std::string& getVariableName() const { return _variableName; } FieldValue * getFieldValueToSetPtr() const { return _fillInVal.get(); } FieldValue & getFieldValueToSet() const { return *_fillInVal; } @@ -78,16 +78,16 @@ class FieldPathEntry { * @param key is the incoming value, and contains what is left when done. * *return The unescaped value */ - static vespalib::string parseKey(std::string_view & key); + static std::string parseKey(std::string_view & key); private: void setFillValue(const DataType & dataType); Type _type; - vespalib::string _name; + std::string _name; Field _field; const DataType * _dataType; uint32_t _lookupIndex; std::unique_ptr _lookupKey; - vespalib::string _variableName; + std::string _variableName; mutable std::unique_ptr _fillInVal; }; diff --git a/document/src/vespa/document/base/globalid.cpp b/document/src/vespa/document/base/globalid.cpp index 3b352b40f9ab..8cfffd392751 100644 --- a/document/src/vespa/document/base/globalid.cpp +++ b/document/src/vespa/document/base/globalid.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -40,7 +41,7 @@ getHexVal(char c) namespace document { -vespalib::string GlobalId::toString() const { +std::string GlobalId::toString() const { vespalib::asciistream out; out << "gid(0x" << vespalib::hex; for (int i = 0; i < (int)LENGTH; ++i) { diff --git a/document/src/vespa/document/base/globalid.h b/document/src/vespa/document/base/globalid.h index 8390dcc28452..ff11ec3ad921 100644 --- a/document/src/vespa/document/base/globalid.h +++ b/document/src/vespa/document/base/globalid.h @@ -24,9 +24,10 @@ */ #pragma once -#include -#include #include +#include +#include +#include namespace document { @@ -173,7 +174,7 @@ class GlobalId { /** * Returns a string representation of this global id. */ - vespalib::string toString() const; + std::string toString() const; /** * Parse the source string to generate a global id object. The source is expected to contain exactly what diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp index ff16d9825e69..58c2ddb7d086 100644 --- a/document/src/vespa/document/base/idstring.cpp +++ b/document/src/vespa/document/base/idstring.cpp @@ -3,12 +3,13 @@ #include "idstring.h" #include "idstringexception.h" #include +#include #include #include #include #include -using vespalib::string; +using std::string; using std::string_view; using vespalib::make_string; diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h index cd2042cfe329..0be7372b915d 100644 --- a/document/src/vespa/document/base/idstring.h +++ b/document/src/vespa/document/base/idstring.h @@ -3,8 +3,9 @@ #pragma once #include -#include +#include #include +#include namespace document { @@ -42,13 +43,13 @@ class IdString { bool operator==(const IdString& other) const { return toString() == other.toString(); } - [[nodiscard]] const vespalib::string & toString() const { return _rawId; } + [[nodiscard]] const std::string & toString() const { return _rawId; } private: [[nodiscard]] uint16_t offset(uint32_t index) const { return _offsets[index]; } [[nodiscard]] uint16_t size(uint32_t index) const { return std::max(0, int(offset(index+1)) - int(offset(index)) - 1); } [[nodiscard]] std::string_view getComponent(size_t index) const { return {_rawId.c_str() + offset(index), size(index)}; } - [[nodiscard]] const vespalib::string & getRawId() const { return _rawId; } + [[nodiscard]] const std::string & getRawId() const { return _rawId; } class Offsets { public: @@ -62,7 +63,7 @@ class IdString { uint16_t _offsets[MAX_COMPONENTS]; }; - vespalib::string _rawId; + std::string _rawId; LocationType _location; Offsets _offsets; uint16_t _groupOffset; diff --git a/document/src/vespa/document/base/testdocrepo.cpp b/document/src/vespa/document/base/testdocrepo.cpp index 2645f6cea1df..9218bbda6ffb 100644 --- a/document/src/vespa/document/base/testdocrepo.cpp +++ b/document/src/vespa/document/base/testdocrepo.cpp @@ -75,7 +75,7 @@ DocumenttypesConfig TestDocRepo::getDefaultConfig() { } const DataType* -TestDocRepo::getDocumentType(const vespalib::string &t) const { +TestDocRepo::getDocumentType(const std::string &t) const { return _repo->getDocumentType(t); } diff --git a/document/src/vespa/document/base/testdocrepo.h b/document/src/vespa/document/base/testdocrepo.h index 6c51d5c5e923..1407cd44bea7 100644 --- a/document/src/vespa/document/base/testdocrepo.h +++ b/document/src/vespa/document/base/testdocrepo.h @@ -24,7 +24,7 @@ class TestDocRepo { const DocumentTypeRepo& getTypeRepo() const { return *_repo; } std::shared_ptr getTypeRepoSp() const { return _repo; } const DocumenttypesConfig& getTypeConfig() const { return _cfg; } - const DataType* getDocumentType(const vespalib::string &name) const; + const DataType* getDocumentType(const std::string &name) const; }; DocumenttypesConfig readDocumenttypesConfig(const char *file_name); diff --git a/document/src/vespa/document/bucket/bucket.cpp b/document/src/vespa/document/bucket/bucket.cpp index baee21aa486f..0340be3f59a5 100644 --- a/document/src/vespa/document/bucket/bucket.cpp +++ b/document/src/vespa/document/bucket/bucket.cpp @@ -12,7 +12,7 @@ Bucket::Bucket() noexcept { } -vespalib::string Bucket::toString() const +std::string Bucket::toString() const { vespalib::asciistream os; os << *this; diff --git a/document/src/vespa/document/bucket/bucket.h b/document/src/vespa/document/bucket/bucket.h index e7bed8767d6f..43dc11f2847b 100644 --- a/document/src/vespa/document/bucket/bucket.h +++ b/document/src/vespa/document/bucket/bucket.h @@ -4,8 +4,8 @@ #include "bucketspace.h" #include "bucketid.h" -#include #include +#include namespace document { @@ -29,7 +29,7 @@ class Bucket { BucketSpace getBucketSpace() const noexcept { return _bucketSpace; } BucketId getBucketId() const noexcept { return _bucketId; } - vespalib::string toString() const; + std::string toString() const; struct hash { size_t operator () (const Bucket& b) const noexcept { diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp index fcc9a0df4f6d..f15bdc51de0c 100644 --- a/document/src/vespa/document/bucket/bucketid.cpp +++ b/document/src/vespa/document/bucket/bucketid.cpp @@ -81,7 +81,7 @@ BucketId::hash::operator () (const BucketId& bucketId) const noexcept { return vespalib::xxhash::xxh3_64(bucketId.getId()); } -vespalib::string +std::string BucketId::toString() const { vespalib::asciistream stream; diff --git a/document/src/vespa/document/bucket/bucketid.h b/document/src/vespa/document/bucket/bucketid.h index bea33fd71095..03ad27d8d440 100644 --- a/document/src/vespa/document/bucket/bucketid.h +++ b/document/src/vespa/document/bucket/bucketid.h @@ -20,7 +20,8 @@ #pragma once -#include +#include +#include namespace vespalib { class nbostream; @@ -59,7 +60,7 @@ class BucketId bool operator==(const BucketId& id) const noexcept { return getId() == id.getId(); } bool operator!=(const BucketId& id) const noexcept { return getId() != id.getId(); } - vespalib::string toString() const; + std::string toString() const; bool valid() const noexcept { return validUsedBits(getUsedBits()); diff --git a/document/src/vespa/document/bucket/bucketselector.cpp b/document/src/vespa/document/bucket/bucketselector.cpp index ae17cb5c3344..c8c5fbc00808 100644 --- a/document/src/vespa/document/bucket/bucketselector.cpp +++ b/document/src/vespa/document/bucket/bucketselector.cpp @@ -84,7 +84,7 @@ using namespace document::select; if (node.getType() == IdValueNode::ALL) { auto val = dynamic_cast(&valnode); if (!val) return; - vespalib::string docId(val->getValue()); + std::string docId(val->getValue()); if (op == FunctionOperator::EQ || !GlobOperator::containsVariables(docId)) { _buckets.emplace_back(58, IdString(docId).getLocation()); _unknown = false; @@ -98,7 +98,7 @@ using namespace document::select; } else if (node.getType() == IdValueNode::GROUP) { auto val = dynamic_cast(&valnode); if (!val) return; - vespalib::string group(val->getValue()); + std::string group(val->getValue()); if (op == FunctionOperator::EQ || !GlobOperator::containsVariables(group)) { _buckets.emplace_back(32, IdString::makeLocation(group)); _unknown = false; @@ -106,7 +106,7 @@ using namespace document::select; } else if (node.getType() == IdValueNode::GID) { auto val = dynamic_cast(&valnode); - vespalib::string gid(val->getValue()); + std::string gid(val->getValue()); if (op == FunctionOperator::EQ || !GlobOperator::containsVariables(gid)) { BucketId bid = document::GlobalId::parse(gid).convertToBucketId(); _buckets.emplace_back(32, bid.getRawId()); diff --git a/document/src/vespa/document/bucket/bucketspace.cpp b/document/src/vespa/document/bucket/bucketspace.cpp index b3eadaea528e..0b85da60960e 100644 --- a/document/src/vespa/document/bucket/bucketspace.cpp +++ b/document/src/vespa/document/bucket/bucketspace.cpp @@ -5,7 +5,7 @@ #include namespace document { -vespalib::string BucketSpace::toString() const +std::string BucketSpace::toString() const { vespalib::asciistream os; os << *this; diff --git a/document/src/vespa/document/bucket/bucketspace.h b/document/src/vespa/document/bucket/bucketspace.h index 7a5b4cc32a69..69cdc49d6472 100644 --- a/document/src/vespa/document/bucket/bucketspace.h +++ b/document/src/vespa/document/bucket/bucketspace.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace vespalib { class asciistream; @@ -27,7 +27,7 @@ class BucketSpace { constexpr Type getId() const noexcept { return _id; } constexpr bool valid() const noexcept { return (_id != 0); } - vespalib::string toString() const; + std::string toString() const; struct hash { size_t operator () (const BucketSpace& bs) const noexcept { diff --git a/document/src/vespa/document/bucket/fixed_bucket_spaces.cpp b/document/src/vespa/document/bucket/fixed_bucket_spaces.cpp index f2fa872418ed..f1998ce56660 100644 --- a/document/src/vespa/document/bucket/fixed_bucket_spaces.cpp +++ b/document/src/vespa/document/bucket/fixed_bucket_spaces.cpp @@ -12,8 +12,8 @@ static_assert(FixedBucketSpaces::global_space() != FixedBucketSpaces::default_sp namespace { -vespalib::string DEFAULT = "default"; -vespalib::string GLOBAL = "global"; +std::string DEFAULT = "default"; +std::string GLOBAL = "global"; } @@ -23,11 +23,11 @@ BucketSpace FixedBucketSpaces::from_string(std::string_view name) { } else if (name == GLOBAL) { return global_space(); } else { - throw UnknownBucketSpaceException("Unknown bucket space name: " + vespalib::string(name), VESPA_STRLOC); + throw UnknownBucketSpaceException("Unknown bucket space name: " + std::string(name), VESPA_STRLOC); } } -const vespalib::string & +const std::string & FixedBucketSpaces::to_string(BucketSpace space) { if (space == default_space()) { return DEFAULT; diff --git a/document/src/vespa/document/bucket/fixed_bucket_spaces.h b/document/src/vespa/document/bucket/fixed_bucket_spaces.h index 9c022d8cc8fc..66de31f6e174 100644 --- a/document/src/vespa/document/bucket/fixed_bucket_spaces.h +++ b/document/src/vespa/document/bucket/fixed_bucket_spaces.h @@ -3,7 +3,7 @@ #include "bucketspace.h" #include -#include +#include namespace document { @@ -16,8 +16,8 @@ VESPA_DEFINE_EXCEPTION(UnknownBucketSpaceException, vespalib::IllegalArgumentExc struct FixedBucketSpaces { static constexpr BucketSpace default_space() { return BucketSpace(1); }; static constexpr BucketSpace global_space() { return BucketSpace(2); } - static const vespalib::string & default_space_name() { return to_string(default_space()); } - static const vespalib::string & global_space_name() { return to_string(global_space()); } + static const std::string & default_space_name() { return to_string(default_space()); } + static const std::string & global_space_name() { return to_string(global_space()); } // Post-condition: returned space has valid() == true iff name // is either "default" or "global". @@ -26,7 +26,7 @@ struct FixedBucketSpaces { // Post-condition: returned string can be losslessly passed to from_string() // iff space is equal to default_space() or global_space(). // Throws UnknownBucketSpaceException if space does not map to a known name. - static const vespalib::string & to_string(BucketSpace space); + static const std::string & to_string(BucketSpace space); }; } diff --git a/document/src/vespa/document/datatype/annotationtype.cpp b/document/src/vespa/document/datatype/annotationtype.cpp index d4ac202ed7aa..0f1ff3a9550e 100644 --- a/document/src/vespa/document/datatype/annotationtype.cpp +++ b/document/src/vespa/document/datatype/annotationtype.cpp @@ -3,11 +3,11 @@ #include "annotationtype.h" #include "numericdatatype.h" #include "primitivedatatype.h" -#include #include +#include using std::vector; -using vespalib::string; +using std::string; namespace document { namespace { @@ -35,7 +35,7 @@ vector AnnotationType::getDefaultAnnotationTypes() { return types; } -vespalib::string +std::string AnnotationType::toString() const { vespalib::asciistream os; os << *this; diff --git a/document/src/vespa/document/datatype/annotationtype.h b/document/src/vespa/document/datatype/annotationtype.h index ae5d36d0898d..892825f0a039 100644 --- a/document/src/vespa/document/datatype/annotationtype.h +++ b/document/src/vespa/document/datatype/annotationtype.h @@ -12,7 +12,7 @@ namespace document { class AnnotationType { int _id; - vespalib::string _name; + std::string _name; const DataType *_type; public: @@ -23,7 +23,7 @@ class AnnotationType { : _id(id), _name(name), _type(0) {} void setDataType(const DataType &type) { _type = &type; } - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } int getId() const { return _id; } const DataType *getDataType() const { return _type; } bool operator==(const AnnotationType &a2) const { @@ -32,7 +32,7 @@ class AnnotationType { bool operator!=(const AnnotationType &a2) const { return ! (*this == a2); } - vespalib::string toString() const; + std::string toString() const; static const AnnotationType *const TERM; static const AnnotationType *const TOKEN_TYPE; diff --git a/document/src/vespa/document/datatype/datatype.h b/document/src/vespa/document/datatype/datatype.h index c90f5f1fc3d4..729a1ef6fb1a 100644 --- a/document/src/vespa/document/datatype/datatype.h +++ b/document/src/vespa/document/datatype/datatype.h @@ -8,8 +8,8 @@ #pragma once #include -#include #include +#include #include namespace document { @@ -31,7 +31,7 @@ class WeightedSetDataType; class DataType : public Printable { int _dataTypeId; - vespalib::string _name; + std::string _name; protected: /** @@ -102,7 +102,7 @@ class DataType : public Printable /** Used by type manager to fetch default types to register. */ static std::vector getDefaultDataTypes(); - const vespalib::string& getName() const noexcept { return _name; } + const std::string& getName() const noexcept { return _name; } int getId() const noexcept { return _dataTypeId; } bool isValueType(const FieldValue & fv) const; diff --git a/document/src/vespa/document/datatype/documenttype.cpp b/document/src/vespa/document/datatype/documenttype.cpp index bc315651be97..fa967b9ef785 100644 --- a/document/src/vespa/document/datatype/documenttype.cpp +++ b/document/src/vespa/document/datatype/documenttype.cpp @@ -2,6 +2,7 @@ #include "documenttype.h" #include +#include #include #include #include @@ -17,7 +18,7 @@ using std::string_view; namespace document { namespace { -FieldCollection build_field_collection(const std::set &fields, +FieldCollection build_field_collection(const std::set &fields, const DocumentType &doc_type) { Field::Set::Builder builder; @@ -30,7 +31,7 @@ FieldCollection build_field_collection(const std::set &fields, } } // namespace -DocumentType::FieldSet::FieldSet(const vespalib::string & name, Fields fields, const DocumentType & doc_type) +DocumentType::FieldSet::FieldSet(const std::string & name, Fields fields, const DocumentType & doc_type) : _name(name), _fields(fields), _field_collection(build_field_collection(fields, doc_type)) @@ -93,14 +94,14 @@ DocumentType::DocumentType(const DocumentType &) = default; DocumentType::~DocumentType() = default; DocumentType & -DocumentType::addFieldSet(const vespalib::string & name, FieldSet::Fields fields) +DocumentType::addFieldSet(const std::string & name, FieldSet::Fields fields) { _fieldSets.emplace(name, FieldSet(name, std::move(fields), *this)); return *this; } const DocumentType::FieldSet * -DocumentType::getFieldSet(const vespalib::string & name) const +DocumentType::getFieldSet(const std::string & name) const { auto it = _fieldSets.find(name); return (it != _fieldSets.end()) ? & it->second : nullptr; @@ -242,12 +243,12 @@ DocumentType::getFieldSet() const } bool -DocumentType::has_imported_field_name(const vespalib::string& name) const noexcept { +DocumentType::has_imported_field_name(const std::string& name) const noexcept { return (_imported_field_names.find(name) != _imported_field_names.end()); } void -DocumentType::add_imported_field_name(const vespalib::string& name) { +DocumentType::add_imported_field_name(const std::string& name) { _imported_field_names.insert(name); } diff --git a/document/src/vespa/document/datatype/documenttype.h b/document/src/vespa/document/datatype/documenttype.h index 3df76c78b868..84d540d71485 100644 --- a/document/src/vespa/document/datatype/documenttype.h +++ b/document/src/vespa/document/datatype/documenttype.h @@ -26,25 +26,25 @@ class DocumentType final : public StructuredDataType { public: class FieldSet { public: - using Fields = std::set; - FieldSet(const vespalib::string & name, Fields fields, const DocumentType & doc_type); + using Fields = std::set; + FieldSet(const std::string & name, Fields fields, const DocumentType & doc_type); ~FieldSet(); FieldSet(const FieldSet&) = default; FieldSet(FieldSet&&) noexcept = default; FieldSet& operator=(const FieldSet&) = default; FieldSet& operator=(FieldSet&&) noexcept = default; - const vespalib::string & getName() const noexcept { return _name; } + const std::string & getName() const noexcept { return _name; } const Fields & getFields() const noexcept { return _fields; } const FieldCollection & asCollection() const { return _field_collection; } private: - vespalib::string _name; + std::string _name; Fields _fields; FieldCollection _field_collection; }; private: - using FieldSetMap = std::map; - using ImportedFieldNames = vespalib::hash_set; + using FieldSetMap = std::map; + using ImportedFieldNames = vespalib::hash_set; std::vector _inheritedTypes; StructDataType::SP _ownedFields; @@ -99,16 +99,16 @@ class DocumentType final : public StructuredDataType { } Field::Set getFieldSet() const override; - DocumentType & addFieldSet(const vespalib::string & name, FieldSet::Fields fields); - const FieldSet * getFieldSet(const vespalib::string & name) const; + DocumentType & addFieldSet(const std::string & name, FieldSet::Fields fields); + const FieldSet * getFieldSet(const std::string & name) const; const FieldSetMap & getFieldSets() const { return _fieldSets; } const ImportedFieldNames& imported_field_names() const noexcept { return _imported_field_names; } - bool has_imported_field_name(const vespalib::string& name) const noexcept; + bool has_imported_field_name(const std::string& name) const noexcept; // Ideally the type would be immutable, but this is how it's built today. - void add_imported_field_name(const vespalib::string& name); + void add_imported_field_name(const std::string& name); }; } // document diff --git a/document/src/vespa/document/datatype/mapdatatype.cpp b/document/src/vespa/document/datatype/mapdatatype.cpp index 3b329b34314f..d53d6b07db97 100644 --- a/document/src/vespa/document/datatype/mapdatatype.cpp +++ b/document/src/vespa/document/datatype/mapdatatype.cpp @@ -14,7 +14,7 @@ namespace { constexpr auto key_keyword = "key"sv; constexpr auto value_keyword = "value"sv; -vespalib::string createName(const DataType& keyType, const DataType& valueType) +std::string createName(const DataType& keyType, const DataType& valueType) { vespalib::asciistream ost; ost << "Map<" << keyType.getName() << "," << valueType.getName() << ">"; @@ -67,7 +67,7 @@ MapDataType::buildFieldPathImpl(FieldPath & path, const DataType &dataType, { if (!remainFieldName.empty() && remainFieldName[0] == '{') { std::string_view rest = remainFieldName; - vespalib::string keyValue = FieldPathEntry::parseKey(rest); + std::string keyValue = FieldPathEntry::parseKey(rest); valueType.buildFieldPath(path, (!rest.empty() && rest[0] == '.') ? rest.substr(1) : rest); diff --git a/document/src/vespa/document/datatype/positiondatatype.cpp b/document/src/vespa/document/datatype/positiondatatype.cpp index 858993cd57b7..5a59a93c413b 100644 --- a/document/src/vespa/document/datatype/positiondatatype.cpp +++ b/document/src/vespa/document/datatype/positiondatatype.cpp @@ -6,13 +6,13 @@ namespace document { namespace { -const vespalib::string ZCURVE("_zcurve"); +const std::string ZCURVE("_zcurve"); } -const vespalib::string PositionDataType::STRUCT_NAME("position"); -const vespalib::string PositionDataType::FIELD_X("x"); -const vespalib::string PositionDataType::FIELD_Y("y"); +const std::string PositionDataType::STRUCT_NAME("position"); +const std::string PositionDataType::FIELD_X("x"); +const std::string PositionDataType::FIELD_Y("y"); StructDataType::UP PositionDataType::createInstance() @@ -30,8 +30,8 @@ PositionDataType::getInstance() return *instance; } -vespalib::string -PositionDataType::getZCurveFieldName(const vespalib::string & fieldName) +std::string +PositionDataType::getZCurveFieldName(const std::string & fieldName) { return fieldName + ZCURVE; } diff --git a/document/src/vespa/document/datatype/positiondatatype.h b/document/src/vespa/document/datatype/positiondatatype.h index cabef5308d64..fcb08ad347a7 100644 --- a/document/src/vespa/document/datatype/positiondatatype.h +++ b/document/src/vespa/document/datatype/positiondatatype.h @@ -11,13 +11,13 @@ class PositionDataType { static StructDataType::UP createInstance(); public: - static const vespalib::string STRUCT_NAME; + static const std::string STRUCT_NAME; static const int STRUCT_VERSION; - static const vespalib::string FIELD_X; - static const vespalib::string FIELD_Y; + static const std::string FIELD_X; + static const std::string FIELD_Y; static const StructDataType &getInstance(); - static vespalib::string getZCurveFieldName(const vespalib::string &name); + static std::string getZCurveFieldName(const std::string &name); static std::string_view cutZCurveFieldName(std::string_view name); static bool isZCurveFieldName(std::string_view name); }; diff --git a/document/src/vespa/document/datatype/referencedatatype.cpp b/document/src/vespa/document/datatype/referencedatatype.cpp index 75bbdecd7277..58197ea48f78 100644 --- a/document/src/vespa/document/datatype/referencedatatype.cpp +++ b/document/src/vespa/document/datatype/referencedatatype.cpp @@ -34,7 +34,7 @@ void ReferenceDataType::onBuildFieldPath(FieldPath &, std::string_view remainingFieldName) const { if ( ! remainingFieldName.empty() ) { throw IllegalArgumentException(make_string("Reference data type does not support further field recursion: '%s'", - vespalib::string(remainingFieldName).c_str()), VESPA_STRLOC); + std::string(remainingFieldName).c_str()), VESPA_STRLOC); } } diff --git a/document/src/vespa/document/datatype/structdatatype.cpp b/document/src/vespa/document/datatype/structdatatype.cpp index f84ee19f7166..6b3ba575eb70 100644 --- a/document/src/vespa/document/datatype/structdatatype.cpp +++ b/document/src/vespa/document/datatype/structdatatype.cpp @@ -60,7 +60,7 @@ StructDataType::print(std::ostream& out, bool verbose, void StructDataType::addField(const Field& field) { - vespalib::string error = containsConflictingField(field); + std::string error = containsConflictingField(field); if (!error.empty()) { throw IllegalArgumentException(make_string("Failed to add field '%s' to struct '%s': %s", field.getName().data(), getName().c_str(), @@ -77,7 +77,7 @@ StructDataType::addField(const Field& field) void StructDataType::addInheritedField(const Field& field) { - vespalib::string error = containsConflictingField(field); + std::string error = containsConflictingField(field); if (!error.empty()) { // Deploy application should fail if overwriting a field with field // of different type. Java version of document sees to this. C++ @@ -106,7 +106,7 @@ StructDataType::getField(std::string_view name) const { StringFieldMap::const_iterator it(_nameFieldMap.find(name)); if (it == _nameFieldMap.end()) { - throw FieldNotFoundException(vespalib::string(name), VESPA_STRLOC); + throw FieldNotFoundException(std::string(name), VESPA_STRLOC); } else { return *it->second; } @@ -162,7 +162,7 @@ bool differs(const Field &field1, const Field &field2) { } } // namespace -vespalib::string +std::string StructDataType::containsConflictingField(const Field& field) const { StringFieldMap::const_iterator it1( _nameFieldMap.find(field.getName())); diff --git a/document/src/vespa/document/datatype/structdatatype.h b/document/src/vespa/document/datatype/structdatatype.h index b9fd1b55b8a6..19c19cd33ee7 100644 --- a/document/src/vespa/document/datatype/structdatatype.h +++ b/document/src/vespa/document/datatype/structdatatype.h @@ -62,13 +62,13 @@ class StructDataType final : public StructuredDataType { Field::Set getFieldSet() const override; private: - using StringFieldMap = vespalib::hash_map; + using StringFieldMap = vespalib::hash_map; using IntFieldMap = vespalib::hash_map; StringFieldMap _nameFieldMap; IntFieldMap _idFieldMap; /** @return "" if not conflicting. Error message otherwise. */ - vespalib::string containsConflictingField(const Field& field) const; + std::string containsConflictingField(const Field& field) const; }; } diff --git a/document/src/vespa/document/datatype/structureddatatype.cpp b/document/src/vespa/document/datatype/structureddatatype.cpp index 4b4c4f159dcf..e7fc94c950f7 100644 --- a/document/src/vespa/document/datatype/structureddatatype.cpp +++ b/document/src/vespa/document/datatype/structureddatatype.cpp @@ -82,10 +82,10 @@ StructuredDataType::onBuildFieldPath(FieldPath & path, std::string_view remainFi path.insert(path.begin(), std::make_unique(fp)); } else { - throw FieldNotFoundException(vespalib::string(currFieldName), + throw FieldNotFoundException(std::string(currFieldName), make_string("Invalid field path '%s', no field named '%s'", - vespalib::string(remainFieldName).c_str(), - vespalib::string(currFieldName).c_str())); + std::string(remainFieldName).c_str(), + std::string(currFieldName).c_str())); } } diff --git a/document/src/vespa/document/datatype/tensor_data_type.cpp b/document/src/vespa/document/datatype/tensor_data_type.cpp index aa26486e5bd1..e6a60c9c3b9c 100644 --- a/document/src/vespa/document/datatype/tensor_data_type.cpp +++ b/document/src/vespa/document/datatype/tensor_data_type.cpp @@ -41,7 +41,7 @@ TensorDataType::print(std::ostream& out, bool verbose, const std::string& indent } std::unique_ptr -TensorDataType::fromSpec(const vespalib::string &spec) +TensorDataType::fromSpec(const std::string &spec) { return std::make_unique(ValueType::from_spec(spec)); } diff --git a/document/src/vespa/document/datatype/tensor_data_type.h b/document/src/vespa/document/datatype/tensor_data_type.h index 93f5fc50629e..172f2fbd0182 100644 --- a/document/src/vespa/document/datatype/tensor_data_type.h +++ b/document/src/vespa/document/datatype/tensor_data_type.h @@ -22,7 +22,7 @@ class TensorDataType final : public PrimitiveDataType { bool equals(const DataType& other) const noexcept override; std::unique_ptr createFieldValue() const override; void print(std::ostream&, bool verbose, const std::string& indent) const override; - static std::unique_ptr fromSpec(const vespalib::string &spec); + static std::unique_ptr fromSpec(const std::string &spec); const vespalib::eval::ValueType &getTensorType() const { return _tensorType; } bool isAssignableType(const vespalib::eval::ValueType &tensorType) const; static bool isAssignableType(const vespalib::eval::ValueType &fieldTensorType, const vespalib::eval::ValueType &tensorType); diff --git a/document/src/vespa/document/datatype/weightedsetdatatype.cpp b/document/src/vespa/document/datatype/weightedsetdatatype.cpp index 5785cb8102ed..7b2bb3fa6079 100644 --- a/document/src/vespa/document/datatype/weightedsetdatatype.cpp +++ b/document/src/vespa/document/datatype/weightedsetdatatype.cpp @@ -10,7 +10,7 @@ namespace document { namespace { -vespalib::string +std::string createName(const DataType& nestedType, bool create, bool remove) { if (nestedType.getId() == DataType::T_STRING && create && remove) { diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.cpp b/document/src/vespa/document/fieldset/fieldsetrepo.cpp index e451ea9f72b4..21862f234c7f 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.cpp +++ b/document/src/vespa/document/fieldset/fieldsetrepo.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using vespalib::StringTokenizer; using vespalib::IllegalArgumentException; @@ -46,7 +47,7 @@ parseFieldCollection(const DocumentTypeRepo& repo, std::string_view docType, std StringTokenizer tokenizer(fieldNames, ","); Field::Set::Builder builder; for (const auto & token : tokenizer) { - const DocumentType::FieldSet * fs = type.getFieldSet(vespalib::string(token)); + const DocumentType::FieldSet * fs = type.getFieldSet(std::string(token)); if (fs) { for (const auto & fieldName : fs->getFields()) { builder.add(&type.getField(fieldName)); @@ -76,7 +77,7 @@ FieldSetRepo::parse(const DocumentTypeRepo& repo, std::string_view str) } } -vespalib::string +std::string FieldSetRepo::serialize(const FieldSet& fieldSet) { switch (fieldSet.getType()) { @@ -126,7 +127,7 @@ FieldSetRepo::~FieldSetRepo() = default; void FieldSetRepo::configureDocumentType(const DocumentType & documentType) { for (const auto & entry : documentType.getFieldSets()) { - vespalib::string fieldSetName(documentType.getName()); + std::string fieldSetName(documentType.getName()); fieldSetName.append(":").append(entry.first); try { auto fieldset = parse(_doumentTyperepo, fieldSetName); diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.h b/document/src/vespa/document/fieldset/fieldsetrepo.h index c08170d90d9a..1dd8153a59d3 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.h +++ b/document/src/vespa/document/fieldset/fieldsetrepo.h @@ -22,11 +22,11 @@ class FieldSetRepo FieldSet::SP getFieldSet(std::string_view fieldSetString) const; static FieldSet::SP parse(const DocumentTypeRepo& repo, std::string_view fieldSetString); - static vespalib::string serialize(const FieldSet& fs); + static std::string serialize(const FieldSet& fs); private: void configureDocumentType(const DocumentType & documentType); const DocumentTypeRepo & _doumentTyperepo; - vespalib::hash_map _configuredFieldSets; + vespalib::hash_map _configuredFieldSets; }; } diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp index 05fd9cf13ed8..8c87f8a674d7 100644 --- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp @@ -171,7 +171,7 @@ ArrayFieldValue::print(std::ostream& out, bool verbose, fieldvalue::ModificationStatus ArrayFieldValue::iterateSubset(int startPos, int endPos, - const vespalib::string & variable, + const std::string & variable, PathRange nested, fieldvalue::IteratorHandler& handler) const { diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.h b/document/src/vespa/document/fieldvalue/arrayfieldvalue.h index 9e07d9e8a4a8..d91df9d3bd09 100644 --- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.h @@ -26,7 +26,7 @@ class ArrayFieldValue final : public CollectionFieldValue { bool addValue(const FieldValue&) override; bool containsValue(const FieldValue& val) const override; bool removeValue(const FieldValue& val) override; - fieldvalue::ModificationStatus iterateSubset(int startPos, int endPos, const vespalib::string & variable, + fieldvalue::ModificationStatus iterateSubset(int startPos, int endPos, const std::string & variable, PathRange nested, fieldvalue::IteratorHandler& handler) const; fieldvalue::ModificationStatus onIterateNested(PathRange nested, fieldvalue::IteratorHandler & handler) const override; public: diff --git a/document/src/vespa/document/fieldvalue/boolfieldvalue.cpp b/document/src/vespa/document/fieldvalue/boolfieldvalue.cpp index ffb5dcd572bf..42b3a7cb8f1c 100644 --- a/document/src/vespa/document/fieldvalue/boolfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/boolfieldvalue.cpp @@ -73,7 +73,7 @@ double BoolFieldValue::getAsDouble() const { return _value ? 1 : 0; } -vespalib::string +std::string BoolFieldValue::getAsString() const { return _value ? "true" : "false"; } diff --git a/document/src/vespa/document/fieldvalue/boolfieldvalue.h b/document/src/vespa/document/fieldvalue/boolfieldvalue.h index e0e656d62fc1..d75dd5e4cf4f 100644 --- a/document/src/vespa/document/fieldvalue/boolfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/boolfieldvalue.h @@ -37,7 +37,7 @@ class BoolFieldValue final : public FieldValue { int64_t getAsLong() const override; float getAsFloat() const override; double getAsDouble() const override; - vespalib::string getAsString() const override; + std::string getAsString() const override; BoolFieldValue& operator=(std::string_view) override; static std::unique_ptr make(bool value=false) { return std::make_unique(value); } diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp index edcb585e35ee..f7e16ff9a15d 100644 --- a/document/src/vespa/document/fieldvalue/document.cpp +++ b/document/src/vespa/document/fieldvalue/document.cpp @@ -29,12 +29,12 @@ void throwTypeMismatch(std::string_view type, std::string_view docidType) __attr void documentTypeError(std::string_view name) { throw IllegalArgumentException(make_string("Cannot generate a document with non-document type %s.", - vespalib::string(name).c_str()), VESPA_STRLOC); + std::string(name).c_str()), VESPA_STRLOC); } void throwTypeMismatch(std::string_view type, std::string_view docidType) { throw IllegalArgumentException(make_string("Trying to create a document with type %s that don't match the id (type %s).", - vespalib::string(type).c_str(), vespalib::string(docidType).c_str()), + std::string(type).c_str(), std::string(docidType).c_str()), VESPA_STRLOC); } @@ -210,8 +210,8 @@ Document::compare(const FieldValue& other) const return diff; } auto & doc(static_cast(other)); - vespalib::string id1 = _id.toString(); - vespalib::string id2 = doc._id.toString(); + std::string id1 = _id.toString(); + std::string id2 = doc._id.toString(); if (id1 != id2) { return (id1 < id2 ? -1 : 1); } @@ -267,7 +267,7 @@ void Document::deserialize(const DocumentTypeRepo& repo, vespalib::nbostream & o try { deserializer.read(*this); } catch (const IllegalStateException &e) { - throw DeserializeException(vespalib::string("Buffer out of bounds: ") + e.what()); + throw DeserializeException(std::string("Buffer out of bounds: ") + e.what()); } } diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp index 5e3fda487c79..20573b551636 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp @@ -163,7 +163,7 @@ FieldValue::getAsDouble() const throw InvalidDataTypeConversionException(*getDataType(), *DataType::DOUBLE, VESPA_STRLOC); } -vespalib::string +std::string FieldValue::getAsString() const { throw InvalidDataTypeConversionException(*getDataType(), *DataType::STRING, VESPA_STRLOC); diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h index fddc4e4d84ea..c34df64ab028 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.h +++ b/document/src/vespa/document/fieldvalue/fieldvalue.h @@ -128,7 +128,7 @@ class FieldValue * @return Returns the wrapped value if it is a string or compatible type. * @throws document::InvalidDataTypeConversionException */ - virtual vespalib::string getAsString() const; + virtual std::string getAsString() const; /** * @return Returns the wrapped value if it is a raw or compatible type. diff --git a/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp b/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp index 2f9e6d13e5f0..d04674b4543a 100644 --- a/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp @@ -80,7 +80,7 @@ void LiteralFieldValueB:: print(std::ostream& out, bool, const std::string&) const { - vespalib::string escaped; + std::string escaped; out << StringUtil::escape(getValue(), escaped); } @@ -91,7 +91,7 @@ LiteralFieldValueB::operator=(std::string_view value) return *this; } -vespalib::string +std::string LiteralFieldValueB::getAsString() const { return getValue(); diff --git a/document/src/vespa/document/fieldvalue/literalfieldvalue.h b/document/src/vespa/document/fieldvalue/literalfieldvalue.h index 22b4105faf6d..694b3b49ad38 100644 --- a/document/src/vespa/document/fieldvalue/literalfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/literalfieldvalue.h @@ -22,7 +22,7 @@ namespace document { class LiteralFieldValueB : public FieldValue { public: - using string = vespalib::string; + using string = std::string; using string_view = std::string_view; using UP = std::unique_ptr; using value_type = string; @@ -57,7 +57,7 @@ class LiteralFieldValueB : public FieldValue { int compare(const FieldValue& other) const override; int fastCompare(const FieldValue& other) const override final; - vespalib::string getAsString() const override; + std::string getAsString() const override; std::pair getAsRaw() const override; void printXml(XmlOutputStream& out) const override; diff --git a/document/src/vespa/document/fieldvalue/numericfieldvalue.h b/document/src/vespa/document/fieldvalue/numericfieldvalue.h index de2ece48ac4d..e84186f71075 100644 --- a/document/src/vespa/document/fieldvalue/numericfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/numericfieldvalue.h @@ -46,7 +46,7 @@ class NumericFieldValue : public NumericFieldValueBase { int64_t getAsLong() const override; float getAsFloat() const override; double getAsDouble() const override; - vespalib::string getAsString() const override; + std::string getAsString() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; diff --git a/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp b/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp index 92d1a9e81f5b..650c5541a149 100644 --- a/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp +++ b/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp @@ -155,7 +155,7 @@ NumericFieldValue::getAsDouble() const } template -vespalib::string +std::string NumericFieldValue::getAsString() const { vespalib::asciistream ost; diff --git a/document/src/vespa/document/fieldvalue/referencefieldvalue.cpp b/document/src/vespa/document/fieldvalue/referencefieldvalue.cpp index 46d3a21d8481..9a74f2cef169 100644 --- a/document/src/vespa/document/fieldvalue/referencefieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/referencefieldvalue.cpp @@ -43,7 +43,7 @@ void ReferenceFieldValue::requireIdOfMatchingType( make_string("Can't assign document ID '%s' (of type '%s') to " "reference of document type '%s'", id.toString().c_str(), - vespalib::string(id.getDocType()).c_str(), + std::string(id.getDocType()).c_str(), type.getName().c_str()), VESPA_STRLOC); } diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index 3f5e58548630..6b84634b454d 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -283,7 +283,7 @@ StructFieldValue::printXml(XmlOutputStream& xos) const { double ns = getFieldValue(getField(PositionDataType::FIELD_Y))->getAsInt() / 1.0e6; double ew = getFieldValue(getField(PositionDataType::FIELD_X))->getAsInt() / 1.0e6; - vespalib::string buf = make_string("%s%.6f;%s%.6f", + std::string buf = make_string("%s%.6f;%s%.6f", (ns < 0 ? "S" : "N"), (ns < 0 ? (-ns) : ns), (ew < 0 ? "W" : "E"), diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h index 6c39c723b6b7..a0fecd49d033 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h @@ -12,6 +12,7 @@ #include "fieldvalue.h" #include +#include namespace document { diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp index b564e852c3c1..3324116eade5 100644 --- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp @@ -21,7 +21,7 @@ namespace { TensorDataType emptyTensorDataType(ValueType::error_type()); -vespalib::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const ValueType &tensorType) +std::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const ValueType &tensorType) { return vespalib::make_string("Field tensor type is '%s' but other tensor type is '%s'", fieldTensorType.to_spec().c_str(), diff --git a/document/src/vespa/document/fieldvalue/variablemap.cpp b/document/src/vespa/document/fieldvalue/variablemap.cpp index 49c98eb591e4..e3e1057c5a79 100644 --- a/document/src/vespa/document/fieldvalue/variablemap.cpp +++ b/document/src/vespa/document/fieldvalue/variablemap.cpp @@ -43,7 +43,7 @@ IndexValue & IndexValue::operator = (const IndexValue & rhs) { IndexValue::~IndexValue() = default; -vespalib::string +std::string IndexValue::toString() const { if (key) { return key->toString(); @@ -57,7 +57,7 @@ VariableMap & VariableMap::operator = (VariableMap && rhs) noexcept = default; VariableMap::VariableMap() = default; VariableMap::~VariableMap() = default; -vespalib::string +std::string VariableMap::toString() const { vespalib::asciistream out; out << "[ "; diff --git a/document/src/vespa/document/fieldvalue/variablemap.h b/document/src/vespa/document/fieldvalue/variablemap.h index d867c47c9b75..2febc63c2dbb 100644 --- a/document/src/vespa/document/fieldvalue/variablemap.h +++ b/document/src/vespa/document/fieldvalue/variablemap.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace document { class FieldValue; @@ -24,14 +24,14 @@ class IndexValue { ~IndexValue(); - vespalib::string toString() const; + std::string toString() const; bool operator==(const IndexValue& other) const; int index; // For array std::unique_ptr key; // For map/wset }; -using VariableMapT = std::map; +using VariableMapT = std::map; class VariableMap : public VariableMapT { public: @@ -41,7 +41,7 @@ class VariableMap : public VariableMapT { VariableMap(const VariableMap & rhs) = delete; VariableMap & operator = (const VariableMap & rhs) = delete; ~VariableMap(); - vespalib::string toString() const; + std::string toString() const; }; } diff --git a/document/src/vespa/document/predicate/predicate_printer.cpp b/document/src/vespa/document/predicate/predicate_printer.cpp index 03ac39e1dc4a..4a95649253ca 100644 --- a/document/src/vespa/document/predicate/predicate_printer.cpp +++ b/document/src/vespa/document/predicate/predicate_printer.cpp @@ -17,7 +17,7 @@ void printEscapedString(vespalib::asciistream &out, const Inspector &in) { } } // namespace -vespalib::string +std::string PredicatePrinter::str() const { return _out->str(); } @@ -97,7 +97,7 @@ void PredicatePrinter::visitFalse(const Inspector &) { *_out << "false"; } -vespalib::string PredicatePrinter::print(const Slime &slime) { +std::string PredicatePrinter::print(const Slime &slime) { PredicatePrinter printer; printer.visit(slime.get()); return printer.str(); diff --git a/document/src/vespa/document/predicate/predicate_printer.h b/document/src/vespa/document/predicate/predicate_printer.h index 54f537715dd4..bad1fdf29529 100644 --- a/document/src/vespa/document/predicate/predicate_printer.h +++ b/document/src/vespa/document/predicate/predicate_printer.h @@ -3,7 +3,7 @@ #pragma once #include "predicate_slime_visitor.h" -#include +#include namespace vespalib { class Slime; @@ -24,12 +24,12 @@ class PredicatePrinter : PredicateSlimeVisitor { void visitTrue(const Inspector &i) override; void visitFalse(const Inspector &i) override; - vespalib::string str() const; + std::string str() const; PredicatePrinter(); ~PredicatePrinter(); public: - static vespalib::string print(const vespalib::Slime &slime); + static std::string print(const vespalib::Slime &slime); }; } // namespace document diff --git a/document/src/vespa/document/repo/configbuilder.cpp b/document/src/vespa/document/repo/configbuilder.cpp index cf563c5c783d..2c35e93b0a44 100644 --- a/document/src/vespa/document/repo/configbuilder.cpp +++ b/document/src/vespa/document/repo/configbuilder.cpp @@ -6,7 +6,7 @@ namespace document::config_builder { -int32_t createFieldId(const vespalib::string &name, int32_t type) { +int32_t createFieldId(const std::string &name, int32_t type) { StructDataType dummy("dummy", type); Field f(name, dummy); return f.getId(); @@ -32,7 +32,7 @@ void DatatypeConfig::addNestedType(const TypeOrId &t) { } Struct & -Struct::addTensorField(const vespalib::string &name, const vespalib::string &spec) { +Struct::addTensorField(const std::string &name, const std::string &spec) { sstruct.field.resize(sstruct.field.size() + 1); auto &field = sstruct.field.back(); field.name = name; @@ -55,14 +55,14 @@ void addType(const DatatypeConfig &type, } DocTypeRep & -DocTypeRep::annotationType(int32_t id, const vespalib::string &name, const DatatypeConfig &type) { +DocTypeRep::annotationType(int32_t id, const std::string &name, const DatatypeConfig &type) { addType(type, doc_type); return annotationType(id, name, type.id); } DocTypeRep -DocumenttypesConfigBuilderHelper::document(int32_t id, const vespalib::string &name, +DocumenttypesConfigBuilderHelper::document(int32_t id, const std::string &name, const DatatypeConfig &header, const DatatypeConfig &body) { assert(header.type == DatatypeConfig::Type::STRUCT); diff --git a/document/src/vespa/document/repo/configbuilder.h b/document/src/vespa/document/repo/configbuilder.h index 61924b2b41af..fbe1282a1a82 100644 --- a/document/src/vespa/document/repo/configbuilder.h +++ b/document/src/vespa/document/repo/configbuilder.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include namespace document::config_builder { @@ -25,7 +25,7 @@ struct DatatypeConfig : DocumenttypesConfig::Documenttype::Datatype { void addNestedType(const TypeOrId &t); }; -int32_t createFieldId(const vespalib::string &name, int32_t type); +int32_t createFieldId(const std::string &name, int32_t type); struct TypeOrId { int32_t id; @@ -37,7 +37,7 @@ struct TypeOrId { }; struct Struct : DatatypeConfig { - explicit Struct(vespalib::string name) { + explicit Struct(std::string name) { type = Type::STRUCT; sstruct.name = std::move(name); } @@ -49,7 +49,7 @@ struct Struct : DatatypeConfig { sstruct.compression.minsize = min_size; return *this; } - Struct &addField(const vespalib::string &name, TypeOrId data_type) { + Struct &addField(const std::string &name, TypeOrId data_type) { addNestedType(data_type); sstruct.field.resize(sstruct.field.size() + 1); sstruct.field.back().name = name; @@ -57,7 +57,7 @@ struct Struct : DatatypeConfig { sstruct.field.back().datatype = data_type.id; return *this; } - Struct &addTensorField(const vespalib::string &name, const vespalib::string &spec); + Struct &addTensorField(const std::string &name, const std::string &spec); Struct &setId(int32_t i) { DatatypeConfig::setId(i); return *this; } }; @@ -109,7 +109,7 @@ struct DocTypeRep { doc_type.inherits.back().id = id; return *this; } - DocTypeRep &annotationType(int32_t id, const vespalib::string &name, + DocTypeRep &annotationType(int32_t id, const std::string &name, int32_t datatype) { doc_type.annotationtype.resize(doc_type.annotationtype.size() + 1); doc_type.annotationtype.back().id = id; @@ -117,7 +117,7 @@ struct DocTypeRep { doc_type.annotationtype.back().datatype = datatype; return *this; } - DocTypeRep &annotationType(int32_t id, const vespalib::string &name, + DocTypeRep &annotationType(int32_t id, const std::string &name, const DatatypeConfig &type); DocTypeRep& referenceType(int32_t id, int32_t target_type_id) { @@ -127,7 +127,7 @@ struct DocTypeRep { return *this; } - DocTypeRep& imported_field(vespalib::string field_name) { + DocTypeRep& imported_field(std::string field_name) { doc_type.importedfield.resize(doc_type.importedfield.size() + 1); doc_type.importedfield.back().name = std::move(field_name); return *this; @@ -142,7 +142,7 @@ class DocumenttypesConfigBuilderHelper { DocumenttypesConfigBuilderHelper(const DocumenttypesConfig &c) : _config(c) {} - DocTypeRep document(int32_t id, const vespalib::string &name, + DocTypeRep document(int32_t id, const std::string &name, const DatatypeConfig &header, const DatatypeConfig &body); diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp index 8501095592d6..a823006b43c3 100644 --- a/document/src/vespa/document/repo/documenttyperepo.cpp +++ b/document/src/vespa/document/repo/documenttyperepo.cpp @@ -29,7 +29,7 @@ using std::vector; using vespalib::IllegalArgumentException; using vespalib::hash_map; using vespalib::make_string; -using vespalib::string; +using std::string; namespace document { diff --git a/document/src/vespa/document/select/context.cpp b/document/src/vespa/document/select/context.cpp index 7400432c0b98..2d8c8003325f 100644 --- a/document/src/vespa/document/select/context.cpp +++ b/document/src/vespa/document/select/context.cpp @@ -37,7 +37,7 @@ Context::Context(const DocumentUpdate& docUpdate) Context::~Context() = default; std::unique_ptr -Context::getValue(const vespalib::string & value) const { +Context::getValue(const std::string & value) const { if (_variables) { VariableMap::const_iterator iter = _variables->find(value); diff --git a/document/src/vespa/document/select/context.h b/document/src/vespa/document/select/context.h index 081a16eedca0..3567e3fac8e3 100644 --- a/document/src/vespa/document/select/context.h +++ b/document/src/vespa/document/select/context.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace document { class Document; @@ -24,7 +24,7 @@ class Context { virtual ~Context(); void setVariableMap(std::unique_ptr map); - std::unique_ptr getValue(const vespalib::string & value) const; + std::unique_ptr getValue(const std::string & value) const; const Document *_doc; const DocumentId *_docId; diff --git a/document/src/vespa/document/select/doctype.h b/document/src/vespa/document/select/doctype.h index 7557760e3244..959d855ef199 100644 --- a/document/src/vespa/document/select/doctype.h +++ b/document/src/vespa/document/select/doctype.h @@ -17,7 +17,7 @@ namespace document::select { class DocType : public Node { private: - vespalib::string _doctype; + std::string _doctype; public: DocType(std::string_view doctype); diff --git a/document/src/vespa/document/select/grammar/lexer.ll b/document/src/vespa/document/select/grammar/lexer.ll index faea80494d8f..4bcf19acb68d 100644 --- a/document/src/vespa/document/select/grammar/lexer.ll +++ b/document/src/vespa/document/select/grammar/lexer.ll @@ -25,9 +25,8 @@ #include #include #include -#include -#include #include +#include #undef YY_DECL #define YY_DECL int document::select::DocSelScanner::yylex( \ @@ -35,7 +34,7 @@ document::select::DocSelParser::location_type* yyloc) using token = document::select::DocSelParser::token; -using string = vespalib::string; +using string = std::string; // Inspired by https://coldfix.eu/2015/05/16/bison-c++11/ @@ -178,7 +177,7 @@ SQ_STRING \'(\\([\\tnfr']|x{HEXDIGIT}{2})|[^'\\])*\' * char to avoid getting auto-generated error messages with "unexpected $undefined" due to the * resulting token not matching any existing, explicitly named tokens. */ -. { throw_parser_syntax_error(*yyloc, "Unexpected character: '" + StringUtil::escape(vespalib::string(yytext, 1)) + "'"); } +. { throw_parser_syntax_error(*yyloc, "Unexpected character: '" + StringUtil::escape(std::string(yytext, 1)) + "'"); } %% diff --git a/document/src/vespa/document/select/grammar/parser.yy b/document/src/vespa/document/select/grammar/parser.yy index 3e95bebda242..58e5737e2382 100644 --- a/document/src/vespa/document/select/grammar/parser.yy +++ b/document/src/vespa/document/select/grammar/parser.yy @@ -26,7 +26,7 @@ int64_t i64_val; double double_val; const char* const_str_val; - vespalib::string* string_val; + std::string* string_val; Constant* constant_node; ValueNode* value_node; FieldExprNode* field_expr_node; @@ -103,8 +103,8 @@ #include #include #include -#include #include +#include namespace document { class BucketIdFactory; @@ -137,12 +137,12 @@ class ValueNode; #include #include #include -#include #include -#include #include +#include +#include -using string = vespalib::string; +using string = std::string; // Wrap grabbing pointers from sub-rules in a way that nulls out the // stored attribute from the Bison stack. Otherwise, exception cleanup diff --git a/document/src/vespa/document/select/node.h b/document/src/vespa/document/select/node.h index c2d9091dd4eb..4af3ef03d423 100644 --- a/document/src/vespa/document/select/node.h +++ b/document/src/vespa/document/select/node.h @@ -21,7 +21,7 @@ class Visitor; class Node : public Printable { protected: - vespalib::string _name; + std::string _name; uint32_t _max_depth; bool _parentheses; // Set to true if parentheses was used around this part // Set such that we can recreate original query in print. diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp index d6ff2096c1f9..39b94043f773 100644 --- a/document/src/vespa/document/select/operator.cpp +++ b/document/src/vespa/document/select/operator.cpp @@ -126,7 +126,7 @@ RegexOperator::traceImpl(const Value& a, const Value& b, std::ostream& out) cons } ResultList -RegexOperator::match(const vespalib::string& val, std::string_view expr) const +RegexOperator::match(const std::string& val, std::string_view expr) const { if (expr.empty()) { return ResultList(Result::True); // Should we catch this in parsing? @@ -167,7 +167,7 @@ GlobOperator::compareImpl(const Value& a, const Value& b) const if (left == nullptr) { return ResultList(Result::Invalid); } - vespalib::string regex(convertToRegex(right->getValue())); + std::string regex(convertToRegex(right->getValue())); return match(left->getValue(), regex); } @@ -187,7 +187,7 @@ GlobOperator::traceImpl(const Value& a, const Value& b, std::ostream& ost) const << "returning invalid.\n"; return ResultList(Result::Invalid); } - vespalib::string regex(convertToRegex(right->getValue())); + std::string regex(convertToRegex(right->getValue())); ost << "Operator(" << getName() << ") - Converted glob expression '" << right->getValue() << "' to regex '" << regex << "'.\n"; return match(left->getValue(), regex); @@ -205,7 +205,7 @@ size_t wildcard_run_length(size_t i, std::string_view str) { } -vespalib::string +std::string GlobOperator::convertToRegex(std::string_view globpattern) { if (globpattern.empty()) { diff --git a/document/src/vespa/document/select/operator.h b/document/src/vespa/document/select/operator.h index f67a2ebc9b9c..a875759f984a 100644 --- a/document/src/vespa/document/select/operator.h +++ b/document/src/vespa/document/select/operator.h @@ -19,9 +19,9 @@ namespace document::select { class Operator : public Printable { private: - using OperatorMap = vespalib::hash_map; + using OperatorMap = vespalib::hash_map; static OperatorMap _operators; - vespalib::string _name; + std::string _name; public: Operator(std::string_view name); @@ -30,7 +30,7 @@ class Operator : public Printable { virtual ResultList compare(const Value&, const Value&) const = 0; virtual ResultList trace(const Value&, const Value&, std::ostream& trace) const = 0; - const vespalib::string& getName() const { return _name; } + const std::string& getName() const { return _name; } static const Operator& get(std::string_view name); @@ -69,7 +69,7 @@ class RegexOperator : public Operator { // Delegates to Value::regexCompare ResultList compare(const Value& a, const Value& b) const override; ResultList trace(const Value&, const Value&, std::ostream& trace) const override; - ResultList match(const vespalib::string & val, std::string_view expr) const; + ResultList match(const std::string & val, std::string_view expr) const; static const RegexOperator REGEX; @@ -108,7 +108,7 @@ class GlobOperator : public RegexOperator { * as all these match 0-n characters each. This also works with * simplification, i.e. '***foo***' -> /foo/ and '***' -> // */ - static vespalib::string convertToRegex(std::string_view globpattern); + static std::string convertToRegex(std::string_view globpattern); static bool containsVariables(std::string_view expression); static const GlobOperator GLOB; diff --git a/document/src/vespa/document/select/simpleparser.cpp b/document/src/vespa/document/select/simpleparser.cpp index 093d2842e1fc..ad97d7620d0f 100644 --- a/document/src/vespa/document/select/simpleparser.cpp +++ b/document/src/vespa/document/select/simpleparser.cpp @@ -4,6 +4,7 @@ #include "compare.h" #include #include +#include namespace document::select::simple { @@ -128,7 +129,7 @@ bool StringParser::parse(std::string_view s) size_t pos(eatWhite(s.data(), s.size())); if (pos + 1 < s.size()) { if (s[pos++] == '"') { - vespalib::string str; + std::string str; for(;(pos < s.size()) && (s[pos] != '"');pos++) { if ((pos < s.size()) && (s[pos] == '\\')) { pos++; diff --git a/document/src/vespa/document/select/value.h b/document/src/vespa/document/select/value.h index 6c006d9864b7..005cf73a0367 100644 --- a/document/src/vespa/document/select/value.h +++ b/document/src/vespa/document/select/value.h @@ -16,12 +16,12 @@ #pragma once -#include +#include "resultlist.h" +#include #include +#include #include #include -#include -#include "resultlist.h" namespace document::select { @@ -86,12 +86,12 @@ class NullValue : public Value class StringValue : public Value { - vespalib::string _value; + std::string _value; public: StringValue(std::string_view val); - const vespalib::string& getValue() const { return _value; } + const std::string& getValue() const { return _value; } ResultList operator<(const Value& value) const override; ResultList operator==(const Value& value) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -228,7 +228,7 @@ class ArrayValue : public Value class StructValue : public Value { public: - using ValueMap = std::map; + using ValueMap = std::map; StructValue(ValueMap values); StructValue(const StructValue &) = delete; StructValue & operator = (const StructValue &) = delete; diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp index d3a02fed7a95..124878dcc26c 100644 --- a/document/src/vespa/document/select/valuenodes.cpp +++ b/document/src/vespa/document/select/valuenodes.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -200,8 +201,8 @@ FloatValueNode::print(std::ostream& out, bool verbose, if (hadParentheses()) out << ')'; } -FieldValueNode::FieldValueNode(const vespalib::string& doctype, - const vespalib::string& fieldExpression) +FieldValueNode::FieldValueNode(const std::string& doctype, + const std::string& fieldExpression) : _doctype(doctype), _fieldExpression(fieldExpression), _fieldName(extractFieldName(fieldExpression)) @@ -212,7 +213,7 @@ FieldValueNode::~FieldValueNode() = default; namespace { -size_t first_ident_length_or_npos(const vespalib::string& expr) { +size_t first_ident_length_or_npos(const std::string& expr) { for (size_t i = 0; i < expr.size(); ++i) { switch (expr[i]) { case '.': @@ -226,14 +227,14 @@ size_t first_ident_length_or_npos(const vespalib::string& expr) { continue; } } - return vespalib::string::npos; + return std::string::npos; } } // TODO remove this pile of fun in favor of actually parsed AST nodes...! -vespalib::string -FieldValueNode::extractFieldName(const vespalib::string & fieldExpression) { +std::string +FieldValueNode::extractFieldName(const std::string & fieldExpression) { // When we get here the actual contents of the field expression shall already // have been structurally and syntactically verified by the parser. return fieldExpression.substr(0, first_ident_length_or_npos(fieldExpression)); @@ -389,7 +390,7 @@ FieldValueNode::initFieldPath(const DocumentType& type) const { namespace { -bool looks_like_complex_field_path(const vespalib::string& expr) { +bool looks_like_complex_field_path(const std::string& expr) { for (const char c : expr) { switch (c) { case '.': @@ -402,7 +403,7 @@ bool looks_like_complex_field_path(const vespalib::string& expr) { return false; } -bool is_simple_imported_field(const vespalib::string& expr, const DocumentType& doc_type) { +bool is_simple_imported_field(const std::string& expr, const DocumentType& doc_type) { if (looks_like_complex_field_path(expr)) { return false; } @@ -573,7 +574,7 @@ IdValueNode::getValue(const Context& context) const std::unique_ptr IdValueNode::getValue(const DocumentId& id) const { - vespalib::string value; + std::string value; switch (_type) { case BUCKET: return std::make_unique(_bucketIdFactory.getBucketId(id).getId(), true); @@ -636,7 +637,7 @@ IdValueNode::traceValue(const Context& context, std::unique_ptr IdValueNode::traceValue(const DocumentId& id, std::ostream& out) const { - vespalib::string value; + std::string value; switch (_type) { case BUCKET: { @@ -1126,7 +1127,7 @@ std::unique_ptr FieldExprNode::convert_to_field_value() const { const auto& doctype = resolve_doctype(); // FIXME deprecate manual post-parsing of field expressions in favor of // actually using the structural parser in the way nature intended. - vespalib::string mangled_expression; + std::string mangled_expression; build_mangled_expression(mangled_expression); return std::make_unique(doctype, mangled_expression); } @@ -1143,7 +1144,7 @@ std::unique_ptr FieldExprNode::convert_to_function_call() con return std::make_unique(function_name, std::move(lhs)); } -void FieldExprNode::build_mangled_expression(vespalib::string& dest) const { +void FieldExprNode::build_mangled_expression(std::string& dest) const { // Leftmost node is doctype, which should not be emitted as part of mangled expression. if (_left_expr && _left_expr->_left_expr) { _left_expr->build_mangled_expression(dest); @@ -1152,7 +1153,7 @@ void FieldExprNode::build_mangled_expression(vespalib::string& dest) const { dest.append(_right_expr); } -const vespalib::string& FieldExprNode::resolve_doctype() const { +const std::string& FieldExprNode::resolve_doctype() const { const auto* leftmost = this; while (leftmost->_left_expr) { leftmost = leftmost->_left_expr.get(); diff --git a/document/src/vespa/document/select/valuenodes.h b/document/src/vespa/document/select/valuenodes.h index f71e51cee98a..9b451c24e5ed 100644 --- a/document/src/vespa/document/select/valuenodes.h +++ b/document/src/vespa/document/select/valuenodes.h @@ -16,7 +16,7 @@ namespace document::select { class InvalidValueNode : public ValueNode { - vespalib::string _name; + std::string _name; public: InvalidValueNode(std::string_view name); @@ -52,11 +52,11 @@ class NullValueNode : public ValueNode class StringValueNode : public ValueNode { - vespalib::string _value; + std::string _value; public: explicit StringValueNode(std::string_view val); - const vespalib::string& getValue() const { return _value; } + const std::string& getValue() const { return _value; } std::unique_ptr getValue(const Context&) const override { return std::make_unique(_value); @@ -132,11 +132,11 @@ class CurrentTimeValueNode : public ValueNode class VariableValueNode : public ValueNode { - vespalib::string _value; + std::string _value; public: - VariableValueNode(const vespalib::string & variableName) : _value(variableName) {} + VariableValueNode(const std::string & variableName) : _value(variableName) {} - const vespalib::string& getVariableName() const { return _value; } + const std::string& getVariableName() const { return _value; } std::unique_ptr getValue(const Context& context) const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -169,22 +169,22 @@ class FloatValueNode : public ValueNode class FieldValueNode : public ValueNode { - vespalib::string _doctype; - vespalib::string _fieldExpression; - vespalib::string _fieldName; + std::string _doctype; + std::string _fieldExpression; + std::string _fieldName; mutable FieldPath _fieldPath; public: - FieldValueNode(const vespalib::string& doctype, const vespalib::string& fieldExpression); + FieldValueNode(const std::string& doctype, const std::string& fieldExpression); FieldValueNode(const FieldValueNode &) = delete; FieldValueNode & operator = (const FieldValueNode &) = delete; FieldValueNode(FieldValueNode &&) = default; FieldValueNode & operator = (FieldValueNode &&) = default; ~FieldValueNode() override; - const vespalib::string& getDocType() const { return _doctype; } - const vespalib::string& getRealFieldName() const { return _fieldName; } - const vespalib::string& getFieldName() const { return _fieldExpression; } + const std::string& getDocType() const { return _doctype; } + const std::string& getRealFieldName() const { return _fieldName; } + const std::string& getFieldName() const { return _fieldExpression; } std::unique_ptr getValue(const Context& context) const override; std::unique_ptr traceValue(const Context &context, std::ostream& out) const override; @@ -195,7 +195,7 @@ class FieldValueNode : public ValueNode return wrapParens(std::make_unique(_doctype, _fieldExpression)); } - static vespalib::string extractFieldName(const vespalib::string & fieldExpression); + static std::string extractFieldName(const std::string & fieldExpression); private: @@ -208,9 +208,9 @@ class FunctionValueNode; // an AST tree returned to the caller. class FieldExprNode final : public ValueNode { std::unique_ptr _left_expr; - vespalib::string _right_expr; + std::string _right_expr; public: - explicit FieldExprNode(const vespalib::string& doctype) : _left_expr(), _right_expr(doctype) {} + explicit FieldExprNode(const std::string& doctype) : _left_expr(), _right_expr(doctype) {} FieldExprNode(std::unique_ptr left_expr, std::string_view right_expr) : ValueNode(left_expr->max_depth() + 1), _left_expr(std::move(left_expr)), @@ -225,8 +225,8 @@ class FieldExprNode final : public ValueNode { std::unique_ptr convert_to_field_value() const; std::unique_ptr convert_to_function_call() const; private: - void build_mangled_expression(vespalib::string& dest) const; - const vespalib::string& resolve_doctype() const; + void build_mangled_expression(std::string& dest) const; + const std::string& resolve_doctype() const; // These are not used, can just return dummy values. std::unique_ptr getValue(const Context& context) const override { @@ -289,8 +289,8 @@ class IdValueNode : public ValueNode private: const BucketIdFactory& _bucketIdFactory; - vespalib::string _id; - vespalib::string _typestring; + std::string _id; + std::string _typestring; Type _type; int _widthBits; int _divisionBits; @@ -304,7 +304,7 @@ class FunctionValueNode : public ValueNode FunctionValueNode(std::string_view name, std::unique_ptr src); Function getFunction() const { return _function; } - const vespalib::string &getFunctionName(void) const { return _funcname; } + const std::string &getFunctionName(void) const { return _funcname; } std::unique_ptr getValue(const Context& context) const override { return getValue(_source->getValue(context)); @@ -325,7 +325,7 @@ class FunctionValueNode : public ValueNode private: Function _function; - vespalib::string _funcname; + std::string _funcname; std::unique_ptr _source; virtual std::unique_ptr getValue(std::unique_ptr val) const; diff --git a/document/src/vespa/document/select/variablemap.h b/document/src/vespa/document/select/variablemap.h index 4a2e463ce6c3..7e9da7e27923 100644 --- a/document/src/vespa/document/select/variablemap.h +++ b/document/src/vespa/document/select/variablemap.h @@ -1,11 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include +#include namespace document::select { -using VariableMapT = vespalib::hash_map; +using VariableMapT = vespalib::hash_map; class VariableMap : public VariableMapT { public: diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp index be0a11a2520e..bbf24660abd7 100644 --- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp @@ -112,7 +112,7 @@ VespaDocumentDeserializer::readDocType(const DocumentType &guess) if (guess.getName() != type_name) { const DocumentType *type = _repo.getDocumentTypeRepo().getDocumentType(type_name); if (!type) { - throw DocumentTypeNotFoundException(vespalib::string(type_name), VESPA_STRLOC); + throw DocumentTypeNotFoundException(std::string(type_name), VESPA_STRLOC); } return type; } @@ -191,7 +191,7 @@ template <> struct ValueType { using Type = bool; }; template <> struct ValueType { using Type = uint16_t; }; template <> struct ValueType { using Type = uint32_t; }; template <> struct ValueType { using Type = uint64_t; }; -template <> struct ValueType { using Type = vespalib::string; }; +template <> struct ValueType { using Type = std::string; }; template void readFieldValue(nbostream &input, T &value) { diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.cpp b/document/src/vespa/document/serialization/vespadocumentserializer.cpp index 782e6574c8b4..cd138fe57fc8 100644 --- a/document/src/vespa/document/serialization/vespadocumentserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentserializer.cpp @@ -37,7 +37,7 @@ using std::pair; using std::vector; using vespalib::nbostream; using std::string_view; -using vespalib::string; +using std::string; using vespalib::slime::BinaryFormat; using vespalib::compression::CompressionConfig; @@ -430,7 +430,7 @@ namespace { // string instead of string_view. No extra allocs; function only ever called with // string arguments. void -writeStringWithZeroTermination(nbostream & os, const vespalib::string& s) +writeStringWithZeroTermination(nbostream & os, const std::string& s) { uint32_t sz(s.size() + 1); os << sz; diff --git a/document/src/vespa/document/test/make_bucket_space.cpp b/document/src/vespa/document/test/make_bucket_space.cpp index 525dd017c3aa..989538f51ab1 100644 --- a/document/src/vespa/document/test/make_bucket_space.cpp +++ b/document/src/vespa/document/test/make_bucket_space.cpp @@ -9,7 +9,7 @@ BucketSpace makeBucketSpace() noexcept return BucketSpace(1); } -BucketSpace makeBucketSpace(const vespalib::string &docTypeName) noexcept +BucketSpace makeBucketSpace(const std::string &docTypeName) noexcept { // Used by persistence conformance test to map from document type name // to bucket space. See document::TestDocRepo for known document types. diff --git a/document/src/vespa/document/test/make_bucket_space.h b/document/src/vespa/document/test/make_bucket_space.h index 5160ab301c57..3635ee9d2dae 100644 --- a/document/src/vespa/document/test/make_bucket_space.h +++ b/document/src/vespa/document/test/make_bucket_space.h @@ -9,6 +9,6 @@ namespace document::test { // Helper functions used by unit tests BucketSpace makeBucketSpace() noexcept; -BucketSpace makeBucketSpace(const vespalib::string &docTypeName) noexcept; +BucketSpace makeBucketSpace(const std::string &docTypeName) noexcept; } diff --git a/document/src/vespa/document/update/addfieldpathupdate.cpp b/document/src/vespa/document/update/addfieldpathupdate.cpp index 8b517a139033..1c99467b4f2c 100644 --- a/document/src/vespa/document/update/addfieldpathupdate.cpp +++ b/document/src/vespa/document/update/addfieldpathupdate.cpp @@ -53,7 +53,7 @@ AddIteratorHandler::doModify(FieldValue &fv) { cf.add(_values[i]); } } else { - vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", fv.className()); + std::string err = make_string("Unable to add a value to a \"%s\" field value.", fv.className()); throw vespalib::IllegalArgumentException(err, VESPA_STRLOC); } return ModificationStatus::MODIFIED; diff --git a/document/src/vespa/document/update/addvalueupdate.cpp b/document/src/vespa/document/update/addvalueupdate.cpp index 4b7375c30da6..ad43b20126d2 100644 --- a/document/src/vespa/document/update/addvalueupdate.cpp +++ b/document/src/vespa/document/update/addvalueupdate.cpp @@ -70,7 +70,7 @@ AddValueUpdate::applyTo(FieldValue& value) const WeightedSetFieldValue& doc(static_cast(value)); doc.add(*_value, _weight); } else { - vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", value.className()); + std::string err = make_string("Unable to add a value to a \"%s\" field value.", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp index 2d4447d1fc15..2f012079079e 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp +++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp @@ -57,7 +57,7 @@ ArithmeticValueUpdate::applyTo(FieldValue& value) const LongFieldValue& lValue = static_cast(value); lValue.setValue(applyTo(lValue.getAsLong())); } else { - vespalib::string err = vespalib::make_string( + std::string err = vespalib::make_string( "Unable to perform an arithmetic update on a \"%s\" field " "value.", value.className()); throw IllegalStateException(err, VESPA_STRLOC); diff --git a/document/src/vespa/document/update/assignfieldpathupdate.cpp b/document/src/vespa/document/update/assignfieldpathupdate.cpp index ae8d197cf7bc..929cd9869ac4 100644 --- a/document/src/vespa/document/update/assignfieldpathupdate.cpp +++ b/document/src/vespa/document/update/assignfieldpathupdate.cpp @@ -85,7 +85,7 @@ class AssignExpressionIteratorHandler : public IteratorHandler AssignExpressionIteratorHandler( const DocumentTypeRepo& repo, Document& doc, - const vespalib::string& expression, + const std::string& expression, bool removeIfZero, bool createMissingPath_) : _calc(repo, expression), @@ -109,7 +109,7 @@ ModificationStatus AssignValueIteratorHandler::doModify(FieldValue& fv) { LOG(spam, "fv = %s", fv.toString().c_str()); if (!(*fv.getDataType() == *_newValue.getDataType())) { - vespalib::string err = vespalib::make_string( + std::string err = vespalib::make_string( "Trying to assign \"%s\" of type %s to an instance of type %s", _newValue.toString().c_str(), _newValue.className(), fv.className()); throw vespalib::IllegalArgumentException(err, VESPA_STRLOC); diff --git a/document/src/vespa/document/update/assignfieldpathupdate.h b/document/src/vespa/document/update/assignfieldpathupdate.h index e6754998c1bc..d7b910b0aae7 100644 --- a/document/src/vespa/document/update/assignfieldpathupdate.h +++ b/document/src/vespa/document/update/assignfieldpathupdate.h @@ -34,7 +34,7 @@ class AssignFieldPathUpdate final : public FieldPathUpdate _createMissingPath = createMissingPath; } bool getCreateMissingPath() const { return _createMissingPath; } - const vespalib::string& getExpression() const { return _expression; } + const std::string& getExpression() const { return _expression; } bool hasValue() const { return bool(_newValue); } const FieldValue & getValue() const { return *_newValue; } @@ -49,7 +49,7 @@ class AssignFieldPathUpdate final : public FieldPathUpdate std::unique_ptr getIteratorHandler(Document& doc, const DocumentTypeRepo & repo) const override; std::unique_ptr _newValue; - vespalib::string _expression; + std::string _expression; bool _removeIfZero; bool _createMissingPath; }; diff --git a/document/src/vespa/document/update/assignvalueupdate.cpp b/document/src/vespa/document/update/assignvalueupdate.cpp index c8cf04c1390b..3c9b16f4362b 100644 --- a/document/src/vespa/document/update/assignvalueupdate.cpp +++ b/document/src/vespa/document/update/assignvalueupdate.cpp @@ -74,7 +74,7 @@ AssignValueUpdate::applyTo(FieldValue& value) const if (_value && (_value->getDataType() != value.getDataType()) && ((value.getDataType() == nullptr) || !value.getDataType()->isValueType(*_value))) { - vespalib::string err = vespalib::make_string( + std::string err = vespalib::make_string( "Unable to assign a \"%s\" value to a \"%s\" field value.", _value->className(), value.className()); throw IllegalStateException(err, VESPA_STRLOC); diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index fe6f1cbc1f88..58258a4a204a 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -17,7 +17,7 @@ using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; using vespalib::nbostream; using vespalib::make_string; -using vespalib::string; +using std::string; using namespace vespalib::xml; namespace document { @@ -41,7 +41,7 @@ deserializeHeader(const DocumentTypeRepo &repo, vespalib::nbostream & stream, st stream >> version; const DocumentType * docType = repo.getDocumentType(typestr); if (!docType) { - throw DocumentTypeNotFoundException(vespalib::string(typestr), VESPA_STRLOC); + throw DocumentTypeNotFoundException(std::string(typestr), VESPA_STRLOC); } return docType; } diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h index 634f0e59e156..44114e689ea7 100644 --- a/document/src/vespa/document/update/fieldpathupdate.h +++ b/document/src/vespa/document/update/fieldpathupdate.h @@ -39,8 +39,8 @@ class FieldPathUpdate return ! (*this == other); } - const vespalib::string& getOriginalFieldPath() const { return _originalFieldPath; } - const vespalib::string& getOriginalWhereClause() const { return _originalWhereClause; } + const std::string& getOriginalFieldPath() const { return _originalFieldPath; } + const std::string& getOriginalWhereClause() const { return _originalWhereClause; } /** * Check that a given field value is of the type inferred by @@ -78,8 +78,8 @@ class FieldPathUpdate virtual std::unique_ptr getIteratorHandler(Document& doc, const DocumentTypeRepo & repo) const = 0; FieldPathUpdateType _type; - vespalib::string _originalFieldPath; - vespalib::string _originalWhereClause; + std::string _originalFieldPath; + std::string _originalWhereClause; }; } diff --git a/document/src/vespa/document/update/tensor_add_update.cpp b/document/src/vespa/document/update/tensor_add_update.cpp index 2426db5ae446..bca905e615d6 100644 --- a/document/src/vespa/document/update/tensor_add_update.cpp +++ b/document/src/vespa/document/update/tensor_add_update.cpp @@ -90,7 +90,7 @@ TensorAddUpdate::applyTo(FieldValue& value) const tensorFieldValue = std::move(newTensor); } } else { - vespalib::string err = make_string("Unable to perform a tensor add update on a '%s' field value", + std::string err = make_string("Unable to perform a tensor add update on a '%s' field value", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } @@ -120,7 +120,7 @@ TensorAddUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &type, if (tensor->isA(FieldValue::Type::TENSOR)) { _tensor.reset(static_cast(tensor.release())); } else { - vespalib::string err = make_string("Expected tensor field value, got a '%s' field value", + std::string err = make_string("Expected tensor field value, got a '%s' field value", tensor->className()); throw IllegalStateException(err, VESPA_STRLOC); } diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp index 5eadd23c92da..b812c2e2f341 100644 --- a/document/src/vespa/document/update/tensor_modify_update.cpp +++ b/document/src/vespa/document/update/tensor_modify_update.cpp @@ -55,7 +55,7 @@ getJoinFunction(TensorModifyUpdate::Operation operation) } } -vespalib::string +std::string getJoinFunctionName(TensorModifyUpdate::Operation operation) { using Operation = TensorModifyUpdate::Operation; @@ -197,7 +197,7 @@ TensorModifyUpdate::applyTo(FieldValue& value) const tensorFieldValue = std::move(new_tensor); } } else { - vespalib::string err = make_string("Unable to perform a tensor modify update on a '%s' field value", + std::string err = make_string("Unable to perform a tensor modify update on a '%s' field value", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } @@ -234,7 +234,7 @@ verifyCellsTensorIsSparse(const vespalib::eval::Value *cellsTensor) if (cellsTensor->type().is_sparse()) { return; } - vespalib::string err = make_string("Expected cells tensor to be sparse, but has type '%s'", + std::string err = make_string("Expected cells tensor to be sparse, but has type '%s'", cellsTensor->type().to_spec().c_str()); throw IllegalStateException(err, VESPA_STRLOC); } @@ -277,7 +277,7 @@ TensorModifyUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &ty if (tensor->isA(FieldValue::Type::TENSOR)) { _tensor.reset(static_cast(tensor.release())); } else { - vespalib::string err = make_string("Expected tensor field value, got a '%s' field value", tensor->className()); + std::string err = make_string("Expected tensor field value, got a '%s' field value", tensor->className()); throw IllegalStateException(err, VESPA_STRLOC); } VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion()); diff --git a/document/src/vespa/document/update/tensor_partial_update.cpp b/document/src/vespa/document/update/tensor_partial_update.cpp index 87567cb3af07..3ba5f5044c8d 100644 --- a/document/src/vespa/document/update/tensor_partial_update.cpp +++ b/document/src/vespa/document/update/tensor_partial_update.cpp @@ -47,7 +47,7 @@ struct DenseCoords { ~DenseCoords(); void clear() { offset = 0; current = 0; } void convert_label(string_id label_id) { - vespalib::string label = SharedStringRepo::Handle::string_from_id(label_id); + std::string label = SharedStringRepo::Handle::string_from_id(label_id); uint32_t coord = 0; for (char c : label) { if (c < '0' || c > '9') { // bad char diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp index 230c451c81c2..35d139c43837 100644 --- a/document/src/vespa/document/update/tensor_remove_update.cpp +++ b/document/src/vespa/document/update/tensor_remove_update.cpp @@ -107,7 +107,7 @@ TensorRemoveUpdate::applyTo(FieldValue &value) const } } } else { - vespalib::string err = make_string("Unable to perform a tensor remove update on a '%s' field value", + std::string err = make_string("Unable to perform a tensor remove update on a '%s' field value", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } diff --git a/document/src/vespa/document/util/bufferexceptions.h b/document/src/vespa/document/util/bufferexceptions.h index 6fc8e570ecab..514e946aa482 100644 --- a/document/src/vespa/document/util/bufferexceptions.h +++ b/document/src/vespa/document/util/bufferexceptions.h @@ -7,10 +7,10 @@ namespace document { class BufferOutOfBoundsException : public vespalib::IoException { - static vespalib::string createMessage(size_t pos, size_t len); + static std::string createMessage(size_t pos, size_t len); public: BufferOutOfBoundsException(size_t pos, size_t len, - const vespalib::string& location = ""); + const std::string& location = ""); VESPA_DEFINE_EXCEPTION_SPINE(BufferOutOfBoundsException) }; diff --git a/document/src/vespa/document/util/bytebuffer.cpp b/document/src/vespa/document/util/bytebuffer.cpp index 3b67cc2f29a9..b2175c695e76 100644 --- a/document/src/vespa/document/util/bytebuffer.cpp +++ b/document/src/vespa/document/util/bytebuffer.cpp @@ -50,13 +50,13 @@ ByteBuffer::getDoubleLongNetwork(T &val) { VESPA_IMPLEMENT_EXCEPTION_SPINE(BufferOutOfBoundsException); -vespalib::string BufferOutOfBoundsException::createMessage(size_t pos, size_t len) { +std::string BufferOutOfBoundsException::createMessage(size_t pos, size_t len) { vespalib::asciistream ost; ost << pos << " > " << len; return ost.str(); } -BufferOutOfBoundsException::BufferOutOfBoundsException(size_t pos, size_t len, const vespalib::string& location) +BufferOutOfBoundsException::BufferOutOfBoundsException(size_t pos, size_t len, const std::string& location) : IoException(createMessage(pos, len), IoException::NO_SPACE, location, 1) { } diff --git a/document/src/vespa/document/util/serializableexceptions.cpp b/document/src/vespa/document/util/serializableexceptions.cpp index e2d21c424c69..70a92caa654a 100644 --- a/document/src/vespa/document/util/serializableexceptions.cpp +++ b/document/src/vespa/document/util/serializableexceptions.cpp @@ -6,14 +6,14 @@ namespace document { VESPA_IMPLEMENT_EXCEPTION_SPINE(DeserializeException); -DeserializeException::DeserializeException(const vespalib::string& msg, const vespalib::string& location) +DeserializeException::DeserializeException(const std::string& msg, const std::string& location) : IoException(msg, IoException::CORRUPT_DATA, location, 1) { } DeserializeException::DeserializeException( - const vespalib::string& msg, const vespalib::Exception& cause, - const vespalib::string& location) + const std::string& msg, const vespalib::Exception& cause, + const std::string& location) : IoException(msg, IoException::CORRUPT_DATA, cause, location, 1) { } diff --git a/document/src/vespa/document/util/serializableexceptions.h b/document/src/vespa/document/util/serializableexceptions.h index 7edcd8b1d20b..cbf2cb82a12d 100644 --- a/document/src/vespa/document/util/serializableexceptions.h +++ b/document/src/vespa/document/util/serializableexceptions.h @@ -18,9 +18,9 @@ namespace document { class DeserializeException : public vespalib::IoException { public: - DeserializeException(const vespalib::string& msg, const vespalib::string& location = ""); - DeserializeException(const vespalib::string& msg, const vespalib::Exception& cause, - const vespalib::string& location = ""); + DeserializeException(const std::string& msg, const std::string& location = ""); + DeserializeException(const std::string& msg, const vespalib::Exception& cause, + const std::string& location = ""); VESPA_DEFINE_EXCEPTION_SPINE(DeserializeException) }; diff --git a/document/src/vespa/document/util/stringutil.cpp b/document/src/vespa/document/util/stringutil.cpp index ff9c99586c08..9ddbbb63146f 100644 --- a/document/src/vespa/document/util/stringutil.cpp +++ b/document/src/vespa/document/util/stringutil.cpp @@ -87,8 +87,8 @@ ReplacementCharacters::ReplacementCharacters() static ReplacementCharacters _G_ForceInitialisation; -const vespalib::string & -StringUtil::escape(const vespalib::string & source, vespalib::string & destination, char delimiter) +const std::string & +StringUtil::escape(const std::string & source, std::string & destination, char delimiter) { size_t escapeCount(0); for (char c : source) { @@ -127,7 +127,7 @@ StringUtil::escape(const vespalib::string & source, vespalib::string & destinati return source; } -vespalib::string +std::string StringUtil::unescape(std::string_view source) { vespalib::asciistream ost; @@ -156,7 +156,7 @@ StringUtil::unescape(std::string_view source) throw IllegalArgumentException("Found \\x at end of input", VESPA_STRLOC); } - vespalib::string hexdigits(source.substr(i+2, 2)); + std::string hexdigits(source.substr(i+2, 2)); char* endp = nullptr; ost << static_cast(strtol(hexdigits.c_str(), &endp, 16)); if (*endp) { diff --git a/document/src/vespa/document/util/stringutil.h b/document/src/vespa/document/util/stringutil.h index 393ebf1f07fb..65efa88134a2 100644 --- a/document/src/vespa/document/util/stringutil.h +++ b/document/src/vespa/document/util/stringutil.h @@ -8,7 +8,7 @@ #pragma once -#include +#include namespace document { @@ -22,20 +22,20 @@ class StringUtil { * want the string to contain. (Useful to escape content to use in a context where you want * to use a given delimiter) */ - static vespalib::string escape(const vespalib::string & source, char delimiter = '\0') { - vespalib::string escaped; + static std::string escape(const std::string & source, char delimiter = '\0') { + std::string escaped; return escape(source, escaped, delimiter); } /** */ - static const vespalib::string & escape(const vespalib::string & source, vespalib::string & dst, + static const std::string & escape(const std::string & source, std::string & dst, char delimiter = '\0'); /** * Unescape a string, replacing \\\\ \\n \\t \\f \\r or \\x## with their * ascii value counterparts. */ - static vespalib::string unescape(std::string_view source); + static std::string unescape(std::string_view source); /** * Print whatever source points to in a readable format. diff --git a/documentapi/src/tests/messages/messages60test.cpp b/documentapi/src/tests/messages/messages60test.cpp index b8caf329d240..f5d9a2c539dc 100644 --- a/documentapi/src/tests/messages/messages60test.cpp +++ b/documentapi/src/tests/messages/messages60test.cpp @@ -201,7 +201,7 @@ TEST_F(Messages60Test, testRemoveLocationMessage) { TEST_F(Messages60Test, testGetDocumentMessage) { GetDocumentMessage tmp(document::DocumentId("id:ns:testdoc::"), "foo bar"); - EXPECT_EQ(152u + 2 *sizeof(vespalib::string), sizeof(GetDocumentMessage)); + EXPECT_EQ(152u + 2 *sizeof(std::string), sizeof(GetDocumentMessage)); EXPECT_EQ(MESSAGE_BASE_LENGTH + (size_t)31, serialize("GetDocumentMessage", tmp)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { @@ -263,7 +263,7 @@ TEST_F(Messages60Test, testPutDocumentMessage) { msg.setTimestamp(666); msg.setCondition(TestAndSetCondition("There's just one condition")); - EXPECT_EQ(sizeof(vespalib::string), sizeof(TestAndSetCondition)); + EXPECT_EQ(sizeof(std::string), sizeof(TestAndSetCondition)); EXPECT_EQ(112u, sizeof(DocumentMessage)); EXPECT_EQ(sizeof(TestAndSetCondition) + sizeof(DocumentMessage), sizeof(TestAndSetMessage)); EXPECT_EQ(sizeof(TestAndSetMessage) + 40, sizeof(PutDocumentMessage)); @@ -363,7 +363,7 @@ TEST_F(Messages60Test, testRemoveDocumentMessage) { msg.setCondition(TestAndSetCondition("There's just one condition")); - EXPECT_EQ(sizeof(TestAndSetMessage) + 48 + sizeof(vespalib::string), sizeof(RemoveDocumentMessage)); + EXPECT_EQ(sizeof(TestAndSetMessage) + 48 + sizeof(std::string), sizeof(RemoveDocumentMessage)); EXPECT_EQ(MESSAGE_BASE_LENGTH + size_t(20) + serializedLength(msg.getCondition().getSelection()), serialize("RemoveDocumentMessage", msg)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { diff --git a/documentapi/src/tests/messages/messages80test.cpp b/documentapi/src/tests/messages/messages80test.cpp index 73d5ce922fd1..678811c016b0 100644 --- a/documentapi/src/tests/messages/messages80test.cpp +++ b/documentapi/src/tests/messages/messages80test.cpp @@ -20,16 +20,16 @@ namespace documentapi { // This is not version-dependent TEST(MessagesTest, concrete_types_have_expected_sizes) { - EXPECT_EQ(sizeof(GetDocumentMessage), 152u + 2 *sizeof(vespalib::string)); + EXPECT_EQ(sizeof(GetDocumentMessage), 152u + 2 *sizeof(std::string)); EXPECT_EQ(sizeof(GetDocumentReply), 128u); - EXPECT_EQ(sizeof(TestAndSetCondition), sizeof(vespalib::string)); + EXPECT_EQ(sizeof(TestAndSetCondition), sizeof(std::string)); EXPECT_EQ(sizeof(DocumentMessage), 112u); EXPECT_EQ(sizeof(TestAndSetMessage), sizeof(TestAndSetCondition) + sizeof(DocumentMessage)); EXPECT_EQ(sizeof(PutDocumentMessage), sizeof(TestAndSetMessage) + 40); EXPECT_EQ(sizeof(WriteDocumentReply), 112u); EXPECT_EQ(sizeof(UpdateDocumentReply), 120u); EXPECT_EQ(sizeof(UpdateDocumentMessage), sizeof(TestAndSetMessage) + 40); - EXPECT_EQ(sizeof(RemoveDocumentMessage), sizeof(TestAndSetMessage) + 48 + sizeof(vespalib::string)); + EXPECT_EQ(sizeof(RemoveDocumentMessage), sizeof(TestAndSetMessage) + 48 + sizeof(std::string)); EXPECT_EQ(sizeof(RemoveDocumentReply), 120u); } diff --git a/documentapi/src/tests/policies/policies_test.cpp b/documentapi/src/tests/policies/policies_test.cpp index 385e1acee0bf..ec112dd5da00 100644 --- a/documentapi/src/tests/policies/policies_test.cpp +++ b/documentapi/src/tests/policies/policies_test.cpp @@ -597,7 +597,7 @@ TEST_F(PoliciesTest, test_document_route_selector_ignore) namespace { -vespalib::string +std::string createDocumentRouteSelectorConfigWithTwoRoutes() { return "[DocumentRouteSelector:raw:" diff --git a/documentapi/src/vespa/documentapi/common.h b/documentapi/src/vespa/documentapi/common.h index 886b8ce2fefd..b07cb2dc7a9d 100644 --- a/documentapi/src/vespa/documentapi/common.h +++ b/documentapi/src/vespa/documentapi/common.h @@ -1,12 +1,12 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace documentapi { // Decide the type of string used once -using string = vespalib::string; +using string = std::string; } // namespace mbus diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h index baf2d2a286ec..57df8a913343 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h @@ -3,14 +3,14 @@ #include "documentmessage.h" #include -#include +#include namespace documentapi { class GetBucketListMessage : public DocumentMessage { private: document::BucketId _bucketId; - vespalib::string _bucketSpace; + std::string _bucketSpace; protected: // Implements DocumentMessage. @@ -33,8 +33,8 @@ class GetBucketListMessage : public DocumentMessage { */ const document::BucketId &getBucketId() const { return _bucketId; } - const vespalib::string &getBucketSpace() const { return _bucketSpace; } - void setBucketSpace(const vespalib::string &value) { _bucketSpace = value; } + const std::string &getBucketSpace() const { return _bucketSpace; } + void setBucketSpace(const std::string &value) { _bucketSpace = value; } uint32_t getType() const override; string toString() const override { return "getbucketlistmessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h b/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h index ee7f03cad675..2221957c0dcc 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/testandsetcondition.h @@ -2,13 +2,13 @@ // @author Vegard Sjonfjell #pragma once -#include +#include namespace documentapi { class TestAndSetCondition { private: - vespalib::string _selection; + std::string _selection; public: TestAndSetCondition() @@ -25,7 +25,7 @@ class TestAndSetCondition { TestAndSetCondition(TestAndSetCondition &&) = default; TestAndSetCondition & operator=(TestAndSetCondition &&) = default; - const vespalib::string & getSelection() const { return _selection; } + const std::string & getSelection() const { return _selection; } bool isPresent() const noexcept { return !_selection.empty(); } bool operator==(const TestAndSetCondition& rhs) const noexcept { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/asyncinitializationpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/asyncinitializationpolicy.cpp index cd9fdbe02543..0ce404e79ff9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/asyncinitializationpolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/asyncinitializationpolicy.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace { VESPA_THREAD_STACK_TAG(async_init_policy); diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp index 1ff1126cd017..41b1665ade39 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp @@ -93,7 +93,7 @@ DocumentRouteSelectorPolicy::select(mbus::RoutingContext &context) } for (uint32_t i = 0; i < context.getNumRecipients(); ++i) { const mbus::Route &recipient = context.getRecipient(i); - vespalib::string routeName = recipient.toString(); + std::string routeName = recipient.toString(); if (select(context, routeName)) { const mbus::Route *route = context.getMessageBus().getRoutingTable(DocumentProtocol::NAME)->getRoute(routeName); context.addChild(route != nullptr ? *route : recipient); @@ -110,7 +110,7 @@ DocumentRouteSelectorPolicy::select(mbus::RoutingContext &context) } bool -DocumentRouteSelectorPolicy::select(mbus::RoutingContext &context, const vespalib::string &routeName) +DocumentRouteSelectorPolicy::select(mbus::RoutingContext &context, const std::string &routeName) { if (_config.empty()) { LOG(debug, "No config at all, select '%s'.", routeName.c_str()); diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h index f3b5d0fd35ad..cebaf6ab153e 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h @@ -50,7 +50,7 @@ class DocumentRouteSelectorPolicy : public mbus::IRoutingPolicy, * @param routeName The candidate route whose selector to run. * @return Whether or not to send to the given recipient. */ - bool select(mbus::RoutingContext &context, const vespalib::string &routeName); + bool select(mbus::RoutingContext &context, const std::string &routeName); public: /** diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp index d86eb987b501..1e06c0a67ab4 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp @@ -39,7 +39,7 @@ ExternPolicy::ExternPolicy(const string ¶m) : // Activate supervisor and register mirror. MirrorAPI::StringList spec; - vespalib::string lst = param.substr(0, pos); + std::string lst = param.substr(0, pos); vespalib::StringTokenizer slobrokList(lst, ","); for (auto slobrok : slobrokList) { spec.emplace_back(slobrok); diff --git a/documentapi/src/vespa/documentapi/messagebus/routable_factories_8.cpp b/documentapi/src/vespa/documentapi/messagebus/routable_factories_8.cpp index baf22112b9ac..a34607c83c55 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routable_factories_8.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routable_factories_8.cpp @@ -149,8 +149,8 @@ void log_codec_error(const char* op, const char* type, const char* msg) noexcept LOGBM(error, "Error during Protobuf %s for message type %s: %s", op, type, msg); } -[[noreturn]] void rethrow_as_decorated_exception(const char* type, const vespalib::string& msg) __attribute((noinline)); -[[noreturn]] void rethrow_as_decorated_exception(const char* type, const vespalib::string& msg) { +[[noreturn]] void rethrow_as_decorated_exception(const char* type, const std::string& msg) __attribute((noinline)); +[[noreturn]] void rethrow_as_decorated_exception(const char* type, const std::string& msg) { throw vespalib::IllegalArgumentException(vespalib::make_string("Failed decoding message of type %s: %s", type, msg.c_str()), VESPA_STRLOC); } @@ -406,7 +406,7 @@ RoutableFactories80::remove_location_message_factory(std::shared_ptr(factory, parser, string(get_raw_selection(src.selection()))); - msg->setBucketSpace(vespalib::string(get_bucket_space(src.bucket_space()))); + msg->setBucketSpace(std::string(get_bucket_space(src.bucket_space()))); return msg; } ); diff --git a/eval/src/apps/analyze_onnx_model/analyze_onnx_model.cpp b/eval/src/apps/analyze_onnx_model/analyze_onnx_model.cpp index d9cb23102ad2..92de4e854188 100644 --- a/eval/src/apps/analyze_onnx_model/analyze_onnx_model.cpp +++ b/eval/src/apps/analyze_onnx_model/analyze_onnx_model.cpp @@ -32,10 +32,10 @@ struct MyError : public std::exception { msg(m) {} const char * what() const noexcept override { return msg.c_str(); } - vespalib::string msg; + std::string msg; }; -bool read_line(FilePointer &file, vespalib::string &line) { +bool read_line(FilePointer &file, std::string &line) { char line_buffer[1024]; char *res = fgets(line_buffer, sizeof(line_buffer), file.fp()); if (res == nullptr) { @@ -49,7 +49,7 @@ bool read_line(FilePointer &file, vespalib::string &line) { return true; } -void extract(const vespalib::string &str, const vespalib::string &prefix, vespalib::string &dst) { +void extract(const std::string &str, const std::string &prefix, std::string &dst) { if (str.starts_with(prefix)) { size_t pos = prefix.size(); while ((str.size() > pos) && std::isspace(static_cast(str[pos]))) { @@ -66,9 +66,9 @@ struct MemoryUsage { }; #ifdef __linux__ -static const vespalib::string UNKNOWN = "unknown"; +static const std::string UNKNOWN = "unknown"; -size_t convert(const vespalib::string & s) { +size_t convert(const std::string & s) { if (s == UNKNOWN) return 0; size_t v(0); size_t end = s.find("kB"); @@ -76,18 +76,18 @@ size_t convert(const vespalib::string & s) { if (ec != std::errc()) { throw std::runtime_error(fmt("Bad format : '%s' at '%s'", s.c_str(), ptr)); } - if (end == vespalib::string::npos) { + if (end == std::string::npos) { throw std::runtime_error(fmt("Bad format : %s", s.c_str())); } return v * 1024; } MemoryUsage extract_memory_usage() { - vespalib::string vm_size = UNKNOWN; - vespalib::string vm_rss = UNKNOWN; + std::string vm_size = UNKNOWN; + std::string vm_rss = UNKNOWN; FilePointer file(fopen("/proc/self/status", "r")); if (file.valid()) { - vespalib::string line; + std::string line; while (read_line(file, line)) { extract(line, "VmSize:", vm_size); extract(line, "VmRSS:", vm_rss); @@ -121,7 +121,7 @@ MemoryUsage extract_memory_usage() { } #endif -void report_memory_usage(const vespalib::string &desc) { +void report_memory_usage(const std::string &desc) { MemoryUsage m = extract_memory_usage(); fprintf(stderr, "vm_size: %zu kB, vm_rss: %zu kB, malloc_peak: %zu kb, malloc_curr: %zu (%s)\n", m.vm_size/1_Ki, m.rss_size/1_Ki, m.malloc_peak/1_Ki, m.malloc_current/1_Ki, desc.c_str()); @@ -129,12 +129,12 @@ void report_memory_usage(const vespalib::string &desc) { struct Options { size_t pos = 0; - std::vector opt_list; - void add_option(const vespalib::string &opt) { + std::vector opt_list; + void add_option(const std::string &opt) { opt_list.push_back(opt); } - vespalib::string get_option(const vespalib::string &desc, const vespalib::string &fallback) { - vespalib::string opt; + std::string get_option(const std::string &desc, const std::string &fallback) { + std::string opt; if (pos < opt_list.size()) { opt = opt_list[pos]; fprintf(stderr, "option[%zu](%s): %s\n", @@ -147,12 +147,12 @@ struct Options { ++pos; return opt; } - bool get_bool_opt(const vespalib::string &desc, const vespalib::string &fallback) { + bool get_bool_opt(const std::string &desc, const std::string &fallback) { auto opt = get_option(desc, fallback); REQUIRE((opt == "true") || (opt == "false")); return (opt == "true"); } - size_t get_size_opt(const vespalib::string &desc, const vespalib::string &fallback) { + size_t get_size_opt(const std::string &desc, const std::string &fallback) { auto opt = get_option(desc, fallback); size_t value = atoi(opt.c_str()); REQUIRE(value > 0); @@ -184,7 +184,7 @@ void dump_wire_info(const Onnx::WireInfo &wire) { struct MakeInputType { Options &opts; - std::map symbolic_sizes; + std::map symbolic_sizes; explicit MakeInputType(Options &opts_in) : opts(opts_in), symbolic_sizes() {} ValueType operator()(const Onnx::TensorInfo &info) { int d = 0; @@ -210,8 +210,8 @@ struct MakeInputType { } }; -vespalib::string make_bound_str(const std::map &bound) { - vespalib::string result; +std::string make_bound_str(const std::map &bound) { + std::string result; if (!bound.empty()) { for (const auto &[name, size]: bound) { if (result.empty()) { @@ -332,7 +332,7 @@ int my_main(int argc, char **argv) { if (argc < 2) { return usage(argv[0]); } - if ((argc == 2) && (vespalib::string(argv[1]) == "--probe-types")) { + if ((argc == 2) && (std::string(argv[1]) == "--probe-types")) { return probe_types(); } Options opts; diff --git a/eval/src/apps/eval_expr/eval_expr.cpp b/eval/src/apps/eval_expr/eval_expr.cpp index cc88ad3f5ba0..6559c03b5851 100644 --- a/eval/src/apps/eval_expr/eval_expr.cpp +++ b/eval/src/apps/eval_expr/eval_expr.cpp @@ -90,12 +90,12 @@ int overflow(int cnt, int max) { class Context { private: - std::vector _param_names; + std::vector _param_names; std::vector _param_types; std::vector _param_values; std::vector _param_refs; bool _verbose; - vespalib::string _error; + std::string _error; CTFMetaData _meta; CostProfile _cost; @@ -113,10 +113,10 @@ class Context bool verbose() const { return _verbose; } size_t size() const { return _param_names.size(); } - const vespalib::string &name(size_t idx) const { return _param_names[idx]; } + const std::string &name(size_t idx) const { return _param_names[idx]; } const ValueType &type(size_t idx) const { return _param_types[idx]; } - Value::UP eval(const vespalib::string &expr) { + Value::UP eval(const std::string &expr) { clear_state(); SimpleObjectParams params(_param_refs); auto fun = Function::parse(_param_names, expr, FeatureNameExtractor()); @@ -152,11 +152,11 @@ class Context return result; } - const vespalib::string &error() const { return _error; } + const std::string &error() const { return _error; } const CTFMetaData &meta() const { return _meta; } const CostProfile &cost() const { return _cost; } - void save(const vespalib::string &name, Value::UP value) { + void save(const std::string &name, Value::UP value) { REQUIRE(value); for (size_t i = 0; i < _param_names.size(); ++i) { if (_param_names[i] == name) { @@ -172,7 +172,7 @@ class Context _param_refs.emplace_back(*_param_values.back()); } - bool remove(const vespalib::string &name) { + bool remove(const std::string &name) { for (size_t i = 0; i < _param_names.size(); ++i) { if (_param_names[i] == name) { _param_names.erase(_param_names.begin() + i); @@ -187,11 +187,11 @@ class Context }; Context::~Context() = default; -void print_error(const vespalib::string &error) { +void print_error(const std::string &error) { fprintf(stderr, "error: %s\n", error.c_str()); } -void print_value(const Value &value, const vespalib::string &name, const CTFMetaData &meta, const CostProfile &cost) { +void print_value(const Value &value, const std::string &name, const CTFMetaData &meta, const CostProfile &cost) { bool with_name = !name.empty(); bool with_meta = !meta.steps.empty(); auto spec = spec_from_value(value); @@ -220,8 +220,8 @@ void print_value(const Value &value, const vespalib::string &name, const CTFMeta } void handle_message(Context &ctx, const Inspector &req, Cursor &reply) { - vespalib::string expr = req["expr"].asString().make_string(); - vespalib::string name = req["name"].asString().make_string(); + std::string expr = req["expr"].asString().make_string(); + std::string name = req["name"].asString().make_string(); ctx.verbose(req["verbose"].asBool()); if (expr.empty()) { reply.setString("error", "missing expression (field name: 'expr')"); @@ -246,7 +246,7 @@ void handle_message(Context &ctx, const Inspector &req, Cursor &reply) { } } -bool is_only_whitespace(const vespalib::string &str) { +bool is_only_whitespace(const std::string &str) { for (auto c : str) { if (!std::isspace(static_cast(c))) { return false; @@ -259,7 +259,7 @@ struct EditLineWrapper { EditLine *my_el; History *my_hist; HistEvent ignore; - static vespalib::string prompt; + static std::string prompt; static char *prompt_fun(EditLine *) { return &prompt[0]; } EditLineWrapper() : my_el(el_init("vespa-eval-expr", stdin, stdout, stderr)), @@ -272,7 +272,7 @@ struct EditLineWrapper { el_set(my_el, EL_HIST, history, my_hist); } ~EditLineWrapper(); - bool read_line(vespalib::string &line_out) { + bool read_line(std::string &line_out) { do { int line_len = 0; const char *line = el_gets(my_el, &line_len); @@ -294,18 +294,18 @@ EditLineWrapper::~EditLineWrapper() history_end(my_hist); el_end(my_el); } -vespalib::string EditLineWrapper::prompt("> "); +std::string EditLineWrapper::prompt("> "); -const vespalib::string exit_cmd("exit"); -const vespalib::string help_cmd("help"); -const vespalib::string list_cmd("list"); -const vespalib::string verbose_cmd("verbose "); -const vespalib::string def_cmd("def "); -const vespalib::string undef_cmd("undef "); +const std::string exit_cmd("exit"); +const std::string help_cmd("help"); +const std::string list_cmd("list"); +const std::string verbose_cmd("verbose "); +const std::string def_cmd("def "); +const std::string undef_cmd("undef "); int interactive_mode(Context &ctx) { EditLineWrapper input; - vespalib::string line; + std::string line; while (input.read_line(line)) { if (line == exit_cmd) { return 0; @@ -332,7 +332,7 @@ int interactive_mode(Context &ctx) { } continue; } - vespalib::string name; + std::string name; if (line.find(undef_cmd) == 0) { name = line.substr(undef_cmd.size()); if (ctx.remove(name)) { @@ -342,7 +342,7 @@ int interactive_mode(Context &ctx) { } continue; } - vespalib::string expr; + std::string expr; if (line.find(def_cmd) == 0) { auto name_size = (line.find(" ", def_cmd.size()) - def_cmd.size()); name = line.substr(def_cmd.size(), name_size); @@ -395,7 +395,7 @@ int json_repl_mode(Context &ctx) { } int main(int argc, char **argv) { - bool verbose = ((argc > 1) && (vespalib::string(argv[1]) == "--verbose")); + bool verbose = ((argc > 1) && (std::string(argv[1]) == "--verbose")); int expr_idx = verbose ? 2 : 1; int expr_cnt = (argc - expr_idx); int expr_max = ('z' - 'a') + 1; @@ -406,15 +406,15 @@ int main(int argc, char **argv) { return overflow(expr_cnt, expr_max); } Context ctx; - if ((expr_cnt == 1) && (vespalib::string(argv[expr_idx]) == "interactive")) { + if ((expr_cnt == 1) && (std::string(argv[expr_idx]) == "interactive")) { setlocale(LC_ALL, ""); return interactive_mode(ctx); } - if ((expr_cnt == 1) && (vespalib::string(argv[expr_idx]) == "json-repl")) { + if ((expr_cnt == 1) && (std::string(argv[expr_idx]) == "json-repl")) { return json_repl_mode(ctx); } ctx.verbose(verbose); - vespalib::string name("a"); + std::string name("a"); for (int i = expr_idx; i < argc; ++i) { if (auto value = ctx.eval(argv[i])) { if (expr_cnt > 1) { @@ -422,7 +422,7 @@ int main(int argc, char **argv) { ctx.save(name, std::move(value)); ++name[0]; } else { - vespalib::string no_name; + std::string no_name; print_value(*value, no_name, ctx.meta(), ctx.cost()); } } else { diff --git a/eval/src/apps/make_tensor_binary_format_test_spec/make_tensor_binary_format_test_spec.cpp b/eval/src/apps/make_tensor_binary_format_test_spec/make_tensor_binary_format_test_spec.cpp index d3ce9e7cc03e..071a5be9c196 100644 --- a/eval/src/apps/make_tensor_binary_format_test_spec/make_tensor_binary_format_test_spec.cpp +++ b/eval/src/apps/make_tensor_binary_format_test_spec/make_tensor_binary_format_test_spec.cpp @@ -15,7 +15,7 @@ using namespace vespalib::eval; using namespace vespalib::slime::convenience; using Options = std::initializer_list>; -using Dict = std::vector; +using Dict = std::vector; //----------------------------------------------------------------------------- @@ -130,7 +130,7 @@ const std::map val_map{ {"bar", 2.0}}; double val(size_t idx) { return double(idx + 1); } -double val(const vespalib::string &label) { +double val(const std::string &label) { auto res = val_map.find(label); if (res == val_map.end()) { fprintf(stderr, "unsupported label: '%s'\n", label.c_str()); @@ -249,7 +249,7 @@ void make_map_test(Cursor &test, const Dict &x_dict_in) { TensorSpec spec(vespalib::make_string("tensor%s(x{})", cell_type_str())); nbostream sparse = sparse_base; nbostream mixed = mixed_base; - for (vespalib::string x: x_dict) { + for (std::string x: x_dict) { double value = val(x); spec.add({{"x", x}}, value); sparse.writeSmallString(x); @@ -269,7 +269,7 @@ void make_map_test(Cursor &test, const Dict &x_dict_in) { } template -void make_mesh_test(Cursor &test, const Dict &x_dict_in, const vespalib::string &y) { +void make_mesh_test(Cursor &test, const Dict &x_dict_in, const std::string &y) { for (bool with_cell_type: with_cell_type_opts()) { nbostream sparse_base = make_sparse(with_cell_type); sparse_base.putInt1_4Bytes(2); @@ -287,7 +287,7 @@ void make_mesh_test(Cursor &test, const Dict &x_dict_in, const vespalib::string TensorSpec spec(vespalib::make_string("tensor%s(x{},y{})", cell_type_str())); nbostream sparse = sparse_base; nbostream mixed = mixed_base; - for (vespalib::string x: x_dict) { + for (std::string x: x_dict) { double value = mix({val(x), val(y)}); spec.add({{"x", x}, {"y", y}}, value); sparse.writeSmallString(x); @@ -312,8 +312,8 @@ void make_mesh_test(Cursor &test, const Dict &x_dict_in, const vespalib::string template void make_vector_map_test(Cursor &test, - const vespalib::string &mapped_name, const Dict &mapped_dict, - const vespalib::string &indexed_name, size_t indexed_size) + const std::string &mapped_name, const Dict &mapped_dict, + const std::string &indexed_name, size_t indexed_size) { for (bool with_cell_type: with_cell_type_opts()) { auto type_str = vespalib::make_string("tensor%s(%s{},%s[%zu])", cell_type_str(), @@ -330,7 +330,7 @@ void make_vector_map_test(Cursor &test, for (const Dict &dict: mapped_perm) { TensorSpec spec(type.to_spec()); // ensures type string is normalized nbostream mixed = mixed_base; - for (vespalib::string label: dict) { + for (std::string label: dict) { mixed.writeSmallString(label); for (size_t idx = 0; idx < indexed_size; ++idx) { double value = mix({val(label), val(idx)}); diff --git a/eval/src/apps/tensor_conformance/generate.cpp b/eval/src/apps/tensor_conformance/generate.cpp index 1c68a94a8529..c9feb700e864 100644 --- a/eval/src/apps/tensor_conformance/generate.cpp +++ b/eval/src/apps/tensor_conformance/generate.cpp @@ -17,9 +17,9 @@ namespace { struct IgnoreJava : TestBuilder { TestBuilder &dst; IgnoreJava(TestBuilder &dst_in) : TestBuilder(dst_in.full), dst(dst_in) {} - void add(const vespalib::string &expression, - const std::map &inputs, - const std::set &ignore) override + void add(const std::string &expression, + const std::map &inputs, + const std::set &ignore) override { auto my_ignore = ignore; my_ignore.insert("vespajlib"); @@ -29,14 +29,14 @@ struct IgnoreJava : TestBuilder { //----------------------------------------------------------------------------- -const std::vector basic_layouts = { +const std::vector basic_layouts = { "", "a3", "a3c5", "a3c5e7", "b2_1", "b2_1d3_1", "b2_1d3_1f4_1", "a3b2_1c5d3_1", "b2_1c5d3_1e7" }; -const std::vector> join_layouts = { +const std::vector> join_layouts = { {"", ""}, {"", "a3"}, {"", "b2_1"}, @@ -52,7 +52,7 @@ const std::vector> join_layouts = { {"a3b4_1c5", "b2_1c5d3_1"} }; -const std::vector> merge_layouts = { +const std::vector> merge_layouts = { {"", ""}, {"a3c5e7", "a3c5e7"}, {"b15_2", "b10_3"}, @@ -60,11 +60,11 @@ const std::vector> merge_layouts = {"a3b6_2c1d4_3e2f6_2", "a3b4_3c1d6_2e2f4_3"}, }; -const std::vector concat_c_layouts_a = { +const std::vector concat_c_layouts_a = { "", "c3", "a3", "b6_2", "a3b6_2", "a3b6_2c3" }; -const std::vector concat_c_layouts_b = { +const std::vector concat_c_layouts_b = { "", "c5", "a3", "b4_3", "a3b4_3", "a3b4_3c5" }; @@ -92,14 +92,14 @@ Sequence my_seq(double x0, double delta, size_t n) { //----------------------------------------------------------------------------- -void generate(const vespalib::string &expr, const GenSpec &a, TestBuilder &dst) { +void generate(const std::string &expr, const GenSpec &a, TestBuilder &dst) { auto a_cell_types = a.dims().empty() ? just_double : dst.full ? all_types : just_float; for (auto a_ct: a_cell_types) { dst.add(expr, {{"a", a.cpy().cells(a_ct)}}); } } -void generate(const vespalib::string &expr, const GenSpec &a, const GenSpec &b, TestBuilder &dst) { +void generate(const std::string &expr, const GenSpec &a, const GenSpec &b, TestBuilder &dst) { auto a_cell_types = a.dims().empty() ? just_double : dst.full ? all_types : just_float; auto b_cell_types = b.dims().empty() ? just_double : dst.full ? all_types : just_float; for (auto a_ct: a_cell_types) { @@ -161,20 +161,20 @@ void generate_reduce(Aggr aggr, const Sequence &seq, TestBuilder &dst) { for (const auto &layout: basic_layouts) { GenSpec a = GenSpec::from_desc(layout).seq(seq); for (const auto &dim: a.dims()) { - vespalib::string expr = fmt("reduce(a,%s,%s)", + std::string expr = fmt("reduce(a,%s,%s)", AggrNames::name_of(aggr)->c_str(), dim.name().c_str()); generate(expr, a, dst); } if (a.dims().size() > 1) { - vespalib::string expr = fmt("reduce(a,%s,%s,%s)", + std::string expr = fmt("reduce(a,%s,%s,%s)", AggrNames::name_of(aggr)->c_str(), a.dims().back().name().c_str(), a.dims().front().name().c_str()); generate(expr, a, dst); } { - vespalib::string expr = fmt("reduce(a,%s)", + std::string expr = fmt("reduce(a,%s)", AggrNames::name_of(aggr)->c_str()); generate(expr, a, dst); } @@ -193,14 +193,14 @@ void generate_reduce(TestBuilder &dst) { //----------------------------------------------------------------------------- -void generate_map_expr(const vespalib::string &expr, const Sequence &seq, TestBuilder &dst) { +void generate_map_expr(const std::string &expr, const Sequence &seq, TestBuilder &dst) { for (const auto &layout: basic_layouts) { GenSpec a = GenSpec::from_desc(layout).seq(seq); generate(expr, a, dst); } } -void generate_op1_map(const vespalib::string &op1_expr, const Sequence &seq, TestBuilder &dst) { +void generate_op1_map(const std::string &op1_expr, const Sequence &seq, TestBuilder &dst) { generate_map_expr(op1_expr, seq, dst); generate_map_expr(fmt("map(a,f(a)(%s))", op1_expr.c_str()), seq, dst); } @@ -242,10 +242,10 @@ void generate_map_subspaces(TestBuilder &dst) { auto sparse = GenSpec().from_desc("x8_1").seq(my_seq); auto mixed = GenSpec().from_desc("x4_1y4").seq(my_seq); auto dense = GenSpec().from_desc("y4").seq(my_seq); - vespalib::string map_a("map_subspaces(a,f(a)(a*3+2))"); - vespalib::string unpack_a("map_subspaces(a,f(a)(tensor(y[8])(bit(a,7-y%8))))"); - vespalib::string unpack_y4("map_subspaces(a,f(a)(tensor(y[32])(bit(a{y:(y/8)},7-y%8))))"); - vespalib::string pack_y4("map_subspaces(a,f(a)(a{y:0}+a{y:1}-a{y:2}+a{y:3}))"); + std::string map_a("map_subspaces(a,f(a)(a*3+2))"); + std::string unpack_a("map_subspaces(a,f(a)(tensor(y[8])(bit(a,7-y%8))))"); + std::string unpack_y4("map_subspaces(a,f(a)(tensor(y[32])(bit(a{y:(y/8)},7-y%8))))"); + std::string pack_y4("map_subspaces(a,f(a)(a{y:0}+a{y:1}-a{y:2}+a{y:3}))"); generate(map_a, scalar, dst); generate(map_a, sparse, dst); generate(unpack_a, scalar, dst); @@ -258,7 +258,7 @@ void generate_map_subspaces(TestBuilder &dst) { //----------------------------------------------------------------------------- -void generate_join_expr(const vespalib::string &expr, const Sequence &seq, TestBuilder &dst) { +void generate_join_expr(const std::string &expr, const Sequence &seq, TestBuilder &dst) { for (const auto &layouts: join_layouts) { GenSpec a = GenSpec::from_desc(layouts.first).seq(seq); GenSpec b = GenSpec::from_desc(layouts.second).seq(skew(seq)); @@ -267,7 +267,7 @@ void generate_join_expr(const vespalib::string &expr, const Sequence &seq, TestB } } -void generate_join_expr(const vespalib::string &expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { +void generate_join_expr(const std::string &expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { for (const auto &layouts: join_layouts) { GenSpec a = GenSpec::from_desc(layouts.first).seq(seq_a); GenSpec b = GenSpec::from_desc(layouts.second).seq(seq_b); @@ -275,12 +275,12 @@ void generate_join_expr(const vespalib::string &expr, const Sequence &seq_a, con } } -void generate_op2_join(const vespalib::string &op2_expr, const Sequence &seq, TestBuilder &dst) { +void generate_op2_join(const std::string &op2_expr, const Sequence &seq, TestBuilder &dst) { generate_join_expr(op2_expr, seq, dst); generate_join_expr(fmt("join(a,b,f(a,b)(%s))", op2_expr.c_str()), seq, dst); } -void generate_op2_join(const vespalib::string &op2_expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { +void generate_op2_join(const std::string &op2_expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { generate_join_expr(op2_expr, seq_a, seq_b, dst); generate_join_expr(fmt("join(a,b,f(a,b)(%s))", op2_expr.c_str()), seq_a, seq_b, dst); } @@ -319,7 +319,7 @@ void generate_join(TestBuilder &dst) { //----------------------------------------------------------------------------- -void generate_merge_expr(const vespalib::string &expr, const Sequence &seq, TestBuilder &dst) { +void generate_merge_expr(const std::string &expr, const Sequence &seq, TestBuilder &dst) { for (const auto &layouts: merge_layouts) { GenSpec a = GenSpec::from_desc(layouts.first).seq(seq); GenSpec b = GenSpec::from_desc(layouts.second).seq(skew(seq)); @@ -328,7 +328,7 @@ void generate_merge_expr(const vespalib::string &expr, const Sequence &seq, Test } } -void generate_merge_expr(const vespalib::string &expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { +void generate_merge_expr(const std::string &expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { for (const auto &layouts: merge_layouts) { GenSpec a = GenSpec::from_desc(layouts.first).seq(seq_a); GenSpec b = GenSpec::from_desc(layouts.second).seq(seq_b); @@ -336,12 +336,12 @@ void generate_merge_expr(const vespalib::string &expr, const Sequence &seq_a, co } } -void generate_op2_merge(const vespalib::string &op2_expr, const Sequence &seq, TestBuilder &dst) { +void generate_op2_merge(const std::string &op2_expr, const Sequence &seq, TestBuilder &dst) { generate_merge_expr(op2_expr, seq, dst); generate_merge_expr(fmt("merge(a,b,f(a,b)(%s))", op2_expr.c_str()), seq, dst); } -void generate_op2_merge(const vespalib::string &op2_expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { +void generate_op2_merge(const std::string &op2_expr, const Sequence &seq_a, const Sequence &seq_b, TestBuilder &dst) { generate_merge_expr(op2_expr, seq_a, seq_b, dst); generate_merge_expr(fmt("merge(a,b,f(a,b)(%s))", op2_expr.c_str()), seq_a, seq_b, dst); } @@ -457,7 +457,7 @@ void generate_rename(TestBuilder &dst) { //----------------------------------------------------------------------------- void generate_if(TestBuilder &dst) { - vespalib::string expr = "if(a,b,c)"; + std::string expr = "if(a,b,c)"; for (const auto &layout: basic_layouts) { GenSpec b = GenSpec::from_desc(layout).seq(N()); GenSpec c = GenSpec::from_desc(layout).seq(skew(N())); @@ -558,9 +558,9 @@ void generate_nan_existence(TestBuilder &dst) { auto mixed1 = GenSpec().from_desc("x4_1y4").seq(seq1); auto mixed2 = GenSpec().from_desc("x4_2y4").seq(seq2); // try to provoke differences between nan and non-existence - const vespalib::string inner_expr = "f(x,y)(if(isNan(x),11,x)+if(isNan(y),22,y))"; - vespalib::string merge_expr = fmt("merge(a,b,%s)", inner_expr.c_str()); - vespalib::string join_expr = fmt("join(a,b,%s)", inner_expr.c_str()); + const std::string inner_expr = "f(x,y)(if(isNan(x),11,x)+if(isNan(y),22,y))"; + std::string merge_expr = fmt("merge(a,b,%s)", inner_expr.c_str()); + std::string join_expr = fmt("join(a,b,%s)", inner_expr.c_str()); dst.add(merge_expr, {{"a", sparse1}, {"b", sparse2}}); dst.add(merge_expr, {{"a", mixed1}, {"b", mixed2}}); dst.add(join_expr, {{"a", sparse1}, {"b", sparse2}}); diff --git a/eval/src/apps/tensor_conformance/generate.h b/eval/src/apps/tensor_conformance/generate.h index b0f20ac4471e..22a46a157a81 100644 --- a/eval/src/apps/tensor_conformance/generate.h +++ b/eval/src/apps/tensor_conformance/generate.h @@ -10,11 +10,11 @@ struct TestBuilder { bool full; TestBuilder(bool full_in) : full(full_in) {} using TensorSpec = vespalib::eval::TensorSpec; - virtual void add(const vespalib::string &expression, - const std::map &inputs, - const std::set &ignore) = 0; - void add(const vespalib::string &expression, - const std::map &inputs) + virtual void add(const std::string &expression, + const std::map &inputs, + const std::set &ignore) = 0; + void add(const std::string &expression, + const std::map &inputs) { add(expression, inputs, {}); } diff --git a/eval/src/apps/tensor_conformance/tensor_conformance.cpp b/eval/src/apps/tensor_conformance/tensor_conformance.cpp index 3e2d1e844b60..5492d4ade998 100644 --- a/eval/src/apps/tensor_conformance/tensor_conformance.cpp +++ b/eval/src/apps/tensor_conformance/tensor_conformance.cpp @@ -79,7 +79,7 @@ nbostream extract_data(const Inspector &value) { //----------------------------------------------------------------------------- -void insert_value(Cursor &cursor, const vespalib::string &name, const TensorSpec &spec) { +void insert_value(Cursor &cursor, const std::string &name, const TensorSpec &spec) { nbostream data; Value::UP value = value_from_spec(spec, simple_factory); encode_value(*value, data); @@ -93,9 +93,9 @@ TensorSpec extract_value(const Inspector &inspector) { //----------------------------------------------------------------------------- -std::vector extract_fields(const Inspector &object) { +std::vector extract_fields(const Inspector &object) { struct FieldExtractor : slime::ObjectTraverser { - std::vector result; + std::vector result; void field(const Memory &symbol, const Inspector &) override { result.push_back(symbol.make_string()); } @@ -185,9 +185,9 @@ class MyTestBuilder : public TestBuilder { TestWriter _writer; public: MyTestBuilder(bool full_in, Output &out) : TestBuilder(full_in), _writer(out) {} - void add(const vespalib::string &expression, - const std::map &inputs_in, - const std::set &ignore_in) override + void add(const std::string &expression, + const std::map &inputs_in, + const std::set &ignore_in) override { Cursor &test = _writer.create(); test.setString("expression", expression); @@ -242,7 +242,7 @@ void evaluate(Input &in, Output &out) { //----------------------------------------------------------------------------- void verify(Input &in, Output &out) { - std::map result_map; + std::map result_map; auto handle_test = [&result_map](Slime &slime) { TensorSpec reference_result = ref_eval(slime.get()); for (const auto &result: extract_fields(slime["result"])) { @@ -315,7 +315,7 @@ int main(int argc, char **argv) { if (argc < 2) { return usage(argv[0]); } - vespalib::string mode = argv[1]; + std::string mode = argv[1]; if (mode == "generate") { generate(std_out, true); } else if (mode == "generate-some") { diff --git a/eval/src/tests/apps/analyze_onnx_model/analyze_onnx_model_test.cpp b/eval/src/tests/apps/analyze_onnx_model/analyze_onnx_model_test.cpp index 701eca4516da..8cee43b5ed51 100644 --- a/eval/src/tests/apps/analyze_onnx_model/analyze_onnx_model_test.cpp +++ b/eval/src/tests/apps/analyze_onnx_model/analyze_onnx_model_test.cpp @@ -7,18 +7,18 @@ using namespace vespalib; using namespace vespalib::eval::test; -vespalib::string module_build_path("../../../../"); -vespalib::string binary = module_build_path + "src/apps/analyze_onnx_model/vespa-analyze-onnx-model"; -vespalib::string probe_cmd = binary + " --probe-types"; +std::string module_build_path("../../../../"); +std::string binary = module_build_path + "src/apps/analyze_onnx_model/vespa-analyze-onnx-model"; +std::string probe_cmd = binary + " --probe-types"; -vespalib::string get_source_dir() { +std::string get_source_dir() { const char *dir = getenv("SOURCE_DIRECTORY"); return (dir ? dir : "."); } -vespalib::string source_dir = get_source_dir(); -vespalib::string probe_model = source_dir + "/../../tensor/onnx_wrapper/probe_model.onnx"; -vespalib::string simple_model = source_dir + "/../../tensor/onnx_wrapper/simple.onnx"; -vespalib::string dynamic_model = source_dir + "/../../tensor/onnx_wrapper/dynamic.onnx"; +std::string source_dir = get_source_dir(); +std::string probe_model = source_dir + "/../../tensor/onnx_wrapper/probe_model.onnx"; +std::string simple_model = source_dir + "/../../tensor/onnx_wrapper/simple.onnx"; +std::string dynamic_model = source_dir + "/../../tensor/onnx_wrapper/dynamic.onnx"; //----------------------------------------------------------------------------- @@ -31,9 +31,9 @@ TEST_F("require that output types can be probed", ServerCmd(probe_cmd)) { params["inputs"].setString("in2", "tensor(x[2],y[3])"); Slime result = f1.invoke(params); EXPECT_EQUAL(result["outputs"].fields(), 3u); - EXPECT_EQUAL(result["outputs"]["out1"].asString().make_string(), vespalib::string("tensor(d0[2],d1[3])")); - EXPECT_EQUAL(result["outputs"]["out2"].asString().make_string(), vespalib::string("tensor(d0[2],d1[3])")); - EXPECT_EQUAL(result["outputs"]["out3"].asString().make_string(), vespalib::string("tensor(d0[2],d1[3])")); + EXPECT_EQUAL(result["outputs"]["out1"].asString().make_string(), std::string("tensor(d0[2],d1[3])")); + EXPECT_EQUAL(result["outputs"]["out2"].asString().make_string(), std::string("tensor(d0[2],d1[3])")); + EXPECT_EQUAL(result["outputs"]["out3"].asString().make_string(), std::string("tensor(d0[2],d1[3])")); EXPECT_EQUAL(f1.shutdown(), 0); } diff --git a/eval/src/tests/apps/eval_expr/eval_expr_test.cpp b/eval/src/tests/apps/eval_expr/eval_expr_test.cpp index e2986e3ae6b3..334ae60815a6 100644 --- a/eval/src/tests/apps/eval_expr/eval_expr_test.cpp +++ b/eval/src/tests/apps/eval_expr/eval_expr_test.cpp @@ -16,16 +16,16 @@ using vespalib::make_string_short::fmt; using vespalib::slime::JsonFormat; using vespalib::slime::Inspector; -vespalib::string module_build_path("../../../../"); -vespalib::string binary = module_build_path + "src/apps/eval_expr/vespa-eval-expr"; -vespalib::string server_cmd = binary + " json-repl"; +std::string module_build_path("../../../../"); +std::string binary = module_build_path + "src/apps/eval_expr/vespa-eval-expr"; +std::string server_cmd = binary + " json-repl"; //----------------------------------------------------------------------------- struct Result { - vespalib::string error; - vespalib::string result; - std::vector> steps; + std::string error; + std::string result; + std::vector> steps; Result(const Inspector &obj) : error(obj["error"].asString().make_string()), @@ -38,11 +38,11 @@ struct Result { arr[i]["symbol"].asString().make_string()); } } - void verify_result(const vespalib::string &expect) { + void verify_result(const std::string &expect) { EXPECT_EQUAL(error, ""); EXPECT_EQUAL(result, expect); } - void verify_error(const vespalib::string &expect) { + void verify_error(const std::string &expect) { EXPECT_EQUAL(steps.size(), 0u); EXPECT_EQUAL(result, ""); fprintf(stderr, "... does error '%s' contain message '%s'?\n", @@ -56,7 +56,7 @@ Result::~Result() = default; struct Server : public ServerCmd { TimeBomb time_bomb; Server() : ServerCmd(server_cmd), time_bomb(60) {} - Result eval(const vespalib::string &expr, const vespalib::string &name = {}, bool verbose = false) { + Result eval(const std::string &expr, const std::string &name = {}, bool verbose = false) { Slime req; auto &obj = req.setObject(); obj.setString("expr", expr.c_str()); diff --git a/eval/src/tests/eval/compile_cache/compile_cache_test.cpp b/eval/src/tests/eval/compile_cache/compile_cache_test.cpp index b596a91770be..b8abe3d7cee8 100644 --- a/eval/src/tests/eval/compile_cache/compile_cache_test.cpp +++ b/eval/src/tests/eval/compile_cache/compile_cache_test.cpp @@ -78,15 +78,15 @@ TEST("require that different strings give different function keys") { struct CheckKeys : test::EvalSpec::EvalTest { bool failed = false; - std::set seen_keys; + std::set seen_keys; ~CheckKeys() override; - bool check_key(const vespalib::string &key) { + bool check_key(const std::string &key) { bool seen = (seen_keys.count(key) > 0); seen_keys.insert(key); return seen; } - virtual void next_expression(const std::vector ¶m_names, - const vespalib::string &expression) override + virtual void next_expression(const std::vector ¶m_names, + const std::string &expression) override { auto function = Function::parse(param_names, expression); if (!CompiledFunction::detect_issues(*function)) { @@ -99,9 +99,9 @@ struct CheckKeys : test::EvalSpec::EvalTest { } } } - virtual void handle_case(const std::vector &, + virtual void handle_case(const std::vector &, const std::vector &, - const vespalib::string &, + const std::string &, double) override {} }; @@ -252,11 +252,11 @@ struct CompileCheck : test::EvalSpec::EvalTest { ~Entry(); }; std::vector list; - void next_expression(const std::vector &, - const vespalib::string &) override {} - void handle_case(const std::vector ¶m_names, + void next_expression(const std::vector &, + const std::string &) override {} + void handle_case(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression, + const std::string &expression, double expected_result) override { auto function = Function::parse(param_names, expression); diff --git a/eval/src/tests/eval/compiled_function/compiled_function_test.cpp b/eval/src/tests/eval/compiled_function/compiled_function_test.cpp index efad34f755cc..1f5d026eaf39 100644 --- a/eval/src/tests/eval/compiled_function/compiled_function_test.cpp +++ b/eval/src/tests/eval/compiled_function/compiled_function_test.cpp @@ -13,7 +13,7 @@ using namespace vespalib::eval; //----------------------------------------------------------------------------- -std::vector params_10({"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10"}); +std::vector params_10({"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10"}); const char *expr_10 = "p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10"; @@ -50,7 +50,7 @@ TEST("require that lazy parameter passing works") { //----------------------------------------------------------------------------- -std::vector unsupported = { +std::vector unsupported = { "map(", "map_subspaces(", "join(", @@ -62,8 +62,8 @@ std::vector unsupported = { "cell_cast(" }; -bool is_unsupported(const vespalib::string &expression) { - if (expression.find("{") != vespalib::string::npos) { +bool is_unsupported(const std::string &expression) { + if (expression.find("{") != std::string::npos) { return true; } for (const auto &prefix: unsupported) { @@ -83,8 +83,8 @@ struct MyEvalTest : test::EvalSpec::EvalTest { bool print_fail = false; ~MyEvalTest() override; - virtual void next_expression(const std::vector ¶m_names, - const vespalib::string &expression) override + virtual void next_expression(const std::vector ¶m_names, + const std::string &expression) override { auto function = Function::parse(param_names, expression); ASSERT_TRUE(!function->has_error()); @@ -98,9 +98,9 @@ struct MyEvalTest : test::EvalSpec::EvalTest { ++fail_cnt; } } - virtual void handle_case(const std::vector ¶m_names, + virtual void handle_case(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression, + const std::string &expression, double expected_result) override { auto function = Function::parse(param_names, expression); diff --git a/eval/src/tests/eval/fast_value/fast_value_test.cpp b/eval/src/tests/eval/fast_value/fast_value_test.cpp index 21b465f2b555..3d3db340c606 100644 --- a/eval/src/tests/eval/fast_value/fast_value_test.cpp +++ b/eval/src/tests/eval/fast_value/fast_value_test.cpp @@ -152,7 +152,7 @@ verifyFastValueSize(TensorSpec spec, uint32_t elems, size_t expected) { TEST(FastValueTest, document_fast_value_memory_usage) { EXPECT_EQ(232, sizeof(FastValue)); FastValue test(ValueType::from_spec("tensor(country{})"), 1, 1, 1); - constexpr size_t BASE_SZ = 348 + sizeof(vespalib::string); + constexpr size_t BASE_SZ = 348 + sizeof(std::string); EXPECT_EQ(BASE_SZ, test.get_memory_usage().allocatedBytes()); diff --git a/eval/src/tests/eval/feature_name_extractor/feature_name_extractor_test.cpp b/eval/src/tests/eval/feature_name_extractor/feature_name_extractor_test.cpp index cd6cbb95e426..86f0fa67c254 100644 --- a/eval/src/tests/eval/feature_name_extractor/feature_name_extractor_test.cpp +++ b/eval/src/tests/eval/feature_name_extractor/feature_name_extractor_test.cpp @@ -4,18 +4,18 @@ using vespalib::eval::FeatureNameExtractor; -void verify_extract(const vespalib::string &input, - const vespalib::string &expect_symbol, - const vespalib::string &expect_after) +void verify_extract(const std::string &input, + const std::string &expect_symbol, + const std::string &expect_after) { FeatureNameExtractor extractor; const char *pos_in = input.data(); const char *end_in = input.data() + input.size(); - vespalib::string symbol_out; + std::string symbol_out; const char *pos_out = nullptr; extractor.extract_symbol(pos_in, end_in, pos_out, symbol_out); ASSERT_TRUE(pos_out != nullptr); - vespalib::string after(pos_out, end_in); + std::string after(pos_out, end_in); EXPECT_EQUAL(expect_symbol, symbol_out); EXPECT_EQUAL(expect_after, after); } diff --git a/eval/src/tests/eval/function/function_test.cpp b/eval/src/tests/eval/function/function_test.cpp index 6aedfeb9fd24..47718329e4f6 100644 --- a/eval/src/tests/eval/function/function_test.cpp +++ b/eval/src/tests/eval/function/function_test.cpp @@ -14,7 +14,7 @@ using namespace vespalib::eval; using namespace vespalib::eval::nodes; using vespalib::eval::test::GenSpec; -std::vector params({"x", "y", "z", "w"}); +std::vector params({"x", "y", "z", "w"}); double as_number(const Function &f) { auto number = as(f.root()); @@ -22,7 +22,7 @@ double as_number(const Function &f) { return number->value(); } -vespalib::string as_string(const Function &f) { +std::string as_string(const Function &f) { auto string = as(f.root()); ASSERT_TRUE(string); return string->value(); @@ -30,10 +30,10 @@ vespalib::string as_string(const Function &f) { struct OperatorLayer { Operator::Order order; - std::vector op_names; + std::vector op_names; }; -Operator_UP create_op(vespalib::string name) { +Operator_UP create_op(std::string name) { Operator_UP op = OperatorRepo::instance().create(name); ASSERT_TRUE(op.get() != nullptr); EXPECT_EQUAL(name, op->op_str()); @@ -41,16 +41,16 @@ Operator_UP create_op(vespalib::string name) { } void verify_operator_binding_order(std::initializer_list layers) { - std::set seen_names; + std::set seen_names; int layer_idx = 0; for (OperatorLayer layer: layers) { ++layer_idx; - for (vespalib::string op_name: layer.op_names) { + for (std::string op_name: layer.op_names) { seen_names.insert(op_name); int other_layer_idx = 0; for (OperatorLayer other_layer: layers) { ++other_layer_idx; - for (vespalib::string other_op_name: other_layer.op_names) { + for (std::string other_op_name: other_layer.op_names) { Operator_UP op = create_op(op_name); Operator_UP other_op = create_op(other_op_name); bool do_op_before_other_op = (layer_idx < other_layer_idx) @@ -72,20 +72,20 @@ void verify_operator_binding_order(std::initializer_list layers) } } -bool verify_string(const vespalib::string &str, const vespalib::string &expr) { +bool verify_string(const std::string &str, const std::string &expr) { bool ok = true; ok &= EXPECT_EQUAL(str, as_string(*Function::parse(params, expr))); ok &= EXPECT_EQUAL(expr, Function::parse(params, expr)->dump()); return ok; } -void verify_error(const vespalib::string &expr, const vespalib::string &expected_error) { +void verify_error(const std::string &expr, const std::string &expected_error) { auto function = Function::parse(params, expr); EXPECT_TRUE(function->has_error()); EXPECT_EQUAL(expected_error, function->get_error()); } -void verify_parse(const vespalib::string &expr, const vespalib::string &expect) { +void verify_parse(const std::string &expr, const std::string &expect) { auto function = Function::parse(expr); EXPECT_TRUE(!function->has_error()); EXPECT_EQUAL(function->dump_as_lambda(), expect); @@ -145,9 +145,9 @@ TEST("require that strings are parsed and dumped correctly") { EXPECT_TRUE(verify_string(">\r<", "\">\\r<\"")); EXPECT_TRUE(verify_string(">\f<", "\">\\f<\"")); for (int c = 0; c < 256; ++c) { - vespalib::string raw_expr = vespalib::make_string("\"%c\"", c); - vespalib::string hex_expr = vespalib::make_string("\"\\x%02x\"", c); - vespalib::string raw_str = vespalib::make_string("%c", c); + std::string raw_expr = vespalib::make_string("\"%c\"", c); + std::string hex_expr = vespalib::make_string("\"\\x%02x\"", c); + std::string raw_str = vespalib::make_string("%c", c); EXPECT_EQUAL(raw_str, as_string(*Function::parse(params, hex_expr))); if (c != 0 && c != '\"' && c != '\\') { EXPECT_EQUAL(raw_str, as_string(*Function::parse(params, raw_expr))); @@ -400,7 +400,7 @@ struct MyNodeHandler : public NodeHandler { } }; -size_t detach_from_root(const vespalib::string &expr) { +size_t detach_from_root(const std::string &expr) { MyNodeHandler handler; auto function = Function::parse(expr); nodes::Node &mutable_root = const_cast(function->root()); @@ -460,7 +460,7 @@ struct MyTraverser : public NodeTraverser { MyTraverser::~MyTraverser() = default; -size_t verify_traversal(size_t open_true_cnt, const vespalib::string &expression) { +size_t verify_traversal(size_t open_true_cnt, const std::string &expression) { auto function = Function::parse(expression); if (!EXPECT_TRUE(!function->has_error())) { fprintf(stderr, "--> %s\n", function->get_error().c_str()); @@ -474,7 +474,7 @@ size_t verify_traversal(size_t open_true_cnt, const vespalib::string &expression return offset; } -bool verify_expression_traversal(const vespalib::string &expression) { +bool verify_expression_traversal(const std::string &expression) { for (size_t open_cnt = 0; true; ++open_cnt) { size_t num_callbacks = verify_traversal(open_cnt, expression); if (num_callbacks == (open_cnt * 2)) { // graph is now fully expanded @@ -604,16 +604,16 @@ TEST("require that sums of trees and forests are forests") { //----------------------------------------------------------------------------- struct UnWrapped { - vespalib::string wrapper; - vespalib::string body; - vespalib::string error; + std::string wrapper; + std::string body; + std::string error; ~UnWrapped(); }; UnWrapped::~UnWrapped() {} -UnWrapped unwrap(const vespalib::string &str) { +UnWrapped unwrap(const std::string &str) { UnWrapped result; bool ok = Function::unwrap(str, result.wrapper, result.body, result.error); EXPECT_EQUAL(ok, result.error.empty()); @@ -658,7 +658,7 @@ struct MySymbolExtractor : SymbolExtractor { explicit MySymbolExtractor(std::initializer_list extra_in) : extra(extra_in), invoke_count() {} void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const override + const char *&pos_out, std::string &symbol_out) const override { ++invoke_count; for (; pos_in < end_in; ++pos_in) { @@ -933,7 +933,7 @@ TEST("require that convenient tensor create handles dimension order") { } TEST("require that convenient tensor create can be highly nested") { - vespalib::string expect("tensor(a{},b{},c[1],d[1]):{{a:\"x\",b:\"y\",c:0,d:0}:5}"); + std::string expect("tensor(a{},b{},c[1],d[1]):{{a:\"x\",b:\"y\",c:0,d:0}:5}"); auto nested1 = Function::parse("tensor(a{},b{},c[1],d[1]):{x:{y:[[5]]}}"); auto nested2 = Function::parse("tensor(c[1],d[1],a{},b{}):[[{x:{y:5}}]]"); auto nested3 = Function::parse("tensor(a{},c[1],b{},d[1]): { x : [ { y : [ 5 ] } ] } "); @@ -943,7 +943,7 @@ TEST("require that convenient tensor create can be highly nested") { } TEST("require that convenient tensor create can have multiple values on multiple levels") { - vespalib::string expect("tensor(x{},y[2]):{{x:\"a\",y:0}:1,{x:\"a\",y:1}:2,{x:\"b\",y:0}:3,{x:\"b\",y:1}:4}"); + std::string expect("tensor(x{},y[2]):{{x:\"a\",y:0}:1,{x:\"a\",y:1}:2,{x:\"b\",y:0}:3,{x:\"b\",y:1}:4}"); auto fun1 = Function::parse("tensor(x{},y[2]):{a:[1,2],b:[3,4]}"); auto fun2 = Function::parse("tensor(y[2],x{}):[{a:1,b:3},{a:2,b:4}]"); auto fun3 = Function::parse("tensor(x{},y[2]): { a : [ 1 , 2 ] , b : [ 3 , 4 ] } "); @@ -1014,7 +1014,7 @@ TEST("require that tensor peek empty label is not allowed") { //----------------------------------------------------------------------------- TEST("require that nested tensor lambda using tensor peek can be parsed") { - vespalib::string expect("tensor(x[2])(tensor(y[2])((x+y)+a){y:(x)})"); + std::string expect("tensor(x[2])(tensor(y[2])((x+y)+a){y:(x)})"); EXPECT_EQUAL(Function::parse(expect)->dump(), expect); } @@ -1042,8 +1042,8 @@ struct CheckExpressions : test::EvalSpec::EvalTest { bool failed = false; size_t seen_cnt = 0; ~CheckExpressions() override; - virtual void next_expression(const std::vector ¶m_names, - const vespalib::string &expression) override + virtual void next_expression(const std::vector ¶m_names, + const std::string &expression) override { auto function = Function::parse(param_names, expression); if (function->has_error()) { @@ -1052,9 +1052,9 @@ struct CheckExpressions : test::EvalSpec::EvalTest { } ++seen_cnt; } - virtual void handle_case(const std::vector &, + virtual void handle_case(const std::vector &, const std::vector &, - const vespalib::string &, + const std::string &, double) override {} }; diff --git a/eval/src/tests/eval/function_speed/function_speed_test.cpp b/eval/src/tests/eval/function_speed/function_speed_test.cpp index bf109bd30189..f7403acd9d71 100644 --- a/eval/src/tests/eval/function_speed/function_speed_test.cpp +++ b/eval/src/tests/eval/function_speed/function_speed_test.cpp @@ -44,7 +44,7 @@ struct Fixture { CompiledFunction separate; CompiledFunction array; CompiledFunction lazy; - Fixture(const vespalib::string &expr) + Fixture(const std::string &expr) : function(Function::parse(expr)), interpreted_simple(SimpleValueBuilderFactory::get(), *function, NodeTypes(*function, std::vector(function->num_params(), ValueType::double_type()))), diff --git a/eval/src/tests/eval/gbdt/fast_forest_bench.cpp b/eval/src/tests/eval/gbdt/fast_forest_bench.cpp index 83b840dbd3da..f1b9e9fc9541 100644 --- a/eval/src/tests/eval/gbdt/fast_forest_bench.cpp +++ b/eval/src/tests/eval/gbdt/fast_forest_bench.cpp @@ -30,7 +30,7 @@ void run_fast_forest_bench() { for (size_t less_percent: std::vector({100})) { for (size_t invert_percent: std::vector({50})) { fprintf(stderr, "\n=== features: %zu, num leafs: %zu, num trees: %zu\n", max_features, tree_size, num_trees); - vespalib::string expression = Model().max_features(max_features).less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); + std::string expression = Model().max_features(max_features).less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); auto function = Function::parse(expression); for (size_t min_bits = std::max(size_t(8), tree_size); true; min_bits *= 2) { auto forest = FastForest::try_convert(*function, min_bits, 64); diff --git a/eval/src/tests/eval/gbdt/gbdt_benchmark.cpp b/eval/src/tests/eval/gbdt/gbdt_benchmark.cpp index 832885d92cfd..b0b7652c4a87 100644 --- a/eval/src/tests/eval/gbdt/gbdt_benchmark.cpp +++ b/eval/src/tests/eval/gbdt/gbdt_benchmark.cpp @@ -103,7 +103,7 @@ struct Result { struct Segment { double min; Option option; - vespalib::string build() const { + std::string build() const { return vespalib::make_string("{%g, %zu}", min, option.id); } }; @@ -119,8 +119,8 @@ struct Plan { } } } - vespalib::string build() const { - vespalib::string plan; + std::string build() const { + std::string plan; plan.append("{"); for (size_t i = 0; i < segments.size(); ++i) { if (i > 0) { diff --git a/eval/src/tests/eval/gbdt/gbdt_test.cpp b/eval/src/tests/eval/gbdt/gbdt_test.cpp index 739202e68bf8..be0d435bc209 100644 --- a/eval/src/tests/eval/gbdt/gbdt_test.cpp +++ b/eval/src/tests/eval/gbdt/gbdt_test.cpp @@ -78,7 +78,7 @@ TEST("require that tree stats can be calculated") { TEST("require that trees can be extracted from forest") { for (size_t tree_size = 10; tree_size < 20; ++tree_size) { for (size_t forest_size = 10; forest_size < 20; ++forest_size) { - vespalib::string expression = Model().make_forest(forest_size, tree_size); + std::string expression = Model().make_forest(forest_size, tree_size); auto function = Function::parse(expression); std::vector trees = extract_trees(function->root()); EXPECT_EQUAL(forest_size, trees.size()); @@ -109,7 +109,7 @@ TEST("require that forest stats can be calculated") { EXPECT_EQUAL(3u, stats.max_set_size); } -double expected_path(const vespalib::string &forest) { +double expected_path(const std::string &forest) { return ForestStats(extract_trees(Function::parse(forest)->root())).total_expected_path_length; } @@ -125,7 +125,7 @@ TEST("require that expected path length is calculated correctly") { EXPECT_EQUAL(0.75*1.0 + 0.25*2.0, expected_path("if(a<1,1,if(a<1,2,3),0.75)")); } -double average_path(const vespalib::string &forest) { +double average_path(const std::string &forest) { return ForestStats(extract_trees(Function::parse(forest)->root())).total_average_path_length; } @@ -141,7 +141,7 @@ TEST("require that average path length is calculated correctly") { EXPECT_EQUAL(5.0/3.0, average_path("if(a<1,1,if(a<1,2,3),0.75)")); } -double count_tuned(const vespalib::string &forest) { +double count_tuned(const std::string &forest) { return ForestStats(extract_trees(Function::parse(forest)->root())).total_tuned_checks; } @@ -226,7 +226,7 @@ TEST("require that trees can be optimized by a forest optimizer when using ARRAY Optimize::Chain chain({DummyForest1::optimize, DummyForest2::optimize}); size_t tree_size = 20; for (size_t forest_size = 10; forest_size <= 100; forest_size += 10) { - vespalib::string expression = Model().make_forest(forest_size, tree_size); + std::string expression = Model().make_forest(forest_size, tree_size); auto function = Function::parse(expression); CompiledFunction compiled_function(*function, PassParams::ARRAY, chain); std::vector inputs(function->num_params(), 0.5); @@ -247,7 +247,7 @@ TEST("require that trees can be optimized by a forest optimizer when using LAZY Optimize::Chain chain({DummyForest1::optimize, DummyForest2::optimize}); size_t tree_size = 20; for (size_t forest_size = 10; forest_size <= 100; forest_size += 10) { - vespalib::string expression = Model().make_forest(forest_size, tree_size); + std::string expression = Model().make_forest(forest_size, tree_size); auto function = Function::parse(expression); CompiledFunction compiled_function(*function, PassParams::LAZY, chain); std::vector inputs(function->num_params(), 0.5); @@ -349,7 +349,7 @@ TEST("require that forests evaluate to approximately the same for all evaluation for (size_t num_trees: std::vector({60})) { for (size_t less_percent: std::vector({100, 80})) { for (size_t invert_percent: std::vector({0, 50})) { - vespalib::string expression = Model().less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); + std::string expression = Model().less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); auto function = Function::parse(expression); auto forest = FastForest::try_convert(*function); EXPECT_EQUAL(bool(forest), bool(less_percent == 100)); @@ -389,7 +389,7 @@ TEST("require that fast forest evaluation is correct for all tree size categorie for (size_t num_features: std::vector({35})) { for (size_t less_percent: std::vector({100})) { for (size_t invert_percent: std::vector({50})) { - vespalib::string expression = Model().max_features(num_features).less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); + std::string expression = Model().max_features(num_features).less_percent(less_percent).invert_percent(invert_percent).make_forest(num_trees, tree_size); auto function = Function::parse(expression); auto forest = FastForest::try_convert(*function); if ((tree_size <= 64) || is_little_endian()) { diff --git a/eval/src/tests/eval/gbdt/model.cpp b/eval/src/tests/eval/gbdt/model.cpp index 707ccdc435ea..ae084e14e9b7 100644 --- a/eval/src/tests/eval/gbdt/model.cpp +++ b/eval/src/tests/eval/gbdt/model.cpp @@ -93,7 +93,7 @@ class Model std::string make_forest(size_t num_trees, size_t tree_sizes) { assert(num_trees > 0); - vespalib::string forest = make_tree(tree_sizes); + std::string forest = make_tree(tree_sizes); for (size_t i = 1; i < num_trees; ++i) { forest.append("+"); forest.append(make_tree(tree_sizes)); diff --git a/eval/src/tests/eval/gen_spec/gen_spec_test.cpp b/eval/src/tests/eval/gen_spec/gen_spec_test.cpp index 6c8ba8121b24..0ee4089f42b2 100644 --- a/eval/src/tests/eval/gen_spec/gen_spec_test.cpp +++ b/eval/src/tests/eval/gen_spec/gen_spec_test.cpp @@ -31,13 +31,13 @@ TEST(DimSpecTest, mapped_dimension) { TEST(DimSpecTest, simple_dictionary_creation) { auto dict = DimSpec::make_dict(5, 1, ""); - std::vector expect = {"1", "2", "3", "4", "5"}; + std::vector expect = {"1", "2", "3", "4", "5"}; EXPECT_EQ(dict, expect); } TEST(DimSpecTest, advanced_dictionary_creation) { auto dict = DimSpec::make_dict(5, 3, "str_"); - std::vector expect = {"str_3", "str_6", "str_9", "str_12", "str_15"}; + std::vector expect = {"str_3", "str_6", "str_9", "str_12", "str_15"}; EXPECT_EQ(dict, expect); } diff --git a/eval/src/tests/eval/inline_operation/inline_operation_test.cpp b/eval/src/tests/eval/inline_operation/inline_operation_test.cpp index 91b791ff4dba..d55d27d61690 100644 --- a/eval/src/tests/eval/inline_operation/inline_operation_test.cpp +++ b/eval/src/tests/eval/inline_operation/inline_operation_test.cpp @@ -28,14 +28,14 @@ template void test_op2(op2_t ref, double a, double b, double expect EXPECT_DOUBLE_EQ(op(a, b), expect); }; -op1_t as_op1(const vespalib::string &str) { +op1_t as_op1(const std::string &str) { auto fun = Function::parse({"a"}, str); auto res = lookup_op1(*fun); EXPECT_TRUE(res.has_value()); return res.value(); } -op2_t as_op2(const vespalib::string &str) { +op2_t as_op2(const std::string &str) { auto fun = Function::parse({"a", "b"}, str); auto res = lookup_op2(*fun); EXPECT_TRUE(res.has_value()); diff --git a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp index 4ba715ea192a..53c3cf217e49 100644 --- a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp +++ b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp @@ -28,8 +28,8 @@ struct MyEvalTest : test::EvalSpec::EvalTest { ~MyEvalTest() override; - virtual void next_expression(const std::vector ¶m_names, - const vespalib::string &expression) override + virtual void next_expression(const std::vector ¶m_names, + const std::string &expression) override { auto function = Function::parse(param_names, expression); ASSERT_TRUE(!function->has_error()); @@ -44,9 +44,9 @@ struct MyEvalTest : test::EvalSpec::EvalTest { } } - virtual void handle_case(const std::vector ¶m_names, + virtual void handle_case(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression, + const std::string &expression, double expected_result) override { auto function = Function::parse(param_names, expression); @@ -54,14 +54,14 @@ struct MyEvalTest : test::EvalSpec::EvalTest { bool is_supported = true; bool has_issues = InterpretedFunction::detect_issues(*function); if (is_supported && !has_issues) { - vespalib::string desc = as_string(param_names, param_values, expression); + std::string desc = as_string(param_names, param_values, expression); SimpleParams params(param_values); verify_result(SimpleValueBuilderFactory::get(), *function, "[simple] "+desc, params, expected_result); verify_result(FastValueBuilderFactory::get(), *function, "[prod] "+desc, params, expected_result); } } - void report_result(bool is_double, double result, double expect, const vespalib::string &desc) + void report_result(bool is_double, double result, double expect, const std::string &desc) { if (is_double && is_same(expect, result)) { print_pass && fprintf(stderr, "verifying: %s -> %g ... PASS\n", @@ -76,7 +76,7 @@ struct MyEvalTest : test::EvalSpec::EvalTest { void verify_result(const ValueBuilderFactory &factory, const Function &function, - const vespalib::string &description, + const std::string &description, const SimpleParams ¶ms, double expected_result) { @@ -101,14 +101,14 @@ TEST_FF("require that interpreted evaluation passes all conformance tests", MyEv //----------------------------------------------------------------------------- TEST("require that invalid function is tagged with error") { - std::vector params({"x", "y", "z", "w"}); + std::vector params({"x", "y", "z", "w"}); auto function = Function::parse(params, "x & y"); EXPECT_TRUE(function->has_error()); } //----------------------------------------------------------------------------- -size_t count_ifs(const vespalib::string &expr, std::initializer_list params_in) { +size_t count_ifs(const std::string &expr, std::initializer_list params_in) { auto fun = Function::parse(expr); auto node_types = NodeTypes(*fun, std::vector(params_in.size(), ValueType::double_type())); InterpretedFunction ifun(SimpleValueBuilderFactory::get(), *fun, node_types); diff --git a/eval/src/tests/eval/llvm_stress/llvm_stress_test.cpp b/eval/src/tests/eval/llvm_stress/llvm_stress_test.cpp index e61133a55c68..6805e0322626 100644 --- a/eval/src/tests/eval/llvm_stress/llvm_stress_test.cpp +++ b/eval/src/tests/eval/llvm_stress/llvm_stress_test.cpp @@ -62,7 +62,7 @@ struct Rnd { } }; -vespalib::string make_expr(size_t size, Rnd &rnd) { +std::string make_expr(size_t size, Rnd &rnd) { if (size < 2) { auto x = rnd.get_int(0, 99); if (x < 2) { @@ -74,7 +74,7 @@ vespalib::string make_expr(size_t size, Rnd &rnd) { } else if (x < 26) { return "1.25"; } else { - static vespalib::string params("abcdefghijk"); + static std::string params("abcdefghijk"); auto idx = rnd.get_int(0, params.size() - 1); return params.substr(idx, 1); } diff --git a/eval/src/tests/eval/map_subspaces/map_subspaces_test.cpp b/eval/src/tests/eval/map_subspaces/map_subspaces_test.cpp index 278d49992bea..82b60c01fcea 100644 --- a/eval/src/tests/eval/map_subspaces/map_subspaces_test.cpp +++ b/eval/src/tests/eval/map_subspaces/map_subspaces_test.cpp @@ -16,7 +16,7 @@ using namespace vespalib::eval; using namespace vespalib::eval::test; using namespace vespalib::eval::tensor_function; -void verify(const vespalib::string &a, const vespalib::string &expr, const vespalib::string &result) { +void verify(const std::string &a, const std::string &expr, const std::string &result) { EvalFixture::ParamRepo param_repo; param_repo.add("a", TensorSpec::from_expr(a)); auto expect = TensorSpec::from_expr(result); diff --git a/eval/src/tests/eval/node_tools/node_tools_test.cpp b/eval/src/tests/eval/node_tools/node_tools_test.cpp index d0f479d45cb8..b90fdf942270 100644 --- a/eval/src/tests/eval/node_tools/node_tools_test.cpp +++ b/eval/src/tests/eval/node_tools/node_tools_test.cpp @@ -7,19 +7,19 @@ using namespace vespalib::eval; auto make_copy(const Function &fun) { - std::vector params; + std::vector params; for (size_t i = 0; i < fun.num_params(); ++i) { params.push_back(fun.param_name(i)); } return Function::create(NodeTools::copy(fun.root()), params); } -void verify_copy(const vespalib::string &expr, const vespalib::string &expect) { +void verify_copy(const std::string &expr, const std::string &expect) { auto fun = Function::parse(expr); auto fun_copy = make_copy(*fun); EXPECT_EQUAL(fun_copy->dump(), expect); } -void verify_copy(const vespalib::string &expr) { verify_copy(expr, expr); } +void verify_copy(const std::string &expr) { verify_copy(expr, expr); } TEST("require that required parameter count can be detected") { auto function = Function::parse({"a","b","c"}, "(c+a)+(b+1)"); diff --git a/eval/src/tests/eval/node_types/node_types_test.cpp b/eval/src/tests/eval/node_types/node_types_test.cpp index ad5426e2a99b..42ca9753bbc9 100644 --- a/eval/src/tests/eval/node_types/node_types_test.cpp +++ b/eval/src/tests/eval/node_types/node_types_test.cpp @@ -10,7 +10,7 @@ using namespace vespalib::eval; struct TypeSpecExtractor : public vespalib::eval::SymbolExtractor { void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const override + const char *&pos_out, std::string &symbol_out) const override { ValueType type = value_type::parse_spec(pos_in, end_in, pos_out); if (pos_out != nullptr) { @@ -27,7 +27,7 @@ void print_errors(const NodeTypes &types) { } } -void verify(const vespalib::string &type_expr, const vespalib::string &type_spec) { +void verify(const std::string &type_expr, const std::string &type_spec) { auto function = Function::parse(type_expr, TypeSpecExtractor()); if (!EXPECT_TRUE(!function->has_error())) { fprintf(stderr, "parse error: %s\n", function->get_error().c_str()); @@ -129,11 +129,11 @@ TEST("require that rename resolves correct type") { TEST_DO(verify("rename(tensor(x{},y[1],z[5]),(x,y,z),(a,b,c))", "tensor(a{},b[1],c[5])")); } -vespalib::string strfmt(const char *pattern, const char *a) { +std::string strfmt(const char *pattern, const char *a) { return vespalib::make_string(pattern, a); } -vespalib::string strfmt(const char *pattern, const char *a, const char *b) { +std::string strfmt(const char *pattern, const char *a, const char *b) { return vespalib::make_string(pattern, a, b); } diff --git a/eval/src/tests/eval/param_usage/param_usage_test.cpp b/eval/src/tests/eval/param_usage/param_usage_test.cpp index a2f4cfc30e41..67361d3c3be6 100644 --- a/eval/src/tests/eval/param_usage/param_usage_test.cpp +++ b/eval/src/tests/eval/param_usage/param_usage_test.cpp @@ -30,35 +30,35 @@ std::ostream &operator<<(std::ostream &out, const List &list) { } TEST("require that simple expression has appropriate parameter usage") { - std::vector params({"x", "y", "z"}); + std::vector params({"x", "y", "z"}); auto function = Function::parse(params, "(x+y)*y"); EXPECT_EQUAL(List(count_param_usage(*function)), List({1.0, 2.0, 0.0})); EXPECT_EQUAL(List(check_param_usage(*function)), List({1.0, 1.0, 0.0})); } TEST("require that if children have 50% probability each by default") { - std::vector params({"x", "y", "z", "w"}); + std::vector params({"x", "y", "z", "w"}); auto function = Function::parse(params, "if(w,(x+y)*y,(y+z)*z)"); EXPECT_EQUAL(List(count_param_usage(*function)), List({0.5, 1.5, 1.0, 1.0})); EXPECT_EQUAL(List(check_param_usage(*function)), List({0.5, 1.0, 0.5, 1.0})); } TEST("require that if children probability can be adjusted") { - std::vector params({"x", "y", "z"}); + std::vector params({"x", "y", "z"}); auto function = Function::parse(params, "if(z,x*x,y*y,0.8)"); EXPECT_EQUAL(List(count_param_usage(*function)), List({1.6, 0.4, 1.0})); EXPECT_EQUAL(List(check_param_usage(*function)), List({0.8, 0.2, 1.0})); } TEST("require that chained if statements are combined correctly") { - std::vector params({"x", "y", "z", "w"}); + std::vector params({"x", "y", "z", "w"}); auto function = Function::parse(params, "if(z,x,y)+if(w,y,x)"); EXPECT_EQUAL(List(count_param_usage(*function)), List({1.0, 1.0, 1.0, 1.0})); EXPECT_EQUAL(List(check_param_usage(*function)), List({0.75, 0.75, 1.0, 1.0})); } TEST("require that multi-level if statements are combined correctly") { - std::vector params({"x", "y", "z", "w"}); + std::vector params({"x", "y", "z", "w"}); auto function = Function::parse(params, "if(z,if(w,y*x,x*x),if(w,y*x,x*x))"); EXPECT_EQUAL(List(count_param_usage(*function)), List({1.5, 0.5, 1.0, 1.0})); EXPECT_EQUAL(List(check_param_usage(*function)), List({1.0, 0.5, 1.0, 1.0})); diff --git a/eval/src/tests/eval/reference_evaluation/reference_evaluation_test.cpp b/eval/src/tests/eval/reference_evaluation/reference_evaluation_test.cpp index 6df1a7fdb34d..3078b875daf3 100644 --- a/eval/src/tests/eval/reference_evaluation/reference_evaluation_test.cpp +++ b/eval/src/tests/eval/reference_evaluation/reference_evaluation_test.cpp @@ -20,11 +20,11 @@ TensorSpec ref_eval(std::shared_ptr fun, const std::vector ¶ms) { +TensorSpec ref_eval(const std::string &expr, const std::vector ¶ms) { return ref_eval(*Function::parse(expr), params); } -TensorSpec make_val(const vespalib::string &expr) { +TensorSpec make_val(const std::string &expr) { return ref_eval(*Function::parse(expr), {}); } @@ -35,11 +35,11 @@ struct MyEvalTest : EvalSpec::EvalTest { size_t fail_cnt = 0; bool print_pass = false; bool print_fail = false; - void next_expression(const std::vector &, - const vespalib::string &) override {} - void handle_case(const std::vector ¶m_names, + void next_expression(const std::vector &, + const std::string &) override {} + void handle_case(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression, + const std::string &expression, double expected_result) override { auto function = Function::parse(param_names, expression); diff --git a/eval/src/tests/eval/reference_operations/reference_operations_test.cpp b/eval/src/tests/eval/reference_operations/reference_operations_test.cpp index e125a29d75f0..c9765769db77 100644 --- a/eval/src/tests/eval/reference_operations/reference_operations_test.cpp +++ b/eval/src/tests/eval/reference_operations/reference_operations_test.cpp @@ -49,7 +49,7 @@ TensorSpec sparse_1d_all_two() { .add({{"c", "qux"}}, 2.0); } -TensorSpec spec(const vespalib::string &expr) { +TensorSpec spec(const std::string &expr) { auto result = TensorSpec::from_expr(expr); EXPECT_FALSE(ValueType::from_spec(result.type()).is_error()); return result; diff --git a/eval/src/tests/eval/simple_value/simple_value_test.cpp b/eval/src/tests/eval/simple_value/simple_value_test.cpp index e8759f3a4073..b44783bcf5be 100644 --- a/eval/src/tests/eval/simple_value/simple_value_test.cpp +++ b/eval/src/tests/eval/simple_value/simple_value_test.cpp @@ -21,7 +21,7 @@ using CPA = std::vector; using Handle = SharedStringRepo::Handle; -vespalib::string as_str(string_id label) { return Handle::string_from_id(label); } +std::string as_str(string_id label) { return Handle::string_from_id(label); } GenSpec G() { return GenSpec(); } @@ -96,8 +96,8 @@ TEST(SimpleValueTest, simple_value_can_be_built_and_inspected) { const auto &factory = SimpleValueBuilderFactory::get(); std::unique_ptr> builder = factory.create_value_builder(type); float seq = 0.0; - for (vespalib::string x: {"a", "b", "c"}) { - for (vespalib::string y: {"aa", "bb"}) { + for (std::string x: {"a", "b", "c"}) { + for (std::string y: {"aa", "bb"}) { std::vector addr = {x, y}; auto subspace = builder->add_subspace(addr); EXPECT_EQ(subspace.size(), 2); @@ -115,7 +115,7 @@ TEST(SimpleValueTest, simple_value_can_be_built_and_inspected) { string_id query = query_handle.id(); string_id label; size_t subspace; - std::map result; + std::map result; view->lookup(CPA{&query}); while (view->next_result(PA{&label}, subspace)) { result[as_str(label)] = subspace; diff --git a/eval/src/tests/eval/tensor_function/tensor_function_test.cpp b/eval/src/tests/eval/tensor_function/tensor_function_test.cpp index 8b654d0073ce..b9bf8cb3fe2d 100644 --- a/eval/src/tests/eval/tensor_function/tensor_function_test.cpp +++ b/eval/src/tests/eval/tensor_function/tensor_function_test.cpp @@ -52,8 +52,8 @@ struct EvalCtx { Value::UP make_false() { return value_from_spec(TensorSpec("double").add({}, 0.0), factory); } - Value::UP make_vector(std::initializer_list cells, vespalib::string dim = "x", bool mapped = false) { - vespalib::string type_spec = mapped + Value::UP make_vector(std::initializer_list cells, std::string dim = "x", bool mapped = false) { + std::string type_spec = mapped ? make_string("tensor(%s{})", dim.c_str()) : make_string("tensor(%s[%zu])", dim.c_str(), cells.size()); TensorSpec spec(type_spec); diff --git a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp index be19795a4376..d19f1ce1fc98 100644 --- a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp +++ b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp @@ -44,7 +44,7 @@ EvalFixture::ParamRepo make_params() { EvalFixture::ParamRepo param_repo = make_params(); template -void verify_impl(const vespalib::string &expr, const vespalib::string &expect, F &&inspect) { +void verify_impl(const std::string &expr, const std::string &expect, F &&inspect) { EvalFixture fixture(prod_factory, expr, param_repo, true); EvalFixture slow_fixture(prod_factory, expr, param_repo, false); EvalFixture simple_factory_fixture(simple_factory, expr, param_repo, false); @@ -59,24 +59,24 @@ void verify_impl(const vespalib::string &expr, const vespalib::string &expect, F } } template -void verify_impl(const vespalib::string &expr, const vespalib::string &expect) { +void verify_impl(const std::string &expr, const std::string &expect) { verify_impl(expr, expect, [](const T*){}); } -void verify_generic(const vespalib::string &expr, const vespalib::string &expect) { +void verify_generic(const std::string &expr, const std::string &expect) { verify_impl(expr, expect); } -void verify_reshape(const vespalib::string &expr, const vespalib::string &expect) { +void verify_reshape(const std::string &expr, const std::string &expect) { verify_impl(expr, expect); } -void verify_range(const vespalib::string &expr, const vespalib::string &expect) { +void verify_range(const std::string &expr, const std::string &expect) { verify_impl(expr, expect); } -void verify_idx_fun(const vespalib::string &expr, const vespalib::string &expect, - const vespalib::string &expect_idx_fun) +void verify_idx_fun(const std::string &expr, const std::string &expect, + const std::string &expect_idx_fun) { verify_impl(expr, expect, [&](const DenseLambdaPeekFunction *info) @@ -85,7 +85,7 @@ void verify_idx_fun(const vespalib::string &expr, const vespalib::string &expect }); } -void verify_const(const vespalib::string &expr, const vespalib::string &expect) { +void verify_const(const std::string &expr, const std::string &expect) { verify_impl(expr, expect); } diff --git a/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp b/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp index c5dafd69b9d0..e327a75e70af 100644 --- a/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp +++ b/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp @@ -29,7 +29,7 @@ TEST("require that a tensor spec can be converted to and from an expression") { .add({{"x", 0}, {"y", "yyy"}}, 2.0) .add({{"x", 1}, {"y", "xxx"}}, 3.0) .add({{"x", 1}, {"y", "yyy"}}, 4.0); - vespalib::string expr = spec.to_expr(); + std::string expr = spec.to_expr(); fprintf(stderr, "expr: \n%s\n", expr.c_str()); EXPECT_EQUAL(TensorSpec::from_expr(expr), spec); } @@ -40,7 +40,7 @@ TEST("require that nan/inf/-inf cells get converted to valid expressions") { .add({{"x", 0}, {"y", "yyy"}}, my_nan) .add({{"x", 1}, {"y", "xxx"}}, my_neg_inf) .add({{"x", 1}, {"y", "yyy"}}, my_inf); - vespalib::string expr = spec.to_expr(); + std::string expr = spec.to_expr(); fprintf(stderr, "expr: \n%s\n", expr.c_str()); EXPECT_EQUAL(TensorSpec::from_expr(expr), spec); } diff --git a/eval/src/tests/eval/value_cache/value_cache_test.cpp b/eval/src/tests/eval/value_cache/value_cache_test.cpp index d4581b71d85b..072be0e40b87 100644 --- a/eval/src/tests/eval/value_cache/value_cache_test.cpp +++ b/eval/src/tests/eval/value_cache/value_cache_test.cpp @@ -17,7 +17,7 @@ struct MyValue : ConstantValue { struct MyFactory : ConstantValueFactory { mutable size_t create_cnt = 0; - ConstantValue::UP create(const vespalib::string &path, const vespalib::string &) const override { + ConstantValue::UP create(const std::string &path, const std::string &) const override { ++create_cnt; return std::make_unique(double(atoi(path.c_str()))); } diff --git a/eval/src/tests/eval/value_codec/value_codec_test.cpp b/eval/src/tests/eval/value_codec/value_codec_test.cpp index cf8f5b079dba..611dc815d635 100644 --- a/eval/src/tests/eval/value_codec/value_codec_test.cpp +++ b/eval/src/tests/eval/value_codec/value_codec_test.cpp @@ -74,8 +74,8 @@ TEST(ValueCodecTest, simple_values_can_be_built_using_tensor_spec) { //----------------------------------------------------------------------------- -vespalib::string make_type_spec(bool use_float, const vespalib::string &dims) { - vespalib::string type_spec = "tensor"; +std::string make_type_spec(bool use_float, const std::string &dims) { + std::string type_spec = "tensor"; if (use_float) { type_spec.append(""); } diff --git a/eval/src/tests/eval/value_type/value_type_test.cpp b/eval/src/tests/eval/value_type/value_type_test.cpp index 9663969ae80d..a4fbfc864b79 100644 --- a/eval/src/tests/eval/value_type/value_type_test.cpp +++ b/eval/src/tests/eval/value_type/value_type_test.cpp @@ -14,13 +14,13 @@ using namespace vespalib::eval; const size_t npos = ValueType::Dimension::npos; -ValueType type(const vespalib::string &type_str) { +ValueType type(const std::string &type_str) { ValueType ret = ValueType::from_spec(type_str); ASSERT_TRUE(!ret.is_error() || (type_str == "error")); return ret; } -std::vector str_list(const std::vector &list) { +std::vector str_list(const std::vector &list) { return list; } @@ -265,16 +265,16 @@ TEST("require that malformed value type spec is parsed as error") { } struct ParseResult { - vespalib::string spec; + std::string spec; const char *pos; const char *end; const char *after; ValueType type; - ParseResult(const vespalib::string &spec_in); + ParseResult(const std::string &spec_in); ~ParseResult(); bool after_inside() const { return ((after > pos) && (after < end)); } }; -ParseResult::ParseResult(const vespalib::string &spec_in) +ParseResult::ParseResult(const std::string &spec_in) : spec(spec_in), pos(spec.data()), end(pos + spec.size()), @@ -633,7 +633,7 @@ TEST("require that diverging types can not be merged") { EXPECT_EQUAL(ValueType::merge(type("tensor(x{})"), type("tensor(y{})")), type("error")); } -void verify_concat(const ValueType &a, const ValueType &b, const vespalib::string &dim, const ValueType &res) { +void verify_concat(const ValueType &a, const ValueType &b, const std::string &dim, const ValueType &res) { EXPECT_EQUAL(ValueType::concat(a, b, dim), res); EXPECT_EQUAL(ValueType::concat(b, a, dim), res); } diff --git a/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp b/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp index 39e6ea039d41..0b5db8f1609e 100644 --- a/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp +++ b/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp @@ -28,14 +28,14 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); EXPECT_EQUAL(info.size(), 1u); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); diff --git a/eval/src/tests/instruction/best_similarity_function/best_similarity_function_test.cpp b/eval/src/tests/instruction/best_similarity_function/best_similarity_function_test.cpp index 1b12fd24cc69..fb91679723ac 100644 --- a/eval/src/tests/instruction/best_similarity_function/best_similarity_function_test.cpp +++ b/eval/src/tests/instruction/best_similarity_function/best_similarity_function_test.cpp @@ -15,7 +15,7 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); //----------------------------------------------------------------------------- -void verify_impl(const TensorSpec &a, const TensorSpec &b, const vespalib::string &expr, bool optimized) { +void verify_impl(const TensorSpec &a, const TensorSpec &b, const std::string &expr, bool optimized) { EvalFixture::ParamRepo param_repo; param_repo.add("a", a).add("b", b); EvalFixture fast_fixture(prod_factory, expr, param_repo, true); @@ -23,27 +23,27 @@ void verify_impl(const TensorSpec &a, const TensorSpec &b, const vespalib::strin EXPECT_EQ(fast_fixture.find_all().size(), optimized ? 1 : 0); } -void verify(const TensorSpec &a, const TensorSpec &b, const vespalib::string &expr, bool optimized = true) { +void verify(const TensorSpec &a, const TensorSpec &b, const std::string &expr, bool optimized = true) { verify_impl(a, b, expr, optimized); verify_impl(b, a, expr, optimized); } //----------------------------------------------------------------------------- -GenSpec gen_double(const vespalib::string &desc, int bias) { +GenSpec gen_double(const std::string &desc, int bias) { return GenSpec::from_desc(desc).cells(CellType::DOUBLE).seq(N(bias)); } -GenSpec gen_float(const vespalib::string &desc, int bias) { +GenSpec gen_float(const std::string &desc, int bias) { return GenSpec::from_desc(desc).cells(CellType::FLOAT).seq(N(bias)); } -GenSpec gen_int8(const vespalib::string &desc, int bias) { +GenSpec gen_int8(const std::string &desc, int bias) { return GenSpec::from_desc(desc).cells(CellType::INT8).seq(N(bias)); } -vespalib::string max_sim = "reduce(reduce(a*b,sum,d),max,b)"; -vespalib::string min_hamming = "reduce(reduce(hamming(a,b),sum,d),min,b)"; +std::string max_sim = "reduce(reduce(a*b,sum,d),max,b)"; +std::string min_hamming = "reduce(reduce(hamming(a,b),sum,d),min,b)"; //----------------------------------------------------------------------------- @@ -88,13 +88,13 @@ TEST(BestSimilarityFunctionTest, extra_trivial_dimensions_are_allowed) { } TEST(BestSimilarityFunctionTest, allow_full_reduce_for_outer_dimension) { - vespalib::string my_max_sim = "reduce(reduce(a*b,sum,d),max)"; - vespalib::string my_min_hamming = "reduce(reduce(hamming(a,b),sum,d),min)"; + std::string my_max_sim = "reduce(reduce(a*b,sum,d),max)"; + std::string my_min_hamming = "reduce(reduce(hamming(a,b),sum,d),min)"; verify(gen_float("d8", 3), gen_float("b5d8", 7), my_max_sim); verify(gen_int8("d8", 3), gen_int8("b5_2d8", 7), my_min_hamming); } -vespalib::string inv_max_sim = "reduce(reduce(a*b,sum,b),max,d)"; +std::string inv_max_sim = "reduce(reduce(a*b,sum,b),max,d)"; TEST(BestSimilarityFunctionTest, dimensions_can_be_inverted_if_best_dimension_is_sparse) { verify(gen_float("b8", 3), gen_float("b8d5_2", 7), inv_max_sim); @@ -108,7 +108,7 @@ TEST(BestSimilarityFunctionTest, cell_type_must_match_operation) { } TEST(BestSimilarityFunctionTest, similarity_must_use_1d_vector) { - vespalib::string max_sim_2d_dist = "reduce(reduce(a*b,sum,d,e),max,b)"; + std::string max_sim_2d_dist = "reduce(reduce(a*b,sum,d,e),max,b)"; verify(gen_float("d8_1", 3), gen_float("b5d8_1", 7), max_sim, false); verify(gen_float("d8e1", 3), gen_float("b5d8e1", 7), max_sim_2d_dist, false); } @@ -119,7 +119,7 @@ TEST(BestSimilarityFunctionTest, similarity_dimension_must_be_inner) { } TEST(BestSimilarityFunctionTest, alternatives_must_use_a_single_dimension) { - vespalib::string max_sim_2d_best = "reduce(reduce(a*b,sum,d),max,a,b)"; + std::string max_sim_2d_best = "reduce(reduce(a*b,sum,d),max,a,b)"; verify(gen_float("d8", 3), gen_float("a1b5d8", 7), max_sim_2d_best, false); } @@ -140,10 +140,10 @@ TEST(BestSimilarityFunctionTest, secondary_tensor_must_not_contain_extra_nontriv //----------------------------------------------------------------------------- TEST(BestSimilarityFunctionTest, similar_expressions_are_not_optimized) { - vespalib::string other_join = "reduce(reduce(a+b,sum,d),max,b)"; - vespalib::string other_reduce = "reduce(reduce(a*b,min,d),max,b)"; - vespalib::string mismatch_best_sim = "reduce(reduce(a*b,sum,d),min,b)"; - vespalib::string mismatch_best_hamming = "reduce(reduce(hamming(a,b),sum,d),max,b)"; + std::string other_join = "reduce(reduce(a+b,sum,d),max,b)"; + std::string other_reduce = "reduce(reduce(a*b,min,d),max,b)"; + std::string mismatch_best_sim = "reduce(reduce(a*b,sum,d),min,b)"; + std::string mismatch_best_hamming = "reduce(reduce(hamming(a,b),sum,d),max,b)"; verify(gen_float("d8", 3), gen_float("b5d8", 7), other_join, false); verify(gen_float("d8", 3), gen_float("b5d8", 7), other_reduce, false); verify(gen_float("d8", 3), gen_float("b5d8", 7), mismatch_best_sim, false); diff --git a/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp b/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp index 97a84e2ccf24..d9c4f5f0499f 100644 --- a/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp @@ -37,7 +37,7 @@ void check_gen_with_result(size_t l, size_t r, double wanted) { EvalFixture::ParamRepo param_repo; param_repo.add("a", makeTensor(l, leftBias)); param_repo.add("b", makeTensor(r, rightBias)); - vespalib::string expr = "reduce(a*b,sum,x)"; + std::string expr = "reduce(a*b,sum,x)"; EvalFixture evaluator(prod_factory, expr, param_repo, true); EXPECT_EQUAL(GenSpec(wanted).gen(), evaluator.result()); EXPECT_EQUAL(evaluator.result(), EvalFixture::ref(expr, param_repo)); @@ -93,14 +93,14 @@ struct FunInfo { }; -void assertOptimized(const vespalib::string &expr) { +void assertOptimized(const std::string &expr) { TEST_STATE(expr.c_str()); auto all_types = CellTypeSpace(CellTypeUtils::list_types(), 2); EvalFixture::verify(expr, {FunInfo{}}, all_types); } -void assertNotOptimized(const vespalib::string &expr) { +void assertNotOptimized(const std::string &expr) { TEST_STATE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); @@ -146,7 +146,7 @@ TEST("require that result must be double to trigger optimization") { TEST_DO(assertNotOptimized("reduce(x3y3$1*x3y3$2,sum,y)")); } -void verify_compatible(const vespalib::string &a, const vespalib::string &b) { +void verify_compatible(const std::string &a, const std::string &b) { auto a_type = ValueType::from_spec(a); auto b_type = ValueType::from_spec(b); EXPECT_TRUE(!a_type.is_error()); @@ -155,7 +155,7 @@ void verify_compatible(const vespalib::string &a, const vespalib::string &b) { EXPECT_TRUE(DenseDotProductFunction::compatible_types(ValueType::double_type(), b_type, a_type)); } -void verify_not_compatible(const vespalib::string &a, const vespalib::string &b) { +void verify_not_compatible(const std::string &a, const std::string &b) { auto a_type = ValueType::from_spec(a); auto b_type = ValueType::from_spec(b); EXPECT_TRUE(!a_type.is_error()); diff --git a/eval/src/tests/instruction/dense_hamming_distance/dense_hamming_distance_test.cpp b/eval/src/tests/instruction/dense_hamming_distance/dense_hamming_distance_test.cpp index 7d1f9bfc3d5c..ef877a5648a7 100644 --- a/eval/src/tests/instruction/dense_hamming_distance/dense_hamming_distance_test.cpp +++ b/eval/src/tests/instruction/dense_hamming_distance/dense_hamming_distance_test.cpp @@ -27,14 +27,14 @@ struct FunInfo { } }; -void assertOptimized(const vespalib::string &expr) { +void assertOptimized(const std::string &expr) { CellTypeSpace just_int8({CellType::INT8}, 2); EvalFixture::verify(expr, {FunInfo{}}, just_int8); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); } -void assertNotOptimized(const vespalib::string &expr) { +void assertNotOptimized(const std::string &expr) { CellTypeSpace just_int8({CellType::INT8}, 2); EvalFixture::verify(expr, {}, just_int8); } diff --git a/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp b/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp index 5a8aa8b41772..4baf7780007f 100644 --- a/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp +++ b/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp @@ -23,7 +23,7 @@ GenSpec::seq_t glb = [] (size_t) noexcept { EvalFixture::ParamRepo make_params() { EvalFixture::ParamRepo repo; - for (vespalib::string param : { + for (std::string param : { "x5$1", "x5$2", "x5$3", "x5y3$1", "x5y3$2", "@x5$1", "@x5$2", "@x5$3", @@ -40,7 +40,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify_optimized(const vespalib::string &expr, size_t param_idx) { +void verify_optimized(const std::string &expr, size_t param_idx) { EvalFixture fixture(prod_factory, expr, param_repo, true, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); for (size_t i = 0; i < fixture.num_params(); ++i) { @@ -55,19 +55,19 @@ void verify_optimized(const vespalib::string &expr, size_t param_idx) { } } -void verify_p0_optimized(const vespalib::string &expr) { +void verify_p0_optimized(const std::string &expr) { verify_optimized(expr, 0); } -void verify_p1_optimized(const vespalib::string &expr) { +void verify_p1_optimized(const std::string &expr) { verify_optimized(expr, 1); } -void verify_p2_optimized(const vespalib::string &expr) { +void verify_p2_optimized(const std::string &expr) { verify_optimized(expr, 2); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { EvalFixture fixture(prod_factory, expr, param_repo, true, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); for (size_t i = 0; i < fixture.num_params(); ++i) { diff --git a/eval/src/tests/instruction/dense_join_reduce_plan/dense_join_reduce_plan_test.cpp b/eval/src/tests/instruction/dense_join_reduce_plan/dense_join_reduce_plan_test.cpp index d59fe9dd6bdd..24a3f6196a62 100644 --- a/eval/src/tests/instruction/dense_join_reduce_plan/dense_join_reduce_plan_test.cpp +++ b/eval/src/tests/instruction/dense_join_reduce_plan/dense_join_reduce_plan_test.cpp @@ -7,7 +7,7 @@ using namespace vespalib; using namespace vespalib::eval; using namespace vespalib::eval::instruction; -ValueType type(const vespalib::string &type_spec) { +ValueType type(const std::string &type_spec) { return ValueType::from_spec(type_spec); } diff --git a/eval/src/tests/instruction/dense_matmul_function/dense_matmul_function_test.cpp b/eval/src/tests/instruction/dense_matmul_function/dense_matmul_function_test.cpp index 389929a76a2c..0f4017bb4fd2 100644 --- a/eval/src/tests/instruction/dense_matmul_function/dense_matmul_function_test.cpp +++ b/eval/src/tests/instruction/dense_matmul_function/dense_matmul_function_test.cpp @@ -33,13 +33,13 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr, FunInfo details) { +void verify_optimized(const std::string &expr, FunInfo details) { TEST_STATE(expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); EvalFixture::verify(expr, {details}, all_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { TEST_STATE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); diff --git a/eval/src/tests/instruction/dense_multi_matmul_function/dense_multi_matmul_function_test.cpp b/eval/src/tests/instruction/dense_multi_matmul_function/dense_multi_matmul_function_test.cpp index 4564288a9fd7..2fe13111d297 100644 --- a/eval/src/tests/instruction/dense_multi_matmul_function/dense_multi_matmul_function_test.cpp +++ b/eval/src/tests/instruction/dense_multi_matmul_function/dense_multi_matmul_function_test.cpp @@ -36,7 +36,7 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr, const FunInfo &details) +void verify_optimized(const std::string &expr, const FunInfo &details) { TEST_STATE(expr.c_str()); CellTypeSpace stable_types(CellTypeUtils::list_stable_types(), 2); @@ -46,7 +46,7 @@ void verify_optimized(const vespalib::string &expr, const FunInfo &details) EvalFixture::verify(expr, {}, std::move(unstable_types)); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { TEST_STATE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); diff --git a/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp b/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp index 13854972abd6..e85c983a5d4b 100644 --- a/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp +++ b/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp @@ -22,13 +22,13 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr, Inner inner) { +void verify_optimized(const std::string &expr, Inner inner) { SCOPED_TRACE(expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); EvalFixture::verify(expr, {FunInfo{inner}}, all_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); diff --git a/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp b/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp index e9055d876a71..8131cb1df106 100644 --- a/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp +++ b/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp @@ -31,19 +31,19 @@ struct ReduceSpec { } }; -void verify_not_optimized(const vespalib::string &expr, +void verify_not_optimized(const std::string &expr, std::vector with_cell_types = {CellType::DOUBLE}) { EvalFixture::verify(expr, {}, CellTypeSpace(with_cell_types, 1)); } -void verify_optimized(const vespalib::string &expr, const ReduceSpec &spec, +void verify_optimized(const std::string &expr, const ReduceSpec &spec, std::vector with_cell_types = CellTypeUtils::list_types()) { EvalFixture::verify(expr, {spec}, CellTypeSpace(with_cell_types, 1)); } -void verify_optimized(const vespalib::string &expr, const ReduceSpec &spec1, const ReduceSpec &spec2, +void verify_optimized(const std::string &expr, const ReduceSpec &spec1, const ReduceSpec &spec2, std::vector with_cell_types = CellTypeUtils::list_types()) { EvalFixture::verify(expr, {spec1, spec2}, CellTypeSpace(with_cell_types, 1)); @@ -101,7 +101,7 @@ TEST("require that non-simple aggregators cannot be decomposed into multiple red TEST_DO(verify_not_optimized("reduce(a2b3c4d5,median,a,c)")); } -void verify_optimized_multi(const vespalib::string &arg, const vespalib::string &dim, size_t outer_size, size_t reduce_size, size_t inner_size) { +void verify_optimized_multi(const std::string &arg, const std::string &dim, size_t outer_size, size_t reduce_size, size_t inner_size) { for (Aggr aggr: Aggregator::list()) { if (aggr != Aggr::PROD) { auto expr = fmt("reduce(%s,%s,%s)", arg.c_str(), AggrNames::name_of(aggr)->c_str(), dim.c_str()); diff --git a/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp b/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp index 5a6f84a4db58..c44422c2a697 100644 --- a/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp +++ b/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp @@ -24,7 +24,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify(const vespalib::string &expr, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { +void verify(const std::string &expr, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); diff --git a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp index 7d8c3dd54fd9..21df8405c644 100644 --- a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp +++ b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp @@ -30,7 +30,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify(const vespalib::string &expr, double expect, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { +void verify(const std::string &expr, double expect, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { EvalFixture fixture(prod_factory, expr, param_repo, true); auto expect_spec = TensorSpec("double").add({}, expect); EXPECT_EQUAL(EvalFixture::ref(expr, param_repo), expect_spec); diff --git a/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp b/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp index 70d29f67500e..190b74125e3d 100644 --- a/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp +++ b/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp @@ -29,19 +29,19 @@ struct FunInfo { } }; -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { EvalFixture::verify(expr, {}, CellTypeSpace({CellType::FLOAT}, 2)); } -void verify_optimized(const vespalib::string &expr, size_t vec_size, size_t res_size, bool happy) { +void verify_optimized(const std::string &expr, size_t vec_size, size_t res_size, bool happy) { EvalFixture::verify(expr, {{vec_size, res_size, happy}}, CellTypeSpace(CellTypeUtils::list_types(), 2)); } -vespalib::string make_expr(const vespalib::string &a, const vespalib::string &b, const vespalib::string &common) { +std::string make_expr(const std::string &a, const std::string &b, const std::string &common) { return make_string("reduce(%s*%s,sum,%s)", a.c_str(), b.c_str(), common.c_str()); } -void verify_optimized_multi(const vespalib::string &a, const vespalib::string &b, const vespalib::string &common, +void verify_optimized_multi(const std::string &a, const std::string &b, const std::string &common, size_t vec_size, size_t res_size, bool happy) { { diff --git a/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp b/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp index fcf37899cf30..7cd2f4abc050 100644 --- a/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp +++ b/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp @@ -23,12 +23,12 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { CellTypeSpace all_types(CellTypeUtils::list_types(), 1); EvalFixture::verify(expr, {FunInfo{}}, all_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace all_types(CellTypeUtils::list_types(), 1); EvalFixture::verify(expr, {}, all_types); } @@ -77,8 +77,8 @@ TEST(FastRenameTest, chained_optimized_renames_are_compacted_into_a_single_opera UNWIND_DO(verify_optimized("rename(rename(x5,x,y),y,z)")); } -bool is_stable(const vespalib::string &from_spec, const vespalib::string &to_spec, - const std::vector &from, const std::vector &to) +bool is_stable(const std::string &from_spec, const std::string &to_spec, + const std::vector &from, const std::vector &to) { auto from_type = ValueType::from_spec(from_spec); auto to_type = ValueType::from_spec(to_spec); diff --git a/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp b/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp index 7f25edd50c8f..6b1b0774c238 100644 --- a/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp +++ b/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp @@ -41,7 +41,7 @@ TensorSpec reference_peek(const TensorSpec ¶m, const PeekSpec &spec) { children.push_back(param); PeekSpec with_indexes; for (const auto & [dim_name, label_or_child] : spec) { - const vespalib::string &dim = dim_name; + const std::string &dim = dim_name; std::visit(vespalib::overload { [&](const TensorSpec::Label &label) { @@ -99,7 +99,7 @@ TensorSpec tensor_function_peek(const TensorSpec &a, const ValueType &result_typ std::vector my_stack; my_stack.push_back(*param); const auto &func_double = tensor_function::inject(ValueType::double_type(), 1, stash); - std::map> func_spec; + std::map> func_spec; for (auto & [dim_name, label_or_child] : spec) { if (std::holds_alternative(label_or_child)) { // here, label_or_child is a size_t specifying the value @@ -120,7 +120,7 @@ TensorSpec tensor_function_peek(const TensorSpec &a, const ValueType &result_typ return spec_from_value(single.eval(my_stack)); } -vespalib::string to_str(const PeekSpec &spec) { +std::string to_str(const PeekSpec &spec) { vespalib::asciistream os; os << "{ "; for (const auto & [dim, label_or_index] : spec) { @@ -145,7 +145,7 @@ void verify_peek_equal(const TensorSpec &input, const ValueBuilderFactory &factory) { ValueType param_type = ValueType::from_spec(input.type()); - std::vector reduce_dims; + std::vector reduce_dims; for (const auto & [dim_name, ignored] : spec) { reduce_dims.push_back(dim_name); } diff --git a/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp b/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp index 8d1bf00af48a..647e4feb42be 100644 --- a/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp +++ b/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp @@ -37,7 +37,7 @@ const std::vector layouts = { G().idx("x", 3).map("y", {}).idx("z", 7) }; -TensorSpec perform_generic_reduce(const TensorSpec &a, Aggr aggr, const std::vector &dims, +TensorSpec perform_generic_reduce(const TensorSpec &a, Aggr aggr, const std::vector &dims, const ValueBuilderFactory &factory) { Stash stash; diff --git a/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp b/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp index 47ae2049f65e..830c084eeb78 100644 --- a/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp +++ b/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp @@ -31,10 +31,10 @@ const std::vector rename_layouts = { }; struct FromTo { - std::vector from; - std::vector to; + std::vector from; + std::vector to; - FromTo(const std::vector& from_in, const std::vector& to_in) + FromTo(const std::vector& from_in, const std::vector& to_in) : from(from_in), to(to_in) { @@ -55,8 +55,8 @@ std::vector rename_from_to = { TEST(GenericRenameTest, dense_rename_plan_can_be_created_and_executed) { auto lhs = ValueType::from_spec("tensor(a[2],c[3],d{},e[5],g[7],h{})"); - std::vector from({"a", "c", "e"}); - std::vector to({"f", "a", "b"}); + std::vector from({"a", "c", "e"}); + std::vector to({"f", "a", "b"}); ValueType renamed = lhs.rename(from, to); auto plan = DenseRenamePlan(lhs, renamed, from, to); SmallVector expect_loop = {15,2,7}; @@ -85,8 +85,8 @@ TEST(GenericRenameTest, dense_rename_plan_can_be_created_and_executed) { TEST(GenericRenameTest, sparse_rename_plan_can_be_created) { auto lhs = ValueType::from_spec("tensor(a{},c{},d[3],e{},g{},h[5])"); - std::vector from({"a", "c", "e"}); - std::vector to({"f", "a", "b"}); + std::vector from({"a", "c", "e"}); + std::vector to({"f", "a", "b"}); ValueType renamed = lhs.rename(from, to); auto plan = SparseRenamePlan(lhs, renamed, from, to); EXPECT_EQ(plan.mapped_dims, 4); @@ -94,7 +94,7 @@ TEST(GenericRenameTest, sparse_rename_plan_can_be_created) { EXPECT_EQ(plan.output_dimensions, expect); } -vespalib::string rename_dimension(const vespalib::string &name, const FromTo &ft) { +std::string rename_dimension(const std::string &name, const FromTo &ft) { assert(ft.from.size() == ft.to.size()); for (size_t i = 0; i < ft.from.size(); ++i) { if (name == ft.from[i]) { diff --git a/eval/src/tests/instruction/inplace_map_function/inplace_map_function_test.cpp b/eval/src/tests/instruction/inplace_map_function/inplace_map_function_test.cpp index 9acafdff5d80..3601909b4229 100644 --- a/eval/src/tests/instruction/inplace_map_function/inplace_map_function_test.cpp +++ b/eval/src/tests/instruction/inplace_map_function/inplace_map_function_test.cpp @@ -25,7 +25,7 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace stable_types(CellTypeUtils::list_stable_types(), 1); CellTypeSpace unstable_types(CellTypeUtils::list_unstable_types(), 1); @@ -33,7 +33,7 @@ void verify_optimized(const vespalib::string &expr) { EvalFixture::verify(expr, {}, unstable_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 1); EvalFixture::verify(expr, {}, just_double); diff --git a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp index 06c59fbb3215..93e929acec96 100644 --- a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp +++ b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp @@ -48,7 +48,7 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr, Primary primary, bool pri_mut) { +void verify_optimized(const std::string &expr, Primary primary, bool pri_mut) { UNWIND_MSG("optimize %s", expr.c_str()); const CellTypeSpace stable_types(CellTypeUtils::list_stable_types(), 2); FunInfo stable_details{primary, pri_mut, pri_mut}; @@ -58,7 +58,7 @@ void verify_optimized(const vespalib::string &expr, Primary primary, bool pri_mu TEST_DO(EvalFixture::verify(expr, {unstable_details}, unstable_types)); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { UNWIND_MSG("not: %s", expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); TEST_DO(EvalFixture::verify(expr, {}, all_types)); @@ -122,8 +122,8 @@ TEST("require that mixed number join can be inplace") { } TEST("require that inappropriate cases are not optimized") { - for (vespalib::string lhs: {"y5", "x3_1z2_1", "x3_1y5z2_1"}) { - for (vespalib::string rhs: {"y5", "x3_1z2_1", "x3_1y5z2_1"}) { + for (std::string lhs: {"y5", "x3_1z2_1", "x3_1y5z2_1"}) { + for (std::string rhs: {"y5", "x3_1z2_1", "x3_1y5z2_1"}) { auto expr = fmt("%s$1*%s$2", lhs.c_str(), rhs.c_str()); verify_not_optimized(expr); } diff --git a/eval/src/tests/instruction/l2_distance/l2_distance_test.cpp b/eval/src/tests/instruction/l2_distance/l2_distance_test.cpp index 114f0c21b8ac..41df52227253 100644 --- a/eval/src/tests/instruction/l2_distance/l2_distance_test.cpp +++ b/eval/src/tests/instruction/l2_distance/l2_distance_test.cpp @@ -19,7 +19,7 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); //----------------------------------------------------------------------------- -void verify(const TensorSpec &a, const TensorSpec &b, const vespalib::string &expr, bool optimized = true) { +void verify(const TensorSpec &a, const TensorSpec &b, const std::string &expr, bool optimized = true) { EvalFixture::ParamRepo param_repo; param_repo.add("a", a).add("b", b); EvalFixture fast_fixture(prod_factory, expr, param_repo, true); @@ -27,7 +27,7 @@ void verify(const TensorSpec &a, const TensorSpec &b, const vespalib::string &ex EXPECT_EQ(fast_fixture.find_all().size(), optimized ? 1 : 0); } -void verify_cell_types(GenSpec a, GenSpec b, const vespalib::string &expr, bool optimized = true) { +void verify_cell_types(GenSpec a, GenSpec b, const std::string &expr, bool optimized = true) { for (CellType act : CellTypeUtils::list_types()) { for (CellType bct : CellTypeUtils::list_types()) { if (optimized && (act == bct) && (act != CellType::BFLOAT16)) { @@ -41,14 +41,14 @@ void verify_cell_types(GenSpec a, GenSpec b, const vespalib::string &expr, bool //----------------------------------------------------------------------------- -GenSpec gen(const vespalib::string &desc, int bias) { +GenSpec gen(const std::string &desc, int bias) { return GenSpec::from_desc(desc).cells(CellType::FLOAT).seq(N(bias)); } //----------------------------------------------------------------------------- -vespalib::string sq_l2 = "reduce((a-b)^2,sum)"; -vespalib::string alt_sq_l2 = "reduce(map((a-b),f(x)(x*x)),sum)"; +std::string sq_l2 = "reduce((a-b)^2,sum)"; +std::string alt_sq_l2 = "reduce(map((a-b),f(x)(x*x)),sum)"; //----------------------------------------------------------------------------- diff --git a/eval/src/tests/instruction/mapped_lookup/mapped_lookup_test.cpp b/eval/src/tests/instruction/mapped_lookup/mapped_lookup_test.cpp index b7c81c909cb1..685f28844c51 100644 --- a/eval/src/tests/instruction/mapped_lookup/mapped_lookup_test.cpp +++ b/eval/src/tests/instruction/mapped_lookup/mapped_lookup_test.cpp @@ -22,7 +22,7 @@ struct FunInfo { } }; -void verify_optimized_cell_types(const vespalib::string &expr) { +void verify_optimized_cell_types(const std::string &expr) { auto same_stable_types = CellTypeSpace(CellTypeUtils::list_stable_types(), 2).same(); auto same_unstable_types = CellTypeSpace(CellTypeUtils::list_unstable_types(), 2).same(); auto different_types = CellTypeSpace(CellTypeUtils::list_types(), 2).different(); @@ -31,12 +31,12 @@ void verify_optimized_cell_types(const vespalib::string &expr) { EvalFixture::verify(expr, {}, different_types); } -void verify_optimized(const vespalib::string &expr, bool expect_mutable = false) { +void verify_optimized(const std::string &expr, bool expect_mutable = false) { CellTypeSpace just_float({CellType::FLOAT}, 2); EvalFixture::verify(expr, {FunInfo(expect_mutable)}, just_float); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace just_float({CellType::FLOAT}, 2); EvalFixture::verify(expr, {}, just_float); } @@ -110,7 +110,7 @@ std::vector map_types_for(KeyType key_type) { TEST(MappedLookup, test_case_interactions) { for (bool mutable_map: {false, true}) { - vespalib::string expr = mutable_map ? "reduce(a*@b,sum,x)" : "reduce(a*b,sum,x)"; + std::string expr = mutable_map ? "reduce(a*@b,sum,x)" : "reduce(a*b,sum,x)"; for (KeyType key_type: {KeyType::EMPTY, KeyType::UNIT, KeyType::SCALING, KeyType::MULTI}) { auto key = make_key(key_type); for (MapType map_type: map_types_for(key_type)) { diff --git a/eval/src/tests/instruction/mixed_112_dot_product/mixed_112_dot_product_test.cpp b/eval/src/tests/instruction/mixed_112_dot_product/mixed_112_dot_product_test.cpp index ea4277315a78..d2c4ee1f7f7e 100644 --- a/eval/src/tests/instruction/mixed_112_dot_product/mixed_112_dot_product_test.cpp +++ b/eval/src/tests/instruction/mixed_112_dot_product/mixed_112_dot_product_test.cpp @@ -22,7 +22,7 @@ struct FunInfo { } }; -void verify_optimized_cell_types(const vespalib::string &expr) +void verify_optimized_cell_types(const std::string &expr) { CellTypeSpace stable(CellTypeUtils::list_stable_types(), 3); CellTypeSpace unstable(CellTypeUtils::list_unstable_types(), 3); @@ -31,13 +31,13 @@ void verify_optimized_cell_types(const vespalib::string &expr) EvalFixture::verify(expr, {}, unstable); } -void verify_optimized(const vespalib::string &expr, size_t num_params = 3) +void verify_optimized(const std::string &expr, size_t num_params = 3) { CellTypeSpace just_float({CellType::FLOAT}, num_params); EvalFixture::verify(expr, {FunInfo()}, just_float); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace just_double({CellType::DOUBLE}, 3); EvalFixture::verify(expr, {}, just_double); } @@ -55,7 +55,7 @@ TEST(Mixed112DotProduct, inverse_dimension_matching_is_handled) { TEST(Mixed112DotProduct, different_input_placement_is_handled) { - std::array params = {"x3_1", "y3", "x3_1y3"}; + std::array params = {"x3_1", "y3", "x3_1y3"}; for (size_t p1 = 0; p1 < params.size(); ++p1) { for (size_t p2 = 0; p2 < params.size(); ++p2) { for (size_t p3 = 0; p3 < params.size(); ++p3) { diff --git a/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp b/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp index d94840dd986c..c8bbc3d3dd68 100644 --- a/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp +++ b/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp @@ -29,21 +29,21 @@ struct FunInfo { } }; -void assert_mixed_optimized(const vespalib::string &expr) { +void assert_mixed_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); using MIP = FunInfo; EvalFixture::verify(expr, {MIP{}}, all_types); } -void assert_not_mixed_optimized(const vespalib::string &expr) { +void assert_not_mixed_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); using MIP = FunInfo; EvalFixture::verify(expr, {}, all_types); } -void assert_dense_optimized(const vespalib::string &expr) { +void assert_dense_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace all_types(CellTypeUtils::list_types(), 2); using MIP = FunInfo; diff --git a/eval/src/tests/instruction/mixed_l2_distance/mixed_l2_distance_test.cpp b/eval/src/tests/instruction/mixed_l2_distance/mixed_l2_distance_test.cpp index dab3af696096..b5bf08e5fa9d 100644 --- a/eval/src/tests/instruction/mixed_l2_distance/mixed_l2_distance_test.cpp +++ b/eval/src/tests/instruction/mixed_l2_distance/mixed_l2_distance_test.cpp @@ -27,7 +27,7 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); auto diff_types = CellTypeSpace(CellTypeUtils::list_types(), 2).different(); EvalFixture::verify(expr, {}, diff_types); @@ -35,7 +35,7 @@ void verify_optimized(const vespalib::string &expr) { EvalFixture::verify(expr, {FunInfo{false}}, same_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); diff --git a/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp b/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp index ab7854b0e279..c3282eea65a3 100644 --- a/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp +++ b/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp @@ -85,7 +85,7 @@ struct FunInfo { } }; -void verify_simple(const vespalib::string &expr, Primary primary, Overlap overlap, size_t factor, +void verify_simple(const std::string &expr, Primary primary, Overlap overlap, size_t factor, bool l_mut, bool r_mut, bool inplace) { TEST_STATE(expr.c_str()); @@ -96,7 +96,7 @@ void verify_simple(const vespalib::string &expr, Primary primary, Overlap overla EvalFixture::verify(expr, {details}, just_float); } -void verify_optimized(const vespalib::string &expr, Primary primary, Overlap overlap, size_t factor, +void verify_optimized(const std::string &expr, Primary primary, Overlap overlap, size_t factor, bool l_mut = false, bool r_mut = false, bool inplace = false) { TEST_STATE(expr.c_str()); @@ -105,7 +105,7 @@ void verify_optimized(const vespalib::string &expr, Primary primary, Overlap ove EvalFixture::verify(expr, {details}, all_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { TEST_STATE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 2); EvalFixture::verify(expr, {}, just_double); @@ -144,13 +144,13 @@ TEST("require that subset join with complex overlap is not optimized") { } struct LhsRhs { - vespalib::string lhs; - vespalib::string rhs; + std::string lhs; + std::string rhs; size_t lhs_size; size_t rhs_size; Overlap overlap; size_t factor; - LhsRhs(const vespalib::string &lhs_in, const vespalib::string &rhs_in, + LhsRhs(const std::string &lhs_in, const std::string &rhs_in, size_t lhs_size_in, size_t rhs_size_in, Overlap overlap_in) noexcept : lhs(lhs_in), rhs(rhs_in), lhs_size(lhs_size_in), rhs_size(rhs_size_in), overlap(overlap_in), factor(1) { diff --git a/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp b/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp index a04781b08dda..3c6068dc1eb7 100644 --- a/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp +++ b/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp @@ -29,7 +29,7 @@ struct InplaceInfo { } }; -void verify_optimized(const vespalib::string &expr, op1_t op1, bool inplace = false) { +void verify_optimized(const std::string &expr, op1_t op1, bool inplace = false) { SCOPED_TRACE(expr.c_str()); CellTypeSpace stable_types(CellTypeUtils::list_stable_types(), 1); if (inplace) { @@ -44,7 +44,7 @@ void verify_optimized(const vespalib::string &expr, op1_t op1, bool inplace = fa EvalFixture::verify(expr, {details}, unstable_types); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { SCOPED_TRACE(expr.c_str()); CellTypeSpace just_double({CellType::DOUBLE}, 1); EvalFixture::verify(expr, {}, just_double); @@ -71,7 +71,7 @@ TEST(PowAsMapTest, hypercubed_dense_tensor_is_not_optimized) { } TEST(PowAsMapTest, scalar_join_is_optimized) { - vespalib::string expr = "join(@$1,2.0,f(x,y)(pow(x,y)))"; + std::string expr = "join(@$1,2.0,f(x,y)(pow(x,y)))"; SCOPED_TRACE(expr.c_str()); MapInfo details{Square::f}; CellTypeSpace just_double({CellType::DOUBLE}, 1); diff --git a/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp b/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp index f816b0911707..6dee6b7e83d5 100644 --- a/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp +++ b/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp @@ -26,14 +26,14 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); EXPECT_EQUAL(info.size(), 1u); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); diff --git a/eval/src/tests/instruction/simple_join_count/simple_join_count_test.cpp b/eval/src/tests/instruction/simple_join_count/simple_join_count_test.cpp index df19bf42bf12..aedf38ddde6f 100644 --- a/eval/src/tests/instruction/simple_join_count/simple_join_count_test.cpp +++ b/eval/src/tests/instruction/simple_join_count/simple_join_count_test.cpp @@ -23,17 +23,17 @@ struct FunInfo { } }; -void verify_optimized_cell_types(const vespalib::string &expr, size_t expected_dense_factor = 1) { +void verify_optimized_cell_types(const std::string &expr, size_t expected_dense_factor = 1) { CellTypeSpace types(CellTypeUtils::list_types(), 2); EvalFixture::verify(expr, {FunInfo(expected_dense_factor)}, types); } -void verify_optimized(const vespalib::string &expr, size_t expected_dense_factor = 1) { +void verify_optimized(const std::string &expr, size_t expected_dense_factor = 1) { CellTypeSpace just_float({CellType::FLOAT}, 2); EvalFixture::verify(expr, {FunInfo(expected_dense_factor)}, just_float); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace just_float({CellType::FLOAT}, 2); EvalFixture::verify(expr, {}, just_float); } diff --git a/eval/src/tests/instruction/sparse_112_dot_product/sparse_112_dot_product_test.cpp b/eval/src/tests/instruction/sparse_112_dot_product/sparse_112_dot_product_test.cpp index ed5d5913cda3..4aa18f7c3f59 100644 --- a/eval/src/tests/instruction/sparse_112_dot_product/sparse_112_dot_product_test.cpp +++ b/eval/src/tests/instruction/sparse_112_dot_product/sparse_112_dot_product_test.cpp @@ -22,20 +22,20 @@ struct FunInfo { } }; -void verify_optimized_cell_types(const vespalib::string &expr) +void verify_optimized_cell_types(const std::string &expr) { CellTypeSpace types(CellTypeUtils::list_types(), 3); EvalFixture::verify(expr, {FunInfo()}, CellTypeSpace(types).same()); EvalFixture::verify(expr, {}, CellTypeSpace(types).different()); } -void verify_optimized(const vespalib::string &expr, size_t num_params = 3) +void verify_optimized(const std::string &expr, size_t num_params = 3) { CellTypeSpace just_float({CellType::FLOAT}, num_params); EvalFixture::verify(expr, {FunInfo()}, just_float); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace just_double({CellType::DOUBLE}, 3); EvalFixture::verify(expr, {}, just_double); } @@ -49,7 +49,7 @@ TEST(Sparse112DotProduct, expression_can_be_optimized) TEST(Sparse112DotProduct, different_input_placement_is_handled) { - std::array params = {"x3_1", "y3_1", "x3_1y3_1"}; + std::array params = {"x3_1", "y3_1", "x3_1y3_1"}; for (size_t p1 = 0; p1 < params.size(); ++p1) { for (size_t p2 = 0; p2 < params.size(); ++p2) { for (size_t p3 = 0; p3 < params.size(); ++p3) { diff --git a/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp b/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp index 68c689db5f89..949ffc5e0087 100644 --- a/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp @@ -27,7 +27,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void assert_optimized(const vespalib::string &expr) { +void assert_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EvalFixture test_fixture(test_factory, expr, param_repo, true); EvalFixture slow_fixture(prod_factory, expr, param_repo, false); @@ -39,7 +39,7 @@ void assert_optimized(const vespalib::string &expr) { EXPECT_EQ(slow_fixture.find_all().size(), 0u); } -void assert_not_optimized(const vespalib::string &expr) { +void assert_not_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EXPECT_EQ(fast_fixture.result(), EvalFixture::ref(expr, param_repo)); EXPECT_EQ(fast_fixture.find_all().size(), 0u); diff --git a/eval/src/tests/instruction/sparse_full_overlap_join_function/sparse_full_overlap_join_function_test.cpp b/eval/src/tests/instruction/sparse_full_overlap_join_function/sparse_full_overlap_join_function_test.cpp index b96fe4892abe..cb466bc54daa 100644 --- a/eval/src/tests/instruction/sparse_full_overlap_join_function/sparse_full_overlap_join_function_test.cpp +++ b/eval/src/tests/instruction/sparse_full_overlap_join_function/sparse_full_overlap_join_function_test.cpp @@ -29,7 +29,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void assert_optimized(const vespalib::string &expr) { +void assert_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EvalFixture test_fixture(test_factory, expr, param_repo, true); EvalFixture slow_fixture(prod_factory, expr, param_repo, false); @@ -41,7 +41,7 @@ void assert_optimized(const vespalib::string &expr) { EXPECT_EQ(slow_fixture.find_all().size(), 0u); } -void assert_not_optimized(const vespalib::string &expr) { +void assert_not_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EXPECT_EQ(fast_fixture.result(), EvalFixture::ref(expr, param_repo)); EXPECT_EQ(fast_fixture.find_all().size(), 0u); diff --git a/eval/src/tests/instruction/sparse_join_reduce_plan/sparse_join_reduce_plan_test.cpp b/eval/src/tests/instruction/sparse_join_reduce_plan/sparse_join_reduce_plan_test.cpp index a0b0d5af32a9..f5cb54ff554b 100644 --- a/eval/src/tests/instruction/sparse_join_reduce_plan/sparse_join_reduce_plan_test.cpp +++ b/eval/src/tests/instruction/sparse_join_reduce_plan/sparse_join_reduce_plan_test.cpp @@ -16,7 +16,7 @@ using namespace vespalib::eval::instruction; using Handle = vespalib::SharedStringRepo::Handle; -Value::UP val(const vespalib::string &value_desc) { +Value::UP val(const std::string &value_desc) { return value_from_spec(GenSpec::from_desc(value_desc), FastValueBuilderFactory::get()); } @@ -24,7 +24,7 @@ Handle make_handle(string_id id) { return Handle::handle_from_id(id); } -Handle make_handle(const vespalib::string &str) { +Handle make_handle(const std::string &str) { return Handle(str); } @@ -53,7 +53,7 @@ struct Trace { void add_raw(size_t lhs_idx, size_t rhs_idx, std::span res_addr) { events.emplace_back(lhs_idx, rhs_idx, res_addr); } - Trace &add(size_t lhs_idx, size_t rhs_idx, std::vector res_addr) { + Trace &add(size_t lhs_idx, size_t rhs_idx, std::vector res_addr) { events.emplace_back(lhs_idx, rhs_idx, res_addr); return *this; } @@ -86,8 +86,8 @@ operator<<(std::ostream &os, const Trace &trace) { Trace trace(size_t est) { return Trace(est); } -Trace trace(const vespalib::string &a_desc, const vespalib::string &b_desc, - const std::vector &reduce_dims) +Trace trace(const std::string &a_desc, const std::string &b_desc, + const std::vector &reduce_dims) { auto a = val(a_desc); auto b = val(b_desc); diff --git a/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp b/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp index 9c7917ff1b97..86e26598de73 100644 --- a/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp +++ b/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp @@ -29,7 +29,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void assert_optimized(const vespalib::string &expr) { +void assert_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EvalFixture test_fixture(test_factory, expr, param_repo, true); EvalFixture slow_fixture(prod_factory, expr, param_repo, false); @@ -41,7 +41,7 @@ void assert_optimized(const vespalib::string &expr) { EXPECT_EQ(slow_fixture.find_all().size(), 0u); } -void assert_not_optimized(const vespalib::string &expr) { +void assert_not_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EXPECT_EQ(fast_fixture.result(), EvalFixture::ref(expr, param_repo)); EXPECT_EQ(fast_fixture.find_all().size(), 0u); diff --git a/eval/src/tests/instruction/sparse_no_overlap_join_function/sparse_no_overlap_join_function_test.cpp b/eval/src/tests/instruction/sparse_no_overlap_join_function/sparse_no_overlap_join_function_test.cpp index 711395772f25..0e7cf266026f 100644 --- a/eval/src/tests/instruction/sparse_no_overlap_join_function/sparse_no_overlap_join_function_test.cpp +++ b/eval/src/tests/instruction/sparse_no_overlap_join_function/sparse_no_overlap_join_function_test.cpp @@ -27,7 +27,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void assert_optimized(const vespalib::string &expr) { +void assert_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EvalFixture test_fixture(test_factory, expr, param_repo, true); EvalFixture slow_fixture(prod_factory, expr, param_repo, false); @@ -39,7 +39,7 @@ void assert_optimized(const vespalib::string &expr) { EXPECT_EQ(slow_fixture.find_all().size(), 0u); } -void assert_not_optimized(const vespalib::string &expr) { +void assert_not_optimized(const std::string &expr) { EvalFixture fast_fixture(prod_factory, expr, param_repo, true); EXPECT_EQ(fast_fixture.result(), EvalFixture::ref(expr, param_repo)); EXPECT_EQ(fast_fixture.find_all().size(), 0u); diff --git a/eval/src/tests/instruction/sparse_singledim_lookup/sparse_singledim_lookup_test.cpp b/eval/src/tests/instruction/sparse_singledim_lookup/sparse_singledim_lookup_test.cpp index 80e39fd4f3e1..8fd3dbcbe458 100644 --- a/eval/src/tests/instruction/sparse_singledim_lookup/sparse_singledim_lookup_test.cpp +++ b/eval/src/tests/instruction/sparse_singledim_lookup/sparse_singledim_lookup_test.cpp @@ -22,12 +22,12 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr) { +void verify_optimized(const std::string &expr) { CellTypeSpace type_space(CellTypeUtils::list_types(), 1); EvalFixture::verify(expr, {FunInfo()}, type_space); } -void verify_not_optimized(const vespalib::string &expr) { +void verify_not_optimized(const std::string &expr) { CellTypeSpace just_float({CellType::FLOAT}, 1); EvalFixture::verify(expr, {}, just_float); } diff --git a/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp b/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp index 8b74d13e5bc9..3bd349ec1668 100644 --- a/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp @@ -15,7 +15,7 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); //----------------------------------------------------------------------------- -vespalib::string main_expr = "reduce(reduce(reduce(a*b,sum,z),max,y),sum,x)"; +std::string main_expr = "reduce(reduce(reduce(a*b,sum,z),max,y),sum,x)"; void assert_optimized(const TensorSpec &a, const TensorSpec &b, size_t dp_size) { EvalFixture::ParamRepo param_repo; @@ -31,7 +31,7 @@ void assert_optimized(const TensorSpec &a, const TensorSpec &b, size_t dp_size) EXPECT_EQ(info[0]->dp_size(), dp_size); } -void assert_not_optimized(const TensorSpec &a, const TensorSpec &b, const vespalib::string &expr = main_expr) { +void assert_not_optimized(const TensorSpec &a, const TensorSpec &b, const std::string &expr = main_expr) { EvalFixture::ParamRepo param_repo; param_repo.add("a", a); param_repo.add("b", b); @@ -91,8 +91,8 @@ TEST(SumMaxDotProduct, additional_dimensions_are_not_optimized) { auto extra_dense_query = Que().idx("a", 1); auto extra_sparse_document = Doc().map("a", 1); auto extra_dense_document = Doc().idx("a", 1); - vespalib::string extra_sum_expr = "reduce(reduce(reduce(a*b,sum,z),max,y),sum,a,x)"; - vespalib::string extra_max_expr = "reduce(reduce(reduce(a*b,sum,z),max,a,y),sum,x)"; + std::string extra_sum_expr = "reduce(reduce(reduce(a*b,sum,z),max,y),sum,a,x)"; + std::string extra_max_expr = "reduce(reduce(reduce(a*b,sum,z),max,a,y),sum,x)"; assert_not_optimized(extra_sparse_query, document); assert_not_optimized(extra_dense_query, document); assert_not_optimized(query, extra_sparse_document); @@ -112,9 +112,9 @@ TEST(SumMaxDotProduct, more_dense_variants_are_not_optimized) { } TEST(SumMaxDotProduct, similar_expressions_are_not_optimized) { - vespalib::string max_sum_expr = "reduce(reduce(reduce(a*b,sum,z),sum,y),max,x)"; - vespalib::string not_dp_expr1 = "reduce(reduce(reduce(a+b,sum,z),max,y),sum,x)"; - vespalib::string not_dp_expr2 = "reduce(reduce(reduce(a*b,min,z),max,y),sum,x)"; + std::string max_sum_expr = "reduce(reduce(reduce(a*b,sum,z),sum,y),max,x)"; + std::string not_dp_expr1 = "reduce(reduce(reduce(a+b,sum,z),max,y),sum,x)"; + std::string not_dp_expr2 = "reduce(reduce(reduce(a*b,min,z),max,y),sum,x)"; assert_not_optimized(query, document, max_sum_expr); assert_not_optimized(query, document, not_dp_expr1); assert_not_optimized(query, document, not_dp_expr2); diff --git a/eval/src/tests/instruction/universal_dot_product/universal_dot_product_test.cpp b/eval/src/tests/instruction/universal_dot_product/universal_dot_product_test.cpp index 99809601d9ad..b97b97dc1ca4 100644 --- a/eval/src/tests/instruction/universal_dot_product/universal_dot_product_test.cpp +++ b/eval/src/tests/instruction/universal_dot_product/universal_dot_product_test.cpp @@ -39,7 +39,7 @@ std::vector ns_list = { {"vespalib::eval::aggr::"}, {"vespalib::eval::"} }; -std::string strip_ns(const vespalib::string &str) { +std::string strip_ns(const std::string &str) { std::string tmp = str; for (const auto &ns: ns_list) { for (bool again = true; again;) { @@ -58,7 +58,7 @@ CellType always_double(size_t) { return CellType::DOUBLE; } select_cell_type_t select(CellType lct) { return [lct](size_t)noexcept{ return lct; }; } select_cell_type_t select(CellType lct, CellType rct) { return [lct,rct](size_t idx)noexcept{ return idx ? rct : lct; }; } -TensorSpec make_spec(const vespalib::string ¶m_name, size_t idx, select_cell_type_t select_cell_type) { +TensorSpec make_spec(const std::string ¶m_name, size_t idx, select_cell_type_t select_cell_type) { return GenSpec::from_desc(param_name).cells(select_cell_type(idx)).seq(N(1 + idx)); } @@ -77,19 +77,19 @@ class Optimize public: enum class With { NONE, CUSTOM, PROD, SPECIFIC }; With with; - vespalib::string name; + std::string name; OptimizeTensorFunctionOptions options; tensor_function_optimizer optimizer; - Optimize(With with_in, const vespalib::string name_in, + Optimize(With with_in, const std::string name_in, const OptimizeTensorFunctionOptions &options_in, tensor_function_optimizer optimizer_in, ctor_tag) : with(with_in), name(name_in), options(options_in), optimizer(optimizer_in) {} static Optimize none() { return {With::NONE, "none", {}, {}, {}}; } static Optimize prod() { return {With::PROD, "prod", {}, {}, {}}; } - static Optimize custom(const vespalib::string &name_in, const OptimizeTensorFunctionOptions &options_in) { + static Optimize custom(const std::string &name_in, const OptimizeTensorFunctionOptions &options_in) { return {With::CUSTOM, name_in, options_in, {}, {}}; } - static Optimize specific(const vespalib::string &name_in, tensor_function_optimizer optimizer_in) { + static Optimize specific(const std::string &name_in, tensor_function_optimizer optimizer_in) { return {With::SPECIFIC, name_in, {}, optimizer_in, {}}; } ~Optimize(); @@ -124,7 +124,7 @@ bool satisfies(bool actual, Trinary expect) { return (expect == Trinary::Undefined) || (actual == (expect == Trinary::True)); } -void verify(const vespalib::string &expr, select_cell_type_t select_cell_type, +void verify(const std::string &expr, select_cell_type_t select_cell_type, Trinary expect_forward, Trinary expect_distinct, Trinary expect_single) { ++verify_cnt; @@ -171,17 +171,17 @@ void verify(const vespalib::string &expr, select_cell_type_t select_cell_type, auto expected = eval_ref(*fun, select_cell_type); EXPECT_EQ(spec_from_value(actual), expected); } -void verify(const vespalib::string &expr) { +void verify(const std::string &expr) { verify(expr, always_double, Trinary::Undefined, Trinary::Undefined, Trinary::Undefined); } -void verify(const vespalib::string &expr, select_cell_type_t select_cell_type, bool forward, bool distinct, bool single) { +void verify(const std::string &expr, select_cell_type_t select_cell_type, bool forward, bool distinct, bool single) { verify(expr, select_cell_type, tri(forward), tri(distinct), tri(single)); } -using cost_list_t = std::vector>; -std::vector> benchmark_results; +using cost_list_t = std::vector>; +std::vector> benchmark_results; -void benchmark(const vespalib::string &expr, std::vector list) { +void benchmark(const std::string &expr, std::vector list) { verify(expr); auto fun = Function::parse(expr); ASSERT_FALSE(fun->has_error()); diff --git a/eval/src/tests/instruction/unpack_bits_function/unpack_bits_function_test.cpp b/eval/src/tests/instruction/unpack_bits_function/unpack_bits_function_test.cpp index a6f44831043a..660190859b60 100644 --- a/eval/src/tests/instruction/unpack_bits_function/unpack_bits_function_test.cpp +++ b/eval/src/tests/instruction/unpack_bits_function/unpack_bits_function_test.cpp @@ -22,7 +22,7 @@ auto vy8 = GenSpec().seq(my_seq).idx("y", 8).cells(CellType::INT8); auto vxf = GenSpec().seq(my_seq).idx("x", 8).cells(CellType::FLOAT); auto tmxy8 = GenSpec().seq(my_seq).idx("t", 1).idx("x", 3).idx("y", 4).cells(CellType::INT8); -void assert_expr(const GenSpec &spec, const vespalib::string &expr, bool optimized) { +void assert_expr(const GenSpec &spec, const std::string &expr, bool optimized) { EvalFixture::ParamRepo param_repo; param_repo.add("a", spec); EvalFixture fast_fixture(prod_factory, expr, param_repo, true); @@ -37,20 +37,20 @@ void assert_expr(const GenSpec &spec, const vespalib::string &expr, bool optimiz EXPECT_EQ(slow_fixture.find_all().size(), 0u); } -void assert_impl(const GenSpec &spec, const vespalib::string &expr, bool optimized) { +void assert_impl(const GenSpec &spec, const std::string &expr, bool optimized) { assert_expr(spec, expr, optimized); - vespalib::string wrapped_expr("map_subspaces(a,f(a)("); + std::string wrapped_expr("map_subspaces(a,f(a)("); wrapped_expr.append(expr); wrapped_expr.append("))"); assert_expr(spec, wrapped_expr, optimized); assert_expr(spec.cpy().map("m", {"foo", "bar", "baz"}), wrapped_expr, optimized); } -void assert_optimized(const GenSpec &spec, const vespalib::string &expr) { +void assert_optimized(const GenSpec &spec, const std::string &expr) { assert_impl(spec, expr, true); } -void assert_not_optimized(const GenSpec &spec, const vespalib::string &expr) { +void assert_not_optimized(const GenSpec &spec, const std::string &expr) { assert_impl(spec, expr, false); } diff --git a/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp b/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp index 65cc8ec00558..44d108b54751 100644 --- a/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp +++ b/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp @@ -26,7 +26,7 @@ EvalFixture::ParamRepo make_params() { } EvalFixture::ParamRepo param_repo = make_params(); -void verify(const vespalib::string &expr, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { +void verify(const std::string &expr, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { EvalFixture fixture(prod_factory, expr, param_repo, true); EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo)); auto info = fixture.find_all(); diff --git a/eval/src/tests/streamed/value/streamed_value_test.cpp b/eval/src/tests/streamed/value/streamed_value_test.cpp index b6fbbbf5e336..072c6564edf3 100644 --- a/eval/src/tests/streamed/value/streamed_value_test.cpp +++ b/eval/src/tests/streamed/value/streamed_value_test.cpp @@ -21,7 +21,7 @@ using CPA = std::vector; using Handle = SharedStringRepo::Handle; -vespalib::string as_str(string_id label) { return Handle::string_from_id(label); } +std::string as_str(string_id label) { return Handle::string_from_id(label); } GenSpec G() { return GenSpec(); } @@ -96,8 +96,8 @@ TEST(StreamedValueTest, streamed_value_can_be_built_and_inspected) { const auto &factory = StreamedValueBuilderFactory::get(); std::unique_ptr> builder = factory.create_value_builder(type); float seq = 0.0; - for (vespalib::string x: {"a", "b", "c"}) { - for (vespalib::string y: {"aa", "bb"}) { + for (std::string x: {"a", "b", "c"}) { + for (std::string y: {"aa", "bb"}) { std::vector addr = {x, y}; auto subspace = builder->add_subspace(addr); EXPECT_EQ(subspace.size(), 2); @@ -115,7 +115,7 @@ TEST(StreamedValueTest, streamed_value_can_be_built_and_inspected) { string_id query = query_handle.id(); string_id label; size_t subspace; - std::map result; + std::map result; view->lookup(CPA{&query}); while (view->next_result(PA{&label}, subspace)) { result[as_str(label)] = subspace; diff --git a/eval/src/tests/tensor/binary_format/binary_format_test.cpp b/eval/src/tests/tensor/binary_format/binary_format_test.cpp index f478a74fb177..e4ea3e580d90 100644 --- a/eval/src/tests/tensor/binary_format/binary_format_test.cpp +++ b/eval/src/tests/tensor/binary_format/binary_format_test.cpp @@ -21,21 +21,21 @@ using namespace vespalib::slime::convenience; using vespalib::make_string_short::fmt; -vespalib::string get_source_dir() { +std::string get_source_dir() { const char *dir = getenv("SOURCE_DIRECTORY"); return (dir ? dir : "."); } -vespalib::string source_dir = get_source_dir(); -vespalib::string module_src_path = source_dir + "/../../../../"; -vespalib::string module_build_path = "../../../../"; +std::string source_dir = get_source_dir(); +std::string module_src_path = source_dir + "/../../../../"; +std::string module_build_path = "../../../../"; const ValueBuilderFactory &simple = SimpleValueBuilderFactory::get(); const ValueBuilderFactory &streamed = StreamedValueBuilderFactory::get(); const ValueBuilderFactory &fast = FastValueBuilderFactory::get(); TEST(TensorBinaryFormatTest, tensor_binary_format_test_spec_can_be_generated) { - vespalib::string spec = module_src_path + "src/apps/make_tensor_binary_format_test_spec/test_spec.json"; - vespalib::string binary = module_build_path + "src/apps/make_tensor_binary_format_test_spec/eval_make_tensor_binary_format_test_spec_app"; + std::string spec = module_src_path + "src/apps/make_tensor_binary_format_test_spec/test_spec.json"; + std::string binary = module_build_path + "src/apps/make_tensor_binary_format_test_spec/eval_make_tensor_binary_format_test_spec_app"; EXPECT_EQ(system(fmt("%s > binary_test_spec.json", binary.c_str()).c_str()), 0); EXPECT_EQ(system(fmt("diff -u %s binary_test_spec.json", spec.c_str()).c_str()), 0); } @@ -125,7 +125,7 @@ void test_binary_format_spec(Cursor &test) { } TEST(TensorBinaryFormatTest, tensor_binary_format_test_spec) { - vespalib::string path = module_src_path; + std::string path = module_src_path; path.append("src/apps/make_tensor_binary_format_test_spec/test_spec.json"); MappedFileInput file(path); EXPECT_TRUE(file.valid()); diff --git a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp index 733acbc09bf3..f6063d41989c 100644 --- a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp +++ b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp @@ -70,9 +70,9 @@ test::GenSpec GS(double bias) { return test::GenSpec(bias).cells_float(); } // helper class used to set up peek instructions struct MyPeekSpec { bool is_dynamic; - std::map spec; + std::map spec; MyPeekSpec(bool is_dynamic_in) : is_dynamic(is_dynamic_in), spec() {} - MyPeekSpec &add(const vespalib::string &dim, size_t index) { + MyPeekSpec &add(const std::string &dim, size_t index) { auto [ignore, was_inserted] = spec.emplace(dim, index); assert(was_inserted); return *this; @@ -111,11 +111,11 @@ Instruction compile_op1_chain(const TensorFunction &node, const ValueBuilderFact struct Impl { size_t order; - vespalib::string name; - vespalib::string short_name; + std::string name; + std::string short_name; const ValueBuilderFactory &factory; bool optimize; - Impl(size_t order_in, const vespalib::string &name_in, const vespalib::string &short_name_in, const ValueBuilderFactory &factory_in, bool optimize_in) + Impl(size_t order_in, const std::string &name_in, const std::string &short_name_in, const ValueBuilderFactory &factory_in, bool optimize_in) : order(order_in), name(name_in), short_name(short_name_in), factory(factory_in), optimize(optimize_in) {} Value::UP create_value(const TensorSpec &spec) const { return value_from_spec(spec, factory); } TensorSpec create_spec(const Value &value) const { return spec_from_value(value); } @@ -127,7 +127,7 @@ struct Impl { const auto &node = optimize ? optimize_tensor_function(factory, join_node, stash) : join_node; return node.compile_self(factory, stash); } - Instruction create_reduce(const ValueType &lhs, Aggr aggr, const std::vector &dims, Stash &stash) const { + Instruction create_reduce(const ValueType &lhs, Aggr aggr, const std::vector &dims, Stash &stash) const { // create a complete tensor function, but only compile the relevant instruction const auto &lhs_node = tensor_function::inject(lhs, 0, stash); const auto &reduce_node = tensor_function::reduce(lhs_node, aggr, dims, stash); @@ -137,7 +137,7 @@ struct Impl { // instructions into a single compound instruction. return compile_op1_chain(node, factory, stash); } - Instruction create_rename(const ValueType &lhs, const std::vector &from, const std::vector &to, Stash &stash) const { + Instruction create_rename(const ValueType &lhs, const std::vector &from, const std::vector &to, Stash &stash) const { // create a complete tensor function, but only compile the relevant instruction const auto &lhs_node = tensor_function::inject(lhs, 0, stash); const auto &rename_node = tensor_function::rename(lhs_node, from, to, stash); @@ -183,7 +183,7 @@ struct Impl { std::vector arg_types(type.dimensions().size(), ValueType::double_type()); arg_types.push_back(p0_type); NodeTypes types(function, arg_types); - EXPECT_EQ(types.errors(), std::vector()); + EXPECT_EQ(types.errors(), std::vector()); const auto &tensor_lambda_node = tensor_function::lambda(type, {0}, function, std::move(types), stash); const auto &node = optimize ? optimize_tensor_function(factory, tensor_lambda_node, stash) : tensor_lambda_node; return node.compile_self(factory, stash); @@ -191,7 +191,7 @@ struct Impl { Instruction create_tensor_peek(const ValueType &type, const MyPeekSpec &my_spec, Stash &stash) const { // create a complete tensor function, but only compile the relevant instruction const auto &my_param = tensor_function::inject(type, 0, stash); - std::map> spec; + std::map> spec; if (my_spec.is_dynamic) { const auto &my_double = tensor_function::inject(ValueType::double_type(), 1, stash); for (const auto &entry: my_spec.spec) { @@ -219,9 +219,9 @@ struct Impl { Impl optimized_fast_value_impl(0, " Optimized FastValue", "NEW PROD", FastValueBuilderFactory::get(), true); Impl fast_value_impl(1, " FastValue", " FastV", FastValueBuilderFactory::get(), false); Impl simple_value_impl(2, " SimpleValue", " SimpleV", SimpleValueBuilderFactory::get(), false); -vespalib::string short_header("--------"); -vespalib::string ghost_name(" loaded from ghost.json"); -vespalib::string ghost_short_name(" ghost"); +std::string short_header("--------"); +std::string ghost_name(" loaded from ghost.json"); +std::string ghost_short_name(" ghost"); double budget = 5.0; constexpr double best_limit = 0.95; // everything within 95% of best performance gets a star @@ -239,7 +239,7 @@ Slime prod_result; // saved to 'result.json' //----------------------------------------------------------------------------- struct BenchmarkHeader { - std::vector short_names; + std::vector short_names; BenchmarkHeader() : short_names() { short_names.resize(impl_list.size()); for (const Impl &impl: impl_list) { @@ -249,7 +249,7 @@ struct BenchmarkHeader { short_names.push_back(ghost_short_name); } } - void print_header(const vespalib::string &desc) const { + void print_header(const std::string &desc) const { for (const auto &name: short_names) { fprintf(stderr, "|%s", name.c_str()); } @@ -264,11 +264,11 @@ struct BenchmarkHeader { }; struct BenchmarkResult { - vespalib::string desc; + std::string desc; std::optional ref_time; std::vector relative_perf; double star_rating; - BenchmarkResult(const vespalib::string &desc_in, size_t num_values) + BenchmarkResult(const std::string &desc_in, size_t num_values) : desc(desc_in), ref_time(std::nullopt), relative_perf(num_values, 0.0) {} BenchmarkResult(const BenchmarkResult&); BenchmarkResult(BenchmarkResult&&) noexcept = default; @@ -322,12 +322,12 @@ std::vector benchmark_results; //----------------------------------------------------------------------------- -void load_ghost(const vespalib::string &file_name) { +void load_ghost(const std::string &file_name) { MappedFileInput input(file_name); has_ghost = JsonFormat::decode(input, ghost); } -void save_result(const vespalib::string &file_name) { +void save_result(const std::string &file_name) { SmartBuffer output(4_Ki); JsonFormat::encode(prod_result, output, false); Memory memory = output.obtain(); @@ -432,7 +432,7 @@ struct EvalOp { //----------------------------------------------------------------------------- -void benchmark(const vespalib::string &desc, const std::vector &list) { +void benchmark(const std::string &desc, const std::vector &list) { fprintf(stderr, "--------------------------------------------------------\n"); fprintf(stderr, "Benchmark Case: [%s]\n", desc.c_str()); std::optional expect = std::nullopt; @@ -461,7 +461,7 @@ void benchmark(const vespalib::string &desc, const std::vector &list //----------------------------------------------------------------------------- -void benchmark_join(const vespalib::string &desc, const TensorSpec &lhs, +void benchmark_join(const std::string &desc, const TensorSpec &lhs, const TensorSpec &rhs, operation::op2_t function) { Stash stash; @@ -483,8 +483,8 @@ void benchmark_join(const vespalib::string &desc, const TensorSpec &lhs, //----------------------------------------------------------------------------- -void benchmark_reduce(const vespalib::string &desc, const TensorSpec &lhs, - Aggr aggr, const std::vector &dims) +void benchmark_reduce(const std::string &desc, const TensorSpec &lhs, + Aggr aggr, const std::vector &dims) { Stash stash; ValueType lhs_type = ValueType::from_spec(lhs.type()); @@ -503,9 +503,9 @@ void benchmark_reduce(const vespalib::string &desc, const TensorSpec &lhs, //----------------------------------------------------------------------------- -void benchmark_rename(const vespalib::string &desc, const TensorSpec &lhs, - const std::vector &from, - const std::vector &to) +void benchmark_rename(const std::string &desc, const TensorSpec &lhs, + const std::vector &from, + const std::vector &to) { Stash stash; ValueType lhs_type = ValueType::from_spec(lhs.type()); @@ -524,7 +524,7 @@ void benchmark_rename(const vespalib::string &desc, const TensorSpec &lhs, //----------------------------------------------------------------------------- -void benchmark_merge(const vespalib::string &desc, const TensorSpec &lhs, +void benchmark_merge(const std::string &desc, const TensorSpec &lhs, const TensorSpec &rhs, operation::op2_t function) { Stash stash; @@ -546,7 +546,7 @@ void benchmark_merge(const vespalib::string &desc, const TensorSpec &lhs, //----------------------------------------------------------------------------- -void benchmark_map(const vespalib::string &desc, const TensorSpec &lhs, operation::op1_t function) +void benchmark_map(const std::string &desc, const TensorSpec &lhs, operation::op1_t function) { Stash stash; ValueType lhs_type = ValueType::from_spec(lhs.type()); @@ -563,7 +563,7 @@ void benchmark_map(const vespalib::string &desc, const TensorSpec &lhs, operatio //----------------------------------------------------------------------------- -void benchmark_concat(const vespalib::string &desc, const TensorSpec &lhs, +void benchmark_concat(const std::string &desc, const TensorSpec &lhs, const TensorSpec &rhs, const std::string &dimension) { Stash stash; @@ -585,7 +585,7 @@ void benchmark_concat(const vespalib::string &desc, const TensorSpec &lhs, //----------------------------------------------------------------------------- -void benchmark_tensor_create(const vespalib::string &desc, const TensorSpec &proto) { +void benchmark_tensor_create(const std::string &desc, const TensorSpec &proto) { Stash stash; ValueType proto_type = ValueType::from_spec(proto.type()); ASSERT_FALSE(proto_type.is_error()); @@ -604,7 +604,7 @@ void benchmark_tensor_create(const vespalib::string &desc, const TensorSpec &pro //----------------------------------------------------------------------------- -void benchmark_tensor_lambda(const vespalib::string &desc, const ValueType &type, const TensorSpec &p0, const Function &function) { +void benchmark_tensor_lambda(const std::string &desc, const ValueType &type, const TensorSpec &p0, const Function &function) { Stash stash; ValueType p0_type = ValueType::from_spec(p0.type()); ASSERT_FALSE(p0_type.is_error()); @@ -619,7 +619,7 @@ void benchmark_tensor_lambda(const vespalib::string &desc, const ValueType &type //----------------------------------------------------------------------------- -void benchmark_tensor_peek(const vespalib::string &desc, const TensorSpec &lhs, const MyPeekSpec &peek_spec) { +void benchmark_tensor_peek(const std::string &desc, const TensorSpec &lhs, const MyPeekSpec &peek_spec) { Stash stash; ValueType type = ValueType::from_spec(lhs.type()); ASSERT_FALSE(type.is_error()); @@ -656,7 +656,7 @@ TEST(MakeInputTest, print_some_test_input) { //----------------------------------------------------------------------------- -void benchmark_encode_decode(const vespalib::string &desc, const TensorSpec &proto) { +void benchmark_encode_decode(const std::string &desc, const TensorSpec &proto) { ValueType proto_type = ValueType::from_spec(proto.type()); ASSERT_FALSE(proto_type.is_error()); for (const Impl &impl: impl_list) { @@ -1073,7 +1073,7 @@ TEST(TensorPeekBench, mixed_peek) { //----------------------------------------------------------------------------- -void print_results(const vespalib::string &desc, const std::vector &results) { +void print_results(const std::string &desc, const std::vector &results) { if (results.empty()) { return; } diff --git a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp index e5bb738de8c4..7393923cc1c7 100644 --- a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp +++ b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp @@ -510,7 +510,7 @@ TEST(OnnxModelCacheTest, share_and_evict_onnx_models) { EXPECT_EQ(OnnxModelCache::count_refs(), 0); } -TensorSpec val(const vespalib::string &expr) { +TensorSpec val(const std::string &expr) { auto result = TensorSpec::from_expr(expr); EXPECT_FALSE(ValueType::from_spec(result.type()).is_error()); return result; diff --git a/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp b/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp index c263e6d7dda3..cd24f4c7a696 100644 --- a/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp +++ b/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp @@ -10,11 +10,11 @@ using vespalib::Slime; using vespalib::slime::JsonFormat; using vespalib::MappedFileInput; -vespalib::string module_build_path("../../../../"); +std::string module_build_path("../../../../"); TEST("require that (some) cross-language tensor conformance tests pass with C++ expression evaluation") { - vespalib::string result_file = "conformance_result.json"; - vespalib::string binary = module_build_path + "src/apps/tensor_conformance/vespa-tensor-conformance"; + std::string result_file = "conformance_result.json"; + std::string binary = module_build_path + "src/apps/tensor_conformance/vespa-tensor-conformance"; EXPECT_EQUAL(system(fmt("%s generate-some | %s evaluate | %s verify > %s", binary.c_str(), binary.c_str(), binary.c_str(), result_file.c_str()).c_str()), 0); Slime result; MappedFileInput input(result_file); diff --git a/eval/src/vespa/eval/eval/aggr.cpp b/eval/src/vespa/eval/eval/aggr.cpp index ebb8ab4d6b1e..5bf0e4e5633c 100644 --- a/eval/src/vespa/eval/eval/aggr.cpp +++ b/eval/src/vespa/eval/eval/aggr.cpp @@ -25,7 +25,7 @@ struct Wrapper final : Aggregator { const AggrNames AggrNames::_instance; void -AggrNames::add(Aggr aggr, const vespalib::string &name) +AggrNames::add(Aggr aggr, const std::string &name) { _name_aggr_map[name] = aggr; _aggr_name_map[aggr] = name; @@ -44,7 +44,7 @@ AggrNames::AggrNames() add(Aggr::MIN, "min"); } -const vespalib::string * +const std::string * AggrNames::name_of(Aggr aggr) { const auto &map = _instance._aggr_name_map; @@ -56,7 +56,7 @@ AggrNames::name_of(Aggr aggr) } const Aggr * -AggrNames::from_name(const vespalib::string &name) +AggrNames::from_name(const std::string &name) { const auto &map = _instance._name_aggr_map; auto result = map.find(name); diff --git a/eval/src/vespa/eval/eval/aggr.h b/eval/src/vespa/eval/eval/aggr.h index 47ee9ecb2bb7..e9ce3256dd4b 100644 --- a/eval/src/vespa/eval/eval/aggr.h +++ b/eval/src/vespa/eval/eval/aggr.h @@ -3,12 +3,12 @@ #pragma once #include -#include -#include -#include -#include #include #include +#include +#include +#include +#include namespace vespalib { class Stash; } @@ -28,13 +28,13 @@ enum class Aggr { AVG, COUNT, PROD, SUM, MAX, MEDIAN, MIN }; class AggrNames { private: static const AggrNames _instance; - std::map _name_aggr_map; - std::map _aggr_name_map; - void add(Aggr aggr, const vespalib::string &name); + std::map _name_aggr_map; + std::map _aggr_name_map; + void add(Aggr aggr, const std::string &name); AggrNames(); public: - static const vespalib::string *name_of(Aggr aggr); - static const Aggr *from_name(const vespalib::string &name); + static const std::string *name_of(Aggr aggr); + static const Aggr *from_name(const std::string &name); }; /** diff --git a/eval/src/vespa/eval/eval/basic_nodes.cpp b/eval/src/vespa/eval/eval/basic_nodes.cpp index e529d3fc2d3a..7b9b9d6d079f 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.cpp +++ b/eval/src/vespa/eval/eval/basic_nodes.cpp @@ -23,14 +23,14 @@ struct Frame { } // namespace vespalib::eval::nodes:: -vespalib::string +std::string Number::dump(DumpContext &) const { return make_string("%g", _value); } -vespalib::string +std::string If::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "if("; str += _cond->dump(ctx); str += ","; diff --git a/eval/src/vespa/eval/eval/basic_nodes.h b/eval/src/vespa/eval/eval/basic_nodes.h index 196c8c32f163..f981dacd6ef0 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.h +++ b/eval/src/vespa/eval/eval/basic_nodes.h @@ -5,7 +5,6 @@ #include "value.h" #include "string_stuff.h" #include -#include #include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include namespace vespalib::eval { @@ -37,8 +37,8 @@ namespace nodes { * the names of bound values. **/ struct DumpContext { - const std::vector ¶m_names; - DumpContext(const std::vector ¶m_names_in) + const std::vector ¶m_names; + DumpContext(const std::vector ¶m_names_in) : param_names(param_names_in) {} }; @@ -54,7 +54,7 @@ struct Node { virtual double get_const_double_value() const; Value::UP get_const_value() const; void traverse(NodeTraverser &traverser) const; - virtual vespalib::string dump(DumpContext &ctx) const = 0; + virtual std::string dump(DumpContext &ctx) const = 0; virtual void accept(NodeVisitor &visitor) const = 0; virtual size_t num_children() const = 0; virtual const Node &get_child(size_t idx) const = 0; @@ -97,7 +97,7 @@ class Number : public Leaf { virtual bool is_const_double() const override { return true; } double get_const_double_value() const override { return value(); } double value() const { return _value; } - vespalib::string dump(DumpContext &) const override; + std::string dump(DumpContext &) const override; void accept(NodeVisitor &visitor) const override; }; @@ -108,7 +108,7 @@ class Symbol : public Leaf { explicit Symbol(size_t id_in) : _id(id_in) {} bool is_param() const override { return true; } size_t id() const { return _id; } - vespalib::string dump(DumpContext &ctx) const override { + std::string dump(DumpContext &ctx) const override { assert(size_t(_id) < ctx.param_names.size()); return ctx.param_names[_id]; } @@ -117,13 +117,13 @@ class Symbol : public Leaf { class String : public Leaf { private: - vespalib::string _value; + std::string _value; public: - String(const vespalib::string &value_in) : _value(value_in) {} + String(const std::string &value_in) : _value(value_in) {} bool is_const_double() const override { return true; } double get_const_double_value() const override { return hash2d(_value); } - const vespalib::string &value() const { return _value; } - vespalib::string dump(DumpContext &) const override { + const std::string &value() const { return _value; } + std::string dump(DumpContext &) const override { return as_quoted_string(_value); } void accept(NodeVisitor &visitor) const override; @@ -151,8 +151,8 @@ class In : public Node { void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; + std::string dump(DumpContext &ctx) const override { + std::string str; str += "("; str += _child->dump(ctx); str += " in ["; @@ -184,8 +184,8 @@ class Neg : public Node { void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; + std::string dump(DumpContext &ctx) const override { + std::string str; str += "(-"; str += _child->dump(ctx); str += ")"; @@ -211,8 +211,8 @@ class Not : public Node { void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; + std::string dump(DumpContext &ctx) const override { + std::string str; str += "(!"; str += _child->dump(ctx); str += ")"; @@ -253,17 +253,17 @@ class If : public Node { handler.handle(std::move(_true_expr)); handler.handle(std::move(_false_expr)); } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; }; class Error : public Leaf { private: - vespalib::string _message; + std::string _message; public: - Error(const vespalib::string &message_in) : _message(message_in) {} - const vespalib::string &message() const { return _message; } - vespalib::string dump(DumpContext &) const override { return _message; } + Error(const std::string &message_in) : _message(message_in) {} + const std::string &message() const { return _message; } + std::string dump(DumpContext &) const override { return _message; } void accept(NodeVisitor &visitor) const override; }; diff --git a/eval/src/vespa/eval/eval/call_nodes.h b/eval/src/vespa/eval/eval/call_nodes.h index 7998160eeecc..fe1b982f25bd 100644 --- a/eval/src/vespa/eval/eval/call_nodes.h +++ b/eval/src/vespa/eval/eval/call_nodes.h @@ -3,9 +3,9 @@ #pragma once #include "basic_nodes.h" -#include -#include #include +#include +#include namespace vespalib::eval { struct NodeVisitor; } @@ -18,16 +18,16 @@ namespace vespalib::eval::nodes { **/ class Call : public Node { private: - vespalib::string _name; + std::string _name; size_t _num_params; std::vector _args; bool _is_const_double; public: - Call(const vespalib::string &name_in, size_t num_params_in) + Call(const std::string &name_in, size_t num_params_in) : _name(name_in), _num_params(num_params_in), _is_const_double(false) {} ~Call(); bool is_const_double() const override { return _is_const_double; } - const vespalib::string &name() const { return _name; } + const std::string &name() const { return _name; } size_t num_params() const { return _num_params; } size_t num_args() const { return _args.size(); } const Node &arg(size_t i) const { return *_args[i]; } @@ -47,8 +47,8 @@ class Call : public Node { } _args.push_back(std::move(arg_in)); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; + std::string dump(DumpContext &ctx) const override { + std::string str; str += _name; str += "("; for (size_t i = 0; i < _args.size(); ++i) { @@ -73,21 +73,21 @@ class CallRepo { private: static CallRepo _instance; typedef nodes::Call_UP (*factory_type)(); - std::map _map; + std::map _map; template void add(const T &op) { _map[op.name()] = T::create; } CallRepo(); public: static const CallRepo &instance() { return _instance; } - nodes::Call_UP create(const vespalib::string &name) const { + nodes::Call_UP create(const std::string &name) const { auto result = _map.find(name); if (result != _map.end()) { return result->second(); } return nodes::Call_UP(nullptr); } - std::vector get_names() const { - std::vector ret; + std::vector get_names() const { + std::vector ret; for (const auto &entry: _map) { ret.push_back(entry.first); } @@ -100,7 +100,7 @@ class CallRepo { template struct CallHelper : Call { using Helper = CallHelper; - CallHelper(const vespalib::string &name_in, size_t num_params_in) + CallHelper(const std::string &name_in, size_t num_params_in) : Call(name_in, num_params_in) {} void accept(NodeVisitor &visitor) const override; static Call_UP create() { return Call_UP(new T()); } diff --git a/eval/src/vespa/eval/eval/compile_tensor_function.h b/eval/src/vespa/eval/eval/compile_tensor_function.h index f6edfe49052b..46a1e77c640f 100644 --- a/eval/src/vespa/eval/eval/compile_tensor_function.h +++ b/eval/src/vespa/eval/eval/compile_tensor_function.h @@ -25,10 +25,10 @@ struct TensorFunction; **/ struct CTFMetaData { struct Step { - vespalib::string class_name; - vespalib::string symbol_name; - Step(vespalib::string &&class_name_in, - vespalib::string &&symbol_name_in) noexcept + std::string class_name; + std::string symbol_name; + Step(std::string &&class_name_in, + std::string &&symbol_name_in) noexcept : class_name(std::move(class_name_in)), symbol_name(std::move(symbol_name_in)) { diff --git a/eval/src/vespa/eval/eval/fast_forest.cpp b/eval/src/vespa/eval/eval/fast_forest.cpp index c49cfeadd946..10379a219e99 100644 --- a/eval/src/vespa/eval/eval/fast_forest.cpp +++ b/eval/src/vespa/eval/eval/fast_forest.cpp @@ -134,11 +134,11 @@ template <> size_t get_lsb(uint16_t value) { return vespalib::Optimize // implementation using single value mask per tree //----------------------------------------------------------------------------- -template vespalib::string fixed_impl_name(); -template <> vespalib::string fixed_impl_name() { return "ff-fixed<8>"; } -template <> vespalib::string fixed_impl_name() { return "ff-fixed<16>"; } -template <> vespalib::string fixed_impl_name() { return "ff-fixed<32>"; } -template <> vespalib::string fixed_impl_name() { return "ff-fixed<64>"; } +template std::string fixed_impl_name(); +template <> std::string fixed_impl_name() { return "ff-fixed<8>"; } +template <> std::string fixed_impl_name() { return "ff-fixed<16>"; } +template <> std::string fixed_impl_name() { return "ff-fixed<32>"; } +template <> std::string fixed_impl_name() { return "ff-fixed<64>"; } template constexpr size_t max_leafs() { return (sizeof(T) * bits_per_byte); } @@ -197,7 +197,7 @@ struct FixedForest : FastForest { static void apply_masks(T *ctx_masks, const DMask *pos, const DMask *end); double get_result(const T *ctx_masks) const; - vespalib::string impl_name() const override { return fixed_impl_name(); } + std::string impl_name() const override { return fixed_impl_name(); } Context::UP create_context() const override; double eval(Context &context, const float *params) const override; }; @@ -437,7 +437,7 @@ struct MultiWordForest : FastForest { static size_t find_leaf(const uint32_t *ctx_words); double get_result(const uint32_t *ctx_words) const; - vespalib::string impl_name() const override { return "ff-multiword"; } + std::string impl_name() const override { return "ff-multiword"; } Context::UP create_context() const override; double eval(Context &context, const float *params) const override; }; diff --git a/eval/src/vespa/eval/eval/fast_forest.h b/eval/src/vespa/eval/eval/fast_forest.h index 7931f19858db..b520ea786a1d 100644 --- a/eval/src/vespa/eval/eval/fast_forest.h +++ b/eval/src/vespa/eval/eval/fast_forest.h @@ -33,7 +33,7 @@ class FastForest using UP = std::unique_ptr; }; static UP try_convert(const Function &fun, size_t min_fixed = 8, size_t max_fixed = 64); - virtual vespalib::string impl_name() const = 0; + virtual std::string impl_name() const = 0; virtual Context::UP create_context() const = 0; virtual double eval(Context &context, const float *params) const = 0; double estimate_cost_us(const std::vector ¶ms, double budget = 5.0) const; diff --git a/eval/src/vespa/eval/eval/feature_name_extractor.cpp b/eval/src/vespa/eval/eval/feature_name_extractor.cpp index f43b720d8eb1..438888519afb 100644 --- a/eval/src/vespa/eval/eval/feature_name_extractor.cpp +++ b/eval/src/vespa/eval/eval/feature_name_extractor.cpp @@ -57,7 +57,7 @@ struct CountParen { void FeatureNameExtractor::extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const + const char *&pos_out, std::string &symbol_out) const { while ((pos_in < end_in) && prefix.is_legal(*pos_in)) { symbol_out.push_back(*pos_in++); diff --git a/eval/src/vespa/eval/eval/feature_name_extractor.h b/eval/src/vespa/eval/eval/feature_name_extractor.h index 7ff44375193e..93c8f746b1b2 100644 --- a/eval/src/vespa/eval/eval/feature_name_extractor.h +++ b/eval/src/vespa/eval/eval/feature_name_extractor.h @@ -12,7 +12,7 @@ namespace vespalib::eval { **/ struct FeatureNameExtractor : public vespalib::eval::SymbolExtractor { void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const override; + const char *&pos_out, std::string &symbol_out) const override; }; } diff --git a/eval/src/vespa/eval/eval/function.cpp b/eval/src/vespa/eval/eval/function.cpp index 5d89db3af0bc..dd40e533ddb4 100644 --- a/eval/src/vespa/eval/eval/function.cpp +++ b/eval/src/vespa/eval/eval/function.cpp @@ -21,7 +21,7 @@ using nodes::Call_UP; namespace { -bool has_duplicates(const std::vector &list) { +bool has_duplicates(const std::vector &list) { for (size_t i = 0; i < list.size(); ++i) { for (size_t j = (i + 1); j < list.size(); ++j) { if (list[i] == list[j]) { @@ -36,13 +36,13 @@ bool has_duplicates(const std::vector &list) { class Params { private: - std::map _params; + std::map _params; protected: - size_t lookup(const vespalib::string &token) const { + size_t lookup(const std::string &token) const { auto result = _params.find(token); return (result == _params.end()) ? UNDEF : result->second; } - size_t lookup_add(const vespalib::string &token) { + size_t lookup_add(const std::string &token) { size_t result = lookup(token); if (result == UNDEF) { result = _params.size(); @@ -53,9 +53,9 @@ class Params { public: static const size_t UNDEF = -1; virtual bool implicit() const = 0; - virtual size_t resolve(const vespalib::string &token) const = 0; - std::vector extract() const { - std::vector params_out; + virtual size_t resolve(const std::string &token) const = 0; + std::vector extract() const { + std::vector params_out; params_out.resize(_params.size()); for (const auto &item: _params) { params_out[item.second] = item.first; @@ -66,28 +66,28 @@ class Params { }; struct ExplicitParams : Params { - explicit ExplicitParams(const std::vector ¶ms_in) { + explicit ExplicitParams(const std::vector ¶ms_in) { for (const auto ¶m: params_in) { assert(lookup(param) == UNDEF); lookup_add(param); } } bool implicit() const override { return false; } - size_t resolve(const vespalib::string &token) const override { + size_t resolve(const std::string &token) const override { return lookup(token); } }; struct ImplicitParams : Params { ImplicitParams() = default; - explicit ImplicitParams(const std::vector ¶ms_in) { + explicit ImplicitParams(const std::vector ¶ms_in) { for (const auto ¶m: params_in) { assert(lookup(param) == UNDEF); lookup_add(param); } } bool implicit() const override { return true; } - size_t resolve(const vespalib::string &token) const override { + size_t resolve(const std::string &token) const override { return const_cast(this)->lookup_add(token); } }; @@ -108,8 +108,8 @@ class ParseContext const char *_pos; const char *_end; char _curr; - vespalib::string _scratch; - vespalib::string _failure; + std::string _scratch; + std::string _failure; std::vector _expression_stack; std::vector _operator_stack; size_t _operator_mark; @@ -159,7 +159,7 @@ class ParseContext assert(!_resolve_stack.empty()); } - void fail(const vespalib::string &msg) { + void fail(const std::string &msg) { if (_failure.empty()) { _failure = msg; _curr = 0; @@ -196,11 +196,11 @@ class ParseContext next(); } } - vespalib::string &scratch() { + std::string &scratch() { _scratch.clear(); return _scratch; } - vespalib::string &peek(vespalib::string &str, size_t n) { + std::string &peek(std::string &str, size_t n) { const char *p = _pos; for (size_t i = 0; i < n; ++i, ++p) { if (_curr != 0 && p < _end) { @@ -217,11 +217,11 @@ class ParseContext } } - size_t resolve_parameter(const vespalib::string &name) const { + size_t resolve_parameter(const std::string &name) const { return resolver().params.resolve(name); } - void extract_symbol(vespalib::string &symbol_out, InputMark before_symbol) { + void extract_symbol(std::string &symbol_out, InputMark before_symbol) { if (resolver().symbol_extractor == nullptr) { return; } @@ -244,8 +244,8 @@ class ParseContext fail("incomplete parse"); } if (!_failure.empty()) { - vespalib::string before(_begin, (_pos - _begin)); - vespalib::string after(_pos, (_end - _pos)); + std::string before(_begin, (_pos - _begin)); + std::string after(_pos, (_end - _pos)); return Node_UP(new nodes::Error(make_string("[%s]...[%s]...[%s]", before.c_str(), _failure.c_str(), after.c_str()))); } @@ -342,7 +342,7 @@ int unhex(char c) { return -1; } -void extract_quoted_string(ParseContext &ctx, vespalib::string &str, char quote) { +void extract_quoted_string(ParseContext &ctx, std::string &str, char quote) { ctx.eat(quote); while (!ctx.eos() && (ctx.get() != quote)) { if (ctx.get() == '\\') { @@ -377,13 +377,13 @@ void extract_quoted_string(ParseContext &ctx, vespalib::string &str, char quote) } void parse_string(ParseContext &ctx, char quote) { - vespalib::string &str = ctx.scratch(); + std::string &str = ctx.scratch(); extract_quoted_string(ctx, str, quote); ctx.push_expression(Node_UP(new nodes::String(str))); } void parse_number(ParseContext &ctx) { - vespalib::string &str = ctx.scratch(); + std::string &str = ctx.scratch(); str.push_back(ctx.get()); ctx.next(); while (ctx.get() >= '0' && ctx.get() <= '9') { @@ -429,9 +429,9 @@ bool is_ident(char c, bool first) { (c == '$' && !first)); } -vespalib::string get_ident(ParseContext &ctx, bool allow_empty) { +std::string get_ident(ParseContext &ctx, bool allow_empty) { ctx.skip_spaces(); - vespalib::string ident; + std::string ident; if (is_ident(ctx.get(), true)) { ident.push_back(ctx.get()); for (ctx.next(); is_ident(ctx.get(), false); ctx.next()) { @@ -446,7 +446,7 @@ vespalib::string get_ident(ParseContext &ctx, bool allow_empty) { size_t get_size_t(ParseContext &ctx) { ctx.skip_spaces(); - vespalib::string num; + std::string num; for (; std::isdigit(static_cast(ctx.get())); ctx.next()) { num.push_back(ctx.get()); } @@ -461,9 +461,9 @@ bool is_label_end(char c) { (c == ':') || (c == ',') || (c == '}')); } -vespalib::string get_label(ParseContext &ctx) { +std::string get_label(ParseContext &ctx) { ctx.skip_spaces(); - vespalib::string label; + std::string label; if (ctx.get() == '"') { extract_quoted_string(ctx, label, '"'); } else if (ctx.get() == '\'') { @@ -510,8 +510,8 @@ void parse_call(ParseContext &ctx, Call_UP call) { // (a,b,c) wrapped // ,a,b,c -> ) not wrapped -std::vector get_ident_list(ParseContext &ctx, bool wrapped) { - std::vector list; +std::vector get_ident_list(ParseContext &ctx, bool wrapped) { + std::vector list; if (wrapped) { ctx.skip_spaces(); ctx.eat('('); @@ -533,8 +533,8 @@ std::vector get_ident_list(ParseContext &ctx, bool wrapped) { // a // (a,b,c) // cannot be empty -std::vector get_idents(ParseContext &ctx) { - std::vector list; +std::vector get_idents(ParseContext &ctx) { + std::vector list; ctx.skip_spaces(); if (ctx.get() == '(') { list = get_ident_list(ctx, true); @@ -770,7 +770,7 @@ void parse_tensor_lambda(ParseContext &ctx, const ValueType &type) { bool maybe_parse_tensor_generator(ParseContext &ctx) { ParseContext::InputMark my_mark = ctx.get_input_mark(); - vespalib::string type_spec("tensor"); + std::string type_spec("tensor"); while(!ctx.eos() && (ctx.get() != ')')) { type_spec.push_back(ctx.get()); ctx.next(); @@ -851,7 +851,7 @@ void parse_tensor_cell_cast(ParseContext &ctx) { } } -bool maybe_parse_call(ParseContext &ctx, const vespalib::string &name) { +bool maybe_parse_call(ParseContext &ctx, const std::string &name) { ctx.skip_spaces(); if (ctx.get() == '(') { ctx.eat('('); @@ -890,7 +890,7 @@ bool maybe_parse_call(ParseContext &ctx, const vespalib::string &name) { void parse_symbol_or_call(ParseContext &ctx) { ParseContext::InputMark before_name = ctx.get_input_mark(); - vespalib::string name = get_ident(ctx, true); + std::string name = get_ident(ctx, true); bool was_tensor_generate = ((name == "tensor") && maybe_parse_tensor_generator(ctx)); if (!was_tensor_generate && !maybe_parse_call(ctx, name)) { ctx.extract_symbol(name, before_name); @@ -970,7 +970,7 @@ void parse_value(ParseContext &ctx) { bool parse_operator(ParseContext &ctx) { bool expect_value = true; ctx.skip_spaces(); - vespalib::string &str = ctx.peek(ctx.scratch(), nodes::OperatorRepo::instance().max_size()); + std::string &str = ctx.peek(ctx.scratch(), nodes::OperatorRepo::instance().max_size()); Operator_UP op = nodes::OperatorRepo::instance().create(str); if (op.get() != nullptr) { ctx.push_operator(std::move(op)); @@ -979,7 +979,7 @@ bool parse_operator(ParseContext &ctx) { parse_tensor_peek(ctx); expect_value = false; } else { - vespalib::string ident = get_ident(ctx, true); + std::string ident = get_ident(ctx, true); if (ident == "in") { parse_in(ctx); expect_value = false; @@ -1014,7 +1014,7 @@ auto parse_function(const Params ¶ms, std::string_view expression, ParseContext ctx(params, expression.data(), expression.size(), symbol_extractor); parse_expression(ctx); if (ctx.failed() && params.implicit()) { - return Function::create(ctx.get_result(), std::vector()); + return Function::create(ctx.get_result(), std::vector()); } return Function::create(ctx.get_result(), params.extract()); } @@ -1030,7 +1030,7 @@ Function::has_error() const return error; } -vespalib::string +std::string Function::get_error() const { auto error = nodes::as(*_root); @@ -1038,7 +1038,7 @@ Function::get_error() const } std::shared_ptr -Function::create(nodes::Node_UP root_in, std::vector params_in) +Function::create(nodes::Node_UP root_in, std::vector params_in) { return std::make_shared(std::move(root_in), std::move(params_in), ctor_tag()); } @@ -1056,13 +1056,13 @@ Function::parse(std::string_view expression, const SymbolExtractor &symbol_extra } std::shared_ptr -Function::parse(const std::vector ¶ms, std::string_view expression) +Function::parse(const std::vector ¶ms, std::string_view expression) { return parse_function(ExplicitParams(params), expression, nullptr); } std::shared_ptr -Function::parse(const std::vector ¶ms, std::string_view expression, +Function::parse(const std::vector ¶ms, std::string_view expression, const SymbolExtractor &symbol_extractor) { return parse_function(ExplicitParams(params), expression, &symbol_extractor); @@ -1070,10 +1070,10 @@ Function::parse(const std::vector ¶ms, std::string_view ex //----------------------------------------------------------------------------- -vespalib::string +std::string Function::dump_as_lambda() const { - vespalib::string lambda = "f("; + std::string lambda = "f("; for (size_t i = 0; i < _params.size(); ++i) { if (i > 0) { lambda += ","; @@ -1081,7 +1081,7 @@ Function::dump_as_lambda() const lambda += _params[i]; } lambda += ")"; - vespalib::string expr = dump(); + std::string expr = dump(); if (expr.starts_with("(")) { lambda += expr; } else { @@ -1094,9 +1094,9 @@ Function::dump_as_lambda() const bool Function::unwrap(std::string_view input, - vespalib::string &wrapper, - vespalib::string &body, - vespalib::string &error) + std::string &wrapper, + std::string &body, + std::string &error) { size_t pos = 0; for (; pos < input.size() && std::isspace(static_cast(input[pos])); ++pos); @@ -1128,7 +1128,7 @@ Function::unwrap(std::string_view input, //----------------------------------------------------------------------------- void -Function::Issues::add_nested_issues(const vespalib::string &context, const Issues &issues) +Function::Issues::add_nested_issues(const std::string &context, const Issues &issues) { for (const auto &issue: issues.list) { list.push_back(context + ": " + issue); diff --git a/eval/src/vespa/eval/eval/function.h b/eval/src/vespa/eval/eval/function.h index af3e0aedc502..5cf0c85f7bf7 100644 --- a/eval/src/vespa/eval/eval/function.h +++ b/eval/src/vespa/eval/eval/function.h @@ -17,7 +17,7 @@ enum class PassParams : uint8_t { SEPARATE, ARRAY, LAZY }; **/ struct SymbolExtractor { virtual void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const = 0; + const char *&pos_out, std::string &symbol_out) const = 0; virtual ~SymbolExtractor() {} }; @@ -32,12 +32,12 @@ class Function : public std::enable_shared_from_this { private: nodes::Node_UP _root; - std::vector _params; + std::vector _params; struct ctor_tag {}; public: - Function(nodes::Node_UP root_in, std::vector params_in, ctor_tag) noexcept + Function(nodes::Node_UP root_in, std::vector params_in, ctor_tag) noexcept : _root(std::move(root_in)), _params(std::move(params_in)) {} Function(Function &&rhs) = delete; Function(const Function &rhs) = delete; @@ -45,27 +45,27 @@ class Function : public std::enable_shared_from_this Function &operator=(const Function &rhs) = delete; ~Function() { delete_node(std::move(_root)); } size_t num_params() const { return _params.size(); } - const vespalib::string & param_name(size_t idx) const { return _params[idx]; } + const std::string & param_name(size_t idx) const { return _params[idx]; } bool has_error() const; - vespalib::string get_error() const; + std::string get_error() const; const nodes::Node &root() const { return *_root; } - static std::shared_ptr create(nodes::Node_UP root_in, std::vector params_in); + static std::shared_ptr create(nodes::Node_UP root_in, std::vector params_in); static std::shared_ptr parse(std::string_view expression); static std::shared_ptr parse(std::string_view expression, const SymbolExtractor &symbol_extractor); - static std::shared_ptr parse(const std::vector ¶ms, std::string_view expression); - static std::shared_ptr parse(const std::vector ¶ms, std::string_view expression, + static std::shared_ptr parse(const std::vector ¶ms, std::string_view expression); + static std::shared_ptr parse(const std::vector ¶ms, std::string_view expression, const SymbolExtractor &symbol_extractor); - vespalib::string dump() const { + std::string dump() const { nodes::DumpContext dump_context(_params); return _root->dump(dump_context); } - vespalib::string dump_as_lambda() const; + std::string dump_as_lambda() const; // Utility function used to unwrap an expression contained inside // a named wrapper. For example 'max(x+y)' -> 'max', 'x+y' static bool unwrap(std::string_view input, - vespalib::string &wrapper, - vespalib::string &body, - vespalib::string &error); + std::string &wrapper, + std::string &body, + std::string &error); /** * Issues is used to report issues relating to the function * structure, typically to explain why a function cannot be @@ -73,11 +73,11 @@ class Function : public std::enable_shared_from_this * supported in that context. **/ struct Issues { - std::vector list; + std::vector list; operator bool() const noexcept { return !list.empty(); } Issues() noexcept : list() {} - Issues(std::vector &&list_in) noexcept : list(std::move(list_in)) {} - void add_nested_issues(const vespalib::string &context, const Issues &issues); + Issues(std::vector &&list_in) noexcept : list(std::move(list_in)) {} + void add_nested_issues(const std::string &context, const Issues &issues); }; }; diff --git a/eval/src/vespa/eval/eval/interpreted_function.cpp b/eval/src/vespa/eval/eval/interpreted_function.cpp index c0aa7d1703bb..b091be8f59d4 100644 --- a/eval/src/vespa/eval/eval/interpreted_function.cpp +++ b/eval/src/vespa/eval/eval/interpreted_function.cpp @@ -80,7 +80,7 @@ InterpretedFunction::ProfiledContext::ProfiledContext(const InterpretedFunction InterpretedFunction::ProfiledContext::~ProfiledContext() = default; -vespalib::string +std::string InterpretedFunction::Instruction::resolve_symbol() const { if (function == nullptr) { diff --git a/eval/src/vespa/eval/eval/interpreted_function.h b/eval/src/vespa/eval/eval/interpreted_function.h index 4d4c77f11168..a232819642ae 100644 --- a/eval/src/vespa/eval/eval/interpreted_function.h +++ b/eval/src/vespa/eval/eval/interpreted_function.h @@ -86,7 +86,7 @@ class InterpretedFunction : function(function_in), param(0) {} Instruction(op_function function_in, uint64_t param_in) noexcept : function(function_in), param(param_in) {} - vespalib::string resolve_symbol() const; + std::string resolve_symbol() const; void perform(State &state) const { if (function == nullptr) { state.stack.push_back(state.params->resolve(param, state.stash)); diff --git a/eval/src/vespa/eval/eval/key_gen.cpp b/eval/src/vespa/eval/eval/key_gen.cpp index bc63ab0a6822..5737b265242b 100644 --- a/eval/src/vespa/eval/eval/key_gen.cpp +++ b/eval/src/vespa/eval/eval/key_gen.cpp @@ -107,7 +107,7 @@ struct KeyGen : public NodeVisitor, public NodeTraverser { } // namespace vespalib::eval:: -vespalib::string gen_key(const Function &function, PassParams pass_params) +std::string gen_key(const Function &function, PassParams pass_params) { KeyGen key_gen; key_gen.add_byte(uint8_t(pass_params)); diff --git a/eval/src/vespa/eval/eval/key_gen.h b/eval/src/vespa/eval/eval/key_gen.h index 9f761c07d838..560f16ff7b44 100644 --- a/eval/src/vespa/eval/eval/key_gen.h +++ b/eval/src/vespa/eval/eval/key_gen.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace vespalib::eval { @@ -13,6 +14,6 @@ enum class PassParams : uint8_t; * Function used to generate a binary key that may be used to query * the compilation cache. **/ -vespalib::string gen_key(const Function &function, PassParams pass_params); +std::string gen_key(const Function &function, PassParams pass_params); } diff --git a/eval/src/vespa/eval/eval/llvm/addr_to_symbol.cpp b/eval/src/vespa/eval/eval/llvm/addr_to_symbol.cpp index b2c375302017..6c88c95a1a51 100644 --- a/eval/src/vespa/eval/eval/llvm/addr_to_symbol.cpp +++ b/eval/src/vespa/eval/eval/llvm/addr_to_symbol.cpp @@ -23,7 +23,7 @@ bool symbol_is_data_or_function(SymbolType type) } // -vespalib::string addr_to_symbol(const void *addr) { +std::string addr_to_symbol(const void *addr) { if (addr == nullptr) { return {""}; } diff --git a/eval/src/vespa/eval/eval/llvm/addr_to_symbol.h b/eval/src/vespa/eval/eval/llvm/addr_to_symbol.h index 16af9b69ae9b..022f081b7874 100644 --- a/eval/src/vespa/eval/eval/llvm/addr_to_symbol.h +++ b/eval/src/vespa/eval/eval/llvm/addr_to_symbol.h @@ -2,14 +2,14 @@ #pragma once -#include +#include namespace vespalib::eval { // Map an address to a symbolic name. // Intended for function pointers. -vespalib::string addr_to_symbol(const void *addr); +std::string addr_to_symbol(const void *addr); // Return the address of a local symbol. // Used for testing. diff --git a/eval/src/vespa/eval/eval/llvm/compile_cache.cpp b/eval/src/vespa/eval/eval/llvm/compile_cache.cpp index d281c3f5b197..283521fe2f90 100644 --- a/eval/src/vespa/eval/eval/llvm/compile_cache.cpp +++ b/eval/src/vespa/eval/eval/llvm/compile_cache.cpp @@ -53,7 +53,7 @@ CompileCache::compile(const Function &function, PassParams pass_params) Token::UP token; Executor::Task::UP task; std::shared_ptr executor; - vespalib::string key = gen_key(function, pass_params); + std::string key = gen_key(function, pass_params); { std::lock_guard guard(_lock); auto pos = _cached.find(key); diff --git a/eval/src/vespa/eval/eval/llvm/compile_cache.h b/eval/src/vespa/eval/eval/llvm/compile_cache.h index bff4ff092c22..badd70739d88 100644 --- a/eval/src/vespa/eval/eval/llvm/compile_cache.h +++ b/eval/src/vespa/eval/eval/llvm/compile_cache.h @@ -21,7 +21,7 @@ namespace vespalib::eval { class CompileCache { private: - using Key = vespalib::string; + using Key = std::string; struct Result { using SP = std::shared_ptr; std::atomic cf; diff --git a/eval/src/vespa/eval/eval/llvm/compiled_function.cpp b/eval/src/vespa/eval/eval/llvm/compiled_function.cpp index bd52b30b708b..84513839aa80 100644 --- a/eval/src/vespa/eval/eval/llvm/compiled_function.cpp +++ b/eval/src/vespa/eval/eval/llvm/compiled_function.cpp @@ -124,7 +124,7 @@ Function::Issues CompiledFunction::detect_issues(const nodes::Node &node) { struct NotSupported : NodeTraverser { - std::vector issues; + std::vector issues; bool open(const nodes::Node &) override { return true; } void close(const nodes::Node &node) override { if (nodes::check_type &dimensions) { + void make_reduce(const Node &, Aggr aggr, const std::vector &dimensions) { assert(stack.size() >= 1); const auto &a = stack.back().get(); stack.back() = tensor_function::reduce(a, aggr, dimensions, stash); @@ -73,7 +73,7 @@ struct TensorFunctionBuilder : public NodeVisitor, public NodeTraverser { stack.back() = tensor_function::merge(a, b, function, stash); } - void make_concat(const Node &, const vespalib::string &dimension) { + void make_concat(const Node &, const std::string &dimension) { assert(stack.size() >= 2); const auto &b = stack.back().get(); stack.pop_back(); @@ -129,7 +129,7 @@ struct TensorFunctionBuilder : public NodeVisitor, public NodeTraverser { void make_peek(const TensorPeek &node) { assert(stack.size() >= node.num_children()); const TensorFunction ¶m = stack[stack.size()-node.num_children()]; - std::map> spec; + std::map> spec; for (auto pos = node.dim_list().rbegin(); pos != node.dim_list().rend(); ++pos) { if (pos->second.is_expr()) { spec.emplace(pos->first, stack.back()); @@ -148,7 +148,7 @@ struct TensorFunctionBuilder : public NodeVisitor, public NodeTraverser { stack.back() = tensor_function::peek(param, spec, stash); } - void make_rename(const Node &, const std::vector &from, const std::vector &to) { + void make_rename(const Node &, const std::vector &from, const std::vector &to) { assert(stack.size() >= 1); const auto &a = stack.back().get(); stack.back() = tensor_function::rename(a, from, to, stash); diff --git a/eval/src/vespa/eval/eval/node_tools.cpp b/eval/src/vespa/eval/eval/node_tools.cpp index 20712b833ee7..b15f60be2bde 100644 --- a/eval/src/vespa/eval/eval/node_tools.cpp +++ b/eval/src/vespa/eval/eval/node_tools.cpp @@ -39,7 +39,7 @@ struct CopyNode : NodeTraverser, NodeVisitor { //------------------------------------------------------------------------- - void fail(const vespalib::string &msg) { + void fail(const std::string &msg) { if (!error) { error = std::make_unique(msg); } diff --git a/eval/src/vespa/eval/eval/node_types.cpp b/eval/src/vespa/eval/eval/node_types.cpp index 767d0f8b28ab..816f582dc196 100644 --- a/eval/src/vespa/eval/eval/node_types.cpp +++ b/eval/src/vespa/eval/eval/node_types.cpp @@ -17,12 +17,12 @@ class State private: const std::vector &_params; std::map &_type_map; - std::vector &_errors; + std::vector &_errors; public: State(const std::vector ¶ms, std::map &type_map, - std::vector &errors) + std::vector &errors) : _params(params), _type_map(type_map), _errors(errors) {} const ValueType ¶m_type(size_t idx) { @@ -39,7 +39,7 @@ class State assert(pos != _type_map.end()); return pos->second; } - void add_error(const vespalib::string &msg) { + void add_error(const std::string &msg) { _errors.push_back(msg); } }; @@ -48,14 +48,14 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { State state; TypeResolver(const std::vector ¶ms_in, std::map &type_map_out, - std::vector &errors_out); + std::vector &errors_out); ~TypeResolver(); const ValueType ¶m_type(size_t idx) { return state.param_type(idx); } - void fail(const Node &node, const vespalib::string &msg, bool child_types = true) { + void fail(const Node &node, const std::string &msg, bool child_types = true) { auto str = fmt("%s: %s", vespalib::getClassName(node).c_str(), msg.c_str()); if (child_types) { str += ", child types: ["; @@ -232,7 +232,7 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { } void visit(const TensorPeek &node) override { const ValueType ¶m_type = type(node.param()); - std::vector dimensions; + std::vector dimensions; for (const auto &dim: node.dim_list()) { dimensions.push_back(dim.first); if (dim.second.is_expr()) { @@ -319,7 +319,7 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { TypeResolver::TypeResolver(const std::vector ¶ms_in, std::map &type_map_out, - std::vector &errors_out) + std::vector &errors_out) : state(params_in, type_map_out, errors_out) { } diff --git a/eval/src/vespa/eval/eval/node_types.h b/eval/src/vespa/eval/eval/node_types.h index 709777977758..1fb21aaa74cb 100644 --- a/eval/src/vespa/eval/eval/node_types.h +++ b/eval/src/vespa/eval/eval/node_types.h @@ -22,7 +22,7 @@ class NodeTypes private: ValueType _not_found; std::map _type_map; - std::vector _errors; + std::vector _errors; public: NodeTypes(); NodeTypes(NodeTypes &&rhs) = default; @@ -30,7 +30,7 @@ class NodeTypes NodeTypes(const nodes::Node &const_node); NodeTypes(const Function &function, const std::vector &input_types); ~NodeTypes(); - const std::vector &errors() const { return _errors; } + const std::vector &errors() const { return _errors; } NodeTypes export_types(const nodes::Node &root) const; const ValueType &get_type(const nodes::Node &node) const; template diff --git a/eval/src/vespa/eval/eval/operation.cpp b/eval/src/vespa/eval/eval/operation.cpp index 61d6efd48162..cd0d58fd5d1e 100644 --- a/eval/src/vespa/eval/eval/operation.cpp +++ b/eval/src/vespa/eval/eval/operation.cpp @@ -62,7 +62,7 @@ double Cube::f(double a) { return (a * a * a); } namespace { template -void add_op(std::map &map, const Function &fun, T op) { +void add_op(std::map &map, const Function &fun, T op) { assert(!fun.has_error()); auto key = gen_key(fun, PassParams::SEPARATE); auto res = map.emplace(key, op); @@ -70,7 +70,7 @@ void add_op(std::map &map, const Function &fun, T op) { } template -std::optional lookup_op(const std::map &map, const Function &fun) { +std::optional lookup_op(const std::map &map, const Function &fun) { auto key = gen_key(fun, PassParams::SEPARATE); auto pos = map.find(key); if (pos != map.end()) { @@ -79,16 +79,16 @@ std::optional lookup_op(const std::map &map, const Functi return std::nullopt; } -void add_op1(std::map &map, const vespalib::string &expr, op1_t op) { +void add_op1(std::map &map, const std::string &expr, op1_t op) { add_op(map, *Function::parse({"a"}, expr), op); } -void add_op2(std::map &map, const vespalib::string &expr, op2_t op) { +void add_op2(std::map &map, const std::string &expr, op2_t op) { add_op(map, *Function::parse({"a", "b"}, expr), op); } -std::map make_op1_map() { - std::map map; +std::map make_op1_map() { + std::map map; add_op1(map, "-a", Neg::f); add_op1(map, "!a", Not::f); add_op1(map, "cos(a)", Cos::f); @@ -124,8 +124,8 @@ std::map make_op1_map() { return map; } -std::map make_op2_map() { - std::map map; +std::map make_op2_map() { + std::map map; add_op2(map, "a+b", Add::f); add_op2(map, "a-b", Sub::f); add_op2(map, "a*b", Mul::f); @@ -155,12 +155,12 @@ std::map make_op2_map() { } // namespace std::optional lookup_op1(const Function &fun) { - static const std::map map = make_op1_map(); + static const std::map map = make_op1_map(); return lookup_op(map, fun); } std::optional lookup_op2(const Function &fun) { - static const std::map map = make_op2_map(); + static const std::map map = make_op2_map(); return lookup_op(map, fun); } diff --git a/eval/src/vespa/eval/eval/operator_nodes.cpp b/eval/src/vespa/eval/eval/operator_nodes.cpp index c07a14e476a6..cf19e18e30bd 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.cpp +++ b/eval/src/vespa/eval/eval/operator_nodes.cpp @@ -5,7 +5,7 @@ namespace vespalib::eval::nodes { -Operator::Operator(const vespalib::string &op_str_in, int priority_in, Order order_in) +Operator::Operator(const std::string &op_str_in, int priority_in, Order order_in) : _op_str(op_str_in), _priority(priority_in), _order(order_in), diff --git a/eval/src/vespa/eval/eval/operator_nodes.h b/eval/src/vespa/eval/eval/operator_nodes.h index 310742632c92..ac1572270b17 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.h +++ b/eval/src/vespa/eval/eval/operator_nodes.h @@ -3,10 +3,10 @@ #pragma once #include "basic_nodes.h" -#include #include -#include #include +#include +#include namespace vespalib::eval { struct NodeVisitor; } @@ -23,7 +23,7 @@ class Operator : public Node { enum Order { LEFT, RIGHT }; private: - vespalib::string _op_str; + std::string _op_str; int _priority; Order _order; Node_UP _lhs; @@ -31,9 +31,9 @@ class Operator : public Node { bool _is_const_double; public: - Operator(const vespalib::string &op_str_in, int priority_in, Order order_in); + Operator(const std::string &op_str_in, int priority_in, Order order_in); ~Operator(); - vespalib::string op_str() const { return _op_str; } + std::string op_str() const { return _op_str; } int priority() const { return _priority; } Order order() const { return _order; } const Node &lhs() const { return *_lhs; } @@ -66,8 +66,8 @@ class Operator : public Node { _is_const_double = (_lhs->is_const_double() && _rhs->is_const_double()); } - vespalib::string dump(DumpContext &ctx) const override { - vespalib::string str; + std::string dump(DumpContext &ctx) const override { + std::string str; str += "("; str += _lhs->dump(ctx); str += op_str(); @@ -88,11 +88,11 @@ class OperatorRepo { private: static OperatorRepo _instance; typedef nodes::Operator_UP (*factory_type)(); - std::map _map; + std::map _map; size_t _max_size; template void add(const T &op) { - vespalib::string op_str = op.op_str(); + std::string op_str = op.op_str(); _max_size = std::max(_max_size, op_str.size()); _map[op_str] = T::create; } @@ -100,7 +100,7 @@ class OperatorRepo { public: static const OperatorRepo &instance() { return _instance; } size_t max_size() const { return _max_size; } - nodes::Operator_UP create(vespalib::string &tmp) const { + nodes::Operator_UP create(std::string &tmp) const { for (; !tmp.empty(); tmp.resize(tmp.size() - 1)) { auto result = _map.find(tmp); if (result != _map.end()) { @@ -109,8 +109,8 @@ class OperatorRepo { } return nodes::Operator_UP(nullptr); } - std::vector get_names() const { - std::vector ret; + std::vector get_names() const { + std::vector ret; for (const auto &entry: _map) { ret.push_back(entry.first); } @@ -123,7 +123,7 @@ class OperatorRepo { template struct OperatorHelper : Operator { using Helper = OperatorHelper; - OperatorHelper(const vespalib::string &op_str_in, int priority_in, Operator::Order order_in) + OperatorHelper(const std::string &op_str_in, int priority_in, Operator::Order order_in) : Operator(op_str_in, priority_in, order_in) {} void accept(NodeVisitor &visitor) const override; static Operator_UP create() { return Operator_UP(new T()); } diff --git a/eval/src/vespa/eval/eval/simple_value.cpp b/eval/src/vespa/eval/eval/simple_value.cpp index 36fe884f7f52..1e3b96eaebe4 100644 --- a/eval/src/vespa/eval/eval/simple_value.cpp +++ b/eval/src/vespa/eval/eval/simple_value.cpp @@ -201,7 +201,7 @@ MemoryUsage SimpleValue::estimate_extra_memory_usage() const { using Node = std::map::value_type; - size_t key_extra_size = sizeof(vespalib::string) * _num_mapped_dims; + size_t key_extra_size = sizeof(std::string) * _num_mapped_dims; size_t node_extra_size = 2 * sizeof(Node *); // left/right child ptr size_t entry_size = sizeof(Node) + key_extra_size + node_extra_size; size_t size = entry_size * _index.size(); diff --git a/eval/src/vespa/eval/eval/string_stuff.cpp b/eval/src/vespa/eval/eval/string_stuff.cpp index b69661bec735..4b842f299bf3 100644 --- a/eval/src/vespa/eval/eval/string_stuff.cpp +++ b/eval/src/vespa/eval/eval/string_stuff.cpp @@ -6,8 +6,8 @@ namespace vespalib::eval { -vespalib::string as_quoted_string(const vespalib::string &str) { - vespalib::string res; +std::string as_quoted_string(const std::string &str) { + std::string res; res.push_back('"'); for (char c: str) { switch (c) { @@ -46,7 +46,7 @@ vespalib::string as_quoted_string(const vespalib::string &str) { return res; } -bool is_number(const vespalib::string &str) { +bool is_number(const std::string &str) { for (char c : str) { if (!std::isdigit(static_cast(c))) { return false; @@ -55,13 +55,13 @@ bool is_number(const vespalib::string &str) { return true; } -size_t as_number(const vespalib::string &str) { +size_t as_number(const std::string &str) { return atoi(str.c_str()); } -vespalib::string as_string(const TensorSpec::Address &address) { +std::string as_string(const TensorSpec::Address &address) { CommaTracker label_list; - vespalib::string str = "{"; + std::string str = "{"; for (const auto &label: address) { label_list.maybe_add_comma(str); if (label.second.is_mapped()) { diff --git a/eval/src/vespa/eval/eval/string_stuff.h b/eval/src/vespa/eval/eval/string_stuff.h index bb18298a02ce..0dc541256612 100644 --- a/eval/src/vespa/eval/eval/string_stuff.h +++ b/eval/src/vespa/eval/eval/string_stuff.h @@ -3,7 +3,7 @@ #pragma once #include "tensor_spec.h" -#include +#include namespace vespalib::eval { @@ -16,7 +16,7 @@ struct CommaTracker { bool first; CommaTracker() noexcept : first(true) {} CommaTracker(bool first_in) noexcept : first(first_in) {} - bool maybe_add_comma(vespalib::string &dst) { + bool maybe_add_comma(std::string &dst) { if (first) { first = false; return false; @@ -40,22 +40,22 @@ struct CommaTracker { /** * Convert the given string to a quoted string with escaped special characters. **/ -vespalib::string as_quoted_string(const vespalib::string &str); +std::string as_quoted_string(const std::string &str); /** * Is this string a positive integer (dimension index) **/ -bool is_number(const vespalib::string &str); +bool is_number(const std::string &str); /** * Convert this string to a positive integer (dimension index) **/ -size_t as_number(const vespalib::string &str); +size_t as_number(const std::string &str); /** * Convert a tensor spec address into a string on the form: * '{dim1:label,dim2:index, ...}' **/ -vespalib::string as_string(const TensorSpec::Address &address); +std::string as_string(const TensorSpec::Address &address); } diff --git a/eval/src/vespa/eval/eval/tensor_function.cpp b/eval/src/vespa/eval/eval/tensor_function.cpp index 14d486aeb48a..a9313785d350 100644 --- a/eval/src/vespa/eval/eval/tensor_function.cpp +++ b/eval/src/vespa/eval/eval/tensor_function.cpp @@ -26,7 +26,7 @@ LOG_SETUP(".eval.eval.tensor_function"); namespace vespalib { namespace eval { -vespalib::string +std::string TensorFunction::as_string() const { ObjectDumper dumper; @@ -47,7 +47,7 @@ TensorFunction::visit_children(vespalib::ObjectVisitor &visitor) const std::vector children; push_children(children); for (size_t i = 0; i < children.size(); ++i) { - vespalib::string name = vespalib::make_string("children[%zu]", i); + std::string name = vespalib::make_string("children[%zu]", i); ::visit(visitor, name, children[i].get().get()); } } @@ -456,7 +456,7 @@ const TensorFunction &inject(const ValueType &type, size_t param_idx, Stash &sta return stash.create(type, param_idx); } -const TensorFunction &reduce(const TensorFunction &child, Aggr aggr, const std::vector &dimensions, Stash &stash) { +const TensorFunction &reduce(const TensorFunction &child, Aggr aggr, const std::vector &dimensions, Stash &stash) { ValueType result_type = child.result_type().reduce(dimensions); if (dimensions.empty()) { // expand dimension list for full reduce return stash.create(result_type, child, aggr, child.result_type().dimension_names()); @@ -485,7 +485,7 @@ const TensorFunction &merge(const TensorFunction &lhs, const TensorFunction &rhs return stash.create(result_type, lhs, rhs, function); } -const TensorFunction &concat(const TensorFunction &lhs, const TensorFunction &rhs, const vespalib::string &dimension, Stash &stash) { +const TensorFunction &concat(const TensorFunction &lhs, const TensorFunction &rhs, const std::string &dimension, Stash &stash) { ValueType result_type = ValueType::concat(lhs.result_type(), rhs.result_type(), dimension); return stash.create(result_type, lhs, rhs, dimension); } @@ -503,8 +503,8 @@ const TensorFunction &cell_cast(const TensorFunction &child, CellType cell_type, return stash.create(result_type, child, cell_type); } -const TensorFunction &peek(const TensorFunction ¶m, const std::map> &spec, Stash &stash) { - std::vector dimensions; +const TensorFunction &peek(const TensorFunction ¶m, const std::map> &spec, Stash &stash) { + std::vector dimensions; for (const auto &dim_spec: spec) { dimensions.push_back(dim_spec.first); } @@ -513,7 +513,7 @@ const TensorFunction &peek(const TensorFunction ¶m, const std::map(result_type, param, spec); } -const TensorFunction &rename(const TensorFunction &child, const std::vector &from, const std::vector &to, Stash &stash) { +const TensorFunction &rename(const TensorFunction &child, const std::vector &from, const std::vector &to, Stash &stash) { ValueType result_type = child.result_type().rename(from, to); return stash.create(result_type, child, from, to); } diff --git a/eval/src/vespa/eval/eval/tensor_function.h b/eval/src/vespa/eval/eval/tensor_function.h index 940f7cd8749f..c851b9496349 100644 --- a/eval/src/vespa/eval/eval/tensor_function.h +++ b/eval/src/vespa/eval/eval/tensor_function.h @@ -11,9 +11,9 @@ #include "interpreted_function.h" #include "wrap_param.h" #include -#include #include #include +#include #include namespace vespalib { @@ -110,7 +110,7 @@ struct TensorFunction virtual InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const = 0; // for debug dumping - vespalib::string as_string() const; + std::string as_string() const; virtual void visit_self(vespalib::ObjectVisitor &visitor) const; virtual void visit_children(vespalib::ObjectVisitor &visitor) const; @@ -215,15 +215,15 @@ class Reduce : public Op1 using Super = Op1; private: Aggr _aggr; - std::vector _dimensions; + std::vector _dimensions; public: Reduce(const ValueType &result_type_in, const TensorFunction &child_in, Aggr aggr_in, - const std::vector &dimensions_in) + const std::vector &dimensions_in) : Super(result_type_in, child_in), _aggr(aggr_in), _dimensions(dimensions_in) {} Aggr aggr() const { return _aggr; } - const std::vector &dimensions() const { return _dimensions; } + const std::vector &dimensions() const { return _dimensions; } bool result_is_mutable() const override { return true; } InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const final override; void visit_self(vespalib::ObjectVisitor &visitor) const override; @@ -314,14 +314,14 @@ class Concat : public Op2 { using Super = Op2; private: - vespalib::string _dimension; + std::string _dimension; public: Concat(const ValueType &result_type_in, const TensorFunction &lhs_in, const TensorFunction &rhs_in, - const vespalib::string &dimension_in) + const std::string &dimension_in) : Super(result_type_in, lhs_in, rhs_in), _dimension(dimension_in) {} - const vespalib::string &dimension() const { return _dimension; } + const std::string &dimension() const { return _dimension; } bool result_is_mutable() const override { return true; } InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const final override; void visit_self(vespalib::ObjectVisitor &visitor) const override; @@ -401,10 +401,10 @@ class Peek : public Node using MyLabel = std::variant; private: Child _param; - std::map _map; + std::map _map; public: Peek(const ValueType &result_type_in, const TensorFunction ¶m, - const std::map> &spec) + const std::map> &spec) : Super(result_type_in), _param(param), _map() { for (const auto &dim: spec) { @@ -419,11 +419,11 @@ class Peek : public Node }, dim.second); } } - const std::map &map() const { return _map; } + const std::map &map() const { return _map; } // a verbatim label or the index of a child that computes the label value: using LabelOrChildIndex = std::variant; // mapping from dimension name to verbatim label or child index: - using Spec = std::map; + using Spec = std::map; Spec make_spec() const; const TensorFunction ¶m() const { return _param.get(); } const ValueType ¶m_type() const { return _param.get().result_type(); } @@ -439,16 +439,16 @@ class Rename : public Op1 { using Super = Op1; private: - std::vector _from; - std::vector _to; + std::vector _from; + std::vector _to; public: Rename(const ValueType &result_type_in, const TensorFunction &child_in, - const std::vector &from_in, - const std::vector &to_in) + const std::vector &from_in, + const std::vector &to_in) : Super(result_type_in, child_in), _from(from_in), _to(to_in) {} - const std::vector &from() const { return _from; } - const std::vector &to() const { return _to; } + const std::vector &from() const { return _from; } + const std::vector &to() const { return _to; } bool result_is_mutable() const override { return true; } InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const final override; void visit_self(vespalib::ObjectVisitor &visitor) const override; @@ -484,17 +484,17 @@ class If : public Node const TensorFunction &const_value(const Value &value, Stash &stash); const TensorFunction &inject(const ValueType &type, size_t param_idx, Stash &stash); -const TensorFunction &reduce(const TensorFunction &child, Aggr aggr, const std::vector &dimensions, Stash &stash); +const TensorFunction &reduce(const TensorFunction &child, Aggr aggr, const std::vector &dimensions, Stash &stash); const TensorFunction &map(const TensorFunction &child, map_fun_t function, Stash &stash); const TensorFunction &map_subspaces(const TensorFunction &child, const Function &function, NodeTypes node_types, Stash &stash); const TensorFunction &join(const TensorFunction &lhs, const TensorFunction &rhs, join_fun_t function, Stash &stash); const TensorFunction &merge(const TensorFunction &lhs, const TensorFunction &rhs, join_fun_t function, Stash &stash); -const TensorFunction &concat(const TensorFunction &lhs, const TensorFunction &rhs, const vespalib::string &dimension, Stash &stash); +const TensorFunction &concat(const TensorFunction &lhs, const TensorFunction &rhs, const std::string &dimension, Stash &stash); const TensorFunction &create(const ValueType &type, const std::map &spec, Stash &stash); const TensorFunction &lambda(const ValueType &type, const std::vector &bindings, const Function &function, NodeTypes node_types, Stash &stash); const TensorFunction &cell_cast(const TensorFunction &child, CellType cell_type, Stash &stash); -const TensorFunction &peek(const TensorFunction ¶m, const std::map> &spec, Stash &stash); -const TensorFunction &rename(const TensorFunction &child, const std::vector &from, const std::vector &to, Stash &stash); +const TensorFunction &peek(const TensorFunction ¶m, const std::map> &spec, Stash &stash); +const TensorFunction &rename(const TensorFunction &child, const std::vector &from, const std::vector &to, Stash &stash); const TensorFunction &if_node(const TensorFunction &cond, const TensorFunction &true_child, const TensorFunction &false_child, Stash &stash); } // namespace vespalib::eval::tensor_function diff --git a/eval/src/vespa/eval/eval/tensor_nodes.cpp b/eval/src/vespa/eval/eval/tensor_nodes.cpp index 824fb7d6c91e..1467d9442cb5 100644 --- a/eval/src/vespa/eval/eval/tensor_nodes.cpp +++ b/eval/src/vespa/eval/eval/tensor_nodes.cpp @@ -17,9 +17,9 @@ void TensorCreate ::accept(NodeVisitor &visitor) const { visitor.visit(*thi void TensorLambda ::accept(NodeVisitor &visitor) const { visitor.visit(*this); } void TensorPeek ::accept(NodeVisitor &visitor) const { visitor.visit(*this); } -vespalib::string +std::string TensorMap::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "map("; str += _child->dump(ctx); str += ","; @@ -28,9 +28,9 @@ TensorMap::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorMapSubspaces::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "map_subspaces("; str += _child->dump(ctx); str += ","; @@ -39,9 +39,9 @@ TensorMapSubspaces::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorJoin::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "join("; str += _lhs->dump(ctx); str += ","; @@ -52,9 +52,9 @@ TensorJoin::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorMerge::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "join("; str += _lhs->dump(ctx); str += ","; @@ -65,9 +65,9 @@ TensorMerge::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorReduce::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "reduce("; str += _child->dump(ctx); str += ","; @@ -80,9 +80,9 @@ TensorReduce::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorRename::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "rename("; str += _child->dump(ctx); str += ","; @@ -93,12 +93,12 @@ TensorRename::dump(DumpContext &ctx) const { return str; } -vespalib::string -TensorRename::flatten(const std::vector &list) { +std::string +TensorRename::flatten(const std::vector &list) { if (list.size() == 1) { return list[0]; } - vespalib::string str = "("; + std::string str = "("; for (size_t i = 0; i < list.size(); ++i) { if (i > 0) { str += ","; @@ -109,9 +109,9 @@ TensorRename::flatten(const std::vector &list) { return str; } -vespalib::string +std::string TensorConcat::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "concat("; str += _lhs->dump(ctx); str += ","; @@ -122,9 +122,9 @@ TensorConcat::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorCellCast::dump(DumpContext &ctx) const { - vespalib::string str; + std::string str; str += "cell_cast("; str += _child->dump(ctx); str += ","; @@ -133,9 +133,9 @@ TensorCellCast::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorCreate::dump(DumpContext &ctx) const { - vespalib::string str = _type.to_spec(); + std::string str = _type.to_spec(); str += ":{"; CommaTracker child_list; for (const Child &child: _cells) { @@ -148,10 +148,10 @@ TensorCreate::dump(DumpContext &ctx) const { return str; } -vespalib::string +std::string TensorLambda::dump(DumpContext &) const { - vespalib::string str = _type.to_spec(); - vespalib::string expr = _lambda->dump(); + std::string str = _type.to_spec(); + std::string expr = _lambda->dump(); if (expr.starts_with("(")) { str += expr; } else { @@ -162,9 +162,9 @@ TensorLambda::dump(DumpContext &) const { return str; } -vespalib::string +std::string TensorPeek::dump(DumpContext &ctx) const { - vespalib::string str = _param->dump(ctx); + std::string str = _param->dump(ctx); str += "{"; CommaTracker dim_list; for (const auto &dim : _dim_list) { @@ -172,7 +172,7 @@ TensorPeek::dump(DumpContext &ctx) const { str += dim.first; str += ":"; if (dim.second.is_expr()) { - vespalib::string expr = dim.second.expr->dump(ctx); + std::string expr = dim.second.expr->dump(ctx); if (expr.starts_with("(")) { str += expr; } else { diff --git a/eval/src/vespa/eval/eval/tensor_nodes.h b/eval/src/vespa/eval/eval/tensor_nodes.h index 5de2e4bc80d1..644bb306adf5 100644 --- a/eval/src/vespa/eval/eval/tensor_nodes.h +++ b/eval/src/vespa/eval/eval/tensor_nodes.h @@ -8,9 +8,9 @@ #include "aggr.h" #include "string_stuff.h" #include "value_type_spec.h" -#include -#include #include +#include +#include namespace vespalib::eval::nodes { @@ -23,7 +23,7 @@ class TensorMap : public Node { : _child(std::move(child)), _lambda(std::move(lambda)) {} const Node &child() const { return *_child; } const Function &lambda() const { return *_lambda; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 1; } const Node &get_child(size_t idx) const override { @@ -45,7 +45,7 @@ class TensorMapSubspaces : public Node { : _child(std::move(child)), _lambda(std::move(lambda)) {} const Node &child() const { return *_child; } const Function &lambda() const { return *_lambda; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 1; } const Node &get_child(size_t idx) const override { @@ -69,7 +69,7 @@ class TensorJoin : public Node { const Node &lhs() const { return *_lhs; } const Node &rhs() const { return *_rhs; } const Function &lambda() const { return *_lambda; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 2; } const Node &get_child(size_t idx) const override { @@ -93,7 +93,7 @@ class TensorMerge : public Node { const Node &lhs() const { return *_lhs; } const Node &rhs() const { return *_rhs; } const Function &lambda() const { return *_lambda; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 2; } const Node &get_child(size_t idx) const override { @@ -110,14 +110,14 @@ class TensorReduce : public Node { private: Node_UP _child; Aggr _aggr; - std::vector _dimensions; + std::vector _dimensions; public: - TensorReduce(Node_UP child, Aggr aggr_in, std::vector dimensions_in) + TensorReduce(Node_UP child, Aggr aggr_in, std::vector dimensions_in) : _child(std::move(child)), _aggr(aggr_in), _dimensions(std::move(dimensions_in)) {} const Node &child() const { return *_child; } Aggr aggr() const { return _aggr; } - const std::vector &dimensions() const { return _dimensions; } - vespalib::string dump(DumpContext &ctx) const override; + const std::vector &dimensions() const { return _dimensions; } + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 1; } const Node &get_child(size_t idx) const override { @@ -132,15 +132,15 @@ class TensorReduce : public Node { class TensorRename : public Node { private: Node_UP _child; - std::vector _from; - std::vector _to; + std::vector _from; + std::vector _to; public: - TensorRename(Node_UP child, std::vector from_in, std::vector to_in) + TensorRename(Node_UP child, std::vector from_in, std::vector to_in) : _child(std::move(child)), _from(std::move(from_in)), _to(std::move(to_in)) {} const Node &child() const { return *_child; } - const std::vector &from() const { return _from; } - const std::vector &to() const { return _to; } - vespalib::string dump(DumpContext &ctx) const override; + const std::vector &from() const { return _from; } + const std::vector &to() const { return _to; } + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 1; } const Node &get_child(size_t idx) const override { @@ -150,21 +150,21 @@ class TensorRename : public Node { void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - static vespalib::string flatten(const std::vector &list); + static std::string flatten(const std::vector &list); }; class TensorConcat : public Node { private: Node_UP _lhs; Node_UP _rhs; - vespalib::string _dimension; + std::string _dimension; public: - TensorConcat(Node_UP lhs, Node_UP rhs, const vespalib::string &dimension_in) + TensorConcat(Node_UP lhs, Node_UP rhs, const std::string &dimension_in) : _lhs(std::move(lhs)), _rhs(std::move(rhs)), _dimension(dimension_in) {} const Node &lhs() const { return *_lhs; } const Node &rhs() const { return *_rhs; } - const vespalib::string &dimension() const { return _dimension; } - vespalib::string dump(DumpContext &ctx) const override; + const std::string &dimension() const { return _dimension; } + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 2; } const Node &get_child(size_t idx) const override { @@ -186,7 +186,7 @@ class TensorCellCast : public Node { : _child(std::move(child)), _cell_type(cell_type) {} const Node &child() const { return *_child; } CellType cell_type() const { return _cell_type; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 1; } const Node &get_child(size_t idx) const override { @@ -216,7 +216,7 @@ class TensorCreate : public Node { } } const ValueType &type() const { return _type; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return _cells.size(); } const Node &get_child(size_t idx) const override { @@ -249,7 +249,7 @@ class TensorLambda : public Node { const ValueType &type() const { return _type; } const std::vector &bindings() const { return _bindings; } const Function &lambda() const { return *_lambda; } - vespalib::string dump(DumpContext &) const override; + std::string dump(DumpContext &) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return 0; } const Node &get_child(size_t) const override { abort(); } @@ -259,16 +259,16 @@ class TensorLambda : public Node { class TensorPeek : public Node { public: struct MyLabel { - vespalib::string label; + std::string label; Node_UP expr; - MyLabel(vespalib::string label_in) + MyLabel(std::string label_in) : label(label_in), expr() {} MyLabel(Node_UP node) : label(""), expr(std::move(node)) {} bool is_expr() const { return bool(expr); } }; - using Spec = std::map; - using Dim = std::pair; + using Spec = std::map; + using Dim = std::pair; using DimList = std::vector; private: using DimRefs = std::vector; @@ -288,7 +288,7 @@ class TensorPeek : public Node { } const Node ¶m() const { return *_param; } const DimList &dim_list() const { return _dim_list; } - vespalib::string dump(DumpContext &ctx) const override; + std::string dump(DumpContext &ctx) const override; void accept(NodeVisitor &visitor) const override; size_t num_children() const override { return (1 + _expr_dims.size()); } const Node &get_child(size_t idx) const override { diff --git a/eval/src/vespa/eval/eval/tensor_spec.cpp b/eval/src/vespa/eval/eval/tensor_spec.cpp index dc5ca6f49717..cd7d4835cd88 100644 --- a/eval/src/vespa/eval/eval/tensor_spec.cpp +++ b/eval/src/vespa/eval/eval/tensor_spec.cpp @@ -19,7 +19,7 @@ namespace vespalib::eval { namespace { -vespalib::string number_to_expr(double value) { +std::string number_to_expr(double value) { if (std::isfinite(value)) { return make_string("%g", value); } else if (std::isnan(value)) { @@ -49,9 +49,9 @@ TensorSpec::Address extract_address(const slime::Inspector &address) { return extractor.address; } -vespalib::string addr_to_compact_string(const TensorSpec::Address &addr) { +std::string addr_to_compact_string(const TensorSpec::Address &addr) { size_t n = 0; - vespalib::string str("["); + std::string str("["); for (const auto &[dim, label]: addr) { if (n++) { str.append(","); @@ -66,21 +66,21 @@ vespalib::string addr_to_compact_string(const TensorSpec::Address &addr) { return str; } -vespalib::string value_to_verbose_string(const TensorSpec::Value &value) { +std::string value_to_verbose_string(const TensorSpec::Value &value) { return make_string("%g (%a)", value.value, value.value); } struct DiffTable { struct Entry { - vespalib::string tag; - vespalib::string lhs; - vespalib::string rhs; + std::string tag; + std::string lhs; + std::string rhs; bool is_separator() const { return (tag.empty() && lhs.empty() && rhs.empty()); } static Entry separator() { return {"","",""}; } - static Entry header(const vespalib::string &lhs_desc, - const vespalib::string &rhs_desc) + static Entry header(const std::string &lhs_desc, + const std::string &rhs_desc) { return {"", lhs_desc, rhs_desc}; } @@ -112,14 +112,14 @@ struct DiffTable { size_t tag_len; size_t lhs_len; size_t rhs_len; - vespalib::string str; + std::string str; Result(size_t tag_len_in, size_t lhs_len_in, size_t rhs_len_in) : tag_len(tag_len_in + 1), lhs_len(lhs_len_in + 1), rhs_len(rhs_len_in + 1), str() {} - void add(const vespalib::string &stuff) { + void add(const std::string &stuff) { str.append(stuff); } - void add(const vespalib::string &stuff, size_t width, char pad = ' ') { + void add(const std::string &stuff, size_t width, char pad = ' ') { int n = (width - stuff.size()); for (int i = 0; i < n; ++i) { str.push_back(pad); @@ -156,7 +156,7 @@ struct DiffTable { rhs_len = std::max(rhs_len, entry.rhs.size()); entries.push_back(entry); } - vespalib::string to_string() { + std::string to_string() { Result res(tag_len, lhs_len, rhs_len); for (const auto &entry: entries) { res.add(entry); @@ -210,7 +210,7 @@ struct NormalizeTensorSpec { TensorSpec::Address address; for (const auto &dim : type.dimensions()) { if (dim.is_mapped()) { - address.emplace(dim.name, vespalib::string(*sparse_addr_iter++)); + address.emplace(dim.name, std::string(*sparse_addr_iter++)); } } REQUIRE(sparse_addr_iter == keys.end()); @@ -233,7 +233,7 @@ struct NormalizeTensorSpec { } // namespace vespalib::eval:: -TensorSpec::TensorSpec(vespalib::string type_spec) noexcept +TensorSpec::TensorSpec(std::string type_spec) noexcept : _type(std::move(type_spec)), _cells() { } @@ -265,10 +265,10 @@ TensorSpec::add(Address address, double value) { return *this; } -vespalib::string +std::string TensorSpec::to_string() const { - vespalib::string out = make_string("spec(%s) {\n", _type.c_str()); + std::string out = make_string("spec(%s) {\n", _type.c_str()); for (const auto &cell: _cells) { out.append(make_string(" %s: %g\n", addr_to_compact_string(cell.first).c_str(), cell.second.value)); } @@ -295,13 +295,13 @@ TensorSpec::to_slime(slime::Cursor &tensor) const } } -vespalib::string +std::string TensorSpec::to_expr() const { if (_type == "double") { return number_to_expr(as_double()); } - vespalib::string out = _type; + std::string out = _type; out.append(":{"); CommaTracker cell_list; for (const auto &cell: _cells) { @@ -332,7 +332,7 @@ TensorSpec::from_value(const eval::Value &value) } TensorSpec -TensorSpec::from_expr(const vespalib::string &expr) +TensorSpec::from_expr(const std::string &expr) { auto fun = Function::parse(expr); if (!fun->has_error() && (fun->num_params() == 0)) { @@ -370,9 +370,9 @@ TensorSpec::normalize() const } } -vespalib::string -TensorSpec::diff(const TensorSpec &lhs, const vespalib::string &lhs_desc, - const TensorSpec &rhs, const vespalib::string &rhs_desc) +std::string +TensorSpec::diff(const TensorSpec &lhs, const std::string &lhs_desc, + const TensorSpec &rhs, const std::string &rhs_desc) { using Entry = DiffTable::Entry; DiffTable table; diff --git a/eval/src/vespa/eval/eval/tensor_spec.h b/eval/src/vespa/eval/eval/tensor_spec.h index 4b1c2e551ef1..c57cf45f3f78 100644 --- a/eval/src/vespa/eval/eval/tensor_spec.h +++ b/eval/src/vespa/eval/eval/tensor_spec.h @@ -2,10 +2,10 @@ #pragma once -#include #include #include #include +#include namespace vespalib::slime { struct Cursor; @@ -25,10 +25,10 @@ class TensorSpec public: struct Label { size_t index; - vespalib::string name; + std::string name; static constexpr size_t npos = -1; Label(size_t index_in) noexcept : index(index_in), name() {} - Label(vespalib::string name_in) noexcept : index(npos), name(std::move(name_in)) {} + Label(std::string name_in) noexcept : index(npos), name(std::move(name_in)) {} Label(const char *name_in) : index(npos), name(name_in) {} bool is_mapped() const noexcept { return (index == npos); } bool is_indexed() const noexcept { return (index != npos); } @@ -54,29 +54,29 @@ class TensorSpec return (both_nan(value, rhs.value) || approx_equal(value, rhs.value)); } }; - using Address = std::map; + using Address = std::map; using Cells = std::map; private: - vespalib::string _type; + std::string _type; Cells _cells; public: - TensorSpec(vespalib::string type_spec) noexcept; + TensorSpec(std::string type_spec) noexcept; TensorSpec(const TensorSpec &); TensorSpec & operator = (const TensorSpec &); ~TensorSpec(); double as_double() const; TensorSpec &add(Address address, double value); - const vespalib::string &type() const { return _type; } + const std::string &type() const { return _type; } const Cells &cells() const { return _cells; } - vespalib::string to_string() const; + std::string to_string() const; TensorSpec normalize() const; void to_slime(slime::Cursor &tensor) const; - vespalib::string to_expr() const; + std::string to_expr() const; static TensorSpec from_slime(const slime::Inspector &tensor); static TensorSpec from_value(const eval::Value &value); - static TensorSpec from_expr(const vespalib::string &expr); - static vespalib::string diff(const TensorSpec &lhs, const vespalib::string &lhs_desc, - const TensorSpec &rhs, const vespalib::string &rhs_desc); + static TensorSpec from_expr(const std::string &expr); + static std::string diff(const TensorSpec &lhs, const std::string &lhs_desc, + const TensorSpec &rhs, const std::string &rhs_desc); }; bool operator==(const TensorSpec &lhs, const TensorSpec &rhs); diff --git a/eval/src/vespa/eval/eval/test/eval_fixture.cpp b/eval/src/vespa/eval/eval/test/eval_fixture.cpp index 562e92a4767e..4d362735afb0 100644 --- a/eval/src/vespa/eval/eval/test/eval_fixture.cpp +++ b/eval/src/vespa/eval/eval/test/eval_fixture.cpp @@ -100,7 +100,7 @@ std::vector get_refs(const std::vector &values) { } // namespace vespalib::eval::test ParamRepo & -EvalFixture::ParamRepo::add(const vespalib::string &name, TensorSpec value) +EvalFixture::ParamRepo::add(const std::string &name, TensorSpec value) { REQUIRE(map.find(name) == map.end()); map.insert_or_assign(name, Param(std::move(value), false)); @@ -108,7 +108,7 @@ EvalFixture::ParamRepo::add(const vespalib::string &name, TensorSpec value) } ParamRepo & -EvalFixture::ParamRepo::add_mutable(const vespalib::string &name, TensorSpec value) +EvalFixture::ParamRepo::add_mutable(const std::string &name, TensorSpec value) { REQUIRE(map.find(name) == map.end()); map.insert_or_assign(name, Param(std::move(value), true)); @@ -117,7 +117,7 @@ EvalFixture::ParamRepo::add_mutable(const vespalib::string &name, TensorSpec val // produce 4 variants: float/double * mutable/const EvalFixture::ParamRepo & -EvalFixture::ParamRepo::add_variants(const vespalib::string &name_base, +EvalFixture::ParamRepo::add_variants(const std::string &name_base, const GenSpec &spec) { auto name_f = name_base + "_f"; @@ -133,7 +133,7 @@ EvalFixture::ParamRepo::add_variants(const vespalib::string &name_base, } EvalFixture::ParamRepo & -EvalFixture::ParamRepo::add(const vespalib::string &name, const vespalib::string &desc, +EvalFixture::ParamRepo::add(const std::string &name, const std::string &desc, CellType cell_type, GenSpec::seq_t seq) { bool is_mutable = ((!desc.empty()) && (desc[0] == '@')); @@ -145,10 +145,10 @@ EvalFixture::ParamRepo::add(const vespalib::string &name, const vespalib::string } EvalFixture::ParamRepo & -EvalFixture::ParamRepo::add(const vespalib::string &name_desc, CellType cell_type, GenSpec::seq_t seq) +EvalFixture::ParamRepo::add(const std::string &name_desc, CellType cell_type, GenSpec::seq_t seq) { auto pos = name_desc.find('$'); - vespalib::string desc = (pos < name_desc.size()) + std::string desc = (pos < name_desc.size()) ? name_desc.substr(0, pos) : name_desc; return add(name_desc, desc, cell_type, seq); @@ -168,7 +168,7 @@ EvalFixture::detect_param_tampering(const ParamRepo ¶m_repo, bool allow_muta } EvalFixture::EvalFixture(const ValueBuilderFactory &factory, - const vespalib::string &expr, + const std::string &expr, const ParamRepo ¶m_repo, bool optimized, bool allow_mutable) @@ -199,7 +199,7 @@ EvalFixture::num_params() const } TensorSpec -EvalFixture::ref(const vespalib::string &expr, const ParamRepo ¶m_repo) +EvalFixture::ref(const std::string &expr, const ParamRepo ¶m_repo) { auto fun = Function::parse(expr); std::vector params; diff --git a/eval/src/vespa/eval/eval/test/eval_fixture.h b/eval/src/vespa/eval/eval/test/eval_fixture.h index 7e33b5417b6e..bd5e8f6e498a 100644 --- a/eval/src/vespa/eval/eval/test/eval_fixture.h +++ b/eval/src/vespa/eval/eval/test/eval_fixture.h @@ -30,23 +30,23 @@ class EvalFixture }; struct ParamRepo { - std::map map; + std::map map; using gen_fun_t = std::function; static double gen_N(size_t seq) { return (seq + 1); } ParamRepo() : map() {} - ParamRepo &add(const vespalib::string &name, TensorSpec value); - ParamRepo &add_mutable(const vespalib::string &name, TensorSpec spec); + ParamRepo &add(const std::string &name, TensorSpec value); + ParamRepo &add_mutable(const std::string &name, TensorSpec spec); // produce 4 variants: float/double * mutable/const - ParamRepo &add_variants(const vespalib::string &name_base, const GenSpec &spec); + ParamRepo &add_variants(const std::string &name_base, const GenSpec &spec); // add a parameter that is generated based on a description. // // the description may start with '@' to indicate that the // parameter is mutable. The rest of the description must be a // valid parameter to the GenSpec::from_desc() function. - ParamRepo &add(const vespalib::string &name, const vespalib::string &desc, + ParamRepo &add(const std::string &name, const std::string &desc, CellType cell_type, GenSpec::seq_t seq); // add a parameter that is generated based on a description, @@ -58,7 +58,7 @@ class EvalFixture // strip an optional suffix starting with '$' from the name // before using it as a descriprion. (to support multiple // parameters with the same description). - ParamRepo &add(const vespalib::string &name_desc, CellType cell_type, GenSpec::seq_t seq); + ParamRepo &add(const std::string &name_desc, CellType cell_type, GenSpec::seq_t seq); ~ParamRepo() {} }; @@ -109,7 +109,7 @@ class EvalFixture } public: - EvalFixture(const ValueBuilderFactory &factory, const vespalib::string &expr, const ParamRepo ¶m_repo, + EvalFixture(const ValueBuilderFactory &factory, const std::string &expr, const ParamRepo ¶m_repo, bool optimized = true, bool allow_mutable = false); ~EvalFixture() {} template @@ -122,8 +122,8 @@ class EvalFixture const Value ¶m_value(size_t idx) const { return *(_param_values[idx]); } const TensorSpec &result() const { return _result; } size_t num_params() const; - static TensorSpec ref(const vespalib::string &expr, const ParamRepo ¶m_repo); - static TensorSpec prod(const vespalib::string &expr, const ParamRepo ¶m_repo) { + static TensorSpec ref(const std::string &expr, const ParamRepo ¶m_repo); + static TensorSpec prod(const std::string &expr, const ParamRepo ¶m_repo) { return EvalFixture(FastValueBuilderFactory::get(), expr, param_repo, true, false).result(); } @@ -136,7 +136,7 @@ class EvalFixture // with '@'. Parameters must be given in automatic discovery order. template - static void verify(const vespalib::string &expr, const std::vector &fun_info, std::vector param_specs) { + static void verify(const std::string &expr, const std::vector &fun_info, std::vector param_specs) { UNWIND_MSG("in verify(%s) with %zu FunInfo", expr.c_str(), fun_info.size()); auto fun = Function::parse(expr); REQUIRE_EQ(fun->num_params(), param_specs.size()); @@ -171,7 +171,7 @@ class EvalFixture // ('$this_is_a_scalar'). template - static void verify(const vespalib::string &expr, const std::vector &fun_info, CellTypeSpace cell_type_space) { + static void verify(const std::string &expr, const std::vector &fun_info, CellTypeSpace cell_type_space) { UNWIND_MSG("in verify(%s) with %zu FunInfo", expr.c_str(), fun_info.size()); auto fun = Function::parse(expr); REQUIRE_EQ(fun->num_params(), cell_type_space.n()); diff --git a/eval/src/vespa/eval/eval/test/eval_spec.cpp b/eval/src/vespa/eval/eval/test/eval_spec.cpp index 72664168114a..f0e78b5d0097 100644 --- a/eval/src/vespa/eval/eval/test/eval_spec.cpp +++ b/eval/src/vespa/eval/eval/test/eval_spec.cpp @@ -10,7 +10,7 @@ namespace vespalib::eval::test { namespace { -double byte(const vespalib::string &bits) { +double byte(const std::string &bits) { int8_t res = 0; assert(bits.size() == 8); for (const auto &c: bits) { @@ -56,7 +56,7 @@ EvalSpec::Expression &EvalSpec::Expression::add_cases(std::initializer_list a_values = a_spec.expand(7); for (double a: a_values) { @@ -65,7 +65,7 @@ void EvalSpec::add_rule(const ParamSpec &a_spec, const vespalib::string &express } void EvalSpec::add_rule(const ParamSpec &a_spec, const ParamSpec &b_spec, - const vespalib::string &expression, fun_2_ref ref) { + const std::string &expression, fun_2_ref ref) { Expression &expr = add_expression({a_spec.name, b_spec.name}, expression); std::vector a_values = a_spec.expand(5); std::vector b_values = b_spec.expand(5); @@ -76,13 +76,13 @@ void EvalSpec::add_rule(const ParamSpec &a_spec, const ParamSpec &b_spec, } } -vespalib::string -EvalSpec::EvalTest::as_string(const std::vector ¶m_names, +std::string +EvalSpec::EvalTest::as_string(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression) + const std::string &expression) { assert(param_values.size() == param_names.size()); - vespalib::string str; + std::string str; str += "f("; for (size_t i = 0; i < param_names.size(); ++i) { if (i > 0) { diff --git a/eval/src/vespa/eval/eval/test/eval_spec.h b/eval/src/vespa/eval/eval/test/eval_spec.h index a26fd6268103..d46724b74599 100644 --- a/eval/src/vespa/eval/eval/test/eval_spec.h +++ b/eval/src/vespa/eval/eval/test/eval_spec.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include #include namespace vespalib::eval::test { @@ -27,10 +27,10 @@ class EvalSpec Case(std::initializer_list param_values_in, double expected_result_in) : param_values(param_values_in), expected_result(expected_result_in) {} }; - std::vector param_names; - vespalib::string expression; + std::vector param_names; + std::string expression; std::vector cases; - Expression(std::initializer_list param_names_in, vespalib::string expression_in) + Expression(std::initializer_list param_names_in, std::string expression_in) : param_names(param_names_in), expression(expression_in) {} ~Expression(); @@ -40,13 +40,13 @@ class EvalSpec }; std::vector expressions; - Expression &add_expression(std::initializer_list param_names, vespalib::string expression) { + Expression &add_expression(std::initializer_list param_names, std::string expression) { expressions.emplace_back(param_names, expression); return expressions.back(); } struct ParamSpec { - vespalib::string name; + std::string name; double min; double max; std::vector expand(size_t inner_samples) const { @@ -70,21 +70,21 @@ class EvalSpec } }; - void add_rule(const ParamSpec &a_spec, const vespalib::string &expression, fun_1_ref ref); + void add_rule(const ParamSpec &a_spec, const std::string &expression, fun_1_ref ref); - void add_rule(const ParamSpec &a_spec, const ParamSpec &b_spec, const vespalib::string &expression, fun_2_ref ref); + void add_rule(const ParamSpec &a_spec, const ParamSpec &b_spec, const std::string &expression, fun_2_ref ref); public: struct EvalTest { - static vespalib::string as_string(const std::vector ¶m_names, + static std::string as_string(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression); + const std::string &expression); bool is_same(double expected, double actual); - virtual void next_expression(const std::vector ¶m_names, - const vespalib::string &expression) = 0; - virtual void handle_case(const std::vector ¶m_names, + virtual void next_expression(const std::vector ¶m_names, + const std::string &expression) = 0; + virtual void handle_case(const std::vector ¶m_names, const std::vector ¶m_values, - const vespalib::string &expression, + const std::string &expression, double expected_result) = 0; virtual ~EvalTest() {} }; diff --git a/eval/src/vespa/eval/eval/test/gen_spec.cpp b/eval/src/vespa/eval/eval/test/gen_spec.cpp index b14a0617a622..b29feabc5660 100644 --- a/eval/src/vespa/eval/eval/test/gen_spec.cpp +++ b/eval/src/vespa/eval/eval/test/gen_spec.cpp @@ -47,12 +47,12 @@ Sequence Seq(const std::vector &seq) { //----------------------------------------------------------------------------- -DimSpec::DimSpec(const vespalib::string &name, size_t size) noexcept +DimSpec::DimSpec(const std::string &name, size_t size) noexcept : _name(name), _size(size), _dict() { assert(_size); } -DimSpec::DimSpec(const vespalib::string &name, std::vector dict) noexcept +DimSpec::DimSpec(const std::string &name, std::vector dict) noexcept : _name(name), _size(), _dict(std::move(dict)) { assert(!_size); @@ -65,10 +65,10 @@ DimSpec & DimSpec::operator=(const DimSpec &) = default; DimSpec::~DimSpec() = default; -std::vector -DimSpec::make_dict(size_t size, size_t stride, const vespalib::string &prefix) +std::vector +DimSpec::make_dict(size_t size, size_t stride, const std::string &prefix) { - std::vector dict; + std::vector dict; for (size_t i = 0; i < size; ++i) { dict.push_back(fmt("%s%zu", prefix.c_str(), (i + 1) * stride)); } @@ -84,10 +84,10 @@ auto is_dim_name = [](char c) { // 'a2' -> DimSpec("a", 2); // 'b2_3' -> DimSpec("b", make_dict(2, 3, "")); DimSpec -DimSpec::from_desc(const vespalib::string &desc) +DimSpec::from_desc(const std::string &desc) { size_t idx = 0; - vespalib::string name; + std::string name; auto is_num = [](char c) { return ((c >= '0') && (c <= '9')); }; auto as_num = [](char c) { return size_t(c - '0'); }; auto is_map_tag = [](char c) { return (c == '_'); }; @@ -119,10 +119,10 @@ DimSpec::from_desc(const vespalib::string &desc) // 'a2b12c5' -> GenSpec().idx("a", 2).idx("b", 12).idx("c", 5); // 'a2_1b3_2c5_1' -> GenSpec().map("a", 2).map("b", 3, 2).map("c", 5); GenSpec -GenSpec::from_desc(const vespalib::string &desc) +GenSpec::from_desc(const std::string &desc) { size_t idx = 0; - vespalib::string dim_desc; + std::string dim_desc; std::vector dim_list; while (idx < desc.size()) { dim_desc.clear(); diff --git a/eval/src/vespa/eval/eval/test/gen_spec.h b/eval/src/vespa/eval/eval/test/gen_spec.h index 79d8318081a7..4b52a56af97d 100644 --- a/eval/src/vespa/eval/eval/test/gen_spec.h +++ b/eval/src/vespa/eval/eval/test/gen_spec.h @@ -52,22 +52,22 @@ Sequence Seq(const std::vector &seq); class DimSpec { private: - vespalib::string _name; + std::string _name; size_t _size; - std::vector _dict; + std::vector _dict; public: - DimSpec(const vespalib::string &name, size_t size) noexcept; - DimSpec(const vespalib::string &name, std::vector dict) noexcept; + DimSpec(const std::string &name, size_t size) noexcept; + DimSpec(const std::string &name, std::vector dict) noexcept; DimSpec(DimSpec &&) noexcept; DimSpec & operator=(DimSpec &&) noexcept; DimSpec & operator=(const DimSpec &); DimSpec(const DimSpec &); ~DimSpec(); - static std::vector make_dict(size_t size, size_t stride, const vespalib::string &prefix); + static std::vector make_dict(size_t size, size_t stride, const std::string &prefix); ValueType::Dimension type() const { return _size ? ValueType::Dimension{_name, uint32_t(_size)} : ValueType::Dimension{_name}; } - const vespalib::string &name() const { return _name; } + const std::string &name() const { return _name; } size_t size() const { return _size ? _size : _dict.size(); } @@ -81,7 +81,7 @@ class DimSpec // // 'a2' -> DimSpec("a", 2); // 'b2_3' -> DimSpec("b", make_dict(2, 3, "")); - static DimSpec from_desc(const vespalib::string &desc); + static DimSpec from_desc(const std::string &desc); }; /** @@ -108,7 +108,7 @@ class GenSpec // // 'a2b12c5' -> GenSpec().idx("a", 2).idx("b", 12).idx("c", 5); // 'a2_1b3_2c5_1' -> GenSpec().map("a", 2).map("b", 3, 2).map("c", 5); - static GenSpec from_desc(const vespalib::string &desc); + static GenSpec from_desc(const std::string &desc); GenSpec(GenSpec &&other) noexcept; GenSpec(const GenSpec &other); @@ -119,20 +119,20 @@ class GenSpec CellType cells() const { return _cells; } const seq_t &seq() const { return _seq; } GenSpec cpy() const { return *this; } - GenSpec &idx(const vespalib::string &name, size_t size) { + GenSpec &idx(const std::string &name, size_t size) { assert(size != 0); _dims.emplace_back(name, size); return *this; } - GenSpec &map(const vespalib::string &name, size_t size, size_t stride = 1, const vespalib::string &prefix = "") { + GenSpec &map(const std::string &name, size_t size, size_t stride = 1, const std::string &prefix = "") { _dims.emplace_back(name, DimSpec::make_dict(size, stride, prefix)); return *this; } - GenSpec &map(const vespalib::string &name, std::vector dict) { + GenSpec &map(const std::string &name, std::vector dict) { _dims.emplace_back(name, std::move(dict)); return *this; } - GenSpec &desc(const vespalib::string &dim_desc) { + GenSpec &desc(const std::string &dim_desc) { _dims.push_back(DimSpec::from_desc(dim_desc)); return *this; } diff --git a/eval/src/vespa/eval/eval/test/reference_evaluation.cpp b/eval/src/vespa/eval/eval/test/reference_evaluation.cpp index 5a1fd2041dd3..02c8982fc725 100644 --- a/eval/src/vespa/eval/eval/test/reference_evaluation.cpp +++ b/eval/src/vespa/eval/eval/test/reference_evaluation.cpp @@ -69,15 +69,15 @@ struct EvalNode : public NodeVisitor { result = ReferenceOperations::merge(eval_node(a, params), eval_node(b, params), op2); } - void eval_reduce(const Node &a, Aggr aggr, const std::vector &dimensions) { + void eval_reduce(const Node &a, Aggr aggr, const std::vector &dimensions) { result = ReferenceOperations::reduce(eval_node(a, params), aggr, dimensions); } - void eval_rename(const Node &a, const std::vector &from, const std::vector &to) { + void eval_rename(const Node &a, const std::vector &from, const std::vector &to) { result = ReferenceOperations::rename(eval_node(a, params), from, to); } - void eval_concat(const Node &a, const Node &b, const vespalib::string &dimension) { + void eval_concat(const Node &a, const Node &b, const std::string &dimension) { result = ReferenceOperations::concat(eval_node(a, params), eval_node(b, params), dimension); } @@ -113,14 +113,14 @@ struct EvalNode : public NodeVisitor { void eval_peek(const TensorPeek &node) { TensorSpec param = eval_node(node.param(), params); ValueType param_type = ValueType::from_spec(param.type()); - auto is_indexed = [&](const vespalib::string &dim_name) { + auto is_indexed = [&](const std::string &dim_name) { size_t dim_idx = param_type.dimension_index(dim_name); return ((dim_idx != ValueType::Dimension::npos) && (param_type.dimensions()[dim_idx].is_indexed())); }; std::vector children; children.push_back(param); - std::map> spec; + std::map> spec; for (const auto &[name, label]: node.dim_list()) { if (label.is_expr()) { spec.emplace(name, size_t(children.size())); diff --git a/eval/src/vespa/eval/eval/test/reference_operations.cpp b/eval/src/vespa/eval/eval/test/reference_operations.cpp index 6771eda91e30..9603fcef9e36 100644 --- a/eval/src/vespa/eval/eval/test/reference_operations.cpp +++ b/eval/src/vespa/eval/eval/test/reference_operations.cpp @@ -61,7 +61,7 @@ bool join_address(const TensorSpec::Address &a, const TensorSpec::Address &b, Te return true; } -vespalib::string rename_dimension(const vespalib::string &name, const std::vector &from, const std::vector &to) { +std::string rename_dimension(const std::string &name, const std::vector &from, const std::vector &to) { for (size_t i = 0; i < from.size(); ++i) { if (name == from[i]) { return to[i]; @@ -125,7 +125,7 @@ TensorSpec ReferenceOperations::concat(const TensorSpec &in_a, const TensorSpec } -TensorSpec ReferenceOperations::create(const vespalib::string &type, const CreateSpec &spec, const std::vector &children) { +TensorSpec ReferenceOperations::create(const std::string &type, const CreateSpec &spec, const std::vector &children) { TensorSpec result(type); if (ValueType::from_spec(type).is_error()) { return result; @@ -253,7 +253,7 @@ TensorSpec ReferenceOperations::peek(const PeekSpec &peek_spec, const std::vecto if (peek_spec.empty() || children.empty()) { return TensorSpec(ValueType::error_type().to_spec()); } - std::vector peek_dims; + std::vector peek_dims; for (const auto & [dim_name, label_or_child] : peek_spec) { peek_dims.push_back(dim_name); } @@ -264,7 +264,7 @@ TensorSpec ReferenceOperations::peek(const PeekSpec &peek_spec, const std::vecto if (result_type.is_error()) { return result; } - auto is_mapped_dim = [&](const vespalib::string &name) { + auto is_mapped_dim = [&](const std::string &name) { size_t dim_idx = param_type.dimension_index(name); assert(dim_idx != ValueType::Dimension::npos); const auto ¶m_dim = param_type.dimensions()[dim_idx]; @@ -272,7 +272,7 @@ TensorSpec ReferenceOperations::peek(const PeekSpec &peek_spec, const std::vecto }; TensorSpec::Address addr; for (const auto & [dim_name, label_or_child] : peek_spec) { - const vespalib::string &dim = dim_name; + const std::string &dim = dim_name; std::visit(vespalib::overload { [&](const TensorSpec::Label &label) { @@ -311,7 +311,7 @@ TensorSpec ReferenceOperations::peek(const PeekSpec &peek_spec, const std::vecto } -TensorSpec ReferenceOperations::reduce(const TensorSpec &in_a, Aggr aggr, const std::vector &dims) { +TensorSpec ReferenceOperations::reduce(const TensorSpec &in_a, Aggr aggr, const std::vector &dims) { auto a = in_a.normalize(); ValueType res_type = ValueType::from_spec(a.type()).reduce(dims); TensorSpec result(res_type.to_spec()); @@ -342,7 +342,7 @@ TensorSpec ReferenceOperations::reduce(const TensorSpec &in_a, Aggr aggr, const } -TensorSpec ReferenceOperations::rename(const TensorSpec &in_a, const std::vector &from, const std::vector &to) { +TensorSpec ReferenceOperations::rename(const TensorSpec &in_a, const std::vector &from, const std::vector &to) { auto a = in_a.normalize(); assert(from.size() == to.size()); ValueType res_type = ValueType::from_spec(a.type()).rename(from, to); @@ -360,7 +360,7 @@ TensorSpec ReferenceOperations::rename(const TensorSpec &in_a, const std::vector return result.normalize(); } -TensorSpec ReferenceOperations::lambda(const vespalib::string &type_in, lambda_fun_t fun) { +TensorSpec ReferenceOperations::lambda(const std::string &type_in, lambda_fun_t fun) { ValueType type = ValueType::from_spec(type_in); TensorSpec result(type.to_spec()); if (type.is_error()) { diff --git a/eval/src/vespa/eval/eval/test/reference_operations.h b/eval/src/vespa/eval/eval/test/reference_operations.h index dd9c4b143ed7..833ea50ab212 100644 --- a/eval/src/vespa/eval/eval/test/reference_operations.h +++ b/eval/src/vespa/eval/eval/test/reference_operations.h @@ -31,15 +31,15 @@ struct ReferenceOperations { static TensorSpec cell_cast(const TensorSpec &a, CellType to); static TensorSpec concat(const TensorSpec &a, const TensorSpec &b, const std::string &concat_dim); - static TensorSpec create(const vespalib::string &type, const CreateSpec &spec, const std::vector &children); + static TensorSpec create(const std::string &type, const CreateSpec &spec, const std::vector &children); static TensorSpec join(const TensorSpec &a, const TensorSpec &b, join_fun_t function); static TensorSpec map(const TensorSpec &a, map_fun_t func); static TensorSpec map_subspaces(const TensorSpec &a, map_subspace_fun_t fun); static TensorSpec merge(const TensorSpec &a, const TensorSpec &b, join_fun_t fun); static TensorSpec peek(const PeekSpec &spec, const std::vector &children); - static TensorSpec reduce(const TensorSpec &a, Aggr aggr, const std::vector &dims); - static TensorSpec rename(const TensorSpec &a, const std::vector &from, const std::vector &to); - static TensorSpec lambda(const vespalib::string &type, lambda_fun_t fun); + static TensorSpec reduce(const TensorSpec &a, Aggr aggr, const std::vector &dims); + static TensorSpec rename(const TensorSpec &a, const std::vector &from, const std::vector &to); + static TensorSpec lambda(const std::string &type, lambda_fun_t fun); }; } // namespace diff --git a/eval/src/vespa/eval/eval/test/test_io.cpp b/eval/src/vespa/eval/eval/test/test_io.cpp index 02747a9006a5..cba2a3ea17ab 100644 --- a/eval/src/vespa/eval/eval/test/test_io.cpp +++ b/eval/src/vespa/eval/eval/test/test_io.cpp @@ -87,7 +87,7 @@ ServerCmd::maybe_exit() } void -ServerCmd::dump_string(const char *prefix, const vespalib::string &str) +ServerCmd::dump_string(const char *prefix, const std::string &str) { fprintf(stderr, "%s%s: '%s'\n", prefix, _basename.c_str(), str.c_str()); } @@ -101,7 +101,7 @@ ServerCmd::dump_message(const char *prefix, const Slime &slime) fprintf(stderr, "%s%s: %s", prefix, _basename.c_str(), str.c_str()); } -ServerCmd::ServerCmd(vespalib::string cmd) +ServerCmd::ServerCmd(std::string cmd) : _child(cmd), _basename(fs::path(cmd).filename()), _closed(false), @@ -110,7 +110,7 @@ ServerCmd::ServerCmd(vespalib::string cmd) { } -ServerCmd::ServerCmd(vespalib::string cmd, capture_stderr_tag) +ServerCmd::ServerCmd(std::string cmd, capture_stderr_tag) : _child(cmd, true), _basename(fs::path(cmd).filename()), _closed(false), @@ -136,10 +136,10 @@ ServerCmd::invoke(const Slime &req) return reply; } -vespalib::string -ServerCmd::write_then_read_all(const vespalib::string &input) +std::string +ServerCmd::write_then_read_all(const std::string &input) { - vespalib::string result; + std::string result; dump_string("input --> ", input); memcpy(_child.reserve(input.size()).data, input.data(), input.size()); _child.commit(input.size()); @@ -163,7 +163,7 @@ ServerCmd::shutdown() //----------------------------------------------------------------------------- bool -LineReader::read_line(vespalib::string &line) +LineReader::read_line(std::string &line) { line.clear(); for (auto mem = _input.obtain(); mem.size > 0; mem = _input.obtain()) { diff --git a/eval/src/vespa/eval/eval/test/test_io.h b/eval/src/vespa/eval/eval/test/test_io.h index 986af5f45fc4..5fae76430de4 100644 --- a/eval/src/vespa/eval/eval/test/test_io.h +++ b/eval/src/vespa/eval/eval/test/test_io.h @@ -46,7 +46,7 @@ class StdOut : public Output { class ServerCmd { private: Process _child; - vespalib::string _basename; + std::string _basename; bool _closed; bool _exited; int _exit_code; @@ -54,16 +54,16 @@ class ServerCmd { void maybe_close(); void maybe_exit(); - void dump_string(const char *prefix, const vespalib::string &str); + void dump_string(const char *prefix, const std::string &str); void dump_message(const char *prefix, const Slime &slime); public: struct capture_stderr_tag{}; - ServerCmd(vespalib::string cmd); - ServerCmd(vespalib::string cmd, capture_stderr_tag); + ServerCmd(std::string cmd); + ServerCmd(std::string cmd, capture_stderr_tag); ~ServerCmd(); Slime invoke(const Slime &req); - vespalib::string write_then_read_all(const vespalib::string &input); + std::string write_then_read_all(const std::string &input); int shutdown(); }; @@ -75,7 +75,7 @@ class LineReader { Input &_input; public: LineReader(Input &input) : _input(input) {} - bool read_line(vespalib::string &line); + bool read_line(std::string &line); }; /** diff --git a/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.cpp b/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.cpp index 5e6a114e62be..78c87978e690 100644 --- a/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.cpp +++ b/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.cpp @@ -86,13 +86,13 @@ struct Target { }; struct AddressExtractor : ObjectTraverser { - const std::set &indexed; + const std::set &indexed; TensorSpec::Address &address; - AddressExtractor(const std::set &indexed_in, + AddressExtractor(const std::set &indexed_in, TensorSpec::Address &address_out) : indexed(indexed_in), address(address_out) {} void field(const Memory &symbol, const Inspector &inspector) override { - vespalib::string dimension = symbol.make_string(); + std::string dimension = symbol.make_string(); if (dimension.empty()) { LOG(warning, "missing 'dimension' in address"); throw std::exception(); @@ -107,7 +107,7 @@ struct AddressExtractor : ObjectTraverser { } return; } - vespalib::string label = inspector.asString().make_string(); + std::string label = inspector.asString().make_string(); if (label.empty()) { auto got = inspector.toString(); int sz = got.size(); @@ -131,14 +131,14 @@ struct AddressExtractor : ObjectTraverser { }; struct SingleMappedExtractor : ObjectTraverser { - const vespalib::string &dimension; + const std::string &dimension; Target ⌖ - SingleMappedExtractor(const vespalib::string &dimension_in, Target &target_in) + SingleMappedExtractor(const std::string &dimension_in, Target &target_in) : dimension(dimension_in), target(target_in) {} void field(const Memory &symbol, const Inspector &inspector) override { - vespalib::string label = symbol.make_string(); + std::string label = symbol.make_string(); double value = decodeDouble(inspector); TensorSpec::Address address; address.emplace(dimension, label); @@ -201,9 +201,9 @@ void decodeSingleMappedBlocks(const Inspector &blocks, const ValueType &value_ty if (value_type.count_mapped_dimensions() != 1) { return; // TODO handle mismatch } - vespalib::string dim_name = value_type.mapped_dimensions()[0].name; + std::string dim_name = value_type.mapped_dimensions()[0].name; DenseValuesDecoder decoder{value_type.indexed_dimensions(), target}; - auto lambda = [&](vespalib::string label, const Inspector &input) { + auto lambda = [&](std::string label, const Inspector &input) { TensorSpec::Address address; address.emplace(dim_name, std::move(label)); decoder.decode(input, std::move(address), 0); @@ -214,7 +214,7 @@ void decodeSingleMappedBlocks(const Inspector &blocks, const ValueType &value_ty void decodeAddressedBlocks(const Inspector &blocks, const ValueType &value_type, Target &target) { const auto & idims = value_type.indexed_dimensions(); - std::set indexed; + std::set indexed; for (const auto &dimension: idims) { indexed.insert(dimension.name); } @@ -228,7 +228,7 @@ void decodeAddressedBlocks(const Inspector &blocks, const ValueType &value_type, } void decodeLiteralForm(const Inspector &cells, const ValueType &value_type, Target &target) { - std::set indexed; + std::set indexed; for (const auto &dimension: value_type.dimensions()) { if (dimension.is_indexed()) { indexed.insert(dimension.name); @@ -242,13 +242,13 @@ void decodeLiteralForm(const Inspector &cells, const ValueType &value_type, Targ } } -void decode_json(const vespalib::string &path, Input &input, Slime &slime) { +void decode_json(const std::string &path, Input &input, Slime &slime) { if (slime::JsonFormat::decode(input, slime) == 0) { LOG(warning, "file contains invalid json: %s", path.c_str()); } } -void decode_json(const vespalib::string &path, Slime &slime) { +void decode_json(const std::string &path, Slime &slime) { MappedFileInput file(path); if (!file.valid()) { LOG(warning, "could not read file: %s", path.c_str()); @@ -272,7 +272,7 @@ void decode_json(const vespalib::string &path, Slime &slime) { ConstantTensorLoader::~ConstantTensorLoader() = default; ConstantValue::UP -ConstantTensorLoader::create(const vespalib::string &path, const vespalib::string &type) const +ConstantTensorLoader::create(const std::string &path, const std::string &type) const { ValueType value_type = ValueType::from_spec(type); if (value_type.is_error()) { diff --git a/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.h b/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.h index bb02af55eebc..eda3c1b77fb8 100644 --- a/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.h +++ b/eval/src/vespa/eval/eval/value_cache/constant_tensor_loader.h @@ -3,7 +3,7 @@ #pragma once #include "constant_value.h" -#include +#include namespace vespalib::eval { @@ -21,7 +21,7 @@ class ConstantTensorLoader : public ConstantValueFactory public: ConstantTensorLoader(const ValueBuilderFactory &factory) : _factory(factory) {} ~ConstantTensorLoader(); - ConstantValue::UP create(const vespalib::string &path, const vespalib::string &type) const override; + ConstantValue::UP create(const std::string &path, const std::string &type) const override; }; } diff --git a/eval/src/vespa/eval/eval/value_cache/constant_value.h b/eval/src/vespa/eval/eval/value_cache/constant_value.h index 80f4b15cb7b3..4f5a10bdec82 100644 --- a/eval/src/vespa/eval/eval/value_cache/constant_value.h +++ b/eval/src/vespa/eval/eval/value_cache/constant_value.h @@ -45,7 +45,7 @@ class BadConstantValue : public ConstantValue { * to share constants among users. **/ struct ConstantValueFactory { - virtual ConstantValue::UP create(const vespalib::string &path, const vespalib::string &type) const = 0; + virtual ConstantValue::UP create(const std::string &path, const std::string &type) const = 0; virtual ~ConstantValueFactory() {} }; diff --git a/eval/src/vespa/eval/eval/value_cache/constant_value_cache.cpp b/eval/src/vespa/eval/eval/value_cache/constant_value_cache.cpp index ef41e22caa4d..52325fb17e0b 100644 --- a/eval/src/vespa/eval/eval/value_cache/constant_value_cache.cpp +++ b/eval/src/vespa/eval/eval/value_cache/constant_value_cache.cpp @@ -23,7 +23,7 @@ ConstantValueCache::ConstantValueCache(const ConstantValueFactory &factory) ConstantValueCache::~ConstantValueCache() = default; ConstantValue::UP -ConstantValueCache::create(const vespalib::string &path, const vespalib::string &type) const +ConstantValueCache::create(const std::string &path, const std::string &type) const { Cache::Key key = std::make_pair(path, type); std::lock_guard guard(_cache->lock); diff --git a/eval/src/vespa/eval/eval/value_cache/constant_value_cache.h b/eval/src/vespa/eval/eval/value_cache/constant_value_cache.h index d8bb03350265..b41acd2c0390 100644 --- a/eval/src/vespa/eval/eval/value_cache/constant_value_cache.h +++ b/eval/src/vespa/eval/eval/value_cache/constant_value_cache.h @@ -22,7 +22,7 @@ class ConstantValueCache : public ConstantValueFactory private: struct Cache { using SP = std::shared_ptr; - using Key = std::pair; + using Key = std::pair; struct Value { size_t num_refs; ConstantValue::UP const_value; @@ -49,7 +49,7 @@ class ConstantValueCache : public ConstantValueFactory public: ConstantValueCache(const ConstantValueFactory &factory); - ConstantValue::UP create(const vespalib::string &path, const vespalib::string &type) const override; + ConstantValue::UP create(const std::string &path, const std::string &type) const override; ~ConstantValueCache() override; }; diff --git a/eval/src/vespa/eval/eval/value_codec.cpp b/eval/src/vespa/eval/eval/value_codec.cpp index f5f6d844b00b..209f5fbd15f4 100644 --- a/eval/src/vespa/eval/eval/value_codec.cpp +++ b/eval/src/vespa/eval/eval/value_codec.cpp @@ -113,7 +113,7 @@ ValueType decode_type(nbostream &input, const Format &format) { if (format.has_sparse) { size_t cnt = input.getInt1_4Bytes(); for (size_t i = 0; i < cnt; ++i) { - vespalib::string name; + std::string name; input.readSmallString(name); dim_list.emplace_back(name); } @@ -121,7 +121,7 @@ ValueType decode_type(nbostream &input, const Format &format) { if (format.has_dense) { size_t cnt = input.getInt1_4Bytes(); for (size_t i = 0; i < cnt; ++i) { - vespalib::string name; + std::string name; input.readSmallString(name); dim_list.emplace_back(name, input.getInt1_4Bytes()); } @@ -143,7 +143,7 @@ size_t maybe_decode_num_blocks(nbostream &input, bool has_mapped_dims, const For void encode_mapped_labels(nbostream &output, size_t num_mapped_dims, const SmallVector &addr) { for (size_t i = 0; i < num_mapped_dims; ++i) { - vespalib::string str = SharedStringRepo::Handle::string_from_id(addr[i]); + std::string str = SharedStringRepo::Handle::string_from_id(addr[i]); output.writeSmallString(str); } } diff --git a/eval/src/vespa/eval/eval/value_codec.h b/eval/src/vespa/eval/eval/value_codec.h index 085237179b65..ee49d066ad14 100644 --- a/eval/src/vespa/eval/eval/value_codec.h +++ b/eval/src/vespa/eval/eval/value_codec.h @@ -4,8 +4,8 @@ #include "value.h" #include "tensor_spec.h" -#include #include +#include namespace vespalib { class nbostream; } diff --git a/eval/src/vespa/eval/eval/value_type.cpp b/eval/src/vespa/eval/eval/value_type.cpp index 7e67ba1121e2..4c0d12afadde 100644 --- a/eval/src/vespa/eval/eval/value_type.cpp +++ b/eval/src/vespa/eval/eval/value_type.cpp @@ -13,7 +13,7 @@ namespace { using Dimension = ValueType::Dimension; using DimensionList = std::vector; -size_t my_dimension_index(const std::vector &list, const vespalib::string &name) { +size_t my_dimension_index(const std::vector &list, const std::string &name) { for (size_t idx = 0; idx < list.size(); ++idx) { if (list[idx].name == name) { return idx; @@ -22,7 +22,7 @@ size_t my_dimension_index(const std::vector &list, const vespalib::st return ValueType::Dimension::npos; } -const Dimension *find_dimension(const std::vector &list, const vespalib::string &name) { +const Dimension *find_dimension(const std::vector &list, const std::string &name) { size_t idx = my_dimension_index(list, name); return (idx != ValueType::Dimension::npos) ? &list[idx] : nullptr; } @@ -47,7 +47,7 @@ bool verify_dimensions(const DimensionList &dimensions) { struct MyReduce { bool has_error; std::vector dimensions; - MyReduce(const std::vector &dim_list, const std::vector &rem_list) + MyReduce(const std::vector &dim_list, const std::vector &rem_list) : has_error(false), dimensions() { if (!rem_list.empty()) { @@ -69,10 +69,10 @@ struct MyReduce { struct MyJoin { bool mismatch; DimensionList dimensions; - vespalib::string concat_dim; + std::string concat_dim; MyJoin(const DimensionList &lhs, const DimensionList &rhs) : mismatch(false), dimensions(), concat_dim() { my_join(lhs, rhs); } - MyJoin(const DimensionList &lhs, const DimensionList &rhs, const vespalib::string & concat_dim_in) + MyJoin(const DimensionList &lhs, const DimensionList &rhs, const std::string & concat_dim_in) : mismatch(false), dimensions(), concat_dim(concat_dim_in) { my_join(lhs, rhs); } ~MyJoin(); private: @@ -121,13 +121,13 @@ struct MyJoin { MyJoin::~MyJoin() = default; struct Renamer { - const std::vector &from; - const std::vector &to; + const std::vector &from; + const std::vector &to; size_t match_cnt; - Renamer(const std::vector &from_in, - const std::vector &to_in) + Renamer(const std::vector &from_in, + const std::vector &to_in) : from(from_in), to(to_in), match_cnt(0) {} - const vespalib::string &rename(const vespalib::string &name) { + const std::string &rename(const std::string &name) { for (size_t i = 0; i < from.size(); ++i) { if (name == from[i]) { ++match_cnt; @@ -281,13 +281,13 @@ ValueType::mapped_dimensions() const } size_t -ValueType::dimension_index(const vespalib::string &name) const +ValueType::dimension_index(const std::string &name) const { return my_dimension_index(_dimensions, name); } size_t -ValueType::stride_of(const vespalib::string &name) const +ValueType::stride_of(const std::string &name) const { size_t stride = 0; for (const auto &dim: dimensions()) { @@ -302,10 +302,10 @@ ValueType::stride_of(const vespalib::string &name) const return stride; } -std::vector +std::vector ValueType::dimension_names() const { - std::vector result; + std::vector result; result.reserve(_dimensions.size()); for (const auto &dimension: _dimensions) { result.push_back(dimension.name); @@ -346,7 +346,7 @@ ValueType::map() const } ValueType -ValueType::reduce(const std::vector &dimensions_in) const +ValueType::reduce(const std::vector &dimensions_in) const { MyReduce result(_dimensions, dimensions_in); auto meta = cell_meta().reduce(result.dimensions.empty()); @@ -355,7 +355,7 @@ ValueType::reduce(const std::vector &dimensions_in) const } ValueType -ValueType::peek(const std::vector &dimensions_in) const +ValueType::peek(const std::vector &dimensions_in) const { MyReduce result(_dimensions, dimensions_in); auto meta = cell_meta().peek(result.dimensions.empty()); @@ -364,8 +364,8 @@ ValueType::peek(const std::vector &dimensions_in) const } ValueType -ValueType::rename(const std::vector &from, - const std::vector &to) const +ValueType::rename(const std::vector &from, + const std::vector &to) const { if (from.empty() || (from.size() != to.size())) { return error_type(); @@ -401,18 +401,18 @@ ValueType::make_type(CellType cell_type, std::vector dimensions_in) } ValueType -ValueType::from_spec(const vespalib::string &spec) +ValueType::from_spec(const std::string &spec) { return value_type::from_spec(spec); } ValueType -ValueType::from_spec(const vespalib::string &spec, std::vector &unsorted) +ValueType::from_spec(const std::string &spec, std::vector &unsorted) { return value_type::from_spec(spec, unsorted); } -vespalib::string +std::string ValueType::to_spec() const { return value_type::to_spec(*this); @@ -436,7 +436,7 @@ ValueType::merge(const ValueType &lhs, const ValueType &rhs) } ValueType -ValueType::concat(const ValueType &lhs, const ValueType &rhs, const vespalib::string &dimension) +ValueType::concat(const ValueType &lhs, const ValueType &rhs, const std::string &dimension) { MyJoin result(lhs._dimensions, rhs._dimensions, dimension); if (!find_dimension(result.dimensions, dimension)) { diff --git a/eval/src/vespa/eval/eval/value_type.h b/eval/src/vespa/eval/eval/value_type.h index bef7a14bc78e..2b433ddd7760 100644 --- a/eval/src/vespa/eval/eval/value_type.h +++ b/eval/src/vespa/eval/eval/value_type.h @@ -3,7 +3,7 @@ #pragma once #include "cell_type.h" -#include +#include #include namespace vespalib::eval { @@ -19,11 +19,11 @@ class ValueType struct Dimension { using size_type = uint32_t; static constexpr size_type npos = -1; - vespalib::string name; + std::string name; size_type size; - Dimension(vespalib::string name_in) noexcept + Dimension(std::string name_in) noexcept : name(std::move(name_in)), size(npos) {} - Dimension(vespalib::string name_in, size_type size_in) noexcept + Dimension(std::string name_in, size_type size_in) noexcept : name(std::move(name_in)), size(size_in) {} bool operator==(const Dimension &rhs) const noexcept { return ((name == rhs.name) && (size == rhs.size)); @@ -68,12 +68,12 @@ class ValueType std::vector nontrivial_indexed_dimensions() const; std::vector indexed_dimensions() const; std::vector mapped_dimensions() const; - size_t dimension_index(const vespalib::string &name) const; - size_t stride_of(const vespalib::string &name) const; - bool has_dimension(const vespalib::string &name) const { + size_t dimension_index(const std::string &name) const; + size_t stride_of(const std::string &name) const; + bool has_dimension(const std::string &name) const { return (dimension_index(name) != Dimension::npos); } - std::vector dimension_names() const; + std::vector dimension_names() const; bool operator==(const ValueType &rhs) const noexcept { return ((_error == rhs._error) && (_cell_type == rhs._cell_type) && @@ -85,21 +85,21 @@ class ValueType ValueType strip_indexed_dimensions() const; ValueType wrap(const ValueType &inner); ValueType map() const; - ValueType reduce(const std::vector &dimensions_in) const; - ValueType peek(const std::vector &dimensions_in) const; - ValueType rename(const std::vector &from, - const std::vector &to) const; + ValueType reduce(const std::vector &dimensions_in) const; + ValueType peek(const std::vector &dimensions_in) const; + ValueType rename(const std::vector &from, + const std::vector &to) const; ValueType cell_cast(CellType to_cell_type) const; static ValueType error_type() { return {}; } static ValueType make_type(CellType cell_type, std::vector dimensions_in); static ValueType double_type() { return make_type(CellType::DOUBLE, {}); } - static ValueType from_spec(const vespalib::string &spec); - static ValueType from_spec(const vespalib::string &spec, std::vector &unsorted); - vespalib::string to_spec() const; + static ValueType from_spec(const std::string &spec); + static ValueType from_spec(const std::string &spec, std::vector &unsorted); + std::string to_spec() const; static ValueType join(const ValueType &lhs, const ValueType &rhs); static ValueType merge(const ValueType &lhs, const ValueType &rhs); - static ValueType concat(const ValueType &lhs, const ValueType &rhs, const vespalib::string &dimension); + static ValueType concat(const ValueType &lhs, const ValueType &rhs, const std::string &dimension); static ValueType either(const ValueType &one, const ValueType &other); }; diff --git a/eval/src/vespa/eval/eval/value_type_spec.cpp b/eval/src/vespa/eval/eval/value_type_spec.cpp index 7639194b7227..f18dc60034d1 100644 --- a/eval/src/vespa/eval/eval/value_type_spec.cpp +++ b/eval/src/vespa/eval/eval/value_type_spec.cpp @@ -9,7 +9,7 @@ namespace vespalib::eval::value_type { -vespalib::string cell_type_to_name(CellType cell_type) { +std::string cell_type_to_name(CellType cell_type) { switch (cell_type) { case CellType::DOUBLE: return "double"; case CellType::FLOAT: return "float"; @@ -19,7 +19,7 @@ vespalib::string cell_type_to_name(CellType cell_type) { abort(); } -std::optional cell_type_from_name(const vespalib::string &name) { +std::optional cell_type_from_name(const std::string &name) { for (CellType t : CellTypeUtils::list_types()) { if (name == cell_type_to_name(t)) { return t; @@ -99,9 +99,9 @@ bool is_ident(char c, bool first) { (c >= '0' && c <= '9' && !first)); } -vespalib::string parse_ident(ParseContext &ctx) { +std::string parse_ident(ParseContext &ctx) { ctx.skip_spaces(); - vespalib::string ident; + std::string ident; if (is_ident(ctx.get(), true)) { ident.push_back(ctx.get()); for (ctx.next(); is_ident(ctx.get(), false); ctx.next()) { @@ -114,7 +114,7 @@ vespalib::string parse_ident(ParseContext &ctx) { size_t parse_int(ParseContext &ctx) { ctx.skip_spaces(); - vespalib::string num; + std::string num; for (; std::isdigit(static_cast(ctx.get())); ctx.next()) { num.push_back(ctx.get()); } @@ -191,7 +191,7 @@ parse_spec(const char *pos_in, const char *end_in, const char *&pos_out, std::vector *unsorted) { ParseContext ctx(pos_in, end_in, pos_out); - vespalib::string type_name = parse_ident(ctx); + std::string type_name = parse_ident(ctx); if (type_name == "error") { return ValueType::error_type(); } else if (type_name == "double") { @@ -212,7 +212,7 @@ parse_spec(const char *pos_in, const char *end_in, const char *&pos_out, } ValueType -from_spec(const vespalib::string &spec) +from_spec(const std::string &spec) { const char *after = nullptr; const char *end = spec.data() + spec.size(); @@ -224,7 +224,7 @@ from_spec(const vespalib::string &spec) } ValueType -from_spec(const vespalib::string &spec, std::vector &unsorted) +from_spec(const std::string &spec, std::vector &unsorted) { const char *after = nullptr; const char *end = spec.data() + spec.size(); @@ -235,7 +235,7 @@ from_spec(const vespalib::string &spec, std::vector &unsor return type; } -vespalib::string +std::string to_spec(const ValueType &type) { asciistream os; diff --git a/eval/src/vespa/eval/eval/value_type_spec.h b/eval/src/vespa/eval/eval/value_type_spec.h index a9e6b9ad1a46..3787da4a9ffd 100644 --- a/eval/src/vespa/eval/eval/value_type_spec.h +++ b/eval/src/vespa/eval/eval/value_type_spec.h @@ -7,14 +7,14 @@ namespace vespalib::eval::value_type { -std::optional cell_type_from_name(const vespalib::string &name); -vespalib::string cell_type_to_name(CellType cell_type); +std::optional cell_type_from_name(const std::string &name); +std::string cell_type_to_name(CellType cell_type); ValueType parse_spec(const char *pos_in, const char *end_in, const char *&pos_out, std::vector *unsorted = nullptr); -ValueType from_spec(const vespalib::string &spec); -ValueType from_spec(const vespalib::string &spec, std::vector &unsorted); -vespalib::string to_spec(const ValueType &type); +ValueType from_spec(const std::string &spec); +ValueType from_spec(const std::string &spec, std::vector &unsorted); +std::string to_spec(const ValueType &type); } diff --git a/eval/src/vespa/eval/eval/visit_stuff.cpp b/eval/src/vespa/eval/eval/visit_stuff.cpp index b0b7fc597e75..2b6a44446c3d 100644 --- a/eval/src/vespa/eval/eval/visit_stuff.cpp +++ b/eval/src/vespa/eval/eval/visit_stuff.cpp @@ -12,7 +12,7 @@ namespace vespalib::eval::visit { namespace { -vespalib::string name_of(map_fun_t fun) { +std::string name_of(map_fun_t fun) { if (fun == operation::Neg::f) return "-"; if (fun == operation::Not::f) return "!"; if (fun == operation::Cos::f) return "cos"; @@ -39,7 +39,7 @@ vespalib::string name_of(map_fun_t fun) { return "[other map function]"; } -vespalib::string name_of(join_fun_t fun) { +std::string name_of(join_fun_t fun) { if (fun == operation::Add::f) return "+"; if (fun == operation::Sub::f) return "-"; if (fun == operation::Mul::f) return "*"; @@ -67,7 +67,7 @@ vespalib::string name_of(join_fun_t fun) { } // namespace vespalib::eval::visit:: } // namespace vespalib::eval::visit -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::TensorFunction &value) { +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::TensorFunction &value) { visitor.openStruct(name, vespalib::getClassName(value)); { value.visit_self(visitor); @@ -76,29 +76,29 @@ void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const visitor.closeStruct(); } -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, vespalib::eval::visit::map_fun_t value) { +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, vespalib::eval::visit::map_fun_t value) { visitor.visitString(name, vespalib::eval::visit::name_of(value)); } -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, vespalib::eval::visit::join_fun_t value) { +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, vespalib::eval::visit::join_fun_t value) { visitor.visitString(name, vespalib::eval::visit::name_of(value)); } -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::Aggr &value) { - if (const vespalib::string *str_ptr = vespalib::eval::AggrNames::name_of(value)) { +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::Aggr &value) { + if (const std::string *str_ptr = vespalib::eval::AggrNames::name_of(value)) { visitor.visitString(name, *str_ptr); } else { visitor.visitNull(name); } } -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::visit::DimList &value) { - vespalib::string list = vespalib::eval::nodes::TensorRename::flatten(value.list); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::visit::DimList &value) { + std::string list = vespalib::eval::nodes::TensorRename::flatten(value.list); visitor.visitString(name, list); } -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::visit::FromTo &value) { - vespalib::string from = vespalib::eval::nodes::TensorRename::flatten(value.from); - vespalib::string to = vespalib::eval::nodes::TensorRename::flatten(value.to); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::visit::FromTo &value) { + std::string from = vespalib::eval::nodes::TensorRename::flatten(value.from); + std::string to = vespalib::eval::nodes::TensorRename::flatten(value.to); visitor.visitString(name, vespalib::make_string("%s -> %s", from.c_str(), to.c_str())); } diff --git a/eval/src/vespa/eval/eval/visit_stuff.h b/eval/src/vespa/eval/eval/visit_stuff.h index 5ce0804f2879..41f7e3977796 100644 --- a/eval/src/vespa/eval/eval/visit_stuff.h +++ b/eval/src/vespa/eval/eval/visit_stuff.h @@ -4,7 +4,7 @@ #include "operation.h" #include -#include +#include #include namespace vespalib { @@ -16,24 +16,24 @@ namespace visit { using map_fun_t = vespalib::eval::operation::op1_t; using join_fun_t = vespalib::eval::operation::op2_t; struct DimList { - const std::vector &list; - DimList(const std::vector &list_in) + const std::vector &list; + DimList(const std::vector &list_in) : list(list_in) {} }; struct FromTo { - const std::vector &from; - const std::vector &to; - FromTo(const std::vector &from_in, - const std::vector &to_in) + const std::vector &from; + const std::vector &to; + FromTo(const std::vector &from_in, + const std::vector &to_in) : from(from_in), to(to_in) {} }; } // namespace vespalib::eval::visit } // namespace vespalib::eval } // namespace vespalib -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::TensorFunction &value); -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, vespalib::eval::visit::map_fun_t value); -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, vespalib::eval::visit::join_fun_t value); -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::Aggr &value); -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::visit::DimList &value); -void visit(vespalib::ObjectVisitor &visitor, const vespalib::string &name, const vespalib::eval::visit::FromTo &value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::TensorFunction &value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, vespalib::eval::visit::map_fun_t value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, vespalib::eval::visit::join_fun_t value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::Aggr &value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::visit::DimList &value); +void visit(vespalib::ObjectVisitor &visitor, const std::string &name, const vespalib::eval::visit::FromTo &value); diff --git a/eval/src/vespa/eval/gp/gp.cpp b/eval/src/vespa/eval/gp/gp.cpp index 7d1fccc6edc8..2fd3e1b02aea 100644 --- a/eval/src/vespa/eval/gp/gp.cpp +++ b/eval/src/vespa/eval/gp/gp.cpp @@ -201,7 +201,7 @@ Program::size_of(Ref ref) const return sizes.back(); } -vespalib::string +std::string Program::as_string(Ref ref) const { assert_valid(ref, _program.size()); diff --git a/eval/src/vespa/eval/gp/gp.h b/eval/src/vespa/eval/gp/gp.h index 5cddf715e6f6..18ae77791b86 100644 --- a/eval/src/vespa/eval/gp/gp.h +++ b/eval/src/vespa/eval/gp/gp.h @@ -2,10 +2,10 @@ #pragma once -#include -#include +#include #include -#include +#include +#include namespace vespalib::gp { @@ -68,10 +68,10 @@ struct OpRepo { using value_op2 = Value (*)(Value lhs, Value rhs); static Value forward_op(Value lhs, Value) { return lhs; } struct Entry { - vespalib::string name; + std::string name; value_op2 fun; size_t cost; - Entry(const vespalib::string &name_in, value_op2 fun_in, size_t cost_in) noexcept + Entry(const std::string &name_in, value_op2 fun_in, size_t cost_in) noexcept : name(name_in), fun(fun_in), cost(cost_in) {} }; feedback_fun _find_weakness; @@ -81,11 +81,11 @@ struct OpRepo { { _list.emplace_back("forward", forward_op, 0); } - OpRepo &add(const vespalib::string &name, value_op2 fun) { + OpRepo &add(const std::string &name, value_op2 fun) { _list.emplace_back(name, fun, 1); return *this; } - const vespalib::string &name_of(size_t op) const { return _list[op].name; } + const std::string &name_of(size_t op) const { return _list[op].name; } size_t cost_of(size_t op) const { return _list[op].cost; } size_t max_op() const { return (_list.size() - 1); } void find_weakness(Random &rnd, Sim &sim) const { @@ -190,7 +190,7 @@ struct Program : public Sim { size_t get_cost(size_t alt) const; size_t size_of(Ref ref) const; - vespalib::string as_string(Ref ref) const; + std::string as_string(Ref ref) const; // implementation of the Sim interface size_t num_inputs() const override { return _in_cnt; } diff --git a/eval/src/vespa/eval/instruction/best_similarity_function.cpp b/eval/src/vespa/eval/instruction/best_similarity_function.cpp index 6ea152ad2a8a..ce1df359e804 100644 --- a/eval/src/vespa/eval/instruction/best_similarity_function.cpp +++ b/eval/src/vespa/eval/instruction/best_similarity_function.cpp @@ -78,7 +78,7 @@ void my_best_similarity_op(InterpretedFunction::State &state, uint64_t param) { //----------------------------------------------------------------------------- -size_t stride(const ValueType &type, const vespalib::string &name) { +size_t stride(const ValueType &type, const std::string &name) { size_t stride = 0; for (const auto &dim: type.dimensions()) { if (dim.is_indexed()) { @@ -93,7 +93,7 @@ size_t stride(const ValueType &type, const vespalib::string &name) { } bool check_dims(const ValueType &pri, const ValueType &sec, - const vespalib::string &best, const vespalib::string &inner) + const std::string &best, const std::string &inner) { if ((stride(pri, inner) != 1) || (stride(sec, inner) != 1)) { return false; @@ -112,7 +112,7 @@ bool check_dims(const ValueType &pri, const ValueType &sec, return true; } -size_t get_dim_size(const ValueType &type, const vespalib::string &dim) { +size_t get_dim_size(const ValueType &type, const std::string &dim) { size_t npos = ValueType::Dimension::npos; size_t idx = type.dimension_index(dim); assert(idx != npos); diff --git a/eval/src/vespa/eval/instruction/dense_lambda_peek_function.cpp b/eval/src/vespa/eval/instruction/dense_lambda_peek_function.cpp index 286e10458672..1a3be14eb3e3 100644 --- a/eval/src/vespa/eval/instruction/dense_lambda_peek_function.cpp +++ b/eval/src/vespa/eval/instruction/dense_lambda_peek_function.cpp @@ -61,7 +61,7 @@ DenseLambdaPeekFunction::compile_self(const ValueBuilderFactory &, Stash &stash) return InterpretedFunction::Instruction(op, wrap_param(self)); } -vespalib::string +std::string DenseLambdaPeekFunction::idx_fun_dump() const { return _idx_fun->dump_as_lambda(); } diff --git a/eval/src/vespa/eval/instruction/dense_lambda_peek_function.h b/eval/src/vespa/eval/instruction/dense_lambda_peek_function.h index 16e3298feff0..55647a4b9c7a 100644 --- a/eval/src/vespa/eval/instruction/dense_lambda_peek_function.h +++ b/eval/src/vespa/eval/instruction/dense_lambda_peek_function.h @@ -24,7 +24,7 @@ class DenseLambdaPeekFunction : public tensor_function::Op1 std::shared_ptr idx_fun); ~DenseLambdaPeekFunction() override; InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override; - vespalib::string idx_fun_dump() const; + std::string idx_fun_dump() const; bool result_is_mutable() const override { return true; } }; diff --git a/eval/src/vespa/eval/instruction/dense_matmul_function.cpp b/eval/src/vespa/eval/instruction/dense_matmul_function.cpp index 74966d64e0e2..2728e6a5c482 100644 --- a/eval/src/vespa/eval/instruction/dense_matmul_function.cpp +++ b/eval/src/vespa/eval/instruction/dense_matmul_function.cpp @@ -78,7 +78,7 @@ bool is_matrix(const ValueType &type) { } bool is_matmul(const ValueType &a, const ValueType &b, - const vespalib::string &reduce_dim, const ValueType &result_type) + const std::string &reduce_dim, const ValueType &result_type) { size_t npos = ValueType::Dimension::npos; return (is_matrix(a) && is_matrix(b) && is_matrix(result_type) && @@ -93,7 +93,7 @@ const ValueType::Dimension &dim(const TensorFunction &expr, size_t idx) { size_t inv(size_t idx) { return (1 - idx); } const TensorFunction &create_matmul(const TensorFunction &a, const TensorFunction &b, - const vespalib::string &reduce_dim, const ValueType &result_type, Stash &stash) { + const std::string &reduce_dim, const ValueType &result_type, Stash &stash) { size_t a_idx = a.result_type().dimension_index(reduce_dim); size_t b_idx = b.result_type().dimension_index(reduce_dim); assert(a_idx != ValueType::Dimension::npos); diff --git a/eval/src/vespa/eval/instruction/dense_multi_matmul_function.cpp b/eval/src/vespa/eval/instruction/dense_multi_matmul_function.cpp index bbd21c929da6..f62795f51685 100644 --- a/eval/src/vespa/eval/instruction/dense_multi_matmul_function.cpp +++ b/eval/src/vespa/eval/instruction/dense_multi_matmul_function.cpp @@ -72,7 +72,7 @@ InterpretedFunction::op_function my_select(CellType cell_type) { struct CommonDim { bool valid; bool inner; - CommonDim(const DimList &list, const vespalib::string &dim) + CommonDim(const DimList &list, const std::string &dim) : valid(true), inner(false) { if (list[list.size() - 1].name == dim) { @@ -119,7 +119,7 @@ bool check_input_type(const ValueType &type, const DimList &relevant) { ((type.cell_type() == CellType::FLOAT) || (type.cell_type() == CellType::DOUBLE))); } -bool is_multi_matmul(const ValueType &a, const ValueType &b, const vespalib::string &reduce_dim) { +bool is_multi_matmul(const ValueType &a, const ValueType &b, const std::string &reduce_dim) { auto dims_a = a.nontrivial_indexed_dimensions(); auto dims_b = b.nontrivial_indexed_dimensions(); if (check_input_type(a, dims_a) && check_input_type(b, dims_b) && (a.cell_type() == b.cell_type())) { @@ -134,7 +134,7 @@ bool is_multi_matmul(const ValueType &a, const ValueType &b, const vespalib::str } const TensorFunction &create_multi_matmul(const TensorFunction &a, const TensorFunction &b, - const vespalib::string &reduce_dim, const ValueType &result_type, Stash &stash) + const std::string &reduce_dim, const ValueType &result_type, Stash &stash) { auto dims_a = a.result_type().nontrivial_indexed_dimensions(); auto dims_b = b.result_type().nontrivial_indexed_dimensions(); diff --git a/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp index 1df4410f9feb..d8307fbc6195 100644 --- a/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp +++ b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp @@ -129,9 +129,9 @@ struct MyGetFun { using MyTypify = TypifyValue; -std::pair,ValueType> sort_and_drop_trivial(const std::vector &list_in, const ValueType &type_in) { - std::vector dropped; - std::vector list_out; +std::pair,ValueType> sort_and_drop_trivial(const std::vector &list_in, const ValueType &type_in) { + std::vector dropped; + std::vector list_out; for (const auto &dim_name: list_in) { auto dim_idx = type_in.dimension_index(dim_name); assert(dim_idx != ValueType::Dimension::npos); @@ -159,14 +159,14 @@ template struct VectorLookupLoop { }; DenseSingleReduceSpec extract_next(const ValueType &type, Aggr aggr, - std::vector &todo) + std::vector &todo) { size_t outer_size = 1; size_t reduce_size = 1; size_t inner_size = 1; auto dims = type.nontrivial_indexed_dimensions(); - std::vector do_now; - std::vector do_later; + std::vector do_now; + std::vector do_later; auto a = VectorLookupLoop(dims); auto b = VectorLookupLoop(todo); while (a.valid() && b.valid() && (a.get().name < b.get())) { @@ -196,7 +196,7 @@ DenseSingleReduceSpec extract_next(const ValueType &type, Aggr aggr, std::vector make_dense_single_reduce_list(const ValueType &type, Aggr aggr, - const std::vector &reduce_dims) + const std::vector &reduce_dims) { auto res_type = type.reduce(reduce_dims); if (reduce_dims.empty() || !type.is_dense() || !res_type.is_dense()) { diff --git a/eval/src/vespa/eval/instruction/dense_single_reduce_function.h b/eval/src/vespa/eval/instruction/dense_single_reduce_function.h index 465cb35edb3c..f7e24cafa679 100644 --- a/eval/src/vespa/eval/instruction/dense_single_reduce_function.h +++ b/eval/src/vespa/eval/instruction/dense_single_reduce_function.h @@ -21,7 +21,7 @@ struct DenseSingleReduceSpec { **/ std::vector make_dense_single_reduce_list(const ValueType &type, Aggr aggr, - const std::vector &reduce_dims); + const std::vector &reduce_dims); /** * Tensor function reducing a single dimension of a dense tensor where diff --git a/eval/src/vespa/eval/instruction/fast_rename_optimizer.cpp b/eval/src/vespa/eval/instruction/fast_rename_optimizer.cpp index 1f851190c9c8..634c3d8562ee 100644 --- a/eval/src/vespa/eval/instruction/fast_rename_optimizer.cpp +++ b/eval/src/vespa/eval/instruction/fast_rename_optimizer.cpp @@ -11,11 +11,11 @@ using namespace tensor_function; bool FastRenameOptimizer::is_stable_rename(const ValueType &from_type, const ValueType &to_type, - const std::vector &from, - const std::vector &to) + const std::vector &from, + const std::vector &to) { assert(from.size() == to.size()); - auto get_from_idx = [&](const vespalib::string &to_name) { + auto get_from_idx = [&](const std::string &to_name) { for (size_t i = 0; i < to.size(); ++i) { if (to[i] == to_name) { return from_type.dimension_index(from[i]); diff --git a/eval/src/vespa/eval/instruction/fast_rename_optimizer.h b/eval/src/vespa/eval/instruction/fast_rename_optimizer.h index eb5bc116b7cd..8f0b7b032674 100644 --- a/eval/src/vespa/eval/instruction/fast_rename_optimizer.h +++ b/eval/src/vespa/eval/instruction/fast_rename_optimizer.h @@ -11,8 +11,8 @@ namespace vespalib::eval { **/ struct FastRenameOptimizer { static bool is_stable_rename(const ValueType &from_type, const ValueType &to_type, - const std::vector &from, - const std::vector &to); + const std::vector &from, + const std::vector &to); static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash); }; diff --git a/eval/src/vespa/eval/instruction/generic_concat.cpp b/eval/src/vespa/eval/instruction/generic_concat.cpp index 89898d0b5ca6..35437341c80e 100644 --- a/eval/src/vespa/eval/instruction/generic_concat.cpp +++ b/eval/src/vespa/eval/instruction/generic_concat.cpp @@ -28,7 +28,7 @@ struct ConcatParam ConcatParam(const ValueType &res_type_in, const ValueType &lhs_type, const ValueType &rhs_type, - const vespalib::string &dimension, const ValueBuilderFactory &factory_in) + const std::string &dimension, const ValueBuilderFactory &factory_in) : res_type(res_type_in), sparse_plan(lhs_type, rhs_type), dense_plan(lhs_type, rhs_type, dimension, res_type), @@ -245,7 +245,7 @@ DenseConcatPlan::InOutLoop::~InOutLoop() = default; InterpretedFunction::Instruction GenericConcat::make_instruction(const ValueType &result_type, const ValueType &lhs_type, const ValueType &rhs_type, - const vespalib::string &dimension, + const std::string &dimension, const ValueBuilderFactory &factory, Stash &stash) { auto ¶m = stash.create(result_type, lhs_type, rhs_type, dimension, factory); diff --git a/eval/src/vespa/eval/instruction/generic_concat.h b/eval/src/vespa/eval/instruction/generic_concat.h index 3ad2f7ca12dc..19369201f648 100644 --- a/eval/src/vespa/eval/instruction/generic_concat.h +++ b/eval/src/vespa/eval/instruction/generic_concat.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include namespace vespalib::eval { struct ValueBuilderFactory; } @@ -16,7 +16,7 @@ struct GenericConcat { static InterpretedFunction::Instruction make_instruction(const ValueType &result_type, const ValueType &lhs_type, const ValueType &rhs_type, - const vespalib::string &dimension, + const std::string &dimension, const ValueBuilderFactory &factory, Stash &stash); }; diff --git a/eval/src/vespa/eval/instruction/generic_peek.cpp b/eval/src/vespa/eval/instruction/generic_peek.cpp index 39fc5f19e88d..2500da8078b5 100644 --- a/eval/src/vespa/eval/instruction/generic_peek.cpp +++ b/eval/src/vespa/eval/instruction/generic_peek.cpp @@ -84,7 +84,7 @@ struct ExtractedSpecs { bool operator() (const Spec::value_type &a, const Dimension &b) { return a.first < b.name; } }; std::vector dimensions; - std::map specs; + std::map specs; ExtractedSpecs(bool indexed, const std::vector &input_dims, diff --git a/eval/src/vespa/eval/instruction/generic_reduce.cpp b/eval/src/vespa/eval/instruction/generic_reduce.cpp index 9267b8b84750..2a400abb5719 100644 --- a/eval/src/vespa/eval/instruction/generic_reduce.cpp +++ b/eval/src/vespa/eval/instruction/generic_reduce.cpp @@ -27,7 +27,7 @@ struct ReduceParam { SparseReducePlan sparse_plan; DenseReducePlan dense_plan; const ValueBuilderFactory &factory; - ReduceParam(const ValueType &type, const std::vector &dimensions, + ReduceParam(const ValueType &type, const std::vector &dimensions, const ValueBuilderFactory &factory_in) : res_type(type.reduce(dimensions)), sparse_plan(type, res_type), @@ -304,7 +304,7 @@ using ReduceTypify = TypifyValue; Instruction GenericReduce::make_instruction(const ValueType &result_type, - const ValueType &input_type, Aggr aggr, const std::vector &dimensions, + const ValueType &input_type, Aggr aggr, const std::vector &dimensions, const ValueBuilderFactory &factory, Stash &stash) { auto ¶m = stash.create(input_type, dimensions, factory); diff --git a/eval/src/vespa/eval/instruction/generic_reduce.h b/eval/src/vespa/eval/instruction/generic_reduce.h index 6b94da209e71..c5c06c182790 100644 --- a/eval/src/vespa/eval/instruction/generic_reduce.h +++ b/eval/src/vespa/eval/instruction/generic_reduce.h @@ -42,7 +42,7 @@ struct GenericReduce { static InterpretedFunction::Instruction make_instruction(const ValueType &result_type, const ValueType &input_type, Aggr aggr, - const std::vector &dimensions, + const std::vector &dimensions, const ValueBuilderFactory &factory, Stash &stash); }; diff --git a/eval/src/vespa/eval/instruction/generic_rename.cpp b/eval/src/vespa/eval/instruction/generic_rename.cpp index eb8f1433442d..bb33748d9ba0 100644 --- a/eval/src/vespa/eval/instruction/generic_rename.cpp +++ b/eval/src/vespa/eval/instruction/generic_rename.cpp @@ -16,10 +16,10 @@ using Instruction = InterpretedFunction::Instruction; namespace { -const vespalib::string & -find_rename(const vespalib::string & original, - const std::vector &from, - const std::vector &to) +const std::string & +find_rename(const std::string & original, + const std::vector &from, + const std::vector &to) { for (size_t i = 0; i < from.size(); ++i) { if (original == from[i]) { @@ -30,7 +30,7 @@ find_rename(const vespalib::string & original, } size_t -find_index_of(const vespalib::string & name, +find_index_of(const std::string & name, const std::vector & dims) { for (size_t i = 0; i < dims.size(); ++i) { @@ -47,8 +47,8 @@ struct RenameParam { DenseRenamePlan dense_plan; const ValueBuilderFactory &factory; RenameParam(const ValueType &lhs_type, - const std::vector &rename_dimension_from, - const std::vector &rename_dimension_to, + const std::vector &rename_dimension_from, + const std::vector &rename_dimension_to, const ValueBuilderFactory &factory_in) : res_type(lhs_type.rename(rename_dimension_from, rename_dimension_to)), sparse_plan(lhs_type, res_type, rename_dimension_from, rename_dimension_to), @@ -138,8 +138,8 @@ struct SelectGenericRenameOp { SparseRenamePlan::SparseRenamePlan(const ValueType &input_type, const ValueType &output_type, - const std::vector &from, - const std::vector &to) + const std::vector &from, + const std::vector &to) : output_dimensions(), can_forward_index(true) { const auto in_dims = input_type.mapped_dimensions(); @@ -162,8 +162,8 @@ SparseRenamePlan::~SparseRenamePlan() = default; DenseRenamePlan::DenseRenamePlan(const ValueType &lhs_type, const ValueType &output_type, - const std::vector &from, - const std::vector &to) + const std::vector &from, + const std::vector &to) : loop_cnt(), stride(), subspace_size(output_type.dense_subspace_size()) @@ -204,8 +204,8 @@ DenseRenamePlan::~DenseRenamePlan() = default; InterpretedFunction::Instruction GenericRename::make_instruction(const ValueType &result_type, const ValueType &input_type, - const std::vector &rename_dimension_from, - const std::vector &rename_dimension_to, + const std::vector &rename_dimension_from, + const std::vector &rename_dimension_to, const ValueBuilderFactory &factory, Stash &stash) { auto ¶m = stash.create(input_type, diff --git a/eval/src/vespa/eval/instruction/generic_rename.h b/eval/src/vespa/eval/instruction/generic_rename.h index d12411e7e6b5..a498aabdc021 100644 --- a/eval/src/vespa/eval/instruction/generic_rename.h +++ b/eval/src/vespa/eval/instruction/generic_rename.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include #include namespace vespalib::eval { struct ValueBuilderFactory; } @@ -19,8 +19,8 @@ struct DenseRenamePlan { const size_t subspace_size; DenseRenamePlan(const ValueType &lhs_type, const ValueType &output_type, - const std::vector &from, - const std::vector &to); + const std::vector &from, + const std::vector &to); ~DenseRenamePlan(); template void execute(size_t offset, const F &f) const { run_nested_loop(offset, loop_cnt, stride, f); @@ -33,8 +33,8 @@ struct SparseRenamePlan { bool can_forward_index; SparseRenamePlan(const ValueType &input_type, const ValueType &output_type, - const std::vector &from, - const std::vector &to); + const std::vector &from, + const std::vector &to); ~SparseRenamePlan(); }; @@ -44,8 +44,8 @@ struct GenericRename { static InterpretedFunction::Instruction make_instruction(const ValueType &result_type, const ValueType &input_type, - const std::vector &rename_dimension_from, - const std::vector &rename_dimension_to, + const std::vector &rename_dimension_from, + const std::vector &rename_dimension_to, const ValueBuilderFactory &factory, Stash &stash); }; diff --git a/eval/src/vespa/eval/instruction/index_lookup_table.h b/eval/src/vespa/eval/instruction/index_lookup_table.h index 9627e151dad6..16f6583ddfc6 100644 --- a/eval/src/vespa/eval/instruction/index_lookup_table.h +++ b/eval/src/vespa/eval/instruction/index_lookup_table.h @@ -2,11 +2,11 @@ #pragma once -#include -#include -#include #include #include +#include +#include +#include namespace vespalib::eval { @@ -20,7 +20,7 @@ class Function; class IndexLookupTable { private: - using Key = vespalib::string; + using Key = std::string; struct Value { size_t num_refs; std::vector data; diff --git a/eval/src/vespa/eval/instruction/remove_trivial_dimension_optimizer.cpp b/eval/src/vespa/eval/instruction/remove_trivial_dimension_optimizer.cpp index 7f4860ce7928..210125a24032 100644 --- a/eval/src/vespa/eval/instruction/remove_trivial_dimension_optimizer.cpp +++ b/eval/src/vespa/eval/instruction/remove_trivial_dimension_optimizer.cpp @@ -10,9 +10,9 @@ using namespace tensor_function; namespace { -bool is_trivial_dim_list(const ValueType &type, const std::vector &dim_list) { +bool is_trivial_dim_list(const ValueType &type, const std::vector &dim_list) { size_t npos = ValueType::Dimension::npos; - for (const vespalib::string &dim: dim_list) { + for (const std::string &dim: dim_list) { size_t idx = type.dimension_index(dim); if ((idx == npos) || (type.dimensions()[idx].size != 1)) { return false; diff --git a/eval/src/vespa/eval/instruction/sum_max_dot_product_function.cpp b/eval/src/vespa/eval/instruction/sum_max_dot_product_function.cpp index 7e19974294ef..f9d6e5802021 100644 --- a/eval/src/vespa/eval/instruction/sum_max_dot_product_function.cpp +++ b/eval/src/vespa/eval/instruction/sum_max_dot_product_function.cpp @@ -47,7 +47,7 @@ const Join *check_mul(const TensorFunction &expr) { } bool check_params(const ValueType &res_type, const ValueType &query, const ValueType &document, - const vespalib::string &sum_dim, const vespalib::string &max_dim, const vespalib::string &dp_dim) + const std::string &sum_dim, const std::string &max_dim, const std::string &dp_dim) { if (res_type.is_double() && (query.dimensions().size() == 2) && (query.cell_type() == CellType::FLOAT) && @@ -70,7 +70,7 @@ bool check_params(const ValueType &res_type, const ValueType &query, const Value return false; } -size_t get_dim_size(const ValueType &type, const vespalib::string &dim) { +size_t get_dim_size(const ValueType &type, const std::string &dim) { size_t npos = ValueType::Dimension::npos; size_t idx = type.dimension_index(dim); assert(idx != npos); diff --git a/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp b/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp index f77c7ae65785..61530da09978 100644 --- a/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp +++ b/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp @@ -33,7 +33,7 @@ void my_vector_from_doubles_op(InterpretedFunction::State &state, uint64_t param state.stack.emplace_back(result); } -size_t vector_size(const TensorFunction &child, const vespalib::string &dimension) { +size_t vector_size(const TensorFunction &child, const std::string &dimension) { if (child.result_type().is_double()) { return 1; } @@ -95,7 +95,7 @@ const TensorFunction & VectorFromDoublesFunction::optimize(const TensorFunction &expr, Stash &stash) { if (auto concat = as(expr)) { - const vespalib::string &dimension = concat->dimension(); + const std::string &dimension = concat->dimension(); size_t a_size = vector_size(concat->lhs(), dimension); size_t b_size = vector_size(concat->rhs(), dimension); if ((a_size > 0) && (b_size > 0)) { diff --git a/eval/src/vespa/eval/instruction/vector_from_doubles_function.h b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h index 6af873f18d1b..b13c058d0c37 100644 --- a/eval/src/vespa/eval/instruction/vector_from_doubles_function.h +++ b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h @@ -28,7 +28,7 @@ class VectorFromDoublesFunction : public TensorFunction ~VectorFromDoublesFunction(); const ValueType &result_type() const override { return _self.resultType; } void push_children(std::vector &children) const override; - const vespalib::string &dimension() const { + const std::string &dimension() const { return _self.resultType.dimensions()[0].name; } size_t size() const { return _self.resultSize; } diff --git a/eval/src/vespa/eval/onnx/onnx_model_cache.cpp b/eval/src/vespa/eval/onnx/onnx_model_cache.cpp index 6735ae0fd505..3b6da7891727 100644 --- a/eval/src/vespa/eval/onnx/onnx_model_cache.cpp +++ b/eval/src/vespa/eval/onnx/onnx_model_cache.cpp @@ -17,7 +17,7 @@ OnnxModelCache::release(Map::iterator entry) } OnnxModelCache::Token::UP -OnnxModelCache::load(const vespalib::string &model_file) +OnnxModelCache::load(const std::string &model_file) { std::lock_guard guard(_lock); auto pos = _cached.find(model_file); diff --git a/eval/src/vespa/eval/onnx/onnx_model_cache.h b/eval/src/vespa/eval/onnx/onnx_model_cache.h index a6b22f8abd6c..c5e376f36c4c 100644 --- a/eval/src/vespa/eval/onnx/onnx_model_cache.h +++ b/eval/src/vespa/eval/onnx/onnx_model_cache.h @@ -3,10 +3,10 @@ #pragma once #include "onnx_wrapper.h" -#include +#include #include #include -#include +#include namespace vespalib::eval { @@ -19,7 +19,7 @@ class OnnxModelCache { private: struct ctor_tag {}; - using Key = vespalib::string; + using Key = std::string; struct Value { size_t num_refs; std::unique_ptr model; @@ -50,7 +50,7 @@ class OnnxModelCache ~Token() { OnnxModelCache::release(_entry); } }; - static Token::UP load(const vespalib::string &model_file); + static Token::UP load(const std::string &model_file); static size_t num_cached(); static size_t count_refs(); }; diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp index cd42699831de..f2899b319e1d 100644 --- a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp +++ b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp @@ -54,7 +54,7 @@ using MyTypify = TypifyValue; //----------------------------------------------------------------------------- struct TypeToString { - template static vespalib::string invoke() { return getClassName(); } + template static std::string invoke() { return getClassName(); } }; struct IsSameType { @@ -120,7 +120,7 @@ ClearVespaTensor clear_vespa_tensor; //----------------------------------------------------------------------------- -template vespalib::string type_name(E enum_value) { +template std::string type_name(E enum_value) { return typify_invoke<1,MyTypify,TypeToString>(enum_value); } @@ -188,7 +188,7 @@ std::vector make_dimensions(const Ort::ConstTensorTypeAndShapeInf if (shape[i] > 0) { result.emplace_back(shape[i]); } else if (symbolic_sizes[i] != nullptr) { - result.emplace_back(vespalib::string(symbolic_sizes[i])); + result.emplace_back(std::string(symbolic_sizes[i])); } else { result.emplace_back(); } @@ -199,7 +199,7 @@ std::vector make_dimensions(const Ort::ConstTensorTypeAndShapeInf Onnx::TensorInfo make_tensor_info(const OnnxString &name, const Ort::TypeInfo &type_info) { auto tensor_info = type_info.GetTensorTypeAndShapeInfo(); auto element_type = tensor_info.GetElementType(); - return Onnx::TensorInfo{vespalib::string(name.get()), make_dimensions(tensor_info), make_element_type(element_type)}; + return Onnx::TensorInfo{std::string(name.get()), make_dimensions(tensor_info), make_element_type(element_type)}; } Onnx::TensorType get_type_of(const Ort::Value &value) { @@ -224,7 +224,7 @@ std::vector extract_sizes(const ValueType &type) { } // -vespalib::string +std::string Onnx::DimSize::as_string() const { if (is_known()) { @@ -236,10 +236,10 @@ Onnx::DimSize::as_string() const } } -vespalib::string +std::string Onnx::TensorInfo::type_as_string() const { - vespalib::string res = type_name(elements); + std::string res = type_name(elements); for (const auto &dim: dimensions) { res += dim.as_string(); } @@ -248,10 +248,10 @@ Onnx::TensorInfo::type_as_string() const Onnx::TensorInfo::~TensorInfo() = default; -vespalib::string +std::string Onnx::TensorType::type_as_string() const { - vespalib::string res = type_name(elements); + std::string res = type_name(elements); for (const auto &size: dimensions) { res += DimSize(size).as_string(); } @@ -364,10 +364,10 @@ Onnx::WirePlanner::bind_input_type(const ValueType &vespa_in, const TensorInfo & return true; } -std::map +std::map Onnx::WirePlanner::get_bound_sizes(const TensorInfo &onnx_in) const { - std::map result; + std::map result; for (const auto &dim: onnx_in.dimensions) { if (dim.is_symbolic()) { auto pos = _symbolic_sizes.find(dim.name); @@ -649,7 +649,7 @@ Onnx::extract_meta_data() } } -Onnx::Onnx(const vespalib::string &model_file, Optimize optimize) +Onnx::Onnx(const std::string &model_file, Optimize optimize) : _shared(Shared::get()), _options(), _session(nullptr), diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.h b/eval/src/vespa/eval/onnx/onnx_wrapper.h index 205256079da1..5c1585a52ff3 100644 --- a/eval/src/vespa/eval/onnx/onnx_wrapper.h +++ b/eval/src/vespa/eval/onnx/onnx_wrapper.h @@ -3,12 +3,12 @@ #pragma once #include -#include #include #include -#include #include #include +#include +#include namespace vespalib::eval { struct Value; } @@ -37,13 +37,13 @@ class Onnx { // the size of a dimension struct DimSize { size_t value; - vespalib::string name; + std::string name; DimSize() noexcept : value(0), name() {} DimSize(size_t size) noexcept : value(size), name() {} - DimSize(const vespalib::string &symbol) noexcept : value(0), name(symbol) {} + DimSize(const std::string &symbol) noexcept : value(0), name(symbol) {} bool is_known() const { return (value > 0); } bool is_symbolic() const { return !name.empty(); } - vespalib::string as_string() const; + std::string as_string() const; }; // supported onnx element types @@ -51,10 +51,10 @@ class Onnx { // information about a single input or output tensor struct TensorInfo { - vespalib::string name; + std::string name; std::vector dimensions; ElementType elements; - vespalib::string type_as_string() const; + std::string type_as_string() const; ~TensorInfo(); }; @@ -64,7 +64,7 @@ class Onnx { std::vector dimensions; TensorType(ElementType elements_in, std::vector dimensions_in) noexcept : elements(elements_in), dimensions(std::move(dimensions_in)) {} - vespalib::string type_as_string() const; + std::string type_as_string() const; }; // how the model should be wired with inputs/outputs @@ -79,9 +79,9 @@ class Onnx { // planning how we should wire the model based on input types class WirePlanner { private: - std::map _input_types; - std::map _symbolic_sizes; - std::map _output_types; + std::map _input_types; + std::map _symbolic_sizes; + std::map _output_types; bool need_model_probe(const Onnx &model) const; void do_model_probe(const Onnx &model); @@ -90,7 +90,7 @@ class Onnx { ~WirePlanner(); static CellType best_cell_type(Onnx::ElementType type); bool bind_input_type(const ValueType &vespa_in, const TensorInfo &onnx_in); - std::map get_bound_sizes(const TensorInfo &onnx_in) const; + std::map get_bound_sizes(const TensorInfo &onnx_in) const; void prepare_output_types(const Onnx &model); ValueType make_output_type(const TensorInfo &onnx_out) const; WireInfo get_wire_info(const Onnx &model) const; @@ -161,7 +161,7 @@ class Onnx { void extract_meta_data() __attribute__((noinline)); public: - Onnx(const vespalib::string &model_file, Optimize optimize); + Onnx(const std::string &model_file, Optimize optimize); ~Onnx(); const std::vector &inputs() const { return _inputs; } const std::vector &outputs() const { return _outputs; } diff --git a/fbench/src/fbench/fbench.h b/fbench/src/fbench/fbench.h index 509d8901f248..4b2a5c4f4046 100644 --- a/fbench/src/fbench/fbench.h +++ b/fbench/src/fbench/fbench.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include +#include class Client; diff --git a/fbench/src/util/clientstatus.h b/fbench/src/util/clientstatus.h index 012cb4cfe2ef..d36c019bd33b 100644 --- a/fbench/src/util/clientstatus.h +++ b/fbench/src/util/clientstatus.h @@ -3,8 +3,8 @@ #include #include -#include #include +#include /** * This is a helper struct that is used by the @ref Client class to diff --git a/fnet/src/tests/connect/connect_test.cpp b/fnet/src/tests/connect/connect_test.cpp index a282a56807ec..15293c8986e3 100644 --- a/fnet/src/tests/connect/connect_test.cpp +++ b/fnet/src/tests/connect/connect_test.cpp @@ -22,11 +22,11 @@ struct BlockingHostResolver : public AsyncResolver::HostResolver { Gate caller; Gate barrier; BlockingHostResolver() : resolver(), caller(), barrier() {} - vespalib::string ip_address(const vespalib::string &host) override { + std::string ip_address(const std::string &host) override { fprintf(stderr, "blocking resolve request: '%s'\n", host.c_str()); caller.countDown(); barrier.await(); - vespalib::string result = resolver.ip_address(host); + std::string result = resolver.ip_address(host); fprintf(stderr, "returning resolve result: '%s'\n", result.c_str()); return result; } @@ -111,7 +111,7 @@ struct TransportFixture : FNET_IPacketHandler { packet->Free(); return FNET_FREE_CHANNEL; } - FNET_Connection *connect(const vespalib::string &spec) { + FNET_Connection *connect(const std::string &spec) { FNET_Connection *conn = transport.Connect(spec.c_str(), &streamer); ASSERT_TRUE(conn != nullptr); if (conn->OpenChannel(this, FNET_Context()) == nullptr) { @@ -152,7 +152,7 @@ TEST_MT_FFFF("require that normal connect works", 2, EXPECT_TRUE(socket.valid()); TEST_BARRIER(); } else { - vespalib::string spec = make_string("tcp/localhost:%d", f1.address().port()); + std::string spec = make_string("tcp/localhost:%d", f1.address().port()); FNET_Connection *conn = f2.connect(spec); TEST_BARRIER(); conn->Owner()->Close(conn); @@ -179,7 +179,7 @@ TEST_MT_FFFFF("require that async close can be called before async resolve compl SocketHandle socket = f1.accept(); EXPECT_TRUE(!socket.valid()); } else { - vespalib::string spec = make_string("tcp/localhost:%d", f1.address().port()); + std::string spec = make_string("tcp/localhost:%d", f1.address().port()); FNET_Connection *conn = f3.connect(spec); f2->wait_for_caller(); conn->Owner()->Close(conn); @@ -201,7 +201,7 @@ TEST_MT_FFFFF("require that async close during async do_handshake_work works", 2 EXPECT_TRUE(socket.valid()); TEST_BARRIER(); // #1 } else { - vespalib::string spec = make_string("tcp/localhost:%d", f1.address().port()); + std::string spec = make_string("tcp/localhost:%d", f1.address().port()); FNET_Connection *conn = f3.connect(spec); f2->handshake_work_enter.await(); conn->Owner()->Close(conn, false); diff --git a/fnet/src/tests/connection_spread/connection_spread_test.cpp b/fnet/src/tests/connection_spread/connection_spread_test.cpp index 2388a44dd58e..95b45f17a766 100644 --- a/fnet/src/tests/connection_spread/connection_spread_test.cpp +++ b/fnet/src/tests/connection_spread/connection_spread_test.cpp @@ -50,7 +50,7 @@ struct Fixture { } }; -void check_threads(FNET_Transport &transport, size_t num_threads, const vespalib::string &tag) { +void check_threads(FNET_Transport &transport, size_t num_threads, const std::string &tag) { std::set threads; while (threads.size() < num_threads) { threads.insert(transport.select_thread(nullptr, 0)); @@ -67,7 +67,7 @@ TEST_F("require that connections are spread among transport threads", Fixture) FNET_Connector *listener = f1.server.Listen("tcp/0", &f1.streamer, &f1.adapter); ASSERT_TRUE(listener); uint32_t port = listener->GetPortNumber(); - vespalib::string spec = vespalib::make_string("tcp/localhost:%u", port); + std::string spec = vespalib::make_string("tcp/localhost:%u", port); std::vector connections; for (size_t i = 0; i < 256; ++i) { std::this_thread::sleep_for(1ms); diff --git a/fnet/src/tests/examples/examples_test.cpp b/fnet/src/tests/examples/examples_test.cpp index 5daa57cef2f3..e3c48bbba01f 100644 --- a/fnet/src/tests/examples/examples_test.cpp +++ b/fnet/src/tests/examples/examples_test.cpp @@ -14,7 +14,7 @@ static const int PORT0 = 18570; using vespalib::Process; using vespalib::make_string_short::fmt; -int run_proc(Process &proc, vespalib::string &output) { +int run_proc(Process &proc, std::string &output) { proc.close(); for (auto mem = proc.obtain(); mem.size > 0; mem = proc.obtain()) { output.append(mem.data, mem.size); @@ -24,7 +24,7 @@ int run_proc(Process &proc, vespalib::string &output) { } void consume_result(Process &proc) { - vespalib::string output; + std::string output; int status = run_proc(proc, output); fprintf(stderr, "child output(server): >>>%s<<<\n", output.c_str()); if (status != 0) { @@ -39,13 +39,13 @@ void consume_result(Process &proc) { } } -bool run_with_retry(const vespalib::string &cmd) { +bool run_with_retry(const std::string &cmd) { for (size_t retry = 0; retry < 60; ++retry) { if (retry > 0) { fprintf(stderr, "retrying command in 500ms...\n"); std::this_thread::sleep_for(500ms); } - vespalib::string output; + std::string output; Process proc(cmd, true); int status = run_proc(proc, output); fprintf(stderr, "child output(client): >>>%s<<<\n", output.c_str()); @@ -70,7 +70,7 @@ TEST("usage") { } TEST("timeout") { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run("exec ../../examples/timeout/fnet_timeout_app", out)); fprintf(stderr, "%s\n", out.c_str()); } diff --git a/fnet/src/tests/frt/parallel_rpc/tls_rpc_bench.cpp b/fnet/src/tests/frt/parallel_rpc/tls_rpc_bench.cpp index dc50814f01de..70516339207e 100644 --- a/fnet/src/tests/frt/parallel_rpc/tls_rpc_bench.cpp +++ b/fnet/src/tests/frt/parallel_rpc/tls_rpc_bench.cpp @@ -63,8 +63,8 @@ struct StartCmp { } }; -vespalib::string get_prefix(const std::vector &stats, size_t idx) { - vespalib::string prefix; +std::string get_prefix(const std::vector &stats, size_t idx) { + std::string prefix; TimeTracer::Record self = stats[idx]; while (idx-- > 0) { if (stats[idx].thread_id == self.thread_id) { diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index 314c1aac3d10..5fc55924e291 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -302,7 +302,7 @@ class Fixture private: fnet::frt::StandaloneFRT _client; fnet::frt::StandaloneFRT _server; - vespalib::string _peerSpec; + std::string _peerSpec; FRT_Target *_target; TestRPC _testRPC; EchoTest _echoTest; diff --git a/fnet/src/tests/thread_selection/thread_selection_test.cpp b/fnet/src/tests/thread_selection/thread_selection_test.cpp index 156d122b0d3a..6e69b2ef86d1 100644 --- a/fnet/src/tests/thread_selection/thread_selection_test.cpp +++ b/fnet/src/tests/thread_selection/thread_selection_test.cpp @@ -40,7 +40,7 @@ struct Fixture { TEST_F("require that selection is time sensistive", Fixture(8)) { using namespace std::literals; - vespalib::string key("my random key"); + std::string key("my random key"); for (size_t i = 0; i < 256; ++i) { f1.count_selected_thread(key.data(), key.size()); std::this_thread::sleep_for(10ms); @@ -52,7 +52,7 @@ TEST_F("require that selection is time sensistive", Fixture(8)) TEST_F("require that selection is key sensistive", Fixture(8)) { for (size_t i = 0; i < 256; ++i) { - vespalib::string key = vespalib::make_string("my random key %zu", i); + std::string key = vespalib::make_string("my random key %zu", i); f1.count_selected_thread(key.data(), key.size()); } EXPECT_EQUAL(f1.counts.size(), 8u); diff --git a/fnet/src/vespa/fnet/connection.cpp b/fnet/src/vespa/fnet/connection.cpp index a36254406756..0a8207c2d401 100644 --- a/fnet/src/vespa/fnet/connection.cpp +++ b/fnet/src/vespa/fnet/connection.cpp @@ -745,7 +745,7 @@ FNET_Connection::HandleWriteEvent() return !broken; } -vespalib::string +std::string FNET_Connection::GetPeerSpec() const { return vespalib::SocketAddress::peer_address(_socket->get_fd()).spec(); diff --git a/fnet/src/vespa/fnet/connection.h b/fnet/src/vespa/fnet/connection.h index 9a33bf0bcce2..3239e82eb365 100644 --- a/fnet/src/vespa/fnet/connection.h +++ b/fnet/src/vespa/fnet/connection.h @@ -282,7 +282,7 @@ class FNET_Connection : public FNET_IOComponent /** * @return address spec of socket peer. Only makes sense to call on non-listening sockets. */ - vespalib::string GetPeerSpec() const; + std::string GetPeerSpec() const; /** * Does this connection have the ability to accept incoming channels ? diff --git a/fnet/src/vespa/fnet/controlpacket.cpp b/fnet/src/vespa/fnet/controlpacket.cpp index e14d5e12f3f0..537fa69b9ed8 100644 --- a/fnet/src/vespa/fnet/controlpacket.cpp +++ b/fnet/src/vespa/fnet/controlpacket.cpp @@ -72,7 +72,7 @@ FNET_ControlPacket::Decode(FNET_DataBuffer *, uint32_t) LOG_ABORT("should not be reached"); } -vespalib::string +std::string FNET_ControlPacket::Print(uint32_t indent) { return vespalib::make_string("%*sFNET_ControlPacket { command = %d }\n", diff --git a/fnet/src/vespa/fnet/controlpacket.h b/fnet/src/vespa/fnet/controlpacket.h index 9df681341f34..76bac878192b 100644 --- a/fnet/src/vespa/fnet/controlpacket.h +++ b/fnet/src/vespa/fnet/controlpacket.h @@ -97,6 +97,6 @@ class FNET_ControlPacket : public FNET_Packet * This method should never be called and will abort the program. **/ bool Decode(FNET_DataBuffer *, uint32_t) override; - vespalib::string Print(uint32_t indent = 0) override; + std::string Print(uint32_t indent = 0) override; }; diff --git a/fnet/src/vespa/fnet/dummypacket.cpp b/fnet/src/vespa/fnet/dummypacket.cpp index 0e507a7a6b5d..e46940a268a4 100644 --- a/fnet/src/vespa/fnet/dummypacket.cpp +++ b/fnet/src/vespa/fnet/dummypacket.cpp @@ -47,7 +47,7 @@ FNET_DummyPacket::Decode(FNET_DataBuffer *, uint32_t) LOG_ABORT("should not be reached"); } -vespalib::string +std::string FNET_DummyPacket::Print(uint32_t indent) { return vespalib::make_string("%*sFNET_DummyPacket {}\n", indent, ""); diff --git a/fnet/src/vespa/fnet/dummypacket.h b/fnet/src/vespa/fnet/dummypacket.h index 9894daf017b9..f4ca581b4ebf 100644 --- a/fnet/src/vespa/fnet/dummypacket.h +++ b/fnet/src/vespa/fnet/dummypacket.h @@ -53,6 +53,6 @@ class FNET_DummyPacket : public FNET_Packet /** * Identify as dummy packet. **/ - vespalib::string Print(uint32_t indent = 0) override; + std::string Print(uint32_t indent = 0) override; }; diff --git a/fnet/src/vespa/fnet/frt/packets.cpp b/fnet/src/vespa/fnet/frt/packets.cpp index 4dc007568638..9d32e63c6935 100644 --- a/fnet/src/vespa/fnet/frt/packets.cpp +++ b/fnet/src/vespa/fnet/frt/packets.cpp @@ -88,10 +88,10 @@ FRT_RPCRequestPacket::Decode(FNET_DataBuffer *src, uint32_t len) } -vespalib::string +std::string FRT_RPCRequestPacket::Print(uint32_t indent) { - vespalib::string s; + std::string s; s += vespalib::make_string("%*sFRT_RPCRequestPacket {\n", indent, ""); s += vespalib::make_string("%*s method name: %s\n", indent, "", (_req->GetMethodName() != nullptr) @@ -149,10 +149,10 @@ FRT_RPCReplyPacket::Decode(FNET_DataBuffer *src, uint32_t len) } -vespalib::string +std::string FRT_RPCReplyPacket::Print(uint32_t indent) { - vespalib::string s; + std::string s; s += vespalib::make_string("%*sFRT_RPCReplyPacket {\n", indent, ""); s += vespalib::make_string("%*s return:\n", indent, ""); _req->GetReturn()->Print(indent + 2); @@ -227,10 +227,10 @@ FRT_RPCErrorPacket::Decode(FNET_DataBuffer *src, uint32_t len) } -vespalib::string +std::string FRT_RPCErrorPacket::Print(uint32_t indent) { - vespalib::string s; + std::string s; s += vespalib::make_string("%*sFRT_RPCErrorPacket {\n", indent, ""); s += vespalib::make_string("%*s error code : %d\n", indent, "", _req->GetErrorCode()); s += vespalib::make_string("%*s error message: %s\n", indent, "", diff --git a/fnet/src/vespa/fnet/frt/packets.h b/fnet/src/vespa/fnet/frt/packets.h index fa43f7ad990b..a23b3b779e82 100644 --- a/fnet/src/vespa/fnet/frt/packets.h +++ b/fnet/src/vespa/fnet/frt/packets.h @@ -61,7 +61,7 @@ class FRT_RPCRequestPacket : public FRT_RPCPacket uint32_t GetLength() override; void Encode(FNET_DataBuffer *dst) override; bool Decode(FNET_DataBuffer *src, uint32_t len) override; - vespalib::string Print(uint32_t indent = 0) override; + std::string Print(uint32_t indent = 0) override; }; @@ -77,7 +77,7 @@ class FRT_RPCReplyPacket : public FRT_RPCPacket uint32_t GetLength() override; void Encode(FNET_DataBuffer *dst) override; bool Decode(FNET_DataBuffer *src, uint32_t len) override; - vespalib::string Print(uint32_t indent = 0) override; + std::string Print(uint32_t indent = 0) override; }; @@ -93,7 +93,7 @@ class FRT_RPCErrorPacket : public FRT_RPCPacket uint32_t GetLength() override; void Encode(FNET_DataBuffer *dst) override; bool Decode(FNET_DataBuffer *src, uint32_t len) override; - vespalib::string Print(uint32_t indent = 0) override; + std::string Print(uint32_t indent = 0) override; }; diff --git a/fnet/src/vespa/fnet/packet.cpp b/fnet/src/vespa/fnet/packet.cpp index d6337caab1ad..5aa6effbd7aa 100644 --- a/fnet/src/vespa/fnet/packet.cpp +++ b/fnet/src/vespa/fnet/packet.cpp @@ -3,7 +3,7 @@ #include "packet.h" #include -vespalib::string +std::string FNET_Packet::Print(uint32_t indent) { return vespalib::make_string("%*sFNET_Packet[subclass] { regular=%s, control=%s, " diff --git a/fnet/src/vespa/fnet/packet.h b/fnet/src/vespa/fnet/packet.h index 6cb56f93bf5b..60adf2e7ceb7 100644 --- a/fnet/src/vespa/fnet/packet.h +++ b/fnet/src/vespa/fnet/packet.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include class FNET_DataBuffer; @@ -155,5 +155,5 @@ class FNET_Packet * * @param indent indent in number of spaces **/ - virtual vespalib::string Print(uint32_t indent = 0); + virtual std::string Print(uint32_t indent = 0); }; diff --git a/fnet/src/vespa/fnet/packetqueue.cpp b/fnet/src/vespa/fnet/packetqueue.cpp index fa136f345412..b3a32f3a5740 100644 --- a/fnet/src/vespa/fnet/packetqueue.cpp +++ b/fnet/src/vespa/fnet/packetqueue.cpp @@ -4,6 +4,7 @@ #include "packet.h" #include #include +#include void FNET_PacketQueue_NoLock::ExpandBuf(uint32_t needentries) diff --git a/fnet/src/vespa/fnet/transport.cpp b/fnet/src/vespa/fnet/transport.cpp index a15982f49ab1..3ceed9f42561 100644 --- a/fnet/src/vespa/fnet/transport.cpp +++ b/fnet/src/vespa/fnet/transport.cpp @@ -165,7 +165,7 @@ FNET_Transport::post_or_perform(vespalib::Executor::Task::UP task) } void -FNET_Transport::resolve_async(const vespalib::string &spec, +FNET_Transport::resolve_async(const std::string &spec, vespalib::AsyncResolver::ResultHandler::WP result_handler) { _async_resolver->resolve_async(spec, std::move(result_handler)); diff --git a/fnet/src/vespa/fnet/transport.h b/fnet/src/vespa/fnet/transport.h index cefafd03e022..a7a05576c7ca 100644 --- a/fnet/src/vespa/fnet/transport.h +++ b/fnet/src/vespa/fnet/transport.h @@ -162,7 +162,7 @@ class FNET_Transport * @param spec connect spec * @param result handler **/ - void resolve_async(const vespalib::string &spec, + void resolve_async(const std::string &spec, vespalib::AsyncResolver::ResultHandler::WP result_handler); /** diff --git a/fsa/queryproc/count_plain_grams.cpp b/fsa/queryproc/count_plain_grams.cpp index 95d952a80f2c..66f728d51f7d 100644 --- a/fsa/queryproc/count_plain_grams.cpp +++ b/fsa/queryproc/count_plain_grams.cpp @@ -1,8 +1,4 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include #include "fsa.h" #include "permuter.h" @@ -10,6 +6,11 @@ #include "ngram.h" #include "base64.h" #include "wordchartokenizer.h" +#include +#include +#include +#include + using namespace fsa; diff --git a/fsa/queryproc/count_sorted_grams.cpp b/fsa/queryproc/count_sorted_grams.cpp index fa184d3e6f32..86d92dc780a8 100644 --- a/fsa/queryproc/count_sorted_grams.cpp +++ b/fsa/queryproc/count_sorted_grams.cpp @@ -1,8 +1,4 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include #include "fsa.h" #include "permuter.h" @@ -10,6 +6,10 @@ #include "ngram.h" #include "base64.h" #include "wordchartokenizer.h" +#include +#include +#include +#include using namespace fsa; diff --git a/fsa/queryproc/p2s_ratio.cpp b/fsa/queryproc/p2s_ratio.cpp index b12060f27f7e..fdd3d0be60c6 100644 --- a/fsa/queryproc/p2s_ratio.cpp +++ b/fsa/queryproc/p2s_ratio.cpp @@ -1,13 +1,13 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include #include "fsa.h" #include "permuter.h" #include "ngram.h" #include "base64.h" +#include +#include +#include +#include using namespace fsa; diff --git a/fsa/src/alltest/fsa_perftest.cpp b/fsa/src/alltest/fsa_perftest.cpp index b1909a11447d..3dacd2d92cde 100644 --- a/fsa/src/alltest/fsa_perftest.cpp +++ b/fsa/src/alltest/fsa_perftest.cpp @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include #include +#include #include #include diff --git a/fsa/src/alltest/fsa_test.cpp b/fsa/src/alltest/fsa_test.cpp index 6a9bfa7f7830..8eaedcb38fd8 100644 --- a/fsa/src/alltest/fsa_test.cpp +++ b/fsa/src/alltest/fsa_test.cpp @@ -3,7 +3,7 @@ #define _GNU_SOURCE #endif -#include +#include #include #include diff --git a/fsa/src/alltest/fsamanager_test.cpp b/fsa/src/alltest/fsamanager_test.cpp index 6c8f3b889b9c..9900069674b0 100644 --- a/fsa/src/alltest/fsamanager_test.cpp +++ b/fsa/src/alltest/fsamanager_test.cpp @@ -2,9 +2,9 @@ #include #include +#include #include #include -#include using namespace fsa; diff --git a/fsa/src/alltest/lookup_test.cpp b/fsa/src/alltest/lookup_test.cpp index 2f134291374e..12a13b4e8855 100644 --- a/fsa/src/alltest/lookup_test.cpp +++ b/fsa/src/alltest/lookup_test.cpp @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include #include +#include #include #include diff --git a/fsa/src/alltest/vectorizer_perftest.cpp b/fsa/src/alltest/vectorizer_perftest.cpp index 7d7a0fc0ef91..6abb0270da1e 100644 --- a/fsa/src/alltest/vectorizer_perftest.cpp +++ b/fsa/src/alltest/vectorizer_perftest.cpp @@ -8,9 +8,9 @@ * */ -#include -#include #include +#include +#include #include #include diff --git a/fsa/src/libfsa/automaton-alternate.h b/fsa/src/libfsa/automaton-alternate.h index c23666886ff0..78ad5266a5d0 100644 --- a/fsa/src/libfsa/automaton-alternate.h +++ b/fsa/src/libfsa/automaton-alternate.h @@ -9,15 +9,15 @@ #pragma once +#include "blob.h" +#include "fsa.h" + +#include #include #include #include -#include -#include #include // for mmap() etc - -#include "blob.h" -#include "fsa.h" +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/automaton.h b/fsa/src/vespa/fsa/automaton.h index 585d88826296..e1c1b8e3fae5 100644 --- a/fsa/src/vespa/fsa/automaton.h +++ b/fsa/src/vespa/fsa/automaton.h @@ -10,13 +10,13 @@ #pragma once +#include "blob.h" +#include "fsa.h" + +#include #include #include #include -#include - -#include "blob.h" -#include "fsa.h" namespace fsa { diff --git a/fsa/src/vespa/fsa/blob.h b/fsa/src/vespa/fsa/blob.h index 7c9dbbed3185..c0c142921b4e 100644 --- a/fsa/src/vespa/fsa/blob.h +++ b/fsa/src/vespa/fsa/blob.h @@ -10,9 +10,8 @@ #pragma once -#include -#include - +#include +#include #include namespace fsa { diff --git a/fsa/src/vespa/fsa/detector.h b/fsa/src/vespa/fsa/detector.h index c320b3a011ed..97bc8e69d406 100644 --- a/fsa/src/vespa/fsa/detector.h +++ b/fsa/src/vespa/fsa/detector.h @@ -10,13 +10,13 @@ #pragma once -#include -#include -#include - #include "fsa.h" #include "ngram.h" +#include +#include +#include + namespace fsa { // {{{ Detector diff --git a/fsa/src/vespa/fsa/fsa.h b/fsa/src/vespa/fsa/fsa.h index b1632c09b0d4..1d2f39e92ea2 100644 --- a/fsa/src/vespa/fsa/fsa.h +++ b/fsa/src/vespa/fsa/fsa.h @@ -9,14 +9,14 @@ #pragma once -#include -#include -#include -#include - #include "file.h" // for FileAccessMethod #include "unaligned.h" +#include +#include +#include +#include + namespace fsa { // {{{ symbol_t, state_t, hash_t, data_t diff --git a/fsa/src/vespa/fsa/ngram.h b/fsa/src/vespa/fsa/ngram.h index 6c995637318c..6c84ecf99b06 100644 --- a/fsa/src/vespa/fsa/ngram.h +++ b/fsa/src/vespa/fsa/ngram.h @@ -9,16 +9,16 @@ #pragma once -#include -#include -#include -#include - #include "unicode.h" #include "selector.h" #include "permuter.h" #include "tokenizer.h" +#include +#include +#include +#include + namespace fsa { // {{{ class NGram diff --git a/fsa/src/vespa/fsa/permuter.h b/fsa/src/vespa/fsa/permuter.h index f6208a3e1128..d5bd2bf9b52b 100644 --- a/fsa/src/vespa/fsa/permuter.h +++ b/fsa/src/vespa/fsa/permuter.h @@ -9,10 +9,9 @@ #pragma once -#include #include #include - +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/segmenter.h b/fsa/src/vespa/fsa/segmenter.h index 757ea336042f..9c6e1cadecd1 100644 --- a/fsa/src/vespa/fsa/segmenter.h +++ b/fsa/src/vespa/fsa/segmenter.h @@ -10,17 +10,15 @@ #pragma once -#include -#include -#include -#include - -#include - #include "fsa.h" #include "ngram.h" #include "detector.h" +#include +#include +#include +#include +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/tokenizer.h b/fsa/src/vespa/fsa/tokenizer.h index 84dd3c399516..a567167a82c9 100644 --- a/fsa/src/vespa/fsa/tokenizer.h +++ b/fsa/src/vespa/fsa/tokenizer.h @@ -9,11 +9,10 @@ #pragma once +#include #include -#include #include -#include - +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/unaligned.h b/fsa/src/vespa/fsa/unaligned.h index e4fac3287be7..16e07b79a617 100644 --- a/fsa/src/vespa/fsa/unaligned.h +++ b/fsa/src/vespa/fsa/unaligned.h @@ -3,6 +3,7 @@ #pragma once #include +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/vectorizer.h b/fsa/src/vespa/fsa/vectorizer.h index c2c0ff6e09f8..5769b8bb7023 100644 --- a/fsa/src/vespa/fsa/vectorizer.h +++ b/fsa/src/vespa/fsa/vectorizer.h @@ -9,12 +9,11 @@ #pragma once -#include -#include -#include - #include "fsa.h" #include "detector.h" +#include +#include +#include namespace fsa { diff --git a/fsa/src/vespa/fsa/wordchartokenizer.h b/fsa/src/vespa/fsa/wordchartokenizer.h index 82491cbd51ce..b9400b0adf40 100644 --- a/fsa/src/vespa/fsa/wordchartokenizer.h +++ b/fsa/src/vespa/fsa/wordchartokenizer.h @@ -11,11 +11,10 @@ #include "tokenizer.h" +#include #include -#include #include -#include - +#include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/conceptnethandle.h b/fsa/src/vespa/fsamanagers/conceptnethandle.h index a96b23229060..18c7cf00cb71 100644 --- a/fsa/src/vespa/fsamanagers/conceptnethandle.h +++ b/fsa/src/vespa/fsamanagers/conceptnethandle.h @@ -10,10 +10,9 @@ #pragma once -#include - #include "refcountable.h" #include +#include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/conceptnetmanager.h b/fsa/src/vespa/fsamanagers/conceptnetmanager.h index fcb1e4fb8d25..b462f4c57619 100644 --- a/fsa/src/vespa/fsamanagers/conceptnetmanager.h +++ b/fsa/src/vespa/fsamanagers/conceptnetmanager.h @@ -10,12 +10,11 @@ #pragma once -#include -#include - -#include "singleton.h" -#include "rwlock.h" #include "conceptnethandle.h" +#include "rwlock.h" +#include "singleton.h" +#include +#include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/fsahandle.h b/fsa/src/vespa/fsamanagers/fsahandle.h index b38700f76370..8ce4d811c8a8 100644 --- a/fsa/src/vespa/fsamanagers/fsahandle.h +++ b/fsa/src/vespa/fsamanagers/fsahandle.h @@ -10,10 +10,9 @@ #pragma once -#include - #include "refcountable.h" #include +#include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/fsamanager.h b/fsa/src/vespa/fsamanagers/fsamanager.h index 8aed496f991f..e70d52397fb4 100644 --- a/fsa/src/vespa/fsamanagers/fsamanager.h +++ b/fsa/src/vespa/fsamanagers/fsamanager.h @@ -10,13 +10,12 @@ #pragma once +#include "fsahandle.h" +#include "rwlock.h" +#include "singleton.h" #include #include -#include "singleton.h" -#include "rwlock.h" -#include "fsahandle.h" - namespace fsa { // {{{ class FSAManager diff --git a/fsa/src/vespa/fsamanagers/metadatahandle.h b/fsa/src/vespa/fsamanagers/metadatahandle.h index c4e562ac408b..4ef5d1f03ad6 100644 --- a/fsa/src/vespa/fsamanagers/metadatahandle.h +++ b/fsa/src/vespa/fsamanagers/metadatahandle.h @@ -10,10 +10,9 @@ #pragma once -#include - #include "refcountable.h" #include +#include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/metadatamanager.h b/fsa/src/vespa/fsamanagers/metadatamanager.h index b39060fb75f6..3578736638d0 100644 --- a/fsa/src/vespa/fsamanagers/metadatamanager.h +++ b/fsa/src/vespa/fsamanagers/metadatamanager.h @@ -10,12 +10,11 @@ #pragma once -#include -#include - #include "singleton.h" #include "rwlock.h" #include "metadatahandle.h" +#include +#include namespace fsa { diff --git a/jrt_test/src/tests/rpc-error/test-errors.cpp b/jrt_test/src/tests/rpc-error/test-errors.cpp index cecdd09d718c..2144332caf1c 100644 --- a/jrt_test/src/tests/rpc-error/test-errors.cpp +++ b/jrt_test/src/tests/rpc-error/test-errors.cpp @@ -6,7 +6,7 @@ #include #include -vespalib::string spec; +std::string spec; class TestErrors : public ::testing::Test { diff --git a/logd/src/logd/empty_forwarder.h b/logd/src/logd/empty_forwarder.h index e9144b29b360..f7e4b9b4a1f1 100644 --- a/logd/src/logd/empty_forwarder.h +++ b/logd/src/logd/empty_forwarder.h @@ -2,8 +2,8 @@ #pragma once #include "forwarder.h" -#include #include +#include namespace logdemon { diff --git a/logd/src/logd/metrics.cpp b/logd/src/logd/metrics.cpp index 518a08ef0d9d..017fe1875bb2 100644 --- a/logd/src/logd/metrics.cpp +++ b/logd/src/logd/metrics.cpp @@ -15,7 +15,7 @@ Metrics::Metrics(std::shared_ptr m) Metrics::~Metrics() = default; void -Metrics::countLine(const vespalib::string &level, const vespalib::string &service) const +Metrics::countLine(const std::string &level, const std::string &service) const { Point p = metrics->pointBuilder() .bind(loglevel, level) diff --git a/logd/src/logd/metrics.h b/logd/src/logd/metrics.h index 504beecd3163..00318058ad49 100644 --- a/logd/src/logd/metrics.h +++ b/logd/src/logd/metrics.h @@ -22,7 +22,7 @@ struct Metrics { Metrics(std::shared_ptr m); ~Metrics(); - void countLine(const vespalib::string &level, const vespalib::string &service) const; + void countLine(const std::string &level, const std::string &service) const; }; } // namespace logdemon diff --git a/logd/src/logd/rpc_forwarder.cpp b/logd/src/logd/rpc_forwarder.cpp index 16cf22e9d65a..181bffd5559b 100644 --- a/logd/src/logd/rpc_forwarder.cpp +++ b/logd/src/logd/rpc_forwarder.cpp @@ -55,7 +55,7 @@ RpcForwarder::ping_logserver() } RpcForwarder::RpcForwarder(Metrics& metrics, const ForwardMap& forward_filter, FRT_Supervisor& supervisor, - const vespalib::string &hostname, int rpc_port, + const std::string &hostname, int rpc_port, double rpc_timeout_secs, size_t max_messages_per_request) : _metrics(metrics), _connection_spec(make_string("tcp/%s:%d", hostname.c_str(), rpc_port)), diff --git a/logd/src/logd/rpc_forwarder.h b/logd/src/logd/rpc_forwarder.h index e87dd68bc0a7..c757a4721567 100644 --- a/logd/src/logd/rpc_forwarder.h +++ b/logd/src/logd/rpc_forwarder.h @@ -28,7 +28,7 @@ using RpcTargetGuard = std::unique_ptr; class RpcForwarder : public Forwarder { private: Metrics& _metrics; - vespalib::string _connection_spec; + std::string _connection_spec; double _rpc_timeout_secs; size_t _max_messages_per_request; RpcTargetGuard _target; @@ -40,7 +40,7 @@ class RpcForwarder : public Forwarder { public: RpcForwarder(Metrics& metrics, const ForwardMap& forward_filter, FRT_Supervisor& supervisor, - const vespalib::string& logserver_host, int logserver_rpc_port, + const std::string& logserver_host, int logserver_rpc_port, double rpc_timeout_secs, size_t max_messages_per_request); ~RpcForwarder() override; diff --git a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp index 0a619716acbc..74c02618fbbf 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp +++ b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp @@ -32,7 +32,7 @@ bool isExecutable(const char *path) { return ((statbuf.st_mode & S_IXOTH) != 0); } -time_t lastModTime(const vespalib::string &fn) { +time_t lastModTime(const std::string &fn) { if (fn.empty()) return 0; struct stat info; if (stat(fn.c_str(), &info) != 0) return 0; @@ -53,16 +53,16 @@ void CfHandler::doConfigure() { } } -vespalib::string CfHandler::clientCertFile() const { - static const vespalib::string certDir = "/var/lib/sia/certs/"; +std::string CfHandler::clientCertFile() const { + static const std::string certDir = "/var/lib/sia/certs/"; if (_lastConfig && !_lastConfig->role.empty()) { return certDir + _lastConfig->role + ".cert.pem"; } return ""; } -vespalib::string CfHandler::clientKeyFile() const { - static const vespalib::string certDir = "/var/lib/sia/keys/"; +std::string CfHandler::clientKeyFile() const { + static const std::string certDir = "/var/lib/sia/keys/"; if (_lastConfig && !_lastConfig->role.empty()) { return certDir + _lastConfig->role + ".key.pem"; } diff --git a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.h b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.h index 6b31e4e69f25..4717c3401172 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.h +++ b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.h @@ -18,8 +18,8 @@ class CfHandler { public: CfHandler(); virtual ~CfHandler(); - vespalib::string clientCertFile() const; - vespalib::string clientKeyFile() const; + std::string clientCertFile() const; + std::string clientKeyFile() const; void start(const char *configId); void check(); diff --git a/logforwarder/src/apps/vespa-logforwarder-start/child-handler.cpp b/logforwarder/src/apps/vespa-logforwarder-start/child-handler.cpp index 4536569fc498..03f2d25fc1b7 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/child-handler.cpp +++ b/logforwarder/src/apps/vespa-logforwarder-start/child-handler.cpp @@ -2,13 +2,13 @@ #include "child-handler.h" -#include #include #include #include +#include +#include #include #include -#include #include LOG_SETUP(".child-handler"); @@ -18,9 +18,9 @@ ChildHandler::ChildHandler() : _childRunning(false) {} namespace { void -runSplunk(const vespalib::string &prefix, std::vector args) +runSplunk(const std::string &prefix, std::vector args) { - vespalib::string path = prefix + "/bin/splunk"; + std::string path = prefix + "/bin/splunk"; args.insert(args.begin(), path.c_str()); std::string dbg = ""; for (const char *arg : args) { @@ -37,7 +37,7 @@ runSplunk(const vespalib::string &prefix, std::vector args) return; } if (child == 0) { - vespalib::string env = "SPLUNK_HOME=" + prefix; + std::string env = "SPLUNK_HOME=" + prefix; char *cenv = const_cast(env.c_str()); // safe cast putenv(cenv); LOG(debug, "added to environment: '%s'", cenv); @@ -74,7 +74,7 @@ runSplunk(const vespalib::string &prefix, std::vector args) void -ChildHandler::startChild(const vespalib::string &prefix) +ChildHandler::startChild(const std::string &prefix) { LOG(debug, "startChild '%s'", prefix.c_str()); if (_childRunning && prefix == _runningPrefix) { @@ -103,7 +103,7 @@ void ChildHandler::stopChild() { } void -ChildHandler::stopChild(const vespalib::string &prefix) { +ChildHandler::stopChild(const std::string &prefix) { stopChild(); _runningPrefix = prefix; stopChild(); diff --git a/logforwarder/src/apps/vespa-logforwarder-start/child-handler.h b/logforwarder/src/apps/vespa-logforwarder-start/child-handler.h index 3f7498ea1619..3dbfa8eb4b49 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/child-handler.h +++ b/logforwarder/src/apps/vespa-logforwarder-start/child-handler.h @@ -1,15 +1,15 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include class ChildHandler { private: bool _childRunning; - vespalib::string _runningPrefix; + std::string _runningPrefix; public: - void startChild(const vespalib::string &prefix); + void startChild(const std::string &prefix); void stopChild(); - void stopChild(const vespalib::string &prefix); + void stopChild(const std::string &prefix); ChildHandler(); }; diff --git a/logforwarder/src/apps/vespa-logforwarder-start/splunk-starter.cpp b/logforwarder/src/apps/vespa-logforwarder-start/splunk-starter.cpp index e90dbe04fcc3..8c23aff826b4 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/splunk-starter.cpp +++ b/logforwarder/src/apps/vespa-logforwarder-start/splunk-starter.cpp @@ -13,7 +13,7 @@ SplunkStarter::~SplunkStarter() = default; namespace { -vespalib::string fixDir(const vespalib::string &parent, const vespalib::string &subdir) { +std::string fixDir(const std::string &parent, const std::string &subdir) { auto dirname = parent + "/" + subdir; DIR *dp = opendir(dirname.c_str()); if (dp == NULL) { @@ -27,17 +27,17 @@ vespalib::string fixDir(const vespalib::string &parent, const vespalib::string & return dirname; } -vespalib::string -cfFilePath(const vespalib::string &parent, const vespalib::string &filename) { - vespalib::string path = parent; +std::string +cfFilePath(const std::string &parent, const std::string &filename) { + std::string path = parent; path = fixDir(path, "etc"); path = fixDir(path, "system"); path = fixDir(path, "local"); return path + "/" + filename; } -vespalib::string splunkCertPath(const vespalib::string &parent, const vespalib::string &filename) { - vespalib::string path = parent; +std::string splunkCertPath(const std::string &parent, const std::string &filename) { + std::string path = parent; path = fixDir(path, "var"); path = fixDir(path, "lib"); path = fixDir(path, "sia"); @@ -45,7 +45,7 @@ vespalib::string splunkCertPath(const vespalib::string &parent, const vespalib:: return path + "/" + filename; } -void appendFile(FILE *target, const vespalib::string &filename) { +void appendFile(FILE *target, const std::string &filename) { FILE *fp = fopen(filename.c_str(), "r"); if (fp != NULL) { int c; @@ -59,9 +59,9 @@ void appendFile(FILE *target, const vespalib::string &filename) { } // namespace void SplunkStarter::gotConfig(const LogforwarderConfig& config) { - vespalib::string path = cfFilePath(config.splunkHome, "deploymentclient.conf"); + std::string path = cfFilePath(config.splunkHome, "deploymentclient.conf"); LOG(debug, "got config, writing %s", path.c_str()); - vespalib::string tmpPath = path + ".new"; + std::string tmpPath = path + ".new"; FILE *fp = fopen(tmpPath.c_str(), "w"); if (fp == NULL) { LOG(warning, "could not open '%s' for write", tmpPath.c_str()); @@ -101,10 +101,10 @@ void SplunkStarter::gotConfig(const LogforwarderConfig& config) { rename(tmpPath.c_str(), path.c_str()); } } - vespalib::string clientCert = clientCertFile(); - vespalib::string clientKey = clientKeyFile(); + std::string clientCert = clientCertFile(); + std::string clientKey = clientKeyFile(); if (!clientCert.empty() && !clientKey.empty()) { - vespalib::string certPath = splunkCertPath(config.splunkHome, "servercert.pem"); + std::string certPath = splunkCertPath(config.splunkHome, "servercert.pem"); tmpPath = certPath + ".new"; fp = fopen(tmpPath.c_str(), "w"); appendFile(fp, clientCert); diff --git a/logforwarder/src/apps/vespa-otelcol-start/child-handler.cpp b/logforwarder/src/apps/vespa-otelcol-start/child-handler.cpp index a69f090e4df7..324baaa03d7d 100644 --- a/logforwarder/src/apps/vespa-otelcol-start/child-handler.cpp +++ b/logforwarder/src/apps/vespa-otelcol-start/child-handler.cpp @@ -2,15 +2,15 @@ #include "child-handler.h" -#include #include #include #include #include #include +#include +#include #include #include -#include #include LOG_SETUP(".child-handler"); diff --git a/logforwarder/src/apps/vespa-otelcol-start/file-watcher.cpp b/logforwarder/src/apps/vespa-otelcol-start/file-watcher.cpp index f56a1d9d1696..303bfa91d067 100644 --- a/logforwarder/src/apps/vespa-otelcol-start/file-watcher.cpp +++ b/logforwarder/src/apps/vespa-otelcol-start/file-watcher.cpp @@ -8,7 +8,7 @@ namespace { -time_t lastModTime(const vespalib::string &fn) { +time_t lastModTime(const std::string &fn) { if (fn.empty()) return 0; struct stat info; if (stat(fn.c_str(), &info) != 0) return 0; diff --git a/logforwarder/src/apps/vespa-otelcol-start/file-watcher.h b/logforwarder/src/apps/vespa-otelcol-start/file-watcher.h index 93c7f615a7cf..e4e94a52a799 100644 --- a/logforwarder/src/apps/vespa-otelcol-start/file-watcher.h +++ b/logforwarder/src/apps/vespa-otelcol-start/file-watcher.h @@ -5,13 +5,13 @@ class FileWatcher { struct FileInfo { - vespalib::string pathName; + std::string pathName; time_t seenModTime; #if !defined(__cpp_aggregate_paren_init) // P0960R3 is supported by gcc >= 10, Clang >= 16 and AppleClang >= 16 - FileInfo(vespalib::string pathName_in, time_t seenModTime_in) + FileInfo(std::string pathName_in, time_t seenModTime_in) : pathName(std::move(pathName_in)), seenModTime(seenModTime_in) { diff --git a/logforwarder/src/apps/vespa-otelcol-start/wrapper.cpp b/logforwarder/src/apps/vespa-otelcol-start/wrapper.cpp index 34b636546ce0..dedfbe5c9c42 100644 --- a/logforwarder/src/apps/vespa-otelcol-start/wrapper.cpp +++ b/logforwarder/src/apps/vespa-otelcol-start/wrapper.cpp @@ -13,7 +13,7 @@ LOG_SETUP(".wrapper"); namespace { -vespalib::string fixDir(const vespalib::string &parent, const vespalib::string &subdir) { +std::string fixDir(const std::string &parent, const std::string &subdir) { auto dirname = parent + "/" + subdir; DIR *dp = opendir(dirname.c_str()); if (dp == NULL) { @@ -27,15 +27,15 @@ vespalib::string fixDir(const vespalib::string &parent, const vespalib::string & return dirname; } -vespalib::string cfFilePath() { - vespalib::string path = vespa::Defaults::underVespaHome("var/db/vespa"); +std::string cfFilePath() { + std::string path = vespa::Defaults::underVespaHome("var/db/vespa"); path = fixDir(path, "otelcol"); return path + "/" + "config.yaml"; } -void writeConfig(const vespalib::string &config, const vespalib::string &path) { +void writeConfig(const std::string &config, const std::string &path) { LOG(info, "got config, writing %s", path.c_str()); - vespalib::string tmpPath = path + ".new"; + std::string tmpPath = path + ".new"; FILE *fp = fopen(tmpPath.c_str(), "w"); if (fp == NULL) { LOG(warning, "could not open '%s' for write", tmpPath.c_str()); diff --git a/lowercasing_test/src/tests/lowercasing/casingvariants_vespalib.cpp b/lowercasing_test/src/tests/lowercasing/casingvariants_vespalib.cpp index ccbb60215c8b..fb40ce4b0ddb 100644 --- a/lowercasing_test/src/tests/lowercasing/casingvariants_vespalib.cpp +++ b/lowercasing_test/src/tests/lowercasing/casingvariants_vespalib.cpp @@ -16,10 +16,10 @@ getUCS4Char(const char *src) return reader.getChar(); } -vespalib::string +std::string getUTF8String(uint32_t ucs4Char) { - vespalib::string target; + std::string target; Utf8Writer writer(target); writer.putChar(ucs4Char); return target; diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index 1083e5902f6d..9d41df4abca8 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -45,7 +45,7 @@ class MultiReceptor : public IMessageHandler std::lock_guard guard(_mon); - vespalib::string expected(vespalib::make_string("%d", _messageCounter)); + std::string expected(vespalib::make_string("%d", _messageCounter)); LOG(debug, "Got message %p with %s, expecting %s", msg.get(), simpleMsg.getValue().c_str(), @@ -110,7 +110,7 @@ VerifyReplyReceptor::handleReply(Reply::UP reply) } LOG(warning, "%s", ss.str().c_str()); } else { - vespalib::string expected(vespalib::make_string("%d", _replyCount)); + std::string expected(vespalib::make_string("%d", _replyCount)); auto & simpleReply(dynamic_cast(*reply)); if (simpleReply.getValue() != expected) { std::stringstream ss; @@ -162,7 +162,7 @@ TEST("messageordering_test") { // send messages on client const int messageCount = 5000; for (int i = 0; i < messageCount; ++i) { - vespalib::string str(vespalib::make_string("%d", i)); + std::string str(vespalib::make_string("%d", i)); //std::this_thread::sleep_for(1ms); auto msg = std::make_unique(str, true, commonMessageId); msg->getTrace().setLevel(9); diff --git a/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp b/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp index 15b2355f1703..13c450d0b586 100644 --- a/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp +++ b/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp @@ -18,8 +18,8 @@ TEST("simpleprotocol_test") { SimpleProtocol protocol; EXPECT_TRUE(protocol.getName() == "Simple"); - EXPECT_EQUAL(24u + 2 *sizeof(vespalib::string), sizeof(Result)); - EXPECT_EQUAL(8u + 2 *sizeof(vespalib::string), sizeof(Error)); + EXPECT_EQUAL(24u + 2 *sizeof(std::string), sizeof(Result)); + EXPECT_EQUAL(8u + 2 *sizeof(std::string), sizeof(Error)); EXPECT_EQUAL(56u, sizeof(Routable)); { // test protocol @@ -30,7 +30,7 @@ TEST("simpleprotocol_test") { { // test SimpleMessage EXPECT_EQUAL(104u, sizeof(Message)); - EXPECT_EQUAL(120u + sizeof(vespalib::string), sizeof(SimpleMessage)); + EXPECT_EQUAL(120u + sizeof(std::string), sizeof(SimpleMessage)); auto msg = std::make_unique("test"); EXPECT_TRUE(!msg->isReply()); EXPECT_TRUE(msg->getProtocol() == SimpleProtocol::NAME); @@ -49,7 +49,7 @@ TEST("simpleprotocol_test") { { // test SimpleReply EXPECT_EQUAL(96u, sizeof(Reply)); - EXPECT_EQUAL(96u + sizeof(vespalib::string), sizeof(SimpleReply)); + EXPECT_EQUAL(96u + sizeof(std::string), sizeof(SimpleReply)); auto reply = std::make_unique("reply"); EXPECT_TRUE(reply->isReply()); EXPECT_TRUE(reply->getProtocol() == SimpleProtocol::NAME); diff --git a/messagebus/src/vespa/messagebus/common.h b/messagebus/src/vespa/messagebus/common.h index bbf6387f1b47..5966a2e4f120 100644 --- a/messagebus/src/vespa/messagebus/common.h +++ b/messagebus/src/vespa/messagebus/common.h @@ -1,13 +1,13 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace mbus { // Decide the type of string used once -using string = vespalib::string; +using string = std::string; using duration = vespalib::duration; using time_point = vespalib::steady_clock::time_point; diff --git a/messagebus/src/vespa/messagebus/messagebus.cpp b/messagebus/src/vespa/messagebus/messagebus.cpp index aca80a1d3878..ee5c292c837a 100644 --- a/messagebus/src/vespa/messagebus/messagebus.cpp +++ b/messagebus/src/vespa/messagebus/messagebus.cpp @@ -418,5 +418,5 @@ MessageBus::setMaxPendingSize(uint32_t maxSize) } // namespace mbus -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, std::shared_ptr); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, mbus::IMessageHandler *); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, std::shared_ptr); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, mbus::IMessageHandler *); diff --git a/messagebus/src/vespa/messagebus/messagebus.h b/messagebus/src/vespa/messagebus/messagebus.h index b3bf10cdf8f5..d1e0ef4518b3 100644 --- a/messagebus/src/vespa/messagebus/messagebus.h +++ b/messagebus/src/vespa/messagebus/messagebus.h @@ -11,9 +11,9 @@ #include #include #include +#include #include #include -#include namespace mbus { diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index 8c97d322e62d..01ff4895ece4 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -337,7 +337,7 @@ emit_recipient_endpoint(vespalib::asciistream& stream, const RoutingNode& recipi } -vespalib::string +std::string RPCNetwork::buildRecipientListString(const SendContext& ctx) { vespalib::asciistream s; bool first = true; diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.h b/messagebus/src/vespa/messagebus/network/rpcnetwork.h index 40590d4545f5..601201f40de8 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.h +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.h @@ -94,7 +94,7 @@ class RPCNetwork : public FRT_Invokable, public INetwork { */ void send(SendContext &ctx); - static vespalib::string buildRecipientListString(const SendContext& ctx); + static std::string buildRecipientListString(const SendContext& ctx); protected: /** diff --git a/messagebus/src/vespa/messagebus/network/rpcsend.cpp b/messagebus/src/vespa/messagebus/network/rpcsend.cpp index ca2940d17e5d..c35bad0a3317 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsend.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcsend.cpp @@ -207,12 +207,12 @@ RPCSend::decode(std::string_view protocolName, const vespalib::Version & version } } else { error = Error(ErrorCode::DECODE_ERROR, - make_string("Protocol '%s' failed to decode routable.", vespalib::string(protocolName).c_str())); + make_string("Protocol '%s' failed to decode routable.", std::string(protocolName).c_str())); } } else { error = Error(ErrorCode::UNKNOWN_PROTOCOL, - make_string("Protocol '%s' is not known by %s.", vespalib::string(protocolName).c_str(), _serverIdent.c_str())); + make_string("Protocol '%s' is not known by %s.", std::string(protocolName).c_str(), _serverIdent.c_str())); } return reply; } @@ -261,7 +261,7 @@ RPCSend::doRequest(FRT_RPCRequest *req) if (protocol == nullptr) { replyError(req, params->getVersion(), params->getTraceLevel(), Error(ErrorCode::UNKNOWN_PROTOCOL, make_string("Protocol '%s' is not known by %s.", - vespalib::string(params->getProtocol()).c_str(), _serverIdent.c_str()))); + std::string(params->getProtocol()).c_str(), _serverIdent.c_str()))); return; } Routable::UP routable = protocol->decode(params->getVersion(), params->getPayload()); @@ -269,7 +269,7 @@ RPCSend::doRequest(FRT_RPCRequest *req) if ( ! routable ) { replyError(req, params->getVersion(), params->getTraceLevel(), Error(ErrorCode::DECODE_ERROR, - make_string("Protocol '%s' failed to decode routable.", vespalib::string(params->getProtocol()).c_str()))); + make_string("Protocol '%s' failed to decode routable.", std::string(params->getProtocol()).c_str()))); return; } if (routable->isReply()) { diff --git a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h index 32d2b3f7cdef..06ddab8c818b 100644 --- a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h +++ b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h @@ -2,9 +2,9 @@ #pragma once -#include #include "iserviceaddress.h" #include "rpctarget.h" +#include namespace mbus { diff --git a/messagebus/src/vespa/messagebus/routing/routeparser.cpp b/messagebus/src/vespa/messagebus/routing/routeparser.cpp index a3bd75fd55a0..1e54f8737964 100644 --- a/messagebus/src/vespa/messagebus/routing/routeparser.cpp +++ b/messagebus/src/vespa/messagebus/routing/routeparser.cpp @@ -105,7 +105,7 @@ RouteParser::createHop(string_view str) return Hop().addDirective(createErrorDirective( vespalib::make_string( "Failed to completely parse '%s'.", - vespalib::string(str).c_str()))); + std::string(str).c_str()))); } else if (str[at] == '[') { ++depth; } else if (str[at] == ']') { diff --git a/messagebus/src/vespa/messagebus/routing/routespec.h b/messagebus/src/vespa/messagebus/routing/routespec.h index 69bc3ba44695..1f0b5cf0eec2 100644 --- a/messagebus/src/vespa/messagebus/routing/routespec.h +++ b/messagebus/src/vespa/messagebus/routing/routespec.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include namespace mbus { diff --git a/messagebus/src/vespa/messagebus/routing/routingtable.h b/messagebus/src/vespa/messagebus/routing/routingtable.h index d3e656224cb7..c4922af9a0a7 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtable.h +++ b/messagebus/src/vespa/messagebus/routing/routingtable.h @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include "hopblueprint.h" #include "route.h" +#include +#include namespace mbus { diff --git a/messagebus/src/vespa/messagebus/routing/routingtablespec.h b/messagebus/src/vespa/messagebus/routing/routingtablespec.h index 51a6998febc7..e99174f45d10 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtablespec.h +++ b/messagebus/src/vespa/messagebus/routing/routingtablespec.h @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include "hopspec.h" #include "routespec.h" +#include +#include namespace mbus { diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 95df8f53589f..72b5a1c734b3 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -150,7 +150,7 @@ struct MetricNameVisitor : public MetricVisitor { namespace { std::pair -getMatchedMetrics(const vespalib::string& config) +getMatchedMetrics(const std::string& config) { TestMetricSet mySet; MetricManager mm; @@ -614,9 +614,9 @@ TEST_F(MetricManagerTest, test_json_output) // Verify some content EXPECT_EQ(1000.0, slime.get()["snapshot"]["from"].asDouble()) << jsonData; EXPECT_EQ(1300.0, slime.get()["snapshot"]["to"].asDouble()) << jsonData; - EXPECT_EQ(vespalib::string("temp.val6"), + EXPECT_EQ(std::string("temp.val6"), slime.get()["values"][0]["name"].asString().make_string()) << jsonData; - EXPECT_EQ(vespalib::string("val6 desc"), + EXPECT_EQ(std::string("val6 desc"), slime.get()["values"][0]["description"].asString().make_string()) << jsonData; EXPECT_EQ(2.0, slime.get()["values"][0]["values"]["average"].asDouble()) << jsonData; EXPECT_EQ(1.0, slime.get()["values"][0]["values"]["count"].asDouble()) << jsonData; @@ -624,9 +624,9 @@ TEST_F(MetricManagerTest, test_json_output) EXPECT_EQ(2.0, slime.get()["values"][0]["values"]["max"].asDouble()) << jsonData; EXPECT_EQ(2.0, slime.get()["values"][0]["values"]["last"].asDouble()) << jsonData; - EXPECT_EQ(vespalib::string("temp.multisub.sum.valsum"), + EXPECT_EQ(std::string("temp.multisub.sum.valsum"), slime.get()["values"][10]["name"].asString().make_string()) << jsonData; - EXPECT_EQ(vespalib::string("valsum desc"), + EXPECT_EQ(std::string("valsum desc"), slime.get()["values"][10]["description"].asString().make_string()) << jsonData; EXPECT_EQ(10.0, slime.get()["values"][10]["values"]["average"].asDouble()) << jsonData; EXPECT_EQ(3.0, slime.get()["values"][10]["values"]["count"].asDouble()) << jsonData; @@ -635,9 +635,9 @@ TEST_F(MetricManagerTest, test_json_output) EXPECT_EQ(10.0, slime.get()["values"][10]["values"]["last"].asDouble()) << jsonData; metrics::StateApiAdapter adapter(mm); - vespalib::string normal = adapter.getMetrics("snapper", vespalib::MetricsProducer::ExpositionFormat::JSON); - EXPECT_EQ(vespalib::string(jsonData), normal); - vespalib::string total = adapter.getTotalMetrics("snapper", vespalib::MetricsProducer::ExpositionFormat::JSON); + std::string normal = adapter.getMetrics("snapper", vespalib::MetricsProducer::ExpositionFormat::JSON); + EXPECT_EQ(std::string(jsonData), normal); + std::string total = adapter.getTotalMetrics("snapper", vespalib::MetricsProducer::ExpositionFormat::JSON); EXPECT_GT(total.size(), 0); EXPECT_NE(total, normal); } diff --git a/metrics/src/tests/metricsettest.cpp b/metrics/src/tests/metricsettest.cpp index 3c7a3ebf5b91..cddf8789a828 100644 --- a/metrics/src/tests/metricsettest.cpp +++ b/metrics/src/tests/metricsettest.cpp @@ -64,14 +64,14 @@ TEST(MetricSetTest, test_normal_usage) // Check that paths are set MetricSet topSet("top", {}, ""); topSet.registerMetric(set); - EXPECT_EQ(vespalib::string("a"), set.getPath()); - EXPECT_EQ(vespalib::string("a.c"), v1.getPath()); - EXPECT_EQ(vespalib::string("a.b"), v2.getPath()); - EXPECT_EQ(vespalib::string("a.d"), v3.getPath()); - EXPECT_EQ(vespalib::string("a.e"), set2.getPath()); - EXPECT_EQ(vespalib::string("a.e.f"), v4.getPath()); - EXPECT_EQ(vespalib::string("a.g"), v5.getPath()); - EXPECT_EQ(vespalib::string("a.b"), v2copy->getPath()); + EXPECT_EQ(std::string("a"), set.getPath()); + EXPECT_EQ(std::string("a.c"), v1.getPath()); + EXPECT_EQ(std::string("a.b"), v2.getPath()); + EXPECT_EQ(std::string("a.d"), v3.getPath()); + EXPECT_EQ(std::string("a.e"), set2.getPath()); + EXPECT_EQ(std::string("a.e.f"), v4.getPath()); + EXPECT_EQ(std::string("a.g"), v5.getPath()); + EXPECT_EQ(std::string("a.b"), v2copy->getPath()); // Verify XML output. Should be in register order. std::string expected("'\n" diff --git a/metrics/src/tests/metrictest.cpp b/metrics/src/tests/metrictest.cpp index 47fef6170e69..7fe9e469f146 100644 --- a/metrics/src/tests/metrictest.cpp +++ b/metrics/src/tests/metrictest.cpp @@ -14,7 +14,7 @@ void testMetricsGetDimensionsAsPartOfMangledNameImpl() { MetricImpl m("test", {{"foo", "bar"}}, "description goes here"); - EXPECT_EQ(vespalib::string("test{foo:bar}"), m.getMangledName()); + EXPECT_EQ(std::string("test{foo:bar}"), m.getMangledName()); } template @@ -24,7 +24,7 @@ testMangledNameMayContainMultipleDimensionsImpl() MetricImpl m("test", {{"flarn", "yarn"}, {"foo", "bar"}}, "description goes here"); - EXPECT_EQ(vespalib::string("test{flarn:yarn,foo:bar}"), m.getMangledName()); + EXPECT_EQ(std::string("test{flarn:yarn,foo:bar}"), m.getMangledName()); } TEST(MetricTest, value_metrics_get_dimensions_as_part_of_mangled_name) @@ -55,20 +55,20 @@ TEST(MetricTest, mangled_name_lists_dimensions_in_lexicographic_order) LongValueMetric m("test", {{"xyz", "bar"}, {"abc", "foo"}, {"def", "baz"}}, "", nullptr); - EXPECT_EQ(vespalib::string("test{abc:foo,def:baz,xyz:bar}"), m.getMangledName()); + EXPECT_EQ(std::string("test{abc:foo,def:baz,xyz:bar}"), m.getMangledName()); } TEST(MetricTest, mangling_does_not_change_original_metric_name) { LongValueMetric m("test", {{"foo", "bar"}}, "", nullptr); - EXPECT_EQ(vespalib::string("test"), m.getName()); + EXPECT_EQ(std::string("test"), m.getName()); } TEST(MetricTest, legacy_tags_do_not_create_mangled_name) { LongValueMetric m("test", {{"foo"},{"bar"}}, "", nullptr); - EXPECT_EQ(vespalib::string("test"), m.getName()); - EXPECT_EQ(vespalib::string("test"), m.getMangledName()); + EXPECT_EQ(std::string("test"), m.getName()); + EXPECT_EQ(std::string("test"), m.getMangledName()); } } diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp index acfea40275fa..c116485f4ea6 100644 --- a/metrics/src/tests/snapshottest.cpp +++ b/metrics/src/tests/snapshottest.cpp @@ -21,14 +21,14 @@ struct SubSubMetricSet : public MetricSet { DoubleAverageMetric average2; SumMetric averageSum; - explicit SubSubMetricSet(const vespalib::string & name, MetricSet* owner = 0); + explicit SubSubMetricSet(const std::string & name, MetricSet* owner = 0); ~SubSubMetricSet() override; MetricSet* clone(std::vector &ownerList, CopyType copyType, metrics::MetricSet* owner, bool includeUnused) const override; void incValues(); }; -SubSubMetricSet::SubSubMetricSet(const vespalib::string & name, MetricSet* owner) +SubSubMetricSet::SubSubMetricSet(const std::string & name, MetricSet* owner) : MetricSet(name, {}, "", owner), incVal(1), count1("count1", {}, "", this), @@ -77,7 +77,7 @@ struct SubMetricSet : public MetricSet { SubSubMetricSet set2; SumMetric setSum; - explicit SubMetricSet(const vespalib::string & name, MetricSet* owner = nullptr); + explicit SubMetricSet(const std::string & name, MetricSet* owner = nullptr); ~SubMetricSet() override; MetricSet* clone(std::vector &ownerList, CopyType copyType, @@ -86,7 +86,7 @@ struct SubMetricSet : public MetricSet { void incValues(); }; -SubMetricSet::SubMetricSet(const vespalib::string & name, MetricSet* owner) +SubMetricSet::SubMetricSet(const std::string & name, MetricSet* owner) : MetricSet(name, {}, "", owner), set1("set1", this), set2("set2", this), @@ -118,14 +118,14 @@ struct TestMetricSet : public MetricSet { SubMetricSet set2; SumMetric setSum; - TestMetricSet(const vespalib::string & name); + TestMetricSet(const std::string & name); ~TestMetricSet() override; void incValues(); }; -TestMetricSet::TestMetricSet(const vespalib::string & name) +TestMetricSet::TestMetricSet(const std::string & name) : MetricSet(name, {}, "", nullptr), set1("set1", this), set2("set2", this), diff --git a/metrics/src/tests/valuemetrictest.cpp b/metrics/src/tests/valuemetrictest.cpp index a3eea37dfb41..2cd24a4631d5 100644 --- a/metrics/src/tests/valuemetrictest.cpp +++ b/metrics/src/tests/valuemetrictest.cpp @@ -172,7 +172,7 @@ TEST(ValueMetricTest, test_add_value_batch) namespace { -vespalib::string extractMetricJson(std::string_view s) { +std::string extractMetricJson(std::string_view s) { vespalib::StringTokenizer st(s, "\n", ""); for (uint32_t i = st.size() - 1; i < st.size(); --i) { if (st[i].find("\"name\":\"") != std::string::npos) { @@ -188,7 +188,7 @@ vespalib::string extractMetricJson(std::string_view s) { throw vespalib::IllegalArgumentException("Didn't find metric"); } -vespalib::string getJson(MetricManager& mm) { +std::string getJson(MetricManager& mm) { vespalib::asciistream as; vespalib::JsonStream stream(as, true); JsonWriter writer(stream); @@ -206,7 +206,7 @@ TEST(ValueMetricTest, test_json) DoubleValueMetric m("test", {{"tag"}}, "description"); mm.registerMetric(mm.getMetricLock(), m); - vespalib::string expected("'\n" + std::string expected("'\n" "{\n" " \"name\":\"test\",\n" " \"description\":\"description\",\n" diff --git a/metrics/src/vespa/metrics/memoryconsumption.cpp b/metrics/src/vespa/metrics/memoryconsumption.cpp index cc3d76ef8e26..d69e6608cd2f 100644 --- a/metrics/src/vespa/metrics/memoryconsumption.cpp +++ b/metrics/src/vespa/metrics/memoryconsumption.cpp @@ -2,6 +2,7 @@ #include "memoryconsumption.h" #include #include +#include #include namespace metrics { @@ -20,7 +21,7 @@ MemoryConsumption::MemoryConsumption() MemoryConsumption::~MemoryConsumption() = default; uint32_t -MemoryConsumption::getStringMemoryUsage(const vespalib::string& s, uint32_t& uniqueCount) { +MemoryConsumption::getStringMemoryUsage(const std::string& s, uint32_t& uniqueCount) { ++_totalStringCount; const char* internalString = s.c_str(); if (_seenStrings->find(internalString) != _seenStrings->end()) { @@ -29,7 +30,7 @@ MemoryConsumption::getStringMemoryUsage(const vespalib::string& s, uint32_t& uni ++uniqueCount; _seenStrings->insert(internalString); const void *p = &s; - if ((p <= internalString) && (internalString - sizeof(vespalib::string) < p)) { + if ((p <= internalString) && (internalString - sizeof(std::string) < p)) { // no extra space allocated outside object return 0; } diff --git a/metrics/src/vespa/metrics/memoryconsumption.h b/metrics/src/vespa/metrics/memoryconsumption.h index e2a29650694f..438dd3c830dc 100644 --- a/metrics/src/vespa/metrics/memoryconsumption.h +++ b/metrics/src/vespa/metrics/memoryconsumption.h @@ -87,7 +87,7 @@ class MemoryConsumption : public vespalib::Printable { ~MemoryConsumption() override; /** Get memory usage of a string that is not included when doing sizeof */ - uint32_t getStringMemoryUsage(const vespalib::string& s, uint32_t& uniqueCount); + uint32_t getStringMemoryUsage(const std::string& s, uint32_t& uniqueCount); void addSnapShotUsage(const std::string& name, uint32_t usage); uint32_t getTotalMemoryUsage() const; diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp index 6e753e42144f..7940963cb808 100644 --- a/metrics/src/vespa/metrics/metric.cpp +++ b/metrics/src/vespa/metrics/metric.cpp @@ -103,7 +103,7 @@ Metric::assignMangledNameWithDimensions() return; } sortTagsInDeterministicOrder(); - vespalib::string mangled = createMangledNameWithDimensions(); + std::string mangled = createMangledNameWithDimensions(); _mangledName = NameRepo::metricId(mangled); } @@ -115,7 +115,7 @@ Metric::sortTagsInDeterministicOrder() }); } -vespalib::string +std::string Metric::createMangledNameWithDimensions() const { vespalib::asciistream s; @@ -166,13 +166,13 @@ Metric::getRoot() const : _owner->getRoot()); } -vespalib::string +std::string Metric::getPath() const { if (_owner == 0 || _owner->_owner == 0) { return getName(); } else { - vespalib::string path(_owner->getPath()); + std::string path(_owner->getPath()); path += '.'; path.append(getName()); return path; diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index 57305bfaecba..481184bd1551 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -3,8 +3,8 @@ #include "name_repo.h" #include -#include #include +#include namespace metrics { @@ -81,8 +81,8 @@ struct MetricVisitor { */ struct Tag { - const vespalib::string& key() const { return NameRepo::tagKey(_key); } - const vespalib::string& value() const { return NameRepo::tagValue(_value); } + const std::string& key() const { return NameRepo::tagKey(_key); } + const std::string& value() const { return NameRepo::tagValue(_value); } Tag(std::string_view k); Tag(std::string_view k, std::string_view v); @@ -102,7 +102,7 @@ struct Tag class Metric : public vespalib::Printable { public: - using String = vespalib::string; + using String = std::string; using string_view = std::string_view; using UP = std::unique_ptr; using SP = std::shared_ptr; @@ -117,17 +117,17 @@ class Metric : public vespalib::Printable Metric & operator = (Metric && rhs) noexcept = default; ~Metric() override; - const vespalib::string& getName() const { return NameRepo::metricName(_name); } + const std::string& getName() const { return NameRepo::metricName(_name); } /** * Get mangled name iff the metric contains any dimensions, otherwise * the original metric name is returned. */ - const vespalib::string& getMangledName() const { + const std::string& getMangledName() const { return NameRepo::metricName(_mangledName); } - vespalib::string getPath() const; + std::string getPath() const; std::vector getPathVector() const; - const vespalib::string& getDescription() const { return NameRepo::description(_description); } + const std::string& getDescription() const { return NameRepo::description(_description); } const Tags& getTags() const { return _tags; } /** Return whether there exists a tag with a key equal to 'tag' */ bool hasTag(const String& tag) const; @@ -212,7 +212,7 @@ class Metric : public vespalib::Printable } /** Used by sum metric to alter description of cloned metric for sum. */ - void setDescription(const vespalib::string& d) { + void setDescription(const std::string& d) { _description = NameRepo::descriptionId(d); } /** Used by sum metric to alter tag of cloned metric for sum. */ @@ -265,7 +265,7 @@ class Metric : public vespalib::Printable */ void sortTagsInDeterministicOrder(); - vespalib::string createMangledNameWithDimensions() const; + std::string createMangledNameWithDimensions() const; void verifyConstructionParameters(); /** diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp index 3165cd51f0cd..157fe022f9c9 100644 --- a/metrics/src/vespa/metrics/metricmanager.cpp +++ b/metrics/src/vespa/metrics/metricmanager.cpp @@ -46,7 +46,7 @@ MetricManager::assertMetricLockLocked(const MetricLockGuard& g) const { } } -vespalib::string +std::string MetricManager::ConsumerSpec::toString() const { vespalib::asciistream out; @@ -207,7 +207,7 @@ struct Path { explicit Path(std::string_view fullpath) : _path(fullpath, ".") { } - vespalib::string toString() const { + std::string toString() const { vespalib::asciistream ost; ost << _path[0]; for (uint32_t i=1; i #include #include +#include #include #include #include @@ -72,8 +73,8 @@ double MetricSet::getDoubleValue(string_view) const { const Metric* MetricSet::getMetric(string_view name) const { - vespalib::string::size_type pos = name.find('.'); - if (pos == vespalib::string::npos) { + std::string::size_type pos = name.find('.'); + if (pos == std::string::npos) { return getMetricInternal(name); } else { string_view child(name.substr(0, pos)); diff --git a/metrics/src/vespa/metrics/metricvalueset.h b/metrics/src/vespa/metrics/metricvalueset.h index 4f7243e28b29..b19417face82 100644 --- a/metrics/src/vespa/metrics/metricvalueset.h +++ b/metrics/src/vespa/metrics/metricvalueset.h @@ -27,11 +27,11 @@ */ #pragma once -#include #include -#include -#include #include +#include +#include +#include namespace metrics { diff --git a/metrics/src/vespa/metrics/name_repo.cpp b/metrics/src/vespa/metrics/name_repo.cpp index 35731eaf578e..f5d4dc3daba5 100644 --- a/metrics/src/vespa/metrics/name_repo.cpp +++ b/metrics/src/vespa/metrics/name_repo.cpp @@ -42,25 +42,25 @@ NameRepo::tagValueId(std::string_view value) return TagValueId(id); } -const vespalib::string& +const std::string& NameRepo::metricName(MetricNameId id) { return metricNames.lookup(id.id()); } -const vespalib::string& +const std::string& NameRepo::description(DescriptionId id) { return descriptions.lookup(id.id()); } -const vespalib::string& +const std::string& NameRepo::tagKey(TagKeyId id) { return tagKeys.lookup(id.id()); } -const vespalib::string& +const std::string& NameRepo::tagValue(TagValueId id) { return tagValues.lookup(id.id()); diff --git a/metrics/src/vespa/metrics/name_repo.h b/metrics/src/vespa/metrics/name_repo.h index 5b2a9e923f44..a7557600bf9d 100644 --- a/metrics/src/vespa/metrics/name_repo.h +++ b/metrics/src/vespa/metrics/name_repo.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace metrics { @@ -22,10 +22,10 @@ struct NameRepo { static TagKeyId tagKeyId(std::string_view name); static TagValueId tagValueId(std::string_view value); - static const vespalib::string& metricName(MetricNameId id); - static const vespalib::string& description(DescriptionId id); - static const vespalib::string& tagKey(TagKeyId id); - static const vespalib::string& tagValue(TagValueId id); + static const std::string& metricName(MetricNameId id); + static const std::string& description(DescriptionId id); + static const std::string& tagKey(TagKeyId id); + static const std::string& tagValue(TagValueId id); }; } // metrics diff --git a/metrics/src/vespa/metrics/prometheus_writer.cpp b/metrics/src/vespa/metrics/prometheus_writer.cpp index 23ef000adaee..369a2cd11a1b 100644 --- a/metrics/src/vespa/metrics/prometheus_writer.cpp +++ b/metrics/src/vespa/metrics/prometheus_writer.cpp @@ -47,7 +47,7 @@ namespace { return std::ranges::any_of(value, [](char ch) noexcept { return label_char_needs_escaping(ch); }); } -[[nodiscard]] vespalib::string prometheus_escaped_name(std::string_view str) { +[[nodiscard]] std::string prometheus_escaped_name(std::string_view str) { asciistream os; for (char ch : str) { if (valid_prometheus_char(ch)) [[likely]] { @@ -123,7 +123,7 @@ std::span PrometheusWriter::metric_to_path_ref(std::stri return _arena.copy_array({path_refs.data(), path_refs.size()}); } -vespalib::string PrometheusWriter::escaped_label_value(std::string_view value) { +std::string PrometheusWriter::escaped_label_value(std::string_view value) { asciistream out; for (char ch : value) { if (ch == '\\') { diff --git a/metrics/src/vespa/metrics/prometheus_writer.h b/metrics/src/vespa/metrics/prometheus_writer.h index e1d4af87aebb..d417825b1049 100644 --- a/metrics/src/vespa/metrics/prometheus_writer.h +++ b/metrics/src/vespa/metrics/prometheus_writer.h @@ -72,7 +72,7 @@ class PrometheusWriter : public MetricVisitor { [[nodiscard]] std::string_view stable_label_value_string_ref(std::string_view raw_label_value); void build_labels_upto_root(vespalib::SmallVector& out, const Metric& m); - [[nodiscard]] static vespalib::string escaped_label_value(std::string_view value); + [[nodiscard]] static std::string escaped_label_value(std::string_view value); // Renders name with a tailing '_' character, as the caller is expected to append an aggregate. static void render_path_as_metric_name_prefix(vespalib::asciistream& out, std::span path); static void render_label_pairs(vespalib::asciistream& out, std::span labels); diff --git a/metrics/src/vespa/metrics/state_api_adapter.cpp b/metrics/src/vespa/metrics/state_api_adapter.cpp index 2c92448fe952..8062ed123577 100644 --- a/metrics/src/vespa/metrics/state_api_adapter.cpp +++ b/metrics/src/vespa/metrics/state_api_adapter.cpp @@ -7,8 +7,8 @@ namespace metrics { -vespalib::string -StateApiAdapter::getMetrics(const vespalib::string &consumer, ExpositionFormat format) +std::string +StateApiAdapter::getMetrics(const std::string &consumer, ExpositionFormat format) { MetricLockGuard guard(_manager.getMetricLock()); auto periods = _manager.getSnapshotPeriods(guard); @@ -38,8 +38,8 @@ StateApiAdapter::getMetrics(const vespalib::string &consumer, ExpositionFormat f return out.str(); } -vespalib::string -StateApiAdapter::getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) +std::string +StateApiAdapter::getTotalMetrics(const std::string &consumer, ExpositionFormat format) { _manager.updateMetrics(); MetricLockGuard guard(_manager.getMetricLock()); diff --git a/metrics/src/vespa/metrics/state_api_adapter.h b/metrics/src/vespa/metrics/state_api_adapter.h index 39a800993558..cb1380dbdf96 100644 --- a/metrics/src/vespa/metrics/state_api_adapter.h +++ b/metrics/src/vespa/metrics/state_api_adapter.h @@ -21,8 +21,8 @@ class StateApiAdapter : public vespalib::MetricsProducer public: explicit StateApiAdapter(MetricManager &manager) : _manager(manager) {} - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override; - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override; + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override; + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override; }; } // namespace metrics diff --git a/metrics/src/vespa/metrics/valuemetric.hpp b/metrics/src/vespa/metrics/valuemetric.hpp index 7948242daa48..91282ec83a78 100644 --- a/metrics/src/vespa/metrics/valuemetric.hpp +++ b/metrics/src/vespa/metrics/valuemetric.hpp @@ -3,6 +3,7 @@ #include "valuemetric.h" #include "memoryconsumption.h" +#include #include #include #include @@ -226,7 +227,7 @@ ValueMetric::getDoubleValue(string_view id) const if (id == "min") return static_cast(values._count > 0 ? values._min : 0); if (id == "max") return static_cast(values._count > 0 ? values._max : 0); throw vespalib::IllegalArgumentException( - "No value " + vespalib::string(id) + " in average metric.", VESPA_STRLOC); + "No value " + std::string(id) + " in average metric.", VESPA_STRLOC); } template diff --git a/metrics/src/vespa/metrics/valuemetricvalues.hpp b/metrics/src/vespa/metrics/valuemetricvalues.hpp index 9b053d17cde2..84d553595d61 100644 --- a/metrics/src/vespa/metrics/valuemetricvalues.hpp +++ b/metrics/src/vespa/metrics/valuemetricvalues.hpp @@ -54,7 +54,7 @@ T ValueMetricValues::getValue(string_view id) const { if (id == "total") return static_cast(_total); if (id == "min") return static_cast(_count > 0 ? _min : 0); if (id == "max") return static_cast( _count > 0 ? _max : 0); - throw IllegalArgumentException("No value " + vespalib::string(id) + " in value metric.", VESPA_STRLOC); + throw IllegalArgumentException("No value " + std::string(id) + " in value metric.", VESPA_STRLOC); } template diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp index 81a77a065f2c..69a261b096f9 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp @@ -936,7 +936,7 @@ TEST_F(ConformanceTest, testRemoveByGid) auto info = spi->getBucketInfo(bucket).getBucketInfo(); EXPECT_EQ(2, info.getDocumentCount()); std::vector ids; - ids.emplace_back(vespalib::string(doc1->getId().getDocType()), doc1->getId().getGlobalId(), Timestamp(10)); + ids.emplace_back(std::string(doc1->getId().getDocType()), doc1->getId().getGlobalId(), Timestamp(10)); assert_remove_by_gid(*spi, bucket, ids, 0, 2, "ignored removebygid"); ids.back().timestamp = Timestamp(11); assert_remove_by_gid(*spi, bucket, ids, 1, 1, "removebygid"); @@ -1266,7 +1266,7 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) std::vector docsToVisit; std::vector timestampsToVisit; - std::set removes; + std::set removes; for (uint32_t i = 0; i < 99; i++) { Timestamp timestamp(1000 + i); @@ -1308,7 +1308,7 @@ TEST_F(ConformanceTest, testIterateRemoves) int docCount = 10; std::vector docs(feedDocs(*spi, testDocMan, b, docCount)); - std::set removedDocs; + std::set removedDocs; std::vector nonRemovedDocs; for (int i = 0; i < docCount; ++i) { @@ -1393,7 +1393,7 @@ TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching) std::vector chunks = doIterate(*spi, iter.getIteratorId(), 4_Ki); std::vector docs; - std::set removes; + std::set removes; removes.insert(removedId.toString()); verifyDocs(docs, chunks, removes); @@ -2307,7 +2307,7 @@ void ConformanceTest::assert_remove_by_gid(PersistenceProvider& spi, const Bucket& bucket, std::vector ids, size_t exp_removed, size_t exp_remaining, - const vespalib::string& label) + const std::string& label) { SCOPED_TRACE(label); auto onDone = std::make_unique(); diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.h b/persistence/src/vespa/persistence/conformancetest/conformancetest.h index 555c4254ad9c..e5d803081f39 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.h +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.h @@ -157,7 +157,7 @@ class ConformanceTest : public ::testing::Test { std::vector ids, size_t exp_removed, size_t exp_remaining, - const vespalib::string& label); + const std::string& label); ConformanceTest(); ConformanceTest(const std::string &docType); diff --git a/persistence/src/vespa/persistence/spi/attribute_resource_usage.h b/persistence/src/vespa/persistence/spi/attribute_resource_usage.h index 557580fdbc98..4734059bcc1b 100644 --- a/persistence/src/vespa/persistence/spi/attribute_resource_usage.h +++ b/persistence/src/vespa/persistence/spi/attribute_resource_usage.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace storage::spi { @@ -13,10 +13,10 @@ namespace storage::spi { class AttributeResourceUsage { double _usage; - vespalib::string _name; // document_type.subdb.attribute.component + std::string _name; // document_type.subdb.attribute.component public: - AttributeResourceUsage(double usage, const vespalib::string& name) + AttributeResourceUsage(double usage, const std::string& name) : _usage(usage), _name(name) { @@ -28,7 +28,7 @@ class AttributeResourceUsage } double get_usage() const noexcept { return _usage; } - const vespalib::string& get_name() const noexcept { return _name; } + const std::string& get_name() const noexcept { return _name; } bool valid() const noexcept { return !_name.empty(); } bool operator==(const AttributeResourceUsage& rhs) const noexcept { diff --git a/persistence/src/vespa/persistence/spi/bucket.cpp b/persistence/src/vespa/persistence/spi/bucket.cpp index af9a25d94610..605ab7f1f4bd 100644 --- a/persistence/src/vespa/persistence/spi/bucket.cpp +++ b/persistence/src/vespa/persistence/spi/bucket.cpp @@ -6,7 +6,7 @@ namespace storage::spi { -vespalib::string +std::string Bucket::toString() const { vespalib::asciistream ost; ost << *this; diff --git a/persistence/src/vespa/persistence/spi/bucket.h b/persistence/src/vespa/persistence/spi/bucket.h index e0e9431ba9c8..161c600e419b 100644 --- a/persistence/src/vespa/persistence/spi/bucket.h +++ b/persistence/src/vespa/persistence/spi/bucket.h @@ -32,7 +32,7 @@ class Bucket { return (_bucket == o._bucket); } - vespalib::string toString() const; + std::string toString() const; }; vespalib::asciistream& operator<<(vespalib::asciistream& out, const Bucket& bucket); diff --git a/persistence/src/vespa/persistence/spi/bucketinfo.cpp b/persistence/src/vespa/persistence/spi/bucketinfo.cpp index c2f424107240..a7265fb6e47e 100644 --- a/persistence/src/vespa/persistence/spi/bucketinfo.cpp +++ b/persistence/src/vespa/persistence/spi/bucketinfo.cpp @@ -46,7 +46,7 @@ BucketInfo::operator==(const BucketInfo& o) const && _active == o._active); } -vespalib::string +std::string BucketInfo::toString() const { vespalib::asciistream out; out << "BucketInfo("; diff --git a/persistence/src/vespa/persistence/spi/bucketinfo.h b/persistence/src/vespa/persistence/spi/bucketinfo.h index 9d8e20fa4f3b..0e065f9f5262 100644 --- a/persistence/src/vespa/persistence/spi/bucketinfo.h +++ b/persistence/src/vespa/persistence/spi/bucketinfo.h @@ -37,7 +37,7 @@ class BucketInfo { bool operator==(const BucketInfo& o) const; - vespalib::string toString() const; + std::string toString() const; /** * Get the checksum of the bucket. An empty bucket should have checksum of diff --git a/persistence/src/vespa/persistence/spi/context.cpp b/persistence/src/vespa/persistence/spi/context.cpp index 56fd4b7f7356..aa646e4f6b68 100644 --- a/persistence/src/vespa/persistence/spi/context.cpp +++ b/persistence/src/vespa/persistence/spi/context.cpp @@ -14,7 +14,7 @@ Context::~Context() = default; void Context::trace(uint32_t level, std::string_view msg, bool addTime) { - _trace.trace(level, vespalib::string(msg), addTime); + _trace.trace(level, std::string(msg), addTime); } } diff --git a/persistence/src/vespa/persistence/spi/docentry.cpp b/persistence/src/vespa/persistence/spi/docentry.cpp index fe28827def63..8f1e2b1aec33 100644 --- a/persistence/src/vespa/persistence/spi/docentry.cpp +++ b/persistence/src/vespa/persistence/spi/docentry.cpp @@ -13,7 +13,7 @@ class DocEntryWithId final : public DocEntry { public: DocEntryWithId(Timestamp t, DocumentMetaEnum metaEnum, const DocumentId &docId); ~DocEntryWithId(); - vespalib::string toString() const override; + std::string toString() const override; const DocumentId* getDocumentId() const override { return & _documentId; } std::string_view getDocumentType() const override { return _documentId.getDocType(); } GlobalId getGid() const override { return _documentId.getGlobalId(); } @@ -25,11 +25,11 @@ class DocEntryWithTypeAndGid final : public DocEntry { public: DocEntryWithTypeAndGid(Timestamp t, DocumentMetaEnum metaEnum, std::string_view docType, GlobalId gid); ~DocEntryWithTypeAndGid(); - vespalib::string toString() const override; + std::string toString() const override; std::string_view getDocumentType() const override { return _type; } GlobalId getGid() const override { return _gid; } private: - vespalib::string _type; + std::string _type; GlobalId _gid; }; @@ -45,7 +45,7 @@ class DocEntryWithDoc final : public DocEntry { */ DocEntryWithDoc(Timestamp t, DocumentUP doc, size_t serializedDocumentSize); ~DocEntryWithDoc(); - vespalib::string toString() const override; + std::string toString() const override; const Document* getDocument() const override { return _document.get(); } const DocumentId* getDocumentId() const override { return &_document->getId(); } DocumentUP releaseDocument() override { return std::move(_document); } @@ -80,7 +80,7 @@ DocEntryWithTypeAndGid::~DocEntryWithTypeAndGid() = default; DocEntryWithId::~DocEntryWithId() = default; DocEntryWithDoc::~DocEntryWithDoc() = default; -vespalib::string +std::string DocEntryWithId::toString() const { std::ostringstream out; @@ -88,7 +88,7 @@ DocEntryWithId::toString() const return out.str(); } -vespalib::string +std::string DocEntryWithTypeAndGid::toString() const { std::ostringstream out; @@ -96,7 +96,7 @@ DocEntryWithTypeAndGid::toString() const return out.str(); } -vespalib::string +std::string DocEntryWithDoc::toString() const { std::ostringstream out; @@ -140,7 +140,7 @@ DocEntry::releaseDocument() { return {}; } -vespalib::string +std::string DocEntry::toString() const { std::ostringstream out; diff --git a/persistence/src/vespa/persistence/spi/docentry.h b/persistence/src/vespa/persistence/spi/docentry.h index ef7152ce4e32..c43b35eee0d0 100644 --- a/persistence/src/vespa/persistence/spi/docentry.h +++ b/persistence/src/vespa/persistence/spi/docentry.h @@ -45,7 +45,7 @@ class DocEntry { */ SizeType getSize() const { return _size; } - virtual vespalib::string toString() const; + virtual std::string toString() const; virtual const Document* getDocument() const { return nullptr; } virtual const DocumentId* getDocumentId() const { return nullptr; } virtual std::string_view getDocumentType() const { return std::string_view(); } diff --git a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.cpp b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.cpp index 145668200251..038e6be1bab4 100644 --- a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.cpp +++ b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.cpp @@ -11,7 +11,7 @@ DocTypeGidAndTimestamp::DocTypeGidAndTimestamp() { } -DocTypeGidAndTimestamp::DocTypeGidAndTimestamp(const vespalib::string& doc_type_, document::GlobalId gid_, Timestamp timestamp_) noexcept +DocTypeGidAndTimestamp::DocTypeGidAndTimestamp(const std::string& doc_type_, document::GlobalId gid_, Timestamp timestamp_) noexcept : doc_type(doc_type_), gid(std::move(gid_)), timestamp(timestamp_) @@ -26,7 +26,7 @@ void DocTypeGidAndTimestamp::print(vespalib::asciistream& os) const { os << doc_type << ":" << gid.toString() << " at time " << timestamp.getValue(); } -vespalib::string DocTypeGidAndTimestamp::to_string() const { +std::string DocTypeGidAndTimestamp::to_string() const { vespalib::asciistream os; print(os); return os.str(); diff --git a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h index 9ff4d0493fa9..14d057e32336 100644 --- a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h +++ b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h @@ -4,8 +4,8 @@ #include "types.h" #include #include -#include #include +#include namespace vespalib { class asciistream; } @@ -18,12 +18,12 @@ namespace storage::spi { * Prefer this instead of a std::tuple due to named fields and a pre-provided hash function. */ struct DocTypeGidAndTimestamp { - vespalib::string doc_type; + std::string doc_type; document::GlobalId gid; Timestamp timestamp; DocTypeGidAndTimestamp(); - DocTypeGidAndTimestamp(const vespalib::string& doc_type_, document::GlobalId gid_, Timestamp timestamp_) noexcept; + DocTypeGidAndTimestamp(const std::string& doc_type_, document::GlobalId gid_, Timestamp timestamp_) noexcept; DocTypeGidAndTimestamp(const DocTypeGidAndTimestamp&); DocTypeGidAndTimestamp& operator=(const DocTypeGidAndTimestamp&); @@ -36,12 +36,12 @@ struct DocTypeGidAndTimestamp { } void print(vespalib::asciistream&) const; - vespalib::string to_string() const; + std::string to_string() const; struct hash { size_t operator()(const DocTypeGidAndTimestamp& dt_gid_ts) const noexcept { size_t h = document::GlobalId::hash()(dt_gid_ts.gid); - h = h ^ (vespalib::hash()(dt_gid_ts.doc_type) + 0x9e3779b9U + (h << 6U) + (h >> 2U)); + h = h ^ (vespalib::hash()(dt_gid_ts.doc_type) + 0x9e3779b9U + (h << 6U) + (h >> 2U)); return h ^ (dt_gid_ts.timestamp + 0x9e3779b9U + (h << 6U) + (h >> 2U)); // Basically boost::hash_combine } }; diff --git a/persistence/src/vespa/persistence/spi/documentselection.h b/persistence/src/vespa/persistence/spi/documentselection.h index 00316f8305ab..bcd73c0df7fe 100644 --- a/persistence/src/vespa/persistence/spi/documentselection.h +++ b/persistence/src/vespa/persistence/spi/documentselection.h @@ -8,21 +8,21 @@ #pragma once -#include +#include namespace document { class Document; } namespace storage::spi { class DocumentSelection { - vespalib::string _documentSelection; + std::string _documentSelection; public: - explicit DocumentSelection(const vespalib::string& docSel) + explicit DocumentSelection(const std::string& docSel) : _documentSelection(docSel) {} bool match(const document::Document&) const { return true; } - const vespalib::string& getDocumentSelection() const { + const std::string& getDocumentSelection() const { return _documentSelection; } }; diff --git a/persistence/src/vespa/persistence/spi/i_resource_usage_listener.h b/persistence/src/vespa/persistence/spi/i_resource_usage_listener.h index 762da63fcf7f..86a9547c5553 100644 --- a/persistence/src/vespa/persistence/spi/i_resource_usage_listener.h +++ b/persistence/src/vespa/persistence/spi/i_resource_usage_listener.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace storage::spi { diff --git a/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp b/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp index 5d608c06a7af..9609d8b76064 100644 --- a/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp +++ b/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp @@ -20,7 +20,7 @@ void IdAndTimestamp::print(vespalib::asciistream& os) const { os << id.toString() << " at time " << timestamp.getValue(); } -vespalib::string IdAndTimestamp::to_string() const { +std::string IdAndTimestamp::to_string() const { vespalib::asciistream os; print(os); return os.str(); diff --git a/persistence/src/vespa/persistence/spi/id_and_timestamp.h b/persistence/src/vespa/persistence/spi/id_and_timestamp.h index c70dd744d36b..d9655aebf04d 100644 --- a/persistence/src/vespa/persistence/spi/id_and_timestamp.h +++ b/persistence/src/vespa/persistence/spi/id_and_timestamp.h @@ -3,8 +3,8 @@ #include "types.h" #include -#include #include +#include namespace vespalib { class asciistream; } @@ -32,7 +32,7 @@ struct IdAndTimestamp { } void print(vespalib::asciistream&) const; - vespalib::string to_string() const; + std::string to_string() const; struct hash { size_t operator()(const IdAndTimestamp& id_ts) const noexcept { diff --git a/persistence/src/vespa/persistence/spi/result.cpp b/persistence/src/vespa/persistence/spi/result.cpp index ec787a25ddf8..27574f27e8a3 100644 --- a/persistence/src/vespa/persistence/spi/result.cpp +++ b/persistence/src/vespa/persistence/spi/result.cpp @@ -14,7 +14,7 @@ Result & Result::operator = (const Result &) = default; Result& Result::operator=(Result&&) noexcept = default; Result::~Result() = default; -vespalib::string +std::string Result::toString() const { vespalib::asciistream os; os << "Result(" << static_cast(_errorCode) << ", " << _errorMessage << ")"; @@ -52,7 +52,7 @@ IterateResult::~IterateResult() = default; IterateResult::IterateResult(IterateResult &&) noexcept = default; IterateResult & IterateResult::operator=(IterateResult &&) noexcept = default; -IterateResult::IterateResult(ErrorType error, const vespalib::string& errorMessage) +IterateResult::IterateResult(ErrorType error, const std::string& errorMessage) : Result(error, errorMessage), _completed(false) { } diff --git a/persistence/src/vespa/persistence/spi/result.h b/persistence/src/vespa/persistence/spi/result.h index 75f9a8e7ef8c..f4e337ff3f96 100644 --- a/persistence/src/vespa/persistence/spi/result.h +++ b/persistence/src/vespa/persistence/spi/result.h @@ -31,7 +31,7 @@ class Result { /** * Constructor to use when an error has been detected. */ - Result(ErrorType error, const vespalib::string& errorMessage) noexcept + Result(ErrorType error, const std::string& errorMessage) noexcept : _errorCode(error), _errorMessage(errorMessage) {} @@ -56,15 +56,15 @@ class Result { return _errorCode; } - const vespalib::string& getErrorMessage() const { + const std::string& getErrorMessage() const { return _errorMessage; } - vespalib::string toString() const; + std::string toString() const; private: ErrorType _errorCode; - vespalib::string _errorMessage; + std::string _errorMessage; }; std::ostream & operator << (std::ostream & os, const Result & r); @@ -78,7 +78,7 @@ class BucketInfoResult final : public Result { * The service layer will not update the bucket information in this case, * so it should not be returned either. */ - BucketInfoResult(ErrorType error, const vespalib::string& errorMessage) + BucketInfoResult(ErrorType error, const std::string& errorMessage) : Result(error, errorMessage) {}; /** @@ -103,7 +103,7 @@ class UpdateResult final : public Result * The service layer will not update the bucket information in this case, * so it should not be returned either. */ - UpdateResult(ErrorType error, const vespalib::string& errorMessage) + UpdateResult(ErrorType error, const std::string& errorMessage) : Result(error, errorMessage), _existingTimestamp(0) { } @@ -134,7 +134,7 @@ class RemoveResult : public Result * The service layer will not update the bucket information in this case, * so it should not be returned either. */ - RemoveResult(ErrorType error, const vespalib::string& errorMessage) noexcept + RemoveResult(ErrorType error, const std::string& errorMessage) noexcept : Result(error, errorMessage), _numRemoved(0) { } @@ -157,7 +157,7 @@ class GetResult final : public Result { * Constructor to use when there was an error retrieving the document. * Not finding the document is not an error in this context. */ - GetResult(ErrorType error, const vespalib::string& errorMessage) + GetResult(ErrorType error, const std::string& errorMessage) : Result(error, errorMessage), _timestamp(0), _is_tombstone(false) @@ -234,7 +234,7 @@ class BucketIdListResult final : public Result { /** * Constructor used when there was an error listing the buckets. */ - BucketIdListResult(ErrorType error, const vespalib::string& errorMessage) + BucketIdListResult(ErrorType error, const std::string& errorMessage) : Result(error, errorMessage) {} /** @@ -267,7 +267,7 @@ class CreateIteratorResult : public Result { /** * Constructor used when there was an error creating the iterator. */ - CreateIteratorResult(ErrorType error, const vespalib::string& errorMessage) noexcept + CreateIteratorResult(ErrorType error, const std::string& errorMessage) noexcept : Result(error, errorMessage), _iterator(0) { } @@ -291,7 +291,7 @@ class IterateResult final : public Result { /** * Constructor used when there was an error creating the iterator. */ - IterateResult(ErrorType error, const vespalib::string& errorMessage); + IterateResult(ErrorType error, const std::string& errorMessage); /** * Constructor used when the iteration was successful. diff --git a/persistence/src/vespa/persistence/spi/types.h b/persistence/src/vespa/persistence/spi/types.h index b2f02e1b0c06..2d837299934b 100644 --- a/persistence/src/vespa/persistence/spi/types.h +++ b/persistence/src/vespa/persistence/spi/types.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace vespalib { class nbostream; @@ -88,7 +88,7 @@ using DocumentUpdate = document::DocumentUpdate; using DocumentId = document::DocumentId; using GlobalId = document::GlobalId; using TimestampList = std::vector; -using string = vespalib::string; +using string = std::string; using DocumentUP = std::unique_ptr; using DocumentIdUP = std::unique_ptr; using DocumentSP = std::shared_ptr; diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index c5a7cd9e32da..6e2f59e2503b 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -118,14 +118,14 @@ using storage::spi::PersistenceProvider; class ProtonServiceLayerProcess : public storage::ServiceLayerProcess { proton::Proton& _proton; FNET_Transport& _transport; - vespalib::string _file_distributor_connection_spec; + std::string _file_distributor_connection_spec; metrics::MetricManager* _metricManager; std::weak_ptr _search_visitor_factory; public: ProtonServiceLayerProcess(const config::ConfigUri & configUri, proton::Proton & proton, FNET_Transport& transport, - const vespalib::string& file_distributor_connection_spec, + const std::string& file_distributor_connection_spec, const vespalib::HwInfo& hw_info); ~ProtonServiceLayerProcess() override { shutdown(); } @@ -147,7 +147,7 @@ class ProtonServiceLayerProcess : public storage::ServiceLayerProcess { ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri & configUri, proton::Proton & proton, FNET_Transport& transport, - const vespalib::string& file_distributor_connection_spec, + const std::string& file_distributor_connection_spec, const vespalib::HwInfo& hw_info) : ServiceLayerProcess(configUri, hw_info), _proton(proton), @@ -281,13 +281,13 @@ App::startAndRun(FNET_Transport & transport, int argc, char **argv) { EV_STOPPING("proton", "shutdown after aborted init"); } else { const ProtonConfig &protonConfig = configSnapshot->getProtonConfig(); - vespalib::string basedir = protonConfig.basedir; + std::string basedir = protonConfig.basedir; std::filesystem::create_directories(std::filesystem::path(basedir)); { ExitOnSignal exit_on_signal; proton.init(configSnapshot); } - vespalib::string file_distributor_connection_spec = configSnapshot->getFiledistributorrpcConfig().connectionspec; + std::string file_distributor_connection_spec = configSnapshot->getFiledistributorrpcConfig().connectionspec; std::unique_ptr spiProton; if ( ! params.serviceidentity.empty()) { diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 80d5174946c2..ad4bf4480b7a 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -179,9 +179,9 @@ ConfigFactory::~ConfigFactory() = default; class DocumentDBFactory : public DummyDBOwner { private: - vespalib::string _baseDir; + std::string _baseDir; DummyFileHeaderContext _fileHeaderContext; - vespalib::string _tlsSpec; + std::string _tlsSpec; matching::QueryLimiter _queryLimiter; mutable DummyWireService _metricsWireService; mutable MemoryConfigStores _config_stores; @@ -196,7 +196,7 @@ class DocumentDBFactory : public DummyDBOwner { } public: - DocumentDBFactory(const vespalib::string &baseDir, int tlsListenPort); + DocumentDBFactory(const std::string &baseDir, int tlsListenPort); ~DocumentDBFactory() override; DocumentDB::SP create(BucketSpace bucketSpace, const DocTypeName &docType, @@ -204,7 +204,7 @@ class DocumentDBFactory : public DummyDBOwner { DocumentDBConfig::SP snapshot = factory.create(docType); std::filesystem::create_directory(std::filesystem::path(_baseDir)); std::filesystem::create_directory(std::filesystem::path(_baseDir + "/" + docType.toString())); - vespalib::string inputCfg = _baseDir + "/" + docType.toString() + "/baseconfig"; + std::string inputCfg = _baseDir + "/" + docType.toString() + "/baseconfig"; { FileConfigManager fileCfg(_shared_service.transport(), inputCfg, "", docType.getName()); fileCfg.saveConfig(*snapshot, 1); @@ -229,7 +229,7 @@ class DocumentDBFactory : public DummyDBOwner { }; -DocumentDBFactory::DocumentDBFactory(const vespalib::string &baseDir, int tlsListenPort) +DocumentDBFactory::DocumentDBFactory(const std::string &baseDir, int tlsListenPort) : _baseDir(baseDir), _fileHeaderContext(), _tlsSpec(vespalib::make_string("tcp/localhost:%d", tlsListenPort)), @@ -310,7 +310,7 @@ class MyPersistenceEngine : public DocDBRepoHolder, MyResourceWriteFilter &writeFilter, IDiskMemUsageNotifier& disk_mem_usage_notifier, DocumentDBRepo::UP docDbRepo, - const vespalib::string &docType = "") + const std::string &docType = "") : DocDBRepoHolder(std::move(docDbRepo)), PersistenceEngine(owner, writeFilter, disk_mem_usage_notifier, -1, false) { @@ -318,7 +318,7 @@ class MyPersistenceEngine : public DocDBRepoHolder, } void - addHandlers(const vespalib::string &docType) + addHandlers(const std::string &docType) { if (!_docDbRepo) return; @@ -355,18 +355,18 @@ class MyPersistenceEngine : public DocDBRepoHolder, class MyPersistenceFactory : public PersistenceFactory { private: - vespalib::string _baseDir; + std::string _baseDir; DocumentDBFactory _docDbFactory; SchemaConfigFactory::SP _schemaFactory; DocumentDBRepo::UP _docDbRepo; - vespalib::string _docType; + std::string _docType; MyPersistenceEngineOwner _engineOwner; MyResourceWriteFilter _writeFilter; test::DiskMemUsageNotifier _disk_mem_usage_notifier; public: - MyPersistenceFactory(const vespalib::string &baseDir, int tlsListenPort, + MyPersistenceFactory(const std::string &baseDir, int tlsListenPort, SchemaConfigFactory::SP schemaFactory, - const vespalib::string & docType = "") + const std::string & docType = "") : _baseDir(baseDir), _docDbFactory(baseDir, tlsListenPort), _schemaFactory(std::move(schemaFactory)), diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp index e78bcdc87576..a2bb3a463a28 100644 --- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp +++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp @@ -57,8 +57,8 @@ using vespalib::eval::Value; using vespalib::eval::ValueType; using vespalib::make_string_short::fmt; -std::optional -get_file(const vespalib::string &ref, const VerifyRanksetupConfig &myCfg) { +std::optional +get_file(const std::string &ref, const VerifyRanksetupConfig &myCfg) { for (const auto &entry: myCfg.file) { if (ref == entry.ref) { return entry.path; @@ -130,13 +130,13 @@ struct DummyRankingAssetsRepo : IRankingAssetsRepo { OnnxModels _onnxModels; DummyRankingAssetsRepo(const RankingConstantsConfig &cfg_in, RankingExpressions expressions, OnnxModels onnxModels); ~DummyRankingAssetsRepo() override; - [[nodiscard]] vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override; + [[nodiscard]] vespalib::eval::ConstantValue::UP getConstant(const std::string &name) const override; - [[nodiscard]] vespalib::string getExpression(const vespalib::string & name) const override { + [[nodiscard]] std::string getExpression(const std::string & name) const override { return _expressions.loadExpression(name); } - [[nodiscard]] const search::fef::OnnxModel *getOnnxModel(const vespalib::string & name) const override { + [[nodiscard]] const search::fef::OnnxModel *getOnnxModel(const std::string & name) const override { return _onnxModels.getModel(name); } }; @@ -150,7 +150,7 @@ DummyRankingAssetsRepo::DummyRankingAssetsRepo(const RankingConstantsConfig &cfg DummyRankingAssetsRepo::~DummyRankingAssetsRepo() = default; vespalib::eval::ConstantValue::UP -DummyRankingAssetsRepo::getConstant(const vespalib::string &name) const { +DummyRankingAssetsRepo::getConstant(const std::string &name) const { for (const auto &entry: cfg.constant) { if (entry.name == name) { try { @@ -260,7 +260,7 @@ VerifyRankSetup::verify(const std::string & configid) bool ok = false; try { auto ctx = std::make_shared(*config::legacyConfigId2Spec(configid)); - vespalib::string cfgId(config::legacyConfigId2ConfigId(configid)); + std::string cfgId(config::legacyConfigId2ConfigId(configid)); ConfigSubscriber subscriber(ctx); ConfigHandle::UP myHandle = subscriber.subscribe(cfgId); ConfigHandle::UP rankHandle = subscriber.subscribe(cfgId); diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup_app.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup_app.cpp index e179685b55b8..2696cced305e 100644 --- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup_app.cpp +++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup_app.cpp @@ -2,6 +2,7 @@ #include "verify_ranksetup.h" #include +#include #include LOG_SETUP("vespa-verify-ranksetup"); diff --git a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp index 745ea4034ab8..af4b3438954a 100644 --- a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp +++ b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp @@ -51,7 +51,7 @@ using search::index::DummyFileHeaderContext; namespace { -vespalib::string base_dir = "testdb"; +std::string base_dir = "testdb"; constexpr int base_port = 9017; std::shared_ptr make_document_types() { @@ -120,7 +120,7 @@ class Benchmark { std::unique_ptr _cluster; BmFeed _feed; - void benchmark_feed(BmFeeder& feeder, int64_t& time_bias, const std::vector& serialized_feed, uint32_t passes, const vespalib::string &op_name); + void benchmark_feed(BmFeeder& feeder, int64_t& time_bias, const std::vector& serialized_feed, uint32_t passes, const std::string &op_name); public: explicit Benchmark(const BMParams& params); ~Benchmark(); @@ -140,7 +140,7 @@ Benchmark::Benchmark(const BMParams& params) Benchmark::~Benchmark() = default; void -Benchmark::benchmark_feed(BmFeeder& feeder, int64_t& time_bias, const std::vector& serialized_feed, uint32_t passes, const vespalib::string &op_name) +Benchmark::benchmark_feed(BmFeeder& feeder, int64_t& time_bias, const std::vector& serialized_feed, uint32_t passes, const std::string &op_name) { if (passes == 0) { return; diff --git a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp index 1975120803d8..5c24226fbb65 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp +++ b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp @@ -1,7 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include @@ -11,18 +10,19 @@ #include #include #include +#include #include -#include #include -#include +#include +#include #include LOG_SETUP("vespa-gen-testdocs"); -using StringSet = vespalib::hash_set; -using StringArray = std::vector; +using StringSet = vespalib::hash_set; +using StringArray = std::vector; using namespace vespalib::alloc; -using vespalib::string; +using std::string; namespace { diff --git a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp index 6a11bbcc3f10..6c4679485312 100644 --- a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp +++ b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp @@ -55,7 +55,7 @@ using vespalib::makeLambdaTask; namespace { -vespalib::string base_dir = "testdb"; +std::string base_dir = "testdb"; constexpr int base_port = 9017; std::shared_ptr make_document_types() { @@ -75,7 +75,7 @@ enum class Mode { BAD }; -std::vector mode_names = { +std::vector mode_names = { "grow", "shrink", "perm-crash", @@ -83,9 +83,9 @@ std::vector mode_names = { "replace" }; -vespalib::string bad_mode_name("bad"); +std::string bad_mode_name("bad"); -Mode get_mode(const vespalib::string& mode_name) { +Mode get_mode(const std::string& mode_name) { for (uint32_t i = 0; i < mode_names.size(); ++i) { if (mode_name == mode_names[i]) { return static_cast(i); @@ -94,7 +94,7 @@ Mode get_mode(const vespalib::string& mode_name) { return Mode::BAD; } -vespalib::string& get_mode_name(Mode mode) { +std::string& get_mode_name(Mode mode) { uint32_t i = static_cast(mode); return (i < mode_names.size()) ? mode_names[i] : bad_mode_name; } @@ -106,13 +106,13 @@ enum ReFeedMode { BAD }; -std::vector refeed_mode_names = { +std::vector refeed_mode_names = { "none", "put", "update" }; -ReFeedMode get_refeed_mode(const vespalib::string& refeed_mode_name) { +ReFeedMode get_refeed_mode(const std::string& refeed_mode_name) { for (uint32_t i = 0; i < refeed_mode_names.size(); ++i) { if (refeed_mode_name == refeed_mode_names[i]) { return static_cast(i); @@ -195,18 +195,18 @@ class ReFeed { vespalib::ThreadStackExecutor _top_executor; vespalib::ThreadStackExecutor _executor; BmFeeder _feeder; - const vespalib::string _op_name; + const std::string _op_name; const BMParams& _params; int64_t& _time_bias; const std::vector& _feed; void run(); public: - ReFeed(const BMParams& params, std::shared_ptr repo, IBmFeedHandler& feed_handler, int64_t& time_bias, const std::vector& feed, const vespalib::string& op_name); + ReFeed(const BMParams& params, std::shared_ptr repo, IBmFeedHandler& feed_handler, int64_t& time_bias, const std::vector& feed, const std::string& op_name); ~ReFeed(); }; -ReFeed::ReFeed(const BMParams& params, std::shared_ptr repo, IBmFeedHandler& feed_handler, int64_t& time_bias, const std::vector& feed, const vespalib::string& op_name) +ReFeed::ReFeed(const BMParams& params, std::shared_ptr repo, IBmFeedHandler& feed_handler, int64_t& time_bias, const std::vector& feed, const std::string& op_name) : _top_executor(1), _executor(params.get_client_threads()), _feeder(repo, feed_handler, _executor), diff --git a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp index 388fe80443b9..8d0a169e94aa 100644 --- a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp +++ b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp @@ -36,7 +36,7 @@ using IReplayPacketHandlerUP = std::unique_ptr; struct DummyFileHeaderContext : public FileHeaderContext { using UP = std::unique_ptr; - void addTags(vespalib::GenericHeader &, const vespalib::string &) const override {} + void addTags(vespalib::GenericHeader &, const std::string &) const override {} }; @@ -46,12 +46,12 @@ class ConfigFile { using SP = std::shared_ptr; - vespalib::string _name; + std::string _name; std::vector _content; public: ConfigFile(); - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } vespalib::nbostream & deserialize(vespalib::nbostream &stream); void print() const; }; @@ -408,7 +408,7 @@ class ListDomainsUtility : public BaseUtility int run() override { std::cout << ListDomainsOptions::command() << ": " << _bopts.toString() << std::endl; - std::vector domains; + std::vector domains; _client.listDomains(domains); std::cout << "Listing status for " << domains.size() << " domain(s):" << std::endl; for (size_t i = 0; i < domains.size(); ++i) { diff --git a/searchcore/src/tests/index/disk_indexes/disk_indexes_test.cpp b/searchcore/src/tests/index/disk_indexes/disk_indexes_test.cpp index c45b5318d661..7b9e6ce77bd0 100644 --- a/searchcore/src/tests/index/disk_indexes/disk_indexes_test.cpp +++ b/searchcore/src/tests/index/disk_indexes/disk_indexes_test.cpp @@ -10,7 +10,7 @@ namespace { -vespalib::string base_dir("base"); +std::string base_dir("base"); constexpr uint32_t block_size = 4_Ki; @@ -26,7 +26,7 @@ class DiskIndexesTest : public ::testing::Test, DiskIndexesTest(); ~DiskIndexesTest(); - static IndexDiskDir get_index_disk_dir(const vespalib::string& dir) { + static IndexDiskDir get_index_disk_dir(const std::string& dir) { return IndexDiskLayout::get_index_disk_dir(dir); } diff --git a/searchcore/src/tests/index/index_disk_layout/index_disk_layout_test.cpp b/searchcore/src/tests/index/index_disk_layout/index_disk_layout_test.cpp index c50df3cc32ca..abbb72c7dd07 100644 --- a/searchcore/src/tests/index/index_disk_layout/index_disk_layout_test.cpp +++ b/searchcore/src/tests/index/index_disk_layout/index_disk_layout_test.cpp @@ -8,14 +8,14 @@ namespace searchcorespi::index { namespace { -void expect_index_disk_dir(IndexDiskDir exp, const vespalib::string& dir) +void expect_index_disk_dir(IndexDiskDir exp, const std::string& dir) { auto act = IndexDiskLayout::get_index_disk_dir(dir); ASSERT_TRUE(act.valid()); ASSERT_EQ(exp, act); } -void expect_bad_index_disk_dir(const vespalib::string& dir) +void expect_bad_index_disk_dir(const std::string& dir) { auto act = IndexDiskLayout::get_index_disk_dir(dir); ASSERT_FALSE(act.valid()); diff --git a/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp index 5cfdd14bbd7a..fe0ea0449010 100644 --- a/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_aspect_delayer/attribute_aspect_delayer_test.cpp @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include #include LOG_SETUP("attibute_aspect_delayer_test"); @@ -37,7 +37,7 @@ namespace proton { namespace { -AttributesConfig::Attribute make_sv_cfg(const vespalib::string &name, AttributesConfig::Attribute::Datatype dataType) +AttributesConfig::Attribute make_sv_cfg(const std::string &name, AttributesConfig::Attribute::Datatype dataType) { AttributesConfig::Attribute attr; attr.name = name; @@ -51,7 +51,7 @@ AttributesConfig::Attribute make_sv_cfg(AttributesConfig::Attribute::Datatype da return make_sv_cfg("a", dataType); } -AttributesConfig::Attribute make_int32_sv_cfg(const vespalib::string &name) { +AttributesConfig::Attribute make_int32_sv_cfg(const std::string &name) { return make_sv_cfg(name, AttributesConfig::Attribute::Datatype::INT32); } @@ -70,7 +70,7 @@ AttributesConfig::Attribute make_predicate_cfg(uint32_t arity) return attr; } -AttributesConfig::Attribute make_tensor_cfg(const vespalib::string &spec) +AttributesConfig::Attribute make_tensor_cfg(const std::string &spec) { auto attr = make_sv_cfg(AttributesConfig::Attribute::Datatype::TENSOR); attr.tensortype = spec; @@ -96,14 +96,14 @@ AttributesConfig::Attribute make_fa(const AttributesConfig::Attribute &cfg) return attr; } -SummaryConfig::Classes::Fields make_summary_field(const vespalib::string &name) +SummaryConfig::Classes::Fields make_summary_field(const std::string &name) { SummaryConfig::Classes::Fields field; field.name = name; return field; } -SummaryConfig::Classes::Fields make_summary_field(const vespalib::string &name, const vespalib::string& command, const vespalib::string& source) +SummaryConfig::Classes::Fields make_summary_field(const std::string &name, const std::string& command, const std::string& source) { SummaryConfig::Classes::Fields field; field.name = name; @@ -124,9 +124,9 @@ SummaryConfig sCfg(std::vector fields) class MyInspector : public IDocumentTypeInspector { - std::set _unchanged; + std::set _unchanged; public: - virtual bool hasUnchangedField(const vespalib::string &name) const override { + virtual bool hasUnchangedField(const std::string &name) const override { return _unchanged.count(name) > 0; } MyInspector() @@ -134,7 +134,7 @@ class MyInspector : public IDocumentTypeInspector { } ~MyInspector() { } - void addFields(const std::vector &fields) { + void addFields(const std::vector &fields) { for (const auto &field : fields) { _unchanged.insert(field); } @@ -156,10 +156,10 @@ class DelayerTest : public ::testing::Test { { } ~DelayerTest() { } - void addFields(const std::vector &fields) { + void addFields(const std::vector &fields) { _inspector.addFields(fields); } - void addOldIndexField(const vespalib::string &name) { + void addOldIndexField(const std::string &name) { IndexschemaConfig::Indexfield field; field.name = name; _oldIndexSchema.indexfield.emplace_back(field); diff --git a/searchcore/src/tests/proton/attribute/attribute_directory/attribute_directory_test.cpp b/searchcore/src/tests/proton/attribute/attribute_directory/attribute_directory_test.cpp index 383632d3f0cf..317abde9602b 100644 --- a/searchcore/src/tests/proton/attribute/attribute_directory/attribute_directory_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_directory/attribute_directory_test.cpp @@ -5,10 +5,10 @@ #include #include #include -#include #include #include #include +#include #include LOG_SETUP("attribute_directory_test"); @@ -21,7 +21,7 @@ namespace proton { namespace { -vespalib::string toString(IndexMetaInfo &info) { +std::string toString(IndexMetaInfo &info) { vespalib::asciistream os; bool first = true; for (auto &snap : info.snapshots()) { @@ -47,7 +47,7 @@ bool hasWriter(const std::unique_ptr &writer) { return static_cast(writer); } -void create_directory(const vespalib::string& path) { +void create_directory(const std::string& path) { std::filesystem::create_directory(std::filesystem::path(path)); } @@ -66,70 +66,70 @@ class Fixture : public DirectoryHandler { ~Fixture() { } - vespalib::string getDir() { return _diskLayout->getBaseDir(); } + std::string getDir() { return _diskLayout->getBaseDir(); } - vespalib::string getAttrDir(const vespalib::string &name) { return getDir() + "/" + name; } + std::string getAttrDir(const std::string &name) { return getDir() + "/" + name; } - void assertDiskDir(const vespalib::string &name) { + void assertDiskDir(const std::string &name) { EXPECT_TRUE(std::filesystem::is_directory(std::filesystem::path(name))); } - void assertAttributeDiskDir(const vespalib::string &name) { + void assertAttributeDiskDir(const std::string &name) { assertDiskDir(getAttrDir(name)); } - void assertNotDiskDir(const vespalib::string &name) { + void assertNotDiskDir(const std::string &name) { EXPECT_FALSE(std::filesystem::exists(std::filesystem::path(name))); } - void assertNotAttributeDiskDir(const vespalib::string &name) { + void assertNotAttributeDiskDir(const std::string &name) { assertNotDiskDir(getAttrDir(name)); } - vespalib::string getSnapshotDirComponent(SerialNum serialNum) { + std::string getSnapshotDirComponent(SerialNum serialNum) { vespalib::asciistream os; os << "snapshot-"; os << serialNum; return os.str(); } - vespalib::string getSnapshotDir(const vespalib::string &name, SerialNum serialNum) { + std::string getSnapshotDir(const std::string &name, SerialNum serialNum) { return getAttrDir(name) + "/" + getSnapshotDirComponent(serialNum); } - void assertSnapshotDir(const vespalib::string &name, SerialNum serialNum) { + void assertSnapshotDir(const std::string &name, SerialNum serialNum) { assertDiskDir(getSnapshotDir(name, serialNum)); } - void assertNotSnapshotDir(const vespalib::string &name, SerialNum serialNum) { + void assertNotSnapshotDir(const std::string &name, SerialNum serialNum) { assertNotDiskDir(getSnapshotDir(name, serialNum)); } - void assertSnapshots(const vespalib::string &name, const vespalib::string &exp) { - vespalib::string attrDir(getAttrDir(name)); + void assertSnapshots(const std::string &name, const std::string &exp) { + std::string attrDir(getAttrDir(name)); IndexMetaInfo info(attrDir); info.load(); - vespalib::string act = toString(info); + std::string act = toString(info); EXPECT_EQ(exp, act); } - auto createAttributeDir(const vespalib::string &name) { return _diskLayout->createAttributeDir(name); } - auto getAttributeDir(const vespalib::string &name) { return _diskLayout->getAttributeDir(name); } - void removeAttributeDir(const vespalib::string &name, SerialNum serialNum) { return _diskLayout->removeAttributeDir(name, serialNum); } + auto createAttributeDir(const std::string &name) { return _diskLayout->createAttributeDir(name); } + auto getAttributeDir(const std::string &name) { return _diskLayout->getAttributeDir(name); } + void removeAttributeDir(const std::string &name, SerialNum serialNum) { return _diskLayout->removeAttributeDir(name, serialNum); } auto createFooAttrDir() { return createAttributeDir("foo"); } auto getFooAttrDir() { return getAttributeDir("foo"); } void removeFooAttrDir(SerialNum serialNum) { removeAttributeDir("foo", serialNum); } - void assertNotGetAttributeDir(const vespalib::string &name) { + void assertNotGetAttributeDir(const std::string &name) { auto dir = getAttributeDir(name); EXPECT_FALSE(static_cast(dir)); assertNotAttributeDiskDir(name); } - void assertGetAttributeDir(const vespalib::string &name, std::shared_ptr expDir) { + void assertGetAttributeDir(const std::string &name, std::shared_ptr expDir) { auto dir = getAttributeDir(name); EXPECT_TRUE(static_cast(dir)); EXPECT_EQ(expDir, dir); } - void assertCreateAttributeDir(const vespalib::string &name, std::shared_ptr expDir) { + void assertCreateAttributeDir(const std::string &name, std::shared_ptr expDir) { auto dir = getAttributeDir(name); EXPECT_TRUE(static_cast(dir)); EXPECT_EQ(expDir, dir); diff --git a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp index af37aca47029..854fa8187785 100644 --- a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp @@ -26,7 +26,7 @@ using search::SerialNum; using search::test::DirectoryHandler; using vespalib::Stash; -const vespalib::string test_dir = "test_output"; +const std::string test_dir = "test_output"; namespace proton { @@ -50,7 +50,7 @@ Config getPredicateWithArity(uint32_t arity) return ret; } -Config getTensor(const vespalib::string &spec) +Config getTensor(const std::string &spec) { Config ret(BasicType::Type::TENSOR); ret.setTensorType(vespalib::eval::ValueType::from_spec(spec)); @@ -65,7 +65,7 @@ Config get_int32_wset_fs() } void -saveAttr(const vespalib::string &name, const Config &cfg, SerialNum serialNum, SerialNum createSerialNum, bool mutate_reserved_doc = false) +saveAttr(const std::string &name, const Config &cfg, SerialNum serialNum, SerialNum createSerialNum, bool mutate_reserved_doc = false) { auto diskLayout = AttributeDiskLayout::create(test_dir); auto dir = diskLayout->createAttributeDir(name); diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 5e270bdae992..fa8f96516793 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -86,7 +86,7 @@ const uint64_t createSerialNum = 42u; class MyAttributeFunctor : public search::attribute::IConstAttributeFunctor { - std::vector _names; + std::vector _names; public: void @@ -97,7 +97,7 @@ class MyAttributeFunctor : public search::attribute::IConstAttributeFunctor std::string getSortedNames() { std::ostringstream os; std::sort(_names.begin(), _names.end()); - for (const vespalib::string &name : _names) { + for (const std::string &name : _names) { if (!os.str().empty()) os << ","; os << name; @@ -133,14 +133,14 @@ search::SerialNum getCreateSerialNum(const AttributeGuard::UP &guard) } } -void assertCreateSerialNum(const AttributeManager &am, const vespalib::string &name, search::SerialNum expCreateSerialNum) { +void assertCreateSerialNum(const AttributeManager &am, const std::string &name, search::SerialNum expCreateSerialNum) { EXPECT_EQUAL(expCreateSerialNum, getCreateSerialNum(am.getAttribute(name))); } struct ImportedAttributesRepoBuilder { ImportedAttributesRepo::UP _repo; ImportedAttributesRepoBuilder() : _repo(std::make_unique()) {} - void add(const vespalib::string &name) { + void add(const std::string &name) { auto refAttr = std::make_shared(name + "_ref"); refAttr->setGidToLidMapperFactory(std::make_shared()); auto targetAttr = search::AttributeFactory::createAttribute(name + "_target", INT32_SINGLE); @@ -187,10 +187,10 @@ struct AttributeManagerFixture ImportedAttributesRepoBuilder _builder; explicit AttributeManagerFixture(BaseFixture &bf); ~AttributeManagerFixture(); - AttributeVector::SP addAttribute(const vespalib::string &name) { + AttributeVector::SP addAttribute(const std::string &name) { return _m.addAttribute({name, INT32_SINGLE}, createSerialNum); } - void addImportedAttribute(const vespalib::string &name) { + void addImportedAttribute(const std::string &name) { _builder.add(name); } void setImportedAttributes() { @@ -710,7 +710,7 @@ TEST_F("require that attributes can be initialized and loaded in sequence", Base } AttributesConfigBuilder::Attribute -createAttributeConfig(const vespalib::string &name) +createAttributeConfig(const std::string &name) { AttributesConfigBuilder::Attribute result; result.name = name; @@ -833,7 +833,7 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture) TEST_DO(assertCreateSerialNum(am2.mgr, "a6", 20)); } -void assertShrinkTargetSerial(proton::AttributeManager &mgr, const vespalib::string &name, search::SerialNum expSerialNum) +void assertShrinkTargetSerial(proton::AttributeManager &mgr, const std::string &name, search::SerialNum expSerialNum) { auto shrinker = mgr.getShrinker(name); EXPECT_EQUAL(expSerialNum, shrinker->getFlushedSerialNum()); diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp index 0d0117973950..c41426a237ca 100644 --- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp @@ -36,7 +36,7 @@ using search::test::DirectoryHandler; using AVBasicType = search::attribute::BasicType; using AVConfig = search::attribute::Config; -const vespalib::string TEST_DIR = "testdir"; +const std::string TEST_DIR = "testdir"; const uint64_t CREATE_SERIAL_NUM = 8u; std::unique_ptr @@ -58,7 +58,7 @@ struct DocContext { } std::shared_ptr create(uint32_t id, int64_t fieldValue) { - vespalib::string docId = + std::string docId = vespalib::make_string("id:searchdocument:searchdocument::%u", id); auto doc = std::make_shared(*_repo, *_repo->getDocumentType("searchdocument"), DocumentId(docId)); doc->setValue("a1", IntFieldValue(fieldValue)); diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index de033897e642..cc1d3786dc70 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -169,7 +169,7 @@ class AttributeWriterTest : public ::testing::Test { void allocAttributeWriter() { _aw = std::make_unique(_mgr); } - AttributeVector::SP addAttribute(const vespalib::string &name) { + AttributeVector::SP addAttribute(const std::string &name) { return addAttribute({name, AVConfig(AVBasicType::INT32)}); } AttributeVector::SP addAttribute(const AttributeSpec &spec) { @@ -536,7 +536,7 @@ class AttributeCollectionSpecTest : public ::testing::Test { addAttribute("a1", false); addAttribute("a2", true); } - void addAttribute(const vespalib::string &name, bool fastAccess) { + void addAttribute(const std::string &name, bool fastAccess) { AttributesConfigBuilder::Attribute attr; attr.name = name; attr.fastaccess = fastAccess; @@ -645,7 +645,7 @@ Value::UP make_tensor(const TensorSpec &spec) { return SimpleValue::from_spec(spec); } -const vespalib::string sparse_tensor = "tensor(x{},y{})"; +const std::string sparse_tensor = "tensor(x{},y{})"; AttributeVector::SP createTensorAttribute(AttributeWriterTest &t) { @@ -736,9 +736,9 @@ putAttributes(AttributeWriterTest &t, std::vector expExecuteHistory) // Since executor distribution depends on the unspecified hash function in vespalib, // decouple attribute names from their usage to allow for picking names that hash // more evenly for a particular implementation. - vespalib::string a1_name = "a1"; - vespalib::string a2_name = "a2x"; - vespalib::string a3_name = "a3y"; + std::string a1_name = "a1"; + std::string a2_name = "a2x"; + std::string a3_name = "a3y"; DocBuilder db([&](auto& header) { header.addField(a1_name, DataType::T_INT) @@ -823,7 +823,7 @@ class MockDenseTensorAttribute : public DenseTensorAttribute { } }; -const vespalib::string dense_tensor = "tensor(x[2])"; +const std::string dense_tensor = "tensor(x[2])"; AVConfig get_tensor_config(bool multi_threaded_indexing) @@ -835,7 +835,7 @@ get_tensor_config(bool multi_threaded_indexing) } std::shared_ptr -make_mock_tensor_attribute(const vespalib::string& name, bool multi_threaded_indexing) +make_mock_tensor_attribute(const std::string& name, bool multi_threaded_indexing) { auto cfg = get_tensor_config(multi_threaded_indexing); return std::make_shared(name, cfg); @@ -866,7 +866,7 @@ TEST_F(AttributeWriterTest, tensor_attributes_using_two_phase_put_are_in_separat class TwoPhasePutTest : public AttributeWriterTest { public: DocBuilder builder; - vespalib::string doc_id; + std::string doc_id; std::shared_ptr attr; std::unique_ptr tensor; @@ -983,7 +983,7 @@ TEST_F(TwoPhasePutTest, handles_assign_update_as_two_phase_put_when_specified_fo ImportedAttributeVector::SP -createImportedAttribute(const vespalib::string &name) +createImportedAttribute(const std::string &name) { auto result = ImportedAttributeVectorFactory::create(name, {}, {}, {}, {}, true); result->getSearchCache()->insert("foo", {}); diff --git a/searchcore/src/tests/proton/attribute/attribute_transient_memory_calculator/attribute_transient_memory_calculator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_transient_memory_calculator/attribute_transient_memory_calculator_test.cpp index a9334e001282..6ace51a387cd 100644 --- a/searchcore/src/tests/proton/attribute/attribute_transient_memory_calculator/attribute_transient_memory_calculator_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_transient_memory_calculator/attribute_transient_memory_calculator_test.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include using vespa::config::search::AttributesConfig; using vespa::config::search::AttributesConfigBuilder; @@ -18,7 +18,7 @@ namespace proton { namespace { -AttributesConfig::Attribute build_single_config(const vespalib::string& name, bool fast_search) +AttributesConfig::Attribute build_single_config(const std::string& name, bool fast_search) { AttributesConfigBuilder::Attribute builder; builder.name = name; @@ -36,7 +36,7 @@ AttributesConfig build_config(bool fast_search) return builder; } -std::shared_ptr build_attribute_vector(const vespalib::string& name, const AttributeConfigInspector& attribute_config_inspector, uint32_t docs) +std::shared_ptr build_attribute_vector(const std::string& name, const AttributeConfigInspector& attribute_config_inspector, uint32_t docs) { auto attribute_vector = search::AttributeFactory::createAttribute(name, *attribute_config_inspector.get_config(name)); attribute_vector->addReservedDoc(); diff --git a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp index cdb0bcdb66a1..ae7b62b6836d 100644 --- a/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_usage_filter/attribute_usage_filter_test.cpp @@ -66,7 +66,7 @@ struct Fixture filter.set_listener(std::move(my_listener)); } - void testWrite(const vespalib::string &exp) { + void testWrite(const std::string &exp) { if (exp.empty()) { EXPECT_TRUE(filter.acceptWriteOperation()); State state = filter.getAcceptState(); diff --git a/searchcore/src/tests/proton/attribute/attribute_usage_stats/attribute_usage_stats_test.cpp b/searchcore/src/tests/proton/attribute/attribute_usage_stats/attribute_usage_stats_test.cpp index a8555193b850..c6e75cc9c547 100644 --- a/searchcore/src/tests/proton/attribute/attribute_usage_stats/attribute_usage_stats_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_usage_stats/attribute_usage_stats_test.cpp @@ -8,8 +8,8 @@ using search::AddressSpaceUsage; using vespalib::AddressSpace; void -expect_max_usage(size_t used, const vespalib::string& attr_name, - const vespalib::string& comp_name, const vespalib::string& sub_name, +expect_max_usage(size_t used, const std::string& attr_name, + const std::string& comp_name, const std::string& sub_name, const AttributeUsageStats& stats) { const auto& max = stats.max_address_space_usage(); diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 6969032535c4..c8ebda37ee34 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -209,7 +209,7 @@ AVConfig getInt32ArrayConfig() return AVConfig(AVBasicType::INT32, AVCollectionType::ARRAY); } -const string test_dir = "flush"; +const std::string test_dir = "flush"; struct BaseFixture { @@ -245,15 +245,15 @@ struct AttributeManagerFixture AttributeManager &_m; AttributeManagerFixture(BaseFixture &bf); ~AttributeManagerFixture(); - AttributeVector::SP addAttribute(const vespalib::string &name) { + AttributeVector::SP addAttribute(const std::string &name) { return _m.addAttribute({name, getInt32Config()}, createSerialNum); } - AttributeVector::SP addPostingAttribute(const vespalib::string &name) { + AttributeVector::SP addPostingAttribute(const std::string &name) { AVConfig cfg(getInt32Config()); cfg.setFastSearch(true); return _m.addAttribute({name, cfg}, createSerialNum); } - AttributeVector::SP addIntArrayPostingAttribute(const vespalib::string &name) { + AttributeVector::SP addIntArrayPostingAttribute(const std::string &name) { AVConfig cfg(getInt32ArrayConfig()); cfg.setFastSearch(true); return _m.addAttribute({name, cfg}, createSerialNum); @@ -544,12 +544,12 @@ TEST(AttributeFlushTest, require_that_shrink_works) } void -require_that_flushed_attribute_can_be_loaded(const HwInfo &hwInfo, const vespalib::string& label) +require_that_flushed_attribute_can_be_loaded(const HwInfo &hwInfo, const std::string& label) { SCOPED_TRACE(label); constexpr uint32_t numDocs = 100; BaseFixture f(hwInfo); - vespalib::string attrName(hwInfo.disk().slow() ? "a11slow" : "a11fast"); + std::string attrName(hwInfo.disk().slow() ? "a11slow" : "a11fast"); { AttributeManagerFixture amf(f); AttributeManager &am = amf._m; diff --git a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp index 732a95e7c132..1a40a53eae7f 100644 --- a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp @@ -44,11 +44,11 @@ using search::index::DummyFileHeaderContext; using search::test::DirectoryHandler; using vespalib::HwInfo; -const vespalib::string TEST_DIR = "test_output"; +const std::string TEST_DIR = "test_output"; -const vespalib::string ref_name("ref"); -const vespalib::string target_name("f3"); -const vespalib::string imported_name("my_f3"); +const std::string ref_name("ref"); +const std::string target_name("f3"); +const std::string imported_name("my_f3"); namespace { VESPA_THREAD_STACK_TAG(test_executor) @@ -68,20 +68,20 @@ struct AttributesStateExplorerTest : public ::testing::Test AttributeManagerExplorer _explorer; AttributesStateExplorerTest() noexcept; ~AttributesStateExplorerTest() override; - void addAttribute(const vespalib::string &name) { + void addAttribute(const std::string &name) { _mgr->addAttribute({name, AttributeUtils::getInt32Config()}, 1); } - void add_fast_search_attribute(const vespalib::string &name, + void add_fast_search_attribute(const std::string &name, DictionaryConfig::Type dictionary_type) { search::attribute::Config cfg = AttributeUtils::getInt32Config(); cfg.setFastSearch(true); cfg.set_dictionary_config(search::DictionaryConfig(dictionary_type)); _mgr->addAttribute({name, cfg}, 1); } - void addExtraAttribute(const vespalib::string &name) { + void addExtraAttribute(const std::string &name) { _mgr->addExtraAttribute(createInt32Attribute(name)); } - Slime explore_attribute(const vespalib::string &name) { + Slime explore_attribute(const std::string &name) { Slime result; vespalib::slime::SlimeInserter inserter(result); _explorer.get_child(name)->get_state(inserter, true); @@ -145,7 +145,7 @@ AttributesStateExplorerTest::AttributesStateExplorerTest() noexcept AttributesStateExplorerTest::~AttributesStateExplorerTest() = default; -using StringVector = std::vector; +using StringVector = std::vector; TEST_F(AttributesStateExplorerTest, require_that_attributes_are_exposed_as_children_names) { @@ -185,7 +185,7 @@ TEST_F(AttributesStateExplorerTest, require_that_dictionary_memory_usage_is_repo TEST_F(AttributesStateExplorerTest, require_that_imported_attribute_shows_memory_usage) { - vespalib::string cache_memory_usage("cacheMemoryUsage"); + std::string cache_memory_usage("cacheMemoryUsage"); auto slime = explore_attribute(imported_name); EXPECT_LT(0, slime[cache_memory_usage]["allocated"].asLong()); EXPECT_LT(0, slime[cache_memory_usage]["used"].asLong()); diff --git a/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp b/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp index f93853d2d1d7..750f5c9aaa36 100644 --- a/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp +++ b/searchcore/src/tests/proton/attribute/document_field_extractor/document_field_extractor_test.cpp @@ -44,7 +44,7 @@ const ArrayDataType arrayTypeString(*DataType::STRING); const WeightedSetDataType weightedSetTypeInt(*DataType::INT, false, false); const WeightedSetDataType weightedSetTypeString(*DataType::STRING, false, false); const int32_t noInt(search::attribute::getUndefined()); -const vespalib::string noString(""); +const std::string noString(""); std::unique_ptr makeIntArray(const std::vector &array) @@ -57,7 +57,7 @@ makeIntArray(const std::vector &array) } std::unique_ptr -makeStringArray(const std::vector &array) +makeStringArray(const std::vector &array) { auto result = std::make_unique(arrayTypeString); for (const auto &elem : array) { @@ -77,7 +77,7 @@ makeIntWeightedSet(const std::vector> &array) } std::unique_ptr -makeStringWeightedSet(const std::vector> &array) +makeStringWeightedSet(const std::vector> &array) { auto result = std::make_unique(weightedSetTypeString); for (const auto &elem : array) { @@ -116,7 +116,7 @@ struct FixtureBase } FieldPath - makeFieldPath(const vespalib::string &path) + makeFieldPath(const std::string &path) { FieldPath fieldPath; try { @@ -131,7 +131,7 @@ struct FixtureBase } void - assertExtracted(const vespalib::string &path, + assertExtracted(const std::string &path, std::unique_ptr expected) { FieldPath fieldPath(makeFieldPath(path)); std::unique_ptr fv = extractor->getFieldValue(fieldPath); @@ -248,7 +248,7 @@ struct StructFixtureBase : public FixtureBase } std::unique_ptr - makeStruct(int weight, const vespalib::string &value) + makeStruct(int weight, const std::string &value) { auto ret = makeStruct(); ret->setValue(weightField, IntFieldValue(weight)); @@ -265,7 +265,7 @@ struct StructFixtureBase : public FixtureBase } std::unique_ptr - makeStruct(const vespalib::string &value) + makeStruct(const std::string &value) { auto ret = makeStruct(); ret->setValue(nameField, StringFieldValue(value)); @@ -339,7 +339,7 @@ struct PrimitiveMapFixture : public FixtureBase { MapDataType mapFieldType; Field mapField; - using MapVector = std::vector>; + using MapVector = std::vector>; PrimitiveMapFixture() : FixtureBase(false), diff --git a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp index 6d522f254b08..1f667f89a873 100644 --- a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp @@ -29,7 +29,7 @@ struct DocContext { } Document::UP create(uint32_t id) { - vespalib::string docId = + std::string docId = vespalib::make_string("id:searchdocument:searchdocument::%u", id); return _builder.make_document(docId); } diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp index 6d2f375e4100..14458cf153d5 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp @@ -29,7 +29,7 @@ using search::attribute::test::MockGidToLidMapperFactory; using generation_t = AttributeVector::generation_t; std::shared_ptr -createReferenceAttribute(const vespalib::string &name) +createReferenceAttribute(const std::string &name) { auto refAttr = std::make_shared(name); refAttr->setGidToLidMapperFactory(std::make_shared()); @@ -37,7 +37,7 @@ createReferenceAttribute(const vespalib::string &name) } AttributeVector::SP -createTargetAttribute(const vespalib::string &name) +createTargetAttribute(const std::string &name) { return search::AttributeFactory::createAttribute(name, Config(BasicType::STRING)); } @@ -79,7 +79,7 @@ struct Fixture { ctx(std::make_unique(repo)) { } - Fixture &addAttribute(const vespalib::string &name) { + Fixture &addAttribute(const std::string &name) { auto attr = ImportedAttributeVectorFactory::create(name, createReferenceAttribute(name + "_ref"), std::shared_ptr(), @@ -89,7 +89,7 @@ struct Fixture { repo.add(name, attr); return *this; } - AttributeVector::SP getTargetAttribute(const vespalib::string &importedName) const { + AttributeVector::SP getTargetAttribute(const std::string &importedName) const { auto readable_target_attr = repo.get(importedName)->getTargetAttribute(); auto target_attr = std::dynamic_pointer_cast(readable_target_attr); ASSERT_TRUE(target_attr); diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp index 0447db9c89e8..173c7e1f192c 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_repo/imported_attributes_repo_test.cpp @@ -20,7 +20,7 @@ using search::attribute::ImportedAttributeVectorFactory; using search::attribute::ReferenceAttribute; ImportedAttributeVector::SP -createAttr(const vespalib::string &name) +createAttr(const std::string &name) { return ImportedAttributeVectorFactory::create(name, ReferenceAttribute::SP(), @@ -36,7 +36,7 @@ struct Fixture { void add(ImportedAttributeVector::SP attr) { repo.add(attr->getName(), attr); } - ImportedAttributeVector::SP get(const vespalib::string &name) const { + ImportedAttributeVector::SP get(const std::string &name) const { return repo.get(name); } }; diff --git a/searchcore/src/tests/proton/common/attribute_updater_test.cpp b/searchcore/src/tests/proton/common/attribute_updater_test.cpp index 97b4207ad032..88ab857f3c0a 100644 --- a/searchcore/src/tests/proton/common/attribute_updater_test.cpp +++ b/searchcore/src/tests/proton/common/attribute_updater_test.cpp @@ -173,8 +173,8 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:testdoc::1"); -vespalib::string doc2("id:test:testdoc::2"); +std::string doc1("id:test:testdoc::1"); +std::string doc2("id:test:testdoc::2"); ReferenceAttribute &asReferenceAttribute(AttributeVector &vec) { @@ -248,7 +248,7 @@ TEST_F("require that single attributes are updated", Fixture) TEST_DO(assertNoRef(*vec, 3)); } { - vespalib::string first_backing("first"); + std::string first_backing("first"); std::span first(first_backing.data(), first_backing.size()); auto vec = AttributeBuilder("in1/raw", Config(BasicType::RAW)).fill({first, first, first, first}).get(); f.applyValueUpdate(*vec, 1, std::make_unique(std::make_unique("second"))); @@ -371,7 +371,7 @@ TEST_F("require that weighted set attributes are updated", Fixture) template std::unique_ptr -makeTensorAttribute(const vespalib::string &name, const vespalib::string &tensorType) +makeTensorAttribute(const std::string &name, const std::string &tensorType) { Config cfg(BasicType::TENSOR, CollectionType::SINGLE); cfg.setTensorType(ValueType::from_spec(tensorType)); @@ -381,10 +381,10 @@ makeTensorAttribute(const vespalib::string &name, const vespalib::string &tensor return result; } -vespalib::hash_map> tensorTypes; +vespalib::hash_map> tensorTypes; const TensorDataType & -getTensorDataType(const vespalib::string &spec) +getTensorDataType(const std::string &spec) { auto insres = tensorTypes.insert(std::make_pair(spec, TensorDataType::fromSpec(spec))); return *insres.first->second; @@ -407,10 +407,10 @@ makeTensorFieldValue(const TensorSpec &spec) template struct TensorFixture : public Fixture { - vespalib::string type; + std::string type; std::unique_ptr attribute; - TensorFixture(const vespalib::string &type_, const vespalib::string &name) + TensorFixture(const std::string &type_, const std::string &name) : type(type_), attribute(makeTensorAttribute(name, type)) { diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp index 70cec30392b8..29e3e56a1c82 100644 --- a/searchcore/src/tests/proton/common/cachedselect_test.cpp +++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp @@ -58,7 +58,7 @@ using search::attribute::BasicType; using search::attribute::CollectionType; using search::attribute::IAttributeContext; using search::attribute::test::MockAttributeManager; -using vespalib::string; +using std::string; using IATint32 = IntegerAttributeTemplate; using IntEnumAttribute = EnumAttribute; @@ -219,14 +219,14 @@ class MyAttributeManager : public MockAttributeManager { public: using MockAttributeManager::addAttribute; - void addAttribute(const vespalib::string &name) { + void addAttribute(const std::string &name) { if (findAttribute(name).get() != nullptr) { return; } AttributeVector::SP av(new MyIntAv(name)); MockAttributeManager::addAttribute(name, av); } - MyIntAv *getAsMyIntAttribute(const vespalib::string &name) const { + MyIntAv *getAsMyIntAttribute(const std::string &name) const { return (dynamic_cast(findAttribute(name).get())); } }; diff --git a/searchcore/src/tests/proton/common/feedoperation_test.cpp b/searchcore/src/tests/proton/common/feedoperation_test.cpp index cae51211dfef..4341113dc710 100644 --- a/searchcore/src/tests/proton/common/feedoperation_test.cpp +++ b/searchcore/src/tests/proton/common/feedoperation_test.cpp @@ -54,9 +54,9 @@ struct MyStreamHandler : NewConfigOperation::IStreamHandler { const int32_t doc_type_id = 787121340; -const vespalib::string type_name = "test"; -const vespalib::string header_name = type_name + ".header"; -const vespalib::string body_name = type_name + ".body"; +const std::string type_name = "test"; +const std::string header_name = type_name + ".header"; +const std::string body_name = type_name + ".body"; const DocumentOperation::Timestamp TS_10(10); @@ -333,7 +333,7 @@ TEST_F("require that we can serialize and deserialize remove by gid operations", GlobalId gid = docId.getGlobalId(); BucketId bucket(toBucket(gid)); uint32_t expSerializedDocSize = 25; - vespalib::string expDocType = "testdoc_type"; + std::string expDocType = "testdoc_type"; EXPECT_NOT_EQUAL(0u, expSerializedDocSize); { RemoveOperationWithGid op(bucket, TS_10 , gid, expDocType); diff --git a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp index 88bc22932d2b..cf99a15a041f 100644 --- a/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp +++ b/searchcore/src/tests/proton/common/hw_info_sampler/hw_info_sampler_test.cpp @@ -17,7 +17,7 @@ using Config = HwInfoSampler::Config; namespace { -const vespalib::string test_dir = "temp"; +const std::string test_dir = "temp"; constexpr uint64_t sampleLen = 40_Mi; constexpr bool sharedDisk = false; diff --git a/searchcore/src/tests/proton/common/metrics_engine_test.cpp b/searchcore/src/tests/proton/common/metrics_engine_test.cpp index f4fc4c52ab10..157e6d3c294c 100644 --- a/searchcore/src/tests/proton/common/metrics_engine_test.cpp +++ b/searchcore/src/tests/proton/common/metrics_engine_test.cpp @@ -10,7 +10,7 @@ using namespace proton; namespace { struct DummyMetricSet : public metrics::MetricSet { - DummyMetricSet(const vespalib::string &name) : metrics::MetricSet(name, {}, "", nullptr) {} + DummyMetricSet(const std::string &name) : metrics::MetricSet(name, {}, "", nullptr) {} }; struct AttributeMetricsFixture { @@ -22,10 +22,10 @@ struct AttributeMetricsFixture { parent("parent"), metrics(&parent) {} - void addAttribute(const vespalib::string &attrName) { + void addAttribute(const std::string &attrName) { engine.addAttribute(metrics, attrName); } - void removeAttribute(const vespalib::string &attrName) { + void removeAttribute(const std::string &attrName) { engine.removeAttribute(metrics, attrName); } void cleanAttributes() { @@ -34,10 +34,10 @@ struct AttributeMetricsFixture { void assertRegisteredMetrics(size_t expNumMetrics) const { EXPECT_EQUAL(expNumMetrics, parent.getRegisteredMetrics().size()); } - void assertMetricsExists(const vespalib::string &attrName) { + void assertMetricsExists(const std::string &attrName) { EXPECT_TRUE(metrics.get(attrName) != nullptr); } - void assertMetricsNotExists(const vespalib::string &attrName) { + void assertMetricsNotExists(const std::string &attrName) { EXPECT_TRUE(metrics.get(attrName) == nullptr); } }; diff --git a/searchcore/src/tests/proton/common/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/common/proton_config_fetcher_test.cpp index 50ed24a0add3..773e12e53970 100644 --- a/searchcore/src/tests/proton/common/proton_config_fetcher_test.cpp +++ b/searchcore/src/tests/proton/common/proton_config_fetcher_test.cpp @@ -215,7 +215,7 @@ struct ProtonConfigOwner : public proton::IProtonConfigurer auto snapshot = _config.get(); return snapshot->getBootstrapConfig(); } - DocumentDBConfig::SP getDocumentDBConfig(const vespalib::string &name) const + DocumentDBConfig::SP getDocumentDBConfig(const std::string &name) const { auto snapshot = _config.get(); auto &dbcs = snapshot->getDocumentDBConfigs(); diff --git a/searchcore/src/tests/proton/common/proton_disk_layout_test.cpp b/searchcore/src/tests/proton/common/proton_disk_layout_test.cpp index 5f3a08246c4c..da54ee608253 100644 --- a/searchcore/src/tests/proton/common/proton_disk_layout_test.cpp +++ b/searchcore/src/tests/proton/common/proton_disk_layout_test.cpp @@ -24,8 +24,8 @@ using proton::Transport; namespace { constexpr unsigned int tlsPort = proton::test::port_numbers::proton_disk_layout_tls_port; -const vespalib::string baseDir("testdb"); -const vespalib::string documentsDir(baseDir + "/documents"); +const std::string baseDir("testdb"); +const std::string documentsDir(baseDir + "/documents"); struct FixtureBase { @@ -37,37 +37,37 @@ struct DiskLayoutFixture { DummyFileHeaderContext _fileHeaderContext; Transport _transport; TransLogServer _tls; - vespalib::string _tlsSpec; + std::string _tlsSpec; ProtonDiskLayout _diskLayout; DiskLayoutFixture(); ~DiskLayoutFixture(); - void createDirs(const std::set &dirs) { + void createDirs(const std::set &dirs) { for (const auto &dir : dirs) { std::filesystem::create_directory(std::filesystem::path(documentsDir + "/" + dir)); } } - void createDomains(const std::set &domains) { + void createDomains(const std::set &domains) { TransLogClient tlc(_transport.transport(), _tlsSpec); for (const auto &domain : domains) { ASSERT_TRUE(tlc.create(domain)); } } - std::set listDomains() { - std::vector domainVector; + std::set listDomains() { + std::vector domainVector; TransLogClient tlc(_transport.transport(), _tlsSpec); ASSERT_TRUE(tlc.listDomains(domainVector)); - std::set domains; + std::set domains; for (const auto &domain : domainVector) { domains.emplace(domain); } return domains; } - std::set listDirs() { - std::set dirs; + std::set listDirs() { + std::set dirs; auto names = vespalib::listDirectory(documentsDir); for (const auto &name : names) { if (std::filesystem::is_directory(std::filesystem::path(documentsDir + "/" + name))) { @@ -77,7 +77,7 @@ struct DiskLayoutFixture { return dirs; } - void initAndPruneUnused(const std::set names) + void initAndPruneUnused(const std::set names) { std::set docTypeNames; for (const auto &name: names) { @@ -86,11 +86,11 @@ struct DiskLayoutFixture { _diskLayout.initAndPruneUnused(docTypeNames); } - void assertDirs(const std::set &expDirs) { + void assertDirs(const std::set &expDirs) { EXPECT_EQUAL(expDirs, listDirs()); } - void assertDomains(const std::set &expDomains) + void assertDomains(const std::set &expDomains) { EXPECT_EQUAL(expDomains, listDomains()); } diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index 9ae692c8a91f..63c5afa92e00 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -29,7 +29,7 @@ using document::select::Node; using document::select::Result; using document::select::ResultSet; using proton::SelectPruner; -using vespalib::string; +using std::string; using search::attribute::BasicType; using search::attribute::CollectionType; using search::attribute::test::MockAttributeManager; diff --git a/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp b/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp index 6c9025d276f0..e819c5db72b2 100644 --- a/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp +++ b/searchcore/src/tests/proton/common/state_reporter_utils_test.cpp @@ -8,7 +8,7 @@ using namespace proton; using namespace vespalib::slime; using vespalib::Slime; -vespalib::string +std::string toString(const StatusReport &statusReport) { Slime slime; diff --git a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp index 2d186893754e..6f628efcf220 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary_test.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary_test.cpp @@ -110,7 +110,7 @@ namespace { constexpr int tls_port = proton::test::port_numbers::docsummary_tls_port; -vespalib::string tls_port_spec() { +std::string tls_port_spec() { return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec(); } @@ -121,9 +121,9 @@ namespace proton { class MockDocsumFieldWriterFactory : public search::docsummary::IDocsumFieldWriterFactory { public: - std::unique_ptr create_docsum_field_writer(const vespalib::string&, - const vespalib::string&, - const vespalib::string&, + std::unique_ptr create_docsum_field_writer(const std::string&, + const std::string&, + const std::string&, std::shared_ptr) override { return {}; } @@ -133,7 +133,7 @@ class MockDocsumFieldWriterFactory : public search::docsummary::IDocsumFieldWrit class DirMaker { public: - explicit DirMaker(const vespalib::string & dir) : + explicit DirMaker(const std::string & dir) : _dir(dir) { std::filesystem::create_directory(std::filesystem::path(dir)); @@ -142,7 +142,7 @@ class DirMaker std::filesystem::remove_all(std::filesystem::path(_dir)); } private: - vespalib::string _dir; + std::string _dir; }; class BuildContext : public DocBuilder @@ -220,10 +220,10 @@ vespalib::eval::Value::UP make_tensor(const TensorSpec &spec) { return SimpleValue::from_spec(spec); } -vespalib::string asVstring(vespalib::Memory str) { - return vespalib::string(str.data, str.size); +std::string asVstring(vespalib::Memory str) { + return std::string(str.data, str.size); } -vespalib::string asVstring(const Inspector &value) { +std::string asVstring(const Inspector &value) { return asVstring(value.asString()); } @@ -367,12 +367,12 @@ class Fixture class MockJuniperConverter : public IJuniperConverter { - vespalib::string _result; + std::string _result; public: void convert(std::string_view input, vespalib::slime::Inserter&) override { _result = input; } - const vespalib::string& get_result() const noexcept { return _result; } + const std::string& get_result() const noexcept { return _result; } }; bool @@ -827,8 +827,8 @@ TEST_F("requireThatUrisAreUsed", Fixture) EXPECT_TRUE(slime.get().valid()); EXPECT_EQUAL(4L, slime.get()[0]["weight"].asLong()); EXPECT_EQUAL(7L, slime.get()[1]["weight"].asLong()); - vespalib::string arr0s = asVstring(slime.get()[0]["item"]); - vespalib::string arr1s = asVstring(slime.get()[1]["item"]); + std::string arr0s = asVstring(slime.get()[0]["item"]); + std::string arr1s = asVstring(slime.get()[1]["item"]); EXPECT_EQUAL("http://www.example.com:83/fluke?ab=2#12", arr0s); EXPECT_EQUAL("http://www.flickr.com:85/fluke?ab=2#13", arr1s); } diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index 36fa50314722..fb5755c76afc 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -150,7 +150,7 @@ struct UnitDR : DocumentRetrieverBaseForTest { docIdLimit = limit; } - CachedSelect::SP parseSelect(const vespalib::string &selection) const override { + CachedSelect::SP parseSelect(const std::string &selection) const override { auto res = std::make_shared(); res->set(selection, repo); return res; @@ -213,7 +213,7 @@ struct AttrUnitDR : public UnitDR } AttrUnitDR(document::Document::UP d, Timestamp t, Bucket b, bool r, - int32_t aa, double dd, const vespalib::string &ss) + int32_t aa, double dd, const std::string &ss) : UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r), _amgr(), _aa(), _dd(), _ss() { @@ -222,11 +222,11 @@ struct AttrUnitDR : public UnitDR createAttribute(_dd, BasicType::DOUBLE, "dd"); addAttribute(*_dd, dd); createAttribute(_ss, BasicType::STRING, "ss"); - addAttribute(*_ss, ss); + addAttribute(*_ss, ss); } void createAttribute(AttributeVector::SP &av, BasicType basicType, - const vespalib::string &fieldName) + const std::string &fieldName) { Config cfg(basicType, CollectionType::SINGLE); cfg.setFastSearch(true); @@ -246,7 +246,7 @@ struct AttrUnitDR : public UnitDR av.commit(); } - CachedSelect::SP parseSelect(const vespalib::string &selection) const override { + CachedSelect::SP parseSelect(const std::string &selection) const override { auto res = std::make_shared(); res->set(selection, "foo", Document(repo, document->getType(), DocumentId()), repo, &_amgr, true); return res; @@ -276,7 +276,7 @@ struct PairDR : DocumentRetrieverBaseForTest { return ret ? std::move(ret) : second->getFullDocument(lid); } - CachedSelect::SP parseSelect(const vespalib::string &selection) const override { + CachedSelect::SP parseSelect(const std::string &selection) const override { auto res = std::make_shared(); res->set(selection, getDocumentTypeRepo()); return res; @@ -354,12 +354,12 @@ IDocumentRetriever::SP doc_with_null_fields(const std::string &id, Timestamp t, return std::make_unique(Document::make_without_repo(getAttrDocType(), DocumentId(id)), t, b, false); } -IDocumentRetriever::SP doc_with_attr_fields(const vespalib::string &id, +IDocumentRetriever::SP doc_with_attr_fields(const std::string &id, Timestamp t, Bucket b, int32_t aa, int32_t ab, int32_t attr_aa, double dd, double attr_dd, - const vespalib::string &ss, - const vespalib::string &attr_ss) + const std::string &ss, + const std::string &attr_ss) { auto d = Document::make_without_repo(getAttrDocType(), DocumentId(id)); d->setValue("header", StringFieldValue::make("foo")); diff --git a/searchcore/src/tests/proton/documentdb/bucketmover_common.h b/searchcore/src/tests/proton/documentdb/bucketmover_common.h index e21f084ff6ec..fba3521a2dfc 100644 --- a/searchcore/src/tests/proton/documentdb/bucketmover_common.h +++ b/searchcore/src/tests/proton/documentdb/bucketmover_common.h @@ -97,7 +97,7 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest { void failRetrieveForLid(uint32_t lid) { _lid2Fail = lid; } - CachedSelect::SP parseSelect(const vespalib::string &) const override { + CachedSelect::SP parseSelect(const std::string &) const override { return {}; } }; diff --git a/searchcore/src/tests/proton/documentdb/clusterstatehandler_test.cpp b/searchcore/src/tests/proton/documentdb/clusterstatehandler_test.cpp index d9d7bd279fce..4f319839aa90 100644 --- a/searchcore/src/tests/proton/documentdb/clusterstatehandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/clusterstatehandler_test.cpp @@ -29,7 +29,7 @@ BucketId bucket2(2); BucketId bucket3(3); Distribution distribution(Distribution::getDefaultDistributionConfig(3, 3)); -ClusterState make_cluster_state(const vespalib::string& state, uint16_t node_index, bool maintenance_in_all_spaces = false) { +ClusterState make_cluster_state(const std::string& state, uint16_t node_index, bool maintenance_in_all_spaces = false) { return ClusterState(storage::lib::ClusterState(state), node_index, distribution, maintenance_in_all_spaces); } diff --git a/searchcore/src/tests/proton/documentdb/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer_test.cpp index 3f44d7df7b48..ac8a181528da 100644 --- a/searchcore/src/tests/proton/documentdb/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer_test.cpp @@ -70,8 +70,8 @@ using ConfigurerUP = std::unique_ptr; using DocumenttypesConfigSP = proton::DocumentDBConfig::DocumenttypesConfigSP; namespace { -const vespalib::string BASE_DIR("baseDir"); -const vespalib::string DOC_TYPE("invalid"); +const std::string BASE_DIR("baseDir"); +const std::string DOC_TYPE("invalid"); class IndexManagerDummyReconfigurer : public searchcorespi::IIndexManager::Reconfigurer { @@ -146,7 +146,7 @@ ViewSet::ViewSet() ViewSet::~ViewSet() = default; struct EmptyConstantValueFactory : public vespalib::eval::ConstantValueFactory { - vespalib::eval::ConstantValue::UP create(const vespalib::string &, const vespalib::string &) const override { + vespalib::eval::ConstantValue::UP create(const std::string &, const std::string &) const override { return {}; } }; diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp index f3f5c2063a06..80bf36929d7a 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp @@ -91,10 +91,10 @@ const std::string SUB_NAME = "subdb"; const std::string BASE_DIR = "basedir"; const SerialNum CFG_SERIAL = 5; -struct ConfigDir1 { static vespalib::string dir() { return TEST_PATH("document_subdbs/cfg1"); } }; -struct ConfigDir2 { static vespalib::string dir() { return TEST_PATH("document_subdbs/cfg2"); } }; -struct ConfigDir3 { static vespalib::string dir() { return TEST_PATH("document_subdbs/cfg3"); } }; -struct ConfigDir4 { static vespalib::string dir() { return TEST_PATH("document_subdbs/cfg4"); } }; +struct ConfigDir1 { static std::string dir() { return TEST_PATH("document_subdbs/cfg1"); } }; +struct ConfigDir2 { static std::string dir() { return TEST_PATH("document_subdbs/cfg2"); } }; +struct ConfigDir3 { static std::string dir() { return TEST_PATH("document_subdbs/cfg3"); } }; +struct ConfigDir4 { static std::string dir() { return TEST_PATH("document_subdbs/cfg4"); } }; struct MySubDBOwner : public IDocumentSubDBOwner { @@ -102,7 +102,7 @@ struct MySubDBOwner : public IDocumentSubDBOwner MySubDBOwner(); ~MySubDBOwner() override; document::BucketSpace getBucketSpace() const override { return makeBucketSpace(); } - vespalib::string getName() const override { return "owner"; } + std::string getName() const override { return "owner"; } uint32_t getDistributionKey() const override { return -1; } SessionManager & session_manager() override { return _sessionMgr; } }; @@ -123,12 +123,12 @@ struct MyGetSerialNum : public IGetSerialNum struct MyFileHeaderContext : public FileHeaderContext { - void addTags(vespalib::GenericHeader &, const vespalib::string &) const override {} + void addTags(vespalib::GenericHeader &, const std::string &) const override {} }; struct MyMetricsWireService : public DummyWireService { - std::set _attributes; + std::set _attributes; MyMetricsWireService() : _attributes() {} void addAttribute(AttributeMetrics &, const std::string &name) override { _attributes.insert(name); @@ -291,7 +291,7 @@ struct MyConfigSnapshot DocBuilder _builder; DocumentDBConfig::SP _cfg; BootstrapConfig::SP _bootstrap; - MyConfigSnapshot(FNET_Transport & transport, Schema schema, const vespalib::string &cfgDir); + MyConfigSnapshot(FNET_Transport & transport, Schema schema, const std::string &cfgDir); MyConfigSnapshot(const MyConfigSnapshot &) = delete; MyConfigSnapshot & operator = (const MyConfigSnapshot &) = delete; ~MyConfigSnapshot(); @@ -299,7 +299,7 @@ struct MyConfigSnapshot MyConfigSnapshot::~MyConfigSnapshot() = default; -MyConfigSnapshot::MyConfigSnapshot(FNET_Transport & transport, Schema schema, const vespalib::string &cfgDir) +MyConfigSnapshot::MyConfigSnapshot(FNET_Transport & transport, Schema schema, const std::string &cfgDir) : _schema(std::move(schema)), _builder(get_add_fields(_schema.getNumAttributeFields() > 1)), _cfg(), @@ -378,10 +378,10 @@ struct FixtureBase void basicReconfig(SerialNum serialNum) { runInMasterAndSync([&]() { performReconfig(serialNum, make_all_attr_schema(two_attr_schema), ConfigDir2::dir()); }); } - void reconfig(SerialNum serialNum, Schema reconfigSchema, const vespalib::string &reconfigConfigDir) { + void reconfig(SerialNum serialNum, Schema reconfigSchema, const std::string &reconfigConfigDir) { runInMasterAndSync([&]() { performReconfig(serialNum, std::move(reconfigSchema), reconfigConfigDir); }); } - void performReconfig(SerialNum serialNum, Schema reconfigSchema, const vespalib::string &reconfigConfigDir) { + void performReconfig(SerialNum serialNum, Schema reconfigSchema, const std::string &reconfigConfigDir) { auto newCfg = std::make_unique(_service.transport(), std::move(reconfigSchema), reconfigConfigDir); DocumentDBConfig::ComparisonResult cmpResult; cmpResult.attributesChanged = true; @@ -762,7 +762,7 @@ using FType = IFlushTarget::Type; using FComponent = IFlushTarget::Component; bool -assertTarget(const vespalib::string &name, +assertTarget(const std::string &name, FType type, FComponent component, const IFlushTarget &target) @@ -906,7 +906,7 @@ struct DocumentHandler }; void -assertAttribute(const AttributeGuard &attr, const vespalib::string &name, uint32_t numDocs, +assertAttribute(const AttributeGuard &attr, const std::string &name, uint32_t numDocs, int64_t doc1Value, int64_t doc2Value, SerialNum createSerialNum, SerialNum lastSerialNum) { EXPECT_EQUAL(name, attr->getName()); @@ -1060,7 +1060,7 @@ struct ExplorerFixture : public FixtureType using StoreOnlyExplorerFixture = ExplorerFixture; using FastAccessExplorerFixture = ExplorerFixture; using SearchableExplorerFixture = ExplorerFixture; -using StringVector = std::vector; +using StringVector = std::vector; void assertExplorer(const StringVector &extraNames, const vespalib::StateExplorer &explorer) diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index 82f01c01b7e9..4bcee4752352 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -66,7 +66,7 @@ namespace { constexpr int tls_port = proton::test::port_numbers::documentdb_tls_port; -vespalib::string tls_port_spec() { +std::string tls_port_spec() { return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec(); } @@ -80,7 +80,7 @@ cleanup_dirs(bool file_config) } } -vespalib::string +std::string config_subdir(SerialNum serialNum) { vespalib::asciistream os; @@ -232,7 +232,7 @@ TEST_F("requireThatFlushTargetsAreNamedBySubDocumentDB", Fixture) { auto targets = f._db->getFlushTargets(); ASSERT_TRUE(!targets.empty()); for (const IFlushTarget::SP & target : f._db->getFlushTargets()) { - vespalib::string name = target->getName(); + std::string name = target->getName(); EXPECT_TRUE((name.find("0.ready.") == 0) || (name.find("1.removed.") == 0) || (name.find("2.notready.") == 0)); diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfig_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfig_test.cpp index f2c4cb0ebd1f..7826a7fa176a 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfig_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfig_test.cpp @@ -31,9 +31,9 @@ namespace documentdbconfig_test { namespace { const int32_t doc_type_id = 787121340; -const vespalib::string type_name = "test"; -const vespalib::string header_name = type_name + ".header"; -const vespalib::string body_name = type_name + ".body"; +const std::string type_name = "test"; +const std::string header_name = type_name + ".header"; +const std::string body_name = type_name + ".body"; std::shared_ptr makeDocTypeRepo(bool hasField) diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfigscout_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfigscout_test.cpp index a945550f108e..a1d3784ca44a 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfigscout_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfigscout_test.cpp @@ -52,7 +52,7 @@ getConfig(int64_t generation, const Schema::SP &schema, bool assertDefaultAttribute(const AttributesConfig::Attribute &attribute, - const vespalib::string &name) + const std::string &name) { if (!EXPECT_EQUAL(name, attribute.name)) { return false; @@ -71,7 +71,7 @@ assertDefaultAttribute(const AttributesConfig::Attribute &attribute, bool assert_string_attribute(const AttributesConfig::Attribute& attribute, - const vespalib::string& name, + const std::string& name, std::optional uncased, std::optional dictionary_type) { using Attribute = AttributesConfig::Attribute; @@ -110,7 +110,7 @@ assert_string_attribute(const AttributesConfig::Attribute& attribute, bool assertFastSearchAttribute(const AttributesConfig::Attribute &attribute, - const vespalib::string &name) + const std::string &name) { if (!EXPECT_EQUAL(name, attribute.name)) { return false; @@ -130,7 +130,7 @@ assertFastSearchAttribute(const AttributesConfig::Attribute &attribute, bool assertFastSearchAndMoreAttribute(const AttributesConfig::Attribute &attribute, - const vespalib::string &name) + const std::string &name) { if (!EXPECT_EQUAL(name, attribute.name)) { return false; @@ -149,7 +149,7 @@ assertFastSearchAndMoreAttribute(const AttributesConfig::Attribute &attribute, bool assertTensorAttribute(const AttributesConfig::Attribute &attribute, - const vespalib::string &name, const vespalib::string &spec, int max_links_per_node) + const std::string &name, const std::string &spec, int max_links_per_node) { if (!EXPECT_EQUAL(attribute.name, name)) { return false; @@ -275,7 +275,7 @@ assertScoutedAttributes(const AttributesConfig::AttributeVector &attributes) AttributesConfig::Attribute -setupDefaultAttribute(const vespalib::string & name) +setupDefaultAttribute(const std::string & name) { AttributesConfig::Attribute attribute; attribute.name = name; @@ -283,7 +283,7 @@ setupDefaultAttribute(const vespalib::string & name) } AttributesConfig::Attribute -setup_string_attribute(const vespalib::string& name, std::optional uncased, std::optional dictionary_type) +setup_string_attribute(const std::string& name, std::optional uncased, std::optional dictionary_type) { using Attribute = AttributesConfig::Attribute; using Datatype = Attribute::Datatype; @@ -308,7 +308,7 @@ setup_string_attribute(const vespalib::string& name, std::optional uncased } AttributesConfig::Attribute -setupFastSearchAttribute(const vespalib::string & name) +setupFastSearchAttribute(const std::string & name) { AttributesConfig::Attribute attribute; attribute.name = name; @@ -318,7 +318,7 @@ setupFastSearchAttribute(const vespalib::string & name) AttributesConfig::Attribute -setupFastSearchAndMoreAttribute(const vespalib::string & name) +setupFastSearchAndMoreAttribute(const std::string & name) { AttributesConfig::Attribute attribute; attribute.name = name; @@ -329,7 +329,7 @@ setupFastSearchAndMoreAttribute(const vespalib::string & name) } AttributesConfig::Attribute -setupTensorAttribute(const vespalib::string &name, const vespalib::string &spec, int max_links_per_node) +setupTensorAttribute(const std::string &name, const std::string &spec, int max_links_per_node) { AttributesConfig::Attribute attribute; attribute.name = name; diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 383f891d5d26..7f319549e62b 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -84,7 +84,7 @@ namespace { constexpr int tls_port = proton::test::port_numbers::feedhandler_tls_port; -vespalib::string tls_port_spec() { +std::string tls_port_spec() { return vespalib::SocketSpec::from_host_port("localhost", tls_port).spec(); } @@ -138,7 +138,7 @@ struct MyOwner : public IFeedHandlerOwner struct MyResourceWriteFilter : public IResourceWriteFilter { bool _acceptWriteOperation; - vespalib::string _message; + std::string _message; MyResourceWriteFilter() : _acceptWriteOperation(true), _message() @@ -319,7 +319,7 @@ SchemaContext::~SchemaContext() = default; struct DocumentContext { Document::SP doc; BucketId bucketId; - DocumentContext(const vespalib::string &docId, DocBuilder &builder) : + DocumentContext(const std::string &docId, DocBuilder &builder) : doc(builder.make_document(docId)), bucketId(BucketFactory::getBucketId(doc->getId())) { @@ -338,12 +338,12 @@ TensorDataType tensor1DType(ValueType::from_spec("tensor(x{})")); struct UpdateContext { DocumentUpdate::SP update; BucketId bucketId; - UpdateContext(const vespalib::string &docId, DocBuilder &builder) : + UpdateContext(const std::string &docId, DocBuilder &builder) : update(std::make_shared(builder.get_repo(), builder.get_document_type(), DocumentId(docId))), bucketId(BucketFactory::getBucketId(update->getId())) { } - void addFieldUpdate(const vespalib::string &fieldName) { + void addFieldUpdate(const std::string &fieldName) { const auto &docType = update->getType(); const auto &field = docType.getField(fieldName); auto fieldValue = field.createValue(); @@ -423,7 +423,7 @@ struct FeedHandlerFixture DummyFileHeaderContext _fileHeaderContext; TransportAndExecutorService _service; TransLogServer tls; - vespalib::string tlsSpec; + std::string tlsSpec; SchemaContext schema; MyOwner owner; MyResourceWriteFilter writeFilter; @@ -662,7 +662,7 @@ TEST_F("require that remove is NOT rejected if resource limit is reached", FeedH void checkUpdate(FeedHandlerFixture &f, SchemaContext &schemaContext, - const vespalib::string &fieldName, bool expectReject, bool existing) + const std::string &fieldName, bool expectReject, bool existing) { f.handler.setSerialNum(15); UpdateContext updCtx("id:test:searchdocument::foo", schemaContext.builder); diff --git a/searchcore/src/tests/proton/documentdb/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview_test.cpp index 7d2b5b98a92c..4b904896c604 100644 --- a/searchcore/src/tests/proton/documentdb/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview_test.cpp @@ -73,8 +73,8 @@ struct MyLidVector : public std::vector const uint32_t subdb_id = 0; -const vespalib::string indexAdapterTypeName = "index"; -const vespalib::string attributeAdapterTypeName = "attribute"; +const std::string indexAdapterTypeName = "index"; +const std::string attributeAdapterTypeName = "attribute"; struct MyTracer { @@ -103,20 +103,20 @@ struct MyTracer _os << ")"; } - void tracePut(const vespalib::string &adapterType, SerialNum serialNum, uint32_t lid) { + void tracePut(const std::string &adapterType, SerialNum serialNum, uint32_t lid) { Guard guard(_mutex); addComma(); _os << "put(adapter=" << adapterType << ",serialNum=" << serialNum << ",lid=" << lid << ")"; } - void traceRemove(const vespalib::string &adapterType, SerialNum serialNum, uint32_t lid) { + void traceRemove(const std::string &adapterType, SerialNum serialNum, uint32_t lid) { Guard guard(_mutex); addComma(); _os << "remove(adapter=" << adapterType << ",serialNum=" << serialNum << ",lid=" << lid << ")"; } - void traceCommit(const vespalib::string &adapterType, SerialNum serialNum) { + void traceCommit(const std::string &adapterType, SerialNum serialNum) { Guard guard(_mutex); addComma(); _os << "commit(adapter=" << adapterType << @@ -129,12 +129,12 @@ struct ParamsContext DocTypeName _docTypeName; SearchableFeedView::PersistentParams _params; - ParamsContext(const vespalib::string &docType, const vespalib::string &baseDir); + ParamsContext(const std::string &docType, const std::string &baseDir); ~ParamsContext(); const SearchableFeedView::PersistentParams &getParams() const { return _params; } }; -ParamsContext::ParamsContext(const vespalib::string &docType, const vespalib::string &baseDir) +ParamsContext::ParamsContext(const std::string &docType, const std::string &baseDir) : _docTypeName(docType), _params(0, 0, _docTypeName, subdb_id, SubDbType::READY) { @@ -329,9 +329,9 @@ struct MyAttributeWriter : public IAttributeWriter int _heartBeatCount; uint32_t _commitCount; uint32_t _wantedLidLimit; - using AttrMap = std::map>; + using AttrMap = std::map>; AttrMap _attrMap; - std::set _attrs; + std::set _attrs; proton::IAttributeManager::SP _mgr; MyTracer &_tracer; @@ -342,7 +342,7 @@ struct MyAttributeWriter : public IAttributeWriter getWritableAttributes() const override { return std::vector(); } - AttributeVector *getWritableAttribute(const vespalib::string &attrName) const override { + AttributeVector *getWritableAttribute(const std::string &attrName) const override { if (_attrs.count(attrName) == 0) { return nullptr; } @@ -464,16 +464,16 @@ struct DocumentContext BucketId bid; Timestamp ts; using List = std::vector; - DocumentContext(const vespalib::string &docId, uint64_t timestamp, DocBuilder &builder); + DocumentContext(const std::string &docId, uint64_t timestamp, DocBuilder &builder); ~DocumentContext(); - void addFieldUpdate(DocBuilder &builder, const vespalib::string &fieldName) { + void addFieldUpdate(DocBuilder &builder, const std::string &fieldName) { const document::Field &field = builder.get_document_type().getField(fieldName); upd->addUpdate(document::FieldUpdate(field)); } document::GlobalId gid() const { return doc->getId().getGlobalId(); } }; -DocumentContext::DocumentContext(const vespalib::string &docId, uint64_t timestamp, DocBuilder& builder) +DocumentContext::DocumentContext(const std::string &docId, uint64_t timestamp, DocBuilder& builder) : doc(builder.make_document(docId)), upd(std::make_shared(builder.get_repo(), builder.get_document_type(), doc->getId())), bid(BucketFactory::getNumBucketBits(), doc->getId().getGlobalId().convertToBucketId().getRawId()), @@ -555,7 +555,7 @@ struct FixtureBase DocBuilder &getBuilder() { return sc._builder; } - DocumentContext doc(const vespalib::string &docId, uint64_t timestamp) { + DocumentContext doc(const std::string &docId, uint64_t timestamp) { return DocumentContext(docId, timestamp, getBuilder()); } @@ -647,7 +647,7 @@ struct FixtureBase _writeService.master().sync(); } - bool assertTrace(const vespalib::string &exp) { + bool assertTrace(const std::string &exp) { return EXPECT_EQUAL(exp, _tracer._os.view()); } @@ -1085,7 +1085,7 @@ TEST_F("require that heartbeat propagates to index- and attributeadapter", } template -void putDocumentAndUpdate(Fixture &f, const vespalib::string &fieldName) +void putDocumentAndUpdate(Fixture &f, const std::string &fieldName) { DocumentContext dc1 = f.doc1(); f.putAndWait(dc1); @@ -1100,7 +1100,7 @@ void putDocumentAndUpdate(Fixture &f, const vespalib::string &fieldName) template void requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(Fixture &f, - const vespalib::string &fieldName) + const std::string &fieldName) { putDocumentAndUpdate(f, fieldName); @@ -1110,7 +1110,7 @@ void requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(Fixture &f, template void requireThatUpdateUpdatesAttributeAndDocumentStore(Fixture &f, - const vespalib::string &fieldName) + const std::string &fieldName) { putDocumentAndUpdate(f, fieldName); diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index 818757d61090..1b195c1ab8a9 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -39,7 +39,7 @@ using DocumenttypesConfigSP = DocumentDBConfig::DocumenttypesConfigSP; using vespalib::nbostream; using vespalib::HwInfo; -vespalib::string myId("myconfigid"); +std::string myId("myconfigid"); DocumentDBConfig::SP makeBaseConfigSnapshot(FNET_Transport & transport) diff --git a/searchcore/src/tests/proton/documentdb/lid_space_common.cpp b/searchcore/src/tests/proton/documentdb/lid_space_common.cpp index 44e663a559b0..833992513e1f 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_common.cpp +++ b/searchcore/src/tests/proton/documentdb/lid_space_common.cpp @@ -68,7 +68,7 @@ MyHandler::stop_remove_ops(bool remove_batch) const { } } -vespalib::string +std::string MyHandler::getName() const { return "myhandler"; } @@ -204,7 +204,7 @@ MyDocumentRetriever::getFullDocument(DocumentIdT lid) const { } CachedSelect::SP -MyDocumentRetriever::parseSelect(const vespalib::string&) const { +MyDocumentRetriever::parseSelect(const std::string&) const { abort(); } diff --git a/searchcore/src/tests/proton/documentdb/lid_space_common.h b/searchcore/src/tests/proton/documentdb/lid_space_common.h index 9e7635d3c3a4..04dd530d417b 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_common.h +++ b/searchcore/src/tests/proton/documentdb/lid_space_common.h @@ -39,7 +39,7 @@ constexpr double REMOVE_BATCH_BLOCK_RATE = 1.0 / 21.0; constexpr double REMOVE_BLOCK_RATE = 1.0 / 20.0; constexpr double RESOURCE_LIMIT_FACTOR = 1.0; constexpr uint32_t MAX_OUTSTANDING_MOVE_OPS = 10; -const vespalib::string DOC_ID = "id:test:searchdocument::"; +const std::string DOC_ID = "id:test:searchdocument::"; const BucketId BUCKET_ID_1(1); const BucketId BUCKET_ID_2(2); const Timestamp TIMESTAMP_1(1); @@ -83,7 +83,7 @@ struct MyHandler : public ILidSpaceCompactionHandler { void clearMoveDoneContexts(); void run_remove_ops(bool remove_batch); void stop_remove_ops(bool remove_batch) const; - vespalib::string getName() const override; + std::string getName() const override; void set_operation_listener(documentmetastore::OperationListener::SP op_listener) override; uint32_t getSubDbId() const override { return 2; } LidUsageStats getLidStatus() const override; @@ -131,7 +131,7 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest { void getBucketMetaData(const storage::spi::Bucket&, DocumentMetaData::Vector&) const override; DocumentMetaData getDocumentMetaData(const DocumentId&) const override; Document::UP getFullDocument(DocumentIdT lid) const override; - CachedSelect::SP parseSelect(const vespalib::string&) const override; + CachedSelect::SP parseSelect(const std::string&) const override; }; struct MySubDb { diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp index 891af3eda393..bc8fe79b1350 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller_test.cpp @@ -154,7 +154,7 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest void getBucketMetaData(const storage::spi::Bucket &, DocumentMetaData::Vector &) const override { abort(); } DocumentMetaData getDocumentMetaData(const DocumentId &) const override { return {}; } Document::UP getFullDocument(DocumentIdT lid) const override { return _subDB.getDocument(lid); } - CachedSelect::SP parseSelect(const vespalib::string &) const override { return {}; } + CachedSelect::SP parseSelect(const std::string &) const override { return {}; } }; @@ -946,7 +946,7 @@ TEST_F("require that maintenance controller state list jobs", MaintenanceControl } const MaintenanceJobRunner * -findJob(const MaintenanceController::JobList &jobs, const vespalib::string &jobName) +findJob(const MaintenanceController::JobList &jobs, const std::string &jobName) { auto itr = std::find_if(jobs.begin(), jobs.end(), [&](const auto &job){ return job->getJob().getName() == jobName; }); @@ -957,7 +957,7 @@ findJob(const MaintenanceController::JobList &jobs, const vespalib::string &jobN } bool -containsJob(const MaintenanceController::JobList &jobs, const vespalib::string &jobName) +containsJob(const MaintenanceController::JobList &jobs, const std::string &jobName) { return findJob(jobs, jobName) != nullptr; } diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index c1560d5e51cf..b062a59bd46d 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -198,7 +198,7 @@ assertWhiteList(const SimpleResult &exp, Blueprint::UP whiteListBlueprint, bool void assertSearchResult(const SimpleResult &exp, const DocumentMetaStore &dms, - const vespalib::string &term, const QueryTermSimple::Type &termType, + const std::string &term, const QueryTermSimple::Type &termType, bool strict, uint32_t docIdLimit = 100) { std::unique_ptr sc = diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp index 69f95ec72438..8cac4797fd41 100644 --- a/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp +++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp @@ -61,7 +61,7 @@ using search::test::DocBuilder; using search::test::SchemaBuilder; using search::test::StringFieldBuilder; using std::ostringstream; -using vespalib::string; +using std::string; namespace { diff --git a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp index d43d1184e2c7..69a646aedba6 100644 --- a/searchcore/src/tests/proton/flushengine/flushengine_test.cpp +++ b/searchcore/src/tests/proton/flushengine/flushengine_test.cpp @@ -61,7 +61,7 @@ class SimpleGetSerialNum : public IGetSerialNum class SimpleTlsStatsFactory : public flushengine::ITlsStatsFactory { flushengine::TlsStatsMap create() override { - vespalib::hash_map map; + vespalib::hash_map map; return flushengine::TlsStatsMap(std::move(map)); } }; @@ -289,14 +289,14 @@ class SimpleTarget : public test::DummyFlushTarget { class GCTarget : public SimpleTarget { public: - GCTarget(const vespalib::string &name, search::SerialNum flushedSerial) + GCTarget(const std::string &name, search::SerialNum flushedSerial) : SimpleTarget(name, Type::GC, flushedSerial) {} }; class HighPriorityTarget : public SimpleTarget { public: - HighPriorityTarget(const vespalib::string &name, search::SerialNum flushedSerial, bool proceed) + HighPriorityTarget(const std::string &name, search::SerialNum flushedSerial, bool proceed) : SimpleTarget(name, Type::OTHER, flushedSerial, proceed) {} @@ -411,7 +411,7 @@ class NoFlushStrategy : public SimpleStrategy class AppendTask : public FlushTask { public: - AppendTask(const vespalib::string & name, std::vector & list, vespalib::Gate & done) : + AppendTask(const std::string & name, std::vector & list, vespalib::Gate & done) : _list(list), _done(done), _name(name) @@ -421,9 +421,9 @@ class AppendTask : public FlushTask _done.countDown(); } search::SerialNum getFlushSerial() const override { return 0u; } - std::vector & _list; + std::vector & _list; vespalib::Gate & _done; - vespalib::string _name; + std::string _name; }; @@ -443,7 +443,7 @@ struct Fixture : Fixture(numThreads, idleInterval, std::make_shared(SimpleStrategy::OrderBy::INDEX_OF)) { } - void putFlushHandler(const vespalib::string &docTypeName, IFlushHandler::SP handler) { + void putFlushHandler(const std::string &docTypeName, IFlushHandler::SP handler) { engine.putFlushHandler(DocTypeName(docTypeName), handler); } @@ -484,7 +484,7 @@ TEST("require that leaf defaults are sane") { TEST_F("require that strategy controls flush target", Fixture(1, IINTERVAL)) { vespalib::Gate fooG, barG; - std::vector order; + std::vector order; auto foo = std::make_shared(std::make_unique("foo", order, fooG), "foo"); auto bar = std::make_shared(std::make_unique("bar", order, barG), "bar"); f.addTargetToStrategy(foo); diff --git a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp index fd80a05860b8..c780687389eb 100644 --- a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp +++ b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp @@ -23,7 +23,7 @@ struct SimpleFlushTarget : public test::DummyFlushTarget SerialNum flushedSerial; uint64_t approxDiskBytes; double replay_operation_cost; - SimpleFlushTarget(const vespalib::string &name, + SimpleFlushTarget(const std::string &name, const Type &type, SerialNum flushedSerial_, uint64_t approxDiskBytes_, @@ -48,9 +48,9 @@ class ContextsBuilder { private: FlushContext::List _result; - std::map _handlers; + std::map _handlers; - IFlushHandler::SP createAndGetHandler(const vespalib::string &handlerName) { + IFlushHandler::SP createAndGetHandler(const std::string &handlerName) { auto itr = _handlers.find(handlerName); if (itr != _handlers.end()) { return itr->second; @@ -63,8 +63,8 @@ class ContextsBuilder public: ContextsBuilder() noexcept; ~ContextsBuilder(); - ContextsBuilder &add(const vespalib::string &handlerName, - const vespalib::string &targetName, + ContextsBuilder &add(const std::string &handlerName, + const std::string &targetName, IFlushTarget::Type targetType, SerialNum flushedSerial, uint64_t approxDiskBytes, @@ -78,20 +78,20 @@ class ContextsBuilder _result.push_back(std::make_shared(handler, target, 0)); return *this; } - ContextsBuilder &add(const vespalib::string &handlerName, - const vespalib::string &targetName, + ContextsBuilder &add(const std::string &handlerName, + const std::string &targetName, SerialNum flushedSerial, uint64_t approxDiskBytes, double replay_operation_cost = 0.0) { return add(handlerName, targetName, IFlushTarget::Type::FLUSH, flushedSerial, approxDiskBytes, replay_operation_cost); } - ContextsBuilder &add(const vespalib::string &targetName, + ContextsBuilder &add(const std::string &targetName, SerialNum flushedSerial, uint64_t approxDiskBytes, double replay_operation_cost = 0.0) { return add("handler1", targetName, IFlushTarget::Type::FLUSH, flushedSerial, approxDiskBytes, replay_operation_cost); } - ContextsBuilder &addGC(const vespalib::string &targetName, + ContextsBuilder &addGC(const std::string &targetName, SerialNum flushedSerial, uint64_t approxDiskBytes, double replay_operation_cost = 0.0) { @@ -226,7 +226,7 @@ struct FlushStrategyFixture } }; -vespalib::string +std::string toString(const FlushContext::List &flushContexts) { std::ostringstream oss; @@ -244,7 +244,7 @@ toString(const FlushContext::List &flushContexts) } void -assertFlushContexts(const vespalib::string &expected, const FlushContext::List &actual) +assertFlushContexts(const std::string &expected, const FlushContext::List &actual) { EXPECT_EQUAL(expected, toString(actual)); } diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp index 19b50c670c65..3727b5f60436 100644 --- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp +++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp @@ -199,7 +199,7 @@ set readFusionIds(const string &dir) { set ids; - const vespalib::string prefix("index.fusion."); + const std::string prefix("index.fusion."); std::filesystem::directory_iterator dir_scan(dir); for (auto& entry : dir_scan) { if (entry.is_directory() && entry.path().filename().string().find(prefix) == 0) { @@ -213,7 +213,7 @@ readFusionIds(const string &dir) return ids; } -vespalib::string +std::string getFusionIndexName(uint32_t fusion_id) { vespalib::asciistream ost; diff --git a/searchcore/src/tests/proton/index/indexcollection_test.cpp b/searchcore/src/tests/proton/index/indexcollection_test.cpp index 0e699fd1443f..7fecf87b204b 100644 --- a/searchcore/src/tests/proton/index/indexcollection_test.cpp +++ b/searchcore/src/tests/proton/index/indexcollection_test.cpp @@ -32,7 +32,7 @@ class MockIndexSearchable : public FakeIndexSearchable { explicit MockIndexSearchable(const FieldLengthInfo& field_length_info) : _field_length_info(field_length_info) {} - FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + FieldLengthInfo get_field_length_info(const std::string& field_name) const override { (void) field_name; return _field_length_info; } diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index c6c303ed1af2..ee96a8ca9a09 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -196,7 +196,7 @@ struct IndexManagerTest : public ::testing::Test { } bool has_urgent_memory_index_flush() const; bool has_urgent_fusion() const; - void assert_urgent(const vespalib::string& label, bool pending, bool flush, bool fusion); + void assert_urgent(const std::string& label, bool pending, bool flush, bool fusion); }; void @@ -281,7 +281,7 @@ IndexManagerTest::assertStats(uint32_t expNumDiskIndexes, uint32_t expNumMemoryI } void -IndexManagerTest::assert_urgent(const vespalib::string& label, bool pending, bool flush, bool fusion) +IndexManagerTest::assert_urgent(const std::string& label, bool pending, bool flush, bool fusion) { SCOPED_TRACE(label); EXPECT_EQ(pending, has_pending_urgent_flush()); @@ -937,7 +937,7 @@ struct EnableInterleavedFeaturesParam RESTART1, RESTART2 }; - vespalib::string name = "no_restart"; + std::string name = "no_restart"; Restart restart = Restart::NONE; bool doc = false; // Feed doc after enabling interleaved fatures bool pruned_config = false; // Original config has been pruned @@ -996,11 +996,11 @@ class IndexManagerEnableInterleavedFeaturesTest : public IndexManagerTest, public testing::WithParamInterface> { protected: - void enable_interleaved_features(const vespalib::string& label, bool old_config_docs, bool flushed_interleaved_features, std::optional serial_num = std::nullopt); + void enable_interleaved_features(const std::string& label, bool old_config_docs, bool flushed_interleaved_features, std::optional serial_num = std::nullopt); }; void -IndexManagerEnableInterleavedFeaturesTest::enable_interleaved_features(const vespalib::string& label, bool old_config_docs, bool flushed_interleaved_features, std::optional serial_num) +IndexManagerEnableInterleavedFeaturesTest::enable_interleaved_features(const std::string& label, bool old_config_docs, bool flushed_interleaved_features, std::optional serial_num) { if (!serial_num.has_value()) { serial_num = ++_serial_num; diff --git a/searchcore/src/tests/proton/initializer/task_runner_test.cpp b/searchcore/src/tests/proton/initializer/task_runner_test.cpp index a8b9969299fe..c9f4935c42a2 100644 --- a/searchcore/src/tests/proton/initializer/task_runner_test.cpp +++ b/searchcore/src/tests/proton/initializer/task_runner_test.cpp @@ -4,10 +4,10 @@ LOG_SETUP("task_runner_test"); #include #include #include -#include #include #include #include +#include using proton::initializer::InitializerTask; using proton::initializer::TaskRunner; @@ -15,7 +15,7 @@ using proton::initializer::TaskRunner; struct TestLog { std::mutex _lock; - vespalib::string _log; + std::string _log; using UP = std::unique_ptr; TestLog() @@ -24,22 +24,22 @@ struct TestLog { } - void append(vespalib::string str) { + void append(std::string str) { std::lock_guard guard(_lock); _log += str; } - vespalib::string result() const { return _log; } + std::string result() const { return _log; } }; class NamedTask : public InitializerTask { protected: - vespalib::string _name; + std::string _name; TestLog &_log; size_t _transient_memory_usage; public: - NamedTask(const vespalib::string &name, TestLog &log, size_t transient_memory_usage = 0) + NamedTask(const std::string &name, TestLog &log, size_t transient_memory_usage = 0) : _name(name), _log(log), _transient_memory_usage(transient_memory_usage) @@ -147,7 +147,7 @@ TEST_F("multiple threads, dag graph", Fixture(10)) for (int iter = 0; iter < 1000; ++iter) { TestJob job = TestJob::setupDiamond(); f.run(job._root); - vespalib::string result = job._log->result(); + std::string result = job._log->result(); EXPECT_TRUE("DABC" == result || "DBAC" == result); if ("DABC" == result) { ++dabc_count; diff --git a/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp b/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp index 1db8a2d93b3c..1a87280bd697 100644 --- a/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp +++ b/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp @@ -21,16 +21,16 @@ class DoubleConstantValue : public ConstantValue { class MyConstantValueFactory : public ConstantValueFactory { private: - using Key = std::pair; + using Key = std::pair; using Map = std::map; Map _map; public: MyConstantValueFactory() : _map() {} - void add(const vespalib::string &path, const vespalib::string &type, double value) { + void add(const std::string &path, const std::string &type, double value) { _map.insert(std::make_pair(std::make_pair(path, type), value)); } - ConstantValue::UP create(const vespalib::string &path, const vespalib::string &type) const override { + ConstantValue::UP create(const std::string &path, const std::string &type) const override { auto itr = _map.find(std::make_pair(path, type)); if (itr != _map.end()) { return std::make_unique(itr->second); diff --git a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp index c3c99253ce55..71e243d1f108 100644 --- a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp +++ b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp @@ -50,7 +50,7 @@ TEST("measure do_work overhead for different cost inputs") { struct Work { using UP = std::unique_ptr; - virtual vespalib::string desc() const = 0; + virtual std::string desc() const = 0; virtual void perform(uint32_t docid) const = 0; virtual ~Work() {} }; @@ -58,14 +58,14 @@ struct Work { struct UniformWork : public Work { size_t cost; UniformWork(size_t cost_in) : cost(cost_in) {} - vespalib::string desc() const override { return make_string("uniform(%zu)", cost); } + std::string desc() const override { return make_string("uniform(%zu)", cost); } void perform(uint32_t) const override { (void) do_work(cost); } }; struct TriangleWork : public Work { size_t div; TriangleWork(size_t div_in) : div(div_in) {} - vespalib::string desc() const override { return make_string("triangle(docid/%zu)", div); } + std::string desc() const override { return make_string("triangle(docid/%zu)", div); } void perform(uint32_t docid) const override { (void) do_work(docid/div); } }; @@ -75,7 +75,7 @@ struct SpikeWork : public Work { size_t cost; SpikeWork(uint32_t begin_in, uint32_t end_in, size_t cost_in) : begin(begin_in), end(end_in), cost(cost_in) {} - vespalib::string desc() const override { return make_string("spike(%u,%u,%zu)", begin, end, cost); } + std::string desc() const override { return make_string("spike(%u,%u,%zu)", begin, end, cost); } void perform(uint32_t docid) const override { if ((docid >= begin) && (docid < end)) { (void) do_work(cost); @@ -103,7 +103,7 @@ struct WorkList { struct SchedulerFactory { using UP = std::unique_ptr; - virtual vespalib::string desc() const = 0; + virtual std::string desc() const = 0; virtual DocidRangeScheduler::UP create(uint32_t docid_limit) const = 0; virtual ~SchedulerFactory() {} }; @@ -111,7 +111,7 @@ struct SchedulerFactory { struct PartitionSchedulerFactory : public SchedulerFactory { size_t num_threads; PartitionSchedulerFactory(size_t num_threads_in) : num_threads(num_threads_in) {} - vespalib::string desc() const override { return make_string("partition(threads:%zu)", num_threads); } + std::string desc() const override { return make_string("partition(threads:%zu)", num_threads); } DocidRangeScheduler::UP create(uint32_t docid_limit) const override { return std::make_unique(num_threads, docid_limit); } @@ -122,7 +122,7 @@ struct TaskSchedulerFactory : public SchedulerFactory { size_t num_tasks; TaskSchedulerFactory(size_t num_threads_in, size_t num_tasks_in) : num_threads(num_threads_in), num_tasks(num_tasks_in) {} - vespalib::string desc() const override { return make_string("task(threads:%zu,num_tasks:%zu)", num_threads, num_tasks); } + std::string desc() const override { return make_string("task(threads:%zu,num_tasks:%zu)", num_threads, num_tasks); } DocidRangeScheduler::UP create(uint32_t docid_limit) const override { return std::make_unique(num_threads, num_tasks, docid_limit); } @@ -133,7 +133,7 @@ struct AdaptiveSchedulerFactory : public SchedulerFactory { size_t min_task; AdaptiveSchedulerFactory(size_t num_threads_in, size_t min_task_in) : num_threads(num_threads_in), min_task(min_task_in) {} - vespalib::string desc() const override { return make_string("adaptive(threads:%zu,min_task:%zu)", num_threads, min_task); } + std::string desc() const override { return make_string("adaptive(threads:%zu,min_task:%zu)", num_threads, min_task); } DocidRangeScheduler::UP create(uint32_t docid_limit) const override { return std::make_unique(num_threads, min_task, docid_limit); } diff --git a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp index 1c7e7083ee73..4125e881c678 100644 --- a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp +++ b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp @@ -22,7 +22,7 @@ using SAF = Schema::AttributeField; using SIAF = Schema::ImportedAttributeField; using SIF = Schema::IndexField; -const vespalib::string my_expr_ref( +const std::string my_expr_ref( "this is my reference ranking expression.\n" "this is my reference ranking expression.\n" "it will not compile into a function.\n" @@ -52,15 +52,15 @@ struct MyRankingAssetsRepo : public IRankingAssetsRepo { _onnxModels(std::move(onnxModels)) {} ~MyRankingAssetsRepo() override; - ConstantValue::UP getConstant(const vespalib::string &) const override { + ConstantValue::UP getConstant(const std::string &) const override { return {}; } - vespalib::string getExpression(const vespalib::string & name) const override { + std::string getExpression(const std::string & name) const override { return _expressions.loadExpression(name); } - const OnnxModel *getOnnxModel(const vespalib::string & name) const override { + const OnnxModel *getOnnxModel(const std::string & name) const override { return _onnxModels.getModel(name); } }; @@ -93,7 +93,7 @@ struct Fixture { { } const FieldInfo *assertField(size_t idx, - const vespalib::string &name, + const std::string &name, DataType dataType, CollectionType collectionType) const { const FieldInfo *field = env.getField(idx); @@ -106,7 +106,7 @@ struct Fixture { return field; } void assertHiddenAttributeField(size_t idx, - const vespalib::string &name, + const std::string &name, DataType dataType, CollectionType collectionType) const { const FieldInfo *field = assertField(idx, name, dataType, collectionType); @@ -115,7 +115,7 @@ struct Fixture { EXPECT_TRUE(field->isFilter()); } void assertAttributeField(size_t idx, - const vespalib::string &name, + const std::string &name, DataType dataType, CollectionType collectionType) const { const FieldInfo *field = assertField(idx, name, dataType, collectionType); @@ -124,7 +124,7 @@ struct Fixture { EXPECT_FALSE(field->isFilter()); } void assert_virtual_field(size_t idx, - const vespalib::string& name) const { + const std::string& name) const { const auto* field = assertField(idx, name, DataType::COMBINED, CollectionType::ARRAY); EXPECT_TRUE(field->type() == FieldType::VIRTUAL); } @@ -187,14 +187,14 @@ TEST_F("require that onnx model config can be obtained", Fixture(buildEmptySchem { auto model = f1.env.getOnnxModel("model1"); ASSERT_TRUE(model != nullptr); - EXPECT_EQUAL(model->file_path(), vespalib::string("path1")); - EXPECT_EQUAL(model->input_feature("input1").value(), vespalib::string("feature1")); - EXPECT_EQUAL(model->output_name("output1").value(), vespalib::string("out1")); + EXPECT_EQUAL(model->file_path(), std::string("path1")); + EXPECT_EQUAL(model->input_feature("input1").value(), std::string("feature1")); + EXPECT_EQUAL(model->output_name("output1").value(), std::string("out1")); } { auto model = f1.env.getOnnxModel("model2"); ASSERT_TRUE(model != nullptr); - EXPECT_EQUAL(model->file_path(), vespalib::string("path2")); + EXPECT_EQUAL(model->file_path(), std::string("path2")); EXPECT_FALSE(model->input_feature("input1").has_value()); EXPECT_FALSE(model->output_name("output1").has_value()); } diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp index a7c1b8ebecae..5671b974eabc 100644 --- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp +++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp @@ -47,15 +47,15 @@ SearchIterator::UP prepare(SearchIterator * search) struct MockSearch : SearchIterator { FieldSpec spec; - vespalib::string term; + std::string term; vespalib::Trinary _strict; TermFieldMatchDataArray tfmda; bool postings_fetched; uint32_t last_seek = beginId(); uint32_t last_unpack = beginId(); - explicit MockSearch(vespalib::string term_in) + explicit MockSearch(std::string term_in) : spec("", 0, 0), term(std::move(term_in)), _strict(vespalib::Trinary::True), tfmda(), postings_fetched(false) {} - MockSearch(const FieldSpec &spec_in, vespalib::string term_in, bool strict_in, + MockSearch(const FieldSpec &spec_in, std::string term_in, bool strict_in, TermFieldMatchDataArray tfmda_in, bool postings_fetched_in) : spec(spec_in), term(std::move(term_in)), _strict(strict_in ? vespalib::Trinary::True : vespalib::Trinary::False), @@ -69,10 +69,10 @@ struct MockSearch : SearchIterator { struct MockBlueprint : SimpleLeafBlueprint { FieldSpec spec; - vespalib::string term; + std::string term; bool postings_fetched = false; bool postings_strict = false; - MockBlueprint(const FieldSpec &spec_in, vespalib::string term_in) + MockBlueprint(const FieldSpec &spec_in, std::string term_in) : SimpleLeafBlueprint(spec_in), spec(spec_in), term(std::move(term_in)) { setEstimate(HitEstimate(756, false)); @@ -456,7 +456,7 @@ struct RangeLimitFixture { }; void -verifyLocateRange(const vespalib::string & from, const vespalib::string & to, +verifyLocateRange(const std::string & from, const std::string & to, const FieldSpec & fieldSpec, RangeLimitFixture & f) { search::query::SimpleNumberTerm term(fmt("[%s;%s]", from.c_str(), to.c_str()), fieldSpec.getName(), 0, search::query::Weight(1)); @@ -476,7 +476,7 @@ TEST_F("require that RangeLocator locates range from attribute blueprint", Range void -verifyRangeIsReflectedInLimiter(const vespalib::string & from, const vespalib::string & to, +verifyRangeIsReflectedInLimiter(const std::string & from, const std::string & to, const FieldSpec & fieldSpec, RangeLimitFixture & f) { search::query::SimpleNumberTerm term(fmt("[%s;%s]", from.c_str(), to.c_str()), fieldSpec.getName(), 0, search::query::Weight(1)); diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index d331204cde7e..698d4a1c9503 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -159,7 +159,7 @@ MatchingTestSharedState::meta_store() vespalib::ThreadBundle &ttb() { return vespalib::ThreadBundle::trivial(); } -void inject_match_phase_limiting(Properties &setup, const vespalib::string &attribute, size_t max_hits, bool descending) +void inject_match_phase_limiting(Properties &setup, const std::string &attribute, size_t max_hits, bool descending) { Properties cfg; cfg.add(indexproperties::matchphase::DegradationAttribute::NAME, attribute); @@ -180,14 +180,14 @@ FakeResult make_elem_result(const std::vector builder; builder.addStringTerm(term, field, 1, search::query::Weight(1)); return StackDumpCreator::create(*builder.build()); } -vespalib::string make_same_element_stack_dump(const vespalib::string &a1_term, const vespalib::string &f1_term) +std::string make_same_element_stack_dump(const std::string &a1_term, const std::string &f1_term) { QueryBuilder builder; builder.addSameElement(2, "my", 0, Weight(1)); @@ -199,15 +199,15 @@ vespalib::string make_same_element_stack_dump(const vespalib::string &a1_term, c //----------------------------------------------------------------------------- struct EmptyRankingAssetsRepo : public search::fef::IRankingAssetsRepo { - vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &) const override { + vespalib::eval::ConstantValue::UP getConstant(const std::string &) const override { return {}; } - vespalib::string getExpression(const vespalib::string &) const override { + std::string getExpression(const std::string &) const override { return {}; } - const OnnxModel *getOnnxModel(const vespalib::string &) const override { + const OnnxModel *getOnnxModel(const std::string &) const override { return nullptr; } }; @@ -268,7 +268,7 @@ struct MyWorld { } - void set_property(const vespalib::string &name, const vespalib::string &value) { + void set_property(const std::string &name, const std::string &value) { Properties cfg; cfg.add(name, value); config.import(cfg); @@ -289,7 +289,7 @@ struct MyWorld { config.add(indexproperties::feature_rename::Rename::NAME, "tensor(x[3])(x)"); } - static void verify_match_features(SearchReply &reply, const vespalib::string &matched_field) { + static void verify_match_features(SearchReply &reply, const std::string &matched_field) { if (reply.hits.empty()) { EXPECT_EQ(reply.match_features.names.size(), 0u); EXPECT_EQ(reply.match_features.values.size(), 0u); @@ -320,7 +320,7 @@ struct MyWorld { } } - static void verify_match_feature_renames(SearchReply &reply, const vespalib::string &matched_field) { + static void verify_match_feature_renames(SearchReply &reply, const std::string &matched_field) { if (reply.hits.empty()) { EXPECT_EQ(reply.match_features.names.size(), 0u); EXPECT_EQ(reply.match_features.values.size(), 0u); @@ -337,15 +337,15 @@ struct MyWorld { } } - void setup_match_phase_limiting(const vespalib::string &attribute, size_t max_hits, bool descending) + void setup_match_phase_limiting(const std::string &attribute, size_t max_hits, bool descending) { inject_match_phase_limiting(config, attribute, max_hits, descending); } - void add_match_phase_limiting_result(const vespalib::string &attribute, size_t want_docs, + void add_match_phase_limiting_result(const std::string &attribute, size_t want_docs, bool descending, std::initializer_list docs) { - vespalib::string term = vespalib::make_string("[;;%s%zu]", descending ? "-" : "", want_docs); + std::string term = vespalib::make_string("[;;%s%zu]", descending ? "-" : "", want_docs); FakeResult result; for (uint32_t doc: docs) { result.doc(doc); @@ -360,7 +360,7 @@ struct MyWorld { config.import(cfg); } - void verbose_a1_result(const vespalib::string &term) { + void verbose_a1_result(const std::string &term) { FakeResult result; for (uint32_t i = 15; i < NUM_DOCS; ++i) { result.doc(i); @@ -368,7 +368,7 @@ struct MyWorld { searchContext.attr().addResult("a1", term, result); } - void add_same_element_results(const vespalib::string &my_a1_term, const vespalib::string &my_f1_0_term) { + void add_same_element_results(const std::string &my_a1_term, const std::string &my_f1_0_term) { auto my_a1_result = make_elem_result({{10, {1}}, {20, {2, 3}}, {21, {2}}}); auto my_f1_0_result = make_elem_result({{10, {2}}, {20, {1, 2}}, {21, {2}}}); searchContext.attr().addResult("my.a1", my_a1_term, my_a1_result); @@ -382,11 +382,11 @@ struct MyWorld { .doc(600).doc(700).doc(800).doc(900)); } - static void setStackDump(Request &request, const vespalib::string &stack_dump) { + static void setStackDump(Request &request, const std::string &stack_dump) { request.stackDump.assign(stack_dump.data(), stack_dump.data() + stack_dump.size()); } - static SearchRequest::SP createRequest(const vespalib::string &stack_dump) + static SearchRequest::SP createRequest(const std::string &stack_dump) { SearchRequest::SP request(new SearchRequest); request->setTimeout(60s); @@ -395,12 +395,12 @@ struct MyWorld { return request; } - static SearchRequest::SP createSimpleRequest(const vespalib::string &field, const vespalib::string &term) + static SearchRequest::SP createSimpleRequest(const std::string &field, const std::string &term) { return createRequest(make_simple_stack_dump(field, term)); } - static SearchRequest::SP createSameElementRequest(const vespalib::string &a1_term, const vespalib::string &f1_term) + static SearchRequest::SP createSameElementRequest(const std::string &a1_term, const std::string &f1_term) { return createRequest(make_same_element_stack_dump(a1_term, f1_term)); } @@ -456,7 +456,7 @@ struct MyWorld { return reply; } - static DocsumRequest::UP create_docsum_request(const vespalib::string &stack_dump, const std::initializer_list docs) { + static DocsumRequest::UP create_docsum_request(const std::string &stack_dump, const std::initializer_list docs) { auto req = std::make_unique(); setStackDump(*req, stack_dump); for (uint32_t docid: docs) { @@ -466,13 +466,13 @@ struct MyWorld { return req; } - static DocsumRequest::SP createSimpleDocsumRequest(const vespalib::string & field, const vespalib::string & term) { + static DocsumRequest::SP createSimpleDocsumRequest(const std::string & field, const std::string & term) { // match a subset of basic result + request for a non-hit (not // sorted on docid) return create_docsum_request(make_simple_stack_dump(field, term), {30, 10, 15}); } - std::unique_ptr get_field_info(const vespalib::string &field_name) { + std::unique_ptr get_field_info(const std::string &field_name) { Matcher::SP matcher = createMatcher(); const FieldInfo *field = matcher->get_index_env().getFieldByName(field_name); if (field == nullptr) { @@ -518,20 +518,20 @@ MyWorld::~MyWorld() = default; void verifyViewResolver(const ViewResolver &resolver) { { - std::vector fields; + std::vector fields; EXPECT_TRUE(resolver.resolve("foo", fields)); ASSERT_TRUE(fields.size() == 2u); EXPECT_EQ("x", fields[0]); EXPECT_EQ("y", fields[1]); } { - std::vector fields; + std::vector fields; EXPECT_TRUE(resolver.resolve("bar", fields)); ASSERT_TRUE(fields.size() == 1u); EXPECT_EQ("z", fields[0]); } { - std::vector fields; + std::vector fields; EXPECT_TRUE(!resolver.resolve("baz", fields)); ASSERT_TRUE(fields.size() == 1u); EXPECT_EQ("baz", fields[0]); @@ -1281,7 +1281,7 @@ struct AttributeBlueprintParamsFixture { } void set_query_properties(std::string_view lower_limit, std::string_view upper_limit, std::string_view target_hits_max_adjustment_factor, - const vespalib::string & fuzzy_matching_algorithm) { + const std::string & fuzzy_matching_algorithm) { rank_properties.add(GlobalFilterLowerLimit::NAME, lower_limit); rank_properties.add(GlobalFilterUpperLimit::NAME, upper_limit); rank_properties.add(TargetHitsMaxAdjustmentFactor::NAME, target_hits_max_adjustment_factor); diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index 5f3db842d727..7948d40a8089 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -155,14 +155,14 @@ Fixture::getIterator(Node &node, ISearchContext &context) { vespalib::ThreadBundle &ttb() { return vespalib::ThreadBundle::trivial(); } -vespalib::string +std::string termAsString(const search::query::Range &term) { vespalib::asciistream os; return (os << term).str(); } -const vespalib::string & -termAsString(const vespalib::string & term) { +const std::string & +termAsString(const std::string & term) { return term; } @@ -776,8 +776,8 @@ TEST("requireThatFakeFieldSearchDumpsDiffer") FakeSearchable b; a.tag("a"); b.tag("b"); - vespalib::string term1="term1"; - vespalib::string term2="term2"; + std::string term1="term1"; + std::string term2="term2"; ProtonStringTerm n1(term1, "field1", string_id, string_weight); ProtonStringTerm n2(term2, "field1", string_id, string_weight); ProtonStringTerm n3(term1, "field2", string_id, string_weight); @@ -972,13 +972,13 @@ TEST("requireThatAndNotBlueprintStaysOnTopAfterWhiteListing") { search::query::Node::UP -make_same_element_stack_dump(const vespalib::string &prefix, const vespalib::string &term_prefix) +make_same_element_stack_dump(const std::string &prefix, const std::string &term_prefix) { QueryBuilder builder; builder.addSameElement(2, prefix, 0, Weight(1)); builder.addStringTerm("xyz", term_prefix + "f1", 1, Weight(1)); builder.addStringTerm("abc", term_prefix + "f2", 2, Weight(1)); - vespalib::string stack = StackDumpCreator::create(*builder.build()); + std::string stack = StackDumpCreator::create(*builder.build()); search::SimpleQueryStackDumpIterator stack_dump_iterator(stack); SameElementModifier sem; search::query::Node::UP query = search::query::QueryTreeCreator::create(stack_dump_iterator); diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp index eeb9937e699e..8f8e2ebdc5f4 100644 --- a/searchcore/src/tests/proton/matching/querynodes_test.cpp +++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp @@ -520,11 +520,11 @@ TEST("requireThatSimpleIntermediatesGetProperBlending") { } TEST("control query nodes size") { - EXPECT_EQUAL(64u + sizeof(vespalib::string), sizeof(ProtonTermData)); - EXPECT_EQUAL(32u + 2 * sizeof(vespalib::string), sizeof(search::query::NumberTerm)); - EXPECT_EQUAL(96u + 3 * sizeof(vespalib::string), sizeof(ProtonNodeTypes::NumberTerm)); - EXPECT_EQUAL(32u + 2 * sizeof(vespalib::string), sizeof(search::query::StringTerm)); - EXPECT_EQUAL(96u + 3 * sizeof(vespalib::string), sizeof(ProtonNodeTypes::StringTerm)); + EXPECT_EQUAL(64u + sizeof(std::string), sizeof(ProtonTermData)); + EXPECT_EQUAL(32u + 2 * sizeof(std::string), sizeof(search::query::NumberTerm)); + EXPECT_EQUAL(96u + 3 * sizeof(std::string), sizeof(ProtonNodeTypes::NumberTerm)); + EXPECT_EQUAL(32u + 2 * sizeof(std::string), sizeof(search::query::StringTerm)); + EXPECT_EQUAL(96u + 3 * sizeof(std::string), sizeof(ProtonNodeTypes::StringTerm)); } } // namespace diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp index 83fea4f9fab1..80925c71e2aa 100644 --- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp +++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp @@ -44,7 +44,7 @@ class RequestContextTest : public ::testing::Test { RequestContext _request_ctx; Value::UP _query_tensor; - void insert_tensor_in_properties(const vespalib::string& tensor_name, const Value& tensor_value) { + void insert_tensor_in_properties(const std::string& tensor_name, const Value& tensor_value) { vespalib::nbostream stream; encode_value(tensor_value, stream); _query_env.getProperties().add(tensor_name, std::string_view(stream.data(), stream.size())); @@ -69,7 +69,7 @@ class RequestContextTest : public ::testing::Test { TensorSpec expected_query_tensor() const { return spec_from_value(*_query_tensor); } - const Value* get_query_tensor(const vespalib::string& tensor_name) const { + const Value* get_query_tensor(const std::string& tensor_name) const { return _request_ctx.get_query_tensor(tensor_name); } }; diff --git a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp index 483034a112dd..792d0ded9e21 100644 --- a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp +++ b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp @@ -6,17 +6,16 @@ #include #include #include -#include #include #include #include #include - +#include #include LOG_SETUP("sessionmanager_test"); -using vespalib::string; +using std::string; using namespace proton; using namespace proton::matching; using vespalib::StateExplorer; @@ -72,7 +71,7 @@ TEST("require that SessionManager can be explored") { session_manager.insert(std::make_shared("baz", start, doom, MatchToolsFactory::UP(), SearchSession::OwnershipBundle())); SessionManagerExplorer explorer(session_manager); - EXPECT_EQUAL(std::vector({"search"}), + EXPECT_EQUAL(std::vector({"search"}), explorer.get_children_names()); std::unique_ptr search = explorer.get_child("search"); ASSERT_TRUE(search.get() != nullptr); diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index c28639279600..ed5cc1dbae39 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -54,7 +54,7 @@ using namespace proton; using namespace vespalib; DocumentType -createDocType(const vespalib::string &name, int32_t id) +createDocType(const std::string &name, int32_t id) { return DocumentType(name, id); } @@ -138,7 +138,7 @@ struct MyDocumentRetriever : DocumentRetrieverBaseForTest { return Document::UP(); } - CachedSelect::SP parseSelect(const vespalib::string &) const override { + CachedSelect::SP parseSelect(const std::string &) const override { return CachedSelect::SP(); } }; @@ -386,7 +386,7 @@ class SimplePersistenceEngineOwner : public IPersistenceEngineOwner struct SimpleResourceWriteFilter : public IResourceWriteFilter { bool _acceptWriteOperation; - vespalib::string _message; + std::string _message; SimpleResourceWriteFilter() : _acceptWriteOperation(true), _message() @@ -749,7 +749,7 @@ TEST_F("require that destroyIterator prevents iteration", SimpleFixture) { IterateResult it_result = f.engine.iterate(create_result.getIteratorId(), max_size); EXPECT_TRUE(it_result.hasError()); EXPECT_EQUAL(Result::ErrorType::PERMANENT_ERROR, it_result.getErrorCode()); - string msg_prefix = "Unknown iterator with id"; + std::string msg_prefix = "Unknown iterator with id"; EXPECT_EQUAL(msg_prefix, it_result.getErrorMessage().substr(0, msg_prefix.size())); } diff --git a/searchcore/src/tests/proton/persistenceengine/resource_usage_tracker/resource_usage_tracker_test.cpp b/searchcore/src/tests/proton/persistenceengine/resource_usage_tracker/resource_usage_tracker_test.cpp index 08c5f16a97cc..bab4fa8460e9 100644 --- a/searchcore/src/tests/proton/persistenceengine/resource_usage_tracker/resource_usage_tracker_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/resource_usage_tracker/resource_usage_tracker_test.cpp @@ -114,10 +114,10 @@ namespace { struct NamedAttribute { - vespalib::string subdb; - vespalib::string attribute; + std::string subdb; + std::string attribute; - NamedAttribute(const vespalib::string& subdb_in, const vespalib::string& attribute_in) + NamedAttribute(const std::string& subdb_in, const std::string& attribute_in) : subdb(subdb_in), attribute(attribute_in) { @@ -164,7 +164,7 @@ double rel_usage(size_t usage) noexcept { return (double) usage / (double) usage_limit; } -ResourceUsage make_resource_usage(const vespalib::string& attr_name, size_t used_address_space) +ResourceUsage make_resource_usage(const std::string& attr_name, size_t used_address_space) { AttributeResourceUsage address_space_usage(rel_usage(used_address_space), attr_name); return ResourceUsage(0.0, 0.0, address_space_usage); diff --git a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp index 6d504649fac1..20467a059d02 100644 --- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp +++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp @@ -77,8 +77,8 @@ struct DBConfigFixture { DocumentDBConfig::SP getConfig(int64_t generation, std::shared_ptr documentTypes, std::shared_ptr repo, - const vespalib::string &configId, - const vespalib::string &docTypeName) + const std::string &configId, + const std::string &docTypeName) { return std::make_shared (generation, @@ -226,10 +226,10 @@ struct MyProtonConfigurerOwner; struct MyDocumentDBConfigOwner : public DocumentDBConfigOwner { - vespalib::string _name; + std::string _name; document::BucketSpace _bucket_space; MyProtonConfigurerOwner &_owner; - MyDocumentDBConfigOwner(const vespalib::string &name, + MyDocumentDBConfigOwner(const std::string &name, document::BucketSpace bucket_space, MyProtonConfigurerOwner &owner) : DocumentDBConfigOwner(), @@ -246,7 +246,7 @@ struct MyDocumentDBConfigOwner : public DocumentDBConfigOwner struct MyLog { - std::vector _log; + std::vector _log; MyLog() : _log() @@ -254,7 +254,7 @@ struct MyLog } ~MyLog(); - void appendLog(const vespalib::string & logEntry) + void appendLog(const std::string & logEntry) { _log.emplace_back(logEntry); } @@ -279,7 +279,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner, std::shared_ptr addDocumentDB(const DocTypeName &docTypeName, document::BucketSpace bucketSpace, - const vespalib::string &configId, + const std::string &configId, const std::shared_ptr &bootstrapConfig, const std::shared_ptr &documentDBConfig, InitializeThreads initializeThreads) override @@ -309,7 +309,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner, _log.emplace_back(os.str()); } - void reconfigureDocumentDB(const vespalib::string &name, const DocumentDBConfig & config) + void reconfigureDocumentDB(const std::string &name, const DocumentDBConfig & config) { std::ostringstream os; os << "reconf db " << name << " " << config.getGeneration(); @@ -373,12 +373,12 @@ class ProtonConfigurerTest : public ::testing::Test } ~ProtonConfigurerTest() override; - void assertLog(const std::vector &expLog) { + void assertLog(const std::vector &expLog) { EXPECT_EQ(expLog, _owner._log); } void sync() { _owner.sync(); } - void addDocType(const vespalib::string &name, const std::string& bucket_space = "default") { _config.addDocType(name, bucket_space); } - void removeDocType(const vespalib::string &name) { _config.removeDocType(name); } + void addDocType(const std::string &name, const std::string& bucket_space = "default") { _config.addDocType(name, bucket_space); } + void removeDocType(const std::string &name) { _config.removeDocType(name); } void applyConfig() { _configurer.reconfigure(_config.getConfigSnapshot()); sync(); diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp index 5ec785496e2b..d6ffca29c4fe 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include #include +#include #include LOG_SETUP("document_db_reference_registry_test"); @@ -42,7 +42,7 @@ struct Fixture } test::MockDocumentDBReference::SP - add(vespalib::string name) { + add(std::string name) { auto reference = std::make_shared(); _registry.add(name, reference); return reference; diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index 81c866795896..1d3303d58f67 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -57,7 +57,7 @@ using RemoveEntry = MockGidToLidChangeHandler::RemoveEntry; struct MyDocumentDBReference : public MockDocumentDBReference { using SP = std::shared_ptr; - using AttributesMap = std::map; + using AttributesMap = std::map; MyGidToLidMapperFactory::SP factory; AttributesMap attributes; std::shared_ptr _gidToLidChangeHandler; @@ -72,7 +72,7 @@ struct MyDocumentDBReference : public MockDocumentDBReference { return factory; } std::shared_ptr getAttribute(std::string_view name) override { - auto itr = attributes.find(vespalib::string(name)); + auto itr = attributes.find(std::string(name)); if (itr != attributes.end()) { return itr->second; } else { @@ -80,9 +80,9 @@ struct MyDocumentDBReference : public MockDocumentDBReference { } } void addIntAttribute(std::string_view name) { - attributes[vespalib::string(name)] = AttributeFactory::createAttribute(name, Config(BasicType::INT32)); + attributes[std::string(name)] = AttributeFactory::createAttribute(name, Config(BasicType::INT32)); } - std::unique_ptr makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) override { + std::unique_ptr makeGidToLidChangeRegistrator(const std::string &docTypeName) override { return std::make_unique(_gidToLidChangeHandler, docTypeName); } @@ -90,20 +90,20 @@ struct MyDocumentDBReference : public MockDocumentDBReference { return *_gidToLidChangeHandler; } void removeAttribute(std::string_view name) { - attributes.erase(vespalib::string(name)); + attributes.erase(std::string(name)); } }; struct MyReferenceRegistry : public IDocumentDBReferenceRegistry { - using ReferenceMap = std::map; + using ReferenceMap = std::map; ReferenceMap map; IDocumentDBReference::SP get(std::string_view name) const override { - auto itr = map.find(vespalib::string(name)); + auto itr = map.find(std::string(name)); ASSERT_TRUE(itr != map.end()); return itr->second; } IDocumentDBReference::SP tryGet(std::string_view name) const override { - auto itr = map.find(vespalib::string(name)); + auto itr = map.find(std::string(name)); if (itr != map.end()) { return itr->second; } else { @@ -111,19 +111,19 @@ struct MyReferenceRegistry : public IDocumentDBReferenceRegistry { } } void add(std::string_view name, IDocumentDBReference::SP reference) override { - map[vespalib::string(name)] = reference; + map[std::string(name)] = reference; } void remove(std::string_view) override {} }; struct MyAttributeManager : public MockAttributeManager { - void addIntAttribute(const vespalib::string &name) { + void addIntAttribute(const std::string &name) { addAttribute(name, AttributeFactory::createAttribute(name, Config(BasicType::INT32))); } - void addReferenceAttribute(const vespalib::string &name) { + void addReferenceAttribute(const std::string &name) { addAttribute(name, std::make_shared(name)); } - const ReferenceAttribute *getReferenceAttribute(const vespalib::string &name) const { + const ReferenceAttribute *getReferenceAttribute(const std::string &name) const { AttributeGuard::UP guard = getAttribute(name); auto *result = dynamic_cast(guard->get()); ASSERT_TRUE(result != nullptr); @@ -162,9 +162,9 @@ struct DocumentModel { DocumentModel::~DocumentModel() = default; void -set(const vespalib::string &name, - const vespalib::string &referenceField, - const vespalib::string &targetField, +set(const std::string &name, + const std::string &referenceField, + const std::string &targetField, ImportedFieldsConfigBuilder::Attribute &attr) { attr.name = name; @@ -251,12 +251,12 @@ struct Fixture { DocumentDBReferenceResolver resolver(registry, docModel.childDocType, importedFieldsCfg, docModel.childDocType, _gidToLidChangeListenerRefCount, *_attributeFieldWriter, false); resolver.teardown(attrMgr); } - const IGidToLidMapperFactory *getMapperFactoryPtr(const vespalib::string &attrName) { + const IGidToLidMapperFactory *getMapperFactoryPtr(const std::string &attrName) { return attrMgr.getReferenceAttribute(attrName)->getGidToLidMapperFactory().get(); } - void assertImportedAttribute(const vespalib::string &name, - const vespalib::string &referenceField, - const vespalib::string &targetField, + void assertImportedAttribute(const std::string &name, + const std::string &referenceField, + const std::string &targetField, bool useSearchCache, const ImportedAttributeVector::SP & attr) { ASSERT_TRUE(attr.get()); @@ -266,20 +266,20 @@ struct Fixture { EXPECT_EQUAL(useSearchCache, attr->getSearchCache().get() != nullptr); } - MockGidToLidChangeHandler &getGidToLidChangeHandler(const vespalib::string &referencedDocTypeName) { + MockGidToLidChangeHandler &getGidToLidChangeHandler(const std::string &referencedDocTypeName) { auto ireference = registry.get(referencedDocTypeName); auto reference = std::dynamic_pointer_cast(ireference); assert(reference); return reference->getGidToLidChangeHandler(); } - void assertParentAdds(const vespalib::string &referencedDocTypeName, const std::vector &expAdds) + void assertParentAdds(const std::string &referencedDocTypeName, const std::vector &expAdds) { auto &handler = getGidToLidChangeHandler(referencedDocTypeName); handler.assertAdds(expAdds); } - void assertParentRemoves(const vespalib::string &referencedDocTypeName, const std::vector &expRemoves) + void assertParentRemoves(const std::string &referencedDocTypeName, const std::vector &expRemoves) { auto &handler = getGidToLidChangeHandler(referencedDocTypeName); handler.assertRemoves(expRemoves); diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp index cd8155d5b3a6..bdf6df0f8c38 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include @@ -10,6 +9,8 @@ #include #include #include +#include + #include LOG_SETUP("gid_to_lid_change_handler_test"); @@ -26,7 +27,7 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:music::1"); +std::string doc1("id:test:music::1"); } @@ -96,12 +97,12 @@ class ListenerStats { class MyListener : public IGidToLidChangeListener { ListenerStats &_stats; - vespalib::string _name; - vespalib::string _docTypeName; + std::string _name; + std::string _docTypeName; public: MyListener(ListenerStats &stats, - const vespalib::string &name, - const vespalib::string &docTypeName) + const std::string &name, + const std::string &docTypeName) : IGidToLidChangeListener(), _stats(stats), _name(name), @@ -113,8 +114,8 @@ class MyListener : public IGidToLidChangeListener void notifyPutDone(IDestructorCallbackSP, GlobalId, uint32_t) override { _stats.notifyPutDone(); } void notifyRemove(IDestructorCallbackSP, GlobalId) override { _stats.notifyRemove(); } void notifyRegistered(const std::vector& removes) override { _stats.markRegisteredListener(removes); } - const vespalib::string &getName() const override { return _name; } - const vespalib::string &getDocTypeName() const override { return _docTypeName; } + const std::string &getName() const override { return _name; } + const std::string &getDocTypeName() const override { return _docTypeName; } }; struct Fixture @@ -166,8 +167,8 @@ struct Fixture gate.await(); } - void removeListeners(const vespalib::string &docTypeName, - const std::set &keepNames) { + void removeListeners(const std::string &docTypeName, + const std::set &keepNames) { _handler->removeListeners(docTypeName, keepNames); } diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index 38fbb6a81aab..e555d5b3d065 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include @@ -10,6 +9,8 @@ #include #include #include +#include + #include LOG_SETUP("gid_to_lid_change_listener_test"); @@ -32,9 +33,9 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:music::1"); -vespalib::string doc2("id:test:music::2"); -vespalib::string doc3("id:test:music::3"); +std::string doc1("id:test:music::1"); +std::string doc2("id:test:music::2"); +std::string doc3("id:test:music::3"); VESPA_THREAD_STACK_TAG(test_executor) struct MyGidToLidMapperFactory : public MockGidToLidMapperFactory diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp index 6e08c8397d0a..a0a7495b76b0 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include @@ -8,6 +7,8 @@ #include #include #include +#include + #include LOG_SETUP("gid_to_lid_change_registrator_test"); @@ -15,10 +16,10 @@ namespace proton { class MyListener : public IGidToLidChangeListener { - vespalib::string _docTypeName; - vespalib::string _name; + std::string _docTypeName; + std::string _name; public: - MyListener(const vespalib::string &docTypeName, const vespalib::string &name) + MyListener(const std::string &docTypeName, const std::string &name) : _docTypeName(docTypeName), _name(name) { @@ -27,8 +28,8 @@ class MyListener : public IGidToLidChangeListener void notifyPutDone(IDestructorCallbackSP, document::GlobalId, uint32_t) override { } void notifyRemove(IDestructorCallbackSP, document::GlobalId) override { } void notifyRegistered(const std::vector&) override { } - const vespalib::string &getName() const override { return _name; } - const vespalib::string &getDocTypeName() const override { return _docTypeName; } + const std::string &getName() const override { return _name; } + const std::string &getDocTypeName() const override { return _docTypeName; } }; @@ -49,7 +50,7 @@ struct Fixture ~Fixture() { } std::unique_ptr - getRegistrator(const vespalib::string &docTypeName) { + getRegistrator(const std::string &docTypeName) { return std::make_unique(_handler, docTypeName); } diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp index 306177a7d31f..594b06e94cea 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include LOG_SETUP("gid_to_lid_mapper_test"); @@ -28,9 +28,9 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:music::1"); -vespalib::string doc2("id:test:music::2"); -vespalib::string doc3("id:test:music::3"); +std::string doc1("id:test:music::1"); +std::string doc2("id:test:music::2"); +std::string doc3("id:test:music::3"); static constexpr uint32_t numBucketBits = UINT32_C(20); diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index 467a00f87dda..b9d0f8786d3c 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -37,10 +37,10 @@ using vespalib::ForegroundTaskExecutor; using vespalib::ForegroundThreadExecutor; using vespalib::HwInfo; -const vespalib::string TEST_DIR = "test_output"; +const std::string TEST_DIR = "test_output"; const SerialNum INIT_SERIAL_NUM = 10; -using StringVector = std::vector; -using StringSet = std::set; +using StringVector = std::vector; +using StringSet = std::set; using ARIConfig = AttributeReprocessingInitializer::Config; struct MyReprocessingHandler : public IReprocessingHandler @@ -64,7 +64,7 @@ struct MyConfig HwInfo _hwInfo; AttributeManager::SP _mgr; search::index::Schema _schema; - std::set _fields; + std::set _fields; MyConfig(); ~MyConfig(); void addFields(const StringVector &fields) { @@ -86,7 +86,7 @@ struct MyConfig } } } - void addIndexField(const vespalib::string &name) { + void addIndexField(const std::string &name) { _schema.addIndexField(Schema::IndexField(name, DataType::STRING)); } }; @@ -112,7 +112,7 @@ struct MyDocTypeInspector : public IDocumentTypeInspector _newCfg(newCfg) { } - virtual bool hasUnchangedField(const vespalib::string &name) const override { + virtual bool hasUnchangedField(const std::string &name) const override { return _oldCfg._fields.count(name) > 0 && _newCfg._fields.count(name) > 0; } @@ -125,7 +125,7 @@ struct MyIndexschemaInspector : public IIndexschemaInspector : _schema(schema) { } - virtual bool isStringIndex(const vespalib::string &name) const override { + virtual bool isStringIndex(const std::string &name) const override { uint32_t fieldId = _schema.getIndexFieldId(name); if (fieldId == Schema::UNKNOWN_FIELD_ID) { return false; @@ -191,7 +191,7 @@ class InitializerTest : public ::testing::Test { } else { const auto & populator = dynamic_cast(*_handler._reader); std::vector attrList = populator.getWriter().getWritableAttributes(); - std::set actAttrs; + std::set actAttrs; for (const auto attr : attrList) { actAttrs.insert(attr->getName()); } diff --git a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp index 97c5b4588672..e47b3c80622e 100644 --- a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp @@ -27,7 +27,7 @@ struct MyProcessor : public ReprocessingType using MyReader = MyProcessor; using MyRewriter = MyProcessor; -const vespalib::string DOC_ID = "id:test:searchdocument::0"; +const std::string DOC_ID = "id:test:searchdocument::0"; struct FixtureBase { diff --git a/searchcore/src/tests/proton/server/disk_mem_usage_filter/disk_mem_usage_filter_test.cpp b/searchcore/src/tests/proton/server/disk_mem_usage_filter/disk_mem_usage_filter_test.cpp index b3a1213fbf77..0d7cc9f79d94 100644 --- a/searchcore/src/tests/proton/server/disk_mem_usage_filter/disk_mem_usage_filter_test.cpp +++ b/searchcore/src/tests/proton/server/disk_mem_usage_filter/disk_mem_usage_filter_test.cpp @@ -22,7 +22,7 @@ struct DiskMemUsageFilterTest : public ::testing::Test _filter.set_resource_usage(TransientResourceUsage(), vespalib::ProcessMemoryStats(297, 298, 299, 300, 42), 20); } - void testWrite(const vespalib::string &exp) { + void testWrite(const std::string &exp) { if (exp.empty()) { EXPECT_TRUE(_filter.acceptWriteOperation()); State state = _filter.getAcceptState(); diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index 6e74869a5cca..2a81cf050952 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -94,7 +94,7 @@ using storage::spi::Timestamp; using storage::spi::test::makeSpiBucket; using vespalib::CacheStats; using vespalib::make_string; -using vespalib::string; +using std::string; using vespalib::eval::SimpleValue; using vespalib::eval::TensorSpec; using vespalib::eval::ValueType; @@ -116,12 +116,12 @@ const char dyn_field_n[] = "dynamic null field"; // not in document, not in attr const char dyn_field_nai[] = "dynamic null attr int field"; // in document, not in attribute const char dyn_field_nas[] = "dynamic null attr string field"; // in document, not in attribute const char position_field[] = "position_field"; -vespalib::string dyn_field_raw("dynamic_raw_field"); -vespalib::string dyn_field_tensor("dynamic_tensor_field"); -vespalib::string static_raw_backing("static raw"); -vespalib::string dynamic_raw_backing("dynamic raw"); +std::string dyn_field_raw("dynamic_raw_field"); +std::string dyn_field_tensor("dynamic_tensor_field"); +std::string static_raw_backing("static raw"); +std::string dynamic_raw_backing("dynamic raw"); std::span dynamic_raw(dynamic_raw_backing.data(), dynamic_raw_backing.size()); -vespalib::string tensor_spec("tensor(x{})"); +std::string tensor_spec("tensor(x{})"); std::unique_ptr static_tensor = SimpleValue::from_spec(TensorSpec(tensor_spec).add({{"x", "1"}}, 1.5)); std::unique_ptr dynamic_tensor = SimpleValue::from_spec(TensorSpec(tensor_spec).add({{"x", "2"}}, 3.5)); const char zcurve_field[] = "position_field_zcurve"; @@ -398,7 +398,7 @@ struct Fixture { build(); } - void clearAttributes(const std::vector & names) const { + void clearAttributes(const std::vector & names) const { for (const auto &name : names) { auto guard = *attr_manager.getAttribute(name); guard->clearDoc(lid); diff --git a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp index 086ef8ebb27a..0ec0fa04bdcc 100644 --- a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp +++ b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp @@ -18,7 +18,7 @@ using DiskGain = IFlushTarget::DiskGain; class MyFlushHandler : public IFlushHandler { public: - MyFlushHandler(const vespalib::string &name) noexcept : IFlushHandler(name) {} + MyFlushHandler(const std::string &name) noexcept : IFlushHandler(name) {} std::vector getFlushTargets() override { return std::vector(); } @@ -35,7 +35,7 @@ class MyFlushTarget : public test::DummyFlushTarget { system_time _lastFlushTime; bool _urgentFlush; public: - MyFlushTarget(const vespalib::string &name, MemoryGain memoryGain, + MyFlushTarget(const std::string &name, MemoryGain memoryGain, DiskGain diskGain, SerialNum flushedSerial, system_time lastFlushTime, bool urgentFlush) noexcept : test::DummyFlushTarget(name), @@ -53,7 +53,7 @@ class MyFlushTarget : public test::DummyFlushTarget { bool needUrgentFlush() const override { return _urgentFlush; } }; -using StringList = std::vector; +using StringList = std::vector; class ContextBuilder { private: @@ -63,7 +63,7 @@ class ContextBuilder { flushengine::ActiveFlushStats _active_flushes; void - fixupMap(const vespalib::string &name, SerialNum lastSerial) + fixupMap(const std::string &name, SerialNum lastSerial) { flushengine::TlsStats oldStats = _map[name]; if (oldStats.getLastSerial() < lastSerial) { @@ -76,7 +76,7 @@ class ContextBuilder { public: ContextBuilder(); ~ContextBuilder(); - void addTls(const vespalib::string &name, + void addTls(const std::string &name, const flushengine::TlsStats &tlsStats) { _map[name] = tlsStats; } @@ -89,7 +89,7 @@ class ContextBuilder { FlushContext::SP ctx(new FlushContext(_handler, target, lastSerial)); return add(ctx); } - ContextBuilder& active_flush(const vespalib::string& handler_name, vespalib::system_time start_time) { + ContextBuilder& active_flush(const std::string& handler_name, vespalib::system_time start_time) { _active_flushes.set_start_time(handler_name, start_time); return *this; } @@ -112,31 +112,31 @@ ContextBuilder::ContextBuilder() ContextBuilder::~ContextBuilder() = default; MyFlushTarget::SP -createTargetM(const vespalib::string &name, MemoryGain memoryGain) +createTargetM(const std::string &name, MemoryGain memoryGain) { return std::make_shared(name, memoryGain, DiskGain(), SerialNum(), system_time(), false); } MyFlushTarget::SP -createTargetD(const vespalib::string &name, DiskGain diskGain, SerialNum serial = 0) +createTargetD(const std::string &name, DiskGain diskGain, SerialNum serial = 0) { return std::make_shared(name, MemoryGain(), diskGain, serial, system_time(), false); } MyFlushTarget::SP -createTargetS(const vespalib::string &name, SerialNum serial, system_time timeStamp = system_time()) +createTargetS(const std::string &name, SerialNum serial, system_time timeStamp = system_time()) { return std::make_shared(name, MemoryGain(), DiskGain(), serial, timeStamp, false); } MyFlushTarget::SP -createTargetT(const vespalib::string &name, system_time lastFlushTime, SerialNum serial = 0) +createTargetT(const std::string &name, system_time lastFlushTime, SerialNum serial = 0) { return std::make_shared(name, MemoryGain(), DiskGain(), serial, lastFlushTime, false); } MyFlushTarget::SP -createTargetF(const vespalib::string &name, bool urgentFlush) +createTargetF(const std::string &name, bool urgentFlush) { return std::make_shared(name, MemoryGain(), DiskGain(), SerialNum(), system_time(), urgentFlush); } diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp index 0695ab53c9dc..7603ac21ed7e 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine_test.cpp @@ -20,9 +20,9 @@ using vespalib::DataBuffer; using vespalib::Memory; using vespalib::compression::CompressionConfig; -vespalib::string +std::string getAnswer(size_t num, const char * reply = "myreply") { - vespalib::string s; + std::string s; s += "{"; s += " docsums: ["; for (size_t i = 0; i < num; i++) { @@ -119,7 +119,7 @@ createRequest(size_t num = 1) { r->hits.emplace_back(GlobalId("aaaaaaaaaaaa")); } else { for (size_t i = 0; i < num; i++) { - vespalib::string s = vespalib::make_string("aaaaaaaaaaa%c", char('a' + i % 26)); + std::string s = vespalib::make_string("aaaaaaaaaaa%c", char('a' + i % 26)); r->hits.emplace_back(GlobalId(s.c_str())); } } diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp index d2e649bb3396..35e2bb9f323e 100644 --- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp +++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp @@ -5,11 +5,11 @@ #include #include #include -#include -#include +#include #include #include -#include +#include +#include const char *prog = "../../../apps/verify_ranksetup/vespa-verify-ranksetup-bin"; const std::string gen_dir("generated"); diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp index 5ae9bc03366c..9eebb69daca1 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp @@ -40,8 +40,8 @@ namespace search::bmcluster { namespace { -vespalib::string message_bus_config_id("bm-message-bus"); -vespalib::string rpc_client_config_id("bm-rpc-client"); +std::string message_bus_config_id("bm-message-bus"); +std::string rpc_client_config_id("bm-rpc-client"); enum class PortBias { @@ -94,11 +94,11 @@ collect_persistence_providers(const std::vector> &nodes) } struct BmCluster::MessageBusConfigSet { - vespalib::string config_id; + std::string config_id; SlobroksConfigBuilder slobroks; MessagebusConfigBuilder messagebus; - MessageBusConfigSet(const vespalib::string &config_id_in, int slobrok_port) + MessageBusConfigSet(const std::string &config_id_in, int slobrok_port) : config_id(config_id_in), slobroks(), messagebus() @@ -116,10 +116,10 @@ struct BmCluster::MessageBusConfigSet { BmCluster::MessageBusConfigSet::~MessageBusConfigSet() = default; struct BmCluster::RpcClientConfigSet { - vespalib::string config_id; + std::string config_id; SlobroksConfigBuilder slobroks; - RpcClientConfigSet(const vespalib::string &config_id_in, int slobrok_port) + RpcClientConfigSet(const std::string &config_id_in, int slobrok_port) : config_id(config_id_in), slobroks() { @@ -134,7 +134,7 @@ struct BmCluster::RpcClientConfigSet { BmCluster::RpcClientConfigSet::~RpcClientConfigSet() = default; -BmCluster::BmCluster(const vespalib::string& base_dir, int base_port, const BmClusterParams& params, std::shared_ptr document_types, std::shared_ptr repo) +BmCluster::BmCluster(const std::string& base_dir, int base_port, const BmClusterParams& params, std::shared_ptr document_types, std::shared_ptr repo) : _params(params), _slobrok_port(port_number(base_port, PortBias::SLOBROK_PORT)), _rpc_client_port(port_number(base_port, PortBias::RPC_CLIENT_PORT)), @@ -189,7 +189,7 @@ BmCluster::stop_slobrok() } void -BmCluster::wait_slobrok(const vespalib::string &name) +BmCluster::wait_slobrok(const std::string &name) { auto &mirror = _rpc_client->slobrok_mirror(); LOG(info, "Waiting for %s in slobrok", name.c_str()); @@ -252,7 +252,7 @@ BmCluster::make_node(uint32_t node_idx) assert(!_nodes[node_idx]); vespalib::asciistream s; s << _base_dir << "/n" << node_idx; - vespalib::string node_base_dir(s.view()); + std::string node_base_dir(s.view()); int node_base_port = port_number(_base_port, PortBias::NUM_PORTS) + BmNode::num_ports() * node_idx; _nodes[node_idx] = BmNode::create(node_base_dir, node_base_port, node_idx, *this, _params, _document_types, _slobrok_port); } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h index 5bcf55acb27c..c985ad6ce80b 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.h @@ -51,7 +51,7 @@ class BmCluster { std::unique_ptr _slobrok; std::unique_ptr _message_bus; std::unique_ptr _rpc_client; - vespalib::string _base_dir; + std::string _base_dir; int _base_port; std::shared_ptr _document_types; std::shared_ptr _repo; @@ -63,11 +63,11 @@ class BmCluster { std::unique_ptr _feed_handler; public: - BmCluster(const vespalib::string& base_dir, int base_port, const BmClusterParams& params, std::shared_ptr document_types, std::shared_ptr repo); + BmCluster(const std::string& base_dir, int base_port, const BmClusterParams& params, std::shared_ptr document_types, std::shared_ptr repo); ~BmCluster(); void start_slobrok(); void stop_slobrok(); - void wait_slobrok(const vespalib::string &name); + void wait_slobrok(const std::string &name); void start_message_bus(); void stop_message_bus(); void start_rpc_client(); diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp index d4067446456d..0655eb5f7118 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_controller.cpp @@ -46,7 +46,7 @@ BmClusterController::BmClusterController(BmCluster& cluster, const IBmDistributi void BmClusterController::propagate_cluster_state(uint32_t node_idx, bool distributor) { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); StorageMessageAddress storage_address(&_storage, distributor ? NodeType::DISTRIBUTOR : NodeType::STORAGE, node_idx); auto req = make_set_cluster_state_request(_distribution); auto& shared_rpc_resources = _cluster.get_rpc_client(); diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_params.h b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_params.h index a375df488612..5b7a7293a7fa 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_params.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster_params.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include namespace search::bmcluster { @@ -21,7 +21,7 @@ class BmClusterParams bool _enable_distributor; bool _enable_service_layer; uint32_t _groups; - vespalib::string _indexing_sequencer; + std::string _indexing_sequencer; uint32_t _max_merges_per_node; uint32_t _max_merge_queue_size; std::optional _mbus_distributor_node_max_pending_count; @@ -48,7 +48,7 @@ class BmClusterParams uint32_t get_doc_store_chunk_maxbytes() const noexcept { return _doc_store_chunk_maxbytes; } bool get_enable_distributor() const { return _enable_distributor; } uint32_t get_groups() const noexcept { return _groups; } - const vespalib::string & get_indexing_sequencer() const { return _indexing_sequencer; } + const std::string & get_indexing_sequencer() const { return _indexing_sequencer; } uint32_t get_max_merges_per_node() const noexcept { return _max_merges_per_node; } uint32_t get_max_merge_queue_size() const noexcept { return _max_merge_queue_size; } const std::optional& get_mbus_distributor_node_max_pending_count() const noexcept { return _mbus_distributor_node_max_pending_count; } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp index 7f5f7a8f44a3..b08765abc4e6 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp @@ -119,7 +119,7 @@ BmFeed::make_get_or_remove_feed(BmRange range, BucketSelector bucket_selector, b serialized_feed << static_cast(operation); serialized_feed << make_bucket_id(n); auto document_id = make_document_id(n, i); - vespalib::string raw_id = document_id.toString(); + std::string raw_id = document_id.toString(); serialized_feed.write(raw_id.c_str(), raw_id.size() + 1); } return serialized_feed; @@ -138,7 +138,7 @@ BmFeed::make_remove_feed(BmRange range, BucketSelector bucket_selector) } std::vector -BmFeed::make_feed(vespalib::ThreadStackExecutor& executor, const BmFeedParams& params, std::function func, uint32_t num_buckets, const vespalib::string &label) +BmFeed::make_feed(vespalib::ThreadStackExecutor& executor, const BmFeedParams& params, std::function func, uint32_t num_buckets, const std::string &label) { LOG(info, "make_feed %s %u small documents", label.c_str(), params.get_documents()); std::vector serialized_feed_v; diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.h b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.h index 415d5d6ee43b..2b108501193d 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.h @@ -54,7 +54,7 @@ class BmFeed { vespalib::nbostream make_update_feed(BmRange range, BucketSelector bucket_selector); vespalib::nbostream make_get_feed(BmRange range, BucketSelector bucket_selector); vespalib::nbostream make_remove_feed(BmRange range, BucketSelector bucket_selector); - std::vector make_feed(vespalib::ThreadStackExecutor& executor, const BmFeedParams& bm_params, std::function func, uint32_t num_buckets, const vespalib::string& label); + std::vector make_feed(vespalib::ThreadStackExecutor& executor, const BmFeedParams& bm_params, std::function func, uint32_t num_buckets, const std::string& label); }; } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feed_params.h b/searchcore/src/vespa/searchcore/bmcluster/bm_feed_params.h index f6ce193f303a..fca65a4b4f54 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_feed_params.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feed_params.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace search::bmcluster { diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.cpp index 6f7f740305e1..ae1f30631b4f 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.cpp @@ -111,7 +111,7 @@ BmFeeder::feed_task(uint32_t max_pending, BmRange range, const vespalib::nbostre } void -BmFeeder::run_feed_tasks(int pass, int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, AvgSampler& sampler, const vespalib::string &op_name) +BmFeeder::run_feed_tasks(int pass, int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, AvgSampler& sampler, const std::string &op_name) { uint32_t old_errors = _feed_handler.get_error_count(); auto start_time = std::chrono::steady_clock::now(); @@ -139,7 +139,7 @@ BmFeeder::stop() } void -BmFeeder::run_feed_tasks_loop(int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, const vespalib::string &op_name) +BmFeeder::run_feed_tasks_loop(int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, const std::string &op_name) { AvgSampler sampler; for (int pass = 0; !_stop.load(std::memory_order_relaxed); ++pass) { diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.h b/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.h index 3a2c13f8c087..9670be164ad6 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feeder.h @@ -35,7 +35,7 @@ class BmFeeder { document::BucketSpace _bucket_space; IBmFeedHandler& _feed_handler; vespalib::ThreadStackExecutor& _executor; - vespalib::string _all_fields; + std::string _all_fields; bool _use_timestamp; std::atomic _stop; public: @@ -43,10 +43,10 @@ class BmFeeder { ~BmFeeder(); void feed_operation(uint32_t op_idx, vespalib::nbostream &serialized_feed, int64_t time_bias, PendingTracker& tracker); uint32_t feed_task(uint32_t max_pending, BmRange range, const vespalib::nbostream &serialized_feed, int64_t time_bias); - void run_feed_tasks(int pass, int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, AvgSampler& sampler, const vespalib::string& op_name); + void run_feed_tasks(int pass, int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, AvgSampler& sampler, const std::string& op_name); IBmFeedHandler& get_feed_handler() const { return _feed_handler; } void stop(); - void run_feed_tasks_loop(int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, const vespalib::string &op_name); + void run_feed_tasks_loop(int64_t& time_bias, const std::vector& serialized_feed_v, const BmFeedParams& params, const std::string &op_name); }; } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_message_bus.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_message_bus.cpp index 92a12503d68f..a6b06e250991 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_message_bus.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_message_bus.cpp @@ -28,7 +28,7 @@ namespace { std::atomic bm_message_bus_msg_id(0u); -vespalib::string reply_as_string(Reply &reply) { +std::string reply_as_string(Reply &reply) { vespalib::asciistream os; if (reply.getType() == 0) { os << "empty reply"; diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp index 8f83f7e1b162..44a1475118dc 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp @@ -262,7 +262,7 @@ MyServiceLayerProcess::getProvider() struct StorageConfigSet { - vespalib::string config_id; + std::string config_id; DocumenttypesConfigBuilder documenttypes; StorDistributionConfigBuilder stor_distribution; StorBouncerConfigBuilder stor_bouncer; @@ -276,7 +276,7 @@ struct StorageConfigSet SlobroksConfigBuilder slobroks; MessagebusConfigBuilder messagebus; - StorageConfigSet(const vespalib::string &base_dir, uint32_t node_idx, bool distributor, const vespalib::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, + StorageConfigSet(const std::string &base_dir, uint32_t node_idx, bool distributor, const std::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params) : config_id(config_id_in), documenttypes(documenttypes_in), @@ -343,7 +343,7 @@ struct ServiceLayerConfigSet : public StorageConfigSet StorFilestorConfigBuilder stor_filestor; StorVisitorConfigBuilder stor_visitor; - ServiceLayerConfigSet(const vespalib::string& base_dir, uint32_t node_idx, const vespalib::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, + ServiceLayerConfigSet(const std::string& base_dir, uint32_t node_idx, const std::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params) : StorageConfigSet(base_dir, node_idx, false, config_id_in, distribution, documenttypes_in, slobrok_port, mbus_port, rpc_port, status_port, params), persistence(), @@ -372,7 +372,7 @@ struct DistributorConfigSet : public StorageConfigSet StorDistributormanagerConfigBuilder stor_distributormanager; StorVisitordispatcherConfigBuilder stor_visitordispatcher; - DistributorConfigSet(const vespalib::string& base_dir, uint32_t node_idx, const vespalib::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, + DistributorConfigSet(const std::string& base_dir, uint32_t node_idx, const std::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, int slobrok_port, int mbus_port, int rpc_port, int status_port, const BmClusterParams& params) : StorageConfigSet(base_dir, node_idx, true, config_id_in, distribution, documenttypes_in, slobrok_port, mbus_port, rpc_port, status_port, params), stor_distributormanager(), @@ -404,7 +404,7 @@ class MyBmNode : public BmNode std::shared_ptr _repo; proton::DocTypeName _doc_type_name; std::shared_ptr _document_db_config; - vespalib::string _base_dir; + std::string _base_dir; search::index::DummyFileHeaderContext _file_header_context; uint32_t _node_idx; int _tls_listen_port; @@ -415,7 +415,7 @@ class MyBmNode : public BmNode int _distributor_mbus_port; int _distributor_rpc_port; int _distributor_status_port; - vespalib::string _tls_spec; + std::string _tls_spec; proton::matching::QueryLimiter _query_limiter; proton::DummyWireService _metrics_wire_service; proton::MemoryConfigStores _config_stores; @@ -444,7 +444,7 @@ class MyBmNode : public BmNode void create_document_db(const BmClusterParams& params); public: - MyBmNode(const vespalib::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port); + MyBmNode(const std::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port); ~MyBmNode() override; void initialize_persistence_provider() override; void create_bucket(const document::Bucket& bucket) override; @@ -461,7 +461,7 @@ class MyBmNode : public BmNode void merge_node_stats(std::vector& node_stats, storage::lib::ClusterState &baseline_state) override; }; -MyBmNode::MyBmNode(const vespalib::string& base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port) +MyBmNode::MyBmNode(const std::string& base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port) : BmNode(), _cluster(cluster), _document_types(std::move(document_types)), @@ -530,7 +530,7 @@ MyBmNode::create_document_db(const BmClusterParams& params) { std::filesystem::create_directory(std::filesystem::path(_base_dir)); std::filesystem::create_directory(std::filesystem::path(_base_dir + "/" + _doc_type_name.getName())); - vespalib::string input_cfg = _base_dir + "/" + _doc_type_name.getName() + "/baseconfig"; + std::string input_cfg = _base_dir + "/" + _doc_type_name.getName() + "/baseconfig"; { proton::FileConfigManager fileCfg(_shared_service.transport(), input_cfg, "", _doc_type_name.getName()); fileCfg.saveConfig(*_document_db_config, 1); @@ -540,7 +540,7 @@ MyBmNode::create_document_db(const BmClusterParams& params) proton::DocumentDBConfigHelper mgr(spec, _doc_type_name.getName()); auto protonCfg = std::make_shared(); if ( ! params.get_indexing_sequencer().empty()) { - vespalib::string sequencer = params.get_indexing_sequencer(); + std::string sequencer = params.get_indexing_sequencer(); std::transform(sequencer.begin(), sequencer.end(), sequencer.begin(), [](unsigned char c){ return std::toupper(c); }); protonCfg->indexing.optimize = ProtonConfig::Indexing::getOptimize(sequencer); } @@ -761,7 +761,7 @@ MyBmNode::merge_node_stats(std::vector& node_stats, storage::lib::C } std::unique_ptr -BmNode::create(const vespalib::string& base_dir, int base_port, uint32_t node_idx, BmCluster &cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port) +BmNode::create(const std::string& base_dir, int base_port, uint32_t node_idx, BmCluster &cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port) { return std::make_unique(base_dir, base_port, node_idx, cluster, params, std::move(document_types), slobrok_port); } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.h b/searchcore/src/vespa/searchcore/bmcluster/bm_node.h index dbf3e03d84ff..3426ce3d93be 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.h +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.h @@ -51,7 +51,7 @@ class BmNode { virtual storage::spi::PersistenceProvider *get_persistence_provider() = 0; virtual void merge_node_stats(std::vector& node_stats, storage::lib::ClusterState &baseline_state) = 0; static unsigned int num_ports(); - static std::unique_ptr create(const vespalib::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port); + static std::unique_ptr create(const std::string &base_dir, int base_port, uint32_t node_idx, BmCluster& cluster, const BmClusterParams& params, std::shared_ptr document_types, int slobrok_port); }; } diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node_stats_reporter.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_node_stats_reporter.cpp index db92e17c6513..c94209c97c90 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_node_stats_reporter.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node_stats_reporter.cpp @@ -116,7 +116,7 @@ BmNodeStatsReporter::report() } else { s << Width(8) << "-"; } - vespalib::string ss(s.view()); + std::string ss(s.view()); LOG(info, "%s", ss.c_str()); if (_report_merge_stats) { s.clear(); diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_storage_chain_builder.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_storage_chain_builder.cpp index 394824e8134f..c14faa324430 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_storage_chain_builder.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_storage_chain_builder.cpp @@ -20,7 +20,7 @@ BmStorageChainBuilder::~BmStorageChainBuilder() = default; void BmStorageChainBuilder::add(std::unique_ptr link) { - vespalib::string name = link->getName(); + std::string name = link->getName(); storage::StorageChainBuilder::add(std::move(link)); LOG(info, "Added storage link '%s'", name.c_str()); if (name == "Communication manager") { diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_storage_message_addresses.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_storage_message_addresses.cpp index 0ccfa0ac4e1a..db56050b61c2 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_storage_message_addresses.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_storage_message_addresses.cpp @@ -10,7 +10,7 @@ namespace search::bmcluster { namespace { -vespalib::string _Storage("storage"); +std::string _Storage("storage"); } diff --git a/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.cpp b/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.cpp index b5af3c794094..93a4511c1535 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.cpp @@ -22,7 +22,7 @@ namespace search::bmcluster { DocumentApiMessageBusBmFeedHandler::DocumentApiMessageBusBmFeedHandler(BmMessageBus &message_bus, const IBmDistribution& distribution) : IBmFeedHandler(), - _name(vespalib::string("DocumentApiMessageBusBmFeedHandler(distributor)")), + _name(std::string("DocumentApiMessageBusBmFeedHandler(distributor)")), _message_bus(message_bus), _routes(distribution.get_num_nodes(), true), _no_route_error_count(0u), @@ -83,7 +83,7 @@ DocumentApiMessageBusBmFeedHandler::get_error_count() const return _message_bus.get_error_count() + _no_route_error_count; } -const vespalib::string& +const std::string& DocumentApiMessageBusBmFeedHandler::get_name() const { return _name; diff --git a/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.h b/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.h index 37fa1c1a2946..695bf4f06140 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.h +++ b/searchcore/src/vespa/searchcore/bmcluster/document_api_message_bus_bm_feed_handler.h @@ -19,7 +19,7 @@ class IBmDistribution; */ class DocumentApiMessageBusBmFeedHandler : public IBmFeedHandler { - vespalib::string _name; + std::string _name; BmMessageBus& _message_bus; BmMessageBusRoutes _routes; std::atomic _no_route_error_count; @@ -34,7 +34,7 @@ class DocumentApiMessageBusBmFeedHandler : public IBmFeedHandler void get(const document::Bucket& bucket, std::string_view field_set_string, const document::DocumentId& document_id, PendingTracker& tracker) override; void attach_bucket_info_queue(PendingTracker &tracker) override; uint32_t get_error_count() const override; - const vespalib::string &get_name() const override; + const std::string &get_name() const override; bool manages_timestamp() const override; }; diff --git a/searchcore/src/vespa/searchcore/bmcluster/i_bm_feed_handler.h b/searchcore/src/vespa/searchcore/bmcluster/i_bm_feed_handler.h index 0805d19a826f..5fc5a2273c3f 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/i_bm_feed_handler.h +++ b/searchcore/src/vespa/searchcore/bmcluster/i_bm_feed_handler.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace document { class Bucket; @@ -30,7 +30,7 @@ class IBmFeedHandler virtual void get(const document::Bucket& bucket, std::string_view field_set_string, const document::DocumentId& document_id, PendingTracker& tracker) = 0; virtual void attach_bucket_info_queue(PendingTracker& tracker) = 0; virtual uint32_t get_error_count() const = 0; - virtual const vespalib::string &get_name() const = 0; + virtual const std::string &get_name() const = 0; virtual bool manages_timestamp() const = 0; }; diff --git a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp index 39f37c22b033..cadf96bf81f2 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp @@ -80,7 +80,7 @@ MyOperationComplete::addResultHandler(const storage::spi::ResultHandler * result SpiBmFeedHandler::SpiBmFeedHandler(std::vectorproviders, const document::FieldSetRepo &field_set_repo, const IBmDistribution& distribution, bool skip_get_spi_bucket_info) : IBmFeedHandler(), - _name(vespalib::string("SpiBmFeedHandler(") + (skip_get_spi_bucket_info ? "skip-get-spi-bucket-info" : "get-spi-bucket-info") + ")"), + _name(std::string("SpiBmFeedHandler(") + (skip_get_spi_bucket_info ? "skip-get-spi-bucket-info" : "get-spi-bucket-info") + ")"), _providers(std::move(providers)), _field_set_repo(field_set_repo), _errors(0u), @@ -173,7 +173,7 @@ SpiBmFeedHandler::get_error_count() const return _errors; } -const vespalib::string& +const std::string& SpiBmFeedHandler::get_name() const { return _name; diff --git a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.h b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.h index 72df64ced5d8..0ac9a7cb9bc0 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.h +++ b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.h @@ -18,7 +18,7 @@ class IBmDistribution; */ class SpiBmFeedHandler : public IBmFeedHandler { - vespalib::string _name; + std::string _name; std::vector _providers; const document::FieldSetRepo& _field_set_repo; std::atomic _errors; @@ -35,7 +35,7 @@ class SpiBmFeedHandler : public IBmFeedHandler void get(const document::Bucket& bucket, std::string_view field_set_string, const document::DocumentId& document_id, PendingTracker& tracker) override; void attach_bucket_info_queue(PendingTracker &tracker) override; uint32_t get_error_count() const override; - const vespalib::string &get_name() const override; + const std::string &get_name() const override; bool manages_timestamp() const override; }; diff --git a/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.cpp b/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.cpp index 7ad5ea07747f..1afb7c26f342 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.cpp @@ -12,7 +12,7 @@ using document::DocumentUpdate; namespace search::bmcluster { -StorageApiBmFeedHandlerBase::StorageApiBmFeedHandlerBase(const vespalib::string &base_name, const IBmDistribution &distribution, bool distributor) +StorageApiBmFeedHandlerBase::StorageApiBmFeedHandlerBase(const std::string &base_name, const IBmDistribution &distribution, bool distributor) : _name(base_name + "(" + (distributor ? "distributor" : "service-layer") + ")"), _distribution(distribution), _distributor(distributor) @@ -57,7 +57,7 @@ StorageApiBmFeedHandlerBase::get(const document::Bucket& bucket, std::string_vie send_cmd(std::move(cmd), tracker); } -const vespalib::string& +const std::string& StorageApiBmFeedHandlerBase::get_name() const { return _name; diff --git a/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.h b/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.h index eacf10ae94c7..4cf3273d4031 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.h +++ b/searchcore/src/vespa/searchcore/bmcluster/storage_api_bm_feed_handler_base.h @@ -17,20 +17,20 @@ class IBmDistribution; class StorageApiBmFeedHandlerBase : public IBmFeedHandler { protected: - vespalib::string _name; + std::string _name; const IBmDistribution& _distribution; bool _distributor; virtual void send_cmd(std::shared_ptr cmd, PendingTracker& tracker) = 0; uint32_t route_cmd(storage::api::StorageCommand& cmd); public: - StorageApiBmFeedHandlerBase(const vespalib::string& base_name, const IBmDistribution &distribution, bool distributor); + StorageApiBmFeedHandlerBase(const std::string& base_name, const IBmDistribution &distribution, bool distributor); ~StorageApiBmFeedHandlerBase(); void put(const document::Bucket& bucket, std::unique_ptr document, uint64_t timestamp, PendingTracker& tracker) override; void update(const document::Bucket& bucket, std::unique_ptr document_update, uint64_t timestamp, PendingTracker& tracker) override; void remove(const document::Bucket& bucket, const document::DocumentId& document_id, uint64_t timestamp, PendingTracker& tracker) override; void get(const document::Bucket& bucket, std::string_view field_set_string, const document::DocumentId& document_id, PendingTracker& tracker) override; - const vespalib::string &get_name() const override; + const std::string &get_name() const override; bool manages_timestamp() const override; }; diff --git a/searchcore/src/vespa/searchcore/grouping/sessionid.h b/searchcore/src/vespa/searchcore/grouping/sessionid.h index af268a05cd9c..1c5d8a8cf620 100644 --- a/searchcore/src/vespa/searchcore/grouping/sessionid.h +++ b/searchcore/src/vespa/searchcore/grouping/sessionid.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::grouping { @@ -10,7 +10,7 @@ namespace search::grouping { * Representing the session identifier of a grouping to be used in the * session manager. **/ -using SessionId = vespalib::string; +using SessionId = std::string; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.cpp b/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.cpp index 8904be6ed6d7..e97224977a89 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.cpp @@ -17,9 +17,9 @@ AddressSpaceUsageStats::~AddressSpaceUsageStats() = default; void AddressSpaceUsageStats::merge(const vespalib::AddressSpace &usage, - const vespalib::string &attributeName, - const vespalib::string &component_name, - const vespalib::string &subDbName) + const std::string &attributeName, + const std::string &component_name, + const std::string &subDbName) { if (attributeName.empty() || usage.usage() > _usage.usage()) { _usage = usage; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.h b/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.h index e6a0ea128b23..89badae13337 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/address_space_usage_stats.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace proton { @@ -14,22 +14,22 @@ namespace proton { class AddressSpaceUsageStats { vespalib::AddressSpace _usage; - vespalib::string _attributeName; - vespalib::string _component_name; - vespalib::string _subDbName; + std::string _attributeName; + std::string _component_name; + std::string _subDbName; public: explicit AddressSpaceUsageStats(const vespalib::AddressSpace &usage); ~AddressSpaceUsageStats(); void merge(const vespalib::AddressSpace &usage, - const vespalib::string &attributeName, - const vespalib::string &component_name, - const vespalib::string &subDbName); + const std::string &attributeName, + const std::string &component_name, + const std::string &subDbName); const vespalib::AddressSpace &getUsage() const { return _usage; } - const vespalib::string &getAttributeName() const { return _attributeName; } - const vespalib::string &get_component_name() const { return _component_name; } - const vespalib::string &getSubDbName() const { return _subDbName; } + const std::string &getAttributeName() const { return _attributeName; } + const std::string &get_component_name() const { return _component_name; } + const std::string &getSubDbName() const { return _subDbName; } bool operator==(const AddressSpaceUsageStats& rhs) const { return (_usage == rhs._usage) && diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp index 7a2ec8f57d72..cdea20aea6c3 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp @@ -30,13 +30,13 @@ using AttributesConfigHash = ConfigHash; bool willTriggerReprocessOnAttributeAspectRemoval(const search::attribute::Config &cfg, const IIndexschemaInspector &indexschemaInspector, - const vespalib::string &name) + const std::string &name) { return isUpdateableInMemoryOnly(name, cfg) && !indexschemaInspector.isStringIndex(name); } -vespalib::string +std::string source_field(const SummaryConfig::Classes::Fields& summary_field) { if (summary_field.source == "") { @@ -65,20 +65,20 @@ class AttributeAspectConfigRewriter AttributesConfigHash _new_attributes_config_hash; const IIndexschemaInspector& _old_index_schema_inspector; const IDocumentTypeInspector& _inspector; - vespalib::hash_set _delayed_add_attribute_aspect; - vespalib::hash_set _delayed_add_attribute_aspect_struct; - vespalib::hash_set _delayed_remove_attribute_aspect; + vespalib::hash_set _delayed_add_attribute_aspect; + vespalib::hash_set _delayed_add_attribute_aspect_struct; + vespalib::hash_set _delayed_remove_attribute_aspect; - bool has_unchanged_field(const vespalib::string& name) const; - bool should_delay_add_attribute_aspect(const vespalib::string& name) const; - bool should_delay_remove_attribute_aspect(const vespalib::string& name) const; + bool has_unchanged_field(const std::string& name) const; + bool should_delay_add_attribute_aspect(const std::string& name) const; + bool should_delay_remove_attribute_aspect(const std::string& name) const; bool calculate_fast_access(const AttributesConfig::Attribute& new_attribute_config) const; - void mark_delayed_add_attribute_aspect(const vespalib::string& name) { _delayed_add_attribute_aspect.insert(name); } - bool is_delayed_add_attribute_aspect(const vespalib::string& name) const noexcept { return _delayed_add_attribute_aspect.find(name) != _delayed_add_attribute_aspect.end(); } - void mark_delayed_add_attribute_aspect_struct(const vespalib::string& name) { _delayed_add_attribute_aspect_struct.insert(name); } - bool is_delayed_add_attribute_aspect_struct(const vespalib::string& name) const noexcept { return _delayed_add_attribute_aspect_struct.find(name) != _delayed_add_attribute_aspect_struct.end(); } - void mark_delayed_remove_attribute_aspect(const vespalib::string& name) { _delayed_remove_attribute_aspect.insert(name); } - bool is_delayed_remove_attribute_aspect(const vespalib::string& name) const noexcept { return _delayed_remove_attribute_aspect.find(name) != _delayed_remove_attribute_aspect.end(); } + void mark_delayed_add_attribute_aspect(const std::string& name) { _delayed_add_attribute_aspect.insert(name); } + bool is_delayed_add_attribute_aspect(const std::string& name) const noexcept { return _delayed_add_attribute_aspect.find(name) != _delayed_add_attribute_aspect.end(); } + void mark_delayed_add_attribute_aspect_struct(const std::string& name) { _delayed_add_attribute_aspect_struct.insert(name); } + bool is_delayed_add_attribute_aspect_struct(const std::string& name) const noexcept { return _delayed_add_attribute_aspect_struct.find(name) != _delayed_add_attribute_aspect_struct.end(); } + void mark_delayed_remove_attribute_aspect(const std::string& name) { _delayed_remove_attribute_aspect.insert(name); } + bool is_delayed_remove_attribute_aspect(const std::string& name) const noexcept { return _delayed_remove_attribute_aspect.find(name) != _delayed_remove_attribute_aspect.end(); } public: AttributeAspectConfigRewriter(const AttributesConfig& old_attributes_config, const AttributesConfig& new_attributes_config, @@ -111,13 +111,13 @@ AttributeAspectConfigRewriter::AttributeAspectConfigRewriter(const AttributesCon AttributeAspectConfigRewriter::~AttributeAspectConfigRewriter() = default; bool -AttributeAspectConfigRewriter::has_unchanged_field(const vespalib::string& name) const +AttributeAspectConfigRewriter::has_unchanged_field(const std::string& name) const { return _inspector.hasUnchangedField(name); } bool -AttributeAspectConfigRewriter::should_delay_add_attribute_aspect(const vespalib::string& name) const +AttributeAspectConfigRewriter::should_delay_add_attribute_aspect(const std::string& name) const { if (!has_unchanged_field(name)) { // No reprocessing due to field type/presence change, just use new config @@ -136,7 +136,7 @@ AttributeAspectConfigRewriter::should_delay_add_attribute_aspect(const vespalib: } bool -AttributeAspectConfigRewriter::should_delay_remove_attribute_aspect(const vespalib::string& name) const +AttributeAspectConfigRewriter::should_delay_remove_attribute_aspect(const std::string& name) const { if (!has_unchanged_field(name)) { // No reprocessing due to field type/presence change, just use new config @@ -184,7 +184,7 @@ AttributeAspectConfigRewriter::calculate_delayed_attribute_aspects() if (should_delay_add_attribute_aspect(newAttr.name)) { mark_delayed_add_attribute_aspect(newAttr.name); auto pos = newAttr.name.find('.'); - if (pos != vespalib::string::npos) { + if (pos != std::string::npos) { mark_delayed_add_attribute_aspect_struct(newAttr.name.substr(0, pos)); } } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp index 1156eb31ddc7..44c6259c3bb4 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp @@ -14,7 +14,7 @@ AttributeCollectionSpec::AttributeCollectionSpec(AttributeList && attributes, ui AttributeCollectionSpec::~AttributeCollectionSpec() = default; bool -AttributeCollectionSpec::hasAttribute(const vespalib::string &name) const { +AttributeCollectionSpec::hasAttribute(const std::string &name) const { for (const auto &attr : _attributes) { if (attr.getName() == name) { return true; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h index 5d27ea670f4d..cdc53227c054 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h @@ -39,7 +39,7 @@ class AttributeCollectionSpec const std::optional& getCurrentSerialNum() const noexcept { return _currentSerialNum; } - bool hasAttribute(const vespalib::string &name) const; + bool hasAttribute(const std::string &name) const; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.cpp index e6080d05b71a..6c137b1fd326 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.cpp @@ -23,7 +23,7 @@ AttributeConfigInspector::AttributeConfigInspector(const AttributesConfig& confi AttributeConfigInspector::~AttributeConfigInspector() = default; const Config* -AttributeConfigInspector::get_config(const vespalib::string& name) const +AttributeConfigInspector::get_config(const std::string& name) const { auto itr = _hash.find(name); return (itr != _hash.end()) ? itr->second.get() : nullptr; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.h index 0403fe4e590a..4c563a8ace82 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_config_inspector.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace vespa::config::search::internal { class InternalAttributesType; } namespace search::attribute { class Config; } @@ -16,12 +16,12 @@ namespace proton { */ class AttributeConfigInspector { using Config = search::attribute::Config; - vespalib::hash_map> _hash; + vespalib::hash_map> _hash; public: using AttributesConfig = const vespa::config::search::internal::InternalAttributesType; AttributeConfigInspector(const AttributesConfig& config); ~AttributeConfigInspector(); - const Config* get_config(const vespalib::string& name) const; + const Config* get_config(const std::string& name) const; }; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.cpp index d63f778db28d..b5000ce514c4 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.cpp @@ -17,7 +17,7 @@ using search::SerialNum; namespace { -vespalib::string +std::string getSnapshotDirComponent(uint64_t syncToken) { vespalib::asciistream os; @@ -30,7 +30,7 @@ getSnapshotDirComponent(uint64_t syncToken) namespace proton { AttributeDirectory::AttributeDirectory(const std::shared_ptr &diskLayout, - const vespalib::string &name) + const std::string &name) : _diskLayout(diskLayout), _name(name), _lastFlushTime(vespalib::system_time()), @@ -43,7 +43,7 @@ AttributeDirectory::AttributeDirectory(const std::shared_ptr diskLayout; @@ -98,16 +98,16 @@ void AttributeDirectory::saveSnapInfo() { if (!_snapInfo.save()) { - vespalib::string dirName(getDirName()); + std::string dirName(getDirName()); LOG(warning, "Could not save meta-info file for attribute vector '%s' to disk", dirName.c_str()); LOG_ABORT("should not be reached"); } } -vespalib::string +std::string AttributeDirectory::getSnapshotDir(search::SerialNum serialNum) const { - vespalib::string dirName(getDirName()); + std::string dirName(getDirName()); return dirName + "/" + getSnapshotDirComponent(serialNum); } @@ -116,7 +116,7 @@ AttributeDirectory::createInvalidSnapshot(SerialNum serialNum) { IndexMetaInfo::Snapshot newSnap(false, serialNum, getSnapshotDirComponent(serialNum)); if (empty()) { - vespalib::string dirName(getDirName()); + std::string dirName(getDirName()); std::filesystem::create_directory(std::filesystem::path(dirName)); vespalib::File::sync(vespalib::dirname(dirName)); } @@ -138,7 +138,7 @@ AttributeDirectory::markValidSnapshot(SerialNum serialNum) assert(snap.syncToken == serialNum); _snapInfo.validateSnapshot(serialNum); } - vespalib::string snapshotDir(getSnapshotDir(serialNum)); + std::string snapshotDir(getSnapshotDir(serialNum)); vespalib::File::sync(snapshotDir); vespalib::File::sync(vespalib::dirname(snapshotDir)); search::DirectoryTraverse dirt(snapshotDir); @@ -191,7 +191,7 @@ AttributeDirectory::removeInvalidSnapshots() } } for (const auto &serialNum : toRemove) { - vespalib::string subDir(getSnapshotDir(serialNum)); + std::string subDir(getSnapshotDir(serialNum)); std::filesystem::remove_all(std::filesystem::path(subDir)); } if (!toRemove.empty()) { @@ -211,7 +211,7 @@ bool AttributeDirectory::removeDiskDir() { if (empty()) { - vespalib::string dirName(getDirName()); + std::string dirName(getDirName()); std::filesystem::remove_all(std::filesystem::path(dirName)); vespalib::File::sync(vespalib::dirname(dirName)); return true; @@ -261,7 +261,7 @@ AttributeDirectory::empty() const return _snapInfo.snapshots().empty(); } -vespalib::string +std::string AttributeDirectory::getAttributeFileName(SerialNum serialNum) { return getSnapshotDir(serialNum) + "/" + _name; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h index dc0573e64603..c59677cc73ee 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h @@ -5,11 +5,11 @@ #include #include #include -#include #include #include #include #include +#include #include namespace proton { @@ -32,7 +32,7 @@ class AttributeDirectory using SnapshotDiskSizes = std::unordered_map>; std::weak_ptr _diskLayout; - const vespalib::string _name; + const std::string _name; vespalib::system_time _lastFlushTime; Writer *_writer; // current writer mutable std::mutex _mutex; @@ -41,7 +41,7 @@ class AttributeDirectory SnapshotDiskSizes _disk_sizes; void saveSnapInfo(); - vespalib::string getSnapshotDir(SerialNum serialNum) const; + std::string getSnapshotDir(SerialNum serialNum) const; void setLastFlushTime(vespalib::system_time lastFlushTime); void createInvalidSnapshot(SerialNum serialNum); void markValidSnapshot(SerialNum serialNum); @@ -50,14 +50,14 @@ class AttributeDirectory void removeInvalidSnapshots(); bool removeDiskDir(); void detach(); - vespalib::string getDirName() const; + std::string getDirName() const; public: AttributeDirectory(const std::shared_ptr &diskLayout, - const vespalib::string &name); + const std::string &name); ~AttributeDirectory(); - const vespalib::string & getAttrName() const { return _name; } + const std::string & getAttrName() const { return _name; } /* * Class to make changes to an attribute directory in a @@ -75,7 +75,7 @@ class AttributeDirectory void setLastFlushTime(vespalib::system_time lastFlushTime) { _dir.setLastFlushTime(lastFlushTime); } void createInvalidSnapshot(SerialNum serialNum) { _dir.createInvalidSnapshot(serialNum); } void markValidSnapshot(SerialNum serialNum) { _dir.markValidSnapshot(serialNum); } - vespalib::string getSnapshotDir(SerialNum serialNum) { return _dir.getSnapshotDir(serialNum); } + std::string getSnapshotDir(SerialNum serialNum) { return _dir.getSnapshotDir(serialNum); } // methods called while pruning old snapshots or removing attribute void invalidateOldSnapshots(SerialNum serialNum) { _dir.invalidateOldSnapshots(serialNum); } @@ -90,7 +90,7 @@ class AttributeDirectory SerialNum getFlushedSerialNum() const; vespalib::system_time getLastFlushTime() const; bool empty() const; - vespalib::string getAttributeFileName(SerialNum serialNum); + std::string getAttributeFileName(SerialNum serialNum); TransientResourceUsage get_transient_resource_usage() const; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.cpp index 74f9470930af..0dee919851c5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.cpp @@ -22,7 +22,7 @@ AttributeExecutor::~AttributeExecutor() = default; void AttributeExecutor::run_sync(std::function task) const { - vespalib::string name(_attr->getNamePrefix()); + std::string name(_attr->getNamePrefix()); auto& writer = _mgr->getAttributeFieldWriter(); std::promise promise; auto future = promise.get_future(); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.h index 6f779f1e898f..c332cccb430b 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_executor.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace search { class AttributeVector; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.cpp index e5a12fe2c9e9..3f85f85e0e7a 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.cpp @@ -12,7 +12,7 @@ using search::AttributeVector; AttributeFactory::AttributeFactory() = default; AttributeVector::SP -AttributeFactory::create(const vespalib::string &name, const search::attribute::Config &cfg) const +AttributeFactory::create(const std::string &name, const search::attribute::Config &cfg) const { AttributeVector::SP v(search::AttributeFactory::createAttribute(name, cfg)); return v; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h index 96cee9817728..d2ded6424fcf 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h @@ -15,7 +15,7 @@ class AttributeFactory : public IAttributeFactory using SP = std::shared_ptr; AttributeFactory(); - AttributeVectorSP create(const vespalib::string &name, const search::attribute::Config &cfg) const override; + AttributeVectorSP create(const std::string &name, const search::attribute::Config &cfg) const override; void setupEmpty(const AttributeVectorSP &vec, std::optional serialNum) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp index f5d280c64caa..55e4923baf44 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp @@ -32,7 +32,7 @@ using search::attribute::AttributeHeader; namespace { -vespalib::string +std::string extraPredicateType(const search::attribute::PersistentPredicateParams ¶ms) { vespalib::asciistream os; @@ -42,7 +42,7 @@ extraPredicateType(const search::attribute::PersistentPredicateParams ¶ms) return os.str(); } -vespalib::string +std::string extraType(const Config &cfg) { if (cfg.basicType().type() == BasicType::Type::TENSOR) { @@ -54,7 +54,7 @@ extraType(const Config &cfg) return ""; } -vespalib::string +std::string extraType(const AttributeHeader &header) { if (header.getBasicType().type() == BasicType::Type::TENSOR) { @@ -66,7 +66,7 @@ extraType(const AttributeHeader &header) return ""; } -vespalib::string +std::string collectionTypeString(const CollectionType &type, bool detailed) { vespalib::asciistream os; @@ -116,7 +116,7 @@ headerTypeOK(const AttributeHeader &header, const Config &cfg) } AttributeHeader -extractHeader(const vespalib::string &attrFileName) +extractHeader(const std::string &attrFileName) { auto df = search::FileUtil::openFile(attrFileName + ".dat"); vespalib::FileHeader datHeader; @@ -142,10 +142,10 @@ void logAttributeWrongType(const AttributeVector::SP &attr, const AttributeHeader &header) { const Config &cfg(attr->getConfig()); - vespalib::string extraCfgType = extraType(cfg); - vespalib::string extraHeaderType = extraType(header); - vespalib::string cfgCollStr = collectionTypeString(cfg.collectionType(), true); - vespalib::string headerCollStr = collectionTypeString(header.getCollectionType(), header.getCollectionTypeParamsSet()); + std::string extraCfgType = extraType(cfg); + std::string extraHeaderType = extraType(header); + std::string cfgCollStr = collectionTypeString(cfg.collectionType(), true); + std::string headerCollStr = collectionTypeString(header.getCollectionType(), header.getCollectionTypeParamsSet()); LOG(info, "Attribute vector '%s' is of wrong type (expected %s/%s/%s, got %s/%s/%s)", header.getFileName().c_str(), cfg.basicType().asString(), cfgCollStr.c_str(), extraCfgType.c_str(), header.getBasicType().asString(), headerCollStr.c_str(), extraHeaderType.c_str()); @@ -158,7 +158,7 @@ AttributeInitializer::readHeader() { if (!_attrDir->empty()) { search::SerialNum serialNum = _attrDir->getFlushedSerialNum(); - vespalib::string attrFileName = _attrDir->getAttributeFileName(serialNum); + std::string attrFileName = _attrDir->getAttributeFileName(serialNum); if (serialNum != 0) { _header = std::make_unique(extractHeader(attrFileName)); if (_header->getCreateSerialNum() <= _currentSerialNum && headerTypeOK(*_header, _spec.getConfig()) && (serialNum >= _currentSerialNum)) { @@ -172,7 +172,7 @@ AttributeVector::SP AttributeInitializer::tryLoadAttribute() const { search::SerialNum serialNum = _attrDir->getFlushedSerialNum(); - vespalib::string attrFileName = _attrDir->getAttributeFileName(serialNum); + std::string attrFileName = _attrDir->getAttributeFileName(serialNum); AttributeVector::SP attr = _factory.create(attrFileName, _spec.getConfig()); if (serialNum != 0 && _header) { if (!_header_ok) { @@ -235,7 +235,7 @@ AttributeInitializer::createAndSetupEmptyAttribute() const } AttributeInitializer::AttributeInitializer(const std::shared_ptr &attrDir, - const vespalib::string &documentSubDbName, + const std::string &documentSubDbName, AttributeSpec && spec, std::optional currentSerialNum, const IAttributeFactory &factory, diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h index 45ce037b65a7..4793524b3f73 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h @@ -4,9 +4,9 @@ #include "attribute_spec.h" #include "attribute_initializer_result.h" -#include #include #include +#include namespace search::attribute { class AttributeHeader; } namespace vespalib { class Executor; } @@ -27,7 +27,7 @@ class AttributeInitializer private: using AttributeVectorSP = std::shared_ptr; std::shared_ptr _attrDir; - const vespalib::string _documentSubDbName; + const std::string _documentSubDbName; const AttributeSpec _spec; const std::optional _currentSerialNum; const IAttributeFactory &_factory; @@ -47,7 +47,7 @@ class AttributeInitializer AttributeVectorSP createAndSetupEmptyAttribute() const; public: - AttributeInitializer(const std::shared_ptr &attrDir, const vespalib::string &documentSubDbName, + AttributeInitializer(const std::shared_ptr &attrDir, const std::string &documentSubDbName, AttributeSpec && spec, std::optional currentSerialNum, const IAttributeFactory &factory, vespalib::Executor& shared_executor); ~AttributeInitializer(); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp index ae3c1c7cd351..e0112fb303c2 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp @@ -28,11 +28,11 @@ AttributeManagerExplorer::get_state(const Inserter &inserter, bool full) const inserter.insertObject(); } -std::vector +std::vector AttributeManagerExplorer::get_children_names() const { auto& attributes = _mgr->getWritableAttributes(); - std::vector names; + std::vector names; for (const auto &attr : attributes) { names.push_back(attr->getName()); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.h index c7f250b62194..f11bbc09bad9 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.h @@ -20,7 +20,7 @@ class AttributeManagerExplorer : public vespalib::StateExplorer ~AttributeManagerExplorer(); void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp index 95e4521488c3..d2f2c788e270 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp @@ -38,12 +38,12 @@ AttributePopulator::nextSerialNum() return _currSerialNum++; } -std::vector +std::vector AttributePopulator::getNames() const { std::vector attrs; _writer.getAttributeManager()->getAttributeList(attrs); - std::vector names; + std::vector names; names.reserve(attrs.size()); for (const search::AttributeGuard &attr : attrs) { names.push_back(_subDbName + ".attribute." + attr->getName()); @@ -53,7 +53,7 @@ AttributePopulator::getNames() const AttributePopulator::AttributePopulator(const proton::IAttributeManager::SP &mgr, search::SerialNum initSerialNum, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum configSerialNum) : _writer(mgr), _initSerialNum(initSerialNum), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.h index 73713c1b465b..92465838b994 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.h @@ -17,18 +17,18 @@ class AttributePopulator : public IReprocessingReader search::SerialNum _initSerialNum; search::SerialNum _currSerialNum; search::SerialNum _configSerialNum; - vespalib::string _subDbName; + std::string _subDbName; search::SerialNum nextSerialNum(); - std::vector getNames() const; + std::vector getNames() const; public: using SP = std::shared_ptr; AttributePopulator(const proton::IAttributeManager::SP &mgr, search::SerialNum initSerialNum, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum configSerialNum); ~AttributePopulator() override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.cpp index cf7f4b085c70..b4f8ed4ecc91 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.cpp @@ -5,7 +5,7 @@ namespace proton { -AttributeSpec::AttributeSpec(const vespalib::string &name, const Config &cfg) +AttributeSpec::AttributeSpec(const std::string &name, const Config &cfg) : _name(name), _cfg(std::make_unique(cfg)) { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.h index aa0ebfa7b38b..93a0fc47d092 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_spec.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::attribute { class Config; } @@ -17,14 +17,14 @@ class AttributeSpec { private: using Config = search::attribute::Config; - vespalib::string _name; + std::string _name; std::unique_ptr _cfg; public: - AttributeSpec(const vespalib::string &name, const search::attribute::Config &cfg); + AttributeSpec(const std::string &name, const search::attribute::Config &cfg); AttributeSpec(AttributeSpec &&) noexcept; AttributeSpec & operator=(AttributeSpec &&) noexcept; ~AttributeSpec(); - const vespalib::string &getName() const { return _name; } + const std::string &getName() const { return _name; } const Config &getConfig() const { return *_cfg; } bool operator==(const AttributeSpec &rhs) const; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.cpp index 31c546659d40..800c115457d5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.cpp @@ -19,8 +19,8 @@ AttributeUsageSamplerContext::~AttributeUsageSamplerContext() void AttributeUsageSamplerContext::merge(const search::AddressSpaceUsage &usage, - const vespalib::string &attributeName, - const vespalib::string &subDbName) + const std::string &attributeName, + const std::string &subDbName) { Guard guard(_lock); _usage.merge(usage, attributeName, subDbName); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.h index c2b53e763460..f9ccd3fc49d5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_context.h @@ -29,8 +29,8 @@ class AttributeUsageSamplerContext AttributeUsageSamplerContext(AttributeUsageFilter& filter); ~AttributeUsageSamplerContext(); void merge(const search::AddressSpaceUsage &usage, - const vespalib::string &attributeName, - const vespalib::string &subDbName); + const std::string &attributeName, + const std::string &subDbName); const AttributeUsageStats& getUsage() const { return _usage; } }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp index e1361f5625bf..b5463a008832 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp @@ -25,7 +25,7 @@ AttributeUsageSamplerFunctor::operator()(const search::attribute::IAttributeVect // Executed by attribute writer thread const auto & attributeVector = dynamic_cast(iAttributeVector); search::AddressSpaceUsage usage = attributeVector.getAddressSpaceUsage(); - vespalib::string attributeName = attributeVector.getName(); + std::string attributeName = attributeVector.getName(); _samplerContext->merge(usage, attributeName, _subDbName); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.cpp index 9e28fe95e019..d127bc718f98 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.cpp @@ -17,8 +17,8 @@ AttributeUsageStats::~AttributeUsageStats() = default; void AttributeUsageStats::merge(const search::AddressSpaceUsage &usage, - const vespalib::string &attributeName, - const vespalib::string &subDbName) + const std::string &attributeName, + const std::string &subDbName) { for (const auto& entry : usage.get_all()) { _max_usage.merge(entry.second, attributeName, entry.first, subDbName); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.h index 8742ffd95f4f..0b9a7c4354c8 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.h @@ -19,8 +19,8 @@ class AttributeUsageStats AttributeUsageStats(); ~AttributeUsageStats(); void merge(const search::AddressSpaceUsage &usage, - const vespalib::string &attributeName, - const vespalib::string &subDbName); + const std::string &attributeName, + const std::string &subDbName); const AddressSpaceUsageStats& max_address_space_usage() const { return _max_usage; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp index 8f75ddd13159..af10655b7a1c 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp @@ -108,7 +108,7 @@ convertPostingBaseToSlime(const IPostingListAttributeBase &postingBase, Cursor & convertMemoryUsageToSlime(memory_usage.bitvectors, cursor.setObject("bitvectors")); } -vespalib::string +std::string type_to_string(const Config& cfg) { if (cfg.basicType().type() == BasicType::TENSOR) { @@ -117,8 +117,8 @@ type_to_string(const Config& cfg) if (cfg.collectionType().type() == CollectionType::SINGLE) { return cfg.basicType().asString(); } - return vespalib::string(cfg.collectionType().asString()) + - "<" + vespalib::string(cfg.basicType().asString()) + ">"; + return std::string(cfg.collectionType().asString()) + + "<" + std::string(cfg.basicType().asString()) + ">"; } void diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 99cc924f67eb..4849dc5a9a43 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -61,7 +61,7 @@ AttributeWriter::WriteField::WriteField(AttributeVector &attribute) _structFieldAttribute(false), _use_two_phase_put(use_two_phase_put_for_attribute(attribute)) { - const vespalib::string &name = attribute.getName(); + const std::string &name = attribute.getName(); _structFieldAttribute = search::attribute::isStructFieldAttribute(name); } @@ -70,7 +70,7 @@ AttributeWriter::WriteField::~WriteField() = default; void AttributeWriter::WriteField::buildFieldPath(const DocumentType &docType) const { - const vespalib::string &name = _attribute.getName(); + const std::string &name = _attribute.getName(); FieldPath fp; try { docType.buildFieldPath(fp, name); @@ -303,7 +303,7 @@ BatchUpdateTask::~BatchUpdateTask() = default; class FieldContext { - vespalib::string _name; + std::string _name; ExecutorId _executorId; AttributeVector *_attr; bool _use_two_phase_put; @@ -693,7 +693,7 @@ AttributeWriter::getWritableAttributes() const search::AttributeVector * -AttributeWriter::getWritableAttribute(const vespalib::string &name) const +AttributeWriter::getWritableAttribute(const std::string &name) const { return _mgr->getWritableAttribute(name); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h index cabae56bdd9e..9dd0fb9b5f68 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h @@ -81,7 +81,7 @@ class AttributeWriter : public IAttributeWriter ExecutorId executor_id_in); }; private: - using AttrMap = vespalib::hash_map; + using AttrMap = vespalib::hash_map; std::vector _writeContexts; bool _hasStructFieldAttribute; AttrMap _attrMap; @@ -102,7 +102,7 @@ class AttributeWriter : public IAttributeWriter * Implements IAttributeWriter. */ std::vector getWritableAttributes() const override; - search::AttributeVector *getWritableAttribute(const vespalib::string &name) const override; + search::AttributeVector *getWritableAttribute(const std::string &name) const override; void put(SerialNum serialNum, const Document &doc, DocumentIdT lid, OnWriteDoneType onWriteDone) override; void remove(SerialNum serialNum, DocumentIdT lid, OnWriteDoneType onWriteDone) override; void remove(const LidVector &lidVector, SerialNum serialNum, OnWriteDoneType onWriteDone) override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp index 317d5affd495..a24056543790 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp @@ -8,7 +8,7 @@ namespace proton { -AttributeDiskLayout::AttributeDiskLayout(const vespalib::string &baseDir, PrivateConstructorTag) +AttributeDiskLayout::AttributeDiskLayout(const std::string &baseDir, PrivateConstructorTag) : _baseDir(baseDir), _mutex(), _dirs() @@ -19,10 +19,10 @@ AttributeDiskLayout::AttributeDiskLayout(const vespalib::string &baseDir, Privat AttributeDiskLayout::~AttributeDiskLayout() = default; -std::vector +std::vector AttributeDiskLayout::listAttributes() { - std::vector attributes; + std::vector attributes; std::shared_lock guard(_mutex); for (const auto &dir : _dirs) { attributes.emplace_back(dir.first); @@ -42,7 +42,7 @@ AttributeDiskLayout::scanDir() } std::shared_ptr -AttributeDiskLayout::getAttributeDir(const vespalib::string &name) +AttributeDiskLayout::getAttributeDir(const std::string &name) { std::shared_lock guard(_mutex); auto itr = _dirs.find(name); @@ -54,7 +54,7 @@ AttributeDiskLayout::getAttributeDir(const vespalib::string &name) } std::shared_ptr -AttributeDiskLayout::createAttributeDir(const vespalib::string &name) +AttributeDiskLayout::createAttributeDir(const std::string &name) { std::lock_guard guard(_mutex); auto itr = _dirs.find(name); @@ -69,7 +69,7 @@ AttributeDiskLayout::createAttributeDir(const vespalib::string &name) } void -AttributeDiskLayout::removeAttributeDir(const vespalib::string &name, search::SerialNum serialNum) +AttributeDiskLayout::removeAttributeDir(const std::string &name, search::SerialNum serialNum) { auto dir = getAttributeDir(name); if (dir) { @@ -96,7 +96,7 @@ AttributeDiskLayout::removeAttributeDir(const vespalib::string &name, search::Se } std::shared_ptr -AttributeDiskLayout::create(const vespalib::string &baseDir) +AttributeDiskLayout::create(const std::string &baseDir) { auto diskLayout = std::make_shared(baseDir, PrivateConstructorTag()); diskLayout->scanDir(); @@ -104,7 +104,7 @@ AttributeDiskLayout::create(const vespalib::string &baseDir) } std::shared_ptr -AttributeDiskLayout::createSimple(const vespalib::string &baseDir) +AttributeDiskLayout::createSimple(const std::string &baseDir) { auto diskLayout = std::make_shared(baseDir, PrivateConstructorTag()); return diskLayout; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h index f00c5dc3ec88..385a9cd9929a 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h @@ -3,12 +3,12 @@ #pragma once #include -#include +#include +#include #include #include -#include +#include #include -#include namespace proton { @@ -19,22 +19,22 @@ class AttributeDirectory; class AttributeDiskLayout : public std::enable_shared_from_this { private: - const vespalib::string _baseDir; + const std::string _baseDir; mutable std::shared_mutex _mutex; - std::map> _dirs; + std::map> _dirs; void scanDir(); struct PrivateConstructorTag { }; public: - explicit AttributeDiskLayout(const vespalib::string &baseDir, PrivateConstructorTag tag); + explicit AttributeDiskLayout(const std::string &baseDir, PrivateConstructorTag tag); ~AttributeDiskLayout(); - std::vector listAttributes(); - const vespalib::string &getBaseDir() const { return _baseDir; } - std::shared_ptr getAttributeDir(const vespalib::string &name); - std::shared_ptr createAttributeDir(const vespalib::string &name); - void removeAttributeDir(const vespalib::string &name, search::SerialNum serialNum); - static std::shared_ptr create(const vespalib::string &baseDir); - static std::shared_ptr createSimple(const vespalib::string &baseDir); + std::vector listAttributes(); + const std::string &getBaseDir() const { return _baseDir; } + std::shared_ptr getAttributeDir(const std::string &name); + std::shared_ptr createAttributeDir(const std::string &name); + void removeAttributeDir(const std::string &name, search::SerialNum serialNum); + static std::shared_ptr create(const std::string &baseDir); + static std::shared_ptr createSimple(const std::string &baseDir); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index 6848bb98cf9c..4613701b97bb 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -72,7 +72,7 @@ allocShrinker(const AttributeVector::SP &attr, vespalib::ISequencedTaskExecutor auto shrinkwrap = std::make_shared(attr, executor, executor.getExecutorIdFromName(attr->getNamePrefix())); - const vespalib::string &name = attr->getName(); + const std::string &name = attr->getName(); auto dir = diskLayout.createAttributeDir(name); search::SerialNum shrinkSerialNum = estimateShrinkSerialNum(*attr); return std::make_shared("attribute.shrink." + name, Type::GC, Component::ATTRIBUTE, shrinkSerialNum, dir->getLastFlushTime(), shrinkwrap); @@ -125,7 +125,7 @@ AttributeManager::internalAddAttribute(AttributeSpec && spec, uint64_t serialNum, const IAttributeFactory &factory) { - vespalib::string name = spec.getName(); + std::string name = spec.getName(); AttributeInitializer initializer(_diskLayout->createAttributeDir(name), _documentSubDbName, std::move(spec), serialNum, factory, _shared_executor); AttributeInitializerResult result = initializer.init(); if (result) { @@ -141,7 +141,7 @@ AttributeManager::addAttribute(AttributeWrap attributeWrap, const ShrinkerSP &sh { AttributeVector::SP attribute = attributeWrap.getAttribute(); bool isExtra = attributeWrap.isExtra(); - const vespalib::string &name = attribute->getName(); + const std::string &name = attribute->getName(); LOG(debug, "Adding attribute vector '%s'", name.c_str()); _attributes[name] = std::move(attributeWrap); assert(attribute->getInterlock() == _interlock); @@ -164,7 +164,7 @@ AttributeManager::findAttribute(std::string_view name) const } const AttributeManager::FlushableWrap * -AttributeManager::findFlushable(const vespalib::string &name) const +AttributeManager::findFlushable(const std::string &name) const { auto itr = _flushables.find(name); return (itr != _flushables.end()) ? &itr->second : nullptr; @@ -242,8 +242,8 @@ AttributeManager::transferExtraAttributes(const AttributeManager &currMgr) } } -AttributeManager::AttributeManager(const vespalib::string &baseDir, - const vespalib::string &documentSubDbName, +AttributeManager::AttributeManager(const std::string &baseDir, + const std::string &documentSubDbName, const TuneFileAttributes &tuneFileAttributes, const FileHeaderContext &fileHeaderContext, std::shared_ptr interlock, @@ -267,8 +267,8 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, { } -AttributeManager::AttributeManager(const vespalib::string &baseDir, - const vespalib::string &documentSubDbName, +AttributeManager::AttributeManager(const std::string &baseDir, + const std::string &documentSubDbName, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext &fileHeaderContext, std::shared_ptr interlock, @@ -371,14 +371,14 @@ AttributeManager::flushAll(SerialNum currentSerial) } FlushableAttribute::SP -AttributeManager::getFlushable(const vespalib::string &name) +AttributeManager::getFlushable(const std::string &name) { auto wrap = findFlushable(name); return ((wrap != nullptr) ? wrap->getFlusher() : FlushableAttribute::SP()); } AttributeManager::ShrinkerSP -AttributeManager::getShrinker(const vespalib::string &name) +AttributeManager::getShrinker(const std::string &name) { auto wrap = findFlushable(name); return ((wrap != nullptr) ? wrap->getShrinker() : ShrinkerSP()); @@ -524,7 +524,7 @@ AttributeManager::getFlushTargets() const } search::SerialNum -AttributeManager::getFlushedSerialNum(const vespalib::string &name) const +AttributeManager::getFlushedSerialNum(const std::string &name) const { auto wrap = findFlushable(name); if (wrap != nullptr) { @@ -568,7 +568,7 @@ AttributeManager::getAttributeListAll(std::vector &list) const void AttributeManager::pruneRemovedFields(search::SerialNum serialNum) { - std::vector attributes = _diskLayout->listAttributes(); + std::vector attributes = _diskLayout->listAttributes(); for (const auto &attribute : attributes) { auto itr = _attributes.find(attribute); if (itr == _attributes.end()) { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h index ee886d90e02a..3f9faa7aeffa 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h @@ -74,14 +74,14 @@ class AttributeManager : public proton::IAttributeManager const ShrinkerSP &getShrinker() const { return _shrinker; } }; - using AttributeMap = vespalib::hash_map; - using FlushableMap = vespalib::hash_map; + using AttributeMap = vespalib::hash_map; + using FlushableMap = vespalib::hash_map; AttributeMap _attributes; FlushableMap _flushables; std::vector _writableAttributes; std::shared_ptr _diskLayout; - vespalib::string _documentSubDbName; + std::string _documentSubDbName; const search::TuneFileAttributes _tuneFileAttributes; const search::common::FileHeaderContext &_fileHeaderContext; std::shared_ptr _factory; @@ -94,15 +94,15 @@ class AttributeManager : public proton::IAttributeManager AttributeVectorSP internalAddAttribute(AttributeSpec && spec, uint64_t serialNum, const IAttributeFactory &factory); void addAttribute(AttributeWrap attribute, const ShrinkerSP &shrinker); AttributeVectorSP findAttribute(std::string_view name) const; - const FlushableWrap *findFlushable(const vespalib::string &name) const; + const FlushableWrap *findFlushable(const std::string &name) const; Spec::AttributeList transferExistingAttributes(const AttributeManager &currMgr, Spec::AttributeList && newAttributes); void addNewAttributes(const Spec &newSpec, Spec::AttributeList && toBeAdded, IAttributeInitializerRegistry &initializerRegistry); void transferExtraAttributes(const AttributeManager &currMgr); public: using SP = std::shared_ptr; - AttributeManager(const vespalib::string &baseDir, - const vespalib::string &documentSubDbName, + AttributeManager(const std::string &baseDir, + const std::string &documentSubDbName, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, std::shared_ptr interlock, @@ -110,8 +110,8 @@ class AttributeManager : public proton::IAttributeManager vespalib::Executor& shared_executor, const vespalib::HwInfo &hwInfo); - AttributeManager(const vespalib::string &baseDir, - const vespalib::string &documentSubDbName, + AttributeManager(const std::string &baseDir, + const std::string &documentSubDbName, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, std::shared_ptr interlock, @@ -132,9 +132,9 @@ class AttributeManager : public proton::IAttributeManager void flushAll(SerialNum currentSerial); - FlushableAttributeSP getFlushable(const vespalib::string &name); + FlushableAttributeSP getFlushable(const std::string &name); - ShrinkerSP getShrinker(const vespalib::string &name); + ShrinkerSP getShrinker(const std::string &name); size_t getNumDocs() const; @@ -158,7 +158,7 @@ class AttributeManager : public proton::IAttributeManager std::vector getFlushTargets() const override; - search::SerialNum getFlushedSerialNum(const vespalib::string &name) const override; + search::SerialNum getFlushedSerialNum(const std::string &name) const override; SerialNum getOldestFlushedSerialNumber() const override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.h b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.h index b8ca9f5ace63..1320c94fed1f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.h @@ -21,7 +21,7 @@ class AttributesConfigScout private: const AttributesConfig &_live; - std::map _map; + std::map _map; static void adjust(AttributesConfig::Attribute &attr, diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h index 2867513cd033..73fb29ba4f03 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include +#include namespace document { @@ -23,7 +23,7 @@ namespace proton { class DocumentFieldExtractor { const document::Document &_doc; - vespalib::hash_map> _cachedFieldValues; + vespalib::hash_map> _cachedFieldValues; const document::FieldValue *getCachedFieldValue(const document::FieldPathEntry &fieldPathEntry); std::unique_ptr getSimpleFieldValue(const document::FieldPath &fieldPath); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.cpp index 00ece6365106..cbd91efe6568 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.cpp @@ -14,18 +14,18 @@ namespace proton { namespace { -vespalib::string -getFieldName(const vespalib::string &subDbName, - const vespalib::string &fieldName) +std::string +getFieldName(const std::string &subDbName, + const std::string &fieldName) { return subDbName + ".documentfield." + fieldName; } } -DocumentFieldPopulator::DocumentFieldPopulator(const vespalib::string &fieldName, +DocumentFieldPopulator::DocumentFieldPopulator(const std::string &fieldName, AttributeVectorSP attr, - const vespalib::string &subDbName) + const std::string &subDbName) : _fieldName(fieldName), _attr(attr), _subDbName(subDbName), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h index 9aac95918170..1b9c5642f744 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h @@ -14,15 +14,15 @@ class DocumentFieldPopulator : public IReprocessingRewriter { private: using AttributeVectorSP = std::shared_ptr; - vespalib::string _fieldName; + std::string _fieldName; AttributeVectorSP _attr; - vespalib::string _subDbName; + std::string _subDbName; int64_t _documentsPopulated; public: - DocumentFieldPopulator(const vespalib::string &fieldName, + DocumentFieldPopulator(const std::string &fieldName, AttributeVectorSP attr, - const vespalib::string &subDbName); + const std::string &subDbName); ~DocumentFieldPopulator() override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp index 819562b475c4..e2ad294b045e 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp @@ -14,15 +14,15 @@ namespace proton { namespace { -const vespalib::string FLUSH_TARGET_NAME_PREFIX("attribute.flush."); -const vespalib::string SHRINK_TARGET_NAME_PREFIX("attribute.shrink."); +const std::string FLUSH_TARGET_NAME_PREFIX("attribute.flush."); +const std::string SHRINK_TARGET_NAME_PREFIX("attribute.shrink."); class FlushTargetFilter { - const vespalib::string &_prefix; + const std::string &_prefix; const IFlushTarget::Type _type; public: - FlushTargetFilter(const vespalib::string &prefix, IFlushTarget::Type type) + FlushTargetFilter(const std::string &prefix, IFlushTarget::Type type) : _prefix(prefix), _type(type) { @@ -30,7 +30,7 @@ class FlushTargetFilter ~FlushTargetFilter(); bool match(const IFlushTarget::SP &flushTarget) const { - const vespalib::string &targetName = flushTarget->getName(); + const std::string &targetName = flushTarget->getName(); if ((flushTarget->getType() != _type) || (flushTarget->getComponent() != IFlushTarget::Component::ATTRIBUTE)) { return false; @@ -38,8 +38,8 @@ class FlushTargetFilter return (targetName.substr(0, _prefix.size()) == _prefix); } - vespalib::string attributeName(const IFlushTarget::SP &flushTarget) { - const vespalib::string &targetName = flushTarget->getName(); + std::string attributeName(const IFlushTarget::SP &flushTarget) { + const std::string &targetName = flushTarget->getName(); return targetName.substr(_prefix.size()); } }; @@ -153,7 +153,7 @@ FilterAttributeManager::getAttributeList(std::vector &list) cons } search::SerialNum -FilterAttributeManager::getFlushedSerialNum(const vespalib::string &name) const +FilterAttributeManager::getFlushedSerialNum(const std::string &name) const { if (acceptAttribute(name)) { return _mgr->getFlushedSerialNum(name); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index 3a9cd2bcd0a4..e40b04ac07cf 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -37,7 +37,7 @@ class FlushableAttribute::Flusher : public Task { search::AttributeMemorySaveTarget _saveTarget; std::unique_ptr _saver; uint64_t _syncToken; - vespalib::string _flushFile; + std::string _flushFile; bool saveAttribute(); // not updating snap info. public: diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h index 77d345616908..74345897888b 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include namespace search { class AttributeVector; } namespace search::attribute { class Config; } @@ -21,7 +21,7 @@ struct IAttributeFactory using SP = std::shared_ptr; using AttributeVectorSP = std::shared_ptr; virtual ~IAttributeFactory() {} - virtual AttributeVectorSP create(const vespalib::string &name, + virtual AttributeVectorSP create(const std::string &name, const search::attribute::Config &cfg) const = 0; virtual void setupEmpty(const AttributeVectorSP &vec, std::optional serialNum) const = 0; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h index 444a068da761..4c63dd5be176 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h @@ -51,7 +51,7 @@ struct IAttributeManager : public search::IAttributeManager * Returns the flushed serial num for the given attribute. * Return 0 if attribute is not found. */ - virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const = 0; + virtual search::SerialNum getFlushedSerialNum(const std::string &name) const = 0; /** * Return the oldest flushed serial number among the underlying attribute vectors. diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_writer.h index 591383dc4d51..11301b3a4cdc 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_writer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_writer.h @@ -36,7 +36,7 @@ class IAttributeWriter { virtual ~IAttributeWriter() = default; virtual std::vector getWritableAttributes() const = 0; - virtual search::AttributeVector *getWritableAttribute(const vespalib::string &attrName) const = 0; + virtual search::AttributeVector *getWritableAttribute(const std::string &attrName) const = 0; virtual void put(SerialNum serialNum, const Document &doc, DocumentIdT lid, OnWriteDoneType onWriteDone) = 0; virtual void remove(SerialNum serialNum, DocumentIdT lid, OnWriteDoneType onWriteDone) = 0; virtual void remove(const LidVector &lidVector, SerialNum serialNum, OnWriteDoneType onWriteDone) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h b/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h index 5db8b264c98b..43f24475f6c4 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/ifieldupdatecallback.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search { class AttributeVector; } namespace document { class Field; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h index 102d621f047a..2a4830c097e2 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h @@ -33,7 +33,7 @@ class ImportedAttributesContext : public search::attribute::IAttributeContext { using IAttributeFunctor = search::attribute::IAttributeFunctor; using MetaStoreReadGuard = search::IDocumentMetaStoreContext::IReadGuard; - using AttributeCache = vespalib::hash_map>; + using AttributeCache = vespalib::hash_map>; using MetaStoreCache = std::unordered_map>; using LockGuard = std::lock_guard; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.cpp b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.cpp index 4b3ca3ba420c..2054607e63bc 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.cpp @@ -18,7 +18,7 @@ ImportedAttributesRepo::ImportedAttributesRepo() = default; ImportedAttributesRepo::~ImportedAttributesRepo() = default; void -ImportedAttributesRepo::add(const vespalib::string &name, ImportedAttributeVector::SP attr) +ImportedAttributesRepo::add(const std::string &name, ImportedAttributeVector::SP attr) { _repo[name] = std::move(attr); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.h b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.h index 4c345b5cec60..720859834f97 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_repo.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include #include namespace search::attribute { class ImportedAttributeVector; } @@ -15,7 +15,7 @@ namespace proton { class ImportedAttributesRepo { private: using ImportedAttributeVector = search::attribute::ImportedAttributeVector; - using Repo = vespalib::hash_map>; + using Repo = vespalib::hash_map>; Repo _repo; @@ -23,7 +23,7 @@ class ImportedAttributesRepo { using UP = std::unique_ptr; ImportedAttributesRepo(); ~ImportedAttributesRepo(); - void add(const vespalib::string &name, std::shared_ptr attr); + void add(const std::string &name, std::shared_ptr attr); const std::shared_ptr & get(std::string_view name) const; void getAll(std::vector> &result) const; size_t size() const noexcept { return _repo.size(); } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp index 6fe6348e831a..1b5aff3bd5c3 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp @@ -12,7 +12,7 @@ namespace proton { namespace { -vespalib::string +std::string bucketIdToString(const BucketId &bucketId) { vespalib::asciistream stream; @@ -21,7 +21,7 @@ bucketIdToString(const BucketId &bucketId) return stream.str(); } -vespalib::string +std::string checksumToString(storage::spi::BucketChecksum checksum) { vespalib::asciistream stream; diff --git a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp index 4f35ea1aa662..3105e051d88b 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp @@ -437,7 +437,7 @@ AttributeUpdater::updateValue(FloatingPointAttribute & vec, uint32_t lid, const namespace { -const vespalib::string & +const std::string & getString(const search::StringAttribute & attr, uint32_t lid, const FieldValue & val) { if ( ! val.isLiteral() ) { throw UpdateException(make_string("Can not update a string attribute '%s' for lid=%d from a non-literal fieldvalue: %s", @@ -451,7 +451,7 @@ getString(const search::StringAttribute & attr, uint32_t lid, const FieldValue & void AttributeUpdater::appendValue(StringAttribute & vec, uint32_t lid, const FieldValue & val, int weight) { - const vespalib::string & s = getString(vec, lid, val); + const std::string & s = getString(vec, lid, val); if (!vec.append(lid, s, weight)) { throw UpdateException(make_string("attribute append failed: %s[%u] = %s", vec.getName().c_str(), lid, s.c_str())); @@ -461,7 +461,7 @@ AttributeUpdater::appendValue(StringAttribute & vec, uint32_t lid, const FieldVa void AttributeUpdater::removeValue(StringAttribute & vec, uint32_t lid, const FieldValue & val) { - const vespalib::string & v = getString(vec, lid, val); + const std::string & v = getString(vec, lid, val); if (!vec.remove(lid, v, 1)) { throw UpdateException(make_string("attribute remove failed: %s[%u] = %s", vec.getName().c_str(), lid, v.c_str())); @@ -471,7 +471,7 @@ AttributeUpdater::removeValue(StringAttribute & vec, uint32_t lid, const FieldVa void AttributeUpdater::updateValue(StringAttribute & vec, uint32_t lid, const FieldValue & val) { - const vespalib::string & v = getString(vec, lid, val); + const std::string & v = getString(vec, lid, val); if (!vec.update(lid, v)) { throw UpdateException(make_string("attribute update failed: %s[%u] = %s", vec.getName().c_str(), lid, v.c_str())); @@ -481,7 +481,7 @@ AttributeUpdater::updateValue(StringAttribute & vec, uint32_t lid, const FieldVa namespace { void -validate_field_value_type(FieldValue::Type expectedType, const FieldValue& val, const vespalib::string& attr_type, const vespalib::string& value_type) +validate_field_value_type(FieldValue::Type expectedType, const FieldValue& val, const std::string& attr_type, const std::string& value_type) { if (!val.isA(expectedType)) { throw UpdateException( diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp index d22fed89ad1d..308a1c21aacf 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp @@ -27,8 +27,8 @@ using vespalib::IllegalStateException; using vespalib::make_string; AttributeFieldValueNode:: -AttributeFieldValueNode(const vespalib::string& doctype, - const vespalib::string& field, +AttributeFieldValueNode(const std::string& doctype, + const std::string& field, uint32_t attr_guard_index) : FieldValueNode(doctype, field), _attr_guard_index(attr_guard_index) diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h index 3a83c4aa50f4..8e614c2c1835 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h @@ -13,8 +13,8 @@ class AttributeFieldValueNode : public document::select::FieldValueNode public: // Precondition: attribute must be of a single-value type. - AttributeFieldValueNode(const vespalib::string& doctype, - const vespalib::string& field, + AttributeFieldValueNode(const std::string& doctype, + const std::string& field, uint32_t attr_guard_index); std::unique_ptr getValue(const Context &context) const override; diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp index e5873fc4fcb3..da01c5c60fc8 100644 --- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp @@ -26,7 +26,7 @@ namespace { class AttrVisitor : public document::select::CloningVisitor { public: - using AttrMap = std::map; + using AttrMap = std::map; AttrMap _amap; const search::IAttributeManager &_amgr; @@ -90,7 +90,7 @@ AttrVisitor::visitFieldValueNode(const FieldValueNode &expr) // Expression has survived select pruner, thus we know that field is // valid for document type. bool complex = false; - vespalib::string name = SelectUtils::extractFieldName(expr, complex); + std::string name = SelectUtils::extractFieldName(expr, complex); auto av = _amgr.readable_attribute_vector(name); if (av) { @@ -219,7 +219,7 @@ CachedSelect::CachedSelect() CachedSelect::~CachedSelect() = default; void -CachedSelect::set(const vespalib::string &selection, +CachedSelect::set(const std::string &selection, const document::IDocumentTypeRepo &repo) { try { @@ -235,8 +235,8 @@ CachedSelect::set(const vespalib::string &selection, void -CachedSelect::set(const vespalib::string &selection, - const vespalib::string &docTypeName, +CachedSelect::set(const std::string &selection, + const std::string &docTypeName, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, const search::IAttributeManager *amgr, diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.h b/searchcore/src/vespa/searchcore/proton/common/cachedselect.h index 1b68030f54be..d76eee9c9658 100644 --- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.h +++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include #include namespace document { @@ -99,11 +99,11 @@ class CachedSelect const std::unique_ptr &preDocOnlySelect() const { return _preDocOnlySelect; } const std::unique_ptr &preDocSelect() const { return _preDocSelect; } - void set(const vespalib::string &selection, + void set(const std::string &selection, const document::IDocumentTypeRepo &repo); - void set(const vespalib::string &selection, - const vespalib::string &docTypeName, + void set(const std::string &selection, + const std::string &docTypeName, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, const search::IAttributeManager *amgr, diff --git a/searchcore/src/vespa/searchcore/proton/common/config_hash.h b/searchcore/src/vespa/searchcore/proton/common/config_hash.h index 581621f88f7e..21c3d707c1e6 100644 --- a/searchcore/src/vespa/searchcore/proton/common/config_hash.h +++ b/searchcore/src/vespa/searchcore/proton/common/config_hash.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include #include namespace proton { @@ -14,11 +14,11 @@ namespace proton { */ template class ConfigHash { - vespalib::hash_map _hash; + vespalib::hash_map _hash; public: ConfigHash(const std::vector &config); ~ConfigHash(); - const Elem *lookup(const vespalib::string &name) const; + const Elem *lookup(const std::string &name) const; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp index 714ddd811fdb..dcf7a368151d 100644 --- a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp +++ b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp @@ -25,7 +25,7 @@ ConfigHash::~ConfigHash() template const Elem * -ConfigHash::lookup(const vespalib::string &name) const +ConfigHash::lookup(const std::string &name) const { auto itr = _hash.find(name); return ((itr == _hash.end()) ? nullptr : itr->second); diff --git a/searchcore/src/vespa/searchcore/proton/common/dbdocumentid.h b/searchcore/src/vespa/searchcore/proton/common/dbdocumentid.h index ce3b4f4c98e3..56ce097d0fca 100644 --- a/searchcore/src/vespa/searchcore/proton/common/dbdocumentid.h +++ b/searchcore/src/vespa/searchcore/proton/common/dbdocumentid.h @@ -39,7 +39,7 @@ class DbDocumentId { _lid == rhs._lid; } - vespalib::string toString() const { + std::string toString() const { return vespalib::make_string("subDbId=%u, lid=%u", _subDbId, _lid); } diff --git a/searchcore/src/vespa/searchcore/proton/common/doctypename.h b/searchcore/src/vespa/searchcore/proton/common/doctypename.h index a32573ba4e01..de51595d3240 100644 --- a/searchcore/src/vespa/searchcore/proton/common/doctypename.h +++ b/searchcore/src/vespa/searchcore/proton/common/doctypename.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace search::engine { class Request; } namespace document { class DocumentType; } @@ -10,7 +10,7 @@ namespace proton { class DocTypeName { - vespalib::string _name; + std::string _name; public: DocTypeName() noexcept : _name() { } @@ -18,13 +18,13 @@ class DocTypeName explicit DocTypeName(const search::engine::Request &request) noexcept; explicit DocTypeName(const document::DocumentType &docType) noexcept; - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } bool operator<(const DocTypeName &rhs) const { return _name < rhs._name; } - const vespalib::string & toString() const { return _name; } + const std::string & toString() const { return _name; } }; diff --git a/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.cpp b/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.cpp index 5054de54c6c3..5753023bceb6 100644 --- a/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.cpp @@ -17,7 +17,7 @@ DocumentTypeInspector::DocumentTypeInspector(const document::DocumentType &oldDo } bool -DocumentTypeInspector::hasUnchangedField(const vespalib::string &name) const +DocumentTypeInspector::hasUnchangedField(const std::string &name) const { FieldPath oldPath; FieldPath newPath; diff --git a/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.h b/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.h index 50591bc897f1..b8abf18beae0 100644 --- a/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.h +++ b/searchcore/src/vespa/searchcore/proton/common/document_type_inspector.h @@ -20,7 +20,7 @@ class DocumentTypeInspector : public IDocumentTypeInspector DocumentTypeInspector(const document::DocumentType &oldDocType, const document::DocumentType &newDocType); - virtual bool hasUnchangedField(const vespalib::string &name) const override; + virtual bool hasUnchangedField(const std::string &name) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp index fcf30c8bf0ea..47935156a7fb 100644 --- a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp @@ -15,7 +15,7 @@ using vespalib::count_ms; namespace { using search::SerialNum; -using vespalib::string; +using std::string; void doTransactionLogReplayStart(const string &domainName, SerialNum first, SerialNum last, const string &eventName) @@ -250,7 +250,7 @@ EventLogger::reprocessDocumentsComplete(const string &subDb, double visitCost, v } void -EventLogger::loadAttributeStart(const vespalib::string &subDbName, const vespalib::string &attrName) +EventLogger::loadAttributeStart(const std::string &subDbName, const std::string &attrName) { JSONStringer jstr; jstr.beginObject(); @@ -261,8 +261,8 @@ EventLogger::loadAttributeStart(const vespalib::string &subDbName, const vespali } void -EventLogger::loadAttributeComplete(const vespalib::string &subDbName, - const vespalib::string &attrName, vespalib::duration elapsedTime) +EventLogger::loadAttributeComplete(const std::string &subDbName, + const std::string &attrName, vespalib::duration elapsedTime) { JSONStringer jstr; jstr.beginObject(); @@ -276,7 +276,7 @@ EventLogger::loadAttributeComplete(const vespalib::string &subDbName, namespace { void -loadComponentStart(const vespalib::string &subDbName, const vespalib::string &componentName) +loadComponentStart(const std::string &subDbName, const std::string &componentName) { JSONStringer jstr; jstr.beginObject(); @@ -286,7 +286,7 @@ loadComponentStart(const vespalib::string &subDbName, const vespalib::string &co } void -loadComponentComplete(const vespalib::string &subDbName, const vespalib::string &componentName, vespalib::duration elapsedTime) +loadComponentComplete(const std::string &subDbName, const std::string &componentName, vespalib::duration elapsedTime) { JSONStringer jstr; jstr.beginObject(); @@ -299,25 +299,25 @@ loadComponentComplete(const vespalib::string &subDbName, const vespalib::string } void -EventLogger::loadDocumentMetaStoreStart(const vespalib::string &subDbName) +EventLogger::loadDocumentMetaStoreStart(const std::string &subDbName) { loadComponentStart(subDbName, "documentmetastore"); } void -EventLogger::loadDocumentMetaStoreComplete(const vespalib::string &subDbName, vespalib::duration elapsedTime) +EventLogger::loadDocumentMetaStoreComplete(const std::string &subDbName, vespalib::duration elapsedTime) { loadComponentComplete(subDbName, "documentmetastore", elapsedTime); } void -EventLogger::loadDocumentStoreStart(const vespalib::string &subDbName) +EventLogger::loadDocumentStoreStart(const std::string &subDbName) { loadComponentStart(subDbName, "documentstore"); } void -EventLogger::loadDocumentStoreComplete(const vespalib::string &subDbName, vespalib::duration elapsedTime) +EventLogger::loadDocumentStoreComplete(const std::string &subDbName, vespalib::duration elapsedTime) { loadComponentComplete(subDbName, "documentstore", elapsedTime); } diff --git a/searchcore/src/vespa/searchcore/proton/common/eventlogger.h b/searchcore/src/vespa/searchcore/proton/common/eventlogger.h index 9be75eb780c1..4aa31fe36853 100644 --- a/searchcore/src/vespa/searchcore/proton/common/eventlogger.h +++ b/searchcore/src/vespa/searchcore/proton/common/eventlogger.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include #include namespace proton { @@ -14,7 +14,7 @@ namespace proton { class EventLogger { private: using SerialNum = search::SerialNum; - using string = vespalib::string; + using string = std::string; public: static void transactionLogReplayComplete(const string &domainName, vespalib::duration elapsedTime); static void populateAttributeStart(const std::vector &names); @@ -46,13 +46,13 @@ class EventLogger { const string &outputPath, size_t outputPathElems); static void flushPrune(const string &name, SerialNum oldestFlushed); - static void loadAttributeStart(const vespalib::string &subDbName, const vespalib::string &attrName); - static void loadAttributeComplete(const vespalib::string &subDbName, - const vespalib::string &attrName, vespalib::duration elapsedTime); - static void loadDocumentMetaStoreStart(const vespalib::string &subDbName); - static void loadDocumentMetaStoreComplete(const vespalib::string &subDbName, vespalib::duration elapsedTime); - static void loadDocumentStoreStart(const vespalib::string &subDbName); - static void loadDocumentStoreComplete(const vespalib::string &subDbName, vespalib::duration elapsedTime); + static void loadAttributeStart(const std::string &subDbName, const std::string &attrName); + static void loadAttributeComplete(const std::string &subDbName, + const std::string &attrName, vespalib::duration elapsedTime); + static void loadDocumentMetaStoreStart(const std::string &subDbName); + static void loadDocumentMetaStoreComplete(const std::string &subDbName, vespalib::duration elapsedTime); + static void loadDocumentStoreStart(const std::string &subDbName); + static void loadDocumentStoreComplete(const std::string &subDbName, vespalib::duration elapsedTime); static void transactionLogPruneComplete(const string &domainName, SerialNum prunedSerial); }; diff --git a/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp b/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp index 0a89bb555756..ccd8f50b0395 100644 --- a/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/feeddebugger.cpp @@ -3,6 +3,7 @@ #include "feeddebugger.h" #include #include +#include namespace proton { @@ -11,7 +12,7 @@ namespace { void setupDebugging(std::vector & debugLidList) { - vespalib::string lidList = vespalib::safe_char_2_string(getenv("VESPA_PROTON_DEBUG_FEED_LID_LIST")); + std::string lidList = vespalib::safe_char_2_string(getenv("VESPA_PROTON_DEBUG_FEED_LID_LIST")); vespalib::StringTokenizer lidTokenizer(lidList); for (auto token : lidTokenizer) { vespalib::asciistream is(token); @@ -24,7 +25,7 @@ setupDebugging(std::vector & debugLidList) void setupDebugging(std::vector & debugLidList) { - vespalib::string lidList = vespalib::safe_char_2_string(getenv("VESPA_PROTON_DEBUG_FEED_DOCID_LIST")); + std::string lidList = vespalib::safe_char_2_string(getenv("VESPA_PROTON_DEBUG_FEED_DOCID_LIST")); vespalib::StringTokenizer lidTokenizer(lidList); for (auto i : lidTokenizer) { debugLidList.emplace_back(i); diff --git a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp index a043a917c56d..9bfd77edceb7 100644 --- a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp +++ b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp @@ -4,8 +4,8 @@ #include "doctypename.h" #include #include -#include #include +#include #include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp index c6f203051788..624d58740423 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp @@ -60,7 +60,7 @@ sampleCpuCores(const HwInfoSampler::Config &cfg, const vespalib::ResourceLimits& } std::unique_ptr -readConfig(const vespalib::string &path) { +readConfig(const std::string &path) { FileSpec spec(path + "/" + "hwinfo.cfg"); ConfigSubscriber s(spec); std::unique_ptr> handle = s.subscribe("hwinfo"); @@ -69,7 +69,7 @@ readConfig(const vespalib::string &path) { } -void writeConfig(const vespalib::string &path, +void writeConfig(const std::string &path, double diskWriteSpeed, Clock::time_point sampleTime) { HwinfoConfigBuilder builder; @@ -81,10 +81,10 @@ void writeConfig(const vespalib::string &path, } } -double measureDiskWriteSpeed(const vespalib::string &path, +double measureDiskWriteSpeed(const std::string &path, size_t diskWriteLen) { - vespalib::string fileName = path + "/hwinfo-writespeed"; + std::string fileName = path + "/hwinfo-writespeed"; size_t bufferLen = 1_Mi; Alloc buffer(Alloc::allocMMap(bufferLen)); memset(buffer.get(), 0, buffer.size()); @@ -114,7 +114,7 @@ double measureDiskWriteSpeed(const vespalib::string &path, } -HwInfoSampler::HwInfoSampler(const vespalib::string &path, +HwInfoSampler::HwInfoSampler(const std::string &path, const Config &config) : _hwInfo(), _sampleTime(), @@ -138,7 +138,7 @@ HwInfoSampler::setup(const HwInfo::Disk &disk, const HwInfo::Memory &memory, con } void -HwInfoSampler::setDiskWriteSpeed(const vespalib::string &path, const Config &config) +HwInfoSampler::setDiskWriteSpeed(const std::string &path, const Config &config) { if (config.diskWriteSpeedOverride != 0) { _diskWriteSpeed = config.diskWriteSpeedOverride; @@ -155,7 +155,7 @@ HwInfoSampler::setDiskWriteSpeed(const vespalib::string &path, const Config &con } void -HwInfoSampler::sampleDiskWriteSpeed(const vespalib::string &path, const Config &config) +HwInfoSampler::sampleDiskWriteSpeed(const std::string &path, const Config &config) { size_t minDiskWriteLen = 1_Mi; size_t diskWriteLen = config.diskSampleWriteSize; diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h index 7142135d7672..04b75c07fed5 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace proton { @@ -49,10 +49,10 @@ class HwInfoSampler double _diskWriteSpeed; void setup(const vespalib::HwInfo::Disk &disk, const vespalib::HwInfo::Memory &memory, const vespalib::HwInfo::Cpu &cpu); - void setDiskWriteSpeed(const vespalib::string &path, const Config &config); - void sampleDiskWriteSpeed(const vespalib::string &path, const Config &config); + void setDiskWriteSpeed(const std::string &path, const Config &config); + void sampleDiskWriteSpeed(const std::string &path, const Config &config); public: - HwInfoSampler(const vespalib::string &path, const Config &config); + HwInfoSampler(const std::string &path, const Config &config); ~HwInfoSampler(); const vespalib::HwInfo &hwInfo() const { return _hwInfo; } diff --git a/searchcore/src/vespa/searchcore/proton/common/i_document_type_inspector.h b/searchcore/src/vespa/searchcore/proton/common/i_document_type_inspector.h index ee2e8e54eab6..c7e44c11c546 100644 --- a/searchcore/src/vespa/searchcore/proton/common/i_document_type_inspector.h +++ b/searchcore/src/vespa/searchcore/proton/common/i_document_type_inspector.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace proton { @@ -16,7 +16,7 @@ struct IDocumentTypeInspector virtual ~IDocumentTypeInspector() =default; - virtual bool hasUnchangedField(const vespalib::string &name) const = 0; + virtual bool hasUnchangedField(const std::string &name) const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/i_indexschema_inspector.h b/searchcore/src/vespa/searchcore/proton/common/i_indexschema_inspector.h index 54340d27e29d..902af50ef2a9 100644 --- a/searchcore/src/vespa/searchcore/proton/common/i_indexschema_inspector.h +++ b/searchcore/src/vespa/searchcore/proton/common/i_indexschema_inspector.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace proton { @@ -12,7 +12,7 @@ namespace proton { class IIndexschemaInspector { public: virtual ~IIndexschemaInspector() { } - virtual bool isStringIndex(const vespalib::string &name) const = 0; + virtual bool isStringIndex(const std::string &name) const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.cpp b/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.cpp index d32469611f0f..1f8d8e319288 100644 --- a/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.cpp @@ -17,7 +17,7 @@ IndexschemaInspector::~IndexschemaInspector() } bool -IndexschemaInspector::isStringIndex(const vespalib::string &name) const +IndexschemaInspector::isStringIndex(const std::string &name) const { auto index = _hash.lookup(name); if (index != nullptr) { diff --git a/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.h b/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.h index f3a16ae6f56f..36bb7489c2ab 100644 --- a/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.h +++ b/searchcore/src/vespa/searchcore/proton/common/indexschema_inspector.h @@ -17,7 +17,7 @@ class IndexschemaInspector : public IIndexschemaInspector { public: IndexschemaInspector(const IndexschemaConfig &config); ~IndexschemaInspector(); - bool isStringIndex(const vespalib::string &name) const override; + bool isStringIndex(const std::string &name) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/common/select_utils.cpp b/searchcore/src/vespa/searchcore/proton/common/select_utils.cpp index c4d35a05d258..d6612b3ad5a4 100644 --- a/searchcore/src/vespa/searchcore/proton/common/select_utils.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/select_utils.cpp @@ -5,10 +5,10 @@ namespace proton { -vespalib::string +std::string SelectUtils::extractFieldName(const document::select::FieldValueNode &expr, bool &isComplex) { - vespalib::string result = expr.getFieldName(); + std::string result = expr.getFieldName(); isComplex = false; for (uint32_t i = 0; i < result.size(); ++i) { if (result[i] == '.' || result[i] == '{' || result[i] == '[') { diff --git a/searchcore/src/vespa/searchcore/proton/common/select_utils.h b/searchcore/src/vespa/searchcore/proton/common/select_utils.h index f79aac90facf..dab55612f116 100644 --- a/searchcore/src/vespa/searchcore/proton/common/select_utils.h +++ b/searchcore/src/vespa/searchcore/proton/common/select_utils.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace document::select { class FieldValueNode; } @@ -15,7 +15,7 @@ struct SelectUtils { /** * Extracts the field name of the FieldValueNode and signals whether it is complex or not. */ - static vespalib::string extractFieldName(const document::select::FieldValueNode &expr, bool &isComplex); + static std::string extractFieldName(const document::select::FieldValueNode &expr, bool &isComplex); }; diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp index 96dcb30a8b3e..9bb30d958601 100644 --- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp @@ -49,7 +49,7 @@ using search::attribute::CollectionType; namespace proton { -SelectPrunerBase::SelectPrunerBase(const vespalib::string &docType, +SelectPrunerBase::SelectPrunerBase(const std::string &docType, const search::IAttributeManager *amgr, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, @@ -74,7 +74,7 @@ SelectPrunerBase::SelectPrunerBase(const SelectPrunerBase &rhs) { } -SelectPruner::SelectPruner(const vespalib::string &docType, +SelectPruner::SelectPruner(const std::string &docType, const search::IAttributeManager *amgr, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, @@ -374,7 +374,7 @@ SelectPruner::visitFunctionValueNode(const FunctionValueNode &expr) return; // Can shortcut evaluation when function argument is invalid } ValueNode::UP child(std::move(_valueNode)); - const vespalib::string &funcName(expr.getFunctionName()); + const std::string &funcName(expr.getFunctionName()); _valueNode = std::make_unique(funcName, std::move(child)); if (_priority < FuncPriority) { _valueNode->setParentheses(); @@ -402,7 +402,7 @@ SelectPruner::visitFieldValueNode(const FieldValueNode &expr) } const document::DocumentType *docType = _repo.getDocumentType(_docType); bool complex = false; // Cannot handle attribute if complex expression - vespalib::string name = SelectUtils::extractFieldName(expr, complex); + std::string name = SelectUtils::extractFieldName(expr, complex); const bool is_imported = docType->has_imported_field_name(name); if (complex || !is_imported) { try { diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h index f831e390bfef..4326b574c1f0 100644 --- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h +++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h @@ -16,7 +16,7 @@ namespace proton { class SelectPrunerBase { protected: - const vespalib::string &_docType; + const std::string &_docType; const search::IAttributeManager *_amgr; const document::Document &_emptyDoc; const document::IDocumentTypeRepo &_repo; @@ -24,7 +24,7 @@ class SelectPrunerBase bool _hasDocuments; public: - SelectPrunerBase(const vespalib::string &docType, + SelectPrunerBase(const std::string &docType, const search::IAttributeManager *amgr, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, @@ -46,7 +46,7 @@ class SelectPruner : public document::select::CloningVisitor, using ValueNodeUP = document::select::ValueNode::UP; uint32_t _attrFieldNodes; public: - SelectPruner(const vespalib::string &docType, + SelectPruner(const std::string &docType, const search::IAttributeManager *amgr, const document::Document &emptyDoc, const document::IDocumentTypeRepo &repo, diff --git a/searchcore/src/vespa/searchcore/proton/common/statusreport.cpp b/searchcore/src/vespa/searchcore/proton/common/statusreport.cpp index 58f307ba2031..9a53be047247 100644 --- a/searchcore/src/vespa/searchcore/proton/common/statusreport.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/statusreport.cpp @@ -4,7 +4,7 @@ namespace proton { -StatusReport::Params::Params(const vespalib::string &component) +StatusReport::Params::Params(const std::string &component) : _component(component), _state(DOWN), _internalState(), diff --git a/searchcore/src/vespa/searchcore/proton/common/statusreport.h b/searchcore/src/vespa/searchcore/proton/common/statusreport.h index 196e792ed2a1..d48293f2b8a9 100644 --- a/searchcore/src/vespa/searchcore/proton/common/statusreport.h +++ b/searchcore/src/vespa/searchcore/proton/common/statusreport.h @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include #include +#include #include namespace proton { @@ -25,24 +25,24 @@ class StatusReport { }; struct Params { - vespalib::string _component; + std::string _component; State _state; - vespalib::string _internalState; - vespalib::string _internalConfigState; + std::string _internalState; + std::string _internalConfigState; float _progress; - vespalib::string _message; + std::string _message; - Params(const vespalib::string &component); + Params(const std::string &component); ~Params(); Params &state(State value) { _state = value; return *this; } - Params &internalState(const vespalib::string &value) { + Params &internalState(const std::string &value) { _internalState = value; return *this; } - Params &internalConfigState(const vespalib::string &value) { + Params &internalConfigState(const std::string &value) { _internalConfigState = value; return *this; } @@ -50,19 +50,19 @@ class StatusReport { _progress = value; return *this; } - Params &message(const vespalib::string &value) { + Params &message(const std::string &value) { _message = value; return *this; } }; private: - vespalib::string _component; + std::string _component; State _state; - vespalib::string _internalState; - vespalib::string _internalConfigState; + std::string _internalState; + std::string _internalConfigState; float _progress; - vespalib::string _message; + std::string _message; public: StatusReport(const Params ¶ms); @@ -72,7 +72,7 @@ class StatusReport { return std::make_unique(params); } - const vespalib::string &getComponent() const { + const std::string &getComponent() const { return _component; } @@ -80,11 +80,11 @@ class StatusReport { return _state; } - const vespalib::string &getInternalState() const { + const std::string &getInternalState() const { return _internalState; } - const vespalib::string &getInternalConfigState() const { + const std::string &getInternalConfigState() const { return _internalConfigState; } @@ -96,12 +96,12 @@ class StatusReport { return _progress; } - const vespalib::string &getMessage() const { + const std::string &getMessage() const { return _message; } - vespalib::string getInternalStatesStr() const { - vespalib::string retval = "state=" + _internalState; + std::string getInternalStatesStr() const { + std::string retval = "state=" + _internalState; if (!_internalConfigState.empty()) { retval = retval + " configstate=" + _internalConfigState; } diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp index 82c705443326..73d9aa96bcb6 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp @@ -14,7 +14,7 @@ LOG_SETUP(".proton.docsummary.docsumcontext"); using document::PositionDataType; using search::common::Location; -using vespalib::string; +using std::string; using vespalib::slime::SymbolTable; using vespalib::slime::NIX; using vespalib::Memory; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/document_store_explorer.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/document_store_explorer.cpp index 4b632a425f20..d2bf3f03ddb1 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/document_store_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/document_store_explorer.cpp @@ -43,7 +43,7 @@ DocumentStoreExplorer::get_state(const Inserter &inserter, bool full) const object.setLong("docIdLimit", storageStats.docIdLimit()); setMemoryUsage(object, store.getMemoryUsage()); if (full) { - const vespalib::string &baseDir = store.getBaseDir(); + const std::string &baseDir = store.getBaseDir(); std::vector chunks; chunks = store.getFileChunkStats(); Cursor &fileChunksArrayCursor = object.setArray("fileChunks"); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp index f927262e30c4..6be23a5b0e57 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp @@ -65,7 +65,7 @@ class CompactSpread : public Compacter { } -SummaryGCTarget::SummaryGCTarget(const vespalib::string & name, vespalib::Executor & summaryService, IDocumentStore & docStore) +SummaryGCTarget::SummaryGCTarget(const std::string & name, vespalib::Executor & summaryService, IDocumentStore & docStore) : LeafFlushTarget(name, Type::GC, Component::DOCUMENT_STORE), _summaryService(summaryService), _docStore(docStore), diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h index 4f73a5150ab4..2a16981e3750 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h @@ -26,7 +26,7 @@ class SummaryGCTarget : public searchcorespi::LeafFlushTarget { FlushStats getLastFlushStats() const override { return _lastStats; } uint64_t getApproxBytesToWriteToDisk() const override { return 0; } protected: - SummaryGCTarget(const vespalib::string &, vespalib::Executor & summaryService, IDocumentStore & docStore); + SummaryGCTarget(const std::string &, vespalib::Executor & summaryService, IDocumentStore & docStore); private: virtual size_t getBloat(const IDocumentStore & docStore) const = 0; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp index 8a27c89cb653..ea3008004f01 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp @@ -48,7 +48,7 @@ class ShrinkSummaryLidSpaceFlushTarget : public ShrinkLidSpaceFlushTarget vespalib::Executor & _summaryService; public: - ShrinkSummaryLidSpaceFlushTarget(const vespalib::string &name, Type type, Component component, + ShrinkSummaryLidSpaceFlushTarget(const std::string &name, Type type, Component component, SerialNum flushedSerialNum, vespalib::system_time lastFlushTime, vespalib::Executor & summaryService, std::shared_ptr target); @@ -57,7 +57,7 @@ class ShrinkSummaryLidSpaceFlushTarget : public ShrinkLidSpaceFlushTarget }; ShrinkSummaryLidSpaceFlushTarget:: -ShrinkSummaryLidSpaceFlushTarget(const vespalib::string &name, Type type, Component component, +ShrinkSummaryLidSpaceFlushTarget(const std::string &name, Type type, Component component, SerialNum flushedSerialNum, vespalib::system_time lastFlushTime, vespalib::Executor & summaryService, std::shared_ptr target) @@ -80,7 +80,7 @@ ShrinkSummaryLidSpaceFlushTarget::initFlush(SerialNum currentSerial, std::shared } SummaryManager::SummarySetup:: -SummarySetup(const vespalib::string & baseDir, const SummaryConfig & summaryCfg, +SummarySetup(const std::string & baseDir, const SummaryConfig & summaryCfg, const JuniperrcConfig & juniperCfg, search::IAttributeManager::SP attributeMgr, search::IDocumentStore::SP docStore, std::shared_ptr repo, @@ -129,7 +129,7 @@ SummaryManager::createSummarySetup(const SummaryConfig & summaryCfg, } SummaryManager::SummaryManager(vespalib::Executor &shared_executor, const LogDocumentStore::Config & storeConfig, - const search::GrowStrategy & growStrategy, const vespalib::string &baseDir, + const search::GrowStrategy & growStrategy, const std::string &baseDir, const TuneFileSummary &tuneFileSummary, const FileHeaderContext &fileHeaderContext, search::transactionlog::SyncProxy &tlSyncer, search::IBucketizer::SP bucketizer) diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index 9a566895cf32..f1956fa04b7c 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -30,7 +30,7 @@ class SummaryManager : public ISummaryManager search::IDocumentStore::SP _docStore; const std::shared_ptr _repo; public: - SummarySetup(const vespalib::string & baseDir, + SummarySetup(const std::string & baseDir, const SummaryConfig & summaryCfg, const JuniperrcConfig & juniperCfg, search::IAttributeManager::SP attributeMgr, @@ -48,7 +48,7 @@ class SummaryManager : public ISummaryManager }; private: - vespalib::string _baseDir; + std::string _baseDir; std::shared_ptr _docStore; public: @@ -56,7 +56,7 @@ class SummaryManager : public ISummaryManager SummaryManager(vespalib::Executor &shared_executor, const search::LogDocumentStore::Config & summary, const search::GrowStrategy & growStrategy, - const vespalib::string &baseDir, + const std::string &baseDir, const search::TuneFileSummary &tuneFileSummary, const search::common::FileHeaderContext &fileHeaderContext, search::transactionlog::SyncProxy &tlSyncer, diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp index 150080b4cba5..c6c5528ad6ef 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp @@ -8,8 +8,8 @@ namespace proton { SummaryManagerInitializer:: SummaryManagerInitializer(const search::GrowStrategy &grow, - const vespalib::string & baseDir, - const vespalib::string &subDbName, + const std::string & baseDir, + const std::string &subDbName, vespalib::Executor &shared_executor, const search::LogDocumentStore::Config & storeCfg, const search::TuneFileSummary &tuneFile, diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.h index 855276ca60e5..e66462655356 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.h @@ -16,8 +16,8 @@ class SummaryManagerInitializer : public initializer::InitializerTask { using IBucketizerSP = std::shared_ptr; const search::GrowStrategy _grow; - const vespalib::string _baseDir; - const vespalib::string _subDbName; + const std::string _baseDir; + const std::string _subDbName; vespalib::Executor &_shared_executor; const search::LogDocumentStore::Config _storeCfg; const search::TuneFileSummary _tuneFile; @@ -31,8 +31,8 @@ class SummaryManagerInitializer : public initializer::InitializerTask // Note: lifetime of result must be handled by caller. SummaryManagerInitializer(const search::GrowStrategy &grow, - const vespalib::string & baseDir, - const vespalib::string &subDbName, + const std::string & baseDir, + const std::string &subDbName, vespalib::Executor &shared_executor, const search::LogDocumentStore::Config & storeCfg, const search::TuneFileSummary &tuneFile, diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index ca54079911cf..4d1b3f236c28 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -59,8 +59,8 @@ namespace proton { namespace documentmetastore { -vespalib::string DOCID_LIMIT("docIdLimit"); -vespalib::string VERSION("version"); +std::string DOCID_LIMIT("docIdLimit"); +std::string VERSION("version"); class Reader { private: @@ -411,11 +411,11 @@ DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB) : DocumentMetaStore(std::move(bucketDB), getFixedName()) {} -DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, const vespalib::string &name) +DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, const std::string &name) : DocumentMetaStore(std::move(bucketDB), name, search::GrowStrategy()) {} DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, - const vespalib::string &name, + const std::string &name, const GrowStrategy &grow, SubDbType subDbType) : DocumentMetaStoreAttribute(name), diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 42eb01c18e96..410cd8d1550b 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -147,9 +147,9 @@ class DocumentMetaStore final : public DocumentMetaStoreAttribute, sizeof(Timestamp); explicit DocumentMetaStore(BucketDBOwnerSP bucketDB); - DocumentMetaStore(BucketDBOwnerSP bucketDB, const vespalib::string & name); + DocumentMetaStore(BucketDBOwnerSP bucketDB, const std::string & name); DocumentMetaStore(BucketDBOwnerSP bucketDB, - const vespalib::string & name, + const std::string & name, const search::GrowStrategy & grow, SubDbType subDbType = SubDbType::READY); ~DocumentMetaStore() override; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp index 8968a5cf33fc..a70a28a85882 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp @@ -7,17 +7,17 @@ namespace proton { namespace { -const vespalib::string documentMetaStoreName("[documentmetastore]"); +const std::string documentMetaStoreName("[documentmetastore]"); } -const vespalib::string & +const std::string & DocumentMetaStoreAttribute::getFixedName() { return documentMetaStoreName; } -DocumentMetaStoreAttribute::DocumentMetaStoreAttribute(const vespalib::string &name) +DocumentMetaStoreAttribute::DocumentMetaStoreAttribute(const std::string &name) : NotImplementedAttribute(name, Config(BasicType::NONE)) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h index 4fc86001b80e..fd904da84b70 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h @@ -14,10 +14,10 @@ namespace proton { class DocumentMetaStoreAttribute : public search::NotImplementedAttribute { public: - explicit DocumentMetaStoreAttribute(const vespalib::string &name); + explicit DocumentMetaStoreAttribute(const std::string &name); ~DocumentMetaStoreAttribute() override; - static const vespalib::string &getFixedName(); + static const std::string &getFixedName(); size_t getFixedWidth() const override { return document::GlobalId::LENGTH; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp index 73901796c8f9..95f3e9c689b8 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp @@ -21,7 +21,7 @@ DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr bucketDB, - const vespalib::string &name, + const std::string &name, const search::GrowStrategy &grow) : _metaStoreAttr(std::make_shared(std::move(bucketDB), name, grow)), _metaStore(std::dynamic_pointer_cast(_metaStoreAttr)) diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index daebd05ada11..5022fd619e01 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -35,7 +35,7 @@ class DocumentMetaStoreContext : public IDocumentMetaStoreContext * with the given name, grow strategy, and comparator. */ DocumentMetaStoreContext(std::shared_ptr bucketDB, - const vespalib::string &name, + const std::string &name, const search::GrowStrategy &grow); ~DocumentMetaStoreContext() override; /** diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp index cd9e60f87b2e..b72c393facc8 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp @@ -33,7 +33,7 @@ class DocumentMetaStoreFlushTarget::Flusher : public Task { DocumentMetaStoreFlushTarget &_dmsft; std::unique_ptr _saver; uint64_t _syncToken; - vespalib::string _flushDir; + std::string _flushDir; bool saveDocumentMetaStore(); // not updating snap info. public: @@ -59,7 +59,7 @@ Flusher(DocumentMetaStoreFlushTarget &dmsft, DocumentMetaStore &dms = *_dmsft._dms; dms.commit(CommitParam(syncToken)); _flushDir = writer.getSnapshotDir(syncToken); - vespalib::string newBaseFileName(_flushDir + "/" + dms.getName()); + std::string newBaseFileName(_flushDir + "/" + dms.getName()); _saver = dms.initSave(newBaseFileName); assert(_saver); } @@ -92,7 +92,7 @@ DocumentMetaStoreFlushTarget::Flusher::flush(AttributeDirectory::Writer &writer) { writer.createInvalidSnapshot(_syncToken); if (!saveDocumentMetaStore()) { - vespalib::string baseFileName(_flushDir + "/" + _dmsft._dms->getName()); + std::string baseFileName(_flushDir + "/" + _dmsft._dms->getName()); LOG(warning, "Could not write document meta store '%s' to disk", baseFileName.c_str()); return false; } @@ -148,7 +148,7 @@ DocumentMetaStoreFlushTarget::Flusher::run() DocumentMetaStoreFlushTarget:: DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, ITlsSyncer &tlsSyncer, - const vespalib::string & baseDir, const TuneFileAttributes &tuneFileAttributes, + const std::string & baseDir, const TuneFileAttributes &tuneFileAttributes, const FileHeaderContext &fileHeaderContext, const vespalib::HwInfo &hwInfo) : LeafFlushTarget("documentmetastore.flush", Type::SYNC, Component::ATTRIBUTE), _dms(dms), diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h index 46ea4607ba62..12f26cffdfea 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h @@ -31,7 +31,7 @@ class DocumentMetaStoreFlushTarget : public searchcorespi::LeafFlushTarget DocumentMetaStoreSP _dms; ITlsSyncer &_tlsSyncer; - vespalib::string _baseDir; + std::string _baseDir; bool _cleanUpAfterFlush; FlushStats _lastStats; const search::TuneFileAttributes _tuneFileAttributes; @@ -48,7 +48,7 @@ class DocumentMetaStoreFlushTarget : public searchcorespi::LeafFlushTarget * given base dir where all attribute vectors are located. **/ DocumentMetaStoreFlushTarget(const DocumentMetaStoreSP dms, ITlsSyncer &tlsSyncer, - const vespalib::string &baseDir, const search::TuneFileAttributes &tuneFileAttributes, + const std::string &baseDir, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext &fileHeaderContext, const vespalib::HwInfo &hwInfo); ~DocumentMetaStoreFlushTarget() override; @@ -64,7 +64,7 @@ class DocumentMetaStoreFlushTarget : public searchcorespi::LeafFlushTarget Task::UP initFlush(SerialNum currentSerial, std::shared_ptr flush_token) override; FlushStats getLastFlushStats() const override { return _lastStats; } - static void initCleanup(const vespalib::string &baseDir); + static void initCleanup(const std::string &baseDir); uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp index 0e1a96f8de14..a4084782f49d 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp @@ -16,9 +16,9 @@ using vespalib::make_string; namespace proton::documentmetastore { DocumentMetaStoreInitializer:: -DocumentMetaStoreInitializer(const vespalib::string baseDir, - const vespalib::string &subDbName, - const vespalib::string &docTypeName, +DocumentMetaStoreInitializer(const std::string baseDir, + const std::string &subDbName, + const std::string &docTypeName, std::shared_ptr dms) : _baseDir(baseDir), _subDbName(subDbName), @@ -27,7 +27,7 @@ DocumentMetaStoreInitializer(const vespalib::string baseDir, { } namespace { -vespalib::string +std::string failedMsg(const char * msg) { return make_string("Failed to load document meta store for document type '%s' from disk", msg); } @@ -36,12 +36,12 @@ failedMsg(const char * msg) { void DocumentMetaStoreInitializer::run() { - vespalib::string name = DocumentMetaStore::getFixedName(); + std::string name = DocumentMetaStore::getFixedName(); IndexMetaInfo info(_baseDir); if (info.load()) { IndexMetaInfo::Snapshot snap = info.getBestSnapshot(); if (snap.valid) { - vespalib::string attrFileName = _baseDir + "/" + snap.dirName + "/" + name; + std::string attrFileName = _baseDir + "/" + snap.dirName + "/" + name; _dms->setBaseFileName(attrFileName); assert(_dms->hasLoadData()); vespalib::Timer stopWatch; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.h index fb9720122d9e..3d6214cad170 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.h @@ -4,7 +4,7 @@ #include #include -#include +#include namespace proton { class DocumentMetaStore; } namespace proton::documentmetastore { @@ -15,18 +15,18 @@ namespace proton::documentmetastore { */ class DocumentMetaStoreInitializer : public initializer::InitializerTask { - vespalib::string _baseDir; - vespalib::string _subDbName; - vespalib::string _docTypeName; + std::string _baseDir; + std::string _subDbName; + std::string _docTypeName; std::shared_ptr _dms; public: using SP = std::shared_ptr; // Note: lifetime of result must be handled by caller. - DocumentMetaStoreInitializer(const vespalib::string baseDir, - const vespalib::string &subDbName, - const vespalib::string &docTypeName, + DocumentMetaStoreInitializer(const std::string baseDir, + const std::string &subDbName, + const std::string &docTypeName, std::shared_ptr dms); void run() override; }; diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp index a1ce680f5708..ff1a90e649c8 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp @@ -34,7 +34,7 @@ CompactLidSpaceOperation::deserialize(vespalib::nbostream& is, const document::D is >> _lidLimit; } -vespalib::string +std::string CompactLidSpaceOperation::toString() const { return vespalib::make_string("CompactLidSpace(subDbId=%u, lidLimit=%u, serialNum=%" PRIu64 ")", diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h index 21f394de0eaa..cb50c4f56e6d 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h @@ -21,7 +21,7 @@ class CompactLidSpaceOperation : public FeedOperation void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &) override; - vespalib::string toString() const override; + std::string toString() const override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.cpp index e0a94a3ceddb..aac01680a274 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.cpp @@ -39,7 +39,7 @@ CreateBucketOperation::deserialize(vespalib::nbostream &is, is >> _bucketId; } -vespalib::string CreateBucketOperation::toString() const { +std::string CreateBucketOperation::toString() const { return make_string("CreateBucket(%s, serialNum=%" PRIu64 ")", _bucketId.toString().c_str(), getSerialNum()); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h index 784ed2979bde..3d8c1cf352f1 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h @@ -17,7 +17,7 @@ class CreateBucketOperation : public FeedOperation const document::BucketId &getBucketId() const { return _bucketId; } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.cpp index 50ca4acbd0aa..c941e710c02a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.cpp @@ -41,7 +41,7 @@ DeleteBucketOperation::deserialize(vespalib::nbostream &is, deserializeLidsToRemove(is); } -vespalib::string DeleteBucketOperation::toString() const { +std::string DeleteBucketOperation::toString() const { return make_string("DeleteBucket(%s, serialNum=%" PRIu64 ")", _bucketId.toString().c_str(), getSerialNum()); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h index 63e70a0aeee1..87a0091d4929 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h @@ -18,7 +18,7 @@ class DeleteBucketOperation : public RemoveDocumentsOperation virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const override; + virtual std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.cpp index 24fc849dc2e1..76f589ecb63e 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.cpp @@ -59,7 +59,7 @@ DocumentOperation::assertValidBucketId(const document::GlobalId &gid) const _bucketId.getRawId() == verId.getId()); } -vespalib::string DocumentOperation::docArgsToString() const { +std::string DocumentOperation::docArgsToString() const { return make_string("%s, timestamp=%" PRIu64 ", dbdId=(%s), prevDbdId=(%s), " "prevMarkedAsRemoved=%s, prevTimestamp=%" PRIu64 ", serialNum=%" PRIu64, _bucketId.toString().c_str(), _timestamp, diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h index c4f38b5978e6..1dd9c790298e 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h @@ -86,7 +86,7 @@ class DocumentOperation : public FeedOperation void assertValidBucketId(const document::DocumentId &docId) const; void assertValidBucketId(const document::GlobalId &docId) const; - vespalib::string docArgsToString() const; + std::string docArgsToString() const; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h index 607df8faa301..6fe9372ceec7 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace document { class DocumentTypeRepo; } namespace vespalib { class nbostream; } @@ -56,7 +56,7 @@ class FeedOperation SerialNum getSerialNum() const { return _serialNum; } virtual void serialize(vespalib::nbostream &os) const = 0; virtual void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) = 0; - virtual vespalib::string toString() const = 0; + virtual std::string toString() const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.cpp index a0fc69ba4635..9098b17c145f 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.cpp @@ -60,7 +60,7 @@ JoinBucketsOperation::deserialize(vespalib::nbostream &is, is >> _target; } -vespalib::string JoinBucketsOperation::toString() const { +std::string JoinBucketsOperation::toString() const { return make_string("JoinBuckets(source1=%s, source2=%s, target=%s, " "serialNum=%" PRIu64 ")", _source1.toString().c_str(), diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h index 70a8f6069242..3d2ef407da7e 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h @@ -24,7 +24,7 @@ class JoinBucketsOperation : public FeedOperation virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const override; + virtual std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp index 7e6baea07419..145a908f1aa6 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp @@ -54,7 +54,7 @@ MoveOperation::deserialize(vespalib::nbostream &is, _serializedDocSize = oldSize - is.size(); } -vespalib::string MoveOperation::toString() const { +std::string MoveOperation::toString() const { return make_string("Move(%s, %s)", _doc.get() ? _doc->getId().getScheme().toString().c_str() : "NULL", diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h index 5b811f88e3e8..17445f414715 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h @@ -28,7 +28,7 @@ class MoveOperation : public DocumentOperation } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.cpp index 17911d9cbbb0..20a255edacfb 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.cpp @@ -31,7 +31,7 @@ NewConfigOperation::deserialize(vespalib::nbostream &is, _streamHandler.deserializeConfig(getSerialNum(), is); } -vespalib::string NewConfigOperation::toString() const { +std::string NewConfigOperation::toString() const { return make_string("NewConfig(serialNum=%" PRIu64 ")", getSerialNum()); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h index c1b6fe2012f6..c29c072a5505 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h @@ -24,7 +24,7 @@ class NewConfigOperation : public FeedOperation ~NewConfigOperation() override {} void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.cpp index 23aaf1f133ce..5f7989135538 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.cpp @@ -13,7 +13,7 @@ NoopOperation::NoopOperation(SerialNum serialNum) setSerialNum(serialNum); } -vespalib::string NoopOperation::toString() const { +std::string NoopOperation::toString() const { return make_string("Noop(serialNum=%" PRIu64 ")", getSerialNum()); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h index 62937ab90fff..81fa6dc6a5bd 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h @@ -13,7 +13,7 @@ struct NoopOperation : FeedOperation { virtual void serialize(vespalib::nbostream &) const override {} virtual void deserialize(vespalib::nbostream &, const document::DocumentTypeRepo &) override {} - virtual vespalib::string toString() const override; + virtual std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp index 929d3cc5d74e..8b0f1193b031 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp @@ -49,7 +49,7 @@ PruneRemovedDocumentsOperation::deserialize(vespalib::nbostream &is, const Docum deserializeLidsToRemove(is); } -vespalib::string PruneRemovedDocumentsOperation::toString() const { +std::string PruneRemovedDocumentsOperation::toString() const { LidVectorContext::SP lids = getLidsToRemove(); return make_string("PruneRemovedDocuments(limitLid=%zu, subDbId=%d, " "serialNum=%" PRIu64 ")", diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h index ff73b2207070..a4c97bc07d8c 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h @@ -29,7 +29,7 @@ class PruneRemovedDocumentsOperation : public RemoveDocumentsOperation void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.cpp index e98385436847..445191e48d2b 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.cpp @@ -52,7 +52,7 @@ PutOperation::deserializeDocument(const DocumentTypeRepo &repo) _doc = std::move(fixedDoc); } -vespalib::string +std::string PutOperation::toString() const { return make_string("Put(%s, %s)", diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h index b24e3298ffed..db9d5e4ab809 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h @@ -19,7 +19,7 @@ class PutOperation : public DocumentOperation void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; void deserializeDocument(const document::DocumentTypeRepo &repo); - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp index 8bc1b7b0cb1a..733a83e810c0 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp @@ -32,7 +32,7 @@ RemoveOperationWithDocId::serialize(vespalib::nbostream &os) const assertValidBucketId(_docId); RemoveOperation::serialize(os); size_t oldSize = os.size(); - vespalib::string rawId = _docId.toString(); + std::string rawId = _docId.toString(); os.write(rawId.c_str(), rawId.size() + 1); _serializedDocSize = os.size() - oldSize; } @@ -47,7 +47,7 @@ RemoveOperationWithDocId::deserialize(vespalib::nbostream &is, const DocumentTyp _serializedDocSize = oldSize - is.size(); } -vespalib::string +std::string RemoveOperationWithDocId::toString() const { return make_string("Remove(%s, %s)", _docId.getScheme().toString().c_str(), docArgsToString().c_str()); @@ -93,7 +93,7 @@ RemoveOperationWithGid::deserialize(vespalib::nbostream &is, const DocumentTypeR _serializedDocSize = oldSize - is.size(); } -vespalib::string +std::string RemoveOperationWithGid::toString() const { return make_string("RemoveGid(%s, %s, %s)", _gid.toString().c_str(), _docType.c_str(), docArgsToString().c_str()); diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h index c6de1b9af08e..89a536d53e2e 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h @@ -29,7 +29,7 @@ class RemoveOperationWithDocId : public RemoveOperation { const document::GlobalId & getGlobalId() const override { return _docId.getGlobalId(); } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; bool hasDocType() const override { return _docId.hasDocType(); } std::string_view getDocType() const override { return _docId.getDocType(); } @@ -37,7 +37,7 @@ class RemoveOperationWithDocId : public RemoveOperation { class RemoveOperationWithGid : public RemoveOperation { document::GlobalId _gid; - vespalib::string _docType; + std::string _docType; public: RemoveOperationWithGid(); @@ -47,7 +47,7 @@ class RemoveOperationWithGid : public RemoveOperation { const document::GlobalId & getGlobalId() const override { return _gid; } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - vespalib::string toString() const override; + std::string toString() const override; bool hasDocType() const override { return true; } std::string_view getDocType() const override { return _docType; } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.cpp index a783d27a8a0e..2da09ced7e62 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.cpp @@ -65,7 +65,7 @@ SplitBucketOperation::deserialize(vespalib::nbostream &is, is >> _target2; } -vespalib::string SplitBucketOperation::toString() const { +std::string SplitBucketOperation::toString() const { return make_string("SplitBucket(source=%s, target1=%s, target2=%s, " "serialNum=%" PRIu64 ")", _source.toString().c_str(), diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h index 6cc16ec55936..540d683f54d2 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h @@ -24,7 +24,7 @@ class SplitBucketOperation : public FeedOperation virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const override; + virtual std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp index 813d21ad6536..28c7faec38d5 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp @@ -88,7 +88,7 @@ UpdateOperation::verifyUpdate(const DocumentTypeRepo &repo) _upd->eagerDeserialize(); // Will trigger exceptions if incompatible } -vespalib::string +std::string UpdateOperation::toString() const { return make_string("%s(%s, %s)", ((getType() == FeedOperation::UPDATE_42) ? "Update42" : "Update"), diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h index ac22dbe5f369..e663326a0b32 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h @@ -29,7 +29,7 @@ class UpdateOperation : public DocumentOperation void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; void verifyUpdate(const document::DocumentTypeRepo &repo); - vespalib::string toString() const override; + std::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.cpp index e0824f0d3ed2..f1fb1c6db852 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.cpp @@ -12,7 +12,7 @@ ActiveFlushStats::ActiveFlushStats() } void -ActiveFlushStats::set_start_time(const vespalib::string& handler_name, vespalib::system_time start_time) +ActiveFlushStats::set_start_time(const std::string& handler_name, vespalib::system_time start_time) { auto itr = _stats.find(handler_name); if (itr != _stats.end()) { @@ -25,7 +25,7 @@ ActiveFlushStats::set_start_time(const vespalib::string& handler_name, vespalib: } ActiveFlushStats::OptionalTime -ActiveFlushStats::oldest_start_time(const vespalib::string& handler_name) const +ActiveFlushStats::oldest_start_time(const std::string& handler_name) const { auto itr = _stats.find(handler_name); if (itr != _stats.end()) { @@ -36,5 +36,5 @@ ActiveFlushStats::oldest_start_time(const vespalib::string& handler_name) const } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, vespalib::system_time); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, vespalib::system_time); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.h b/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.h index 374cee9ffb37..efb88bf17046 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/active_flush_stats.h @@ -15,7 +15,7 @@ class ActiveFlushStats { using OptionalTime = std::optional; private: - using StatsMap = vespalib::hash_map; + using StatsMap = vespalib::hash_map; StatsMap _stats; public: @@ -24,8 +24,8 @@ class ActiveFlushStats { * Set the start time for a flush in the given flush handler. * A start time is only updated if it is older than the current oldest one. */ - void set_start_time(const vespalib::string& handler_name, vespalib::system_time start_time); - OptionalTime oldest_start_time(const vespalib::string& handler_name) const; + void set_start_time(const std::string& handler_name, vespalib::system_time start_time); + OptionalTime oldest_start_time(const std::string& handler_name) const; }; } diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.cpp index b1d1722b8fca..72a600afb795 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.cpp @@ -18,14 +18,14 @@ FlushContext::FlushContext( _lastSerial(lastSerial) { } -vespalib::string +std::string FlushContext::createName(const IFlushHandler & handler, const IFlushTarget & target) { return create_name(handler.getName(), target.getName()); } -vespalib::string -FlushContext::create_name(const vespalib::string& handler_name, - const vespalib::string& target_name) { +std::string +FlushContext::create_name(const std::string& handler_name, + const std::string& target_name) { return (handler_name + "." + target_name); } diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h index 4ceee985f59f..ccb41fa89511 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h @@ -13,7 +13,7 @@ namespace proton { class FlushContext { private: using IFlushTarget = searchcorespi::IFlushTarget; - vespalib::string _name; + std::string _name; IFlushHandler::SP _handler; IFlushTarget::SP _target; searchcorespi::FlushTask::UP _task; @@ -32,13 +32,13 @@ class FlushContext { * @param target The target to flush. * @return the name created. */ - static vespalib::string createName(const IFlushHandler & handler, const IFlushTarget & target); + static std::string createName(const IFlushHandler & handler, const IFlushTarget & target); /** * Create a combined name of the handler name and the target name. */ - static vespalib::string create_name(const vespalib::string& handler_name, - const vespalib::string& target_name); + static std::string create_name(const std::string& handler_name, + const std::string& target_name); /** * Constructs a new instance of this class. @@ -70,7 +70,7 @@ class FlushContext { * * @return The name of this. */ - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } /** * Returns the flush handler of this context. diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 768800ee7816..ed2faaca2521 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -24,11 +24,11 @@ namespace proton { namespace { -std::pair +std::pair findOldestFlushedTarget(const IFlushTarget::List &lst, const IFlushHandler &handler) { search::SerialNum oldestFlushedSerial = handler.getCurrentSerialNumber(); - vespalib::string oldestFlushedName = "null"; + std::string oldestFlushedName = "null"; for (const IFlushTarget::SP &target : lst) { if (target->getType() != IFlushTarget::Type::GC) { search::SerialNum targetFlushedSerial = target->getFlushedSerialNum(); @@ -55,8 +55,8 @@ VESPA_THREAD_STACK_TAG(flush_engine_executor) } -FlushEngine::FlushMeta::FlushMeta(const vespalib::string& handler_name, - const vespalib::string& target_name, uint32_t id) +FlushEngine::FlushMeta::FlushMeta(const std::string& handler_name, + const std::string& target_name, uint32_t id) : _name((handler_name.empty() && target_name.empty()) ? "" : FlushContext::create_name(handler_name, target_name)), _handler_name(handler_name), _timer(), @@ -74,7 +74,7 @@ FlushEngine::FlushInfo::FlushInfo() FlushEngine::FlushInfo::~FlushInfo() = default; -FlushEngine::FlushInfo::FlushInfo(uint32_t taskId, const vespalib::string& handler_name, const IFlushTarget::SP& target, std::shared_ptr priority_flush_token) +FlushEngine::FlushInfo::FlushInfo(uint32_t taskId, const std::string& handler_name, const IFlushTarget::SP& target, std::shared_ptr priority_flush_token) : FlushMeta(handler_name, target->getName(), taskId), _target(target), _priority_flush_token(std::move(priority_flush_token)) @@ -191,8 +191,8 @@ FlushEngine::has_slot(IFlushTarget::Priority priority) return canFlushMore(guard, priority); } -vespalib::string -FlushEngine::checkAndFlush(vespalib::string prev) { +std::string +FlushEngine::checkAndFlush(std::string prev) { std::pair lst = getSortedTargetList(); if (lst.second) { // Everything returned from a priority strategy should be flushed @@ -221,7 +221,7 @@ void FlushEngine::run() { _has_thread = true; - vespalib::string prevFlushName; + std::string prevFlushName; for (vespalib::duration idleInterval=vespalib::duration::zero(); !_closed.load(std::memory_order_relaxed); idleInterval = _idleInterval) { LOG(debug, "Making another check for something to flush, last was '%s'", prevFlushName.c_str()); wait_for_slot_or_pending_prune(IFlushTarget::Priority::HIGH); @@ -241,8 +241,8 @@ FlushEngine::run() namespace { -vespalib::string -createName(const IFlushHandler &handler, const vespalib::string &targetName) +std::string +createName(const IFlushHandler &handler, const std::string &targetName) { return (handler.getName() + "." + targetName); } @@ -273,7 +273,7 @@ FlushEngine::prune() } bool -FlushEngine::isFlushing(const std::lock_guard & guard, const vespalib::string & name) const +FlushEngine::isFlushing(const std::lock_guard & guard, const std::string & name) const { (void) guard; for(const auto & it : _flushing) { @@ -390,8 +390,8 @@ FlushEngine::flushAll(const FlushContext::List &lst) _strategyCond.notify_all(); } -vespalib::string -FlushEngine::flushNextTarget(const vespalib::string & name, const FlushContext::List & contexts) +std::string +FlushEngine::flushNextTarget(const std::string & name, const FlushContext::List & contexts) { if (contexts.empty()) { LOG(debug, "No target to flush."); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index 302c4a2499ee..9cc764eed819 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -24,17 +24,17 @@ class FlushEngine public: class FlushMeta { public: - FlushMeta(const vespalib::string& handler_name, const vespalib::string& target_name, uint32_t id); + FlushMeta(const std::string& handler_name, const std::string& target_name, uint32_t id); ~FlushMeta(); - const vespalib::string & getName() const { return _name; } - const vespalib::string& handler_name() const { return _handler_name; } + const std::string & getName() const { return _name; } + const std::string& handler_name() const { return _handler_name; } vespalib::system_time getStart() const { return vespalib::to_utc(_timer.get_start()); } vespalib::duration elapsed() const { return _timer.elapsed(); } uint32_t getId() const { return _id; } bool operator < (const FlushMeta & rhs) const { return _id < rhs._id; } private: - vespalib::string _name; - vespalib::string _handler_name; + std::string _name; + std::string _handler_name; vespalib::Timer _timer; uint32_t _id; }; @@ -44,7 +44,7 @@ class FlushEngine struct FlushInfo : public FlushMeta { FlushInfo(); - FlushInfo(uint32_t taskId, const vespalib::string& handler_name, const IFlushTarget::SP &target, std::shared_ptr priority_flush_token); + FlushInfo(uint32_t taskId, const std::string& handler_name, const IFlushTarget::SP &target, std::shared_ptr priority_flush_token); ~FlushInfo(); IFlushTarget::SP _target; @@ -79,7 +79,7 @@ class FlushEngine std::pair getSortedTargetList(); std::shared_ptr get_flush_token(const FlushContext& ctx); FlushContext::SP initNextFlush(const FlushContext::List &lst); - vespalib::string flushNextTarget(const vespalib::string & name, const FlushContext::List & contexts); + std::string flushNextTarget(const std::string & name, const FlushContext::List & contexts); void flushAll(const FlushContext::List &lst); bool prune(); uint32_t initFlush(const FlushContext &ctx, std::shared_ptr priority_flush_token); @@ -90,8 +90,8 @@ class FlushEngine void idle_wait(vespalib::duration minimumWaitTimeIfReady); bool wait_for_slot(IFlushTarget::Priority priority); bool has_slot(IFlushTarget::Priority priority); - bool isFlushing(const std::lock_guard &guard, const vespalib::string & name) const; - vespalib::string checkAndFlush(vespalib::string prev); + bool isFlushing(const std::lock_guard &guard, const std::string & name) const; + std::string checkAndFlush(std::string prev); friend class FlushTask; friend class FlushEngineExplorer; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.cpp index 50c4938f39c5..385d02149d35 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.cpp @@ -15,7 +15,7 @@ FlushTargetProxy::FlushTargetProxy(const IFlushTarget::SP &target) } FlushTargetProxy::FlushTargetProxy(const IFlushTarget::SP &target, - const vespalib::string & prefix) + const std::string & prefix) : IFlushTarget(prefix + "." + target->getName(), target->getType(), target->getComponent()), _target(target) diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h index 1520cf5555f1..a764a3774eb1 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h @@ -31,7 +31,7 @@ class FlushTargetProxy : public searchcorespi::IFlushTarget * @param target The target to decorate. * @param prefix The prefix to prepend to the target */ - FlushTargetProxy(const IFlushTarget::SP &target, const vespalib::string & prefix); + FlushTargetProxy(const IFlushTarget::SP &target, const std::string & prefix); /** * Returns the decorated flush target. This should not be used for anything * but testing, as invoking a method on the returned target beats the diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h b/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h index c28913619f63..0f2c7543a359 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h @@ -11,7 +11,7 @@ namespace proton { */ class IFlushHandler { private: - vespalib::string _name; + std::string _name; public: using IFlushTarget = searchcorespi::IFlushTarget; @@ -27,7 +27,7 @@ class IFlushHandler { * * @param name The unique name of this handler. */ - IFlushHandler(const vespalib::string &name) noexcept + IFlushHandler(const std::string &name) noexcept : _name(name) { } @@ -41,7 +41,7 @@ class IFlushHandler { * * @return The name of this. */ - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } /** * Returns a list of the flush targets that belong to this handler. This diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp index 7ba239dbf6c5..a2976e850b85 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp @@ -16,7 +16,7 @@ using search::SerialNum; using searchcorespi::IFlushTarget; using Config = PrepareRestartFlushStrategy::Config; -using FlushContextsMap = std::map; +using FlushContextsMap = std::map; using FlushTargetCandidatesList = std::vector; PrepareRestartFlushStrategy::Config::Config(double tlsReplayByteCost_, @@ -52,7 +52,7 @@ groupByFlushHandler(const FlushContext::List &flushContexts) { FlushContextsMap result; for (const auto &flushContext : flushContexts) { - const vespalib::string &handlerName = flushContext->getHandler()->getName(); + const std::string &handlerName = flushContext->getHandler()->getName(); result[handlerName].push_back(flushContext); } return result; @@ -82,7 +82,7 @@ sortByOldestFlushedSerialNumber(std::vector& candidates) }); } -vespalib::string +std::string toString(const FlushContext::List &flushContexts) { std::ostringstream oss; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.h b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.h index dafb50f7299c..7c4bac87cc62 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.h @@ -2,8 +2,8 @@ #pragma once #include "iflushstrategy.h" -#include #include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp index fe9f3c244eb0..185126bd1369 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp @@ -41,7 +41,7 @@ ShrinkLidSpaceFlushTarget::Flusher::getFlushSerial() const return _flushSerialNum; } -ShrinkLidSpaceFlushTarget::ShrinkLidSpaceFlushTarget(const vespalib::string &name, +ShrinkLidSpaceFlushTarget::ShrinkLidSpaceFlushTarget(const std::string &name, Type type, Component component, SerialNum flushedSerialNum, diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h index a0e012274af7..f6c4bafb85fe 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h @@ -34,7 +34,7 @@ class ShrinkLidSpaceFlushTarget : public searchcorespi::LeafFlushTarget * @param flushedSerialNum When target shrank lid space last time * @param target The target supporting lid space compaction */ - ShrinkLidSpaceFlushTarget(const vespalib::string &name, + ShrinkLidSpaceFlushTarget(const std::string &name, Type type, Component component, SerialNum flushedSerialNum, diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.cpp index 288ca9cc13ca..d16e3f26b9aa 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.cpp @@ -24,7 +24,7 @@ ThreadedFlushTarget::ThreadedFlushTarget(vespalib::Executor &executor, ThreadedFlushTarget::ThreadedFlushTarget(vespalib::Executor &executor, const IGetSerialNum &getSerialNum, const IFlushTarget::SP &target, - const vespalib::string & prefix) + const std::string & prefix) : FlushTargetProxy(target, prefix), _executor(executor), _getSerialNum(getSerialNum) diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h index 31d2606552d9..4a4779341645 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h @@ -46,7 +46,7 @@ class ThreadedFlushTarget : public FlushTargetProxy ThreadedFlushTarget(vespalib::Executor &executor, const IGetSerialNum &getSerialNum, const IFlushTarget::SP &target, - const vespalib::string & prefix); + const std::string & prefix); Task::UP initFlush(SerialNum currentSerial, std::shared_ptr flush_token) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.cpp index 9f545295357f..482a75ab4efb 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.cpp @@ -14,7 +14,7 @@ TlsStatsMap::TlsStatsMap(Map &&map) TlsStatsMap::~TlsStatsMap() { } const TlsStats & -TlsStatsMap::getTlsStats(const vespalib::string &domain) const { +TlsStatsMap::getTlsStats(const std::string &domain) const { auto itr = _map.find(domain); if (itr != _map.end()) { return itr->second; @@ -24,4 +24,4 @@ TlsStatsMap::getTlsStats(const vespalib::string &domain) const { } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, proton::flushengine::TlsStats); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, proton::flushengine::TlsStats); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.h b/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.h index c43ff827e26b..f5dab48dbd52 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/tls_stats_map.h @@ -13,7 +13,7 @@ namespace proton::flushengine { class TlsStatsMap { public: - using Map = vespalib::hash_map; + using Map = vespalib::hash_map; private: Map _map; @@ -21,7 +21,7 @@ class TlsStatsMap TlsStatsMap(Map &&map); ~TlsStatsMap(); - const TlsStats &getTlsStats(const vespalib::string &domain) const; + const TlsStats &getTlsStats(const std::string &domain) const; }; } diff --git a/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.cpp b/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.cpp index 741fb27d006d..53638231fadc 100644 --- a/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.cpp +++ b/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.cpp @@ -10,7 +10,7 @@ using searchcorespi::index::IndexReadUtilities; namespace proton { -DiskIndexWrapper::DiskIndexWrapper(const vespalib::string &indexDir, +DiskIndexWrapper::DiskIndexWrapper(const std::string &indexDir, const TuneFileSearch &tuneFileSearch, size_t cacheSize) : _index(indexDir, cacheSize), @@ -47,7 +47,7 @@ DiskIndexWrapper::accept(searchcorespi::IndexSearchableVisitor &visitor) const } FieldLengthInfo -DiskIndexWrapper::get_field_length_info(const vespalib::string& field_name) const +DiskIndexWrapper::get_field_length_info(const std::string& field_name) const { return _index.get_field_length_info(field_name); } diff --git a/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.h b/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.h index a8def8c635cf..0004ccff04f7 100644 --- a/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.h +++ b/searchcore/src/vespa/searchcore/proton/index/diskindexwrapper.h @@ -14,7 +14,7 @@ class DiskIndexWrapper : public searchcorespi::index::IDiskIndex { search::SerialNum _serialNum; public: - DiskIndexWrapper(const vespalib::string &indexDir, + DiskIndexWrapper(const std::string &indexDir, const search::TuneFileSearch &tuneFileSearch, size_t cacheSize); @@ -37,8 +37,8 @@ class DiskIndexWrapper : public searchcorespi::index::IDiskIndex { search::SerialNum getSerialNum() const override; void accept(searchcorespi::IndexSearchableVisitor &visitor) const override; - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override; - const vespalib::string &getIndexDir() const override { return _index.getIndexDir(); } + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override; + const std::string &getIndexDir() const override { return _index.getIndexDir(); } const search::index::Schema &getSchema() const override { return _index.getSchema(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.cpp b/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.cpp index 5ec2dbe724ca..42028f3f9a80 100644 --- a/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.cpp @@ -10,7 +10,7 @@ LOG_SETUP(".proton.index.indexmanagerinitializer"); namespace proton { IndexManagerInitializer:: -IndexManagerInitializer(const vespalib::string &baseDir, +IndexManagerInitializer(const std::string &baseDir, const index::IndexConfig & indexCfg, const search::index::Schema &schema, search::SerialNum serialNum, diff --git a/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.h b/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.h index 1f8be6bf84c5..00d529aeec13 100644 --- a/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/index/index_manager_initializer.h @@ -14,7 +14,7 @@ namespace proton { */ class IndexManagerInitializer : public initializer::InitializerTask { - const vespalib::string _baseDir; + const std::string _baseDir; const index::IndexConfig _indexConfig; const search::index::Schema _schema; search::SerialNum _serialNum; @@ -27,7 +27,7 @@ class IndexManagerInitializer : public initializer::InitializerTask std::shared_ptr _indexManager; public: // Note: lifetime of indexManager must be handled by caller. - IndexManagerInitializer(const vespalib::string &baseDir, + IndexManagerInitializer(const std::string &baseDir, const index::IndexConfig & indexCfg, const search::index::Schema &schema, search::SerialNum serialNum, diff --git a/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp b/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp index 985ddd10e141..af57a074e1d7 100644 --- a/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp @@ -31,7 +31,7 @@ IndexWriter::put(search::SerialNum serialNum, const document::Document &doc, con } ns_log::Logger::LogLevel level = getDebugLevel(lid, doc.getId()); if (LOG_WOULD_VLOG(level)) { - vespalib::string s1(doc.toString(true)); + std::string s1(doc.toString(true)); VLOG(level, "Handle put: serial(%" PRIu64 "), docId(%s), lid(%u), document(sz=%ld)", serialNum, doc.getId().toString().c_str(), lid, s1.size()); const size_t chunksize(30000); diff --git a/searchcore/src/vespa/searchcore/proton/index/indexmanager.cpp b/searchcore/src/vespa/searchcore/proton/index/indexmanager.cpp index ba3f21049ecd..4797f59165f1 100644 --- a/searchcore/src/vespa/searchcore/proton/index/indexmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/index/indexmanager.cpp @@ -49,7 +49,7 @@ IndexManager::MaintainerOperations::createMemoryIndex(const Schema& schema, } IDiskIndex::SP -IndexManager::MaintainerOperations::loadDiskIndex(const vespalib::string &indexDir) +IndexManager::MaintainerOperations::loadDiskIndex(const std::string &indexDir) { return std::make_shared(indexDir, _tuneFileSearch, _cacheSize); } @@ -63,8 +63,8 @@ IndexManager::MaintainerOperations::reloadDiskIndex(const IDiskIndex &oldIndex) bool IndexManager::MaintainerOperations::runFusion(const Schema &schema, - const vespalib::string &outputDir, - const std::vector &sources, + const std::string &outputDir, + const std::vector &sources, const SelectorArray &selectorArray, SerialNum serialNum, std::shared_ptr flush_token) @@ -76,7 +76,7 @@ IndexManager::MaintainerOperations::runFusion(const Schema &schema, } -IndexManager::IndexManager(const vespalib::string &baseDir, +IndexManager::IndexManager(const std::string &baseDir, const IndexConfig & indexConfig, const Schema &schema, SerialNum serialNum, diff --git a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h index c1ad4bb316b8..7c1eb1737acb 100644 --- a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h +++ b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h @@ -51,10 +51,10 @@ class IndexManager : public searchcorespi::IIndexManager IMemoryIndex::SP createMemoryIndex(const Schema& schema, const IFieldLengthInspector& inspector, SerialNum serialNum) override; - IDiskIndex::SP loadDiskIndex(const vespalib::string &indexDir) override; + IDiskIndex::SP loadDiskIndex(const std::string &indexDir) override; IDiskIndex::SP reloadDiskIndex(const IDiskIndex &oldIndex) override; - bool runFusion(const Schema &schema, const vespalib::string &outputDir, - const std::vector &sources, + bool runFusion(const Schema &schema, const std::string &outputDir, + const std::vector &sources, const SelectorArray &docIdSelector, search::SerialNum lastSerialNum, std::shared_ptr flush_token) override; @@ -67,7 +67,7 @@ class IndexManager : public searchcorespi::IIndexManager public: IndexManager(const IndexManager &) = delete; IndexManager & operator = (const IndexManager &) = delete; - IndexManager(const vespalib::string &baseDir, + IndexManager(const std::string &baseDir, const IndexConfig & indexConfig, const Schema &schema, SerialNum serialNum, diff --git a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.cpp b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.cpp index b4d32cb43768..432d32755860 100644 --- a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.cpp +++ b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.cpp @@ -32,7 +32,7 @@ MemoryIndexWrapper::MemoryIndexWrapper(const search::index::Schema& schema, } void -MemoryIndexWrapper::flushToDisk(const vespalib::string &flushDir, uint32_t docIdLimit, SerialNum serialNum) +MemoryIndexWrapper::flushToDisk(const std::string &flushDir, uint32_t docIdLimit, SerialNum serialNum) { const uint64_t numWords = _index.getNumWords(); _index.freeze(); // TODO(geirst): is this needed anymore? @@ -55,7 +55,7 @@ MemoryIndexWrapper::accept(searchcorespi::IndexSearchableVisitor &visitor) const } FieldLengthInfo -MemoryIndexWrapper::get_field_length_info(const vespalib::string& field_name) const +MemoryIndexWrapper::get_field_length_info(const std::string& field_name) const { return _index.get_field_length_info(field_name); } diff --git a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h index abc318998272..0a11dbbdb573 100644 --- a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h +++ b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h @@ -63,7 +63,7 @@ class MemoryIndexWrapper : public searchcorespi::index::IMemoryIndex { /** * Implements IFieldLengthInspector */ - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override; + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override; /** * Implements proton::IMemoryIndex @@ -93,7 +93,7 @@ class MemoryIndexWrapper : public searchcorespi::index::IMemoryIndex { void pruneRemovedFields(const search::index::Schema &schema) override { _index.pruneRemovedFields(schema); } - void flushToDisk(const vespalib::string &flushDir, uint32_t docIdLimit, SerialNum serialNum) override; + void flushToDisk(const std::string &flushDir, uint32_t docIdLimit, SerialNum serialNum) override; void insert_write_context_state(vespalib::slime::Cursor& object) const override { _index.insert_write_context_state(object); diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp index d873eee20a4a..f372b787b09c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp @@ -13,7 +13,7 @@ using namespace search::queryeval; using namespace search::query; using vespalib::make_string; -using vespalib::string; +using std::string; using vespalib::make_string_short::fmt; namespace proton::matching { @@ -57,8 +57,8 @@ AttributeLimiter::~AttributeLimiter() = default; namespace { -vespalib::string STRICT_STR("strict"); -vespalib::string LOOSE_STR("loose"); +std::string STRICT_STR("strict"); +std::string LOOSE_STR("loose"); } @@ -70,7 +70,7 @@ AttributeLimiter::toDiversityCutoffStrategy(std::string_view strategy) : DiversityCutoffStrategy::LOOSE; } -const vespalib::string & +const std::string & toString(AttributeLimiter::DiversityCutoffStrategy strategy) { return (strategy == AttributeLimiter::DiversityCutoffStrategy::STRICT) ? STRICT_STR : LOOSE_STR; diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h index be15acab74d9..baa2c513f1c9 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h +++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h @@ -2,11 +2,11 @@ #pragma once -#include -#include +#include #include #include -#include +#include +#include namespace search::queryeval { class Searchable; @@ -36,8 +36,8 @@ class AttributeLimiter AttributeLimiter(const RangeQueryLocator & _rangeQueryLocator, search::queryeval::Searchable &searchable_attributes, const search::queryeval::IRequestContext & requestContext, - const vespalib::string &attribute_name, bool descending, - const vespalib::string &diversity_attribute, + const std::string &attribute_name, bool descending, + const std::string &diversity_attribute, double diversityCutoffFactor, DiversityCutoffStrategy diversityCutoffStrategy); ~AttributeLimiter(); @@ -51,9 +51,9 @@ class AttributeLimiter search::queryeval::Searchable & _searchable_attributes; const search::queryeval::IRequestContext & _requestContext; const RangeQueryLocator & _rangeQueryLocator; - vespalib::string _attribute_name; + std::string _attribute_name; bool _descending; - vespalib::string _diversity_attribute; + std::string _diversity_attribute; std::mutex _lock; std::vector> _match_datas; std::unique_ptr _blueprint; diff --git a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp index c7f86903e057..a1722ba9006b 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/docsum_matcher.cpp @@ -80,7 +80,7 @@ void find_matching_elements(const std::vector &docs, MatchingElementsS } } -void find_matching_elements(const std::vector &docs, const vespalib::string &field_name, const AttrSearchCtx &attr_ctx, MatchingElements &result) { +void find_matching_elements(const std::vector &docs, const std::string &field_name, const AttrSearchCtx &attr_ctx, MatchingElements &result) { int32_t weight = 0; std::vector matches; for (uint32_t doc : docs) { diff --git a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp index 922bc933aa1d..573340196622 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp @@ -33,7 +33,7 @@ HandleRecorder::HandleRecorder() : namespace { -vespalib::string +std::string handles_to_string(const HandleRecorder::HandleMap& handles, MatchDataDetails requested_details) { vespalib::asciistream os; @@ -55,7 +55,7 @@ handles_to_string(const HandleRecorder::HandleMap& handles, MatchDataDetails req } -vespalib::string +std::string HandleRecorder::to_string() const { vespalib::asciistream os; diff --git a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.h b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.h index 933279de496e..0d6cd1433315 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.h +++ b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.h @@ -39,7 +39,7 @@ class HandleRecorder HandleMap steal_handles() && { return std::move(_handles); } static void register_handle(search::fef::TermFieldHandle handle, search::fef::MatchDataDetails requested_details); - vespalib::string to_string() const; + std::string to_string() const; void tag_match_data(search::fef::MatchData &match_data); private: void add(search::fef::TermFieldHandle handle, diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp index a9e6785f8622..e639496fa29d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp @@ -11,14 +11,14 @@ using namespace search::fef; namespace { -using StringSet = std::set; +using StringSet = std::set; void -consider_field_for_extraction(const vespalib::string& field_name, StringSet& virtual_fields) +consider_field_for_extraction(const std::string& field_name, StringSet& virtual_fields) { size_t pos = field_name.find_last_of('.'); - if (pos != vespalib::string::npos) { - vespalib::string virtual_field = field_name.substr(0, pos); + if (pos != std::string::npos) { + std::string virtual_field = field_name.substr(0, pos); virtual_fields.insert(virtual_field); consider_field_for_extraction(virtual_field, virtual_fields); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h index 20fcddcea994..48045d72578d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h @@ -63,14 +63,14 @@ class IndexEnvironment : public search::fef::IIndexEnvironment void hintFeatureMotivation(FeatureMotivation motivation) const override; uint32_t getDistributionKey() const override { return _distributionKey; } - vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override { + vespalib::eval::ConstantValue::UP getConstantValue(const std::string &name) const override { return _rankingAssetsRepo.getConstant(name); } - vespalib::string getRankingExpression(const vespalib::string &name) const override { + std::string getRankingExpression(const std::string &name) const override { return _rankingAssetsRepo.getExpression(name); } - const search::fef::OnnxModel *getOnnxModel(const vespalib::string &name) const override { + const search::fef::OnnxModel *getOnnxModel(const std::string &name) const override { return _rankingAssetsRepo.getOnnxModel(name); } }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h index 7f61723c0ce3..3b04d60ed03d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h @@ -70,7 +70,7 @@ struct NoMatchPhaseLimiter : MaybeMatchPhaseLimiter { struct DiversityParams { using CutoffStrategy = AttributeLimiter::DiversityCutoffStrategy; DiversityParams() : DiversityParams("", 0, 0, CutoffStrategy::LOOSE) { } - DiversityParams(const vespalib::string & attribute_, uint32_t min_groups_, + DiversityParams(const std::string & attribute_, uint32_t min_groups_, double cutoff_factor_, CutoffStrategy cutoff_strategy_) : attribute(attribute_), min_groups(min_groups_), @@ -78,14 +78,14 @@ struct DiversityParams { cutoff_strategy(cutoff_strategy_) { } bool enabled() const { return !attribute.empty() && (min_groups > 0); } - vespalib::string attribute; + std::string attribute; uint32_t min_groups; double cutoff_factor; CutoffStrategy cutoff_strategy; }; struct DegradationParams { - DegradationParams(const vespalib::string &attribute_, size_t max_hits_, bool descending_, + DegradationParams(const std::string &attribute_, size_t max_hits_, bool descending_, double max_filter_coverage_, double sample_percentage_, double post_filter_multiplier_) : attribute(attribute_), descending(descending_), @@ -95,7 +95,7 @@ struct DegradationParams { post_filter_multiplier(post_filter_multiplier_) { } bool enabled() const { return !attribute.empty() && (max_hits > 0); } - vespalib::string attribute; + std::string attribute; bool descending; size_t max_hits; double max_filter_coverage; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 7ccc120d0478..d1974bec27f6 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -535,11 +535,11 @@ MatchThread::run() } if (first_phase_profiler) { first_phase_profiler->report(trace->createCursor("first_phase_profiling"), - [](const vespalib::string &name){ return BlueprintResolver::describe_feature(name); }); + [](const std::string &name){ return BlueprintResolver::describe_feature(name); }); } if (second_phase_profiler) { second_phase_profiler->report(trace->createCursor("second_phase_profiling"), - [](const vespalib::string &name){ return BlueprintResolver::describe_feature(name); }); + [](const std::string &name){ return BlueprintResolver::describe_feature(name); }); } } diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index 68611abdf8b8..93989332bdca 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -53,7 +53,7 @@ bool contains_all(const HandleRecorder::HandleMap &old_map, } DegradationParams -extractDegradationParams(const RankSetup &rankSetup, const vespalib::string & attribute, const Properties &rankProperties) +extractDegradationParams(const RankSetup &rankSetup, const std::string & attribute, const Properties &rankProperties) { return { attribute, DegradationMaxHits::lookup(rankProperties, rankSetup.getDegradationMaxHits()), @@ -169,7 +169,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter, IAttributeContext & attributeContext, search::engine::Trace & root_trace, std::string_view queryStack, - const vespalib::string & location, + const std::string & location, const ViewResolver & viewResolver, const IDocumentMetaStore & metaStore, const IIndexEnvironment & indexEnv, @@ -226,7 +226,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter, _rankSetup.prepareSharedState(_queryEnv, _queryEnv.getObjectStore()); _first_phase_rank_lookup = FirstPhaseRankLookup::get_mutable_shared_state(_queryEnv.getObjectStore()); _diversityParams = extractDiversityParams(_rankSetup, rankProperties); - vespalib::string attribute = DegradationAttribute::lookup(rankProperties, _rankSetup.getDegradationAttribute()); + std::string attribute = DegradationAttribute::lookup(rankProperties, _rankSetup.getDegradationAttribute()); DegradationParams degradationParams = extractDegradationParams(_rankSetup, attribute, rankProperties); if (degradationParams.enabled()) { diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h index 529dcd9d9af0..11488abed983 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h @@ -102,10 +102,10 @@ class AttributeOperationTask { void run(Hits hits) const; private: search::attribute::BasicType getAttributeType() const; - const vespalib::string & getOperation() const { return _operation; } + const std::string & getOperation() const { return _operation; } const RequestContext & _requestContext; - vespalib::string _attribute; - vespalib::string _operation; + std::string _attribute; + std::string _operation; }; class MatchToolsFactory @@ -148,7 +148,7 @@ class MatchToolsFactory IAttributeContext &attributeContext, search::engine::Trace & root_trace, std::string_view queryStack, - const vespalib::string &location, + const std::string &location, const ViewResolver &viewResolver, const search::IDocumentMetaStore &metaStore, const IIndexEnvironment &indexEnv, diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 142c68686152..fbf00171aa9b 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -84,7 +84,7 @@ willNeedRanking(const SearchRequest & request, const GroupingContext & groupingC { return (groupingContext.needRanking() || (request.maxhits != 0)) && (request.sortSpec.empty() || - (request.sortSpec.find("[rank]") != vespalib::string::npos) || + (request.sortSpec.find("[rank]") != std::string::npos) || first_phase_rank_score_drop_limit.has_value()); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/partial_result.cpp b/searchcore/src/vespa/searchcore/proton/matching/partial_result.cpp index 3586a77b7779..bdf7f208ffdc 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/partial_result.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/partial_result.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "partial_result.h" +#include namespace proton::matching { diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 1aeb5501d599..8a41bf6ba4ca 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -43,7 +43,7 @@ using search::queryeval::MatchingPhase; using search::queryeval::RankBlueprint; using search::queryeval::SearchIterator; using vespalib::Issue; -using vespalib::string; +using std::string; using std::vector; namespace proton::matching { diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index c21783bb03e6..e896f96cf85d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -57,14 +57,14 @@ class Query * @return success(true)/failure(false) **/ bool buildTree(std::string_view stack, - const vespalib::string &location, + const std::string &location, const ViewResolver &resolver, const search::fef::IIndexEnvironment &idxEnv) { return buildTree(stack, location, resolver, idxEnv, false); } bool buildTree(std::string_view stack, - const vespalib::string &location, + const std::string &location, const ViewResolver &resolver, const search::fef::IIndexEnvironment &idxEnv, bool always_mark_phrase_expensive); diff --git a/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.cpp index d3114234c80d..83e8bf38b4f5 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.cpp @@ -50,7 +50,7 @@ QueryEnvironment::getAttributeContext() const } double -QueryEnvironment::get_average_field_length(const vespalib::string &field_name) const +QueryEnvironment::get_average_field_length(const std::string &field_name) const { return _field_length_inspector.get_field_length_info(field_name).get_average_field_length(); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.h b/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.h index fda4f99eb0db..776b14280fa8 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.h +++ b/searchcore/src/vespa/searchcore/proton/matching/queryenvironment.h @@ -76,7 +76,7 @@ class QueryEnvironment : public search::fef::IQueryEnvironment // inherited from search::fef::IQueryEnvironment const search::attribute::IAttributeContext & getAttributeContext() const override; - double get_average_field_length(const vespalib::string &field_name) const override; + double get_average_field_length(const std::string &field_name) const override; // inherited from search::fef::IQueryEnvironment const search::fef::IIndexEnvironment & getIndexEnvironment() const override; diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp index 47a9f3dd43d3..74f720c09f9d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.cpp @@ -16,7 +16,7 @@ using search::fef::MatchData; using search::fef::MatchDataLayout; using search::fef::TermFieldHandle; using search::query::Node; -using vespalib::string; +using std::string; using vespalib::Issue; namespace proton::matching { diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h index 412905559971..926a8ed4b606 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h +++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h @@ -30,7 +30,7 @@ class ProtonTermData : public search::fef::ITermData FieldSpec _field_spec; bool attribute_field; - FieldEntry(const vespalib::string &name, uint32_t fieldId, bool is_filter) noexcept + FieldEntry(const std::string &name, uint32_t fieldId, bool is_filter) noexcept : ITermFieldData(fieldId), _field_spec(name, fieldId, search::fef::IllegalHandle, is_filter), attribute_field(false) @@ -41,7 +41,7 @@ class ProtonTermData : public search::fef::ITermData } [[nodiscard]] TermFieldHandle getHandle() const { return getHandle(MatchDataDetails::Normal); } [[nodiscard]] TermFieldHandle getHandle(MatchDataDetails requested_details) const override; - [[nodiscard]] const vespalib::string & getName() const noexcept { return _field_spec.getName(); } + [[nodiscard]] const std::string & getName() const noexcept { return _field_spec.getName(); } [[nodiscard]] bool is_filter() const noexcept { return _field_spec.isFilter(); } }; @@ -52,7 +52,7 @@ class ProtonTermData : public search::fef::ITermData protected: void resolve(const ViewResolver &resolver, const search::fef::IIndexEnvironment &idxEnv, - const vespalib::string &view, bool forceFilter); + const std::string &view, bool forceFilter); public: ProtonTermData() noexcept; @@ -64,7 +64,7 @@ class ProtonTermData : public search::fef::ITermData void setDocumentFrequency(uint32_t estHits, uint32_t numDocs); // ITermData interface - [[nodiscard]] std::optional query_tensor_name() const override { return std::nullopt; } + [[nodiscard]] std::optional query_tensor_name() const override { return std::nullopt; } [[nodiscard]] size_t numFields() const final { return _fields.size(); } [[nodiscard]] const FieldEntry &field(size_t i) const final { return _fields[i]; } [[nodiscard]] const FieldEntry *lookupField(uint32_t fieldId) const final; @@ -129,7 +129,7 @@ struct ProtonSameElement final : public ProtonTermBase { using ProtonTermBase::ProtonTermBase; - [[nodiscard]] std::optional query_tensor_name() const override { + [[nodiscard]] std::optional query_tensor_name() const override { return ProtonTermBase::NearestNeighborTerm::get_query_tensor_name(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.cpp b/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.cpp index 4949289d143b..26bb8d9e05c9 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.cpp @@ -41,7 +41,7 @@ locateFirst(uint32_t field_id, const Blueprint & blueprint) { const Blueprint::State & state = blueprint.getState(); if (state.isTermLike() && (state.numFields() == 1) && (state.field(0).getFieldId() == field_id)) { const LeafBlueprint * leaf = blueprint.asLeaf(); - vespalib::string from, too; + std::string from, too; if (leaf->getRange(from, too)) { return {from, too, state.estimate().estHits}; } diff --git a/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.h b/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.h index bd933f325212..e1f6901686db 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.h +++ b/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search::queryeval { class Blueprint; } @@ -13,15 +14,15 @@ class RangeLimitMetaInfo { RangeLimitMetaInfo(); RangeLimitMetaInfo(std::string_view low, std::string_view high, size_t estimate); ~RangeLimitMetaInfo(); - const vespalib::string & low() const { return _low; } - const vespalib::string & high() const { return _high; } + const std::string & low() const { return _low; } + const std::string & high() const { return _high; } bool valid() const { return _valid; } size_t estimate() const { return _estimate; } private: bool _valid; size_t _estimate; - vespalib::string _low; - vespalib::string _high; + std::string _low; + std::string _high; }; class RangeQueryLocator { diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp index 4b9131d3cb1e..7b098114a0c4 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp @@ -53,7 +53,7 @@ RequestContext::asyncForAttribute(std::string_view name, std::unique_ptr func) const override; const search::attribute::IAttributeVector *getAttributeStableEnum(std::string_view name) const override; - const vespalib::eval::Value* get_query_tensor(const vespalib::string& tensor_name) const override; + const vespalib::eval::Value* get_query_tensor(const std::string& tensor_name) const override; const search::attribute::AttributeBlueprintParams& get_attribute_blueprint_params() const override { return _attribute_blueprint_params; diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp index 623a17b89f41..db815f946029 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp @@ -26,7 +26,7 @@ ResultProcessor::Result::Result(std::unique_ptr rep ResultProcessor::Result::~Result() = default; -ResultProcessor::Sort::Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const vespalib::string &ss) +ResultProcessor::Sort::Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const std::string &ss) : sorter(FastS_DefaultResultSorter::instance()), _ucaFactory(std::make_unique()), sortSpec(DocumentMetaStoreAttribute::getFixedName(), partitionId, doom, *_ucaFactory) @@ -60,8 +60,8 @@ ResultProcessor::ResultProcessor(IAttributeContext &attrContext, const search::IDocumentMetaStore &metaStore, SessionManager &sessionMgr, GroupingContext &groupingContext, - const vespalib::string &sessionId, - const vespalib::string &sortSpec, + const std::string &sessionId, + const std::string &sortSpec, size_t offset, size_t hits) : _attrContext(attrContext), _metaStore(metaStore), diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h index 1cf6284295f9..bec51fe8c505 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h @@ -40,7 +40,7 @@ class ResultProcessor FastS_SortSpec sortSpec; Sort(const Sort &) = delete; Sort & operator = (const Sort &) = delete; - Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const vespalib::string &ss); + Sort(uint32_t partitionId, const vespalib::Doom & doom, IAttributeContext &ac, const std::string &ss); bool hasSortData() const noexcept { return (sorter == (const FastS_IResultSorter *) &sortSpec); } @@ -86,7 +86,7 @@ class ResultProcessor SessionManager &_sessionMgr; GroupingContext &_groupingContext; std::unique_ptr _groupingSession; - const vespalib::string &_sortSpec; + const std::string &_sortSpec; size_t _offset; size_t _hits; bool _wasMerged; @@ -96,8 +96,8 @@ class ResultProcessor const search::IDocumentMetaStore & metaStore, SessionManager & sessionMgr, GroupingContext & groupingContext, - const vespalib::string & sessionId, - const vespalib::string & sortSpec, + const std::string & sessionId, + const std::string & sortSpec, size_t offset, size_t hits); ~ResultProcessor(); diff --git a/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.cpp b/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.cpp index b4c7cf51bf23..0e24ce805602 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.cpp @@ -11,7 +11,7 @@ void SameElementModifier::visit(ProtonNodeTypes::SameElement &n) { if (n.getView().empty()) return; - vespalib::string prefix = n.getView() + "."; + std::string prefix = n.getView() + "."; for (search::query::Node * child : n.getChildren()) { search::query::TermNode * term = dynamic_cast(child); if (term != nullptr) { diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h index 3c61f472233f..c09ffcbf0479 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h +++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h @@ -5,9 +5,9 @@ #include "match_context.h" #include #include -#include #include #include +#include namespace search::fef { class Properties; } @@ -36,7 +36,7 @@ class SearchSession { std::vector stackDump; }; private: - using SessionId = vespalib::string; + using SessionId = std::string; SessionId _session_id; vespalib::steady_time _create_time; diff --git a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp index a1e4ac51b3a3..b1ce55788431 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp @@ -12,7 +12,7 @@ namespace proton::matching { namespace { -const vespalib::string SEARCH = "search"; +const std::string SEARCH = "search"; class SearchSessionExplorer : public vespalib::StateExplorer { @@ -44,10 +44,10 @@ SessionManagerExplorer::get_state(const Inserter &, bool) const { } -std::vector +std::vector SessionManagerExplorer::get_children_names() const { - return std::vector({SEARCH}); + return std::vector({SEARCH}); } std::unique_ptr diff --git a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.h b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.h index 0852cd1bda16..660aa235b8e9 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.h @@ -19,7 +19,7 @@ class SessionManagerExplorer : public vespalib::StateExplorer public: SessionManagerExplorer(const SessionManager &manager) : _manager(manager) {} void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h index a95c7b7a8a82..528e777623af 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h +++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h @@ -9,7 +9,7 @@ namespace vespalib { class ThreadExecutor; } namespace proton::matching { -using SessionId = vespalib::string; +using SessionId = std::string; struct GroupingSessionCache; struct SearchSessionCache; @@ -32,10 +32,10 @@ class SessionManager { }; struct SearchSessionInfo { - vespalib::string id; + std::string id; vespalib::steady_time created; vespalib::steady_time doom; - SearchSessionInfo(const vespalib::string &id_in, + SearchSessionInfo(const std::string &id_in, vespalib::steady_time created_in, vespalib::steady_time doom_in) noexcept : id(id_in), created(created_in), doom(doom_in) {} diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp index cad3c3ac0186..7941950a2a27 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp @@ -6,14 +6,14 @@ namespace proton::matching { ViewResolver & -ViewResolver::add(const vespalib::string & view, std::string_view field) +ViewResolver::add(const std::string & view, std::string_view field) { _map[view].emplace_back(field); return *this; } bool -ViewResolver::resolve(std::string_view view, std::vector &fields) const +ViewResolver::resolve(std::string_view view, std::vector &fields) const { auto pos = _map.find(view); if (pos == _map.end()) { @@ -30,8 +30,8 @@ ViewResolver::createFromSchema(const search::index::Schema &schema) ViewResolver resolver; for (uint32_t i = 0; i < schema.getNumFieldSets(); ++i) { const search::index::Schema::FieldSet &f = schema.getFieldSet(i); - const vespalib::string &view = f.getName(); - const std::vector &fields = f.getFields(); + const std::string &view = f.getName(); + const std::vector &fields = f.getFields(); for (const auto & field : fields) { resolver.add(view, field); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h index 2e974d2f4247..2ca4ddf429c3 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h +++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::index { class Schema; } @@ -19,7 +19,7 @@ namespace proton::matching { class ViewResolver { private: - using Map = vespalib::hash_map >; + using Map = vespalib::hash_map >; Map _map; @@ -35,7 +35,7 @@ class ViewResolver * @param view the name of the view * @param field the name of the field **/ - ViewResolver &add(const vespalib::string & view, std::string_view field); + ViewResolver &add(const std::string & view, std::string_view field); /** * Resolve a view to obtain the set of fields it @@ -48,7 +48,7 @@ class ViewResolver * that are part of the requested view. **/ bool resolve(std::string_view view, - std::vector &fields) const; + std::vector &fields) const; /** * Create a view resolver based on the field collections defined diff --git a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.cpp index e2ed0d52ba19..9d9870d4bff9 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.cpp @@ -6,7 +6,7 @@ namespace proton { using Entry = AttributeMetrics::Entry; -AttributeMetrics::Entry::Entry(const vespalib::string &attrName) +AttributeMetrics::Entry::Entry(const std::string &attrName) : metrics::MetricSet("attribute", {{"field", attrName}}, "Metrics for a given attribute vector", nullptr), memoryUsage(this) { @@ -19,7 +19,7 @@ AttributeMetrics::AttributeMetrics(metrics::MetricSet *parent) } Entry::SP -AttributeMetrics::add(const vespalib::string &attrName) +AttributeMetrics::add(const std::string &attrName) { if (get(attrName).get() != nullptr) { return Entry::SP(); @@ -30,7 +30,7 @@ AttributeMetrics::add(const vespalib::string &attrName) } Entry::SP -AttributeMetrics::get(const vespalib::string &attrName) const +AttributeMetrics::get(const std::string &attrName) const { auto itr = _attributes.find(attrName); if (itr != _attributes.end()) { @@ -40,7 +40,7 @@ AttributeMetrics::get(const vespalib::string &attrName) const } Entry::SP -AttributeMetrics::remove(const vespalib::string &attrName) +AttributeMetrics::remove(const std::string &attrName) { Entry::SP result = get(attrName); if (result.get() != nullptr) { diff --git a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.h index 688c47e148f5..65465e42654e 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.h @@ -13,19 +13,19 @@ class AttributeMetrics struct Entry : public metrics::MetricSet { using SP = std::shared_ptr; MemoryUsageMetrics memoryUsage; - Entry(const vespalib::string &attrName); + Entry(const std::string &attrName); }; private: - using Map = std::map; + using Map = std::map; metrics::MetricSet *_parent; Map _attributes; public: AttributeMetrics(metrics::MetricSet *parent); - Entry::SP add(const vespalib::string &attrName); - Entry::SP get(const vespalib::string &attrName) const; - Entry::SP remove(const vespalib::string &attrName); + Entry::SP add(const std::string &attrName); + Entry::SP get(const std::string &attrName) const; + Entry::SP remove(const std::string &attrName); std::vector release(); metrics::MetricSet *parent() { return _parent; } }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp index 97a6764d794b..bc325677cb13 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp @@ -30,7 +30,7 @@ DocumentDBTaggedMetrics::JobMetrics::JobMetrics(metrics::MetricSet* parent) DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() = default; -DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent) +DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const std::string &name, MetricSet *parent) : MetricSet(name, {}, "Sub database metrics", parent), lidSpace(this), documentStore(this), @@ -137,7 +137,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent) DocumentDBTaggedMetrics::MatchingMetrics::~MatchingMetrics() = default; -DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics(const vespalib::string &name, +DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics(const std::string &name, size_t numDocIdPartitions, MetricSet *parent) : MetricSet("rank_profile", {{"rankProfile", name}}, "Rank profile metrics", parent), @@ -156,14 +156,14 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics { softDoomFactor.set(MatchingStats::INITIAL_SOFT_DOOM_FACTOR); for (size_t i = 0; i < numDocIdPartitions; ++i) { - vespalib::string partition(vespalib::make_string("docid_part%02ld", i)); + std::string partition(vespalib::make_string("docid_part%02ld", i)); partitions.push_back(std::make_unique(partition, this)); } } DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() = default; -DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const vespalib::string &name, MetricSet *parent) +DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const std::string &name, MetricSet *parent) : MetricSet("docid_partition", {{"docidPartition", name}}, "DocId Partition profile metrics", parent), docsMatched("docs_matched", {}, "Number of documents matched", this), docsRanked("docs_ranked", {}, "Number of documents ranked (first phase)", this), @@ -210,7 +210,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::update(const metri if (stats.getNumPartitions() > 0) { for (size_t i = partitions.size(); i < stats.getNumPartitions(); ++i) { // This loop is to handle live reconfigs that changes how many partitions(number of threads) might be used per query. - vespalib::string partition(vespalib::make_string("docid_part%02ld", i)); + std::string partition(vespalib::make_string("docid_part%02ld", i)); partitions.push_back(std::make_unique(partition, this)); LOG(info, "Number of partitions has been increased to '%ld' from '%ld' previously configured. Adding part %ld", stats.getNumPartitions(), partitions.size(), i); @@ -239,7 +239,7 @@ DocumentDBTaggedMetrics::BucketMoveMetrics::BucketMoveMetrics(metrics::MetricSet DocumentDBTaggedMetrics::BucketMoveMetrics::~BucketMoveMetrics() = default; -DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName, size_t maxNumThreads_) +DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const std::string &docTypeName, size_t maxNumThreads_) : MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr), job(this), attribute(this), diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h index b3b1cdb955a0..35d4b00b13a9 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h @@ -78,7 +78,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet DocumentStoreMetrics documentStore; proton::AttributeMetrics attributes; - SubDBMetrics(const vespalib::string &name, metrics::MetricSet *parent); + SubDBMetrics(const std::string &name, metrics::MetricSet *parent); ~SubDBMetrics() override; }; @@ -128,7 +128,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::DoubleAverageMetric waitTime; using UP = std::unique_ptr; - DocIdPartition(const vespalib::string &name, metrics::MetricSet *parent); + DocIdPartition(const std::string &name, metrics::MetricSet *parent); ~DocIdPartition() override; void update(const matching::MatchingStats::Partition &stats); }; @@ -149,14 +149,14 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::DoubleAverageMetric queryLatency; DocIdPartitions partitions; - RankProfileMetrics(const vespalib::string &name, + RankProfileMetrics(const std::string &name, size_t numDocIdPartitions, metrics::MetricSet *parent); ~RankProfileMetrics() override; void update(const metrics::MetricLockGuard & guard, const matching::MatchingStats &stats); }; - using RankProfileMap = std::map; + using RankProfileMap = std::map; RankProfileMap rank_profiles; void update(const matching::MatchingStats &stats); @@ -197,7 +197,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::DoubleValueMetric heart_beat_age; size_t maxNumThreads; - DocumentDBTaggedMetrics(const vespalib::string &docTypeName, size_t maxNumThreads_); + DocumentDBTaggedMetrics(const std::string &docTypeName, size_t maxNumThreads_); ~DocumentDBTaggedMetrics() override; }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp index 7a1393727a19..751c8928aeac 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp @@ -134,7 +134,7 @@ namespace { template void -addRankProfileTo(MatchingMetricsType &matchingMetrics, const vespalib::string &name, size_t numDocIdPartitions) +addRankProfileTo(MatchingMetricsType &matchingMetrics, const std::string &name, size_t numDocIdPartitions) { auto &entry = matchingMetrics.rank_profiles[name]; if (entry.get()) { diff --git a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp index 21b2e7b58cb7..bf3f3677289c 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp @@ -19,7 +19,7 @@ ResourceUsageMetrics::CpuUtilMetrics::CpuUtilMetrics(metrics::MetricSet *parent) ResourceUsageMetrics::CpuUtilMetrics::~CpuUtilMetrics() = default; -ResourceUsageMetrics::DetailedResourceMetrics::DetailedResourceMetrics(const vespalib::string& resource_type, metrics::MetricSet* parent) +ResourceUsageMetrics::DetailedResourceMetrics::DetailedResourceMetrics(const std::string& resource_type, metrics::MetricSet* parent) : MetricSet(make_string("%s_usage", resource_type.c_str()), {}, make_string("Detailed resource usage metrics for %s", resource_type.c_str()), parent), total("total", {}, make_string("The total relative amount of %s used by this content node (value in the range [0, 1])", diff --git a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h index 469e10bf1d34..069330385c6d 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h @@ -28,7 +28,7 @@ struct ResourceUsageMetrics : metrics::MetricSet metrics::DoubleValueMetric total_util; metrics::DoubleValueMetric transient; - DetailedResourceMetrics(const vespalib::string& resource_type, metrics::MetricSet* parent); + DetailedResourceMetrics(const std::string& resource_type, metrics::MetricSet* parent); ~DetailedResourceMetrics(); }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp index 459202f1a738..f905846cec3b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp @@ -5,7 +5,7 @@ namespace proton { -SessionManagerMetrics::SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent) +SessionManagerMetrics::SessionManagerMetrics(const std::string &name, metrics::MetricSet *parent) : metrics::MetricSet(name, {}, vespalib::make_string("Session manager cache metrics for %s", name.c_str()), parent), numInsert("num_insert", {}, "Number of inserted sessions", this), numPick("num_pick", {}, "Number if picked sessions", this), diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h index eb6f74683759..19faa570a192 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h @@ -21,7 +21,7 @@ struct SessionManagerMetrics : metrics::MetricSet metrics::LongCountMetric numTimedout; void update(const proton::matching::SessionManager::Stats &stats); - SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent); + SessionManagerMetrics(const std::string &name, metrics::MetricSet *parent); ~SessionManagerMetrics(); }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp index a1a683bb8b20..306c36909543 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp @@ -8,7 +8,7 @@ using search::transactionlog::DomainStats; namespace proton { TransLogServerMetrics::DomainMetrics::DomainMetrics(metrics::MetricSet *parent, - const vespalib::string &documentType) + const std::string &documentType) : metrics::MetricSet("transactionlog", {{"documenttype", documentType}}, "Transaction log metrics for a document type", parent), entries("entries", {}, "The current number of entries in the transaction log", this), @@ -31,7 +31,7 @@ void TransLogServerMetrics::considerAddDomains(const DomainStats &stats) { for (const auto &elem : stats) { - const vespalib::string &documentType = elem.first; + const std::string &documentType = elem.first; if (_domainMetrics.find(documentType) == _domainMetrics.end()) { _domainMetrics[documentType] = std::make_unique(_parent, documentType); } @@ -42,7 +42,7 @@ void TransLogServerMetrics::considerRemoveDomains(const DomainStats &stats) { for (auto itr = _domainMetrics.begin(); itr != _domainMetrics.end(); ) { - const vespalib::string &documentType = itr->first; + const std::string &documentType = itr->first; if (stats.find(documentType) == stats.end()) { _parent->unregisterMetric(*itr->second); itr = _domainMetrics.erase(itr); @@ -56,7 +56,7 @@ void TransLogServerMetrics::updateDomainMetrics(const DomainStats &stats) { for (const auto &elem : stats) { - const vespalib::string &documentType = elem.first; + const std::string &documentType = elem.first; _domainMetrics.find(documentType)->second->update(elem.second); } } diff --git a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h index 20e5573ce9ef..83a0f8157f06 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h @@ -21,14 +21,14 @@ class TransLogServerMetrics metrics::DoubleValueMetric replayTime; using UP = std::unique_ptr; - DomainMetrics(metrics::MetricSet *parent, const vespalib::string &documentType); + DomainMetrics(metrics::MetricSet *parent, const std::string &documentType); ~DomainMetrics() override; void update(const search::transactionlog::DomainInfo &stats); }; private: metrics::MetricSet *_parent; - std::map _domainMetrics; + std::map _domainMetrics; void considerAddDomains(const search::transactionlog::DomainStats &stats); void considerRemoveDomains(const search::transactionlog::DomainStats &stats); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp index fafa3b34dc57..5519ce8dd8c9 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp @@ -52,7 +52,7 @@ CommitAndWaitDocumentRetriever::visitDocuments(const LidVector &lids, search::ID } CachedSelect::SP -CommitAndWaitDocumentRetriever::parseSelect(const vespalib::string &selection) const { +CommitAndWaitDocumentRetriever::parseSelect(const std::string &selection) const { return _retriever->parseSelect(selection); } diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h index b985f4f2f145..ee8694bbea04 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h @@ -27,7 +27,7 @@ class CommitAndWaitDocumentRetriever : public IDocumentRetriever DocumentUP getFullDocument(search::DocumentIdT lid) const override; DocumentUP getPartialDocument(search::DocumentIdT lid, const document::DocumentId & docId, const document::FieldSet & fieldSet) const override; void visitDocuments(const LidVector &lids, search::IDocumentVisitor &visitor, ReadConsistency readConsistency) const override; - CachedSelect::SP parseSelect(const vespalib::string &selection) const override; + CachedSelect::SP parseSelect(const std::string &selection) const override; ReadGuard getReadGuard() const override; uint32_t getDocIdLimit() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp index 0f27aada7407..adc94a4d78c3 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp @@ -137,7 +137,7 @@ namespace { class Matcher { public: - Matcher(const IDocumentRetriever &source, bool metaOnly, const vespalib::string &selection) : + Matcher(const IDocumentRetriever &source, bool metaOnly, const std::string &selection) : _dscTrue(true), _metaOnly(metaOnly), _willAlwaysFail(false), diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/i_document_retriever.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/i_document_retriever.h index 7b15a19288c4..1471aee7e95b 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/i_document_retriever.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/i_document_retriever.h @@ -53,7 +53,7 @@ class IDocumentRetriever */ virtual void visitDocuments(const LidVector &lids, search::IDocumentVisitor &visitor, ReadConsistency readConsistency) const = 0; - virtual CachedSelect::SP parseSelect(const vespalib::string &selection) const = 0; + virtual CachedSelect::SP parseSelect(const std::string &selection) const = 0; // Convenience to get all fields DocumentUP getDocument(search::DocumentIdT lid, const document::DocumentId & docId) const; diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h index bbf7f9b16630..c2600b397cd3 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace proton { @@ -15,18 +15,18 @@ struct IResourceWriteFilter { private: bool _acceptWriteOperation; - vespalib::string _message; + std::string _message; public: State() : _acceptWriteOperation(true), _message() {} - State(bool acceptWriteOperation_, const vespalib::string &message_) + State(bool acceptWriteOperation_, const std::string &message_) : _acceptWriteOperation(acceptWriteOperation_), _message(message_) {} bool acceptWriteOperation() const { return _acceptWriteOperation; } - const vespalib::string &message() const { return _message; } + const std::string &message() const { return _message; } }; virtual ~IResourceWriteFilter() {} diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.cpp index ac79c298b1fd..7ae9279077c9 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.cpp @@ -38,16 +38,16 @@ ResourceUsageTracker::ListenerGuard::~ListenerGuard() class ResourceUsageTracker::AttributeUsageListener : public IAttributeUsageListener { std::shared_ptr _tracker; - vespalib::string _document_type; + std::string _document_type; public: - AttributeUsageListener(std::shared_ptr tracker, const vespalib::string& document_type); + AttributeUsageListener(std::shared_ptr tracker, const std::string& document_type); ~AttributeUsageListener() override; void notify_attribute_usage(const AttributeUsageStats &attribute_usage) override; }; -ResourceUsageTracker::AttributeUsageListener::AttributeUsageListener(std::shared_ptr tracker, const vespalib::string &document_type) +ResourceUsageTracker::AttributeUsageListener::AttributeUsageListener(std::shared_ptr tracker, const std::string &document_type) : IAttributeUsageListener(), _tracker(std::move(tracker)), _document_type(document_type) @@ -124,7 +124,7 @@ ResourceUsageTracker::remove_listener() } void -ResourceUsageTracker::remove_document_type(const vespalib::string &document_type) +ResourceUsageTracker::remove_document_type(const std::string &document_type) { std::lock_guard guard(_lock); _attribute_usage.erase(document_type); @@ -149,7 +149,7 @@ bool can_skip_scan(double max, double old_max, bool same_document_type) noexcept } void -ResourceUsageTracker::notify_attribute_usage(const vespalib::string &document_type, const AttributeUsageStats &attribute_usage) +ResourceUsageTracker::notify_attribute_usage(const std::string &document_type, const AttributeUsageStats &attribute_usage) { std::lock_guard guard(_lock); auto& old_usage = _attribute_usage[document_type]; @@ -174,10 +174,10 @@ namespace { class MaxAttributeUsage { const AddressSpaceUsageStats* _max; - const vespalib::string* _document_type; + const std::string* _document_type; double _max_usage; - vespalib::string get_name() const { + std::string get_name() const { return *_document_type + "." + _max->getSubDbName() + "." + _max->getAttributeName() + "." + _max->get_component_name(); } @@ -189,7 +189,7 @@ class MaxAttributeUsage { } - void sample(const vespalib::string& document_type, const AddressSpaceUsageStats& usage) { + void sample(const std::string& document_type, const AddressSpaceUsageStats& usage) { if (_max == nullptr || usage.getUsage().usage() > _max_usage) { _max = &usage; _document_type = &document_type; @@ -205,7 +205,7 @@ class MaxAttributeUsage } } - const vespalib::string get_document_type() const { return _document_type != nullptr ? *_document_type : ""; } + const std::string get_document_type() const { return _document_type != nullptr ? *_document_type : ""; } }; } @@ -231,7 +231,7 @@ ResourceUsageTracker::scan_attribute_usage(bool force_changed, std::lock_guard -ResourceUsageTracker::make_attribute_usage_listener(const vespalib::string &document_type) +ResourceUsageTracker::make_attribute_usage_listener(const std::string &document_type) { return std::make_unique(shared_from_this(), document_type); } diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.h index 48f69659fed4..20d24e894c57 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/resource_usage_tracker.h @@ -30,11 +30,11 @@ class ResourceUsageTracker : public std::enable_shared_from_this _attribute_usage; - vespalib::string _attribute_address_space_max_document_type; + vespalib::hash_map _attribute_usage; + std::string _attribute_address_space_max_document_type; void remove_listener(); - void remove_document_type(const vespalib::string &document_type); - void notify_attribute_usage(const vespalib::string &document_type, const AttributeUsageStats &attribute_usage); + void remove_document_type(const std::string &document_type); + void notify_attribute_usage(const std::string &document_type, const AttributeUsageStats &attribute_usage); bool scan_attribute_usage(bool force_changed, std::lock_guard&); public: ResourceUsageTracker(IDiskMemUsageNotifier& notifier); @@ -42,7 +42,7 @@ class ResourceUsageTracker : public std::enable_shared_from_this set_listener(storage::spi::IResourceUsageListener& listener); - std::unique_ptr make_attribute_usage_listener(const vespalib::string &document_type); + std::unique_ptr make_attribute_usage_listener(const std::string &document_type); }; } diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp index a0d0f003540c..ebfbb05e665e 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp @@ -52,7 +52,7 @@ DocumentDBReference::getGidToLidMapperFactory() } std::unique_ptr -DocumentDBReference::makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) +DocumentDBReference::makeGidToLidChangeRegistrator(const std::string &docTypeName) { return std::make_unique(_gidToLidChangeHandler, docTypeName); } diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h index 08f17e1914c3..c1cb985c39c1 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h @@ -28,7 +28,7 @@ class DocumentDBReference : public IDocumentDBReference virtual std::shared_ptr getAttribute(std::string_view name) override; virtual std::shared_ptr getDocumentMetaStore() const override; virtual std::shared_ptr getGidToLidMapperFactory() override; - virtual std::unique_ptr makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) override; + virtual std::unique_ptr makeGidToLidChangeRegistrator(const std::string &docTypeName) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp index b9082d02ede8..4a667db71165 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp @@ -16,7 +16,7 @@ DocumentDBReferenceRegistry::~DocumentDBReferenceRegistry() = default; std::shared_ptr DocumentDBReferenceRegistry::get(std::string_view name_view) const { - vespalib::string name(name_view); + std::string name(name_view); std::unique_lock guard(_lock); auto itr = _handlers.find(name); while (itr == _handlers.end()) { @@ -29,7 +29,7 @@ DocumentDBReferenceRegistry::get(std::string_view name_view) const std::shared_ptr DocumentDBReferenceRegistry::tryGet(std::string_view name_view) const { - vespalib::string name(name_view); + std::string name(name_view); std::lock_guard guard(_lock); auto itr = _handlers.find(name); if (itr == _handlers.end()) { @@ -42,7 +42,7 @@ DocumentDBReferenceRegistry::tryGet(std::string_view name_view) const void DocumentDBReferenceRegistry::add(std::string_view name_view, std::shared_ptr referee) { - vespalib::string name(name_view); + std::string name(name_view); std::lock_guard guard(_lock); _handlers[name] = referee; _cv.notify_all(); @@ -51,7 +51,7 @@ DocumentDBReferenceRegistry::add(std::string_view name_view, std::shared_ptr guard(_lock); _handlers.erase(name); } diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h index fae0dd2ad7b4..df02681608c3 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h @@ -15,7 +15,7 @@ class DocumentDBReferenceRegistry : public IDocumentDBReferenceRegistry { mutable std::mutex _lock; mutable std::condition_variable _cv; - std::map> _handlers; + std::map> _handlers; public: DocumentDBReferenceRegistry(); virtual ~DocumentDBReferenceRegistry(); diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp index af333d7a8b58..d98d985e5d1e 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp @@ -37,8 +37,8 @@ namespace proton { namespace { -vespalib::string -getTargetDocTypeName(const vespalib::string &attrName, +std::string +getTargetDocTypeName(const std::string &attrName, const DocumentType &thisDocType) { const DataType &attrType = thisDocType.getField(attrName).getDataType(); @@ -48,7 +48,7 @@ getTargetDocTypeName(const vespalib::string &attrName, } ReferenceAttribute::SP -getReferenceAttribute(const vespalib::string &name, const IAttributeManager &attrMgr) +getReferenceAttribute(const std::string &name, const IAttributeManager &attrMgr) { AttributeGuard::UP guard = attrMgr.getAttribute(name); assert(guard.get()); @@ -77,7 +77,7 @@ getReferenceAttributes(const IAttributeManager &attrMgr) } GidToLidChangeRegistrator & -DocumentDBReferenceResolver::getRegistrator(const vespalib::string &docTypeName) +DocumentDBReferenceResolver::getRegistrator(const std::string &docTypeName) { auto &result = _registrators[docTypeName]; if (!result) { @@ -87,7 +87,7 @@ DocumentDBReferenceResolver::getRegistrator(const vespalib::string &docTypeName) } IDocumentDBReference::SP -DocumentDBReferenceResolver::getTargetDocumentDB(const vespalib::string &refAttrName) const +DocumentDBReferenceResolver::getTargetDocumentDB(const std::string &refAttrName) const { return _registry.get(getTargetDocTypeName(refAttrName, _thisDocType)); } @@ -108,7 +108,7 @@ DocumentDBReferenceResolver::detectOldListeners(const IAttributeManager &attrMgr { auto refAttrs(getReferenceAttributes(attrMgr)); for (auto &attrSP : refAttrs) { - vespalib::string docTypeName = getTargetDocTypeName(attrSP->getName(), _prevThisDocType); + std::string docTypeName = getTargetDocTypeName(attrSP->getName(), _prevThisDocType); auto ®istratorUP = _registrators[docTypeName]; if (!registratorUP) { auto reference = _registry.tryGet(docTypeName); @@ -125,7 +125,7 @@ DocumentDBReferenceResolver::listenToGidToLidChanges(const IAttributeManager &at auto refAttrs(getReferenceAttributes(attrMgr)); for (auto &attrSP : refAttrs) { auto &attr = *attrSP; - vespalib::string docTypeName = getTargetDocTypeName(attr.getName(), _thisDocType); + std::string docTypeName = getTargetDocTypeName(attr.getName(), _thisDocType); GidToLidChangeRegistrator ®istrator = getRegistrator(docTypeName); auto listener = std::make_unique(_attributeFieldWriter, attrSP, RetainGuard(_refCount), diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h index a925b53e3829..19c2aa216f7c 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h @@ -2,9 +2,9 @@ #pragma once #include "i_document_db_reference_resolver.h" -#include #include #include +#include namespace document { class DocumentType; @@ -47,10 +47,10 @@ class DocumentDBReferenceResolver : public IDocumentDBReferenceResolver { vespalib::MonitoredRefCount &_refCount; vespalib::ISequencedTaskExecutor &_attributeFieldWriter; bool _useReferences; - std::map> _registrators; + std::map> _registrators; - GidToLidChangeRegistrator &getRegistrator(const vespalib::string &docTypeName); - std::shared_ptr getTargetDocumentDB(const vespalib::string &refAttrName) const; + GidToLidChangeRegistrator &getRegistrator(const std::string &docTypeName); + std::shared_ptr getTargetDocumentDB(const std::string &refAttrName) const; void connectReferenceAttributesToGidMapper(const search::IAttributeManager &attrMgr); std::unique_ptr createImportedAttributesRepo(const search::IAttributeManager &attrMgr, const std::shared_ptr &documentMetaStore, diff --git a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp index 12cef09e67b8..5ff2510da836 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp @@ -31,8 +31,8 @@ DummyGidToLidChangeHandler::addListener(std::unique_ptr } void -DummyGidToLidChangeHandler::removeListeners(const vespalib::string &, - const std::set &) +DummyGidToLidChangeHandler::removeListeners(const std::string &, + const std::set &) { } diff --git a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h index 67356d8785a5..d9d557ce8c46 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h @@ -25,7 +25,7 @@ class DummyGidToLidChangeHandler : public IGidToLidChangeHandler void notifyPut(IDestructorCallbackSP context, GlobalId gid, uint32_t lid, SerialNum serial_num) override; void notifyRemoves(IDestructorCallbackSP context, const std::vector & gid, SerialNum serialNum) override; void addListener(std::unique_ptr listener) override; - void removeListeners(const vespalib::string &docTypeName, const std::set &keepNames) override; + void removeListeners(const std::string &docTypeName, const std::set &keepNames) override; std::unique_ptr grab_pending_changes() override; }; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp index bf354d68d95d..e7e24c908d75 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp @@ -134,8 +134,8 @@ GidToLidChangeHandler::addListener(std::unique_ptr list { lock_guard guard(_lock); if (!_closed) { - const vespalib::string &docTypeName = listener->getDocTypeName(); - const vespalib::string &name = listener->getName(); + const std::string &docTypeName = listener->getDocTypeName(); + const std::string &name = listener->getName(); for (const auto &oldlistener : _listeners) { if (oldlistener->getDocTypeName() == docTypeName && oldlistener->getName() == name) { return; @@ -157,8 +157,8 @@ GidToLidChangeHandler::addListener(std::unique_ptr list namespace { bool shouldRemoveListener(const IGidToLidChangeListener &listener, - const vespalib::string &docTypeName, - const std::set &keepNames) + const std::string &docTypeName, + const std::set &keepNames) { return ((listener.getDocTypeName() == docTypeName) && (keepNames.find(listener.getName()) == keepNames.end())); @@ -167,8 +167,8 @@ bool shouldRemoveListener(const IGidToLidChangeListener &listener, } void -GidToLidChangeHandler::removeListeners(const vespalib::string &docTypeName, - const std::set &keepNames) +GidToLidChangeHandler::removeListeners(const std::string &docTypeName, + const std::set &keepNames) { Listeners deferredDelete; { diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h index 07a22fd7ce2b..99ee12be33d4 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h @@ -64,7 +64,7 @@ class GidToLidChangeHandler : public std::enable_shared_from_this listener) override; - void removeListeners(const vespalib::string &docTypeName, const std::set &keepNames) override; + void removeListeners(const std::string &docTypeName, const std::set &keepNames) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp index 7767fc206190..11f9a025f299 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp @@ -11,8 +11,8 @@ namespace proton { GidToLidChangeListener::GidToLidChangeListener(vespalib::ISequencedTaskExecutor & executor, std::shared_ptr attr, RetainGuard retainGuard, - const vespalib::string &name, - const vespalib::string &docTypeName) + const std::string &name, + const std::string &docTypeName) : _executor(executor), _executorId(_executor.getExecutorIdFromName(attr->getNamePrefix())), _attr(std::move(attr)), @@ -61,13 +61,13 @@ GidToLidChangeListener::notifyRegistered(const std::vector& future.wait(); } -const vespalib::string & +const std::string & GidToLidChangeListener::getName() const { return _name; } -const vespalib::string & +const std::string & GidToLidChangeListener::getDocTypeName() const { return _docTypeName; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h index d6f94e306eff..bedc500981a1 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h @@ -19,21 +19,21 @@ class GidToLidChangeListener : public IGidToLidChangeListener vespalib::ISequencedTaskExecutor::ExecutorId _executorId; std::shared_ptr _attr; vespalib::RetainGuard _retainGuard; - vespalib::string _name; - vespalib::string _docTypeName; + std::string _name; + std::string _docTypeName; public: GidToLidChangeListener(vespalib::ISequencedTaskExecutor &attributeFieldWriter, std::shared_ptr attr, vespalib::RetainGuard refCount, - const vespalib::string &name, - const vespalib::string &docTypeName); + const std::string &name, + const std::string &docTypeName); ~GidToLidChangeListener() override; void notifyPutDone(IDestructorCallbackSP context, document::GlobalId gid, uint32_t lid) override; void notifyRemove(IDestructorCallbackSP context, document::GlobalId gid) override; void notifyRegistered(const std::vector& removes) override; - const vespalib::string &getName() const override; - const vespalib::string &getDocTypeName() const override; + const std::string &getName() const override; + const std::string &getDocTypeName() const override; const std::shared_ptr &getReferenceAttribute() const { return _attr; } }; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp index 9eebb42aaf64..13d0370c4178 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp @@ -7,7 +7,7 @@ namespace proton { GidToLidChangeRegistrator::GidToLidChangeRegistrator(std::shared_ptr handler, - const vespalib::string &docTypeName) + const std::string &docTypeName) : _handler(std::move(handler)), _docTypeName(docTypeName), _keepNames() diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.h index 5cc3dfba4bae..fba757c9df42 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.h @@ -14,12 +14,12 @@ namespace proton { class GidToLidChangeRegistrator { std::shared_ptr _handler; - vespalib::string _docTypeName; - std::set _keepNames; + std::string _docTypeName; + std::set _keepNames; public: GidToLidChangeRegistrator(std::shared_ptr handler, - const vespalib::string &docTypeName); + const std::string &docTypeName); ~GidToLidChangeRegistrator(); void addListener(std::unique_ptr listener); }; diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h index a05367e97660..bc621a0dcb71 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace search::attribute { class ReadableAttributeVector; } @@ -30,7 +30,7 @@ class IDocumentDBReference virtual std::shared_ptr getAttribute(std::string_view name) = 0; virtual std::shared_ptr getDocumentMetaStore() const = 0; virtual std::shared_ptr getGidToLidMapperFactory() = 0; - virtual std::unique_ptr makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) = 0; + virtual std::unique_ptr makeGidToLidChangeRegistrator(const std::string &docTypeName) = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h index c8b74e4adfa1..b9ce47bee737 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h index 25d5257a38f5..d8b0f817a245 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h @@ -36,8 +36,8 @@ class IGidToLidChangeHandler * Remove listeners with matching docTypeName unless name is present in * keepNames. */ - virtual void removeListeners(const vespalib::string &docTypeName, - const std::set &keepNames) = 0; + virtual void removeListeners(const std::string &docTypeName, + const std::set &keepNames) = 0; /** * Notify pending gid to lid mapping change. Passed on to listeners later * when force commit has made changes visible. diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h index 1393290bdba2..c46033f14e5f 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include #include namespace document { class GlobalId; } @@ -22,8 +22,8 @@ class IGidToLidChangeListener virtual void notifyPutDone(IDestructorCallbackSP context, document::GlobalId gid, uint32_t lid) = 0; virtual void notifyRemove(IDestructorCallbackSP context, document::GlobalId gid) = 0; virtual void notifyRegistered(const std::vector& removes) = 0; - virtual const vespalib::string &getName() const = 0; - virtual const vespalib::string &getDocTypeName() const = 0; + virtual const std::string &getName() const = 0; + virtual const std::string &getDocTypeName() const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp index 0533a7206372..2996819ef41b 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp @@ -44,7 +44,7 @@ getAttributeSetToPopulate(const ARIConfig &newCfg, std::vector attrList; newCfg.getAttrMgr()->getAttributeList(attrList); for (const auto &guard : attrList) { - const vespalib::string &name = guard->getName(); + const std::string &name = guard->getName(); bool inOldAttrMgr = oldCfg.getAttrMgr()->getAttribute(name)->valid(); bool unchangedField = inspector.hasUnchangedField(name); search::SerialNum flushedSerialNum = newCfg.getAttrMgr()->getFlushedSerialNum(name); @@ -62,7 +62,7 @@ IReprocessingReader::SP getAttributesToPopulate(const ARIConfig &newCfg, const ARIConfig &oldCfg, const IDocumentTypeInspector &inspector, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum serialNum) { FilterAttributeManager::AttributeSet attrsToPopulate = @@ -80,13 +80,13 @@ getFieldsToPopulate(const ARIConfig &newCfg, const ARIConfig &oldCfg, const IDocumentTypeInspector &inspector, const IIndexschemaInspector &oldIndexschemaInspector, - const vespalib::string &subDbName) + const std::string &subDbName) { std::vector fieldsToPopulate; std::vector attrList; oldCfg.getAttrMgr()->getAttributeList(attrList); for (const auto &guard : attrList) { - const vespalib::string &name = guard->getName(); + const std::string &name = guard->getName(); const auto &attrCfg = guard->getConfig(); bool inNewAttrMgr = newCfg.getAttrMgr()->getAttribute(name)->valid(); bool unchangedField = inspector.hasUnchangedField(name); @@ -116,7 +116,7 @@ AttributeReprocessingInitializer(const Config &newCfg, const Config &oldCfg, const IDocumentTypeInspector &inspector, const IIndexschemaInspector &oldIndexschemaInspector, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum serialNum) : _attrsToPopulate(getAttributesToPopulate(newCfg, oldCfg, inspector, subDbName, serialNum)), _fieldsToPopulate(getFieldsToPopulate(newCfg, oldCfg, inspector, oldIndexschemaInspector, subDbName)) diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h index 885ce4fc85ac..0551782b5986 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h @@ -52,7 +52,7 @@ class AttributeReprocessingInitializer : public IReprocessingInitializer const Config &oldCfg, const IDocumentTypeInspector &inspector, const IIndexschemaInspector &oldIndexschemaInspector, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum serialNum); // Implements IReprocessingInitializer diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.cpp index 214e4a75e1ae..5ceb4b485677 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.cpp @@ -14,7 +14,7 @@ ReprocessDocumentsTask:: ReprocessDocumentsTask(IReprocessingInitializer &initializer, const proton::ISummaryManager::SP &sm, const std::shared_ptr &docTypeRepo, - const vespalib::string &subDbName, + const std::string &subDbName, uint32_t docIdLimit) : _sm(sm), _docTypeRepo(docTypeRepo), diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h index ff3c6ba60f77..ec4039167cb2 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h @@ -23,7 +23,7 @@ class ReprocessDocumentsTask : public IReprocessingTask, using clock = std::chrono::steady_clock; proton::ISummaryManager::SP _sm; std::shared_ptr _docTypeRepo; - vespalib::string _subDbName; + std::string _subDbName; double _visitorProgress; double _visitorCost; DocumentReprocessingHandler _handler; @@ -35,7 +35,7 @@ class ReprocessDocumentsTask : public IReprocessingTask, ReprocessDocumentsTask(IReprocessingInitializer &initializer, const proton::ISummaryManager::SP &sm, const std::shared_ptr &docTypeRepo, - const vespalib::string &subDbName, + const std::string &subDbName, uint32_t docIdLimit); void run() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.cpp b/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.cpp index ee5dbb620379..6aed4d08a016 100644 --- a/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.cpp @@ -27,14 +27,14 @@ BlockableMaintenanceJob::internalNotifyDiskMemUsage(const DiskMemUsageState &sta } } -BlockableMaintenanceJob::BlockableMaintenanceJob(const vespalib::string &name, +BlockableMaintenanceJob::BlockableMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval) : BlockableMaintenanceJob(name, delay, interval, BlockableMaintenanceJobConfig()) { } -BlockableMaintenanceJob::BlockableMaintenanceJob(const vespalib::string &name, +BlockableMaintenanceJob::BlockableMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval, const BlockableMaintenanceJobConfig &config) diff --git a/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.h index 114f9de459d8..aaabac8d0909 100644 --- a/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/blockable_maintenance_job.h @@ -35,11 +35,11 @@ class BlockableMaintenanceJob : public IBlockableMaintenanceJob { void internalNotifyDiskMemUsage(const DiskMemUsageState &state); public: - BlockableMaintenanceJob(const vespalib::string &name, + BlockableMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval); - BlockableMaintenanceJob(const vespalib::string &name, + BlockableMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval, const BlockableMaintenanceJobConfig &config); diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp index 24b9b716c68d..f23fde5fd1b8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp @@ -26,7 +26,7 @@ using BucketspacesConfigSP = std::shared_ptr; namespace proton { -BootstrapConfigManager::BootstrapConfigManager(const vespalib::string & configId) +BootstrapConfigManager::BootstrapConfigManager(const std::string & configId) : _pendingConfigSnapshot(), _configId(configId), _pendingConfigMutex() diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h index f67c26452665..20daea59176f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h @@ -17,7 +17,7 @@ class BootstrapConfig; class BootstrapConfigManager { public: - BootstrapConfigManager(const vespalib::string & configId); + BootstrapConfigManager(const std::string & configId); ~BootstrapConfigManager(); const config::ConfigKeySet createConfigKeySet() const; @@ -26,7 +26,7 @@ class BootstrapConfigManager private: std::shared_ptr _pendingConfigSnapshot; - vespalib::string _configId; + std::string _configId; mutable std::mutex _pendingConfigMutex; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp index b0de87fc7712..39d9949a8e81 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp @@ -67,7 +67,7 @@ BucketMoveJob::BucketMoveJob(std::shared_ptr calc, IBucketStateChangedNotifier &bucketStateChangedNotifier, IDiskMemUsageNotifier &diskMemUsageNotifier, const BlockableMaintenanceJobConfig &blockableConfig, - const vespalib::string &docTypeName, + const std::string &docTypeName, document::BucketSpace bucketSpace) : BlockableMaintenanceJob("move_buckets." + docTypeName, vespalib::duration::zero(), vespalib::duration::zero(), blockableConfig), IClusterStateChangedHandler(), @@ -128,7 +128,7 @@ BucketMoveJob::create(std::shared_ptr calc, IBucketStateChangedNotifier &bucketStateChangedNotifier, IDiskMemUsageNotifier &diskMemUsageNotifier, const BlockableMaintenanceJobConfig &blockableConfig, - const vespalib::string &docTypeName, + const std::string &docTypeName, document::BucketSpace bucketSpace) { return {new BucketMoveJob(std::move(calc), std::move(dbRetainer), moveHandler, modifiedHandler, master, bucketExecutor, ready, notReady, diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h index cfb59d7024ed..e4e6951e3f71 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h +++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h @@ -102,7 +102,7 @@ class BucketMoveJob final : public BlockableMaintenanceJob, IBucketStateChangedNotifier &bucketStateChangedNotifier, IDiskMemUsageNotifier &diskMemUsageNotifier, const BlockableMaintenanceJobConfig &blockableConfig, - const vespalib::string &docTypeName, + const std::string &docTypeName, document::BucketSpace bucketSpace); void startMove(BucketMover & mover, size_t maxDocsToMove); @@ -137,7 +137,7 @@ class BucketMoveJob final : public BlockableMaintenanceJob, IBucketStateChangedNotifier &bucketStateChangedNotifier, IDiskMemUsageNotifier &diskMemUsageNotifier, const BlockableMaintenanceJobConfig &blockableConfig, - const vespalib::string &docTypeName, + const std::string &docTypeName, document::BucketSpace bucketSpace); ~BucketMoveJob() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/ddbstate.cpp b/searchcore/src/vespa/searchcore/proton/server/ddbstate.cpp index 868c1fa1240f..27ee0fd08724 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ddbstate.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/ddbstate.cpp @@ -5,7 +5,7 @@ namespace proton { -std::vector DDBState::_stateNames = +std::vector DDBState::_stateNames = { "CONSTRUCT", "LOAD", @@ -18,7 +18,7 @@ std::vector DDBState::_stateNames = "DEAD", }; -std::vector DDBState::_configStateNames = +std::vector DDBState::_configStateNames = { "OK", "NEED_RESTART" @@ -156,14 +156,14 @@ DDBState::clearDelayedConfig() } -vespalib::string +std::string DDBState::getStateString(State state) { return _stateNames[static_cast(state)]; } -vespalib::string +std::string DDBState::getConfigStateString(ConfigState configState) { return _configStateNames[static_cast(configState)]; diff --git a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h index 71daef67c9d1..ce386f1c8aaa 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ddbstate.h +++ b/searchcore/src/vespa/searchcore/proton/server/ddbstate.h @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include -#include #include +#include +#include #include namespace proton { @@ -46,8 +46,8 @@ class DDBState Mutex _lock; // protects state transition std::condition_variable _cond; - static std::vector _stateNames; - static std::vector _configStateNames; + static std::vector _stateNames; + static std::vector _configStateNames; void set_state(State state) noexcept { _state.store(state, std::memory_order_release); } @@ -68,7 +68,7 @@ class DDBState void enterShutdownState(); void enterDeadState(); State getState() const noexcept { return _state.load(std::memory_order_acquire); } - static vespalib::string getStateString(State state); + static std::string getStateString(State state); bool getClosed() const noexcept { State state(getState()); @@ -101,7 +101,7 @@ class DDBState void clearDelayedConfig(); ConfigState getConfigState() const noexcept { return _configState.load(std::memory_order_relaxed); } - static vespalib::string getConfigStateString(ConfigState configState); + static std::string getConfigStateString(ConfigState configState); void setConfigState(ConfigState newConfigState); void waitForOnlineState(); }; diff --git a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp index f82804ab2356..4934f63f1324 100644 --- a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp @@ -69,7 +69,7 @@ makeDiskLimitMessage(std::ostream &os, os << "}"; } -vespalib::string +std::string makeUnblockingMessage(double memoryUsed, double memoryLimit, const vespalib::ProcessMemoryStats &memoryStats, @@ -117,7 +117,7 @@ DiskMemUsageFilter::recalcState(const Guard &guard) _acceptWrite = false; } else { if (!_acceptWrite) { - vespalib::string unblockMsg = makeUnblockingMessage(memoryUsed, + std::string unblockMsg = makeUnblockingMessage(memoryUsed, _config._memoryLimit, _memoryStats, _hwInfo, diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp index fa7adeda4b0d..6054c0509adb 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp @@ -41,12 +41,12 @@ DocumentDBExplorer::get_state(const Inserter &inserter, bool full) const } } -const vespalib::string SUB_DB = "subdb"; -const vespalib::string THREADING_SERVICE = "threadingservice"; -const vespalib::string BUCKET_DB = "bucketdb"; -const vespalib::string MAINTENANCE_CONTROLLER = "maintenancecontroller"; +const std::string SUB_DB = "subdb"; +const std::string THREADING_SERVICE = "threadingservice"; +const std::string BUCKET_DB = "bucketdb"; +const std::string MAINTENANCE_CONTROLLER = "maintenancecontroller"; -std::vector +std::vector DocumentDBExplorer::get_children_names() const { return {SUB_DB, THREADING_SERVICE, BUCKET_DB, MAINTENANCE_CONTROLLER}; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.h b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.h index 5147f8bf3136..890761b7222e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.h @@ -21,7 +21,7 @@ class DocumentDBExplorer : public vespalib::StateExplorer ~DocumentDBExplorer() override; void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h index 178b2ca8af32..eb1da9726a62 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h @@ -3,9 +3,9 @@ #include "document_db_flush_config.h" #include -#include #include #include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.cpp index cbd906849631..ac28ed708c45 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.cpp @@ -7,9 +7,9 @@ using vespalib::slime::Inserter; namespace proton { -const vespalib::string READY = "ready"; -const vespalib::string REMOVED = "removed"; -const vespalib::string NOT_READY = "notready"; +const std::string READY = "ready"; +const std::string REMOVED = "removed"; +const std::string NOT_READY = "notready"; namespace { @@ -34,7 +34,7 @@ DocumentSubDBCollectionExplorer::get_state(const Inserter &inserter, bool full) (void) full; } -std::vector +std::vector DocumentSubDBCollectionExplorer::get_children_names() const { return {READY, REMOVED, NOT_READY}; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.h b/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.h index 41ac5f568d34..0b106494be95 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_collection_explorer.h @@ -19,7 +19,7 @@ class DocumentSubDBCollectionExplorer : public vespalib::StateExplorer DocumentSubDBCollectionExplorer(const DocumentSubDBCollection &subDbs); void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.cpp index 709c9dbb492c..c9862e98850d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.cpp @@ -15,11 +15,11 @@ namespace proton { namespace { -const vespalib::string DOCUMENT_META_STORE = "documentmetastore"; -const vespalib::string DOCUMENT_STORE = "documentstore"; -const vespalib::string ATTRIBUTE = "attribute"; -const vespalib::string ATTRIBUTE_WRITER = "attributewriter"; -const vespalib::string INDEX = "index"; +const std::string DOCUMENT_META_STORE = "documentmetastore"; +const std::string DOCUMENT_STORE = "documentstore"; +const std::string ATTRIBUTE = "attribute"; +const std::string ATTRIBUTE_WRITER = "attributewriter"; +const std::string INDEX = "index"; } @@ -35,10 +35,10 @@ DocumentSubDBExplorer::get_state(const Inserter &inserter, bool full) const inserter.insertObject(); } -std::vector +std::vector DocumentSubDBExplorer::get_children_names() const { - std::vector children = {DOCUMENT_META_STORE, DOCUMENT_STORE}; + std::vector children = {DOCUMENT_META_STORE, DOCUMENT_STORE}; if (_subDb.getAttributeManager()) { children.push_back(ATTRIBUTE); } diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.h b/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.h index 852a45253651..11755c9ab1a2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_explorer.h @@ -19,7 +19,7 @@ class DocumentSubDBExplorer : public vespalib::StateExplorer DocumentSubDBExplorer(const IDocumentSubDB &subDb); void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index d47bed8936f3..c5476c7f9391 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -137,9 +137,9 @@ DocumentDB::masterExecute(FunctionType &&function) { } DocumentDB::SP -DocumentDB::create(const vespalib::string &baseDir, +DocumentDB::create(const std::string &baseDir, DocumentDBConfig::SP currentSnapshot, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, matching::QueryLimiter &queryLimiter, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, @@ -160,9 +160,9 @@ DocumentDB::create(const vespalib::string &baseDir, metricsWireService, fileHeaderContext, std::move(attribute_interlock), std::move(config_store), std::move(initializeThreads), hwInfo)); } -DocumentDB::DocumentDB(const vespalib::string &baseDir, +DocumentDB::DocumentDB(const std::string &baseDir, DocumentDBConfig::SP configSnapshot, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, matching::QueryLimiter &queryLimiter, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, @@ -513,7 +513,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum auto end_time = vespalib::steady_clock::now(); auto state_string = DDBState::getStateString(_state.getState()); auto config_state_string = DDBState::getConfigStateString(_state.getConfigState()); - vespalib::string saved_string(save_config ? "yes" : "no"); + std::string saved_string(save_config ? "yes" : "no"); LOG(info, "DocumentDB(%s): Applied config, state=%s, config_state=%s, saved=%s, serialNum=%" PRIu64 ", %.3fs of %.3fs in write thread", _docTypeName.toString().c_str(), state_string.c_str(), @@ -859,8 +859,8 @@ DocumentDB::reportStatus() const StatusReport::Params params("documentdb:" + _docTypeName.toString()); const DDBState::State rawState = _state.getState(); { - const vespalib::string state(DDBState::getStateString(rawState)); - const vespalib::string configState(DDBState::getConfigStateString(_state.getConfigState())); + const std::string state(DDBState::getStateString(rawState)); + const std::string configState(DDBState::getConfigStateString(_state.getConfigState())); params.internalState(state).internalConfigState(configState); } @@ -869,7 +869,7 @@ DocumentDB::reportStatus() const message("DocumentDB initializing components")); } else if (_feedHandler->isDoingReplay()) { float progress = _feedHandler->getReplayProgress() * 100.0f; - vespalib::string msg = vespalib::make_string("DocumentDB replay transaction log on startup (%u%% done)", + std::string msg = vespalib::make_string("DocumentDB replay transaction log on startup (%u%% done)", static_cast(progress)); return StatusReport::create(params.state(StatusReport::PARTIAL).progress(progress).message(msg)); } else if (rawState == DDBState::State::APPLY_LIVE_CONFIG) { @@ -879,7 +879,7 @@ DocumentDB::reportStatus() const rawState == DDBState::State::REDO_REPROCESS) { float progress = _subDBs.getReprocessingProgress() * 100.0f; - vespalib::string msg = make_string("DocumentDB reprocess on startup (%u%% done)", + std::string msg = make_string("DocumentDB reprocess on startup (%u%% done)", static_cast(progress)); return StatusReport::create(params.state(StatusReport::PARTIAL).progress(progress).message(msg)); } else if (_state.getDelayedConfig()) { @@ -1028,7 +1028,7 @@ namespace { void notifyBucketsChanged(const documentmetastore::IBucketHandler &metaStore, IBucketModifiedHandler &handler, - const vespalib::string &name) + const std::string &name) { bucketdb::Guard guard = metaStore.getBucketDB().takeGuard(); document::BucketId::List buckets = guard->getBuckets(); @@ -1091,7 +1091,7 @@ DocumentDB::waitForOnlineState() _state.waitForOnlineState(); } -vespalib::string +std::string DocumentDB::getName() const { return _docTypeName.getName(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 3c98f79bb47b..c3fad477fc60 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -106,7 +106,7 @@ class DocumentDB : public DocumentDBConfigOwner, DocTypeName _docTypeName; document::BucketSpace _bucketSpace; - vespalib::string _baseDir; + std::string _baseDir; ThreadingServiceConfig _writeServiceConfig; // Only one thread per executor, or dropFeedView() will fail. ExecutorThreadingService _writeService; @@ -214,9 +214,9 @@ class DocumentDB : public DocumentDBConfigOwner, // Invokes initFinish() on self friend class InitDoneTask; - DocumentDB(const vespalib::string &baseDir, + DocumentDB(const std::string &baseDir, DocumentDBConfigSP currentSnapshot, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, matching::QueryLimiter &queryLimiter, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, @@ -244,9 +244,9 @@ class DocumentDB : public DocumentDBConfigOwner, * @param config_store Access to read and write configs. */ static DocumentDB::SP - create(const vespalib::string &baseDir, + create(const std::string &baseDir, DocumentDBConfigSP currentSnapshot, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, matching::QueryLimiter &queryLimiter, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, @@ -324,7 +324,7 @@ class DocumentDB : public DocumentDBConfigOwner, * * @return The directory name. */ - const vespalib::string &getBaseDirectory() const { return _baseDir; } + const std::string &getBaseDirectory() const { return _baseDir; } const DocumentSubDBCollection &getDocumentSubDBs() const { return _subDBs; } @@ -391,7 +391,7 @@ class DocumentDB : public DocumentDBConfigOwner, * Implements IDocumentSubDBOwner */ document::BucketSpace getBucketSpace() const override; - vespalib::string getName() const override; + std::string getName() const override; uint32_t getDistributionKey() const override; matching::SessionManager &session_manager() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp index 3c7d197d5e17..d28076e015fb 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp @@ -94,7 +94,7 @@ struct TempAttributeMetric struct TempAttributeMetrics { - using AttrMap = std::map; + using AttrMap = std::map; TempAttributeMetric total; AttrMap attrs; }; @@ -112,7 +112,7 @@ isNotReadySubDB(const IDocumentSubDB *subDb, const DocumentSubDBCollection &subD } void -fillTempAttributeMetrics(TempAttributeMetrics &metrics, const vespalib::string &attrName, +fillTempAttributeMetrics(TempAttributeMetrics &metrics, const std::string &attrName, const MemoryUsage &memoryUsage, uint32_t bitVectors) { metrics.total.memoryUsage.merge(memoryUsage); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index f2b2f286acdc..659e86967520 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -71,8 +71,8 @@ DocumentDBConfig::DocumentDBConfig( const search::LogDocumentStore::Config & storeConfig, const ThreadingServiceConfig & threading_service_config, const AllocConfig & alloc_config, - const vespalib::string &configId, - const vespalib::string &docTypeName) noexcept + const std::string &configId, + const std::string &docTypeName) noexcept : _configId(configId), _docTypeName(docTypeName), _generation(generation), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index d03995e7cd4f..fe72c35b1407 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -111,8 +111,8 @@ class DocumentDBConfig using ImportedFieldsConfigSP = std::shared_ptr; private: - vespalib::string _configId; - vespalib::string _docTypeName; + std::string _configId; + std::string _docTypeName; int64_t _generation; RankProfilesConfigSP _rankProfiles; std::shared_ptr _rankingConstants; @@ -170,17 +170,17 @@ class DocumentDBConfig const search::LogDocumentStore::Config & storeConfig, const ThreadingServiceConfig & threading_service_config, const AllocConfig & alloc_config, - const vespalib::string &configId, - const vespalib::string &docTypeName) noexcept; + const std::string &configId, + const std::string &docTypeName) noexcept; DocumentDBConfig(const DocumentDBConfig &cfg) noexcept; DocumentDBConfig & operator=(const DocumentDBConfig &cfg) = delete; ~DocumentDBConfig(); - const vespalib::string &getConfigId() const { return _configId; } - void setConfigId(const vespalib::string &configId) { _configId = configId; } + const std::string &getConfigId() const { return _configId; } + void setConfigId(const std::string &configId) { _configId = configId; } - const vespalib::string &getDocTypeName() const { return _docTypeName; } + const std::string &getDocTypeName() const { return _docTypeName; } int64_t getGeneration() const { return _generation; } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index 150de1c9cec5..3557cc01aeae 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -95,7 +95,7 @@ namespace { DocumentDBMaintenanceConfig::SP buildMaintenanceConfig(const BootstrapConfig::SP &bootstrapConfig, - const vespalib::string &docTypeName) + const std::string &docTypeName) { using DdbConfig = ProtonConfig::Documentdb; ProtonConfig &proton(bootstrapConfig->getProtonConfig()); @@ -214,7 +214,7 @@ filterImportedAttributes(const AttributesConfigSP &attrCfg) const ProtonConfig::Documentdb default_document_db_config_entry; const ProtonConfig::Documentdb& -find_document_db_config_entry(const ProtonConfig::DocumentdbVector& document_dbs, const vespalib::string& doc_type_name) { +find_document_db_config_entry(const ProtonConfig::DocumentdbVector& document_dbs, const std::string& doc_type_name) { for (const auto & db_cfg : document_dbs) { if (db_cfg.inputdoctypename == doc_type_name) { return db_cfg; @@ -236,7 +236,7 @@ use_hw_memory_presized_target_num_docs([[maybe_unused]] ProtonConfig::Documentdb } AllocConfig -build_alloc_config(const vespalib::HwInfo & hwInfo, const ProtonConfig& proton_config, const vespalib::string& doc_type_name) +build_alloc_config(const vespalib::HwInfo & hwInfo, const ProtonConfig& proton_config, const std::string& doc_type_name) { // This is an approximate number based on observation of a node using 33G memory with 765M docs constexpr uint64_t MIN_MEMORY_COST_PER_DOCUMENT = 46; @@ -371,7 +371,7 @@ DocumentDBConfigManager::update(FNET_Transport & transport, const ConfigSnapshot DocumentDBConfigManager:: -DocumentDBConfigManager(const vespalib::string &configId, const vespalib::string &docTypeName) +DocumentDBConfigManager(const std::string &configId, const std::string &docTypeName) : _configId(configId), _docTypeName(docTypeName), _bootstrapConfig(), @@ -401,7 +401,7 @@ forwardConfig(const BootstrapConfig::SP & config) } } -DocumentDBConfigHelper::DocumentDBConfigHelper(const DirSpec &spec, const vespalib::string &docTypeName) +DocumentDBConfigHelper::DocumentDBConfigHelper(const DirSpec &spec, const std::string &docTypeName) : _mgr("", docTypeName), _retriever(make_unique(_mgr.createConfigKeySet(), make_shared(spec))) { } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h index 07e05dc1585f..6facd65057f7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h @@ -25,8 +25,8 @@ class DocumentDBConfigManager using BootstrapConfigSP = std::shared_ptr; private: - vespalib::string _configId; - vespalib::string _docTypeName; + std::string _configId; + std::string _docTypeName; BootstrapConfigSP _bootstrapConfig; DocumentDBConfig::SP _pendingConfigSnapshot; bool _ignoreForwardedConfig; @@ -37,7 +37,7 @@ class DocumentDBConfigManager const DocumentDBConfig::IndexschemaConfig & newIndexschemaConfig); public: - DocumentDBConfigManager(const vespalib::string &configId, const vespalib::string &docTypeName); + DocumentDBConfigManager(const std::string &configId, const std::string &docTypeName); ~DocumentDBConfigManager(); void update(FNET_Transport & transport, const config::ConfigSnapshot & snapshot); @@ -45,7 +45,7 @@ class DocumentDBConfigManager void forwardConfig(const BootstrapConfigSP & config); config::ConfigKeySet createConfigKeySet() const; - const vespalib::string & getConfigId() const { return _configId; } + const std::string & getConfigId() const { return _configId; } }; /** @@ -54,7 +54,7 @@ class DocumentDBConfigManager class DocumentDBConfigHelper { public: - DocumentDBConfigHelper(const config::DirSpec &spec, const vespalib::string &docTypeName); + DocumentDBConfigHelper(const config::DirSpec &spec, const std::string &docTypeName); ~DocumentDBConfigHelper(); bool nextGeneration(FNET_Transport & transport, vespalib::duration timeout); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp index 7b49c02c66a5..cdba7e1e8835 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp @@ -97,7 +97,7 @@ ::DocumentRetriever(const DocTypeName &docTypeName, for (const Field* field : fields) { if ((field->getDataType().getId() == positionDataTypeId) || is_array_of_position_type(field->getDataType())) { LOG(debug, "Field '%s' is a position field", field->getName().c_str()); - const vespalib::string & zcurve_name = PositionDataType::getZCurveFieldName(field->getName()); + const std::string & zcurve_name = PositionDataType::getZCurveFieldName(field->getName()); AttributeGuard::UP attr = attr_manager.getAttribute(zcurve_name); if (attr && attr->valid()) { LOG(debug, "Field '%s' is a registered attribute field", zcurve_name.c_str()); @@ -106,7 +106,7 @@ ::DocumentRetriever(const DocTypeName &docTypeName, _areAllFieldsAttributes = false; } } else { - const vespalib::string &name = field->getName(); + const std::string &name = field->getName(); AttributeGuard::UP attr = attr_manager.getAttribute(name); if (attr && attr->valid() && !_schema.isIndexField(field->getName()) diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretriever.h b/searchcore/src/vespa/searchcore/proton/server/documentretriever.h index d4478e28c88c..729e6e778a67 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretriever.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentretriever.h @@ -34,7 +34,7 @@ class FieldSetAttributeDB { class DocumentRetriever : public DocumentRetrieverBase, public IFieldInfo { public: - using PositionFields = std::vector>; + using PositionFields = std::vector>; DocumentRetriever(const DocTypeName &docTypeName, const document::DocumentTypeRepo &repo, const search::index::Schema &schema, diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp index 77ba86f78f8a..e6748a5e99db 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp @@ -41,7 +41,7 @@ DocumentRetrieverBase::getDocumentMetaData(const DocumentId &id) const { } CachedSelect::SP -DocumentRetrieverBase::parseSelect(const vespalib::string &selection) const +DocumentRetrieverBase::parseSelect(const std::string &selection) const { { std::lock_guard guard(_lock); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.h b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.h index fe5a7a1392d1..d816b2b803a5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.h @@ -17,7 +17,7 @@ class DocumentRetrieverBase : public IDocumentRetriever const document::DocumentTypeRepo &_repo; const IDocumentMetaStoreContext &_meta_store; - using SelectCache = vespalib::lrucache_map>; + using SelectCache = vespalib::lrucache_map>; mutable SelectCache _selectCache; mutable std::mutex _lock; @@ -39,7 +39,7 @@ class DocumentRetrieverBase : public IDocumentRetriever const document::DocumentTypeRepo &getDocumentTypeRepo() const override { return _repo; } void getBucketMetaData(const storage::spi::Bucket &bucket, search::DocumentMetaData::Vector &result) const override; search::DocumentMetaData getDocumentMetaData(const document::DocumentId &id) const override; - CachedSelect::SP parseSelect(const vespalib::string &selection) const override; + CachedSelect::SP parseSelect(const std::string &selection) const override; ReadGuard getReadGuard() const override { return _meta_store.getReadGuard(); } uint32_t getDocIdLimit() const override { return _meta_store.getReadGuard()->get().getCommittedDocIdLimit(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 78101ca6afeb..db71f4325b44 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -36,7 +36,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( matching::QueryLimiter &queryLimiter, const std::atomic & now_ref, std::mutex &configMutex, - const vespalib::string &baseDir, + const std::string &baseDir, const vespalib::HwInfo &hwInfo) : _subDBs(), _owner(owner), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 5f32b9184a71..93f7d3d598e3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -92,7 +92,7 @@ class DocumentSubDBCollection { matching::QueryLimiter & queryLimiter, const std::atomic & now_ref, std::mutex &configMutex, - const vespalib::string &baseDir, + const std::string &baseDir, const vespalib::HwInfo &hwInfo); ~DocumentSubDBCollection(); diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_explorer_utils.cpp b/searchcore/src/vespa/searchcore/proton/server/executor_explorer_utils.cpp index 64a9863c19aa..ae6bc596493d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executor_explorer_utils.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/executor_explorer_utils.cpp @@ -22,7 +22,7 @@ namespace proton::explorer { namespace { void -convert_syncable_executor_to_slime(const ThreadExecutor& executor, const vespalib::string& type, Cursor& object) +convert_syncable_executor_to_slime(const ThreadExecutor& executor, const std::string& type, Cursor& object) { object.setString("type", type); object.setLong("num_threads", executor.getNumThreads()); @@ -38,7 +38,7 @@ convert_single_executor_to_slime(const SingleExecutor& executor, Cursor& object) } void -set_type(Cursor& object, const vespalib::string& type) +set_type(Cursor& object, const std::string& type) { object.setString("type", type); } diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp index 1e96f604530f..7c9af86dee28 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp @@ -36,9 +36,9 @@ namespace { struct AttributeGuardComp { - vespalib::string name; + std::string name; - AttributeGuardComp(const vespalib::string &n) + AttributeGuardComp(const std::string &n) : name(n) { } @@ -90,10 +90,10 @@ FastAccessDocSubDB::createAttributeManagerInitializer(const DocumentDBConfig &co namespace { -vespalib::hash_set +vespalib::hash_set get_attribute_names(const proton::IAttributeManager& mgr) { - vespalib::hash_set both; + vespalib::hash_set both; std::vector list; mgr.getAttributeListAll(list); for (const auto& attr : list) { diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp index 28d676208430..8c7367482a36 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp @@ -39,7 +39,7 @@ FastAccessDocSubDBConfigurer::reconfigureFeedView(FastAccessFeedView & curr, } FastAccessDocSubDBConfigurer::FastAccessDocSubDBConfigurer(FeedViewVarHolder &feedView, - const vespalib::string &subDbName) + const std::string &subDbName) : _feedView(feedView), _subDbName(subDbName) { diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h index 31f419e6aae2..af6074905e42 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h @@ -3,10 +3,10 @@ #pragma once #include -#include #include #include #include +#include namespace document { class DocumentTypeRepo; } namespace search::index { class Schema; } @@ -32,7 +32,7 @@ class FastAccessDocSubDBConfigurer private: FeedViewVarHolder &_feedView; - vespalib::string _subDbName; + std::string _subDbName; void reconfigureFeedView(FastAccessFeedView & curr, std::shared_ptr schema, @@ -41,7 +41,7 @@ class FastAccessDocSubDBConfigurer public: FastAccessDocSubDBConfigurer(FeedViewVarHolder &feedView, - const vespalib::string &subDbName); + const std::string &subDbName); ~FastAccessDocSubDBConfigurer(); std::unique_ptr diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index b98b83a6e8e5..949511cd2ec7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -394,7 +394,7 @@ FeedHandler::doChangeFeedState(FeedStateSP newState) } FeedHandler::FeedHandler(IThreadingService &writeService, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, const DocTypeName &docTypeName, IFeedHandlerOwner &owner, const IResourceWriteFilter &writeFilter, @@ -591,8 +591,8 @@ namespace { template void -feedOperationRejected(FeedToken & token, const vespalib::string &opType, const vespalib::string &docId, - const DocTypeName & docTypeName, const vespalib::string &rejectMessage) +feedOperationRejected(FeedToken & token, const std::string &opType, const std::string &docId, + const DocTypeName & docTypeName, const std::string &rejectMessage) { if (token) { auto message = make_string("%s operation rejected for document '%s' of type '%s': '%s'", @@ -604,13 +604,13 @@ feedOperationRejected(FeedToken & token, const vespalib::string &opType, const v void notifyFeedOperationRejected(FeedToken & token, const FeedOperation &op, - const DocTypeName & docTypeName, const vespalib::string &rejectMessage) + const DocTypeName & docTypeName, const std::string &rejectMessage) { if ((op.getType() == FeedOperation::UPDATE_42) || (op.getType() == FeedOperation::UPDATE)) { - vespalib::string docId = (static_cast(op)).getUpdate()->getId().toString(); + std::string docId = (static_cast(op)).getUpdate()->getId().toString(); feedOperationRejected(token, "Update", docId, docTypeName, rejectMessage); } else if (op.getType() == FeedOperation::PUT) { - vespalib::string docId = (static_cast(op)).getDocument()->getId().toString(); + std::string docId = (static_cast(op)).getDocument()->getId().toString(); feedOperationRejected(token, "Put", docId, docTypeName, rejectMessage); } else { feedOperationRejected(token, "Feed", "", docTypeName, rejectMessage); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h index 06fca28a55ce..9c2c9a5f50ba 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h @@ -151,7 +151,7 @@ class FeedHandler: private search::transactionlog::client::Callback, * @param writer Inject writer for tls, or nullptr to use internal. */ FeedHandler(IThreadingService &writeService, - const vespalib::string &tlsSpec, + const std::string &tlsSpec, const DocTypeName &docTypeName, IFeedHandlerOwner &owner, const IResourceWriteFilter &writerFilter, @@ -233,7 +233,7 @@ class FeedHandler: private search::transactionlog::client::Callback, return _tlsReplayProgress ? _tlsReplayProgress->getProgress() : 0; } bool getTransactionLogReplayDone() const; - vespalib::string getDocTypeName() const { return _docTypeName.getName(); } + std::string getDocTypeName() const { return _docTypeName.getName(); } void tlsPrune(SerialNum oldest_to_keep); void performOperation(FeedToken token, FeedOperationUP op); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp index 9a4890b5dd73..53ca1d9b9987 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstate.cpp @@ -9,7 +9,7 @@ using vespalib::make_string; namespace proton { -void FeedState::throwExceptionInReceive(const vespalib::string &docType, +void FeedState::throwExceptionInReceive(const std::string &docType, uint64_t serialRangeFrom, uint64_t serialRangeTo, size_t packetSize) { @@ -26,7 +26,7 @@ void FeedState::throwExceptionInReceive(const vespalib::string &docType, } void -FeedState::throwExceptionInHandleOperation(const vespalib::string &docType, const FeedOperation &op) +FeedState::throwExceptionInHandleOperation(const std::string &docType, const FeedOperation &op) { throw IllegalStateException (make_string("We should not receive any feed operations" @@ -38,7 +38,7 @@ FeedState::throwExceptionInHandleOperation(const vespalib::string &docType, cons op.getSerialNum())); } -vespalib::string FeedState::getName() const { +std::string FeedState::getName() const { switch(_type) { case NORMAL: return "NORMAL"; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstate.h b/searchcore/src/vespa/searchcore/proton/server/feedstate.h index 050b296eeb63..fcb82df3cb66 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstate.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstate.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace vespalib { class Executor; @@ -26,16 +26,16 @@ class FeedState { protected: using FeedOperationUP = std::unique_ptr; using PacketWrapperSP = std::shared_ptr; - void throwExceptionInReceive(const vespalib::string &docType, uint64_t serialRangeFrom, + void throwExceptionInReceive(const std::string &docType, uint64_t serialRangeFrom, uint64_t serialRangeTo, size_t packetSize); - void throwExceptionInHandleOperation(const vespalib::string &docType, const FeedOperation &op); + void throwExceptionInHandleOperation(const std::string &docType, const FeedOperation &op); public: FeedState(Type type) : _type(type) {} virtual ~FeedState() = default; Type getType() const { return _type; } - vespalib::string getName() const; + std::string getName() const; virtual void handleOperation(FeedToken token, FeedOperationUP op) = 0; virtual void receive(const PacketWrapperSP &wrap, vespalib::Executor &executor) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index f3af0ceaa7a8..0b7b9fcadf81 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -190,7 +190,7 @@ PacketDispatcher::handleEntry(const Packet::Entry &entry) { } // namespace ReplayTransactionLogState::ReplayTransactionLogState( - const vespalib::string &name, + const std::string &name, IFeedView *& feed_view_ptr, IBucketDBHandler &bucketDBHandler, IReplayConfig &replay_config, diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.h b/searchcore/src/vespa/searchcore/proton/server/feedstates.h index 865d53b4799a..72df8d33d28f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.h @@ -21,10 +21,10 @@ namespace proton { * The feed handler owner is initializing components. */ class InitState : public FeedState { - vespalib::string _doc_type_name; + std::string _doc_type_name; public: - InitState(const vespalib::string &name) noexcept + InitState(const std::string &name) noexcept : FeedState(INIT), _doc_type_name(name) { @@ -46,11 +46,11 @@ class InitState : public FeedState { * Replayed messages from the transaction log are sent to the active feed view. */ class ReplayTransactionLogState : public FeedState { - vespalib::string _doc_type_name; + std::string _doc_type_name; std::unique_ptr _packet_handler; public: - ReplayTransactionLogState(const vespalib::string &name, + ReplayTransactionLogState(const std::string &name, IFeedView *& feed_view_ptr, bucketdb::IBucketDBHandler &bucketDBHandler, IReplayConfig &replay_config, diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 80ec2a0c32b4..2fc3fe3437d7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -49,7 +49,7 @@ namespace proton { namespace { -vespalib::string +std::string makeSnapDirBaseName(SerialNum serialNum) { std::ostringstream os; @@ -58,7 +58,7 @@ makeSnapDirBaseName(SerialNum serialNum) } void -fsyncFile(const vespalib::string &fileName) +fsyncFile(const std::string &fileName) { FastOS_File f; f.OpenReadWrite(fileName.c_str()); @@ -73,9 +73,9 @@ fsyncFile(const vespalib::string &fileName) template void -saveHelper(const vespalib::string &snapDir, const vespalib::string &name, const Config &config) +saveHelper(const std::string &snapDir, const std::string &name, const Config &config) { - vespalib::string fileName(snapDir + "/" + name + ".cfg"); + std::string fileName(snapDir + "/" + name + ".cfg"); config::FileConfigWriter writer(fileName); bool ok = writer.write(config); assert(ok); @@ -85,7 +85,7 @@ saveHelper(const vespalib::string &snapDir, const vespalib::string &name, const template void -save(const vespalib::string &snapDir, const Config &config) +save(const std::string &snapDir, const Config &config) { saveHelper(snapDir, config.defName(), config); } @@ -94,18 +94,18 @@ class ConfigFile { using SP = std::shared_ptr; - vespalib::string _name; + std::string _name; std::vector _content; public: ConfigFile(); ~ConfigFile(); - ConfigFile(const vespalib::string &name, const vespalib::string &fullName); + ConfigFile(const std::string &name, const std::string &fullName); nbostream &serialize(nbostream &stream) const; nbostream &deserialize(nbostream &stream); - void save(const vespalib::string &snapDir) const; + void save(const std::string &snapDir) const; }; ConfigFile::ConfigFile() @@ -116,7 +116,7 @@ ConfigFile::ConfigFile() ConfigFile::~ConfigFile() = default; -ConfigFile::ConfigFile(const vespalib::string &name, const vespalib::string &fullName) +ConfigFile::ConfigFile(const std::string &name, const std::string &fullName) : _name(name), _content() { @@ -160,9 +160,9 @@ ConfigFile::deserialize(nbostream &stream) } void -ConfigFile::save(const vespalib::string &snapDir) const +ConfigFile::save(const std::string &snapDir) const { - vespalib::string fullName = snapDir + "/" + _name; + std::string fullName = snapDir + "/" + _name; FastOS_File file; bool openRes = file.OpenWriteOnlyTruncate(fullName.c_str()); assert(openRes); @@ -188,10 +188,10 @@ operator>>(nbostream &stream, ConfigFile &configFile) return configFile.deserialize(stream); } -std::vector -getFileList(const vespalib::string &snapDir) +std::vector +getFileList(const std::string &snapDir) { - std::vector res; + std::vector res; std::filesystem::directory_iterator dir_scan{std::filesystem::path(snapDir)}; for (auto& entry : dir_scan) { res.emplace_back(entry.path().filename().string()); @@ -201,9 +201,9 @@ getFileList(const vespalib::string &snapDir) } // add an empty file if it's not already present -void addEmptyFile(vespalib::string snapDir, vespalib::string fileName) +void addEmptyFile(std::string snapDir, std::string fileName) { - vespalib::string path = snapDir + "/" + fileName; + std::string path = snapDir + "/" + fileName; if (access(path.c_str(), R_OK) == 0) { // exists OK return; @@ -220,9 +220,9 @@ void addEmptyFile(vespalib::string snapDir, vespalib::string fileName) } FileConfigManager::FileConfigManager(FNET_Transport & transport, - const vespalib::string &baseDir, - const vespalib::string &configId, - const vespalib::string &docTypeName) + const std::string &baseDir, + const std::string &configId, + const std::string &docTypeName) : _transport(transport), _baseDir(baseDir), _configId(configId), @@ -269,8 +269,8 @@ FileConfigManager::saveConfig(const DocumentDBConfig &snapshot, SerialNum serial static_cast(serialNum)); return; } - vespalib::string snapDirBaseName(makeSnapDirBaseName(serialNum)); - vespalib::string snapDir(_baseDir + "/" + snapDirBaseName); + std::string snapDirBaseName(makeSnapDirBaseName(serialNum)); + std::string snapDir(_baseDir + "/" + snapDirBaseName); Snapshot snap(false, serialNum, snapDirBaseName); _info.addSnapshot(snap); bool saveInvalidSnap = _info.save(); @@ -299,8 +299,8 @@ void FileConfigManager::loadConfig(const DocumentDBConfig ¤tSnapshot, search::SerialNum serialNum, DocumentDBConfig::SP &loadedSnapshot) { - vespalib::string snapDirBaseName(makeSnapDirBaseName(serialNum)); - vespalib::string snapDir(_baseDir + "/" + snapDirBaseName); + std::string snapDirBaseName(makeSnapDirBaseName(serialNum)); + std::string snapDir(_baseDir + "/" + snapDirBaseName); config::DirSpec spec(snapDir); addEmptyFile(snapDir, "ranking-constants.cfg"); @@ -366,8 +366,8 @@ FileConfigManager::removeInvalid() return; for (const auto &serial : toRem) { - vespalib::string snapDirBaseName(makeSnapDirBaseName(serial)); - vespalib::string snapDir(_baseDir + "/" + snapDirBaseName); + std::string snapDirBaseName(makeSnapDirBaseName(serial)); + std::string snapDir(_baseDir + "/" + snapDirBaseName); try { std::filesystem::remove_all(std::filesystem::path(snapDir)); } catch (const std::exception &e) { @@ -432,12 +432,12 @@ FileConfigManager::getPrevValidSerial(SerialNum serialNum) const void FileConfigManager::serializeConfig(SerialNum serialNum, nbostream &stream) { - vespalib::string snapDirBaseName(makeSnapDirBaseName(serialNum)); - vespalib::string snapDir(_baseDir + "/" + snapDirBaseName); + std::string snapDirBaseName(makeSnapDirBaseName(serialNum)); + std::string snapDir(_baseDir + "/" + snapDirBaseName); assert(hasValidSerial(serialNum)); - std::vector configs = getFileList(snapDir); + std::vector configs = getFileList(snapDir); uint32_t numConfigs = configs.size(); stream << numConfigs; for (const auto &config : configs) { @@ -449,8 +449,8 @@ FileConfigManager::serializeConfig(SerialNum serialNum, nbostream &stream) void FileConfigManager::deserializeConfig(SerialNum serialNum, nbostream &stream) { - vespalib::string snapDirBaseName(makeSnapDirBaseName(serialNum)); - vespalib::string snapDir(_baseDir + "/" + snapDirBaseName); + std::string snapDirBaseName(makeSnapDirBaseName(serialNum)); + std::string snapDir(_baseDir + "/" + snapDirBaseName); bool skip = hasValidSerial(serialNum); diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h index 24d38b96524b..4c44584ecfba 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h @@ -13,9 +13,9 @@ namespace proton { class FileConfigManager : public ConfigStore { private: FNET_Transport & _transport; - vespalib::string _baseDir; - vespalib::string _configId; - vespalib::string _docTypeName; + std::string _baseDir; + std::string _configId; + std::string _docTypeName; search::IndexMetaInfo _info; ProtonConfigSP _protonConfig; @@ -26,8 +26,8 @@ class FileConfigManager : public ConfigStore { * @param baseDir the directory in which config snapshots are saved and loaded. * @param configId the configId that was used to subscribe to config that is later handled by this manager. */ - FileConfigManager(FNET_Transport & transport, const vespalib::string &baseDir, - const vespalib::string &configId, const vespalib::string &docTypeName); + FileConfigManager(FNET_Transport & transport, const std::string &baseDir, + const std::string &configId, const std::string &docTypeName); ~FileConfigManager() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/health_adapter.cpp b/searchcore/src/vespa/searchcore/proton/server/health_adapter.cpp index 46a562daaa21..5167cd835cb2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/health_adapter.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/health_adapter.cpp @@ -14,7 +14,7 @@ vespalib::HealthProducer::Health HealthAdapter::getHealth() const { bool ok = true; - vespalib::string msg; + std::string msg; StatusReport::List reports(_statusProducer.getStatusReports()); for (size_t i = 0; i < reports.size(); ++i) { const StatusReport &r = *reports[i]; diff --git a/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h index 39d281789b61..e6e2e912e8e7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h @@ -18,7 +18,7 @@ class IBlockableMaintenanceJob : public IMaintenanceJob { OUTSTANDING_OPS = 3 }; - IBlockableMaintenanceJob(const vespalib::string &name, + IBlockableMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval) : IMaintenanceJob(name, delay, interval) diff --git a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h index a5ae3f300766..9a50b9c17d5a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include +#include namespace proton { @@ -19,7 +19,7 @@ class IDocumentSubDBOwner using SessionManager = matching::SessionManager; virtual ~IDocumentSubDBOwner() {} virtual document::BucketSpace getBucketSpace() const = 0; - virtual vespalib::string getName() const = 0; + virtual std::string getName() const = 0; virtual uint32_t getDistributionKey() const = 0; virtual SessionManager & session_manager() = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h b/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h index 6954d36ee0c9..9a525a93392f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include #include namespace vespalib { class IDestructorCallback; } @@ -32,7 +32,7 @@ struct ILidSpaceCompactionHandler /** * Returns the name of this handler. */ - virtual vespalib::string getName() const = 0; + virtual std::string getName() const = 0; /** * Sets the listener used to get notifications on the operations handled by the document meta store. diff --git a/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h index 58cf377e5838..f2b0b6d62f63 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include -#include #include +#include +#include namespace proton { @@ -19,7 +19,7 @@ struct DocumentDBTaggedMetrics; class IMaintenanceJob { private: - const vespalib::string _name; + const std::string _name; const vespalib::duration _delay; const vespalib::duration _interval; std::atomic _stopped; @@ -29,7 +29,7 @@ class IMaintenanceJob using UP = std::unique_ptr; using SP = std::shared_ptr; - IMaintenanceJob(const vespalib::string &name, + IMaintenanceJob(const std::string &name, vespalib::duration delay, vespalib::duration interval) : _name(name), @@ -40,7 +40,7 @@ class IMaintenanceJob virtual ~IMaintenanceJob() = default; - virtual const vespalib::string &getName() const { return _name; } + virtual const std::string &getName() const { return _name; } virtual vespalib::duration getDelay() const { return _delay; } virtual vespalib::duration getInterval() const { return _interval; } virtual bool isBlocked() const { return false; } diff --git a/searchcore/src/vespa/searchcore/proton/server/i_proton_configurer_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_proton_configurer_owner.h index fd787b164490..2cd31ab6bba2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_proton_configurer_owner.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_proton_configurer_owner.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include namespace proton { @@ -21,7 +21,7 @@ class IProtonConfigurerOwner virtual ~IProtonConfigurerOwner() = default; virtual std::shared_ptr addDocumentDB(const DocTypeName &docTypeName, document::BucketSpace bucketSpace, - const vespalib::string &configId, + const std::string &configId, const std::shared_ptr &bootstrapConfig, const std::shared_ptr &documentDBConfig, InitializeThreads initializeThreads) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index 2249cb5392a2..81efe9c00c84 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -5,9 +5,9 @@ #include #include #include -#include #include #include +#include namespace search::index { class Schema; } @@ -71,7 +71,7 @@ class IDocumentSubDB IDocumentSubDB() noexcept { } virtual ~IDocumentSubDB() = default; virtual uint32_t getSubDbId() const = 0; - virtual vespalib::string getName() const = 0; + virtual std::string getName() const = 0; virtual std::unique_ptr createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, @@ -126,7 +126,7 @@ class IDocumentSubDB virtual search::SearchableStats getSearchableStats() const = 0; virtual std::shared_ptr getDocumentRetriever() = 0; - virtual matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const = 0; + virtual matching::MatchingStats getMatcherStats(const std::string &rankProfile) const = 0; virtual void close() = 0; virtual std::shared_ptr getDocumentDBReference() = 0; virtual void tearDownReferences(IDocumentDBReferenceResolver &resolver) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.cpp b/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.cpp index 8db74a39da15..44d1ad773e45 100644 --- a/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.cpp @@ -12,7 +12,7 @@ using CpuCategory = vespalib::CpuUsage::Category; namespace { void -write(const vespalib::string& path, uint32_t num_threads) +write(const std::string& path, uint32_t num_threads) { std::ofstream file; file.open(path); @@ -21,7 +21,7 @@ write(const vespalib::string& path, uint32_t num_threads) } uint32_t -read(const vespalib::string& path) +read(const std::string& path) { std::ifstream file; file.open(path); @@ -33,14 +33,14 @@ read(const vespalib::string& path) VESPA_THREAD_STACK_TAG(proton_initialize_executor) -const vespalib::string file_name = "initialize-threads.txt"; +const std::string file_name = "initialize-threads.txt"; } namespace proton { InitializeThreadsCalculator::InitializeThreadsCalculator(const vespalib::HwInfo::Cpu & cpu_info, - const vespalib::string& base_dir, + const std::string& base_dir, uint32_t configured_num_threads) : _path(base_dir + "/" + file_name), _num_threads(std::min(cpu_info.cores(), configured_num_threads)), diff --git a/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.h b/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.h index 199c5df751d7..bc6f0445be9d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.h +++ b/searchcore/src/vespa/searchcore/proton/server/initialize_threads_calculator.h @@ -2,11 +2,11 @@ #pragma once -#include #include #include #include #include +#include namespace proton { @@ -26,7 +26,7 @@ namespace proton { InitializeThreads _threads; public: - InitializeThreadsCalculator(const vespalib::HwInfo::Cpu & cpu_info, const vespalib::string& base_dir, uint32_t configured_num_threads); + InitializeThreadsCalculator(const vespalib::HwInfo::Cpu & cpu_info, const std::string& base_dir, uint32_t configured_num_threads); ~InitializeThreadsCalculator(); uint32_t num_threads() const { return _num_threads; } InitializeThreads threads() const { return _threads; } diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp index 4509058bf7d6..255782666e9d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp @@ -21,7 +21,7 @@ using storage::spi::Timestamp; namespace proton { LidSpaceCompactionHandler::LidSpaceCompactionHandler(const MaintenanceDocumentSubDB& subDb, - const vespalib::string& docTypeName) + const std::string& docTypeName) : _subDb(subDb), _docTypeName(docTypeName) { @@ -29,7 +29,7 @@ LidSpaceCompactionHandler::LidSpaceCompactionHandler(const MaintenanceDocumentSu LidSpaceCompactionHandler::~LidSpaceCompactionHandler() = default; -vespalib::string +std::string LidSpaceCompactionHandler::getName() const { return _docTypeName + "." + _subDb.name(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h index 0ee317f90c8c..9acbfdf9a898 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h @@ -15,14 +15,14 @@ class LidSpaceCompactionHandler : public ILidSpaceCompactionHandler { private: const MaintenanceDocumentSubDB _subDb; - const vespalib::string _docTypeName; + const std::string _docTypeName; public: LidSpaceCompactionHandler(const MaintenanceDocumentSubDB& subDb, - const vespalib::string& docTypeName); + const std::string& docTypeName); ~LidSpaceCompactionHandler() override; - vespalib::string getName() const override; + std::string getName() const override; void set_operation_listener(std::shared_ptr op_listener) override; uint32_t getSubDbId() const override; search::LidUsageStats getLidStatus() const override; diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp index b9a0abb3c3d8..3ebeac3b9ce2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp @@ -47,7 +47,7 @@ injectBucketMoveJob(MaintenanceController &controller, const DocumentDBMaintenanceConfig &config, storage::spi::BucketExecutor & bucketExecutor, bucketdb::IBucketCreateNotifier &bucketCreateNotifier, - const vespalib::string &docTypeName, + const std::string &docTypeName, document::BucketSpace bucketSpace, IDocumentMoveHandler &moveHandler, IBucketModifiedHandler &bucketModifiedHandler, diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.cpp index 85dfcf10a348..e293ad5bf85c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.cpp @@ -16,7 +16,7 @@ MaintenanceDocumentSubDB::MaintenanceDocumentSubDB() MaintenanceDocumentSubDB::~MaintenanceDocumentSubDB() = default; -MaintenanceDocumentSubDB::MaintenanceDocumentSubDB(const vespalib::string& name, +MaintenanceDocumentSubDB::MaintenanceDocumentSubDB(const std::string& name, uint32_t sub_db_id, IDocumentMetaStore::SP meta_store, IDocumentRetriever::SP retriever, diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.h index 3a12ae577bdb..b8e95b00110b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/maintenancedocumentsubdb.h @@ -17,7 +17,7 @@ class ILidCommitState; class MaintenanceDocumentSubDB { private: - vespalib::string _name; + std::string _name; uint32_t _sub_db_id; IDocumentMetaStore::SP _meta_store; IDocumentRetriever::SP _retriever; @@ -28,14 +28,14 @@ class MaintenanceDocumentSubDB MaintenanceDocumentSubDB(); ~MaintenanceDocumentSubDB(); - MaintenanceDocumentSubDB(const vespalib::string& name, + MaintenanceDocumentSubDB(const std::string& name, uint32_t sub_db_id, IDocumentMetaStore::SP meta_store, IDocumentRetriever::SP retriever, IFeedView::SP feed_view, const ILidCommitState *); - const vespalib::string& name() const { return _name; } + const std::string& name() const { return _name; } uint32_t sub_db_id() const { return _sub_db_id; } const IDocumentMetaStore::SP& meta_store() const { return _meta_store; } const IDocumentRetriever::SP& retriever() const { return _retriever; } diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp index 587fbad8d778..7de45204c4c2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp @@ -29,7 +29,7 @@ Matchers::Matchers(const std::atomic & now_ref, Matchers::~Matchers() = default; void -Matchers::add(const vespalib::string &name, std::shared_ptr matcher) +Matchers::add(const std::string &name, std::shared_ptr matcher) { if ((name == "default") || ! _default) { _default = matcher; @@ -48,14 +48,14 @@ Matchers::getStats() const } MatchingStats -Matchers::getStats(const vespalib::string &name) const +Matchers::getStats(const std::string &name) const { auto it = _rpmap.find(name); return it != _rpmap.end() ? it->second->getStats() : MatchingStats(); } std::shared_ptr -Matchers::lookup(const vespalib::string &name) const +Matchers::lookup(const std::string &name) const { auto found = _rpmap.find(name); if (found == _rpmap.end()) { diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.h b/searchcore/src/vespa/searchcore/proton/server/matchers.h index 08f3031ce7af..76376b702c4a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchers.h +++ b/searchcore/src/vespa/searchcore/proton/server/matchers.h @@ -15,7 +15,7 @@ namespace matching { class Matchers { private: - using Map = vespalib::hash_map>; + using Map = vespalib::hash_map>; Map _rpmap; const search::fef::RankingAssetsRepo _ranking_assets_repo; std::shared_ptr _fallback; @@ -28,10 +28,10 @@ class Matchers { Matchers(const Matchers &) = delete; Matchers & operator =(const Matchers &) = delete; ~Matchers(); - void add(const vespalib::string &name, std::shared_ptr matcher); + void add(const std::string &name, std::shared_ptr matcher); matching::MatchingStats getStats() const; - matching::MatchingStats getStats(const vespalib::string &name) const; - std::shared_ptr lookup(const vespalib::string &name) const; + matching::MatchingStats getStats(const std::string &name) const; + std::shared_ptr lookup(const std::string &name) const; const search::fef::RankingAssetsRepo& get_ranking_assets_repo() const noexcept { return _ranking_assets_repo; } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp index 9c8d854e0e98..7e63ba1000d7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp @@ -51,7 +51,7 @@ MatchView::MatchView(Matchers::SP matchers, MatchView::~MatchView() = default; std::shared_ptr -MatchView::getMatcher(const vespalib::string & rankProfile) const +MatchView::getMatcher(const std::string & rankProfile) const { return _matchers->lookup(rankProfile); } diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.h b/searchcore/src/vespa/searchcore/proton/server/matchview.h index 82d5f5314891..b36246d57eef 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.h @@ -53,10 +53,10 @@ class MatchView { DocIdLimit & getDocIdLimit() const noexcept { return _docIdLimit; } // Throws on error. - std::shared_ptr getMatcher(const vespalib::string & rankProfile) const; + std::shared_ptr getMatcher(const std::string & rankProfile) const; matching::MatchingStats - getMatcherStats(const vespalib::string &rankProfile) const { + getMatcherStats(const std::string &rankProfile) const { return _matchers->getStats(rankProfile); } diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index 41bf82e97b18..4c88b76c92c0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -69,7 +69,7 @@ MemoryFlush::Config::Config(uint64_t maxGlobalMemory_in, maxTimeGain(maxTimeGain_in) { } -vespalib::string +std::string MemoryFlush::Config::toString() const { vespalib::asciistream os; os << "maxGlobalMemory=" << maxGlobalMemory << " "; @@ -110,7 +110,7 @@ MemoryFlush::setConfig(const Config &config) namespace { -vespalib::string +std::string getOrderName(MemoryFlush::OrderType &orderType) { switch (orderType) { diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.h b/searchcore/src/vespa/searchcore/proton/server/memoryflush.h index 4af9967d6b11..69a7513cf8e7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.h +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.h @@ -44,7 +44,7 @@ class MemoryFlush : public IFlushStrategy (maxTimeGain == rhs.maxTimeGain) && (diskBloatFactor == rhs. diskBloatFactor); } - vespalib::string toString() const; + std::string toString() const; }; enum OrderType { DEFAULT, MAXAGE, DISKBLOAT, TLSSIZE, MEMORY }; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index aecd332975ee..778836c3c13c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -144,12 +144,12 @@ struct MetricsUpdateHook : metrics::UpdateHook } }; -const vespalib::string CUSTOM_COMPONENT_API_PATH = "/state/v1/custom/component"; +const std::string CUSTOM_COMPONENT_API_PATH = "/state/v1/custom/component"; VESPA_THREAD_STACK_TAG(proton_close_executor); VESPA_THREAD_STACK_TAG(proton_executor); -void ensureWritableDir(const vespalib::string &dirName) { +void ensureWritableDir(const std::string &dirName) { auto filename = dirName + "/tmp.filesystem.probe"; vespalib::File probe(filename); probe.unlink(); @@ -161,7 +161,7 @@ void ensureWritableDir(const vespalib::string &dirName) { } // namespace -Proton::ProtonFileHeaderContext::ProtonFileHeaderContext(const vespalib::string &creator) +Proton::ProtonFileHeaderContext::ProtonFileHeaderContext(const std::string &creator) : _hostName(), _creator(creator), _cluster(), @@ -175,7 +175,7 @@ Proton::ProtonFileHeaderContext::~ProtonFileHeaderContext() = default; void Proton::ProtonFileHeaderContext::addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const + const std::string &name) const { using Tag = vespalib::GenericHeader::Tag; @@ -192,8 +192,8 @@ Proton::ProtonFileHeaderContext::addTags(vespalib::GenericHeader &header, void -Proton::ProtonFileHeaderContext::setClusterName(const vespalib::string & clusterName, - const vespalib::string & baseDir) +Proton::ProtonFileHeaderContext::setClusterName(const std::string & clusterName, + const std::string & baseDir) { if (!clusterName.empty()) { _cluster = clusterName; @@ -201,13 +201,13 @@ Proton::ProtonFileHeaderContext::setClusterName(const vespalib::string & cluster } // Derive cluster name from base dir. size_t cpos(baseDir.rfind('/')); - if (cpos == vespalib::string::npos) + if (cpos == std::string::npos) return; size_t rpos(baseDir.rfind('/', cpos - 1)); - if (rpos == vespalib::string::npos) + if (rpos == std::string::npos) return; size_t clpos(baseDir.rfind('/', rpos - 1)); - if (clpos == vespalib::string::npos) + if (clpos == std::string::npos) return; if (baseDir.substr(clpos + 1, 8) != "cluster.") return; @@ -216,7 +216,7 @@ Proton::ProtonFileHeaderContext::setClusterName(const vespalib::string & cluster Proton::Proton(FNET_Transport & transport, const config::ConfigUri & configUri, - const vespalib::string &progName, vespalib::duration subscribeTimeout) + const std::string &progName, vespalib::duration subscribeTimeout) : IProtonConfigurerOwner(), search::engine::MonitorServer(), IDocumentDBOwner(), @@ -348,7 +348,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) _scheduler = std::make_unique(_transport, _shared_service->shared()); _diskMemUsageSampler->setConfig(diskMemUsageSamplerConfig(protonConfig, hwInfo), *_scheduler); - vespalib::string fileConfigId; + std::string fileConfigId; _compile_cache_executor_binding = vespalib::eval::CompileCache::bind(_shared_service->shared_raw()); InitializeThreadsCalculator calc(hwInfo.cpu(), protonConfig.basedir, protonConfig.initialize.threads); @@ -417,7 +417,7 @@ Proton::applyConfig(const BootstrapConfig::SP & configSnapshot) std::shared_ptr Proton::addDocumentDB(const DocTypeName &docTypeName, document::BucketSpace bucketSpace, - const vespalib::string &configId, + const std::string &configId, const BootstrapConfig::SP &bootstrapConfig, const std::shared_ptr &documentDBConfig, InitializeThreads initializeThreads) @@ -580,7 +580,7 @@ Proton::get_monitor_server() return *this; } -vespalib::string +std::string Proton::getDelayedConfigs() const { std::ostringstream res; @@ -626,7 +626,7 @@ Proton::addDocumentDB(const document::DocumentType &docType, return it->second; } - vespalib::string db_dir = config.basedir + "/documents/" + docTypeName.toString(); + std::string db_dir = config.basedir + "/documents/" + docTypeName.toString(); std::filesystem::create_directory(std::filesystem::path(db_dir)); // Assume parent is created. auto config_store = std::make_unique(_transport, db_dir + "/config", documentDBConfig->getConfigId(), docTypeName.getName()); @@ -888,7 +888,7 @@ Proton::getComponentConfig(Consumer &consumer) } } for (const auto &docDb : dbs) { - vespalib::string name("proton.documentdb."); + std::string name("proton.documentdb."); name.append(docDb->getDocTypeName().getName()); int64_t gen = docDb->getActiveGeneration(); if (docDb->getDelayedConfig()) { @@ -936,21 +936,21 @@ Proton::setClusterState(BucketSpace bucketSpace, const storage::spi::ClusterStat namespace { -const vespalib::string MATCH_ENGINE = "matchengine"; -const vespalib::string DOCUMENT_DB = "documentdb"; -const vespalib::string FLUSH_ENGINE = "flushengine"; -const vespalib::string TLS_NAME = "tls"; -const vespalib::string RESOURCE_USAGE = "resourceusage"; -const vespalib::string THREAD_POOLS = "threadpools"; -const vespalib::string HW_INFO = "hwinfo"; -const vespalib::string SESSION = "session"; +const std::string MATCH_ENGINE = "matchengine"; +const std::string DOCUMENT_DB = "documentdb"; +const std::string FLUSH_ENGINE = "flushengine"; +const std::string TLS_NAME = "tls"; +const std::string RESOURCE_USAGE = "resourceusage"; +const std::string THREAD_POOLS = "threadpools"; +const std::string HW_INFO = "hwinfo"; +const std::string SESSION = "session"; struct StateExplorerProxy : vespalib::StateExplorer { const StateExplorer &explorer; explicit StateExplorerProxy(const StateExplorer &explorer_in) : explorer(explorer_in) {} void get_state(const vespalib::slime::Inserter &inserter, bool full) const override { explorer.get_state(inserter, full); } - std::vector get_children_names() const override { return explorer.get_children_names(); } + std::vector get_children_names() const override { return explorer.get_children_names(); } std::unique_ptr get_child(std::string_view name) const override { return explorer.get_child(name); } }; @@ -961,9 +961,9 @@ struct DocumentDBMapExplorer : vespalib::StateExplorer { DocumentDBMapExplorer(const DocumentDBMap &documentDBMap_in, std::shared_mutex &mutex_in) : documentDBMap(documentDBMap_in), mutex(mutex_in) {} void get_state(const vespalib::slime::Inserter &, bool) const override {} - std::vector get_children_names() const override { + std::vector get_children_names() const override { std::shared_lock guard(mutex); - std::vector names; + std::vector names; for (const auto &item: documentDBMap) { names.push_back(item.first.getName()); } @@ -971,7 +971,7 @@ struct DocumentDBMapExplorer : vespalib::StateExplorer { } std::unique_ptr get_child(std::string_view name) const override { std::shared_lock guard(mutex); - auto result = documentDBMap.find(DocTypeName(vespalib::string(name))); + auto result = documentDBMap.find(DocTypeName(std::string(name))); if (result == documentDBMap.end()) { return {}; } @@ -986,7 +986,7 @@ Proton::get_state(const vespalib::slime::Inserter &, bool) const { } -std::vector +std::vector Proton::get_children_names() const { return {DOCUMENT_DB, THREAD_POOLS, MATCH_ENGINE, FLUSH_ENGINE, TLS_NAME, HW_INFO, RESOURCE_USAGE, SESSION}; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 30f7128091f2..a89fc58f4238 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -73,17 +73,17 @@ class Proton : public IProtonConfigurerOwner, class ProtonFileHeaderContext : public search::common::FileHeaderContext { - vespalib::string _hostName; - vespalib::string _creator; - vespalib::string _cluster; + std::string _hostName; + std::string _creator; + std::string _cluster; pid_t _pid; public: - explicit ProtonFileHeaderContext(const vespalib::string &creator); + explicit ProtonFileHeaderContext(const std::string &creator); ~ProtonFileHeaderContext() override; - void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; - void setClusterName(const vespalib::string &clusterName, const vespalib::string &baseDir); + void addTags(vespalib::GenericHeader &header, const std::string &name) const override; + void setClusterName(const std::string &clusterName, const std::string &baseDir); }; vespalib::CpuUtil _cpu_util; @@ -133,7 +133,7 @@ class Proton : public IProtonConfigurerOwner, std::set _nodeUp; // bucketspaces where node is up std::shared_ptr - addDocumentDB(const DocTypeName & docTypeName, BucketSpace bucketSpace, const vespalib::string & configid, + addDocumentDB(const DocTypeName & docTypeName, BucketSpace bucketSpace, const std::string & configid, const BootstrapConfig::SP & bootstrapConfig, const std::shared_ptr &documentDBConfig, InitializeThreads initializeThreads) override; @@ -156,7 +156,7 @@ class Proton : public IProtonConfigurerOwner, using SP = std::shared_ptr; Proton(FNET_Transport & transport, const config::ConfigUri & configUri, - const vespalib::string &progName, vespalib::duration subscribeTimeout); + const std::string &progName, vespalib::duration subscribeTimeout); ~Proton() override; /** @@ -210,7 +210,7 @@ class Proton : public IProtonConfigurerOwner, search::engine::DocsumServer &get_docsum_server(); search::engine::MonitorServer &get_monitor_server(); - vespalib::string getDelayedConfigs() const; + std::string getDelayedConfigs() const; StatusReport::List getStatusReports() const override; @@ -224,7 +224,7 @@ class Proton : public IProtonConfigurerOwner, uint32_t getNumThreadsPerSearch() const override { return _numThreadsPerSearch; } void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp index 82ac88600e22..18aff7dbc546 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp @@ -176,7 +176,7 @@ void ProtonConfigurer::configureDocumentDB(const ProtonConfigSnapshot &configSnapshot, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, - const vespalib::string &configId, + const std::string &configId, InitializeThreads initializeThreads) { // called by proton executor thread @@ -197,8 +197,8 @@ ProtonConfigurer::configureDocumentDB(const ProtonConfigSnapshot &configSnapshot assert(documentDB); auto old_bucket_space = documentDB->getBucketSpace(); if (bucketSpace != old_bucket_space) { - const vespalib::string & old_bucket_space_name(document::FixedBucketSpaces::to_string(old_bucket_space)); - const vespalib::string & bucket_space_name(document::FixedBucketSpaces::to_string(bucketSpace)); + const std::string & old_bucket_space_name(document::FixedBucketSpaces::to_string(old_bucket_space)); + const std::string & bucket_space_name(document::FixedBucketSpaces::to_string(bucketSpace)); LOG(fatal, "Bucket space for document type %s changed from %s to %s. This triggers undefined behavior on a running system. Restarting process immediately to fix it.", docTypeName.getName().c_str(), old_bucket_space_name.c_str(), bucket_space_name.c_str()); std::_Exit(1); } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.h b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.h index 7ca1a21d2f04..541d5c45b008 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.h @@ -46,7 +46,7 @@ class ProtonConfigurer : public IProtonConfigurer InitializeThreads initializeThreads, bool initialConfig); void configureDocumentDB(const ProtonConfigSnapshot &configSnapshot, const DocTypeName &docTypeName, document::BucketSpace bucketSpace, - const vespalib::string &configId, InitializeThreads initializeThreads); + const std::string &configId, InitializeThreads initializeThreads); void pruneDocumentDBs(const ProtonConfigSnapshot &configSnapshot); void pruneInitialDocumentDBDirs(const ProtonConfigSnapshot &configSnapshot); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.cpp index e5fcd32fdce2..b644ac24de5d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.cpp @@ -29,28 +29,28 @@ struct DocumentDBDirMeta using DocumentDBDirScan = std::map; -vespalib::string getDocumentsDir(const vespalib::string &baseDir) +std::string getDocumentsDir(const std::string &baseDir) { return baseDir + "/documents"; } -vespalib::string removedSuffix(".removed"); +std::string removedSuffix(".removed"); -vespalib::string getNormalName(const vespalib::string removedName) { +std::string getNormalName(const std::string removedName) { return removedName.substr(0, removedName.size() - removedSuffix.size()); } -vespalib::string getRemovedName(const vespalib::string &normalName) +std::string getRemovedName(const std::string &normalName) { return normalName + removedSuffix; } -bool isRemovedName(const vespalib::string &dirName) +bool isRemovedName(const std::string &dirName) { return dirName.size() > removedSuffix.size() && dirName.substr(dirName.size() - removedSuffix.size()) == removedSuffix; } -void scanDir(const vespalib::string documentsDir, DocumentDBDirScan &dirs) +void scanDir(const std::string documentsDir, DocumentDBDirScan &dirs) { auto names = vespalib::listDirectory(documentsDir); for (const auto &name : names) { @@ -66,7 +66,7 @@ void scanDir(const vespalib::string documentsDir, DocumentDBDirScan &dirs) } -ProtonDiskLayout::ProtonDiskLayout(FNET_Transport & transport, const vespalib::string &baseDir, const vespalib::string &tlsSpec) +ProtonDiskLayout::ProtonDiskLayout(FNET_Transport & transport, const std::string &baseDir, const std::string &tlsSpec) : _transport(transport), _baseDir(baseDir), _tlsSpec(tlsSpec) @@ -79,10 +79,10 @@ ProtonDiskLayout::~ProtonDiskLayout() = default; void ProtonDiskLayout::remove(const DocTypeName &docTypeName) { - vespalib::string documentsDir(getDocumentsDir(_baseDir)); - vespalib::string name(docTypeName.toString()); - vespalib::string normalDir(documentsDir + "/" + name); - vespalib::string removedDir(documentsDir + "/" + getRemovedName(name)); + std::string documentsDir(getDocumentsDir(_baseDir)); + std::string name(docTypeName.toString()); + std::string normalDir(documentsDir + "/" + name); + std::string removedDir(documentsDir + "/" + getRemovedName(name)); if (std::filesystem::exists(std::filesystem::path(normalDir))) { std::filesystem::rename(std::filesystem::path(normalDir), std::filesystem::path(removedDir)); } @@ -99,15 +99,15 @@ ProtonDiskLayout::remove(const DocTypeName &docTypeName) void ProtonDiskLayout::initAndPruneUnused(const std::set &docTypeNames) { - vespalib::string documentsDir(getDocumentsDir(_baseDir)); + std::string documentsDir(getDocumentsDir(_baseDir)); DocumentDBDirScan dirs; scanDir(documentsDir, dirs); for (const auto &dir : dirs) { if (dir.second.removed) { // Complete interrupted removal if (dir.second.normal) { - vespalib::string name(dir.first.toString()); - vespalib::string normalDir(documentsDir + "/" + name); + std::string name(dir.first.toString()); + std::string normalDir(documentsDir + "/" + name); std::filesystem::remove_all(std::filesystem::path(normalDir)); } remove(dir.first); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.h b/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.h index 5a8177baaf86..9f60415859bd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton_disk_layout.h @@ -3,7 +3,7 @@ #pragma once #include "i_proton_disk_layout.h" -#include +#include class FNET_Transport; @@ -17,11 +17,11 @@ class ProtonDiskLayout : public IProtonDiskLayout { private: FNET_Transport & _transport; - const vespalib::string _baseDir; - const vespalib::string _tlsSpec; + const std::string _baseDir; + const std::string _tlsSpec; public: - ProtonDiskLayout(FNET_Transport & transport, const vespalib::string &baseDir, const vespalib::string &tlsSpec); + ProtonDiskLayout(FNET_Transport & transport, const std::string &baseDir, const std::string &tlsSpec); ~ProtonDiskLayout() override; void remove(const DocTypeName &docTypeName) override; void initAndPruneUnused(const std::set &docTypeNames) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.cpp index e3940a6116ad..460b9341df4e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.cpp @@ -40,9 +40,9 @@ ProtonThreadPoolsExplorer::get_state(const vespalib::slime::Inserter& inserter, } } -const vespalib::string FIELD_WRITER = "field_writer"; +const std::string FIELD_WRITER = "field_writer"; -std::vector +std::vector ProtonThreadPoolsExplorer::get_children_names() const { return {FIELD_WRITER}; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.h b/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.h index b7d131f3dd68..34d4f994a989 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton_thread_pools_explorer.h @@ -32,7 +32,7 @@ class ProtonThreadPoolsExplorer : public vespalib::StateExplorer { vespalib::ISequencedTaskExecutor* field_writer); void get_state(const vespalib::slime::Inserter& inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.cpp b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.cpp index be74761dc591..691ec34bc62a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.cpp @@ -23,7 +23,7 @@ namespace proton { PruneRemovedDocumentsJob:: PruneRemovedDocumentsJob(const DocumentDBPruneConfig &config, RetainGuard dbRetainer, const IDocumentMetaStore &metaStore, - uint32_t subDbId, document::BucketSpace bucketSpace, const vespalib::string &docTypeName, + uint32_t subDbId, document::BucketSpace bucketSpace, const std::string &docTypeName, IPruneRemovedDocumentsHandler &handler, IThreadService & master, BucketExecutor & bucketExecutor) : BlockableMaintenanceJob("prune_removed_documents." + docTypeName, diff --git a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h index 4928afb744ca..672873c95094 100644 --- a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h +++ b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h @@ -34,7 +34,7 @@ class PruneRemovedDocumentsJob : public BlockableMaintenanceJob, IPruneRemovedDocumentsHandler &_handler; IThreadService &_master; BucketExecutor &_bucketExecutor; - const vespalib::string _docTypeName; + const std::string _docTypeName; vespalib::RetainGuard _dbRetainer; const vespalib::duration _cfgAgeLimit; const uint32_t _subDbId; @@ -45,14 +45,14 @@ class PruneRemovedDocumentsJob : public BlockableMaintenanceJob, void remove(uint32_t lid, const RawDocumentMetaData & meta); PruneRemovedDocumentsJob(const DocumentDBPruneConfig &config, vespalib::RetainGuard dbRetainer, const IDocumentMetaStore &metaStore, - uint32_t subDbId, document::BucketSpace bucketSpace, const vespalib::string &docTypeName, + uint32_t subDbId, document::BucketSpace bucketSpace, const std::string &docTypeName, IPruneRemovedDocumentsHandler &handler, IThreadService & master, BucketExecutor & bucketExecutor); bool run() override; public: static std::shared_ptr create(const Config &config, vespalib::RetainGuard dbRetainer, const IDocumentMetaStore &metaStore, uint32_t subDbId, - document::BucketSpace bucketSpace, const vespalib::string &docTypeName, + document::BucketSpace bucketSpace, const std::string &docTypeName, IPruneRemovedDocumentsHandler &handler, IThreadService & master, BucketExecutor & bucketExecutor) { return std::shared_ptr( diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index 0a6af8b397d7..d920dcc1d6f5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -18,9 +18,9 @@ using vespalib::compression::CompressionConfig; namespace { -string delayed_configs_string("delayedConfigs"); +std::string delayed_configs_string("delayedConfigs"); -using Pair = std::pair; +using Pair = std::pair; } @@ -107,7 +107,7 @@ RPCHooksBase::initRPC() RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const config::ConfigUri & configUri, std::string_view slobrokId, uint32_t transportThreads) : proton(parent), - slobrok_config(configUri.createWithNewId(vespalib::string(slobrokId))), + slobrok_config(configUri.createWithNewId(std::string(slobrokId))), identity(configUri.getConfigId()), rtcPort(port), numTranportThreads(transportThreads) diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index 04119afd617a..0b0446bf0d50 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -4,8 +4,8 @@ #include #include -#include #include +#include class FNET_Transport; @@ -37,7 +37,7 @@ class RPCHooksBase : public FRT_Invokable struct Params { Proton &proton; config::ConfigUri slobrok_config; - vespalib::string identity; + std::string identity; uint32_t rtcPort; uint32_t numTranportThreads; diff --git a/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.cpp b/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.cpp index cb34d319865b..e1223ac32a96 100644 --- a/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.cpp @@ -13,7 +13,7 @@ SampleAttributeUsageJob:: SampleAttributeUsageJob(IAttributeManagerSP readyAttributeManager, IAttributeManagerSP notReadyAttributeManager, AttributeUsageFilter &attributeUsageFilter, - const vespalib::string &docTypeName, + const std::string &docTypeName, vespalib::duration interval) : IMaintenanceJob("sample_attribute_usage." + docTypeName, vespalib::duration::zero(), interval), _readyAttributeManager(std::move(readyAttributeManager)), diff --git a/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.h b/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.h index ceab13481b57..327d36df9daa 100644 --- a/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/sample_attribute_usage_job.h @@ -26,7 +26,7 @@ class SampleAttributeUsageJob : public IMaintenanceJob SampleAttributeUsageJob(IAttributeManagerSP readyAttributeManager, IAttributeManagerSP notReadyAttributeManager, AttributeUsageFilter &attributeUsageFilter, - const vespalib::string &docTypeName, + const std::string &docTypeName, vespalib::duration interval); ~SampleAttributeUsageJob() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp index 0ffe69f22783..412596a7848f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp @@ -96,7 +96,7 @@ SearchableDocSubDBConfigurer(const std::shared_ptr& summaryMgr, matching::QueryLimiter &queryLimiter, const vespalib::eval::ConstantValueFactory& constant_value_factory, const std::atomic & now_ref, - const vespalib::string &subDbName, + const std::string &subDbName, uint32_t distributionKey) : _summaryMgr(summaryMgr), _searchView(searchView), @@ -122,7 +122,7 @@ SearchableDocSubDBConfigurer::createMatchers(const DocumentDBConfig& new_config_ auto newMatchers = std::make_shared(_now_ref, _queryLimiter, ranking_assets_repo_source); auto& ranking_assets_repo = newMatchers->get_ranking_assets_repo(); for (const auto &profile : cfg.rankprofile) { - vespalib::string name = profile.name; + std::string name = profile.name; search::fef::Properties properties; for (const auto &property : profile.fef.property) { properties.add(property.name, property.value); @@ -171,7 +171,7 @@ createAttributeReprocessingInitializer(const DocumentDBConfig &newConfig, const std::shared_ptr& newAttrMgr, const DocumentDBConfig &oldConfig, const std::shared_ptr& oldAttrMgr, - const vespalib::string &subDbName, + const std::string &subDbName, search::SerialNum serialNum) { const document::DocumentType *newDocType = newConfig.getDocumentType(); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h index b5c87b8dc9b5..793e011a5db9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h @@ -47,7 +47,7 @@ class SearchableDocSubDBConfigurer matching::QueryLimiter &_queryLimiter; const vespalib::eval::ConstantValueFactory& _constant_value_factory; const std::atomic & _now_ref; - vespalib::string _subDbName; + std::string _subDbName; uint32_t _distributionKey; void reconfigureFeedView(std::shared_ptr attrWriter, @@ -73,7 +73,7 @@ class SearchableDocSubDBConfigurer matching::QueryLimiter &queryLimiter, const vespalib::eval::ConstantValueFactory& constant_value_factory, const std::atomic & now_ref, - const vespalib::string &subDbName, + const std::string &subDbName, uint32_t distributionKey); ~SearchableDocSubDBConfigurer(); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index fd62baa5bcb9..11cab648b521 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -85,7 +85,7 @@ createIndexManagerInitializer(const DocumentDBConfig &configSnapshot, SerialNum std::shared_ptr indexManager) const { const Schema & schema = *configSnapshot.getSchemaSP(); - vespalib::string vespaIndexDir(_baseDir + "/index"); + std::string vespaIndexDir(_baseDir + "/index"); // Note: const_cast for reconfigurer role return std::make_shared (vespaIndexDir, indexCfg, schema, configSerialNum, const_cast(*this), @@ -316,7 +316,7 @@ SearchableDocSubDB::getDocumentRetriever() } MatchingStats -SearchableDocSubDB::getMatcherStats(const vespalib::string &rankProfile) const +SearchableDocSubDB::getMatcherStats(const std::string &rankProfile) const { return _rSearchView.get()->getMatcherStats(rankProfile); } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index 01b78c6bb4d3..6986908995c4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -130,7 +130,7 @@ SearchableDocSubDB : public FastAccessDocSubDB, size_t getNumActiveDocs() const override; search::SearchableStats getSearchableStats() const override ; std::shared_ptr getDocumentRetriever() override; - matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; + matching::MatchingStats getMatcherStats(const std::string &rankProfile) const override; void close() override; std::shared_ptr getDocumentDBReference() override; void tearDownReferences(IDocumentDBReferenceResolver &resolver) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.h b/searchcore/src/vespa/searchcore/proton/server/searchview.h index 42110d84f6d9..6e405b827e74 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.h @@ -31,7 +31,7 @@ class SearchView : public ISearchHandler, public std::enable_shared_from_thisgetSessionManager(); } const std::shared_ptr& getDocumentMetaStore() const noexcept { return _matchView->getDocumentMetaStore(); } DocIdLimit &getDocIdLimit() const noexcept { return _matchView->getDocIdLimit(); } - matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const { return _matchView->getMatcherStats(rankProfile); } + matching::MatchingStats getMatcherStats(const std::string &rankProfile) const { return _matchView->getMatcherStats(rankProfile); } std::unique_ptr getDocsums(const DocsumRequest & req) override; std::unique_ptr match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index 0e383c47e9be..8bf10fe18dc5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -54,8 +54,8 @@ IIndexWriter::SP nullIndexWriter; } -StoreOnlyDocSubDB::Config::Config(const DocTypeName &docTypeName, const vespalib::string &subName, - const vespalib::string &baseDir, +StoreOnlyDocSubDB::Config::Config(const DocTypeName &docTypeName, const std::string &subName, + const std::string &baseDir, uint32_t subDbId, SubDbType subDbType) : _docTypeName(docTypeName), _subName(subName), @@ -229,7 +229,7 @@ createSummaryManagerInitializer(const search::LogDocumentStore::Config & storeCf std::shared_ptr result) const { GrowStrategy grow = alloc_strategy.get_grow_strategy(); - vespalib::string baseDir(_baseDir + "/summary"); + std::string baseDir(_baseDir + "/summary"); return std::make_shared (grow, baseDir, getSubDbName(), _writeService.shared(), storeCfg, tuneFile, _fileHeaderContext, _tlSyncer, std::move(bucketizer), std::move(result)); @@ -254,9 +254,9 @@ createDocumentMetaStoreInitializer(const AllocStrategy& alloc_strategy, GrowStrategy grow = alloc_strategy.get_grow_strategy(); // Amortize memory spike cost over N docs grow.setGrowDelta(grow.getGrowDelta() + alloc_strategy.get_amortize_count()); - vespalib::string baseDir(_baseDir + "/documentmetastore"); - vespalib::string name = DocumentMetaStore::getFixedName(); - vespalib::string attrFileName = baseDir + "/" + name; // XXX: Wrong + std::string baseDir(_baseDir + "/documentmetastore"); + std::string name = DocumentMetaStore::getFixedName(); + std::string attrFileName = baseDir + "/" + name; // XXX: Wrong // make preliminary result visible early, allowing dependent // initializers to get hold of document meta store instance in // their constructors. @@ -270,8 +270,8 @@ createDocumentMetaStoreInitializer(const AllocStrategy& alloc_strategy, void StoreOnlyDocSubDB::setupDocumentMetaStore(const DocumentMetaStoreInitializerResult & dmsResult) { - vespalib::string baseDir(_baseDir + "/documentmetastore"); - vespalib::string name = DocumentMetaStore::getFixedName(); + std::string baseDir(_baseDir + "/documentmetastore"); + std::string name = DocumentMetaStore::getFixedName(); DocumentMetaStore::SP dms(dmsResult.documentMetaStore()); if (dms->isLoaded()) { _flushedDocumentMetaStoreSerialNum = dms->getStatus().getLastSyncToken(); @@ -413,7 +413,7 @@ StoreOnlyDocSubDB::initFeedView(const DocumentDBConfig &configSnapshot) _iFeedView.set(std::move(feedView)); } -vespalib::string +std::string StoreOnlyDocSubDB::getSubDbName() const { return vespalib::make_string("%s.%s", _owner.getName().c_str(), _subName.c_str()); } @@ -557,7 +557,7 @@ StoreOnlyDocSubDB::getDocumentRetriever() } MatchingStats -StoreOnlyDocSubDB::getMatcherStats(const vespalib::string &rankProfile) const +StoreOnlyDocSubDB::getMatcherStats(const std::string &rankProfile) const { (void) rankProfile; return {}; @@ -586,14 +586,14 @@ StoreOnlyDocSubDB::getDocumentDBReference() StoreOnlySubDBFileHeaderContext:: StoreOnlySubDBFileHeaderContext(const FileHeaderContext & parentFileHeaderContext, const DocTypeName &docTypeName, - const vespalib::string &baseDir) + const std::string &baseDir) : FileHeaderContext(), _parentFileHeaderContext(parentFileHeaderContext), _docTypeName(docTypeName), _subDB() { size_t pos = baseDir.rfind('/'); - _subDB = (pos != vespalib::string::npos) ? baseDir.substr(pos + 1) : baseDir; + _subDB = (pos != std::string::npos) ? baseDir.substr(pos + 1) : baseDir; } StoreOnlySubDBFileHeaderContext::~StoreOnlySubDBFileHeaderContext() = default; @@ -604,7 +604,7 @@ StoreOnlyDocSubDB::tearDownReferences(IDocumentDBReferenceResolver &) void StoreOnlySubDBFileHeaderContext:: -addTags(vespalib::GenericHeader &header, const vespalib::string &name) const +addTags(vespalib::GenericHeader &header, const std::string &name) const { _parentFileHeaderContext.addTags(header, name); using Tag = GenericHeader::Tag; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index db7b59611d61..a86b8af40d98 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -61,15 +61,15 @@ class StoreOnlySubDBFileHeaderContext : public search::common::FileHeaderContext { const search::common::FileHeaderContext &_parentFileHeaderContext; const DocTypeName &_docTypeName; - vespalib::string _subDB; + std::string _subDB; public: StoreOnlySubDBFileHeaderContext(const search::common::FileHeaderContext & parentFileHeaderContext, const DocTypeName &docTypeName, - const vespalib::string &baseDir); + const std::string &baseDir); ~StoreOnlySubDBFileHeaderContext() override; - void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; + void addTags(vespalib::GenericHeader &header, const std::string &name) const override; }; /** @@ -85,13 +85,13 @@ class StoreOnlyDocSubDB : public DocSubDB using BucketDBOwnerSP = std::shared_ptr; struct Config { const DocTypeName _docTypeName; - const vespalib::string _subName; - const vespalib::string _baseDir; + const std::string _subName; + const std::string _baseDir; const uint32_t _subDbId; const SubDbType _subDbType; - Config(const DocTypeName &docTypeName, const vespalib::string &subName, - const vespalib::string &baseDir, + Config(const DocTypeName &docTypeName, const std::string &subName, + const std::string &baseDir, uint32_t subDbId, SubDbType subDbType); ~Config(); }; @@ -125,8 +125,8 @@ class StoreOnlyDocSubDB : public DocSubDB protected: const DocTypeName _docTypeName; - const vespalib::string _subName; - const vespalib::string _baseDir; + const std::string _subName; + const std::string _baseDir; BucketDBOwnerSP _bucketDB; bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; IDocumentMetaStoreContext::SP _metaStoreCtx; @@ -181,7 +181,7 @@ class StoreOnlyDocSubDB : public DocSubDB virtual IFlushTargetList getFlushTargetsInternal(); StoreOnlyFeedView::Context getStoreOnlyFeedViewContext(const DocumentDBConfig &configSnapshot); StoreOnlyFeedView::PersistentParams getFeedViewPersistentParams(); - vespalib::string getSubDbName() const; + std::string getSubDbName() const; void reconfigure(const search::LogDocumentStore::Config & protonConfig, const AllocStrategy& alloc_strategy); void reconfigureAttributesConsideringNodeState(OnDone onDone); public: @@ -189,7 +189,7 @@ class StoreOnlyDocSubDB : public DocSubDB ~StoreOnlyDocSubDB() override; uint32_t getSubDbId() const override { return _subDbId; } - vespalib::string getName() const override { return _subName; } + std::string getName() const override { return _subName; } std::unique_ptr createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, @@ -233,7 +233,7 @@ class StoreOnlyDocSubDB : public DocSubDB void setIndexSchema(const Schema::SP &schema, SerialNum serialNum) override; search::SearchableStats getSearchableStats() const override; std::shared_ptr getDocumentRetriever() override; - matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; + matching::MatchingStats getMatcherStats(const std::string &rankProfile) const override; void close() override; std::shared_ptr getDocumentDBReference() override; void tearDownReferences(IDocumentDBReferenceResolver &resolver) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index 27c5b835edbf..44f7a8a5e559 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -200,7 +200,7 @@ StoreOnlyFeedView::StoreOnlyFeedView(Context ctx, const PersistentParams ¶ms if (_schema && _docType) { for (const auto &indexField : _schema->getIndexFields()) { size_t dotPos = indexField.getName().find('.'); - if ((dotPos == vespalib::string::npos) || search::index::UriField::mightBePartofUri(indexField.getName())) { + if ((dotPos == std::string::npos) || search::index::UriField::mightBePartofUri(indexField.getName())) { document::FieldPath fieldPath; _docType->buildFieldPath(fieldPath, indexField.getName().substr(0, dotPos)); _indexedFields.insert(fieldPath.back().getFieldRef().getId()); diff --git a/searchcore/src/vespa/searchcore/proton/server/tls_replay_progress.h b/searchcore/src/vespa/searchcore/proton/server/tls_replay_progress.h index 36570cbef21b..8bd50a18e846 100644 --- a/searchcore/src/vespa/searchcore/proton/server/tls_replay_progress.h +++ b/searchcore/src/vespa/searchcore/proton/server/tls_replay_progress.h @@ -3,16 +3,16 @@ #pragma once #include -#include #include #include +#include namespace proton { class TlsReplayProgress { private: - const vespalib::string _domainName; + const std::string _domainName; const search::SerialNum _first; const search::SerialNum _last; std::atomic _current; @@ -20,7 +20,7 @@ class TlsReplayProgress public: using UP = std::unique_ptr; - TlsReplayProgress(const vespalib::string &domainName, + TlsReplayProgress(const std::string &domainName, search::SerialNum first, search::SerialNum last) : _domainName(domainName), @@ -29,7 +29,7 @@ class TlsReplayProgress _current(first) { } - const vespalib::string &getDomainName() const noexcept { return _domainName; } + const std::string &getDomainName() const noexcept { return _domainName; } search::SerialNum getFirst() const noexcept { return _first; } search::SerialNum getLast() const noexcept { return _last; } search::SerialNum getCurrent() const noexcept { return _current.load(std::memory_order_relaxed); } diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp index d24de3ad2c18..1245bd70e854 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp @@ -18,14 +18,14 @@ using search::transactionlog::client::Session; namespace proton { void -TransactionLogManager::doLogReplayComplete(const vespalib::string &domainName, +TransactionLogManager::doLogReplayComplete(const std::string &domainName, vespalib::duration elapsedTime) const { EventLogger::transactionLogReplayComplete(domainName, elapsedTime); } -TransactionLogManager::TransactionLogManager(FNET_Transport & transport, const vespalib::string &tlsSpec, const vespalib::string &domainName) +TransactionLogManager::TransactionLogManager(FNET_Transport & transport, const std::string &tlsSpec, const std::string &domainName) : TransactionLogManagerBase(transport, tlsSpec, domainName), _visitor() { @@ -60,7 +60,7 @@ getStatus(Session & session, search::SerialNum & serialBegin, search::SerialNum } void getStatus(TransLogClient & client, - const vespalib::string & domainName, + const std::string & domainName, search::SerialNum & serialBegin, search::SerialNum & serialEnd, size_t & count) @@ -80,7 +80,7 @@ void getStatus(TransLogClient & client, void TransactionLogManager::prepareReplay(TransLogClient &client, - const vespalib::string &domainName, + const std::string &domainName, SerialNum flushedIndexMgrSerial, SerialNum flushedSummaryMgrSerial, ConfigStore &config_store) diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h index 384cde3e3409..5e4edde22f3c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h @@ -15,7 +15,7 @@ class TransactionLogManager : public TransactionLogManagerBase { std::unique_ptr _visitor; - void doLogReplayComplete(const vespalib::string &domainName, vespalib::duration elapsedTime) const override; + void doLogReplayComplete(const std::string &domainName, vespalib::duration elapsedTime) const override; public: /** @@ -24,7 +24,7 @@ class TransactionLogManager : public TransactionLogManagerBase * @param tlsSpec the spec of the transaction log server. * @param domainName the name of the domain this manager should handle. **/ - TransactionLogManager(FNET_Transport & transport, const vespalib::string &tlsSpec, const vespalib::string &domainName); + TransactionLogManager(FNET_Transport & transport, const std::string &tlsSpec, const std::string &domainName); ~TransactionLogManager() override; /** @@ -43,7 +43,7 @@ class TransactionLogManager : public TransactionLogManagerBase **/ static void prepareReplay(TransLogClient &client, - const vespalib::string &domainName, + const std::string &domainName, SerialNum flushedIndexMgrSerial, SerialNum flushedSummaryMgrSerial, ConfigStore &config_store); diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp index ee09e0705a70..b7ca1cf8238e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp @@ -13,8 +13,8 @@ namespace proton { TransactionLogManagerBase::TransactionLogManagerBase(FNET_Transport & transport, - const vespalib::string &tlsSpec, - const vespalib::string &domainName) : + const std::string &tlsSpec, + const std::string &domainName) : _tlc(std::make_unique(transport, tlsSpec)), _tlcSession(), _domainName(domainName), @@ -34,7 +34,7 @@ TransactionLogManagerBase::init() std::unique_ptr session = _tlc->open(_domainName); if ( ! session) { if (!_tlc->create(_domainName)) { - vespalib::string str = vespalib::make_string( + std::string str = vespalib::make_string( "Failed creating domain '%s' on TLS '%s'", _domainName.c_str(), _tlc->getRPCTarget().c_str()); throw std::runtime_error(str); @@ -43,7 +43,7 @@ TransactionLogManagerBase::init() _domainName.c_str(), _tlc->getRPCTarget().c_str()); session = _tlc->open(_domainName); if ( ! session) { - vespalib::string str = vespalib::make_string( + std::string str = vespalib::make_string( "Could not open session for domain '%s' on TLS '%s'", _domainName.c_str(), _tlc->getRPCTarget().c_str()); throw std::runtime_error(str); @@ -53,7 +53,7 @@ TransactionLogManagerBase::init() _domainName.c_str(), _tlc->getRPCTarget().c_str()); StatusResult res; if (!session->status(res.serialBegin, res.serialEnd, res.count)) { - vespalib::string str = vespalib::make_string( + std::string str = vespalib::make_string( "Could not get status from session with domain '%s' on TLS '%s'", _domainName.c_str(), _tlc->getRPCTarget().c_str()); throw std::runtime_error(str); @@ -126,7 +126,7 @@ TransactionLogManagerBase::logReplayComplete() const { doLogReplayComplete(_domainName, _replayStopWatch.elapsed()); } -const vespalib::string & +const std::string & TransactionLogManagerBase::getRpcTarget() const { return _tlc->getRPCTarget(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h index 3fe37b39f3f8..229df0ca49e7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h @@ -29,7 +29,7 @@ class TransactionLogManagerBase { private: std::unique_ptr _tlc; std::unique_ptr _tlcSession; - vespalib::string _domainName; + std::string _domainName; mutable std::mutex _replayLock; mutable std::condition_variable _replayCond; volatile bool _replayDone; @@ -49,7 +49,7 @@ class TransactionLogManagerBase { StatusResult init(); void internalStartReplay(); - virtual void doLogReplayComplete(const vespalib::string &domainName, vespalib::duration elapsedTime) const = 0; + virtual void doLogReplayComplete(const std::string &domainName, vespalib::duration elapsedTime) const = 0; public: TransactionLogManagerBase(const TransactionLogManagerBase &) = delete; @@ -61,8 +61,8 @@ class TransactionLogManagerBase { * @param domainName the name of the domain this manager should handle. **/ TransactionLogManagerBase(FNET_Transport & transport, - const vespalib::string &tlsSpec, - const vespalib::string &domainName); + const std::string &tlsSpec, + const std::string &domainName); virtual ~TransactionLogManagerBase(); void changeReplayDone(); @@ -73,11 +73,11 @@ class TransactionLogManagerBase { TransLogClient &getClient() { return *_tlc; } Session *getSession() { return _tlcSession.get(); } - const vespalib::string &getDomainName() const { return _domainName; } + const std::string &getDomainName() const { return _domainName; } bool getReplayDone() const; bool isDoingReplay() const; void logReplayComplete() const; - const vespalib::string &getRpcTarget() const; + const std::string &getRpcTarget() const; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.cpp b/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.cpp index 1e1eb424e5ba..d7acda0c0ca7 100644 --- a/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.cpp @@ -6,7 +6,7 @@ namespace proton::test { std::unique_ptr -createInt32Attribute(const vespalib::string &name) { +createInt32Attribute(const std::string &name) { return std::make_unique(name, AttributeUtils::getInt32Config()); } diff --git a/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.h b/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.h index c3339dc2acb5..4125081582a4 100644 --- a/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.h +++ b/searchcore/src/vespa/searchcore/proton/test/attribute_vectors.h @@ -8,6 +8,6 @@ namespace proton::test { using Int32Attribute = search::SingleValueNumericAttribute >; -std::unique_ptr createInt32Attribute(const vespalib::string &name); +std::unique_ptr createInt32Attribute(const std::string &name); } diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp index 2777d3b3fb88..c2da87fd9cfc 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp @@ -27,8 +27,8 @@ namespace proton::test { DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, const search::index::Schema::SP &schema, - const vespalib::string &configId, - const vespalib::string &docTypeName) + const std::string &configId, + const std::string &docTypeName) : _generation(generation), _rankProfiles(std::make_shared()), _rankingConstants(std::make_shared()), diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h index 25865812d345..7a1a3951ebed 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h @@ -32,14 +32,14 @@ class DocumentDBConfigBuilder { search::LogDocumentStore::Config _store; const ThreadingServiceConfig _threading_service_config; const AllocConfig _alloc_config; - vespalib::string _configId; - vespalib::string _docTypeName; + std::string _configId; + std::string _docTypeName; public: DocumentDBConfigBuilder(int64_t generation, const search::index::Schema::SP &schema, - const vespalib::string &configId, - const vespalib::string &docTypeName); + const std::string &configId, + const std::string &docTypeName); ~DocumentDBConfigBuilder(); DocumentDBConfigBuilder(const DocumentDBConfig &cfg); diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h index 3f04c230e4ca..aa5f06e4b662 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_store.h @@ -8,10 +8,10 @@ namespace proton::test { struct DummyDocumentStore : public search::IDocumentStore { - vespalib::string _baseDir; + std::string _baseDir; DummyDocumentStore() = default; - DummyDocumentStore(const vespalib::string &baseDir) noexcept + DummyDocumentStore(const std::string &baseDir) noexcept : _baseDir(baseDir) {} ~DummyDocumentStore() = default; @@ -35,7 +35,7 @@ struct DummyDocumentStore : public search::IDocumentStore size_t getDiskBloat() const override { return 0; } size_t getMaxSpreadAsBloat() const override { return getDiskBloat(); } vespalib::CacheStats getCacheStats() const override { return vespalib::CacheStats(); } - const vespalib::string &getBaseDir() const override { return _baseDir; } + const std::string &getBaseDir() const override { return _baseDir; } void accept(search::IDocumentStoreReadVisitor &, search::IDocumentStoreVisitorProgress &, const document::DocumentTypeRepo &) override {} diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h index 35ada75b0013..990852d843d4 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h @@ -34,7 +34,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB ~DummyDocumentSubDb() override; void close() override { } uint32_t getSubDbId() const override { return _subDbId; } - vespalib::string getName() const override { return "dummysubdb"; } + std::string getName() const override { return "dummysubdb"; } DocumentSubDbInitializer::UP createInitializer(const DocumentDBConfig &, SerialNum,const index::IndexConfig &) const override { return std::make_unique @@ -80,7 +80,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB std::shared_ptr getDocumentRetriever() override { return {}; } - matching::MatchingStats getMatcherStats(const vespalib::string &) const override { + matching::MatchingStats getMatcherStats(const std::string &) const override { return {}; } std::shared_ptr getDocumentDBReference() override { diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_handler.h b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_handler.h index 453bc8d87a28..5bd94ef57107 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_handler.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_handler.h @@ -10,7 +10,7 @@ namespace proton::test { */ struct DummyFlushHandler : public IFlushHandler { - DummyFlushHandler(const vespalib::string &name) noexcept + DummyFlushHandler(const std::string &name) noexcept : IFlushHandler(name) {} diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp index e2d4890ea30e..65513496760a 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp @@ -4,10 +4,10 @@ namespace proton::test { -DummyFlushTarget::DummyFlushTarget(const vespalib::string &name) noexcept +DummyFlushTarget::DummyFlushTarget(const std::string &name) noexcept : searchcorespi::LeafFlushTarget(name, Type::OTHER, Component::OTHER) {} -DummyFlushTarget::DummyFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept +DummyFlushTarget::DummyFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept : searchcorespi::LeafFlushTarget(name, type, component) {} DummyFlushTarget::~DummyFlushTarget() = default; diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h index 8fead6133053..853333ac787b 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h @@ -7,8 +7,8 @@ namespace proton::test { struct DummyFlushTarget : public searchcorespi::LeafFlushTarget { - DummyFlushTarget(const vespalib::string &name) noexcept; - DummyFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept; + DummyFlushTarget(const std::string &name) noexcept; + DummyFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept; ~DummyFlushTarget() override; MemoryGain getApproxMemoryGain() const override { return MemoryGain(0, 0); } DiskGain getApproxDiskGain() const override { return DiskGain(0, 0); } diff --git a/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h b/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h index 6e9fb120589a..9f8fce0537c9 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.h b/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.h index f6d98f1beddb..c35fe6ec9af2 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.h @@ -23,7 +23,7 @@ struct MockDocumentDBReference : public IDocumentDBReference { virtual std::shared_ptr getGidToLidMapperFactory() override { return std::shared_ptr(); } - virtual std::unique_ptr makeGidToLidChangeRegistrator(const vespalib::string &) override { + virtual std::unique_ptr makeGidToLidChangeRegistrator(const std::string &) override { return std::unique_ptr(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp index b9ed2cc10f20..6bf5b63b50a4 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp @@ -22,7 +22,7 @@ MockGidToLidChangeHandler::addListener(std::unique_ptr } void -MockGidToLidChangeHandler::removeListeners(const vespalib::string &docTypeName, const std::set &keepNames) { +MockGidToLidChangeHandler::removeListeners(const std::string &docTypeName, const std::set &keepNames) { _removes.emplace_back(docTypeName, keepNames); } diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h index 1fd27e07f497..50b99d841c5e 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h @@ -16,8 +16,8 @@ namespace proton::test { */ class MockGidToLidChangeHandler : public IGidToLidChangeHandler { public: - using AddEntry = std::pair; - using RemoveEntry = std::pair>; + using AddEntry = std::pair; + using RemoveEntry = std::pair>; private: std::vector _adds; @@ -29,7 +29,7 @@ class MockGidToLidChangeHandler : public IGidToLidChangeHandler { ~MockGidToLidChangeHandler() override; void addListener(std::unique_ptr listener) override; - void removeListeners(const vespalib::string &docTypeName, const std::set &keepNames) override; + void removeListeners(const std::string &docTypeName, const std::set &keepNames) override; void notifyPut(IDestructorCallbackSP, document::GlobalId, uint32_t, SerialNum) override { } void notifyRemoves(IDestructorCallbackSP, const std::vector &, SerialNum) override { } diff --git a/searchcore/src/vespa/searchcore/proton/test/userdocumentsbuilder.cpp b/searchcore/src/vespa/searchcore/proton/test/userdocumentsbuilder.cpp index 40d1f2400dea..7902e3134d4e 100644 --- a/searchcore/src/vespa/searchcore/proton/test/userdocumentsbuilder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/userdocumentsbuilder.cpp @@ -15,7 +15,7 @@ UserDocumentsBuilder::~UserDocumentsBuilder() = default; UserDocumentsBuilder & UserDocumentsBuilder::createDoc(uint32_t userId, search::DocumentIdT lid) { - vespalib::string docId = vespalib::make_string("id:test:searchdocument:n=%u:%u", userId, lid); + std::string docId = vespalib::make_string("id:test:searchdocument:n=%u:%u", userId, lid); document::Document::SP doc(_builder.make_document(docId)); _docs.addDoc(userId, Document(doc, lid, storage::spi::Timestamp(lid))); return *this; diff --git a/searchcore/src/vespa/searchcorespi/flush/flushstats.h b/searchcore/src/vespa/searchcorespi/flush/flushstats.h index 3ed877a0d7a9..5ded306b99b9 100644 --- a/searchcore/src/vespa/searchcorespi/flush/flushstats.h +++ b/searchcore/src/vespa/searchcorespi/flush/flushstats.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace searchcorespi { @@ -11,16 +11,16 @@ namespace searchcorespi { class FlushStats { private: - vespalib::string _path; // path to data flushed + std::string _path; // path to data flushed size_t _pathElementsToLog; public: FlushStats(); - void setPath(const vespalib::string & path) { _path = path; } + void setPath(const std::string & path) { _path = path; } void setPathElementsToLog(size_t numElems) { _pathElementsToLog = numElems; } - const vespalib::string & getPath() const { return _path; } + const std::string & getPath() const { return _path; } size_t getPathElementsToLog() const { return _pathElementsToLog; } }; diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp index 1a843794b21c..dfe1499e3d28 100644 --- a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp +++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp @@ -4,11 +4,11 @@ namespace searchcorespi { -IFlushTarget::IFlushTarget(const vespalib::string &name) noexcept +IFlushTarget::IFlushTarget(const std::string &name) noexcept : IFlushTarget(name, Type::OTHER, Component::OTHER) { } -IFlushTarget::IFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept +IFlushTarget::IFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept : _name(name), _type(type), _component(component) @@ -16,7 +16,7 @@ IFlushTarget::IFlushTarget(const vespalib::string &name, const Type &type, const IFlushTarget::~IFlushTarget() = default; -LeafFlushTarget::LeafFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept +LeafFlushTarget::LeafFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept : IFlushTarget(name, type, component) {} diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h index ddcdb44be8f3..631070138ea9 100644 --- a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h +++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h @@ -44,7 +44,7 @@ class IFlushTarget }; private: - vespalib::string _name; + std::string _name; Type _type; Component _component; @@ -81,7 +81,7 @@ class IFlushTarget * * @param name The handler-wide unique name of this target. */ - IFlushTarget(const vespalib::string &name) noexcept; + IFlushTarget(const std::string &name) noexcept; /** * Constructs a new instance of this class. @@ -90,7 +90,7 @@ class IFlushTarget * @param type The flush type of this target. * @param component The component type of this target. */ - IFlushTarget(const vespalib::string &name, + IFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept; @@ -104,7 +104,7 @@ class IFlushTarget * * @return The name of this. */ - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } /** * Returns the flush type of this target. @@ -187,7 +187,7 @@ class IFlushTarget class LeafFlushTarget : public IFlushTarget { public: - LeafFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept; + LeafFlushTarget(const std::string &name, const Type &type, const Component &component) noexcept; bool needUrgentFlush() const override { return false; } Priority getPriority() const override { return Priority::NORMAL; } double get_replay_operation_cost() const override { return 0.0; } diff --git a/searchcore/src/vespa/searchcorespi/index/disk_index_stats.h b/searchcore/src/vespa/searchcorespi/index/disk_index_stats.h index cba2c40402ba..c41c619b2e2e 100644 --- a/searchcore/src/vespa/searchcorespi/index/disk_index_stats.h +++ b/searchcore/src/vespa/searchcorespi/index/disk_index_stats.h @@ -2,7 +2,7 @@ #pragma once #include "index_searchable_stats.h" -#include +#include namespace searchcorespi { namespace index { @@ -13,13 +13,13 @@ struct IDiskIndex; * Information about a disk index usable by state explorer. */ class DiskIndexStats : public IndexSearchableStats { - vespalib::string _indexDir; + std::string _indexDir; public: DiskIndexStats(); DiskIndexStats(const IDiskIndex &index); ~DiskIndexStats(); - const vespalib::string &getIndexdir() const { return _indexDir; } + const std::string &getIndexdir() const { return _indexDir; } }; } // namespace searchcorespi::index diff --git a/searchcore/src/vespa/searchcorespi/index/disk_indexes.cpp b/searchcore/src/vespa/searchcorespi/index/disk_indexes.cpp index 096bdb64e5a1..610cba589f23 100644 --- a/searchcore/src/vespa/searchcorespi/index/disk_indexes.cpp +++ b/searchcore/src/vespa/searchcorespi/index/disk_indexes.cpp @@ -8,7 +8,7 @@ #include #include -using vespalib::string; +using std::string; namespace searchcorespi::index { diff --git a/searchcore/src/vespa/searchcorespi/index/disk_indexes.h b/searchcore/src/vespa/searchcorespi/index/disk_indexes.h index a98f43d35abd..a50f06bf1ef5 100644 --- a/searchcore/src/vespa/searchcorespi/index/disk_indexes.h +++ b/searchcore/src/vespa/searchcorespi/index/disk_indexes.h @@ -2,10 +2,10 @@ #pragma once -#include #include -#include #include +#include +#include namespace searchcorespi::index { @@ -35,9 +35,9 @@ class DiskIndexes { ~DiskIndexes(); DiskIndexes(const DiskIndexes &) = delete; DiskIndexes & operator = (const DiskIndexes &) = delete; - void setActive(const vespalib::string & index, uint64_t size_on_disk); - void notActive(const vespalib::string & index); - bool isActive(const vespalib::string & index) const; + void setActive(const std::string & index, uint64_t size_on_disk); + void notActive(const std::string & index); + bool isActive(const std::string & index) const; void add_not_active(IndexDiskDir index_disk_dir); bool remove(IndexDiskDir index_disk_dir); uint64_t get_transient_size(IndexDiskLayout& layout, IndexDiskDir index_disk_dir) const; diff --git a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp index 5849fdad3446..9f499eae2d14 100644 --- a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp +++ b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.cpp @@ -14,7 +14,7 @@ LOG_SETUP(".searchcorespi.index.diskindexcleaner"); using std::istringstream; -using vespalib::string; +using std::string; using std::vector; namespace searchcorespi::index { diff --git a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.h b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.h index bdf018e93a0f..461c839f39c1 100644 --- a/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.h +++ b/searchcore/src/vespa/searchcorespi/index/diskindexcleaner.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace searchcorespi { namespace index { @@ -15,9 +15,9 @@ struct DiskIndexCleaner { /** * Deletes all indexes with id lower than the most recent fusion id. */ - static void clean(const vespalib::string &index_dir, + static void clean(const std::string &index_dir, DiskIndexes& disk_indexes); - static void removeOldIndexes(const vespalib::string &index_dir, + static void removeOldIndexes(const std::string &index_dir, DiskIndexes& disk_indexes); }; diff --git a/searchcore/src/vespa/searchcorespi/index/eventlogger.cpp b/searchcore/src/vespa/searchcorespi/index/eventlogger.cpp index 227a4652695f..32aeef4301c2 100644 --- a/searchcore/src/vespa/searchcorespi/index/eventlogger.cpp +++ b/searchcore/src/vespa/searchcorespi/index/eventlogger.cpp @@ -12,7 +12,7 @@ using search::util::LogUtil; namespace searchcorespi::index { void -EventLogger::diskIndexLoadStart(const vespalib::string &indexDir) +EventLogger::diskIndexLoadStart(const std::string &indexDir) { JSONStringer jstr; jstr.beginObject(); @@ -23,7 +23,7 @@ EventLogger::diskIndexLoadStart(const vespalib::string &indexDir) } void -EventLogger::diskIndexLoadComplete(const vespalib::string &indexDir, +EventLogger::diskIndexLoadComplete(const std::string &indexDir, int64_t elapsedTimeMs) { JSONStringer jstr; @@ -36,8 +36,8 @@ EventLogger::diskIndexLoadComplete(const vespalib::string &indexDir, } void -EventLogger::diskFusionStart(const std::vector &sources, - const vespalib::string &fusionDir) +EventLogger::diskFusionStart(const std::vector &sources, + const std::string &fusionDir) { JSONStringer jstr; jstr.beginObject(); @@ -54,7 +54,7 @@ EventLogger::diskFusionStart(const std::vector &sources, } void -EventLogger::diskFusionComplete(const vespalib::string &fusionDir, +EventLogger::diskFusionComplete(const std::string &fusionDir, int64_t elapsedTimeMs) { JSONStringer jstr; diff --git a/searchcore/src/vespa/searchcorespi/index/eventlogger.h b/searchcore/src/vespa/searchcorespi/index/eventlogger.h index ff7e4eba3132..ac47b2ea6b37 100644 --- a/searchcore/src/vespa/searchcorespi/index/eventlogger.h +++ b/searchcore/src/vespa/searchcorespi/index/eventlogger.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include namespace searchcorespi { @@ -11,12 +11,12 @@ namespace index { * Class used to log various events related to disk index handling. **/ struct EventLogger { - static void diskIndexLoadStart(const vespalib::string &indexDir); - static void diskIndexLoadComplete(const vespalib::string &indexDir, + static void diskIndexLoadStart(const std::string &indexDir); + static void diskIndexLoadComplete(const std::string &indexDir, int64_t elapsedTimeMs); - static void diskFusionStart(const std::vector &sources, - const vespalib::string &fusionDir); - static void diskFusionComplete(const vespalib::string &fusionDir, + static void diskFusionStart(const std::vector &sources, + const std::string &fusionDir); + static void diskFusionComplete(const std::string &fusionDir, int64_t elapsedTimeMs); }; diff --git a/searchcore/src/vespa/searchcorespi/index/fakeindexsearchable.h b/searchcore/src/vespa/searchcorespi/index/fakeindexsearchable.h index be86f3d30c6e..fa34ad410010 100644 --- a/searchcore/src/vespa/searchcorespi/index/fakeindexsearchable.h +++ b/searchcore/src/vespa/searchcorespi/index/fakeindexsearchable.h @@ -35,7 +35,7 @@ class FakeIndexSearchable : public IndexSearchable { search::SerialNum getSerialNum() const override { return 0; } void accept(IndexSearchableVisitor &) const override { } - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override { (void) field_name; return search::index::FieldLengthInfo(); } diff --git a/searchcore/src/vespa/searchcorespi/index/fusionrunner.cpp b/searchcore/src/vespa/searchcorespi/index/fusionrunner.cpp index 211fa36c3054..ef2875b96505 100644 --- a/searchcore/src/vespa/searchcorespi/index/fusionrunner.cpp +++ b/searchcore/src/vespa/searchcorespi/index/fusionrunner.cpp @@ -20,7 +20,7 @@ using search::queryeval::ISourceSelector; using search::diskindex::SelectorArray; using search::SerialNum; using std::vector; -using vespalib::string; +using std::string; namespace searchcorespi::index { diff --git a/searchcore/src/vespa/searchcorespi/index/fusionrunner.h b/searchcore/src/vespa/searchcorespi/index/fusionrunner.h index a375ec57409d..cb6fa378241d 100644 --- a/searchcore/src/vespa/searchcorespi/index/fusionrunner.h +++ b/searchcore/src/vespa/searchcorespi/index/fusionrunner.h @@ -40,7 +40,7 @@ class FusionRunner { * Create a FusionRunner that operates on indexes stored in the * base dir. **/ - FusionRunner(const vespalib::string &base_dir, + FusionRunner(const std::string &base_dir, const search::index::Schema &schema, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext &fileHeaderContext); diff --git a/searchcore/src/vespa/searchcorespi/index/idiskindex.h b/searchcore/src/vespa/searchcorespi/index/idiskindex.h index fea875dee051..bcb8562e543b 100644 --- a/searchcore/src/vespa/searchcorespi/index/idiskindex.h +++ b/searchcore/src/vespa/searchcorespi/index/idiskindex.h @@ -3,7 +3,7 @@ #include "indexsearchable.h" #include -#include +#include namespace searchcorespi::index { @@ -17,7 +17,7 @@ struct IDiskIndex : public IndexSearchable { /** * Returns the directory in which this disk index exists. */ - virtual const vespalib::string &getIndexDir() const = 0; + virtual const std::string &getIndexDir() const = 0; /** * Returns the schema used by this disk index. diff --git a/searchcore/src/vespa/searchcorespi/index/iindexcollection.cpp b/searchcore/src/vespa/searchcorespi/index/iindexcollection.cpp index a5edc61a4587..1eff951c7112 100644 --- a/searchcore/src/vespa/searchcorespi/index/iindexcollection.cpp +++ b/searchcore/src/vespa/searchcorespi/index/iindexcollection.cpp @@ -8,7 +8,7 @@ namespace searchcorespi { using index::IDiskIndex; -vespalib::string IIndexCollection::toString() const +std::string IIndexCollection::toString() const { vespalib::asciistream s; s << "selector : " << &getSourceSelector() << "(baseId=" << getSourceSelector().getBaseId() diff --git a/searchcore/src/vespa/searchcorespi/index/iindexcollection.h b/searchcore/src/vespa/searchcorespi/index/iindexcollection.h index 97bc48c3cf17..6179e3737e7a 100644 --- a/searchcore/src/vespa/searchcorespi/index/iindexcollection.h +++ b/searchcore/src/vespa/searchcorespi/index/iindexcollection.h @@ -41,7 +41,7 @@ class IIndexCollection { */ virtual uint32_t getSourceId(uint32_t i) const = 0; - virtual vespalib::string toString() const; + virtual std::string toString() const; }; diff --git a/searchcore/src/vespa/searchcorespi/index/iindexmaintaineroperations.h b/searchcore/src/vespa/searchcorespi/index/iindexmaintaineroperations.h index 85e9be12c9d6..5e12345b0d46 100644 --- a/searchcore/src/vespa/searchcorespi/index/iindexmaintaineroperations.h +++ b/searchcore/src/vespa/searchcorespi/index/iindexmaintaineroperations.h @@ -31,7 +31,7 @@ struct IIndexMaintainerOperations { /** * Loads a disk index from the given directory. */ - virtual IDiskIndex::SP loadDiskIndex(const vespalib::string &indexDir) = 0; + virtual IDiskIndex::SP loadDiskIndex(const std::string &indexDir) = 0; /** * Reloads the given disk index and returns a new instance. @@ -51,8 +51,8 @@ struct IIndexMaintainerOperations { * @param lastSerialNum the serial number of the last operation in the last input disk index. */ virtual bool runFusion(const Schema &schema, - const vespalib::string &outputDir, - const std::vector &sources, + const std::string &outputDir, + const std::vector &sources, const SelectorArray &selectorArray, search::SerialNum lastSerialNum, std::shared_ptr flush_token) = 0; diff --git a/searchcore/src/vespa/searchcorespi/index/imemoryindex.h b/searchcore/src/vespa/searchcorespi/index/imemoryindex.h index d67932f32d8c..d9a13e24a1aa 100644 --- a/searchcore/src/vespa/searchcorespi/index/imemoryindex.h +++ b/searchcore/src/vespa/searchcorespi/index/imemoryindex.h @@ -4,8 +4,8 @@ #include "indexsearchable.h" #include #include -#include #include +#include namespace document { class Document; } namespace vespalib { class IDestructorCallback; } @@ -73,7 +73,7 @@ struct IMemoryIndex : public searchcorespi::IndexSearchable { * @param docIdLimit the largest local document id used + 1 * @param serialNum the serial number of the last operation to the memory index. */ - virtual void flushToDisk(const vespalib::string &flushDir, + virtual void flushToDisk(const std::string &flushDir, uint32_t docIdLimit, search::SerialNum serialNum) = 0; diff --git a/searchcore/src/vespa/searchcorespi/index/indexcollection.cpp b/searchcore/src/vespa/searchcorespi/index/indexcollection.cpp index e6cc618ead79..dfc25865dc14 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexcollection.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexcollection.cpp @@ -243,7 +243,7 @@ IndexCollection::createBlueprint(const IRequestContext & requestContext, } FieldLengthInfo -IndexCollection::get_field_length_info(const vespalib::string& field_name) const +IndexCollection::get_field_length_info(const std::string& field_name) const { if (_sources.empty()) { return FieldLengthInfo(); diff --git a/searchcore/src/vespa/searchcorespi/index/indexcollection.h b/searchcore/src/vespa/searchcorespi/index/indexcollection.h index c15afc0ce5b5..6f7e4c3c29a4 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexcollection.h +++ b/searchcore/src/vespa/searchcorespi/index/indexcollection.h @@ -62,7 +62,7 @@ class IndexCollection : public ISearchableIndexCollection /** * Returns field length info from the newest disk index, or empty info for all fields if no disk index exists. */ - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override; + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override; }; } // namespace searchcorespi diff --git a/searchcore/src/vespa/searchcorespi/index/indexdisklayout.cpp b/searchcore/src/vespa/searchcorespi/index/indexdisklayout.cpp index ebe148e5c662..bf58a3721365 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexdisklayout.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexdisklayout.cpp @@ -6,21 +6,21 @@ namespace searchcorespi::index { -const vespalib::string -IndexDiskLayout::FlushDirPrefix = vespalib::string("index.flush."); +const std::string +IndexDiskLayout::FlushDirPrefix = std::string("index.flush."); -const vespalib::string -IndexDiskLayout::FusionDirPrefix = vespalib::string("index.fusion."); +const std::string +IndexDiskLayout::FusionDirPrefix = std::string("index.fusion."); -const vespalib::string -IndexDiskLayout::SerialNumTag = vespalib::string("Serial num"); +const std::string +IndexDiskLayout::SerialNumTag = std::string("Serial num"); -IndexDiskLayout::IndexDiskLayout(const vespalib::string &baseDir) +IndexDiskLayout::IndexDiskLayout(const std::string &baseDir) : _baseDir(baseDir) { } -vespalib::string +std::string IndexDiskLayout::getFlushDir(uint32_t sourceId) const { std::ostringstream ost; @@ -28,7 +28,7 @@ IndexDiskLayout::getFlushDir(uint32_t sourceId) const return ost.str(); } -vespalib::string +std::string IndexDiskLayout::getFusionDir(uint32_t sourceId) const { std::ostringstream ost; @@ -36,29 +36,29 @@ IndexDiskLayout::getFusionDir(uint32_t sourceId) const return ost.str(); } -vespalib::string -IndexDiskLayout::getSerialNumFileName(const vespalib::string &dir) +std::string +IndexDiskLayout::getSerialNumFileName(const std::string &dir) { return dir + "/serial.dat"; } -vespalib::string -IndexDiskLayout::getSchemaFileName(const vespalib::string &dir) +std::string +IndexDiskLayout::getSchemaFileName(const std::string &dir) { return dir + "/schema.txt"; } -vespalib::string -IndexDiskLayout::getSelectorFileName(const vespalib::string &dir) +std::string +IndexDiskLayout::getSelectorFileName(const std::string &dir) { return dir + "/selector"; } IndexDiskDir -IndexDiskLayout::get_index_disk_dir(const vespalib::string& dir) +IndexDiskLayout::get_index_disk_dir(const std::string& dir) { auto name = dir.substr(dir.rfind('/') + 1); - const vespalib::string* prefix = nullptr; + const std::string* prefix = nullptr; bool fusion = false; if (name.find(FlushDirPrefix) == 0) { prefix = &FlushDirPrefix; diff --git a/searchcore/src/vespa/searchcorespi/index/indexdisklayout.h b/searchcore/src/vespa/searchcorespi/index/indexdisklayout.h index a577f6daf01b..abdd5210f9b7 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexdisklayout.h +++ b/searchcore/src/vespa/searchcorespi/index/indexdisklayout.h @@ -1,7 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include +#include namespace searchcorespi { namespace index { @@ -14,22 +15,22 @@ class IndexDiskDir; */ class IndexDiskLayout { public: - static const vespalib::string FlushDirPrefix; - static const vespalib::string FusionDirPrefix; - static const vespalib::string SerialNumTag; + static const std::string FlushDirPrefix; + static const std::string FusionDirPrefix; + static const std::string SerialNumTag; private: - vespalib::string _baseDir; + std::string _baseDir; public: - IndexDiskLayout(const vespalib::string &baseDir); - vespalib::string getFlushDir(uint32_t sourceId) const; - vespalib::string getFusionDir(uint32_t sourceId) const; - static IndexDiskDir get_index_disk_dir(const vespalib::string& dir); - - static vespalib::string getSerialNumFileName(const vespalib::string &dir); - static vespalib::string getSchemaFileName(const vespalib::string &dir); - static vespalib::string getSelectorFileName(const vespalib::string &dir); + IndexDiskLayout(const std::string &baseDir); + std::string getFlushDir(uint32_t sourceId) const; + std::string getFusionDir(uint32_t sourceId) const; + static IndexDiskDir get_index_disk_dir(const std::string& dir); + + static std::string getSerialNumFileName(const std::string &dir); + static std::string getSchemaFileName(const std::string &dir); + static std::string getSelectorFileName(const std::string &dir); }; } // namespace index diff --git a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp index f889fad136f4..e4d7e913ba51 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp @@ -26,7 +26,7 @@ class Fusioner : public FlushTask { {} void run() override { - vespalib::string outputFusionDir = _indexMaintainer.doFusion(_serialNum, _flush_token); + std::string outputFusionDir = _indexMaintainer.doFusion(_serialNum, _flush_token); // the target must live until this task is done (handled by flush engine). _stats.setPath(outputFusionDir); } diff --git a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp index 6028a543320d..1ab09c0e0495 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -43,7 +43,7 @@ using search::SerialNum; using vespalib::makeLambdaTask; using vespalib::makeSharedLambdaCallback; using std::ostringstream; -using vespalib::string; +using std::string; using vespalib::Executor; using vespalib::Runnable; using vespalib::IDestructorCallback; @@ -146,14 +146,14 @@ class DiskIndexWithDestructorCallback : public IDiskIndex { /** * Implements IFieldLengthInspector */ - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override { return _index->get_field_length_info(field_name); } /** * Implements IDiskIndex */ - const vespalib::string &getIndexDir() const override { return _index->getIndexDir(); } + const std::string &getIndexDir() const override { return _index->getIndexDir(); } const search::index::Schema &getSchema() const override { return _index->getSchema(); } }; @@ -219,7 +219,7 @@ IndexMaintainer::reopenDiskIndexes(ISearchableIndexCollection &coll) continue; // not a disk index } const string indexDir = d->getIndexDir(); - vespalib::string schemaName = IndexDiskLayout::getSchemaFileName(indexDir); + std::string schemaName = IndexDiskLayout::getSchemaFileName(indexDir); Schema trimmedSchema; if (!trimmedSchema.loadFromFile(schemaName)) { LOG(error, "Could not open schema '%s'", schemaName.c_str()); @@ -234,7 +234,7 @@ IndexMaintainer::reopenDiskIndexes(ISearchableIndexCollection &coll) } void -IndexMaintainer::updateDiskIndexSchema(const vespalib::string &indexDir, +IndexMaintainer::updateDiskIndexSchema(const std::string &indexDir, const Schema &schema, SerialNum serialNum) { @@ -300,7 +300,7 @@ IndexMaintainer::updateActiveFusionPrunedSchema(const Schema &schema) } void -IndexMaintainer::deactivateDiskIndexes(vespalib::string indexDir) +IndexMaintainer::deactivateDiskIndexes(std::string indexDir) { _disk_indexes->notActive(indexDir); removeOldDiskIndexes(); @@ -586,7 +586,7 @@ void IndexMaintainer::updateFlushStats(const FlushArgs &args) { // Called by a flush worker thread - vespalib::string flushDir; + std::string flushDir; if (!args._skippedEmptyLast) { flushDir = getFlushDir(args.old_absolute_id); } else { @@ -1210,7 +1210,7 @@ IndexMaintainer::putDocument(uint32_t lid, const Document &doc, SerialNum serial try { _current_index->insertDocument(lid, doc, on_write_done); } catch (const vespalib::IllegalStateException & e) { - vespalib::string s = "Failed inserting document :\n" + doc.toXml(" ") + "\n"; + std::string s = "Failed inserting document :\n" + doc.toXml(" ") + "\n"; LOG(error, "%s", s.c_str()); throw vespalib::IllegalStateException(s, e, VESPA_STRLOC); } diff --git a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.h index 6db588d83acf..24c172ba14a2 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcore/src/vespa/searchcorespi/index/indexmaintainer.h @@ -71,7 +71,7 @@ class IndexMaintainer : public IIndexManager, using ISourceSelector = search::queryeval::ISourceSelector; using LockGuard = std::lock_guard; - const vespalib::string _base_dir; + const std::string _base_dir; const WarmupConfig _warmupConfig; std::shared_ptr _disk_indexes; IndexDiskLayout _layout; @@ -146,8 +146,8 @@ class IndexMaintainer : public IIndexManager, uint32_t get_absolute_id() const noexcept { return _last_fusion_id + _current_index_id; } // set id for new memory index, other callers than constructor holds SL and IUL void set_id_for_new_memory_index(); - vespalib::string getFlushDir(uint32_t sourceId) const; - vespalib::string getFusionDir(uint32_t sourceId) const; + std::string getFlushDir(uint32_t sourceId) const; + std::string getFusionDir(uint32_t sourceId) const; /** * Will reopen diskindexes if necessary due to schema changes. @@ -156,7 +156,7 @@ class IndexMaintainer : public IIndexManager, */ bool reopenDiskIndexes(ISearchableIndexCollection &coll); - void updateDiskIndexSchema(const vespalib::string &indexDir, + void updateDiskIndexSchema(const std::string &indexDir, const Schema &schema, SerialNum serialNum); @@ -165,8 +165,8 @@ class IndexMaintainer : public IIndexManager, SerialNum serialNum); void updateActiveFusionPrunedSchema(const Schema &schema); - void deactivateDiskIndexes(vespalib::string indexDir); - std::shared_ptr loadDiskIndex(const vespalib::string &indexDir); + void deactivateDiskIndexes(std::string indexDir); + std::shared_ptr loadDiskIndex(const std::string &indexDir); std::shared_ptr reloadDiskIndex(const IDiskIndex &oldIndex); std::shared_ptr flushMemoryIndex(IMemoryIndex &memoryIndex, @@ -293,7 +293,7 @@ class IndexMaintainer : public IIndexManager, /** * Runs fusion for any available specs and return the output fusion directory. */ - vespalib::string doFusion(SerialNum serialNum, std::shared_ptr flush_token); + std::string doFusion(SerialNum serialNum, std::shared_ptr flush_token); uint32_t runFusion(const FusionSpec &fusion_spec, std::shared_ptr flush_token); void removeOldDiskIndexes(); @@ -330,7 +330,7 @@ class IndexMaintainer : public IIndexManager, **/ FlushStats getFlushStats() const; FusionStats getFusionStats() const; - const vespalib::string & getBaseDir() const { return _base_dir; } + const std::string & getBaseDir() const { return _base_dir; } uint32_t getNumFrozenMemoryIndexes() const; uint32_t getMaxFrozenMemoryIndexes() const { return _maxFrozen; } diff --git a/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp b/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp index ca3e98de3a64..046e5de06ea2 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.cpp @@ -7,7 +7,7 @@ using search::TuneFileAttributes; namespace searchcorespi::index { -IndexMaintainerConfig::IndexMaintainerConfig(const vespalib::string &baseDir, +IndexMaintainerConfig::IndexMaintainerConfig(const std::string &baseDir, const WarmupConfig & warmup, size_t maxFlushed, const Schema &schema, diff --git a/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.h b/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.h index 4e91dd598317..c126eb742de5 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.h +++ b/searchcore/src/vespa/searchcorespi/index/indexmaintainerconfig.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace searchcorespi::index { @@ -14,7 +14,7 @@ namespace searchcorespi::index { */ class IndexMaintainerConfig { private: - const vespalib::string _baseDir; + const std::string _baseDir; const WarmupConfig _warmup; const size_t _maxFlushed; const search::index::Schema _schema; @@ -22,7 +22,7 @@ class IndexMaintainerConfig { const search::TuneFileAttributes _tuneFileAttributes; public: - IndexMaintainerConfig(const vespalib::string &baseDir, + IndexMaintainerConfig(const std::string &baseDir, const WarmupConfig & warmup, size_t maxFlushed, const search::index::Schema &schema, @@ -34,7 +34,7 @@ class IndexMaintainerConfig { /** * Returns the base directory in which the maintainer will store its indexes. */ - const vespalib::string &getBaseDir() const { + const std::string &getBaseDir() const { return _baseDir; } diff --git a/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.cpp b/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.cpp index f5df775a27b6..def6fbc74d4a 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.cpp @@ -4,7 +4,7 @@ namespace searchcorespi { -IndexManagerConfig::IndexManagerConfig(const vespalib::string &configId, +IndexManagerConfig::IndexManagerConfig(const std::string &configId, const config::ConfigSnapshot &configSnapshot, size_t numSearcherThreads) : _configId(configId), diff --git a/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.h b/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.h index 3012b3d428fd..764460ffb52e 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.h +++ b/searchcore/src/vespa/searchcorespi/index/indexmanagerconfig.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include namespace searchcorespi { @@ -11,12 +11,12 @@ namespace searchcorespi { */ class IndexManagerConfig { private: - vespalib::string _configId; + std::string _configId; const config::ConfigSnapshot &_configSnapshot; size_t _numSearcherThreads; public: - IndexManagerConfig(const vespalib::string &configId, + IndexManagerConfig(const std::string &configId, const config::ConfigSnapshot &configSnapshot, size_t numSearcherThreads); ~IndexManagerConfig(); @@ -24,7 +24,7 @@ class IndexManagerConfig { /** * Returns the config id used to retrieve the configs from the config snapshot instance. */ - const vespalib::string &getConfigId() const { return _configId; } + const std::string &getConfigId() const { return _configId; } /** * Returns the snapshot containing configs to be used by the index manager. diff --git a/searchcore/src/vespa/searchcorespi/index/indexreadutilities.cpp b/searchcore/src/vespa/searchcorespi/index/indexreadutilities.cpp index 6683e9aa9350..47f68e7ddcd6 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexreadutilities.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexreadutilities.cpp @@ -22,14 +22,14 @@ namespace { * Assumes that cleanup has removed all obsolete index dirs. **/ void -scanForIndexes(const vespalib::string &baseDir, - std::vector &flushDirs, - vespalib::string &fusionDir) +scanForIndexes(const std::string &baseDir, + std::vector &flushDirs, + std::string &fusionDir) { std::filesystem::directory_iterator dir_scan{std::filesystem::path(baseDir)}; for (auto& entry : dir_scan) { if (entry.is_directory()) { - vespalib::string name = entry.path().filename().string(); + std::string name = entry.path().filename().string(); if (name.find(IndexDiskLayout::FlushDirPrefix) == 0) { flushDirs.push_back(name); } @@ -47,10 +47,10 @@ scanForIndexes(const vespalib::string &baseDir, } FusionSpec -IndexReadUtilities::readFusionSpec(const vespalib::string &baseDir) +IndexReadUtilities::readFusionSpec(const std::string &baseDir) { - std::vector flushDirs; - vespalib::string fusionDir; + std::vector flushDirs; + std::string fusionDir; scanForIndexes(baseDir, flushDirs, fusionDir); uint32_t fusionId = 0; @@ -70,9 +70,9 @@ IndexReadUtilities::readFusionSpec(const vespalib::string &baseDir) } SerialNum -IndexReadUtilities::readSerialNum(const vespalib::string &dir) +IndexReadUtilities::readSerialNum(const std::string &dir) { - const vespalib::string fileName = IndexDiskLayout::getSerialNumFileName(dir); + const std::string fileName = IndexDiskLayout::getSerialNumFileName(dir); Fast_BufferedFile file(16_Ki); file.ReadOpen(fileName.c_str()); diff --git a/searchcore/src/vespa/searchcorespi/index/indexreadutilities.h b/searchcore/src/vespa/searchcorespi/index/indexreadutilities.h index a4af2418ae33..96cbc732b443 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexreadutilities.h +++ b/searchcore/src/vespa/searchcorespi/index/indexreadutilities.h @@ -3,7 +3,7 @@ #include "fusionspec.h" #include -#include +#include namespace searchcorespi { namespace index { @@ -13,8 +13,8 @@ namespace index { * Used by the index maintainer. */ struct IndexReadUtilities { - static FusionSpec readFusionSpec(const vespalib::string &baseDir); - static search::SerialNum readSerialNum(const vespalib::string &dir); + static FusionSpec readFusionSpec(const std::string &baseDir); + static search::SerialNum readSerialNum(const std::string &dir); }; } // namespace index diff --git a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp index dfef52cc8e81..50f701233251 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp +++ b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.cpp @@ -37,11 +37,11 @@ SerialNum noSerialNumHigh = std::numeric_limits::max(); void IndexWriteUtilities::writeSerialNum(SerialNum serialNum, - const vespalib::string &dir, + const std::string &dir, const FileHeaderContext &fileHeaderContext) { - const vespalib::string fileName = IndexDiskLayout::getSerialNumFileName(dir); - const vespalib::string tmpFileName = fileName + ".tmp"; + const std::string fileName = IndexDiskLayout::getSerialNumFileName(dir); + const std::string tmpFileName = fileName + ".tmp"; SerialNumFileHeaderContext snFileHeaderContext(fileHeaderContext, serialNum); Fast_BufferedFile file(16_Ki); @@ -77,12 +77,12 @@ IndexWriteUtilities::writeSerialNum(SerialNum serialNum, } bool -IndexWriteUtilities::copySerialNumFile(const vespalib::string &sourceDir, - const vespalib::string &destDir) +IndexWriteUtilities::copySerialNumFile(const std::string &sourceDir, + const std::string &destDir) { - vespalib::string source = IndexDiskLayout::getSerialNumFileName(sourceDir); - vespalib::string dest = IndexDiskLayout::getSerialNumFileName(destDir); - vespalib::string tmpDest = dest + ".tmp"; + std::string source = IndexDiskLayout::getSerialNumFileName(sourceDir); + std::string dest = IndexDiskLayout::getSerialNumFileName(destDir); + std::string tmpDest = dest + ".tmp"; std::error_code ec; fs::copy_file(fs::path(source), fs::path(tmpDest), ec); @@ -117,9 +117,9 @@ IndexWriteUtilities::writeSourceSelector(FixedSourceSelector::SaveInfo & saveInf } void -IndexWriteUtilities::updateDiskIndexSchema(const vespalib::string &indexDir, const Schema &schema, SerialNum serialNum) +IndexWriteUtilities::updateDiskIndexSchema(const std::string &indexDir, const Schema &schema, SerialNum serialNum) { - vespalib::string schemaName = IndexDiskLayout::getSchemaFileName(indexDir); + std::string schemaName = IndexDiskLayout::getSchemaFileName(indexDir); Schema oldSchema; if (!oldSchema.loadFromFile(schemaName)) { LOG(error, "Could not open schema '%s'", schemaName.c_str()); @@ -139,8 +139,8 @@ IndexWriteUtilities::updateDiskIndexSchema(const vespalib::string &indexDir, con return; } } - vespalib::string schemaTmpName = schemaName + ".tmp"; - vespalib::string schemaOrigName = schemaName + ".orig"; + std::string schemaTmpName = schemaName + ".tmp"; + std::string schemaOrigName = schemaName + ".orig"; fs::remove(fs::path(schemaTmpName)); if (!newSchema->saveToFile(schemaTmpName)) { LOG(error, "Could not save schema to '%s'", schemaTmpName.c_str()); diff --git a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.h b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.h index d4a5319d7c20..c3c5ec32ef74 100644 --- a/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.h +++ b/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include namespace searchcorespi::index { @@ -18,12 +18,12 @@ struct IndexWriteUtilities { static void writeSerialNum(search::SerialNum serialNum, - const vespalib::string &dir, + const std::string &dir, const search::common::FileHeaderContext &fileHeaderContext); static bool - copySerialNumFile(const vespalib::string &sourceDir, - const vespalib::string &destDir); + copySerialNumFile(const std::string &sourceDir, + const std::string &destDir); static void writeSourceSelector(search::FixedSourceSelector::SaveInfo &saveInfo, @@ -34,7 +34,7 @@ struct IndexWriteUtilities search::SerialNum serialNum); static void - updateDiskIndexSchema(const vespalib::string &indexDir, + updateDiskIndexSchema(const std::string &indexDir, const search::index::Schema &schema, search::SerialNum serialNum); }; diff --git a/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.cpp b/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.cpp index 5541dd840310..3d396b1cf913 100644 --- a/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.cpp +++ b/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.cpp @@ -28,7 +28,7 @@ using search::queryeval::SearchIterator; using search::queryeval::IRequestContext; using search::queryeval::FieldSpec; using search::queryeval::FieldSpecList; -using TermMap = vespalib::hash_set; +using TermMap = vespalib::hash_set; namespace { class WarmupRequestContext : public IRequestContext { @@ -41,7 +41,7 @@ class WarmupRequestContext : public IRequestContext { vespalib::ThreadBundle & thread_bundle() const override { return vespalib::ThreadBundle::trivial(); } const IAttributeVector *getAttribute(std::string_view) const override { return nullptr; } const IAttributeVector *getAttributeStableEnum(std::string_view) const override { return nullptr; } - const vespalib::eval::Value* get_query_tensor(const vespalib::string&) const override; + const vespalib::eval::Value* get_query_tensor(const std::string&) const override; const AttributeBlueprintParams& get_attribute_blueprint_params() const override { return _params; } const MetaStoreReadGuardSP * getMetaStoreReadGuard() const override { return nullptr; } private: @@ -108,7 +108,7 @@ WarmupIndexCollection::setSource(uint32_t docId) _next->setSource(docId); } -vespalib::string +std::string WarmupIndexCollection::toString() const { vespalib::asciistream os; @@ -182,7 +182,7 @@ WarmupIndexCollection::handledBefore(uint32_t fieldId, const Node &term) { const auto * sb(dynamic_cast(&term)); if (sb != nullptr) { - const vespalib::string & s = sb->getTerm(); + const std::string & s = sb->getTerm(); std::lock_guard guard(_lock); TermMap::insert_result found = (*_handledTerms)[fieldId].insert(s); return ! found.second; @@ -247,7 +247,7 @@ WarmupIndexCollection::accept(IndexSearchableVisitor &visitor) const } FieldLengthInfo -WarmupIndexCollection::get_field_length_info(const vespalib::string& field_name) const +WarmupIndexCollection::get_field_length_info(const std::string& field_name) const { return _next->get_field_length_info(field_name); } @@ -279,7 +279,7 @@ WarmupRequestContext::WarmupRequestContext() = default; WarmupRequestContext::~WarmupRequestContext() = default; const vespalib::eval::Value* -WarmupRequestContext::get_query_tensor(const vespalib::string&) const { +WarmupRequestContext::get_query_tensor(const std::string&) const { return {}; } WarmupTask::WarmupTask(std::unique_ptr md, std::shared_ptr warmup) diff --git a/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.h b/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.h index 143587743474..7503b1173c59 100644 --- a/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.h +++ b/searchcore/src/vespa/searchcorespi/index/warmupindexcollection.h @@ -53,7 +53,7 @@ class WarmupIndexCollection : public ISearchableIndexCollection, void accept(IndexSearchableVisitor &visitor) const override; // Implements IFieldLengthInspector - search::index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override; + search::index::FieldLengthInfo get_field_length_info(const std::string& field_name) const override; // Implements ISearchableIndexCollection void append(uint32_t id, const IndexSearchable::SP &source) override; @@ -62,7 +62,7 @@ class WarmupIndexCollection : public ISearchableIndexCollection, void setSource(uint32_t docId) override; const ISearchableIndexCollection::SP & getNextIndexCollection() const { return _next; } - vespalib::string toString() const override; + std::string toString() const override; bool doUnpack() const { return _warmupConfig.getUnpack(); } void drainPending(); vespalib::steady_time warmupEndTime() const { return _warmupEndTime; } diff --git a/searchlib/src/apps/docstore/benchmarkdatastore.cpp b/searchlib/src/apps/docstore/benchmarkdatastore.cpp index bdc9bd3a9ed7..60cbdd31e1f3 100644 --- a/searchlib/src/apps/docstore/benchmarkdatastore.cpp +++ b/searchlib/src/apps/docstore/benchmarkdatastore.cpp @@ -19,7 +19,7 @@ using namespace search; class BenchmarkDataStoreApp { void usage(const char *self); - int benchmark(const vespalib::string & directory, size_t numReads, size_t numThreads, size_t perChunk, const vespalib::string & readType); + int benchmark(const std::string & directory, size_t numReads, size_t numThreads, size_t perChunk, const std::string & readType); void read(size_t numReads, size_t perChunk, const IDataStore * dataStore); public: int main(int argc, char **argv); @@ -41,8 +41,8 @@ BenchmarkDataStoreApp::main(int argc, char **argv) size_t numThreads(16); size_t numReads(1000000); size_t perChunk(1); - vespalib::string readType("directio"); - vespalib::string directory(argv[1]); + std::string readType("directio"); + std::string directory(argv[1]); if (argc >= 3) { numReads = strtoul(argv[2], NULL, 0); if (argc >= 4) { @@ -83,7 +83,7 @@ void BenchmarkDataStoreApp::read(size_t numReads, size_t perChunk, const IDataSt } int -BenchmarkDataStoreApp::benchmark(const vespalib::string & dir, size_t numReads, size_t numThreads, size_t perChunk, const vespalib::string & readType) +BenchmarkDataStoreApp::benchmark(const std::string & dir, size_t numReads, size_t numThreads, size_t perChunk, const std::string & readType) { int retval(0); LogDataStore::Config config; diff --git a/searchlib/src/apps/docstore/create-idx-from-dat.cpp b/searchlib/src/apps/docstore/create-idx-from-dat.cpp index fd7a4b5ee484..746b9917367d 100644 --- a/searchlib/src/apps/docstore/create-idx-from-dat.cpp +++ b/searchlib/src/apps/docstore/create-idx-from-dat.cpp @@ -14,7 +14,7 @@ using namespace search; class CreateIdxFileFromDatApp { void usage(const char *self); - int createIdxFile(const vespalib::string & datFileName, const vespalib::string & idxFileName); + int createIdxFile(const std::string & datFileName, const std::string & idxFileName); public: int main(int argc, char **argv); }; @@ -86,7 +86,7 @@ generate(uint64_t serialNum, size_t chunks, FastOS_FileInterface & idxFile, size } } -int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, const vespalib::string & idxFileName) +int CreateIdxFileFromDatApp::createIdxFile(const std::string & datFileName, const std::string & idxFileName) { MMapRandRead datFile(datFileName, 0, 0); int64_t fileSize = datFile.getSize(); @@ -155,10 +155,10 @@ int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, int CreateIdxFileFromDatApp::main(int argc, char **argv) { - vespalib::string cmd; + std::string cmd; if (argc == 3) { - vespalib::string datFile(argv[1]); - vespalib::string idxfile(argv[2]); + std::string datFile(argv[1]); + std::string idxfile(argv[2]); createIdxFile(datFile, idxfile); } else { fprintf(stderr, "Too few arguments\n"); diff --git a/searchlib/src/apps/docstore/documentstoreinspect.cpp b/searchlib/src/apps/docstore/documentstoreinspect.cpp index d618580d1d94..b24772da7595 100644 --- a/searchlib/src/apps/docstore/documentstoreinspect.cpp +++ b/searchlib/src/apps/docstore/documentstoreinspect.cpp @@ -14,8 +14,8 @@ using namespace search; class DocumentStoreInspectApp { void usage(const char *self); - int verify(const vespalib::string & directory); - int dumpIdxFile(const vespalib::string & file); + int verify(const std::string & directory); + int dumpIdxFile(const std::string & file); public: int main(int argc, char **argv); }; @@ -29,7 +29,7 @@ DocumentStoreInspectApp::usage(const char *self) fflush(stdout); } -int DocumentStoreInspectApp::dumpIdxFile(const vespalib::string & file) +int DocumentStoreInspectApp::dumpIdxFile(const std::string & file) { FastOS_File idxFile(file.c_str()); idxFile.enableMemoryMap(0); @@ -67,13 +67,13 @@ int DocumentStoreInspectApp::dumpIdxFile(const vespalib::string & file) int DocumentStoreInspectApp::main(int argc, char **argv) { - vespalib::string cmd; + std::string cmd; if (argc >= 2) { cmd = argv[1]; if (cmd == "dumpidxfile") { - vespalib::string idxfile; + std::string idxfile; if (argc >= 4) { - if (vespalib::string(argv[2]) == vespalib::string("--idxfile")) { + if (std::string(argv[2]) == std::string("--idxfile")) { idxfile = argv[3]; dumpIdxFile(idxfile); } else { @@ -100,7 +100,7 @@ DocumentStoreInspectApp::main(int argc, char **argv) } int -DocumentStoreInspectApp::verify(const vespalib::string & dir) +DocumentStoreInspectApp::verify(const std::string & dir) { int retval(0); diff --git a/searchlib/src/apps/docstore/verifylogdatastore.cpp b/searchlib/src/apps/docstore/verifylogdatastore.cpp index 0f8de9d702fc..516885475fb6 100644 --- a/searchlib/src/apps/docstore/verifylogdatastore.cpp +++ b/searchlib/src/apps/docstore/verifylogdatastore.cpp @@ -14,7 +14,7 @@ using namespace search; class VerifyLogDataStoreApp { void usage(const char *self); - int verify(const vespalib::string & directory); + int verify(const std::string & directory); public: int main(int argc, char **argv); }; @@ -32,7 +32,7 @@ int VerifyLogDataStoreApp::main(int argc, char **argv) { if (argc >= 2) { - vespalib::string directory(argv[1]); + std::string directory(argv[1]); return verify(directory); } else { fprintf(stderr, "Too few arguments\n"); @@ -43,7 +43,7 @@ VerifyLogDataStoreApp::main(int argc, char **argv) } int -VerifyLogDataStoreApp::verify(const vespalib::string & dir) +VerifyLogDataStoreApp::verify(const std::string & dir) { int retval(0); diff --git a/searchlib/src/apps/tests/memoryindexstress_test.cpp b/searchlib/src/apps/tests/memoryindexstress_test.cpp index 53d2eb2c2763..dd22c7286ffc 100644 --- a/searchlib/src/apps/tests/memoryindexstress_test.cpp +++ b/searchlib/src/apps/tests/memoryindexstress_test.cpp @@ -57,14 +57,14 @@ using vespalib::makeLambdaTask; namespace { -const vespalib::string SPANTREE_NAME("linguistics"); -const vespalib::string title("title"); -const vespalib::string body("body"); -const vespalib::string foo("foo"); -const vespalib::string bar("bar"); -const vespalib::string doc_type_name = "test"; -const vespalib::string header_name = doc_type_name + ".header"; -const vespalib::string body_name = doc_type_name + ".body"; +const std::string SPANTREE_NAME("linguistics"); +const std::string title("title"); +const std::string body("body"); +const std::string foo("foo"); +const std::string bar("bar"); +const std::string doc_type_name = "test"; +const std::string header_name = doc_type_name + ".header"; +const std::string body_name = doc_type_name + ".body"; uint32_t docid_limit = 100; // needed for relative estimates Schema @@ -104,7 +104,7 @@ tokenizeStringFieldValue(const document::FixedTypeRepo & repo, StringFieldValue auto spanList = std::make_unique(); SpanList *spans = spanList.get(); auto spanTree = std::make_unique(SPANTREE_NAME, std::move(spanList)); - const vespalib::string &text = field.getValue(); + const std::string &text = field.getValue(); uint32_t cur = 0; int32_t start = 0; bool inWord = false; @@ -177,7 +177,7 @@ makeDoc(const DocumentTypeRepo &repo, uint32_t i) SimpleStringTerm makeTerm(std::string_view term) { - return SimpleStringTerm(vespalib::string(term), "field", 0, search::query::Weight(0)); + return SimpleStringTerm(std::string(term), "field", 0, search::query::Weight(0)); } Node::UP makePhrase(const std::string &term1, const std::string &term2) { diff --git a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp index 1c4b4b8d3ea8..6e70a1887936 100644 --- a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp +++ b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp @@ -83,7 +83,7 @@ LoadAttribute::printContent(const AttributePtr & ptr, std::ostream & os) } delete [] buf; } else { - vespalib::string *buf = new vespalib::string[ptr->getMaxValueCount()]; + std::string *buf = new std::string[ptr->getMaxValueCount()]; for (uint32_t doc = 0; doc < ptr->getNumDocs(); ++doc) { uint32_t valueCount = ptr->get(doc, buf, sz); assert(valueCount <= sz); @@ -146,10 +146,10 @@ LoadAttribute::main(int argc, char **argv) return -1; } - vespalib::string fileName(argv[optind]); + std::string fileName(argv[optind]); vespalib::FileHeader fh; { - vespalib::string datFileName(fileName + ".dat"); + std::string datFileName(fileName + ".dat"); Fast_BufferedFile file; file.ReadOpenExisting(datFileName.c_str()); (void) fh.readFile(file); @@ -172,7 +172,7 @@ LoadAttribute::main(int argc, char **argv) } if (doPrintContent) { - vespalib::string outFile(fileName + ".out"); + std::string outFile(fileName + ".out"); std::ofstream of(outFile.c_str()); if (of.fail()) { std::cout << "failed opening: " << fileName << ".out" << std::endl; @@ -183,7 +183,7 @@ LoadAttribute::main(int argc, char **argv) } if (doSave) { - vespalib::string saveFile = fileName + ".save"; + std::string saveFile = fileName + ".save"; std::cout << "saving attribute: " << saveFile << std::endl; timer = vespalib::Timer(); ptr->save(saveFile); diff --git a/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp b/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp index a86d09c45fce..c8aa7629ed49 100644 --- a/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp +++ b/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp @@ -14,7 +14,7 @@ using namespace vespalib; class Application { private: - vespalib::string _fileName; + std::string _fileName; char _delimiter; bool _quiet; @@ -22,9 +22,9 @@ class Application { void usage(const char *self); void printQuiet(FileHeader &header); void printVerbose(FileHeader &header); - vespalib::string escape(const vespalib::string &str, char quote = '\0'); - vespalib::string getTypeString(const FileHeader::Tag &tag); - vespalib::string getValueString(const FileHeader::Tag &tag); + std::string escape(const std::string &str, char quote = '\0'); + std::string getTypeString(const FileHeader::Tag &tag); + std::string getValueString(const FileHeader::Tag &tag); public: Application(); @@ -162,10 +162,10 @@ Application::printVerbose(FileHeader &header) std::cout << line.view() << std::endl; } -vespalib::string -Application::escape(const vespalib::string &str, char quote) +std::string +Application::escape(const std::string &str, char quote) { - vespalib::string ret = ""; + std::string ret = ""; for (uint32_t i = 0, len = str.size(); i < len; ++i) { char c = str[i]; switch (c) { @@ -191,7 +191,7 @@ Application::escape(const vespalib::string &str, char quote) return ret; } -vespalib::string +std::string Application::getTypeString(const FileHeader::Tag &tag) { switch (tag.getType()) { @@ -207,7 +207,7 @@ Application::getTypeString(const FileHeader::Tag &tag) } } -vespalib::string +std::string Application::getValueString(const FileHeader::Tag &tag) { vespalib::asciistream out; diff --git a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp index 60047565eaf7..f28ab10bf2a4 100644 --- a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp +++ b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp @@ -131,7 +131,7 @@ usageHeader() class FieldOptions { public: - std::vector _fields; + std::vector _fields; std::vector _ids; FieldOptions() @@ -141,7 +141,7 @@ class FieldOptions } ~FieldOptions(); - void addField(const vespalib::string &field) { _fields.push_back(field); } + void addField(const std::string &field) { _fields.push_back(field); } bool empty() const { return _ids.empty(); } void validateFields(const Schema &schema); }; @@ -176,9 +176,9 @@ class SubApp class ShowPostingListSubApp : public SubApp { - vespalib::string _indexDir; + std::string _indexDir; FieldOptions _fieldOptions; - vespalib::string _word; + std::string _word; bool _verbose; bool _readmmap; bool _directio; @@ -368,10 +368,10 @@ ShowPostingListSubApp::readWordList(const SchemaUtil::IndexIterator &index) search::TuneFileSeqRead tuneFileRead; PageDict4FileSeqRead wr; - vespalib::string fieldDir = _indexDir + "/" + index.getName(); + std::string fieldDir = _indexDir + "/" + index.getName(); if (!wr.open(fieldDir + "/dictionary", tuneFileRead)) return false; - vespalib::string word; + std::string word; PostingListCounts counts; uint64_t wordNum = noWordNum(); wr.readWord(word, wordNum, counts); @@ -420,7 +420,7 @@ ShowPostingListSubApp::readPostings(const SchemaUtil::IndexIterator &index, { FieldReader r; std::unique_ptr postingfile(new Zc4PosOccRandRead); - vespalib::string mangledName = _indexDir + "/" + index.getName() + + std::string mangledName = _indexDir + "/" + index.getName() + "/"; search::TuneFileSeqRead tuneFileRead; r.setup(_wmv[index.getIndex()], _dm); @@ -514,8 +514,8 @@ ShowPostingListSubApp::showPostingList() Schema schema; uint32_t numFields = 1; std::string schemaName = _indexDir + "/schema.txt"; - std::vector fieldNames; - vespalib::string shortName; + std::vector fieldNames; + std::string shortName; if (!schema.loadFromFile(schemaName)) { LOG(error, "Could not load schema from %s", schemaName.c_str()); @@ -773,7 +773,7 @@ DumpWordsSubApp::dumpWords() } SchemaUtil::IndexIterator index(schema, _fieldOptions._ids[0]); - vespalib::string fieldDir = _indexDir + "/" + index.getName(); + std::string fieldDir = _indexDir + "/" + index.getName(); PageDict4FileSeqRead wordList; std::string wordListName = fieldDir + "/dictionary"; search::TuneFileSeqRead tuneFileRead; @@ -782,7 +782,7 @@ DumpWordsSubApp::dumpWords() std::_Exit(1); } uint64_t wordNum = 0; - vespalib::string word; + std::string word; PostingListCounts counts; for (;;) { wordList.readWord(word, wordNum, counts); diff --git a/searchlib/src/apps/vespa-query-analyzer/vespa-query-analyzer.cpp b/searchlib/src/apps/vespa-query-analyzer/vespa-query-analyzer.cpp index b62a79352c9b..4d4529154147 100644 --- a/searchlib/src/apps/vespa-query-analyzer/vespa-query-analyzer.cpp +++ b/searchlib/src/apps/vespa-query-analyzer/vespa-query-analyzer.cpp @@ -36,7 +36,7 @@ int rel_diff(double a, double b, double e, double m) { return res; } -void apply_diff(vespalib::string &str, int diff, char small, char big, int len) { +void apply_diff(std::string &str, int diff, char small, char big, int len) { for (int i = 0; i < diff && i < len; ++i) { str += ((diff + i >= len * 2) ? big :small); } @@ -82,7 +82,7 @@ struct Matcher : vespalib::slime::ObjectTraverser { }; template Matcher::~Matcher() = default; -std::vector find_field(const Inspector &root, const vespalib::string &name) { +std::vector find_field(const Inspector &root, const std::string &name) { auto matcher = Matcher([&](const Path &path, const Inspector &){ return ((path.size() > 0) && (std::holds_alternative(path.back())) && @@ -92,7 +92,7 @@ std::vector find_field(const Inspector &root, const vespalib::string &name return matcher.result; } -std::vector find_tag(const Inspector &root, const vespalib::string &name) { +std::vector find_tag(const Inspector &root, const std::string &name) { auto matcher = Matcher([&](const Path &path, const Inspector &value){ return ((path.size() > 0) && (std::holds_alternative(path.back())) && @@ -103,9 +103,9 @@ std::vector find_tag(const Inspector &root, const vespalib::string &name) return matcher.result; } -vespalib::string path_to_str(const Path &path) { +std::string path_to_str(const Path &path) { size_t cnt = 0; - vespalib::string str("["); + std::string str("["); for (const auto &item: path) { if (cnt++ > 0) { str.append(","); @@ -118,11 +118,11 @@ vespalib::string path_to_str(const Path &path) { return str; } -vespalib::string strip_name(std::string_view name) { +std::string strip_name(std::string_view name) { auto end = name.find("<"); auto ns = name.rfind("::", end); size_t begin = (ns > name.size()) ? 0 : ns + 2; - return vespalib::string(name.substr(begin, end - begin)); + return std::string(name.substr(begin, end - begin)); } const Inspector &apply_path(const Inspector &node, const Path &path, size_t max = -1) { @@ -143,7 +143,7 @@ const Inspector &apply_path(const Inspector &node, const Path &path, size_t max return *ptr; } -void extract(vespalib::string &value, const Inspector &data) { +void extract(std::string &value, const Inspector &data) { if (data.valid() && data.type() == STRING()) { value = data.asString().make_stringview(); } @@ -197,7 +197,7 @@ struct Sample { self_time_ms = total_time_ms; } } - static vespalib::string type_to_str(Type type) { + static std::string type_to_str(Type type) { switch(type) { case Type::INVALID: return ""; case Type::INIT: return "init"; @@ -207,14 +207,14 @@ struct Sample { } abort(); } - static vespalib::string path_to_str(const std::vector &path) { - vespalib::string result("/"); + static std::string path_to_str(const std::vector &path) { + std::string result("/"); for (size_t elem: path) { result += fmt("%zu/", elem); } return result; } - vespalib::string to_string() const { + std::string to_string() const { return fmt("type: %s, path: %s, count: %zu, total_time_ms: %g\n", type_to_str(type).c_str(), path_to_str(path).c_str(), count, total_time_ms); } @@ -248,7 +248,7 @@ struct BlueprintMeta { self_cost_non_strict(self_cost_non_strict_in) {} ~MetaEntry(); }; - std::map map; + std::map map; BlueprintMeta() { map["AndNotBlueprint"] = MetaEntry{ [](InFlow in_flow)noexcept{ return AnyFlow::create(in_flow); } @@ -283,10 +283,10 @@ struct BlueprintMeta { [](double, size_t)noexcept{ return 1.0; } }; } - bool is_known(const vespalib::string &type) { + bool is_known(const std::string &type) { return map.find(type) != map.end(); } - const MetaEntry &lookup(const vespalib::string &type) { + const MetaEntry &lookup(const std::string &type) { return map.find(type)->second; } }; @@ -294,11 +294,11 @@ BlueprintMeta::MetaEntry::~MetaEntry() = default; BlueprintMeta blueprint_meta; struct Node { - vespalib::string type = "unknown"; + std::string type = "unknown"; uint32_t id = 0; uint32_t docid_limit = 0; - vespalib::string field_name; - vespalib::string query_term; + std::string field_name; + std::string query_term; bool strict = false; FlowStats flow_stats = FlowStats(0.0, 0.0, 0.0); size_t count = 0; @@ -352,8 +352,8 @@ struct Node { } Node(const Node &); ~Node(); - vespalib::string name() const { - vespalib::string res = type; + std::string name() const { + std::string res = type; if (id > 0) { res.append(fmt("[%u]", id)); } @@ -479,8 +479,8 @@ struct Node { node.ms_limit = time_limit; }); } - vespalib::string tingle() const { - vespalib::string res; + std::string tingle() const { + std::string res; if (total_time_ms > ms_limit) { apply_diff(res, rel_diff(est_seek, rel_count(), 1e-6, 0.50), 's', 'S', 3); apply_diff(res, rel_diff(ms_per_cost * est_cost, total_time_ms, 1e-3, 0.50), 't', 'T', 3); @@ -522,7 +522,7 @@ struct Node { fprintf(stdout, "| "); } static constexpr const char *pads[4] = {" ├─ "," │ "," └─ "," "}; - void print_line(const vespalib::string &prefix, const char *pad_self, const char *pad_child) const { + void print_line(const std::string &prefix, const char *pad_self, const char *pad_child) const { print_stats(); fprintf(stdout, "%s%s%s\n", prefix.c_str(), pad_self, name().c_str()); for (size_t i = 0; i < children.size(); ++i) { @@ -601,7 +601,7 @@ void usage(const char *self) { struct MyApp { Analyzer analyzer; - vespalib::string file_name; + std::string file_name; bool parse_params(int argc, char **argv); int main(); }; diff --git a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp index c5e885e350c5..04109b975d2a 100644 --- a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp +++ b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp @@ -24,9 +24,9 @@ using namespace search::features::rankingexpression; //----------------------------------------------------------------------------- -vespalib::string strip_name(const vespalib::string &name) { +std::string strip_name(const std::string &name) { const char *expected_ending = ".expression"; - vespalib::string tmp = name; + std::string tmp = name; size_t pos = tmp.rfind("/"); if (pos != tmp.npos) { tmp = tmp.substr(pos + 1); @@ -57,7 +57,7 @@ size_t count_nodes(const Node &node) { //----------------------------------------------------------------------------- struct InputInfo { - vespalib::string name; + std::string name; std::vector cmp_with; double usage_probability; double expected_usage; @@ -239,8 +239,8 @@ bool vmforest_used(const std::vector &forests) { struct State { using FunPtr = std::shared_ptr; - vespalib::string name; - vespalib::string expression; + std::string name; + std::string expression; FunPtr function; FunctionInfo fun_info; CompiledFunction::UP compiled_function; @@ -248,10 +248,10 @@ struct State { double llvm_compile_s = 0.0; double llvm_execute_us = 0.0; - std::vector options; + std::vector options; std::vector options_us; - State(const vespalib::string &file_name, vespalib::string expression_in); + State(const std::string &file_name, std::string expression_in); ~State(); void benchmark_llvm_compile() { @@ -265,7 +265,7 @@ struct State { llvm_compile_s = timer.min_time(); } - void benchmark_option(const vespalib::string &opt_name, Optimize::Chain optimizer_chain) { + void benchmark_option(const std::string &opt_name, Optimize::Chain optimizer_chain) { options.push_back(opt_name); options_us.push_back(CompiledFunction(*function, PassParams::ARRAY, optimizer_chain).estimate_cost_us(fun_info.params)); fprintf(stderr, " option '%s' execute time: %g us\n", opt_name.c_str(), options_us.back()); @@ -274,7 +274,7 @@ struct State { void maybe_benchmark_fast_forest() { auto ff = FastForest::try_convert(*function); if (ff) { - vespalib::string opt_name("ff"); + std::string opt_name("ff"); options.push_back(opt_name); options_us.push_back(ff->estimate_cost_us(fun_info.params)); fprintf(stderr, " option '%s' execute time: %g us\n", opt_name.c_str(), options_us.back()); @@ -311,7 +311,7 @@ struct State { } }; -State::State(const vespalib::string &file_name, vespalib::string expression_in) +State::State(const std::string &file_name, std::string expression_in) : name(strip_name(file_name)), expression(std::move(expression_in)), function(Function::parse(expression, FeatureNameExtractor())), @@ -348,7 +348,7 @@ MyApp::main(int argc, char **argv) if (!(verbose || (argc == 2))) { return usage(argv[0]); } - vespalib::string file_name(verbose ? argv[2] : argv[1]); + std::string file_name(verbose ? argv[2] : argv[1]); vespalib::MappedFileInput file(file_name); if (!file.valid()) { fprintf(stderr, "could not read input file: '%s'\n", @@ -357,7 +357,7 @@ MyApp::main(int argc, char **argv) } State state(file_name, file.get().make_string()); if (state.function->has_error()) { - vespalib::string error_message = state.function->get_error(); + std::string error_message = state.function->get_error(); fprintf(stderr, "input file (%s) contains an illegal expression:\n%s\n", file_name.c_str(), error_message.c_str()); return 1; diff --git a/searchlib/src/tests/attribute/attribute_header/attribute_header_test.cpp b/searchlib/src/tests/attribute/attribute_header/attribute_header_test.cpp index 0dd88d3b2448..c750827c2a0b 100644 --- a/searchlib/src/tests/attribute/attribute_header/attribute_header_test.cpp +++ b/searchlib/src/tests/attribute/attribute_header/attribute_header_test.cpp @@ -17,7 +17,7 @@ using HnswIPO = std::optional; using vespalib::eval::ValueType; const Config tensor_cfg(BasicType::TENSOR, CollectionType::SINGLE); -const vespalib::string file_name = "my_file_name"; +const std::string file_name = "my_file_name"; const ValueType tensor_type = ValueType::from_spec("tensor(x[4])"); constexpr uint32_t num_docs = 23; constexpr uint64_t unique_value_count = 11; diff --git a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp index 647b79d3fe7e..8c98c8097e1c 100644 --- a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp +++ b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp @@ -46,7 +46,7 @@ TEST("test illegal operations on float attribute") { } AttributeVector::SP -createAttribute(BasicType basicType, const vespalib::string &fieldName, bool fastSearch = false, bool immutable = false) +createAttribute(BasicType basicType, const std::string &fieldName, bool fastSearch = false, bool immutable = false) { constexpr size_t NUM_DOCS = 20; Config cfg(basicType, CollectionType::SINGLE); diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index 9cbf23e8b858..c40d49d1887a 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -38,7 +38,7 @@ using search::common::FileHeaderContext; using search::index::DummyFileHeaderContext; using search::attribute::BasicType; using search::attribute::IAttributeVector; -using vespalib::string; +using std::string; namespace fs = std::filesystem; namespace { @@ -109,7 +109,7 @@ statSize(const string &fileName) uint64_t statSize(const AttributeVector &a) { - vespalib::string baseFileName = a.getBaseFileName(); + std::string baseFileName = a.getBaseFileName(); uint64_t resultSize = statSize(baseFileName + ".dat"); if (a.hasMultiValue()) { resultSize += statSize(baseFileName + ".idx"); @@ -140,15 +140,15 @@ baseFileName(const string &attrName) } AttributeVector::SP -createAttribute(vespalib::string attrName, const search::attribute::Config &cfg) +createAttribute(std::string attrName, const search::attribute::Config &cfg) { return search::AttributeFactory::createAttribute(baseFileName(attrName), cfg); } -vespalib::string -replace_suffix(AttributeVector &v, const vespalib::string &suffix) +std::string +replace_suffix(AttributeVector &v, const std::string &suffix) { - vespalib::string name = v.getName(); + std::string name = v.getName(); if (name.size() >= suffix.size()) { name.resize(name.size() - suffix.size()); } @@ -289,7 +289,7 @@ class AttributeTest : public ::testing::Test void testPendingCompaction(); void testConditionalCommit(); - int test_paged_attribute(const vespalib::string& name, const vespalib::string& swapfile, const search::attribute::Config& cfg); + int test_paged_attribute(const std::string& name, const std::string& swapfile, const search::attribute::Config& cfg); void test_paged_attributes(); public: @@ -696,7 +696,7 @@ AttributeTest::testMemorySaver(const AttributePtr & a) auto b = createAttribute(replace_suffix(*a, "2ms"), a->getConfig()); AttributeMemorySaveTarget saveTarget; EXPECT_TRUE(a->save(saveTarget, b->getBaseFileName())); - vespalib::string datFile = vespalib::make_string("%s.dat", b->getBaseFileName().c_str()); + std::string datFile = vespalib::make_string("%s.dat", b->getBaseFileName().c_str()); EXPECT_FALSE(fs::exists(fs::path(datFile))); EXPECT_TRUE(saveTarget.writeToFile(TuneFileAttributes(), DummyFileHeaderContext())); EXPECT_TRUE(fs::exists(fs::path(datFile))); @@ -1977,13 +1977,13 @@ AttributeTest::testCompactLidSpace(const Config &config, { uint32_t highDocs = 100; uint32_t trimmedDocs = 30; - vespalib::string bts = config.basicType().asString(); - vespalib::string cts = config.collectionType().asString(); - vespalib::string fas = fast_search ? "-fs" : ""; + std::string bts = config.basicType().asString(); + std::string cts = config.collectionType().asString(); + std::string fas = fast_search ? "-fs" : ""; Config cfg = config; cfg.setFastSearch(fast_search); - vespalib::string name = clsDir + "/" + bts + "-" + cts + fas; + std::string name = clsDir + "/" + bts + "-" + cts + fas; LOG(info, "testCompactLidSpace(%s)", name.c_str()); AttributePtr attr = AttributeFactory::createAttribute(name, cfg); auto &v = static_cast(*attr.get()); @@ -2030,7 +2030,7 @@ AttributeTest::testCompactLidSpace(const Config &config) void AttributeTest::testCompactLidSpaceForPredicateAttribute(const Config &config) { - vespalib::string name = clsDir + "/predicate-single"; + std::string name = clsDir + "/predicate-single"; LOG(info, "testCompactLidSpace(%s)", name.c_str()); AttributePtr attr = AttributeFactory::createAttribute(name, config); attr->addDocs(10); @@ -2135,7 +2135,7 @@ AttributeTest::test_default_value_ref_count_is_updated_after_shrink_lid_space() { Config cfg(BasicType::INT32, CollectionType::SINGLE); cfg.setFastSearch(true); - vespalib::string name = "shrink"; + std::string name = "shrink"; AttributePtr attr = AttributeFactory::createAttribute(name, cfg); const auto & iattr = dynamic_cast &>(*attr); attr->addReservedDoc(); @@ -2153,7 +2153,7 @@ void AttributeTest::requireThatAddressSpaceUsageIsReported(const Config &config, bool fastSearch) { uint32_t numDocs = 10; - vespalib::string attrName = asuDir + "/" + config.basicType().asString() + "-" + + std::string attrName = asuDir + "/" + config.basicType().asString() + "-" + config.collectionType().asString() + (fastSearch ? "-fs" : ""); Config cfg = config; cfg.setFastSearch(fastSearch); @@ -2323,7 +2323,7 @@ AttributeTest::testConditionalCommit() { } int -AttributeTest::test_paged_attribute(const vespalib::string& name, const vespalib::string& swapfile, const search::attribute::Config& cfg) +AttributeTest::test_paged_attribute(const std::string& name, const std::string& swapfile, const search::attribute::Config& cfg) { int result = 1; size_t rounded_size = std::max(vespalib::round_up_to_page_size(1), size_t(vespalib::alloc::MmapFileAllocator::default_small_limit)); @@ -2385,7 +2385,7 @@ AttributeTest::test_paged_attribute(const vespalib::string& name, const vespalib void AttributeTest::test_paged_attributes() { - vespalib::string basedir("mmap-file-allocator-factory-dir"); + std::string basedir("mmap-file-allocator-factory-dir"); vespalib::alloc::MmapFileAllocatorFactory::instance().setup(basedir); search::attribute::Config cfg1(BasicType::INT32, CollectionType::SINGLE); cfg1.setPaged(true); @@ -2426,7 +2426,7 @@ void testNamePrefix() { class MyMultiValueAttribute : public ArrayStringAttribute { public: - MyMultiValueAttribute(const vespalib::string& name) + MyMultiValueAttribute(const std::string& name) : ArrayStringAttribute(name, Config(BasicType::STRING, CollectionType::ARRAY)) { } diff --git a/searchlib/src/tests/attribute/attributefilewriter/attributefilewriter_test.cpp b/searchlib/src/tests/attribute/attributefilewriter/attributefilewriter_test.cpp index 56117fdd17f0..6f96af80e27e 100644 --- a/searchlib/src/tests/attribute/attributefilewriter/attributefilewriter_test.cpp +++ b/searchlib/src/tests/attribute/attributefilewriter/attributefilewriter_test.cpp @@ -21,8 +21,8 @@ namespace search { namespace { -vespalib::string testFileName("test.dat"); -vespalib::string hello("Hello world"); +std::string testFileName("test.dat"); +std::string hello("Hello world"); void removeTestFile() { std::filesystem::remove(std::filesystem::path(testFileName)); } @@ -30,7 +30,7 @@ struct Fixture { TuneFileAttributes _tuneFileAttributes; DummyFileHeaderContext _fileHeaderContext; attribute::AttributeHeader _header; - const vespalib::string _desc; + const std::string _desc; AttributeFileWriter _writer; Fixture() diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 4ca01baacea9..1bfb55926a38 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -19,7 +19,7 @@ LOG_SETUP("attributebenchmark"); using std::shared_ptr; using NumVector = std::vector; -using StringVector = std::vector; +using StringVector = std::vector; using AttrConfig = search::attribute::Config; using search::attribute::BasicType; using search::attribute::CollectionType; @@ -34,7 +34,7 @@ class AttributeBenchmark private: class Config { public: - vespalib::string _attribute; + std::string _attribute; uint32_t _numDocs; uint32_t _numUpdates; uint32_t _numValues; @@ -110,7 +110,7 @@ class AttributeBenchmark void benchmarkUpdate(const AttributePtr & ptr, const std::vector & values, uint32_t id); template - std::vector prepareForPrefixSearch(const std::vector & values) const; + std::vector prepareForPrefixSearch(const std::vector & values) const; template void benchmarkSearch(const AttributePtr & ptr, const std::vector & values); template @@ -224,18 +224,18 @@ AttributeBenchmark::benchmarkUpdate(const AttributePtr & ptr, const std::vector< } template -std::vector +std::vector AttributeBenchmark::prepareForPrefixSearch(const std::vector & values) const { (void) values; - return std::vector(); + return std::vector(); } template <> -std::vector +std::vector AttributeBenchmark::prepareForPrefixSearch(const std::vector & values) const { - std::vector retval; + std::vector retval; retval.reserve(values.size()); for (size_t i = 0; i < values.size(); ++i) { retval.push_back(values[i].getValue().substr(0, _config._prefixLength)); @@ -252,7 +252,7 @@ AttributeBenchmark::benchmarkSearch(const AttributePtr & ptr, const std::vector< std::cout << "" << std::endl; - std::vector prefixStrings = prepareForPrefixSearch(values); + std::vector prefixStrings = prepareForPrefixSearch(values); for (uint32_t i = 0; i < _config._numSearchers; ++i) { if (_config._rangeSearch) { @@ -560,7 +560,7 @@ AttributeBenchmark::main(int argc, char **argv) return -1; } - dc._attribute = vespalib::string(argv[optind]); + dc._attribute = std::string(argv[optind]); std::cout << "" << std::endl; init(dc); diff --git a/searchlib/src/tests/attribute/benchmark/attributesearcher.h b/searchlib/src/tests/attribute/benchmark/attributesearcher.h index d1a9d059a27d..bda5c689ac77 100644 --- a/searchlib/src/tests/attribute/benchmark/attributesearcher.h +++ b/searchlib/src/tests/attribute/benchmark/attributesearcher.h @@ -79,13 +79,13 @@ class AttributeSearcher void start() { _thread = std::thread([this](){doRun();}); } void join() { _thread.join(); } AttributeSearcherStatus & getStatus() { return _status; } - void buildTermQuery(std::vector & buffer, const vespalib::string & index, const char * term, bool prefix = false); + void buildTermQuery(std::vector & buffer, const std::string & index, const char * term, bool prefix = false); }; AttributeSearcher::~AttributeSearcher() = default; void -AttributeSearcher::buildTermQuery(std::vector & buffer, const vespalib::string & index, const char * term, bool prefix) +AttributeSearcher::buildTermQuery(std::vector & buffer, const std::string & index, const char * term, bool prefix) { uint32_t indexLen = index.size(); uint32_t termLen = strlen(term); @@ -231,12 +231,12 @@ AttributeRangeSearcher::doRun() class AttributePrefixSearcher : public AttributeSearcher { private: - const std::vector & _values; + const std::vector & _values; std::vector _query; public: AttributePrefixSearcher(const AttributePtr & attrPtr, - const std::vector & values, uint32_t numQueries) : + const std::vector & values, uint32_t numQueries) : AttributeSearcher(attrPtr), _values(values), _query() { _status._numQueries = numQueries; diff --git a/searchlib/src/tests/attribute/benchmark/attributeupdater.h b/searchlib/src/tests/attribute/benchmark/attributeupdater.h index dc2c426d2b0b..709e33ea09da 100644 --- a/searchlib/src/tests/attribute/benchmark/attributeupdater.h +++ b/searchlib/src/tests/attribute/benchmark/attributeupdater.h @@ -20,7 +20,7 @@ class AttributeValidator public: AttributeValidator() : _totalCnt(0) {} uint32_t getTotalCnt() const { return _totalCnt; } - bool reportAssert(bool rc, const vespalib::string & file, uint32_t line, const vespalib::string & str) { + bool reportAssert(bool rc, const std::string & file, uint32_t line, const std::string & str) { _totalCnt++; if (!rc) { std::cout << "Assert " << _totalCnt << " failed: \"" << str << "\" (" @@ -30,8 +30,8 @@ class AttributeValidator return true; } template - bool reportAssertEqual(const vespalib::string & file, uint32_t line, - const vespalib::string & aStr, const vespalib::string & bStr, + bool reportAssertEqual(const std::string & file, uint32_t line, + const std::string & aStr, const std::string & bStr, const A & a, const B & b) { _totalCnt++; if (!(a == b)) { diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index 165af0c721c4..805b1c81ca0a 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -72,7 +72,7 @@ class BitVectorTest : public ::testing::TestWithParam void populateAll(VectorType &v, uint32_t low, uint32_t high, bool set); - void buildTermQuery(std::vector & buffer, const vespalib::string & index, const vespalib::string & term, bool prefix); + void buildTermQuery(std::vector & buffer, const std::string & index, const std::string & term, bool prefix); template - vespalib::string getSearchStr(); + std::string getSearchStr(); template SearchContextPtr getSearch(const V & vec, const T & term, bool prefix, bool useBitVector); @@ -114,7 +114,7 @@ class BitVectorTest : public ::testing::TestWithParam void - test(BasicType bt, CollectionType ct, const vespalib::string &pref, bool fastSearch, bool filter); + test(BasicType bt, CollectionType ct, const std::string &pref, bool fastSearch, bool filter); }; BitVectorTest::BitVectorTest() = default; @@ -154,8 +154,8 @@ BitVectorTest::asFloat(AttributePtr &v) void BitVectorTest::buildTermQuery(std::vector &buffer, - const vespalib::string &index, - const vespalib::string &term, + const std::string &index, + const std::string &term, bool prefix) { uint32_t indexLen = index.size(); @@ -175,21 +175,21 @@ BitVectorTest::buildTermQuery(std::vector &buffer, template <> -vespalib::string +std::string BitVectorTest::getSearchStr() { return "[-42;-42]"; } template <> -vespalib::string +std::string BitVectorTest::getSearchStr() { return "[-42.0;-42.0]"; } template <> -vespalib::string +std::string BitVectorTest::getSearchStr() { return "foo"; @@ -230,12 +230,12 @@ template <> SearchContextPtr BitVectorTest::getSearch(const StringAttribute &v, bool useBitVector) { - return getSearch(v, "foo", false, useBitVector); + return getSearch(v, "foo", false, useBitVector); } BitVectorTest::AttributePtr -BitVectorTest::make(Config cfg, const vespalib::string &pref, bool fastSearch, bool filter) +BitVectorTest::make(Config cfg, const std::string &pref, bool fastSearch, bool filter) { cfg.setFastSearch(fastSearch); cfg.setIsFilter(filter); @@ -435,7 +435,7 @@ BitVectorTest::checkSearch(AttributePtr v, template void -BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pref, bool fastSearch, bool filter) +BitVectorTest::test(BasicType bt, CollectionType ct, const std::string &pref, bool fastSearch, bool filter) { Config cfg(bt, ct); AttributePtr v = make(cfg, pref, fastSearch, filter); diff --git a/searchlib/src/tests/attribute/changevector/changevector_test.cpp b/searchlib/src/tests/attribute/changevector/changevector_test.cpp index fec689c9a10e..8f30ebd3ec8b 100644 --- a/searchlib/src/tests/attribute/changevector/changevector_test.cpp +++ b/searchlib/src/tests/attribute/changevector/changevector_test.cpp @@ -124,7 +124,7 @@ TEST("require that buffer can grow some, but not unbound") { TEST("Control Change size") { EXPECT_EQUAL(32u, sizeof(ChangeTemplate>)); - EXPECT_EQUAL(16u + sizeof(vespalib::string), sizeof(ChangeTemplate)); + EXPECT_EQUAL(16u + sizeof(std::string), sizeof(ChangeTemplate)); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp index 7c7486906f21..0bc23bf7fefc 100644 --- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp @@ -148,7 +148,7 @@ class Fixture { void hammer(DocIdRange range, uint32_t count) { hammerAttribute(_v, range, count); } void clean(DocIdRange range) { cleanAttribute(*_v, range); } AttributeStatus getStatus() { _v->commit(true); return _v->getStatus(); } - AttributeStatus getStatus(const vespalib::string &prefix) { + AttributeStatus getStatus(const std::string &prefix) { AttributeStatus status(getStatus()); LOG(info, "status %s: allocated=%" PRIu64 ", used=%" PRIu64 ", dead=%" PRIu64 ", onHold=%" PRIu64 ", waste=%f", prefix.c_str(), status.getAllocated(), status.getUsed(), status.getDead(), status.getOnHold(), @@ -157,7 +157,7 @@ class Fixture { } const Config &getConfig() const { return _v->getConfig(); } AddressSpace getMultiValueAddressSpaceUsage() const {return _v->getAddressSpaceUsage().multi_value_usage(); } - AddressSpace getMultiValueAddressSpaceUsage(const vespalib::string &prefix) { + AddressSpace getMultiValueAddressSpaceUsage(const std::string &prefix) { AddressSpace usage(getMultiValueAddressSpaceUsage()); LOG(info, "address space usage %s: used=%zu, dead=%zu, limit=%zu, usage=%12.8f", prefix.c_str(), usage.used(), usage.dead(), usage.limit(), usage.usage()); diff --git a/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp b/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp index 1f4082b908b5..0d3ce56eff63 100644 --- a/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp +++ b/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp @@ -214,10 +214,10 @@ dfa_fuzzy_match_in_dictionary_no_skip(std::string_view target, const StringEnumS struct TestParam { - vespalib::string _name; + std::string _name; bool _cased; - TestParam(vespalib::string name, bool cased) + TestParam(std::string name, bool cased) : _name(std::move(name)), _cased(cased) { diff --git a/searchlib/src/tests/attribute/direct_multi_term_blueprint/direct_multi_term_blueprint_test.cpp b/searchlib/src/tests/attribute/direct_multi_term_blueprint/direct_multi_term_blueprint_test.cpp index 735b566e675d..3734e91e7c2e 100644 --- a/searchlib/src/tests/attribute/direct_multi_term_blueprint/direct_multi_term_blueprint_test.cpp +++ b/searchlib/src/tests/attribute/direct_multi_term_blueprint/direct_multi_term_blueprint_test.cpp @@ -26,20 +26,20 @@ using LookupKey = IDirectPostingStore::LookupKey; struct IntegerKey : public LookupKey { int64_t _value; IntegerKey(int64_t value_in) : _value(value_in) {} - IntegerKey(const vespalib::string&) : _value() { abort(); } + IntegerKey(const std::string&) : _value() { abort(); } std::string_view asString() const override { abort(); } bool asInteger(int64_t& value) const override { value = _value; return true; } }; struct StringKey : public LookupKey { - vespalib::string _value; + std::string _value; StringKey(int64_t value_in) : _value(std::to_string(value_in)) {} - StringKey(const vespalib::string& value_in) : _value(value_in) {} + StringKey(const std::string& value_in) : _value(value_in) {} std::string_view asString() const override { return _value; } bool asInteger(int64_t&) const override { abort(); } }; -const vespalib::string field_name = "test"; +const std::string field_name = "test"; constexpr uint32_t field_id = 3; uint32_t doc_id_limit = 500; @@ -98,7 +98,7 @@ make_attribute(CollectionType col_type, BasicType type, bool field_is_filter) uint32_t num_docs = doc_id_limit - 1; auto attr = test::AttributeBuilder(field_name, cfg).docs(num_docs).get(); if (type == BasicType::STRING) { - populate_attribute(dynamic_cast(*attr), + populate_attribute(dynamic_cast(*attr), {"1", "3", "100", "300", "foo", "Foo"}); } else { populate_attribute(dynamic_cast(*attr), @@ -162,9 +162,9 @@ using MultiInBlueprintType = DirectMultiTermBlueprint; using MultiWSetBlueprintType = DirectMultiTermBlueprint; -vespalib::string iterator_unpack_docid_and_weights = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)0"; -vespalib::string iterator_unpack_docid = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)1"; -vespalib::string iterator_unpack_none = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)2"; +std::string iterator_unpack_docid_and_weights = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)0"; +std::string iterator_unpack_docid = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)1"; +std::string iterator_unpack_none = "search::queryeval::WeightedSetTermSearchImpl<(search::queryeval::UnpackType)2"; class DirectMultiTermBlueprintTest : public ::testing::TestWithParam { public: @@ -257,7 +257,7 @@ class DirectMultiTermBlueprintTest : public ::testing::TestWithParam add_term(value); } } - void add_terms(const std::vector& term_values) { + void add_terms(const std::vector& term_values) { for (auto value : term_values) { add_term(value); } @@ -266,7 +266,7 @@ class DirectMultiTermBlueprintTest : public ::testing::TestWithParam blueprint->basic_plan(strict, doc_id_limit); return blueprint->createLeafSearch(tfmda); } - vespalib::string resolve_iterator_with_unpack() const { + std::string resolve_iterator_with_unpack() const { if (in_operator) { return iterator_unpack_docid; } @@ -291,7 +291,7 @@ expect_or_iterator(SearchIterator& itr, size_t exp_children) } void -expect_or_child(SearchIterator& itr, size_t child, const vespalib::string& exp_child_itr) +expect_or_child(SearchIterator& itr, size_t child, const std::string& exp_child_itr) { auto& real = dynamic_cast(itr); EXPECT_THAT(real.getChildren()[child]->asString(), StartsWith(exp_child_itr)); diff --git a/searchlib/src/tests/attribute/direct_posting_store/direct_posting_store_test.cpp b/searchlib/src/tests/attribute/direct_posting_store/direct_posting_store_test.cpp index 2ddd211bd121..07cfbc28121f 100644 --- a/searchlib/src/tests/attribute/direct_posting_store/direct_posting_store_test.cpp +++ b/searchlib/src/tests/attribute/direct_posting_store/direct_posting_store_test.cpp @@ -190,7 +190,7 @@ TEST_P(DirectPostingStoreTest, lookup_works_correctly) { } template -void verify_posting(const IDirectPostingStore& api, const vespalib::string& term) { +void verify_posting(const IDirectPostingStore& api, const std::string& term) { auto result = api.lookup(term, api.get_dictionary_snapshot()); ASSERT_TRUE(result.posting_idx.valid()); std::vector itr_store; @@ -242,10 +242,10 @@ TEST_P(DirectPostingStoreTest, collect_folded_works) attr->commit(); auto snapshot = api->get_dictionary_snapshot(); auto lookup = api->lookup(GetParam().valid_term, snapshot); - std::vector folded; + std::vector folded; std::function save_folded = [&folded,sa](vespalib::datastore::EntryRef enum_idx) { folded.emplace_back(sa->getFromEnum(enum_idx.ref())); }; api->collect_folded(lookup.enum_idx, snapshot, save_folded); - std::vector expected_folded{"FOO", "foo"}; + std::vector expected_folded{"FOO", "foo"}; EXPECT_EQ(expected_folded, folded); } else { auto* ia = dynamic_cast*>(attr.get()); diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 072e7ffe86b8..bb1068d94a63 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -107,13 +107,13 @@ class MemAttr : public search::IAttributeSaveTarget } IAttributeFileWriter &udatWriter() override { return _udatWriter; } - bool setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) override { + bool setup_writer(const std::string& file_suffix, + const std::string& desc) override { (void) file_suffix; (void) desc; abort(); } - IAttributeFileWriter& get_writer(const vespalib::string& file_suffix) override { + IAttributeFileWriter& get_writer(const std::string& file_suffix) override { (void) file_suffix; abort(); } @@ -144,8 +144,8 @@ class EnumeratedSaveTest template void compare(VectorType &a, VectorType &b); - void buildTermQuery(std::vector & buffer, const vespalib::string & index, - const vespalib::string & term, bool prefix); + void buildTermQuery(std::vector & buffer, const std::string & index, + const std::string & term, bool prefix); template SearchContextPtr getSearch(const V & vec, const T & term, bool prefix); @@ -157,21 +157,21 @@ class EnumeratedSaveTest void saveMemDuringCompaction(AttributeVector &v); void checkMem(AttributeVector &v, const MemAttr &e); MemAttr::SP saveBoth(AttributePtr v); - AttributePtr make(Config cfg, const vespalib::string &pref, bool fastSearch = false); - void load(AttributePtr v, const vespalib::string &name); + AttributePtr make(Config cfg, const std::string &pref, bool fastSearch = false); + void load(AttributePtr v, const std::string &name); template - AttributePtr checkLoad(Config cfg, const vespalib::string &name, AttributePtr ev); + AttributePtr checkLoad(Config cfg, const std::string &name, AttributePtr ev); template void testReload(AttributePtr v0, AttributePtr v1, AttributePtr v2, MemAttr::SP mv0, MemAttr::SP mv1, MemAttr::SP mv2, MemAttr::SP emv0, MemAttr::SP emv1, MemAttr::SP emv2, - Config cfg, const vespalib::string &pref, bool fastSearch, search::DictionaryConfig dictionary_config); + Config cfg, const std::string &pref, bool fastSearch, search::DictionaryConfig dictionary_config); public: template - void test(BasicType bt, CollectionType ct, const vespalib::string &pref); + void test(BasicType bt, CollectionType ct, const std::string &pref); }; @@ -454,8 +454,8 @@ EnumeratedSaveTest::asFloat(AttributePtr &v) void EnumeratedSaveTest::buildTermQuery(std::vector &buffer, - const vespalib::string &index, - const vespalib::string &term, + const std::string &index, + const std::string &term, bool prefix) { uint32_t indexLen = index.size(); @@ -507,7 +507,7 @@ template <> SearchContextPtr EnumeratedSaveTest::getSearch(const StringAttribute &v) { - return getSearch + return getSearch (v, "foo", false); } @@ -567,7 +567,7 @@ MemAttr::SP EnumeratedSaveTest::saveBoth(AttributePtr v) { EXPECT_TRUE(v->save()); - vespalib::string basename = v->getBaseFileName(); + std::string basename = v->getBaseFileName(); AttributePtr v2 = make(v->getConfig(), basename, true); EXPECT_TRUE(v2->load()); EXPECT_TRUE(v2->save(basename + "_e")); @@ -583,7 +583,7 @@ EnumeratedSaveTest::saveBoth(AttributePtr v) EnumeratedSaveTest::AttributePtr -EnumeratedSaveTest::make(Config cfg, const vespalib::string &pref, bool fastSearch) +EnumeratedSaveTest::make(Config cfg, const std::string &pref, bool fastSearch) { cfg.setFastSearch(fastSearch); AttributePtr v = AttributeFactory::createAttribute(pref, cfg); @@ -592,7 +592,7 @@ EnumeratedSaveTest::make(Config cfg, const vespalib::string &pref, bool fastSear void -EnumeratedSaveTest::load(AttributePtr v, const vespalib::string &name) +EnumeratedSaveTest::load(AttributePtr v, const std::string &name) { v->setBaseFileName(name); EXPECT_TRUE(v->load()); @@ -600,7 +600,7 @@ EnumeratedSaveTest::load(AttributePtr v, const vespalib::string &name) template EnumeratedSaveTest::AttributePtr -EnumeratedSaveTest::checkLoad(Config cfg, const vespalib::string &name, +EnumeratedSaveTest::checkLoad(Config cfg, const std::string &name, AttributePtr ev) { AttributePtr v = AttributeFactory::createAttribute(name, cfg); @@ -622,7 +622,7 @@ EnumeratedSaveTest::testReload(AttributePtr v0, MemAttr::SP emv1, MemAttr::SP emv2, Config cfg, - const vespalib::string &pref, + const std::string &pref, bool fastSearch, search::DictionaryConfig dictionary_config) { @@ -690,7 +690,7 @@ EnumeratedSaveTest::testReload(AttributePtr v0, template void EnumeratedSaveTest::test(BasicType bt, CollectionType ct, - const vespalib::string &pref) + const std::string &pref) { Config cfg(bt, ct); AttributePtr v0 = AttributeFactory::createAttribute(pref + "0", cfg); @@ -902,7 +902,7 @@ TEST_F("Test enumerated save with weighted set value double", TEST_F("Test enumerated save with single value string", EnumeratedSaveTest) { f.template test(BasicType::STRING, + std::string>(BasicType::STRING, CollectionType::SINGLE, "str_sv"); } @@ -910,7 +910,7 @@ TEST_F("Test enumerated save with single value string", EnumeratedSaveTest) TEST_F("Test enumerated save with array value string", EnumeratedSaveTest) { f.template test(BasicType::STRING, + std::string>(BasicType::STRING, CollectionType::ARRAY, "str_a"); } diff --git a/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp b/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp index 264c2d8ab444..56cacc208567 100644 --- a/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp +++ b/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp @@ -37,8 +37,8 @@ std::vector as_vector(std::span value) { return {value.data(), value.data() + value.size()}; } -vespalib::string vec_2d_spec("tensor(x[2])"); -vespalib::string vec_mixed_2d_spec("tensor(a{},x[2])"); +std::string vec_2d_spec("tensor(x[2])"); +std::string vec_mixed_2d_spec("tensor(a{},x[2])"); TensorSpec vec_2d(double x0, double x1) @@ -53,7 +53,7 @@ vec_mixed_2d(std::vector> val) for (uint32_t a = 0; a < val.size(); ++a) { vespalib::asciistream a_stream; a_stream << a; - vespalib::string a_as_string = a_stream.str(); + std::string a_as_string = a_stream.str(); for (uint32_t x = 0; x < val[a].size(); ++x) { spec.add({{"a", a_as_string.c_str()},{"x", x}}, val[a][x]); } diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp index 0f91a69f27f9..295b8136f77f 100644 --- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp +++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp @@ -311,7 +311,7 @@ void verify_get_string_from_enum_is_mapped(FixtureType& f) { ASSERT_TRUE(f.target_attr->findEnum("foo", handle)); const char* from_enum = f.get_imported_attr()->getStringFromEnum(handle); ASSERT_TRUE(from_enum != nullptr); - EXPECT_EQUAL(vespalib::string("foo"), vespalib::string(from_enum)); + EXPECT_EQUAL(std::string("foo"), std::string(from_enum)); } TEST_F("Single-value getStringFromEnum() returns string enum is mapped to", SingleStringAttrFixture) { diff --git a/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp b/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp index 7f51ef9bb0b9..53ee0fb5a911 100644 --- a/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp +++ b/searchlib/src/tests/attribute/multi_value_read_view/multi_value_read_view_test.cpp @@ -30,8 +30,8 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:music::1"); -vespalib::string doc2("id:test:music::2"); +std::string doc1("id:test:music::1"); +std::string doc2("id:test:music::2"); struct MyGidToLidMapperFactory : public MockGidToLidMapperFactory { @@ -63,7 +63,7 @@ MockDocumentMetaStoreContext::getReadGuard() const std::shared_ptr -create_reference_attribute(const vespalib::string &name, const std::shared_ptr gid_to_lid_mapper_factory) +create_reference_attribute(const std::string &name, const std::shared_ptr gid_to_lid_mapper_factory) { auto attr = std::make_shared(name, Config(BasicType::REFERENCE)); attr->addReservedDoc(); @@ -319,7 +319,7 @@ MultiValueReadViewTest::make_imported_attribute(std::shared_ptr std::shared_ptr MultiValueReadViewTest::make_extendable_attribute(CollectionType collection_type) { - vespalib::string name("attr"); + std::string name("attr"); // Match strategy in streaming visitor switch (collection_type.type()) { case CollectionType::Type::ARRAY: diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index d4cdebd1e426..5682aa76de7c 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -27,7 +27,7 @@ LOG_SETUP("postinglistattribute_test"); namespace { -vespalib::string tmp_dir("tmp"); +std::string tmp_dir("tmp"); } @@ -118,7 +118,7 @@ class PostingListAttributeTest : public ::testing::Test IntegerAttribute & asInt(AttributePtr &v); StringAttribute & asString(AttributePtr &v); - void buildTermQuery(std::vector & buffer, const vespalib::string & index, const vespalib::string & term, bool prefix); + void buildTermQuery(std::vector & buffer, const std::string & index, const std::string & term, bool prefix); template SearchContextPtr getSearch(const V & vec, const T & term, bool prefix, const attribute::SearchContextParams & params=attribute::SearchContextParams()); @@ -302,8 +302,8 @@ PostingListAttributeTest::asString(AttributePtr &v) void PostingListAttributeTest::buildTermQuery(std::vector &buffer, - const vespalib::string &index, - const vespalib::string &term, + const std::string &index, + const std::string &term, bool prefix) { uint32_t indexLen = index.size(); @@ -347,7 +347,7 @@ template <> SearchContextPtr PostingListAttributeTest::getSearch(const StringAttribute &v) { - return getSearch(v, "foo", false); + return getSearch(v, "foo", false); } @@ -363,7 +363,7 @@ template <> SearchContextPtr PostingListAttributeTest::getSearch2(const StringAttribute &v) { - return getSearch(v, "bar", false); + return getSearch(v, "bar", false); } @@ -656,7 +656,7 @@ PostingListAttributeTest::testPostingList(bool enable_only_bitvector, uint32_t n } { // StringAttribute - std::vector values; + std::vector values; std::vector charValues; values.reserve(numUniqueValues); charValues.reserve(numUniqueValues); @@ -890,12 +890,12 @@ PostingListAttributeTest::testReload() { AttributePtr ptr1 = create_attribute("sstr_1", cfg); AttributePtr ptr2 = create_attribute("sstr_2", cfg); - testReload(ptr1, ptr2, "unique"); + testReload(ptr1, ptr2, "unique"); } { AttributePtr ptr1 = create_attribute("sstr_1", cfg); AttributePtr ptr2 = create_attribute("sstr_2", cfg); - testReload(ptr1, ptr2, ""); + testReload(ptr1, ptr2, ""); } } } diff --git a/searchlib/src/tests/attribute/predicate_attribute/predicate_attribute_test.cpp b/searchlib/src/tests/attribute/predicate_attribute/predicate_attribute_test.cpp index e560806979f3..91892864f8a2 100644 --- a/searchlib/src/tests/attribute/predicate_attribute/predicate_attribute_test.cpp +++ b/searchlib/src/tests/attribute/predicate_attribute/predicate_attribute_test.cpp @@ -89,7 +89,7 @@ make_sample_predicate_attribute() } void -corrupt_file_header(const vespalib::string &name) +corrupt_file_header(const std::string &name) { vespalib::FileHeader h(FileSettings::DIRECTIO_ALIGNMENT); FastOS_File f; diff --git a/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp b/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp index ec2124af9463..84516c34e7ce 100644 --- a/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp +++ b/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp @@ -20,7 +20,7 @@ using search::attribute::SingleRawAttribute; using namespace std::literals; std::vector empty; -vespalib::string hello("hello"); +std::string hello("hello"); std::span raw_hello(hello.c_str(), hello.size()); std::filesystem::path attr_path("raw.dat"); @@ -90,7 +90,7 @@ TEST_F(RawAttributeTest, can_set_and_clear_value) TEST_F(RawAttributeTest, implements_serialize_for_sort) { std::vector escapes{1, 0, char(0xff), char(0xfe), 1}; - vespalib::string long_hello("hello, is there anybody out there"); + std::string long_hello("hello, is there anybody out there"); std::span raw_long_hello(long_hello.c_str(), long_hello.size()); uint8_t buf[8]; memset(buf, 0, sizeof(buf)); diff --git a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp index 1fb413555118..f4cde68514ea 100644 --- a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp +++ b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp @@ -43,9 +43,9 @@ GlobalId toGid(std::string_view docId) { return DocumentId(docId).getGlobalId(); } -vespalib::string doc1("id:test:music::1"); -vespalib::string doc2("id:test:music::2"); -vespalib::string doc3("id:test:music::3"); +std::string doc1("id:test:music::1"); +std::string doc2("id:test:music::2"); +std::string doc3("id:test:music::3"); } diff --git a/searchlib/src/tests/attribute/save_target/attribute_save_target_test.cpp b/searchlib/src/tests/attribute/save_target/attribute_save_target_test.cpp index 741333260543..c73fdc38a611 100644 --- a/searchlib/src/tests/attribute/save_target/attribute_save_target_test.cpp +++ b/searchlib/src/tests/attribute/save_target/attribute_save_target_test.cpp @@ -19,7 +19,7 @@ using namespace search::attribute; using search::index::DummyFileHeaderContext; using search::test::DirectoryHandler; -const vespalib::string test_dir = "test_data/"; +const std::string test_dir = "test_data/"; class SaveTargetTest : public ::testing::Test { public: @@ -27,7 +27,7 @@ class SaveTargetTest : public ::testing::Test { TuneFileAttributes tune_file; DummyFileHeaderContext file_header_ctx; IAttributeSaveTarget& target; - vespalib::string base_file_name; + std::string base_file_name; SaveTargetTest(IAttributeSaveTarget& target_in) : dir_handler(test_dir), @@ -38,28 +38,28 @@ class SaveTargetTest : public ::testing::Test { { } ~SaveTargetTest() {} - void set_header(const vespalib::string& file_name) { + void set_header(const std::string& file_name) { target.setHeader(AttributeHeader(file_name)); } - IAttributeFileWriter& setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) { + IAttributeFileWriter& setup_writer(const std::string& file_suffix, + const std::string& desc) { bool res = target.setup_writer(file_suffix, desc); assert(res); return target.get_writer(file_suffix); } - void setup_writer_and_fill(const vespalib::string& file_suffix, - const vespalib::string& desc, + void setup_writer_and_fill(const std::string& file_suffix, + const std::string& desc, int value) { auto& writer = setup_writer(file_suffix, desc); auto buf = writer.allocBufferWriter(); buf->write(&value, sizeof(int)); buf->flush(); } - void validate_loaded_file(const vespalib::string& file_suffix, - const vespalib::string& exp_desc, + void validate_loaded_file(const std::string& file_suffix, + const std::string& exp_desc, int exp_value) { - vespalib::string file_name = base_file_name + "." + file_suffix; + std::string file_name = base_file_name + "." + file_suffix; EXPECT_TRUE(std::filesystem::exists(std::filesystem::path(file_name))); auto loaded = FileUtil::loadFile(file_name); EXPECT_FALSE(loaded->empty()); diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index 6008519442b0..0733d8a04e78 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -68,7 +68,7 @@ using search::queryeval::ParallelWeakAndSearch; using search::queryeval::PostingInfo; using search::queryeval::SearchIterator; using std::vector; -using vespalib::string; +using std::string; using vespalib::make_string; using namespace search::attribute; using namespace search; @@ -153,7 +153,7 @@ struct Result { int64_t wand_initial_threshold; double wand_boost_factor; std::vector hits; - vespalib::string iterator_dump; + std::string iterator_dump; Result(size_t est_hits_in, bool est_empty_in); ~Result(); @@ -394,9 +394,9 @@ TEST("require that optimized location search works with wrapped bounding box (no EXPECT_EQUAL(1u, result1.hits.size()); EXPECT_EQUAL(0u, result2.hits.size()); EXPECT_EQUAL(0u, result3.hits.size()); - EXPECT_TRUE(result1.iterator_dump.find("LocationPreFilterIterator") != vespalib::string::npos); - EXPECT_TRUE(result2.iterator_dump.find("EmptySearch") != vespalib::string::npos); - EXPECT_TRUE(result3.iterator_dump.find("EmptySearch") != vespalib::string::npos); + EXPECT_TRUE(result1.iterator_dump.find("LocationPreFilterIterator") != std::string::npos); + EXPECT_TRUE(result2.iterator_dump.find("EmptySearch") != std::string::npos); + EXPECT_TRUE(result3.iterator_dump.find("EmptySearch") != std::string::npos); } void set_weights(StringAttribute *attr, uint32_t docid, @@ -485,8 +485,8 @@ TEST("require that single weighted set turns filter on filter fields") { SimpleStringTerm node("foo", "", 0, Weight(1)); Result result = do_search(attribute_manager, node, strict); EXPECT_EQUAL(3u, result.est_hits); - EXPECT_TRUE(result.iterator_dump.find("DocidWithWeightSearchIterator") == vespalib::string::npos); - EXPECT_TRUE(result.iterator_dump.find("FilterAttributePostingListIteratorT") != vespalib::string::npos); + EXPECT_TRUE(result.iterator_dump.find("DocidWithWeightSearchIterator") == std::string::npos); + EXPECT_TRUE(result.iterator_dump.find("FilterAttributePostingListIteratorT") != std::string::npos); ASSERT_EQUAL(3u, result.hits.size()); EXPECT_FALSE(result.est_empty); EXPECT_EQUAL(20u, result.hits[0].docid); @@ -515,7 +515,7 @@ TEST("require that attribute parallel wand works") { EXPECT_EQUAL(num_docs * 3, result.est_hits); } if (EXPECT_EQUAL(2u, result.hits.size())) { - if (result.iterator_dump.find("MonitoringDumpIterator") == vespalib::string::npos) { + if (result.iterator_dump.find("MonitoringDumpIterator") == std::string::npos) { EXPECT_EQUAL(10u, result.wand_hits); EXPECT_EQUAL(500, result.wand_initial_threshold); EXPECT_EQUAL(1.5, result.wand_boost_factor); @@ -545,9 +545,9 @@ TEST("require that attribute weighted set term works") { Result result = do_search(attribute_manager, node, strict); EXPECT_FALSE(result.est_empty); ASSERT_EQUAL(5u, result.hits.size()); - if (fast_search && result.iterator_dump.find("MonitoringDumpIterator") == vespalib::string::npos) { + if (fast_search && result.iterator_dump.find("MonitoringDumpIterator") == std::string::npos) { fprintf(stderr, "DUMP: %s\n", result.iterator_dump.c_str()); - EXPECT_TRUE(result.iterator_dump.find("PostingIteratorPack") != vespalib::string::npos); + EXPECT_TRUE(result.iterator_dump.find("PostingIteratorPack") != std::string::npos); } EXPECT_EQUAL(10u, result.hits[0].docid); EXPECT_EQUAL(20, result.hits[0].match_weight); @@ -576,9 +576,9 @@ TEST("require that attribute in term works") { Result result = do_search(attribute_manager, node, strict); EXPECT_FALSE(result.est_empty); ASSERT_EQUAL(5u, result.hits.size()); - if (fast_search && result.iterator_dump.find("MonitoringDumpIterator") == vespalib::string::npos) { + if (fast_search && result.iterator_dump.find("MonitoringDumpIterator") == std::string::npos) { fprintf(stderr, "DUMP: %s\n", result.iterator_dump.c_str()); - EXPECT_TRUE(result.iterator_dump.find("PostingIteratorPack") != vespalib::string::npos); + EXPECT_TRUE(result.iterator_dump.find("PostingIteratorPack") != std::string::npos); } EXPECT_EQUAL(10u, result.hits[0].docid); EXPECT_EQUAL(1, result.hits[0].match_weight); @@ -651,7 +651,7 @@ void set_attr_value(AttributeVector &attr, uint32_t docid, size_t value) { float_attr->commit(); } else if (string_attr != nullptr) { ASSERT_LESS(value, size_t(27*26 + 26)); - vespalib::string str; + std::string str; str.push_back('a' + value / 27); str.push_back('a' + value % 27); string_attr->update(docid, str); @@ -681,13 +681,13 @@ MyAttributeManager make_diversity_setup(BasicType::Type field_type, bool field_f return attribute_manager; } -size_t diversity_hits(IAttributeManager &manager, const vespalib::string &term, bool strict) { +size_t diversity_hits(IAttributeManager &manager, const std::string &term, bool strict) { SimpleRangeTerm node(term, "", 0, Weight(1)); Result result = do_search(manager, node, strict); return result.hits.size(); } -std::pair diversity_docid_range(IAttributeManager &manager, const vespalib::string &term, bool strict) { +std::pair diversity_docid_range(IAttributeManager &manager, const std::string &term, bool strict) { SimpleRangeTerm node(term, "", 0, Weight(1)); Result result = do_search(manager, node, strict); std::pair range(0, 0); diff --git a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp index ea18960c8ff3..d85a7918b4ff 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 25d045bc8e4e..ebb2bdd366ef 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -155,7 +155,7 @@ downcast(ParentType& parent) } AttributeVector::SP -make_string_attribute(std::initializer_list values) +make_string_attribute(std::initializer_list values) { Config cfg(BasicType::STRING, CollectionType::SINGLE); return AttributeBuilder(field, cfg).fill(values).get(); @@ -168,7 +168,7 @@ make_string_attribute(const std::string& value) } AttributeVector::SP -make_wset_string_attribute(std::initializer_list> values) +make_wset_string_attribute(std::initializer_list> values) { Config cfg(BasicType::STRING, CollectionType::WSET); // fast-search is needed to trigger use of DirectAttributeBlueprint. @@ -276,7 +276,7 @@ TEST(AttributeBlueprintTest, require_that_fast_search_location_terms_work) } AttributeVector::SP -make_tensor_attribute(const vespalib::string& name, const vespalib::string& tensor_spec) +make_tensor_attribute(const std::string& name, const std::string& tensor_spec) { Config cfg(BasicType::TENSOR, CollectionType::SINGLE); cfg.setTensorType(ValueType::from_spec(tensor_spec)); @@ -284,7 +284,7 @@ make_tensor_attribute(const vespalib::string& name, const vespalib::string& tens } AttributeVector::SP -make_int_attribute(const vespalib::string& name) +make_int_attribute(const std::string& name) { Config cfg(BasicType::INT32, CollectionType::SINGLE); return AttributeFactory::createAttribute(name, cfg); @@ -296,7 +296,7 @@ class BlueprintFactoryFixture { public: AttributeVector::SP attr; MyAttributeManager mgr; - vespalib::string attr_name; + std::string attr_name; AttributeContext attr_ctx; FakeRequestContext request_ctx; AttributeBlueprintFactory source; @@ -354,7 +354,7 @@ class NearestNeighborFixture : public BlueprintFactoryFixture { }; void -expect_nearest_neighbor_blueprint(const vespalib::string& attribute_tensor_type_spec, +expect_nearest_neighbor_blueprint(const std::string& attribute_tensor_type_spec, const TensorSpec& query_tensor, const TensorSpec& converted_query_tensor) { diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 14c4a738debb..9d2b467b00bb 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -154,7 +154,7 @@ class SearchContextTest : public ::testing::Test template static SearchContextPtr getSearch(const V & vec, const T & term, TermType termType=TermType::WORD); protected: - using ConfigMap = std::map; + using ConfigMap = std::map; // Map of all config objects ConfigMap _integerCfg; ConfigMap _floatCfg; @@ -171,7 +171,7 @@ class SearchContextTest : public ::testing::Test void fillPostingList(PostingList & pl, const DocRange & range); template void fillPostingList(PostingList & pl); - static void buildTermQuery(std::vector & buffer, const vespalib::string & index, const vespalib::string & term, + static void buildTermQuery(std::vector & buffer, const std::string & index, const std::string & term, TermType termType=TermType::WORD); ResultSetPtr performSearch(SearchIterator & sb, uint32_t numDocs); @@ -180,14 +180,14 @@ class SearchContextTest : public ::testing::Test template ResultSetPtr performSearch(const queryeval::ExecuteInfo & executeInfo, const V & vec, const T & term, TermType termType); template - void performSearch(const V & vec, const vespalib::string & term, const DocSet & expected, TermType termType); + void performSearch(const V & vec, const std::string & term, const DocSet & expected, TermType termType); template - void performSearch(const queryeval::ExecuteInfo & executeInfo, const V & vec, const vespalib::string & term, + void performSearch(const queryeval::ExecuteInfo & executeInfo, const V & vec, const std::string & term, const DocSet & expected, TermType termType); void checkResultSet(const ResultSet & rs, const DocSet & exp, bool bitVector); template - void testSearchIterator(const std::vector & keys, const vespalib::string &keyAsString, const ConfigMap &cfgs); + void testSearchIterator(const std::vector & keys, const std::string &keyAsString, const ConfigMap &cfgs); // test search functionality template void testFind(const PostingList & first, bool verify_hit_estimate); @@ -236,8 +236,8 @@ class SearchContextTest : public ::testing::Test // test search iterator functionality void testStrictSearchIterator(SearchContext & threeHits, SearchContext & noHits, const IteratorTester & typeTester); void testNonStrictSearchIterator(SearchContext & threeHits, SearchContext & noHits, const IteratorTester & typeTester); - AttributePtr fillForSearchIteratorTest(const vespalib::string& name, const Config& cfg); - AttributePtr fillForSemiNibbleSearchIteratorTest(const vespalib::string& name, const Config& cfg); + AttributePtr fillForSearchIteratorTest(const std::string& name, const Config& cfg); + AttributePtr fillForSemiNibbleSearchIteratorTest(const std::string& name, const Config& cfg); // test search iterator unpacking @@ -254,44 +254,44 @@ class SearchContextTest : public ::testing::Test // test range search template - void performRangeSearch(const VectorType & vec, const vespalib::string & term, const DocSet & expected); + void performRangeSearch(const VectorType & vec, const std::string & term, const DocSet & expected); template void testRangeSearch(const AttributePtr & ptr, uint32_t numDocs, std::vector values); // test case insensitive search - void performCaseInsensitiveSearch(const StringAttribute & vec, const vespalib::string & term, const DocSet & expected); + void performCaseInsensitiveSearch(const StringAttribute & vec, const std::string & term, const DocSet & expected); void testCaseInsensitiveSearch(const AttributePtr & ptr); - void testRegexSearch(const vespalib::string& name, const Config& cfg); + void testRegexSearch(const std::string& name, const Config& cfg); // test prefix search - void testPrefixSearch(const vespalib::string& name, const Config& cfg); + void testPrefixSearch(const std::string& name, const Config& cfg); // test fuzzy search - void testFuzzySearch(const vespalib::string& name, const Config& cfg); + void testFuzzySearch(const std::string& name, const Config& cfg); // test that search is working after clear doc template - void requireThatSearchIsWorkingAfterClearDoc(const vespalib::string & name, const Config & cfg, - ValueType startValue, const vespalib::string & term); + void requireThatSearchIsWorkingAfterClearDoc(const std::string & name, const Config & cfg, + ValueType startValue, const std::string & term); // test that search is working after load and clear doc template - void requireThatSearchIsWorkingAfterLoadAndClearDoc(const vespalib::string & name, const Config & cfg, + void requireThatSearchIsWorkingAfterLoadAndClearDoc(const std::string & name, const Config & cfg, ValueType startValue, ValueType defaultValue, - const vespalib::string & term); + const std::string & term); template - void requireThatSearchIsWorkingAfterUpdates(const vespalib::string & name, const Config & cfg, + void requireThatSearchIsWorkingAfterUpdates(const std::string & name, const Config & cfg, ValueType value1, ValueType value2); template - void requireThatInvalidSearchTermGivesZeroHits(const vespalib::string & name, const Config & cfg, ValueType value); + void requireThatInvalidSearchTermGivesZeroHits(const std::string & name, const Config & cfg, ValueType value); - void requireThatOutOfBoundsSearchTermGivesZeroHits(const vespalib::string &name, const Config &cfg, int32_t maxValue); + void requireThatOutOfBoundsSearchTermGivesZeroHits(const std::string &name, const Config &cfg, int32_t maxValue); // init maps with config objects void initIntegerConfig(); @@ -336,7 +336,7 @@ SearchContextTest::fillVector(std::vector & values, size_t numValues) template <> void -SearchContextTest::fillVector(std::vector & values, size_t numValues) +SearchContextTest::fillVector(std::vector & values, size_t numValues) { values.clear(); values.reserve(numValues); @@ -410,7 +410,7 @@ SearchContextTest::fillPostingList(PostingList & pl) } void -SearchContextTest::buildTermQuery(std::vector & buffer, const vespalib::string & index, const vespalib::string & term, TermType termType) +SearchContextTest::buildTermQuery(std::vector & buffer, const std::string & index, const std::string & term, TermType termType) { uint32_t indexLen = index.size(); uint32_t termLen = term.size(); @@ -488,7 +488,7 @@ SearchContextTest::performSearch(const queryeval::ExecuteInfo & executeInfo, con template void -SearchContextTest::performSearch(const queryeval::ExecuteInfo & executeInfo, const V & vec, const vespalib::string & term, +SearchContextTest::performSearch(const queryeval::ExecuteInfo & executeInfo, const V & vec, const std::string & term, const DocSet & expected, TermType termType) { #if 0 @@ -503,7 +503,7 @@ SearchContextTest::performSearch(const queryeval::ExecuteInfo & executeInfo, con } template void -SearchContextTest::performSearch(const V & vec, const vespalib::string & term, +SearchContextTest::performSearch(const V & vec, const std::string & term, const DocSet & expected, TermType termType) { performSearch(queryeval::ExecuteInfo::FULL, vec, term, expected, termType); @@ -673,8 +673,8 @@ void SearchContextTest::testSearch(const ConfigMap & cfgs) { template class Verifier : public search::test::SearchIteratorVerifier { public: - Verifier(const std::vector & keys, const vespalib::string & keyAsString, - const vespalib::string & name, const Config & cfg); + Verifier(const std::vector & keys, const std::string & keyAsString, + const std::string & name, const Config & cfg); ~Verifier() override; SearchIterator::UP create(bool strict) const override { @@ -688,8 +688,8 @@ class Verifier : public search::test::SearchIteratorVerifier { }; template -Verifier::Verifier(const std::vector & keys, const vespalib::string & keyAsString, - const vespalib::string & name, const Config & cfg) +Verifier::Verifier(const std::vector & keys, const std::string & keyAsString, + const std::string & name, const Config & cfg) : _dummy(), _attribute(AttributeFactory::createAttribute(name + "-initrange", cfg)), _sc() @@ -709,7 +709,7 @@ template Verifier::~Verifier() = default; template -void SearchContextTest::testSearchIterator(const std::vector & keys, const vespalib::string &keyAsString, const ConfigMap &cfgs) { +void SearchContextTest::testSearchIterator(const std::vector & keys, const std::string &keyAsString, const ConfigMap &cfgs) { for (const auto & cfg : cfgs) { { Verifier verifier(keys, keyAsString, cfg.first, cfg.second); @@ -729,7 +729,7 @@ TEST_F(SearchContextTest, test_search_iterator_conformance) testSearchIterator({42,45,46}, "[0;100]", _integerCfg); testSearchIterator({42}, "42", _integerCfg); testSearchIterator({42.42}, "42.42", _floatCfg); - testSearchIterator({"any-key"}, "any-key", _stringCfg); + testSearchIterator({"any-key"}, "any-key", _stringCfg); } TEST_F(SearchContextTest, test_search) @@ -773,7 +773,7 @@ TEST_F(SearchContextTest, test_search) testSearch(_integerCfg); testSearch(_floatCfg); - testSearch(_stringCfg); + testSearch(_stringCfg); } //----------------------------------------------------------------------------- @@ -858,13 +858,13 @@ SearchContextTest::testNonStrictSearchIterator(SearchContext & threeHits, } AttributePtr -SearchContextTest::fillForSearchIteratorTest(const vespalib::string& name, const Config& cfg) +SearchContextTest::fillForSearchIteratorTest(const std::string& name, const Config& cfg) { return AttributeBuilder(name, cfg).fill({10, 20, 10, 20, 10}).get(); } AttributePtr -SearchContextTest::fillForSemiNibbleSearchIteratorTest(const vespalib::string& name, const Config& cfg) +SearchContextTest::fillForSemiNibbleSearchIteratorTest(const std::string& name, const Config& cfg) { return AttributeBuilder(name, cfg).fill({1, 2, 1, 2, 1}).get(); } @@ -1051,7 +1051,7 @@ SearchContextTest::testSearchIteratorUnpacking(const AttributePtr & attr, Search TEST_F(SearchContextTest, test_search_iterator_unpacking) { - std::vector > config; + std::vector > config; { Config cfg(BasicType::INT32, CollectionType::SINGLE); @@ -1072,7 +1072,7 @@ TEST_F(SearchContextTest, test_search_iterator_unpacking) { Config cfg(BasicType::INT32, CollectionType::SINGLE); cfg.setFastSearch(true); - config.emplace_back(vespalib::string("sfs-int32"), cfg); + config.emplace_back(std::string("sfs-int32"), cfg); } { Config cfg(BasicType::INT32, CollectionType::ARRAY); @@ -1116,7 +1116,7 @@ TEST_F(SearchContextTest, test_search_iterator_unpacking) template void -SearchContextTest::performRangeSearch(const VectorType & vec, const vespalib::string & term, const DocSet & expected) +SearchContextTest::performRangeSearch(const VectorType & vec, const std::string & term, const DocSet & expected) { for (size_t num_threads : {1,3}) { vespalib::SimpleThreadBundle thread_bundle(num_threads); @@ -1351,7 +1351,7 @@ TEST_F(SearchContextTest, test_range_search) //----------------------------------------------------------------------------- void -SearchContextTest::performCaseInsensitiveSearch(const StringAttribute & vec, const vespalib::string & term, +SearchContextTest::performCaseInsensitiveSearch(const StringAttribute & vec, const std::string & term, const DocSet & expected) { performSearch(vec, term, expected, TermType::WORD); @@ -1390,7 +1390,7 @@ SearchContextTest::testCaseInsensitiveSearch(const AttributePtr & ptr) for (uint32_t j = 0; j < 5; ++j) { for (uint32_t i = 0; i < 5; ++i) { EXPECT_EQ(ptr->get(doc++, buffer, 1), uint32_t(1)); - EXPECT_EQ(vespalib::string(buffer[0]), vespalib::string(terms[i][j])); + EXPECT_EQ(std::string(buffer[0]), std::string(terms[i][j])); } } @@ -1419,7 +1419,7 @@ SearchContextTest::testCaseInsensitiveSearch(const AttributePtr & ptr) } void -SearchContextTest::testRegexSearch(const vespalib::string& name, const Config& cfg) +SearchContextTest::testRegexSearch(const std::string& name, const Config& cfg) { LOG(info, "testRegexSearch: vector '%s'", name.c_str()); auto attr = AttributeBuilder(name, cfg). @@ -1459,7 +1459,7 @@ TEST_F(SearchContextTest, test_regex_search) //----------------------------------------------------------------------------- void -SearchContextTest::testPrefixSearch(const vespalib::string& name, const Config& cfg) +SearchContextTest::testPrefixSearch(const std::string& name, const Config& cfg) { LOG(info, "testPrefixSearch: vector '%s'", name.c_str()); auto attr = AttributeBuilder(name, cfg). @@ -1500,9 +1500,9 @@ SearchContextTest::testPrefixSearch(const vespalib::string& name, const Config& for (uint32_t i = 0; i < longrange_values; ++i) { vespalib::asciistream ss; ss << "lpref" << i; - vespalib::string sss(ss.view()); + std::string sss(ss.view()); exp_longrange.put(old_size + i); - vec.update(old_size + i, vespalib::string(ss.view()).c_str()); + vec.update(old_size + i, std::string(ss.view()).c_str()); } attr->commit(); performSearch(*attr, "lpref", exp_longrange, TermType::PREFIXTERM); @@ -1521,7 +1521,7 @@ TEST_F(SearchContextTest, test_prefix_search) //----------------------------------------------------------------------------- void -SearchContextTest::testFuzzySearch(const vespalib::string& name, const Config& cfg) +SearchContextTest::testFuzzySearch(const std::string& name, const Config& cfg) { LOG(info, "testFuzzySearch: vector '%s'", name.c_str()); auto attr = AttributeBuilder(name, cfg).fill({"fuzzysearch"s, "notthis"s, "FUZZYSEARCH"s}).get(); @@ -1554,10 +1554,10 @@ TEST_F(SearchContextTest, test_fuzzy_search) template void -SearchContextTest::requireThatSearchIsWorkingAfterClearDoc(const vespalib::string & name, +SearchContextTest::requireThatSearchIsWorkingAfterClearDoc(const std::string & name, const Config & cfg, ValueType startValue, - const vespalib::string & term) + const std::string & term) { AttributePtr a = AttributeFactory::createAttribute(name, cfg); LOG(info, "requireThatSearchIsWorkingAfterClearDoc: vector '%s', term '%s'", @@ -1607,11 +1607,11 @@ TEST_F(SearchContextTest, require_that_search_is_working_after_clear_doc) template void -SearchContextTest::requireThatSearchIsWorkingAfterLoadAndClearDoc(const vespalib::string & name, +SearchContextTest::requireThatSearchIsWorkingAfterLoadAndClearDoc(const std::string & name, const Config & cfg, ValueType startValue, ValueType defaultValue, - const vespalib::string & term) + const std::string & term) { AttributePtr a = AttributeFactory::createAttribute(name, cfg); LOG(info, "requireThatSearchIsWorkingAfterLoadAndClearDoc: vector '%s', term '%s'", @@ -1656,8 +1656,8 @@ TEST_F(SearchContextTest, require_that_search_is_working_after_load_and_clear_do value, defValue, "10"); } { - vespalib::string value = "foo"; - vespalib::string defValue = ""; + std::string value = "foo"; + std::string defValue = ""; requireThatSearchIsWorkingAfterLoadAndClearDoc("s-fs-str", _stringCfg["s-fs-str"], value, defValue, value); requireThatSearchIsWorkingAfterLoadAndClearDoc("a-fs-str", _stringCfg["a-fs-str"], @@ -1667,7 +1667,7 @@ TEST_F(SearchContextTest, require_that_search_is_working_after_load_and_clear_do template void -SearchContextTest::requireThatSearchIsWorkingAfterUpdates(const vespalib::string & name, +SearchContextTest::requireThatSearchIsWorkingAfterUpdates(const std::string & name, const Config & cfg, ValueType value1, ValueType value2) @@ -1768,7 +1768,7 @@ TEST_F(SearchContextTest, require_that_flag_attribute_is_working_when_new_docs_a template void -SearchContextTest::requireThatInvalidSearchTermGivesZeroHits(const vespalib::string & name, +SearchContextTest::requireThatInvalidSearchTermGivesZeroHits(const std::string & name, const Config & cfg, ValueType value) { @@ -1809,12 +1809,12 @@ TEST_F(SearchContextTest, require_that_flag_attribute_handles_the_byte_range) } void -SearchContextTest::requireThatOutOfBoundsSearchTermGivesZeroHits(const vespalib::string &name, +SearchContextTest::requireThatOutOfBoundsSearchTermGivesZeroHits(const std::string &name, const Config &cfg, int32_t maxValue) { auto a = AttributeBuilder(name, cfg).fill({maxValue}).get(); - vespalib::string term = vespalib::make_string("%" PRIu64 "", (int64_t) maxValue + 1); + std::string term = vespalib::make_string("%" PRIu64 "", (int64_t) maxValue + 1); LOG(info, "requireThatOutOfBoundsSearchTermGivesZeroHits: vector '%s', term '%s'", a->getName().c_str(), term.c_str()); ResultSetPtr rs = performSearch(*a, term); EXPECT_EQ(0u, rs->getNumHits()); diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp index b558c50488ad..5f9641db2d39 100644 --- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp +++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp @@ -44,9 +44,9 @@ addDocs(Attribute & vec, uint32_t numDocs) template void checkCount(Attribute & vec, uint32_t doc, uint32_t valueCount, - uint32_t numValues, const vespalib::string & value) + uint32_t numValues, const std::string & value) { - std::vector buffer(valueCount); + std::vector buffer(valueCount); EXPECT_TRUE(static_cast(vec.getValueCount(doc)) == valueCount); EXPECT_TRUE(vec.get(doc, buffer.data(), buffer.size()) == valueCount); EXPECT_TRUE(std::count(buffer.begin(), buffer.end(), value) == numValues); @@ -76,7 +76,7 @@ testMultiValue(Attribute & attr, uint32_t numDocs) EXPECT_TRUE(attr.getNumDocs() == 0); // generate two sets of unique strings - std::vector uniqueStrings; + std::vector uniqueStrings; uniqueStrings.reserve(numDocs - 1); for (uint32_t i = 0; i < numDocs - 1; ++i) { char unique[16]; @@ -85,7 +85,7 @@ testMultiValue(Attribute & attr, uint32_t numDocs) } ASSERT_TRUE(std::is_sorted(uniqueStrings.begin(), uniqueStrings.end())); - std::vector newUniques; + std::vector newUniques; newUniques.reserve(numDocs - 1); for (uint32_t i = 0; i < numDocs - 1; ++i) { char unique[16]; @@ -115,7 +115,7 @@ testMultiValue(Attribute & attr, uint32_t numDocs) EXPECT_TRUE(attr.get(doc) == nullptr); EXPECT_TRUE(attr.getEnum(doc) == std::numeric_limits::max()); } else if (!attr.hasWeightedSetType()) { - EXPECT_EQUAL(vespalib::string(attr.get(doc)), uniqueStrings[0]); + EXPECT_EQUAL(std::string(attr.get(doc)), uniqueStrings[0]); uint32_t e; EXPECT_TRUE(attr.findEnum(uniqueStrings[0].c_str(), e)); EXPECT_EQUAL(1u, attr.findFoldedEnums(uniqueStrings[0].c_str()).size()); @@ -124,7 +124,7 @@ testMultiValue(Attribute & attr, uint32_t numDocs) } // test get all - std::vector values(valueCount); + std::vector values(valueCount); ASSERT_TRUE(attr.get(doc, values.data(), valueCount) == valueCount); std::vector enums(valueCount); @@ -166,7 +166,7 @@ testMultiValue(Attribute & attr, uint32_t numDocs) EXPECT_TRUE(valueCount == expectedValueCount); // test get all - std::vector values(valueCount); + std::vector values(valueCount); EXPECT_TRUE(attr.get(doc, values.data(), valueCount) == valueCount); std::vector enums(valueCount); @@ -229,7 +229,7 @@ TEST("testMultiValueMultipleClearDocBetweenCommit") ArrayStr mvsa("a-string"); uint32_t numDocs = 50; addDocs(mvsa, numDocs); - std::vector buffer(numDocs); + std::vector buffer(numDocs); for (uint32_t doc = 0; doc < numDocs; ++doc) { uint32_t valueCount = doc; @@ -255,7 +255,7 @@ TEST("testMultiValueRemove") ArrayStr mvsa("a-string"); uint32_t numDocs = 50; addDocs(mvsa, numDocs); - std::vector buffer(9); + std::vector buffer(9); for (uint32_t doc = 0; doc < numDocs; ++doc) { EXPECT_TRUE(mvsa.append(doc, "one", 1)); @@ -327,7 +327,7 @@ testSingleValue(Attribute & svsa, Config &cfg) EXPECT_TRUE( ! IEnumStore::Index(EntryRef(v.getEnum(doc))).valid() ); } - std::map enums; + std::map enums; // 10 unique strings for (uint32_t i = 0; i < numDocs; ++i) { snprintf(tmp,sizeof(tmp), "enum%u", i % 10); @@ -345,11 +345,11 @@ testSingleValue(Attribute & svsa, Config &cfg) e1 = v.getEnum(j); EXPECT_TRUE( v.findEnum(t, e2) ); EXPECT_TRUE( e1 == e2 ); - if (enums.count(vespalib::string(t)) == 0) { - enums[vespalib::string(t)] = e1; + if (enums.count(std::string(t)) == 0) { + enums[std::string(t)] = e1; } else { - EXPECT_TRUE( e1 == enums[vespalib::string(t)]); - EXPECT_TRUE( e2 == enums[vespalib::string(t)]); + EXPECT_TRUE( e1 == enums[std::string(t)]); + EXPECT_TRUE( e2 == enums[std::string(t)]); } } } diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index ac7a63cdb9f8..38d4945c9137 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -76,19 +76,19 @@ using vespalib::eval::ValueType; using DoubleVector = std::vector; using generation_t = vespalib::GenerationHandler::generation_t; -vespalib::string sparseSpec("tensor(x{},y{})"); -vespalib::string denseSpec("tensor(x[2],y[3])"); -vespalib::string vec_2d_spec("tensor(x[2])"); -vespalib::string vec_mixed_2d_spec("tensor(a{},x[2])"); +std::string sparseSpec("tensor(x{},y{})"); +std::string denseSpec("tensor(x[2],y[3])"); +std::string vec_2d_spec("tensor(x[2])"); +std::string vec_mixed_2d_spec("tensor(a{},x[2])"); Value::UP createTensor(const TensorSpec &spec) { return value_from_spec(spec, FastValueBuilderFactory::get()); } -std::vector +std::vector to_string_labels(std::span labels) { - std::vector result; + std::vector result; for (auto& label : labels) { result.emplace_back(SharedStringRepo::Handle::string_from_id(label)); } @@ -108,7 +108,7 @@ vec_mixed_2d(std::vector> val) for (uint32_t a = 0; a < val.size(); ++a) { vespalib::asciistream a_stream; a_stream << a; - vespalib::string a_as_string = a_stream.str(); + std::string a_as_string = a_stream.str(); for (uint32_t x = 0; x < val[a].size(); ++x) { spec.add({{"a", a_as_string.c_str()},{"x", x}}, val[a][x]); } @@ -353,10 +353,10 @@ class MockNearestNeighborIndexFactory : public NearestNeighborIndexFactory { } }; -const vespalib::string test_dir = "test_data/"; -const vespalib::string attr_name = test_dir + "my_attr"; +const std::string test_dir = "test_data/"; +const std::string attr_name = test_dir + "my_attr"; -const vespalib::string hnsw_max_squared_norm = "hnsw.max_squared_norm"; +const std::string hnsw_max_squared_norm = "hnsw.max_squared_norm"; struct FixtureTraits { bool use_dense_tensor_attribute = false; @@ -421,8 +421,8 @@ struct Fixture { search::test::DirectoryHandler _dir_handler; Config _cfg; - vespalib::string _name; - vespalib::string _typeSpec; + std::string _name; + std::string _typeSpec; bool _use_mock_index; std::unique_ptr _index_factory; std::shared_ptr _tensorAttr; @@ -430,9 +430,9 @@ struct Fixture { vespalib::ThreadStackExecutor _executor; bool _denseTensors; FixtureTraits _traits; - vespalib::string _mmap_allocator_base_dir; + std::string _mmap_allocator_base_dir; - explicit Fixture(const vespalib::string &typeSpec, FixtureTraits traits = FixtureTraits()); + explicit Fixture(const std::string &typeSpec, FixtureTraits traits = FixtureTraits()); ~Fixture(); @@ -597,7 +597,7 @@ struct Fixture { return {denseSpec}; } - vespalib::string expEmptyDenseTensorSpec() const { + std::string expEmptyDenseTensorSpec() const { return denseSpec; } @@ -617,7 +617,7 @@ struct Fixture { void test_mmap_file_allocator(); }; -Fixture::Fixture(const vespalib::string &typeSpec, FixtureTraits traits) +Fixture::Fixture(const std::string &typeSpec, FixtureTraits traits) : _dir_handler(test_dir), _cfg(BasicType::TENSOR, CollectionType::SINGLE), _name(attr_name), @@ -783,7 +783,7 @@ Fixture::get_file_header() { vespalib::FileHeader header; FastOS_File file; - vespalib::string file_name = attr_name + ".dat"; + std::string file_name = attr_name + ".dat"; EXPECT_TRUE(file.OpenReadOnly(file_name.c_str())); (void) header.readFile(file); return header; @@ -811,7 +811,7 @@ Fixture::testEmptyTensor() const TensorAttribute &tensorAttr = *_tensorAttr; Value::UP emptyTensor = tensorAttr.getEmptyTensor(); if (_denseTensors) { - vespalib::string expSpec = expEmptyDenseTensorSpec(); + std::string expSpec = expEmptyDenseTensorSpec(); EXPECT_EQUAL(emptyTensor->type(), ValueType::from_spec(expSpec)); } else { EXPECT_EQUAL(emptyTensor->type(), tensorAttr.getConfig().tensorType()); @@ -847,11 +847,11 @@ Fixture::testSerializedTensorRef() EXPECT_EQUAL(2u, vectors.subspaces()); auto cells = vectors.cells(0).typify(); auto labels = ref.get_labels(0); - EXPECT_EQUAL((std::vector{"one", "two"}), to_string_labels(labels)); + EXPECT_EQUAL((std::vector{"one", "two"}), to_string_labels(labels)); EXPECT_EQUAL((std::vector{11.0}), (std::vector{ cells.begin(), cells.end() })); cells = vectors.cells(1).typify(); labels = ref.get_labels(1); - EXPECT_EQUAL((std::vector{"three", "four"}), to_string_labels(labels)); + EXPECT_EQUAL((std::vector{"three", "four"}), to_string_labels(labels)); EXPECT_EQUAL((std::vector{17.0}), (std::vector{ cells.begin(), cells.end() })); } TEST_DO(clearTensor(3)); @@ -964,7 +964,7 @@ template class TensorAttributeHnswIndex : public Fixture { public: - TensorAttributeHnswIndex(const vespalib::string &type_spec, FixtureTraits traits) + TensorAttributeHnswIndex(const std::string &type_spec, FixtureTraits traits) : Fixture(type_spec, traits) { } diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp index 7d915bf997ca..9368a11ef018 100644 --- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp +++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp @@ -2,11 +2,11 @@ #include #include #include +#include #include #include -#include -#include #include +#include LOG_SETUP("bitvectorbenchmark"); diff --git a/searchlib/src/tests/common/bitvector/bitvector_test.cpp b/searchlib/src/tests/common/bitvector/bitvector_test.cpp index 04c0c082a690..4593994a013e 100644 --- a/searchlib/src/tests/common/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/common/bitvector/bitvector_test.cpp @@ -155,7 +155,7 @@ fill(BitVector & bv, const std::vector & bits, uint32_t offset, bool f } } -vespalib::string +std::string fill(const std::vector & bits, uint32_t offset) { vespalib::asciistream os; diff --git a/searchlib/src/tests/common/matching_elements_fields/matching_elements_fields_test.cpp b/searchlib/src/tests/common/matching_elements_fields/matching_elements_fields_test.cpp index 2bdd079e4382..129220f5151f 100644 --- a/searchlib/src/tests/common/matching_elements_fields/matching_elements_fields_test.cpp +++ b/searchlib/src/tests/common/matching_elements_fields/matching_elements_fields_test.cpp @@ -7,7 +7,7 @@ using namespace search; namespace { -std::string str(const vespalib::string &s) { return std::string(s.data(), s.size()); } +std::string str(const std::string &s) { return std::string(s.data(), s.size()); } } diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp index e6ab94e89140..ed1743149a68 100644 --- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp +++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp @@ -71,7 +71,7 @@ namespace fieldwriter { uint32_t minSkipDocs = 64; uint32_t minChunkDocs = 256_Ki; -vespalib::string dirprefix = "index/"; +std::string dirprefix = "index/"; void disableSkip() { @@ -93,7 +93,7 @@ void enableSkipChunks() const char *bool_to_str(bool val) { return (val ? "true" : "false"); } -vespalib::string +std::string makeWordString(uint64_t wordNum) { using AS = vespalib::asciistream; @@ -162,13 +162,13 @@ class WrappedFieldWriter bool _encode_interleaved_features; uint32_t _numWordIds; uint32_t _docIdLimit; - vespalib::string _namepref; + std::string _namepref; Schema _schema; uint32_t _indexId; public: - WrappedFieldWriter(const vespalib::string &namepref, + WrappedFieldWriter(const std::string &namepref, bool dynamicK, bool encoce_cheap_fatures, uint32_t numWordIds, @@ -181,7 +181,7 @@ class WrappedFieldWriter WrappedFieldWriter::~WrappedFieldWriter() {} -WrappedFieldWriter::WrappedFieldWriter(const vespalib::string &namepref, +WrappedFieldWriter::WrappedFieldWriter(const std::string &namepref, bool dynamicK, bool encode_interleaved_features, uint32_t numWordIds, @@ -238,7 +238,7 @@ class WrappedFieldReader Schema _schema; public: - WrappedFieldReader(const vespalib::string &namepref, + WrappedFieldReader(const std::string &namepref, uint32_t numWordIds, uint32_t docIdLimit); @@ -248,7 +248,7 @@ class WrappedFieldReader }; -WrappedFieldReader::WrappedFieldReader(const vespalib::string &namepref, +WrappedFieldReader::WrappedFieldReader(const std::string &namepref, uint32_t numWordIds, uint32_t docIdLimit) : _fieldReader(), @@ -298,7 +298,7 @@ class FileChecksum unsigned char _digest[EVP_MAX_MD_SIZE]; unsigned int _digest_len; public: - FileChecksum(const vespalib::string &file_name); + FileChecksum(const std::string &file_name); bool operator==(const FileChecksum &rhs) const { return ((_digest_len == rhs._digest_len) && (memcmp(_digest, rhs._digest, _digest_len) == 0)); @@ -306,13 +306,13 @@ class FileChecksum }; -FileChecksum::FileChecksum(const vespalib::string &file_name) +FileChecksum::FileChecksum(const std::string &file_name) : _digest(), _digest_len(0u) { FastOS_File f; Alloc buf = Alloc::alloc(64_Ki); - vespalib::string full_file_name(dirprefix + file_name); + std::string full_file_name(dirprefix + file_name); bool openres = f.OpenReadOnly(full_file_name.c_str()); if (!openres) { LOG(error, "Could not open %s for sha256 checksum", full_file_name.c_str()); @@ -335,7 +335,7 @@ FileChecksum::FileChecksum(const vespalib::string &file_name) } void -compare_files(const vespalib::string &file_name_prefix, const vespalib::string &file_name_suffix) +compare_files(const std::string &file_name_prefix, const std::string &file_name_suffix) { FileChecksum baseline_checksum(file_name_prefix + file_name_suffix); FileChecksum cooked_fusion_checksum(file_name_prefix + "x" + file_name_suffix); @@ -344,14 +344,14 @@ compare_files(const vespalib::string &file_name_prefix, const vespalib::string & assert(baseline_checksum == raw_fusion_checksum); } -std::vector suffixes = { +std::vector suffixes = { "boolocc.bdat", "boolocc.idx", "posocc.dat.compressed", "dictionary.pdat", "dictionary.spdat", "dictionary.ssdat" }; void -check_fusion(const vespalib::string &file_name_prefix) +check_fusion(const std::string &file_name_prefix) { for (const auto &file_name_suffix : suffixes) { compare_files(file_name_prefix, file_name_suffix); @@ -359,9 +359,9 @@ check_fusion(const vespalib::string &file_name_prefix) } void -remove_field(const vespalib::string &file_name_prefix) +remove_field(const std::string &file_name_prefix) { - vespalib::string remove_prefix(dirprefix + file_name_prefix); + std::string remove_prefix(dirprefix + file_name_prefix); FieldWriter::remove(remove_prefix); FieldWriter::remove(remove_prefix + "x"); FieldWriter::remove(remove_prefix + "xx"); @@ -484,7 +484,7 @@ randReadField(FakeWordSet &wordSet, bool openCntRes = dictFile->open(cname, tuneFileRandRead); assert(openCntRes); (void) openCntRes; - vespalib::string cWord; + std::string cWord; std::string pname = dirprefix + namepref + "posocc.dat"; pname += ".compressed"; @@ -552,8 +552,8 @@ randReadField(FakeWordSet &wordSet, void fusionField(uint32_t numWordIds, uint32_t docIdLimit, - const vespalib::string &ipref, - const vespalib::string &opref, + const std::string &ipref, + const std::string &opref, bool doRaw, bool dynamicK, bool encode_interleaved_features) @@ -609,7 +609,7 @@ fusionField(uint32_t numWordIds, void testFieldWriterVariant(FakeWordSet &wordSet, uint32_t doc_id_limit, - const vespalib::string &file_name_prefix, + const std::string &file_name_prefix, bool dynamic_k, bool encode_interleaved_features, bool verbose) diff --git a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp index c45b5787c4c4..e050efd3e21c 100644 --- a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp +++ b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp @@ -60,7 +60,7 @@ using namespace index; namespace diskindex { class MyMockFieldLengthInspector : public IFieldLengthInspector { - FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + FieldLengthInfo get_field_length_info(const std::string& field_name) const override { if (field_name == "f0") { return FieldLengthInfo(3.5, 21); } else { @@ -76,10 +76,10 @@ class FusionTest : public ::testing::Test bool _force_small_merge_chunk; const Schema & getSchema() const { return _schema; } - void requireThatFusionIsWorking(const vespalib::string &prefix, bool directio, bool readmmap, bool force_short_merge_chunk); - void make_simple_index(const vespalib::string &dump_dir, const IFieldLengthInspector &field_length_inspector); - bool try_merge_simple_indexes(const vespalib::string &dump_dir, const std::vector &sources, std::shared_ptr flush_token); - void merge_simple_indexes(const vespalib::string &dump_dir, const std::vector &sources); + void requireThatFusionIsWorking(const std::string &prefix, bool directio, bool readmmap, bool force_short_merge_chunk); + void make_simple_index(const std::string &dump_dir, const IFieldLengthInspector &field_length_inspector); + bool try_merge_simple_indexes(const std::string &dump_dir, const std::vector &sources, std::shared_ptr flush_token); + void merge_simple_indexes(const std::string &dump_dir, const std::vector &sources); void reconstruct_interleaved_features(); public: FusionTest(); @@ -97,7 +97,7 @@ myPushDocument(DocumentInverter &inv) } -vespalib::string +std::string toString(FieldPositionsIterator posItr, bool hasElements = false, bool hasWeights = false) { vespalib::asciistream ss; @@ -155,7 +155,7 @@ make_schema(bool interleaved_features) } void -assert_interleaved_features(DiskIndex &d, const vespalib::string &field, const vespalib::string &term, uint32_t doc_id, uint32_t exp_num_occs, uint32_t exp_field_length) +assert_interleaved_features(DiskIndex &d, const std::string &field, const std::string &term, uint32_t doc_id, uint32_t exp_num_occs, uint32_t exp_field_length) { using LookupResult = DiskIndex::LookupResult; using PostingListHandle = index::PostingListHandle; @@ -198,10 +198,10 @@ validateDiskIndex(DiskIndex &dw, bool f2HasElements, bool f3HasWeights) a.add(&f0); SB::UP sbap(wh1->createIterator(lr1->counts, a)); sbap->initFullRange(); - EXPECT_EQ(vespalib::string("{1000000:}"), toString(f0.getIterator())); + EXPECT_EQ(std::string("{1000000:}"), toString(f0.getIterator())); EXPECT_TRUE(sbap->seek(10)); sbap->unpack(10); - EXPECT_EQ(vespalib::string("{7:2}"), toString(f0.getIterator())); + EXPECT_EQ(std::string("{7:2}"), toString(f0.getIterator())); } { uint32_t id1(schema.getIndexFieldId("f2")); @@ -214,14 +214,14 @@ validateDiskIndex(DiskIndex &dw, bool f2HasElements, bool f3HasWeights) a.add(&f2); SB::UP sbap(wh1->createIterator(lr1->counts, a)); sbap->initFullRange(); - EXPECT_EQ(vespalib::string("{1000000:}"), toString(f2.getIterator())); + EXPECT_EQ(std::string("{1000000:}"), toString(f2.getIterator())); EXPECT_TRUE(sbap->seek(10)); sbap->unpack(10); if (f2HasElements) { - EXPECT_EQ(vespalib::string("{3:0[e=0,l=3],0[e=1,l=1]}"), + EXPECT_EQ(std::string("{3:0[e=0,l=3],0[e=1,l=1]}"), toString(f2.getIterator(), true)); } else { - EXPECT_EQ(vespalib::string("{3:0[e=0,l=3]}"), + EXPECT_EQ(std::string("{3:0[e=0,l=3]}"), toString(f2.getIterator(), true)); } } @@ -236,14 +236,14 @@ validateDiskIndex(DiskIndex &dw, bool f2HasElements, bool f3HasWeights) a.add(&f3); SB::UP sbap(wh1->createIterator(lr1->counts, a)); sbap->initFullRange(); - EXPECT_EQ(vespalib::string("{1000000:}"), toString(f3.getIterator())); + EXPECT_EQ(std::string("{1000000:}"), toString(f3.getIterator())); EXPECT_TRUE(sbap->seek(10)); sbap->unpack(10); if (f3HasWeights) { - EXPECT_EQ(vespalib::string("{2:0[e=0,w=4,l=2]}"), + EXPECT_EQ(std::string("{2:0[e=0,w=4,l=2]}"), toString(f3.getIterator(), true, true)); } else { - EXPECT_EQ(vespalib::string("{2:0[e=0,w=1,l=2]}"), + EXPECT_EQ(std::string("{2:0[e=0,w=1,l=2]}"), toString(f3.getIterator(), true, true)); } } @@ -258,14 +258,14 @@ validateDiskIndex(DiskIndex &dw, bool f2HasElements, bool f3HasWeights) a.add(&f3); SB::UP sbap(wh1->createIterator(lr1->counts, a)); sbap->initFullRange(); - EXPECT_EQ(vespalib::string("{1000000:}"), toString(f3.getIterator())); + EXPECT_EQ(std::string("{1000000:}"), toString(f3.getIterator())); EXPECT_TRUE(sbap->seek(11)); sbap->unpack(11); if (f3HasWeights) { - EXPECT_EQ(vespalib::string("{1:0[e=0,w=-27,l=1]}"), + EXPECT_EQ(std::string("{1:0[e=0,w=-27,l=1]}"), toString(f3.getIterator(), true, true)); } else { - EXPECT_EQ(vespalib::string("{1:0[e=0,w=1,l=1]}"), + EXPECT_EQ(std::string("{1:0[e=0,w=1,l=1]}"), toString(f3.getIterator(), true, true)); } } @@ -280,14 +280,14 @@ validateDiskIndex(DiskIndex &dw, bool f2HasElements, bool f3HasWeights) a.add(&f3); SB::UP sbap(wh1->createIterator(lr1->counts, a)); sbap->initFullRange(); - EXPECT_EQ(vespalib::string("{1000000:}"), toString(f3.getIterator())); + EXPECT_EQ(std::string("{1000000:}"), toString(f3.getIterator())); EXPECT_TRUE(sbap->seek(12)); sbap->unpack(12); if (f3HasWeights) { - EXPECT_EQ(vespalib::string("{1:0[e=0,w=0,l=1]}"), + EXPECT_EQ(std::string("{1:0[e=0,w=0,l=1]}"), toString(f3.getIterator(), true, true)); } else { - EXPECT_EQ(vespalib::string("{1:0[e=0,w=1,l=1]}"), + EXPECT_EQ(std::string("{1:0[e=0,w=1,l=1]}"), toString(f3.getIterator(), true, true)); } } @@ -297,7 +297,7 @@ VESPA_THREAD_STACK_TAG(invert_executor) VESPA_THREAD_STACK_TAG(push_executor) void -FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool directio, bool readmmap, bool force_small_merge_chunk) +FusionTest::requireThatFusionIsWorking(const std::string &prefix, bool directio, bool readmmap, bool force_small_merge_chunk) { Schema schema; Schema schema2; @@ -361,7 +361,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire myPushDocument(inv); - const vespalib::string dump2dir = prefix + "dump2"; + const std::string dump2dir = prefix + "dump2"; constexpr uint32_t numDocs = 12 + 1; const uint32_t numWords = fic.getNumUniqueWords(); @@ -391,7 +391,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire } while (0); do { - std::vector sources; + std::vector sources; SelectorArray selector(numDocs, 0); sources.push_back(prefix + "dump2"); Fusion fusion(schema, prefix + "dump3", sources, selector, @@ -405,7 +405,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire validateDiskIndex(dw3, true, true); } while (0); do { - std::vector sources; + std::vector sources; SelectorArray selector(numDocs, 0); sources.push_back(prefix + "dump3"); Fusion fusion(schema2, prefix + "dump4", sources, selector, @@ -419,7 +419,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire validateDiskIndex(dw4, true, false); } while (0); do { - std::vector sources; + std::vector sources; SelectorArray selector(numDocs, 0); sources.push_back(prefix + "dump3"); Fusion fusion(schema3, prefix + "dump5", sources, selector, @@ -433,7 +433,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire validateDiskIndex(dw5, false, false); } while (0); do { - std::vector sources; + std::vector sources; SelectorArray selector(numDocs, 0); sources.push_back(prefix + "dump3"); Fusion fusion(schema, prefix + "dump6", sources, selector, @@ -448,7 +448,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire validateDiskIndex(dw6, true, true); } while (0); do { - std::vector sources; + std::vector sources; SelectorArray selector(numDocs, 0); sources.push_back(prefix + "dump2"); Fusion fusion(schema, prefix + "dump3", sources, selector, @@ -464,7 +464,7 @@ FusionTest::requireThatFusionIsWorking(const vespalib::string &prefix, bool dire } void -FusionTest::make_simple_index(const vespalib::string &dump_dir, const IFieldLengthInspector &field_length_inspector) +FusionTest::make_simple_index(const std::string &dump_dir, const IFieldLengthInspector &field_length_inspector) { FieldIndexCollection fic(_schema, field_length_inspector); constexpr uint32_t numDocs = 20; @@ -486,7 +486,7 @@ FusionTest::make_simple_index(const vespalib::string &dump_dir, const IFieldLeng } bool -FusionTest::try_merge_simple_indexes(const vespalib::string &dump_dir, const std::vector &sources, std::shared_ptr flush_token) +FusionTest::try_merge_simple_indexes(const std::string &dump_dir, const std::vector &sources, std::shared_ptr flush_token) { vespalib::ThreadStackExecutor executor(4); TuneFileIndexing tuneFileIndexing; @@ -498,7 +498,7 @@ FusionTest::try_merge_simple_indexes(const vespalib::string &dump_dir, const std } void -FusionTest::merge_simple_indexes(const vespalib::string &dump_dir, const std::vector &sources) +FusionTest::merge_simple_indexes(const std::string &dump_dir, const std::vector &sources) { ASSERT_TRUE(try_merge_simple_indexes(dump_dir, sources, std::make_shared())); } diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4_hugeword_cornercase_test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4_hugeword_cornercase_test.cpp index c17d78b25f36..ade628b082c5 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4_hugeword_cornercase_test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4_hugeword_cornercase_test.cpp @@ -161,7 +161,7 @@ void testPageSizedCounts() uint64_t checkWordNum = 0; PostingListCounts counts; for (uint64_t wordNum = 1; wordNum < 7; ++wordNum) { - vespalib::string word; + std::string word; counts.clear(); r.readCounts(word, checkWordNum, counts); if (wordNum < 6) { diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4_long_words_test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4_long_words_test.cpp index 062723a9bc26..202e75e2f049 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4_long_words_test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4_long_words_test.cpp @@ -19,8 +19,8 @@ using search::index::PostingListParams; namespace { -vespalib::string test_dir("long_words_dir"); -vespalib::string dict(test_dir + "/dict"); +std::string test_dir("long_words_dir"); +std::string dict(test_dir + "/dict"); PostingListCounts make_counts() { @@ -31,11 +31,11 @@ PostingListCounts make_counts() return counts; } -vespalib::string +std::string make_word(int i) { vespalib::asciistream os; - vespalib::string word(5_Ki, 'a'); + std::string word(5_Ki, 'a'); os << vespalib::setfill('0') << vespalib::setw(8) << i; word.append(os.view()); return word; @@ -112,7 +112,7 @@ TEST(PageDict4LongWordsTest, test_many_long_words) auto dr = std::make_unique(); search::TuneFileSeqRead tune_file_read; EXPECT_TRUE(dr->open(dict, tune_file_read)); - vespalib::string check_word; + std::string check_word; PostingListCounts check_counts; for (int i = 0; i < num_words; ++i) { uint64_t check_word_num = 0; diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp index 3b7ec00211d7..f59cd6a0d738 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -418,7 +419,7 @@ testWords(const std::string &logname, ie = myrand.end(); i != ie; ++i, ++wordNum) { - vespalib::string word; + std::string word; counts.clear(); r.readCounts(word, checkWordNum, counts); checkCounts(word, counts, checkOffset, *i, chunkSize); @@ -512,7 +513,7 @@ testWords(const std::string &logname, assert(openres); (void) openres; std::string lastWord; - vespalib::string checkWord; + std::string checkWord; PostingListCounts wCounts; PostingListCounts rCounts; uint64_t wordNum = 1; @@ -558,7 +559,7 @@ testWords(const std::string &logname, assert(openres); (void) openres; std::string lastWord; - vespalib::string checkWord; + std::string checkWord; PostingListCounts wCounts; PostingListCounts rCounts; uint64_t wOffset; diff --git a/searchlib/src/tests/docstore/chunk/chunk_test.cpp b/searchlib/src/tests/docstore/chunk/chunk_test.cpp index 5863297be51b..fef5f650af14 100644 --- a/searchlib/src/tests/docstore/chunk/chunk_test.cpp +++ b/searchlib/src/tests/docstore/chunk/chunk_test.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include LOG_SETUP("chunk_test"); @@ -48,7 +48,7 @@ TEST("require that Chunk can produce unique list") EXPECT_EQUAL(3u, unique[2].netSize()); } -void testChunkFormat(ChunkFormat &cf, size_t expectedLen, const vespalib::string &expectedContent) +void testChunkFormat(ChunkFormat &cf, size_t expectedLen, const std::string &expectedContent) { CompressionConfig cfg; uint64_t MAGIC_CONTENT(0xabcdef9876543210); diff --git a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp index 07dda0d6f1b5..3a2487916dc1 100644 --- a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp +++ b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp @@ -21,7 +21,7 @@ LOG_SETUP("document_store_visitor_test"); using namespace search; -using vespalib::string; +using std::string; using document::DataType; using document::Document; using document::DocumentId; diff --git a/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp b/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp index 8ccd4e57eed0..34a6512b832b 100644 --- a/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp +++ b/searchlib/src/tests/docstore/file_chunk/file_chunk_test.cpp @@ -23,7 +23,7 @@ using vespalib::CpuUsage; using vespalib::ThreadStackExecutor; struct MyFileHeaderContext : public FileHeaderContext { - void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override { + void addTags(vespalib::GenericHeader &header, const std::string &name) const override { (void) header; (void) name; } @@ -50,7 +50,7 @@ struct BucketizerObserver : public IBucketizer { } }; -vespalib::string +std::string getData(uint32_t lid) { std::ostringstream oss; @@ -72,7 +72,7 @@ struct FixtureBase { return serialNum++; }; - explicit FixtureBase(const vespalib::string &baseName, bool dirCleanup = true) + explicit FixtureBase(const std::string &baseName, bool dirCleanup = true) : dir(baseName), executor(1), serialNum(1), @@ -98,7 +98,7 @@ FixtureBase::~FixtureBase() = default; struct ReadFixture : public FixtureBase { FileChunk chunk; - explicit ReadFixture(const vespalib::string &baseName, bool dirCleanup = true) + explicit ReadFixture(const std::string &baseName, bool dirCleanup = true) : FixtureBase(baseName, dirCleanup), chunk(FileChunk::FileId(0), FileChunk::NameId(1234), baseName, tuneFile, &bucketizer) { @@ -114,7 +114,7 @@ struct WriteFixture : public FixtureBase { WriteableFileChunk chunk; using CompressionConfig = vespalib::compression::CompressionConfig; - WriteFixture(const vespalib::string &baseName, + WriteFixture(const std::string &baseName, uint32_t docIdLimit, bool dirCleanup = true) : FixtureBase(baseName, dirCleanup), @@ -128,7 +128,7 @@ struct WriteFixture : public FixtureBase { chunk.flushPendingChunks(serialNum); } WriteFixture &append(uint32_t lid) { - vespalib::string data = getData(lid); + std::string data = getData(lid); chunk.append(nextSerialNum(), lid, {data.c_str(), data.size()}, CpuUsage::Category::WRITE); return *this; } diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index e54e068eb3af..0d5a45ade8c5 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -391,7 +391,7 @@ TEST("test visit cache does not cache empty ones and is able to access some back EXPECT_EQUAL(1u, visitCache.read({1,3}).getBlobSet().getPositions().size()); } -using vespalib::string; +using std::string; using document::DataType; using document::Document; using document::DocumentId; @@ -566,7 +566,7 @@ TEST("Control static memory usage") { IDocumentStore &ds = vcs.getStore(); vespalib::MemoryUsage usage = ds.getMemoryUsage(); constexpr size_t mutex_size = sizeof(std::mutex) * 2 * (113 + 1); // sizeof(std::mutex) is platform dependent - constexpr size_t string_size = sizeof(vespalib::string); + constexpr size_t string_size = sizeof(std::string); EXPECT_EQUAL(74476 + mutex_size + 3 * string_size, usage.allocatedBytes()); EXPECT_EQUAL(752u + mutex_size + 3 * string_size, usage.usedBytes()); } @@ -815,7 +815,7 @@ getBasicConfig(size_t maxFileSize) return LogDataStore::Config().setMaxFileSize(maxFileSize); } -vespalib::string +std::string genData(uint32_t lid, size_t numBytes) { assert(numBytes >= 6); @@ -839,7 +839,7 @@ struct Fixture { return serialNum++; } - Fixture(const vespalib::string &dirName = "tmp", + Fixture(const std::string &dirName = "tmp", bool dirCleanup = true, size_t maxFileSize = 4_Ki * 2) : executor(1), @@ -858,7 +858,7 @@ struct Fixture { store.flush(serialNum); } Fixture &write(uint32_t lid, size_t numBytes = 1024) { - vespalib::string data = genData(lid, numBytes); + std::string data = genData(lid, numBytes); store.write(nextSerialNum(), lid, data.c_str(), data.size()); return *this; } @@ -893,11 +893,11 @@ struct Fixture { vespalib::DataBuffer buffer; size_t size = store.read(lid, buffer); if (lids.find(lid) != lids.end()) { - vespalib::string expData = genData(lid, numBytesPerEntry); - EXPECT_EQUAL(expData, vespalib::string(buffer.getData(), buffer.getDataLen())); + std::string expData = genData(lid, numBytesPerEntry); + EXPECT_EQUAL(expData, std::string(buffer.getData(), buffer.getDataLen())); EXPECT_GREATER(size, 0u); } else { - EXPECT_EQUAL("", vespalib::string(buffer.getData(), buffer.getDataLen())); + EXPECT_EQUAL("", std::string(buffer.getData(), buffer.getDataLen())); EXPECT_EQUAL(0u, size); } } @@ -1007,9 +1007,9 @@ TEST_F("require that lid space can be increased after being compacted and then s TEST_F("require that there is control of static memory usage", Fixture) { vespalib::MemoryUsage usage = f.store.getMemoryUsage(); - EXPECT_EQUAL(456u + sizeof(LogDataStore::NameIdSet) + sizeof(std::mutex) + sizeof(vespalib::string), sizeof(LogDataStore)); - EXPECT_EQUAL(73916u + 3 * sizeof(vespalib::string), usage.allocatedBytes()); - EXPECT_EQUAL(192u + 3 * sizeof(vespalib::string), usage.usedBytes()); + EXPECT_EQUAL(456u + sizeof(LogDataStore::NameIdSet) + sizeof(std::mutex) + sizeof(std::string), sizeof(LogDataStore)); + EXPECT_EQUAL(73916u + 3 * sizeof(std::string), usage.allocatedBytes()); + EXPECT_EQUAL(192u + 3 * sizeof(std::string), usage.usedBytes()); } TEST_F("require that lid space can be shrunk only after read guards are deleted", Fixture) diff --git a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp index 45872f2a8195..d296e014e8c6 100644 --- a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp +++ b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp @@ -16,7 +16,7 @@ using namespace search::docstore; using document::BucketId; using vespalib::compression::CompressionConfig; -vespalib::string +std::string createPayload(BucketId b) { constexpr const char * BUF = "Buffer for testing Bucket drain order."; vespalib::asciistream os; @@ -39,7 +39,7 @@ createBucketId(size_t i) { void add(StoreByBucket & sbb, size_t i) { BucketId b = createBucketId(i); - vespalib::string s = createPayload(b); + std::string s = createPayload(b); sbb.add(b, i%10, i, {s.c_str(), s.size()}); } diff --git a/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp b/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp index 6549458ab992..3ca41d52bfd8 100644 --- a/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp +++ b/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp @@ -226,7 +226,7 @@ struct SearchReplyTest : ProtoConverterTest { reply.hits[2].metric = 10.0; } void fill_sort_data() { - vespalib::string sort_data("fooxybar"); + std::string sort_data("fooxybar"); reply.sortData.assign(sort_data.begin(), sort_data.end()); reply.sortIndex.push_back(0); reply.sortIndex.push_back(3); // hit1: 'foo' @@ -349,7 +349,7 @@ TEST_F(SearchReplyTest, require_that_match_features_are_converted) { } TEST_F(SearchReplyTest, require_that_grouping_blob_is_converted) { - vespalib::string tmp("grouping-result"); + std::string tmp("grouping-result"); reply.groupResult.assign(tmp.data(), tmp.data() + tmp.size()); convert(); EXPECT_EQ(proto.grouping_blob(), "grouping-result"); diff --git a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp index 3941cc606fb7..2dfc910b11c5 100644 --- a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp +++ b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp @@ -52,15 +52,15 @@ using vespalib::BufferRef; namespace { -vespalib::string stringValue(const ResultNode &result, const IAttributeVector &attr) { +std::string stringValue(const ResultNode &result, const IAttributeVector &attr) { if (result.inherits(EnumResultNode::classId)) { auto enumHandle = result.getEnum(); - return vespalib::string(attr.getStringFromEnum(enumHandle)); + return std::string(attr.getStringFromEnum(enumHandle)); } char buf[100]; BufferRef bref(&buf[0], sizeof(buf)); auto sbuf = result.getString(bref); - return vespalib::string(sbuf.c_str(), sbuf.c_str() + sbuf.size()); + return std::string(sbuf.c_str(), sbuf.c_str() + sbuf.size()); } struct AttributeManagerFixture @@ -70,16 +70,16 @@ struct AttributeManagerFixture AttributeManagerFixture(); ~AttributeManagerFixture(); template - void buildAttribute(const vespalib::string &name, BasicType type, std::vector values); - void buildStringAttribute(const vespalib::string &name, std::vector values); - void buildBoolAttribute(const vespalib::string &name, std::vector values); - void buildFloatAttribute(const vespalib::string &name, std::vector values); - void buildIntegerAttribute(const vespalib::string &name, BasicType type, std::vector values); + void buildAttribute(const std::string &name, BasicType type, std::vector values); + void buildStringAttribute(const std::string &name, std::vector values); + void buildBoolAttribute(const std::string &name, std::vector values); + void buildFloatAttribute(const std::string &name, std::vector values); + void buildIntegerAttribute(const std::string &name, BasicType type, std::vector values); template - void buildArrayAttribute(const vespalib::string &name, BasicType type, std::vector> values); - void buildStringArrayAttribute(const vespalib::string &name,std::vector> values); - void buildFloatArrayAttribute(const vespalib::string &name, std::vector> values); - void buildIntegerArrayAttribute(const vespalib::string &name, BasicType type, std::vector> values); + void buildArrayAttribute(const std::string &name, BasicType type, std::vector> values); + void buildStringArrayAttribute(const std::string &name,std::vector> values); + void buildFloatArrayAttribute(const std::string &name, std::vector> values); + void buildIntegerArrayAttribute(const std::string &name, BasicType type, std::vector> values); }; AttributeManagerFixture::AttributeManagerFixture() @@ -106,7 +106,7 @@ AttributeManagerFixture::~AttributeManagerFixture() = default; template void -AttributeManagerFixture::buildAttribute(const vespalib::string &name, BasicType type, +AttributeManagerFixture::buildAttribute(const std::string &name, BasicType type, std::vector values) { Config cfg(type, CollectionType::Type::SINGLE); @@ -126,28 +126,28 @@ AttributeManagerFixture::buildAttribute(const vespalib::string &name, BasicType } void -AttributeManagerFixture::buildStringAttribute(const vespalib::string &name, - std::vector values) +AttributeManagerFixture::buildStringAttribute(const std::string &name, + std::vector values) { - buildAttribute(name, BasicType::Type::STRING, std::move(values)); + buildAttribute(name, BasicType::Type::STRING, std::move(values)); } void -AttributeManagerFixture::buildFloatAttribute(const vespalib::string &name, +AttributeManagerFixture::buildFloatAttribute(const std::string &name, std::vector values) { buildAttribute(name, BasicType::Type::DOUBLE, std::move(values)); } void -AttributeManagerFixture::buildIntegerAttribute(const vespalib::string &name, BasicType type, +AttributeManagerFixture::buildIntegerAttribute(const std::string &name, BasicType type, std::vector values) { buildAttribute(name, type, std::move(values)); } void -AttributeManagerFixture::buildBoolAttribute(const vespalib::string &name, +AttributeManagerFixture::buildBoolAttribute(const std::string &name, std::vector values) { buildAttribute(name, BasicType::BOOL, std::move(values)); @@ -155,7 +155,7 @@ AttributeManagerFixture::buildBoolAttribute(const vespalib::string &name, template void -AttributeManagerFixture::buildArrayAttribute(const vespalib::string &name, BasicType type, +AttributeManagerFixture::buildArrayAttribute(const std::string &name, BasicType type, std::vector> values) { Config cfg(type, CollectionType::Type::ARRAY); @@ -177,21 +177,21 @@ AttributeManagerFixture::buildArrayAttribute(const vespalib::string &name, Basic } void -AttributeManagerFixture::buildStringArrayAttribute(const vespalib::string &name, - std::vector> values) +AttributeManagerFixture::buildStringArrayAttribute(const std::string &name, + std::vector> values) { - buildArrayAttribute(name, BasicType::Type::STRING, std::move(values)); + buildArrayAttribute(name, BasicType::Type::STRING, std::move(values)); } void -AttributeManagerFixture::buildFloatArrayAttribute(const vespalib::string &name, +AttributeManagerFixture::buildFloatArrayAttribute(const std::string &name, std::vector> values) { buildArrayAttribute(name, BasicType::Type::DOUBLE, std::move(values)); } void -AttributeManagerFixture::buildIntegerArrayAttribute(const vespalib::string &name, +AttributeManagerFixture::buildIntegerArrayAttribute(const std::string &name, BasicType type, std::vector> values) { @@ -206,16 +206,16 @@ class Fixture AttributeContext context; Fixture(); ~Fixture(); - std::unique_ptr makeNode(const vespalib::string &attributeName, bool useEnumOptimiation = false, bool preserveAccurateTypes = false); - void assertInts(std::vector expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false); - void assertBools(std::vector expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false); - void assertStrings(std::vector expVals, const vespalib::string &attributteName); - void assertFloats(std::vector expVals, const vespalib::string &attributteName); - void assertIntArrays(std::vector> expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false); - void assertStringArrays(std::vector> expVals, const vespalib::string &attributteName, bool useEnumOptimization = false); - void assertFloatArrays(std::vector> expVals, const vespalib::string &attributteName); + std::unique_ptr makeNode(const std::string &attributeName, bool useEnumOptimiation = false, bool preserveAccurateTypes = false); + void assertInts(std::vector expVals, const std::string &attributteName, bool preserveAccurateTypes = false); + void assertBools(std::vector expVals, const std::string &attributteName, bool preserveAccurateTypes = false); + void assertStrings(std::vector expVals, const std::string &attributteName); + void assertFloats(std::vector expVals, const std::string &attributteName); + void assertIntArrays(std::vector> expVals, const std::string &attributteName, bool preserveAccurateTypes = false); + void assertStringArrays(std::vector> expVals, const std::string &attributteName, bool useEnumOptimization = false); + void assertFloatArrays(std::vector> expVals, const std::string &attributteName); private: - void assertStrings(std::vector expVals, const vespalib::string &attributteName, bool useEnumOptimization); + void assertStrings(std::vector expVals, const std::string &attributteName, bool useEnumOptimization); }; Fixture::Fixture() @@ -227,10 +227,10 @@ Fixture::Fixture() Fixture::~Fixture() = default; std::unique_ptr -Fixture::makeNode(const vespalib::string &attributeName, bool useEnumOptimization, bool preserveAccurateTypes) +Fixture::makeNode(const std::string &attributeName, bool useEnumOptimization, bool preserveAccurateTypes) { std::unique_ptr node; - if (attributeName.find('{') == vespalib::string::npos) { + if (attributeName.find('{') == std::string::npos) { node = std::make_unique(attributeName); } else { node = makeAttributeMapLookupNode(attributeName); @@ -244,7 +244,7 @@ Fixture::makeNode(const vespalib::string &attributeName, bool useEnumOptimizatio void -Fixture::assertInts(std::vector expVals, const vespalib::string &attributeName, bool preserveAccurateTypes) +Fixture::assertInts(std::vector expVals, const std::string &attributeName, bool preserveAccurateTypes) { auto node = makeNode(attributeName, false, preserveAccurateTypes); uint32_t docId = 0; @@ -264,7 +264,7 @@ Fixture::assertInts(std::vector expVals, const ves } void -Fixture::assertBools(std::vector expVals, const vespalib::string &attributeName, bool preserveAccurateTypes) +Fixture::assertBools(std::vector expVals, const std::string &attributeName, bool preserveAccurateTypes) { auto node = makeNode(attributeName, false, preserveAccurateTypes); uint32_t docId = 0; @@ -282,13 +282,13 @@ Fixture::assertBools(std::vector expVals, const vespalib::string &attribut } void -Fixture::assertStrings(std::vector expVals, const vespalib::string &attributeName) { +Fixture::assertStrings(std::vector expVals, const std::string &attributeName) { assertStrings(expVals, attributeName, false); assertStrings(expVals, attributeName, true); } void -Fixture::assertStrings(std::vector expVals, const vespalib::string &attributeName, bool useEnumOptimization) +Fixture::assertStrings(std::vector expVals, const std::string &attributeName, bool useEnumOptimization) { auto node = makeNode(attributeName, useEnumOptimization); uint32_t docId = 0; @@ -305,13 +305,13 @@ Fixture::assertStrings(std::vector expVals, const vespalib::st } else { ASSERT_TRUE(result.inherits(StringResultNode::classId)); } - vespalib::string docVal = stringValue(result, *node->getAttribute()); + std::string docVal = stringValue(result, *node->getAttribute()); EXPECT_EQUAL(expDocVal, docVal); } } void -Fixture::assertFloats(std::vector expVals, const vespalib::string &attributeName) +Fixture::assertFloats(std::vector expVals, const std::string &attributeName) { auto node = makeNode(attributeName); uint32_t docId = 0; @@ -330,7 +330,7 @@ Fixture::assertFloats(std::vector expVals, const vespalib::string &attri } void -Fixture::assertIntArrays(std::vector> expVals, const vespalib::string &attributeName, bool preserveAccurateTypes) +Fixture::assertIntArrays(std::vector> expVals, const std::string &attributeName, bool preserveAccurateTypes) { auto node = makeNode(attributeName, false, preserveAccurateTypes); uint32_t docId = 0; @@ -355,7 +355,7 @@ Fixture::assertIntArrays(std::vector> } void -Fixture::assertStringArrays(std::vector> expVals, const vespalib::string &attributeName, bool useEnumOptimization) +Fixture::assertStringArrays(std::vector> expVals, const std::string &attributeName, bool useEnumOptimization) { auto node = makeNode(attributeName, useEnumOptimization); uint32_t docId = 0; @@ -371,7 +371,7 @@ Fixture::assertStringArrays(std::vector> expVals, } else { ASSERT_TRUE(result.inherits(StringResultNodeVector::classId)); } - std::vector docVals; + std::vector docVals; for (size_t i = 0; i < resultVector.size(); ++i) { docVals.push_back(stringValue(resultVector.get(i), *node->getAttribute())); } @@ -380,7 +380,7 @@ Fixture::assertStringArrays(std::vector> expVals, } void -Fixture::assertFloatArrays(std::vector> expVals, const vespalib::string &attributeName) +Fixture::assertFloatArrays(std::vector> expVals, const std::string &attributeName) { auto node = makeNode(attributeName); uint32_t docId = 0; diff --git a/searchlib/src/tests/expression/interpolated_document_field_lookup_node/interpolated_document_field_lookup_node_test.cpp b/searchlib/src/tests/expression/interpolated_document_field_lookup_node/interpolated_document_field_lookup_node_test.cpp index c131efcacb22..c49820e1c34e 100644 --- a/searchlib/src/tests/expression/interpolated_document_field_lookup_node/interpolated_document_field_lookup_node_test.cpp +++ b/searchlib/src/tests/expression/interpolated_document_field_lookup_node/interpolated_document_field_lookup_node_test.cpp @@ -19,7 +19,7 @@ using search::expression::FloatResultNode; using search::expression::InterpolatedDocumentFieldLookupNode; using search::test::DocBuilder; -const vespalib::string field_name("f"); +const std::string field_name("f"); struct Fixture { DocBuilder _builder; diff --git a/searchlib/src/tests/features/beta/beta_features_test.cpp b/searchlib/src/tests/features/beta/beta_features_test.cpp index 3a476b3682ba..2e49af3cf562 100644 --- a/searchlib/src/tests/features/beta/beta_features_test.cpp +++ b/searchlib/src/tests/features/beta/beta_features_test.cpp @@ -36,9 +36,9 @@ class BetaFeaturesTest : public ::testing::Test, BetaFeaturesTest(); ~BetaFeaturesTest() override; - void assertJaroWinklerDistance(const vespalib::string &query, const vespalib::string &field, feature_t expected); + void assertJaroWinklerDistance(const std::string &query, const std::string &field, feature_t expected); void assertQueryCompleteness(FtFeatureTest & ft, uint32_t firstOcc, uint32_t hits, uint32_t miss); - void assertTermEditDistance(const vespalib::string &query, const vespalib::string &field, + void assertTermEditDistance(const std::string &query, const std::string &field, uint32_t expectedDel, uint32_t expectedIns, uint32_t expectedSub); }; @@ -120,7 +120,7 @@ TEST_F(BetaFeaturesTest, test_jaro_winkler_distance) } void -BetaFeaturesTest::assertJaroWinklerDistance(const vespalib::string &query, const vespalib::string &field, feature_t expected) +BetaFeaturesTest::assertJaroWinklerDistance(const std::string &query, const std::string &field, feature_t expected) { FtFeatureTest ft(_factory, "jaroWinklerDistance(foo)"); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); @@ -166,7 +166,7 @@ TEST_F(BetaFeaturesTest, test_proximity) #ifdef VISIT_BETA_FEATURES for (uint32_t a = 0; a < 5; ++a) { for (uint32_t b = a + 1; b < 6; ++b) { - vespalib::string bn = vespalib::make_string("proximity(bar,%u,%u)", a, b); + std::string bn = vespalib::make_string("proximity(bar,%u,%u)", a, b); dump.add(bn + ".out"); dump.add(bn + ".posA"); dump.add(bn + ".posB"); @@ -387,7 +387,7 @@ TEST_F(BetaFeaturesTest, test_flow_completeness) StringList expDump; for (size_t i = 0; i < out.size(); ++i) { - vespalib::string fn = "flowCompleteness(foo)."; + std::string fn = "flowCompleteness(foo)."; fn.append(out[i]); expDump.push_back(fn); } @@ -532,7 +532,7 @@ TEST_F(BetaFeaturesTest, test_reverse_proximity) #ifdef VISIT_BETA_FEATURES for (uint32_t a = 0; a < 5; ++a) { for (uint32_t b = a + 1; b < 6; ++b) { - vespalib::string bn = vespalib::make_string("reverseProximity(bar,%u,%u)", a, b); + std::string bn = vespalib::make_string("reverseProximity(bar,%u,%u)", a, b); dump.add(bn + ".out"); dump.add(bn + ".posA"); dump.add(bn + ".posB"); @@ -641,7 +641,7 @@ TEST_F(BetaFeaturesTest, test_term_edit_distance) StringList dump; #ifdef VISIT_BETA_FEATURES ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "bar"); - vespalib::string bn = "termEditDistance(bar)"; + std::string bn = "termEditDistance(bar)"; dump.add(bn + ".out"); dump.add(bn + ".del"); dump.add(bn + ".ins"); @@ -665,11 +665,11 @@ TEST_F(BetaFeaturesTest, test_term_edit_distance) } void -BetaFeaturesTest::assertTermEditDistance(const vespalib::string &query, const vespalib::string &field, +BetaFeaturesTest::assertTermEditDistance(const std::string &query, const std::string &field, uint32_t expectedDel, uint32_t expectedIns, uint32_t expectedSub) { // Setup feature test. - vespalib::string feature = "termEditDistance(foo)"; + std::string feature = "termEditDistance(foo)"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); StringMap foo; diff --git a/searchlib/src/tests/features/bm25/bm25_test.cpp b/searchlib/src/tests/features/bm25/bm25_test.cpp index 85514a9ced76..9140f8c3a39f 100644 --- a/searchlib/src/tests/features/bm25/bm25_test.cpp +++ b/searchlib/src/tests/features/bm25/bm25_test.cpp @@ -15,7 +15,7 @@ using namespace search::features; using namespace search::fef; using namespace search::fef::objectstore; using CollectionType = FieldInfo::CollectionType; -using StringVector = std::vector; +using StringVector = std::vector; struct Bm25BlueprintTest : public ::testing::Test { BlueprintFactory factory; @@ -146,7 +146,7 @@ struct Bm25ExecutorTest : public ::testing::Test { add_query_term("bar", 45); test.getQueryEnv().getBuilder().set_avg_field_length("foo", 10); } - void add_query_term(const vespalib::string& field_name, uint32_t matching_doc_count) { + void add_query_term(const std::string& field_name, uint32_t matching_doc_count) { auto* term = test.getQueryEnv().getBuilder().addIndexNode({field_name}); term->field(0).setDocFreq(matching_doc_count, total_doc_count); term->setUniqueId(test.getQueryEnv().getNumTerms() - 1); diff --git a/searchlib/src/tests/features/closest/closest_test.cpp b/searchlib/src/tests/features/closest/closest_test.cpp index 526244e6b8cc..5fb46e637047 100644 --- a/searchlib/src/tests/features/closest/closest_test.cpp +++ b/searchlib/src/tests/features/closest/closest_test.cpp @@ -25,12 +25,12 @@ using vespalib::eval::Value; using vespalib::eval::spec_from_value; using vespalib::eval::value_from_spec; -const vespalib::string field_and_label_feature_name("closest(bar,nns)"); -const vespalib::string field_feature_name("closest(bar)"); +const std::string field_and_label_feature_name("closest(bar,nns)"); +const std::string field_feature_name("closest(bar)"); -const vespalib::string dense_tensor_type("tensor(x[2])"); -const vespalib::string mixed_tensor_type("tensor(a{},x[2])"); -const vespalib::string sparse_tensor_type("tensor(a{})"); +const std::string dense_tensor_type("tensor(x[2])"); +const std::string mixed_tensor_type("tensor(a{},x[2])"); +const std::string sparse_tensor_type("tensor(a{})"); TensorSpec no_subspace(sparse_tensor_type); TensorSpec subspace_a = TensorSpec::from_expr("tensor(a{}):{{a:\"a\"}:1}"); @@ -46,9 +46,9 @@ TensorSpec get_spec(RankFixture& f, uint32_t docid) { struct TestParam { - vespalib::string _name; + std::string _name; bool _direct_tensor; - TestParam(vespalib::string name, bool direct_tensor) + TestParam(std::string name, bool direct_tensor) : _name(std::move(name)), _direct_tensor(direct_tensor) { @@ -65,13 +65,13 @@ std::ostream& operator<<(std::ostream& os, const TestParam param) } void -assert_setup(vespalib::string field_name, +assert_setup(std::string field_name, bool exp_setup_result, - std::optional attr_type_spec, - std::optional label) + std::optional attr_type_spec, + std::optional label) { vespalib::asciistream feature_name; - std::vector setup_args; + std::vector setup_args; ClosestBlueprint f1; IndexEnvironmentFixture f2; DummyDependencyHandler deps(f1); @@ -95,8 +95,8 @@ class ClosestTest : public ::testing::TestWithParam ClosestTest(); ~ClosestTest(); bool direct_tensor() const noexcept { return GetParam()._direct_tensor; } - void assert_closest(const Labels& labels, const vespalib::string& feature_name, const vespalib::string& query_tensor, const TensorSpec& exp_spec); - void assert_closest(const Labels& labels, const vespalib::string& feature_name, const std::vector& exp_specs); + void assert_closest(const Labels& labels, const std::string& feature_name, const std::string& query_tensor, const TensorSpec& exp_spec); + void assert_closest(const Labels& labels, const std::string& feature_name, const std::vector& exp_specs); }; ClosestTest::ClosestTest() @@ -107,7 +107,7 @@ ClosestTest::ClosestTest() ClosestTest::~ClosestTest() = default; void -ClosestTest::assert_closest(const Labels& labels, const vespalib::string& feature_name, const vespalib::string& query_tensor, const TensorSpec& exp_spec) +ClosestTest::assert_closest(const Labels& labels, const std::string& feature_name, const std::string& query_tensor, const TensorSpec& exp_spec) { RankFixture f(mixed_tensor_type, direct_tensor(), 0, 1, labels, feature_name, dense_tensor_type + ":" + query_tensor); @@ -118,7 +118,7 @@ ClosestTest::assert_closest(const Labels& labels, const vespalib::string& featur } void -ClosestTest::assert_closest(const Labels& labels, const vespalib::string& feature_name, const std::vector& exp_specs) +ClosestTest::assert_closest(const Labels& labels, const std::string& feature_name, const std::vector& exp_specs) { assert_closest(labels, feature_name, "[9,10]", exp_specs[0]); assert_closest(labels, feature_name, "[1,10]", exp_specs[1]); diff --git a/searchlib/src/tests/features/constant/constant_test.cpp b/searchlib/src/tests/features/constant/constant_test.cpp index ae9c698372bd..c972fb265524 100644 --- a/searchlib/src/tests/features/constant/constant_test.cpp +++ b/searchlib/src/tests/features/constant/constant_test.cpp @@ -40,7 +40,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { @@ -63,7 +63,7 @@ struct ExecFixture double executeDouble(uint32_t docId = 1) { return extractDouble(docId); } - void addTensor(const vespalib::string &name, + void addTensor(const std::string &name, const TensorSpec &spec) { Value::UP tensor = make_tensor(spec); @@ -72,12 +72,12 @@ struct ExecFixture std::move(type), std::move(tensor)); } - void addDouble(const vespalib::string &name, const double value) { + void addDouble(const std::string &name, const double value) { test.getIndexEnv().addConstantValue(name, ValueType::double_type(), std::make_unique(value)); } - void addTypeValue(const vespalib::string &name, const vespalib::string &type, const vespalib::string &value) { + void addTypeValue(const std::string &name, const std::string &type, const std::string &value) { auto &props = test.getIndexEnv().getProperties(); auto type_prop = fmt("constant(%s).type", name.c_str()); auto value_prop = fmt("constant(%s).value", name.c_str()); diff --git a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp index 4118b395d2b4..37d476f8dcf0 100644 --- a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp +++ b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp @@ -15,8 +15,8 @@ using namespace search::fef::test; using namespace search::features; using CollectionType = FieldInfo::CollectionType; -std::vector featureNamesFoo() { - std::vector f; +std::vector featureNamesFoo() { + std::vector f; f.push_back("elementCompleteness(foo).completeness"); f.push_back("elementCompleteness(foo).fieldCompleteness"); f.push_back("elementCompleteness(foo).queryCompleteness"); @@ -54,9 +54,9 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - std::vector expect; + std::vector expect; size_t dumped; - virtual void visitDumpFeature(const vespalib::string &name) override { + virtual void visitDumpFeature(const std::string &name) override { EXPECT_LT(dumped, expect.size()); EXPECT_EQ(expect[dumped++], name); } @@ -66,12 +66,12 @@ struct FeatureDumpFixture : public IDumpFeatureVisitor { struct RankFixture : BlueprintFactoryFixture { Properties idxProps; RankFixture() : BlueprintFactoryFixture(), idxProps() {} - void test(const vespalib::string &queryStr, const FtIndex &index, + void test(const std::string &queryStr, const FtIndex &index, feature_t field, feature_t query, int32_t weight = 1, feature_t factor = 0.5, bool useStaleMatchData = false) { SCOPED_TRACE(queryStr); - std::vector names = featureNamesFoo(); + std::vector names = featureNamesFoo(); ASSERT_TRUE(names.size() == 4u); RankResult expect; expect.addScore(names[TOTAL], field*factor + query*(1-factor)) @@ -115,7 +115,7 @@ TEST(ElementCompletenessTest, require_that_setup_can_be_done_on_index_field) IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); } TEST(ElementCompletenessTest, require_that_setup_can_not_be_done_on_attribute_field) @@ -124,7 +124,7 @@ TEST(ElementCompletenessTest, require_that_setup_can_not_be_done_on_attribute_fi IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(bar)", f1.getBaseName().c_str())); - EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); + EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); } TEST(ElementCompletenessTest, require_that_default_config_parameters_are_correct) @@ -133,7 +133,7 @@ TEST(ElementCompletenessTest, require_that_default_config_parameters_are_correct IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); EXPECT_EQ(0u, f1.getParams().fieldId); EXPECT_EQ(0.5, f1.getParams().fieldCompletenessImportance); } @@ -144,7 +144,7 @@ TEST(ElementCompletenessTest, require_that_blueprint_can_be_configured){ DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); f2.indexEnv.getProperties().add("elementCompleteness(foo).fieldCompletenessImportance", "0.75"); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); EXPECT_EQ(0.75, f1.getParams().fieldCompletenessImportance); } diff --git a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp index 6d6830ea7dfc..c6a0e4e3f4c0 100644 --- a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp +++ b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp @@ -16,12 +16,12 @@ using namespace search::fef::test; using namespace search::features; using CollectionType = FieldInfo::CollectionType; -const vespalib::string DEFAULT = "elementSimilarity(foo)"; -const vespalib::string PROXIMITY = "elementSimilarity(foo).proximity"; -const vespalib::string ORDER = "elementSimilarity(foo).order"; -const vespalib::string QUERY = "elementSimilarity(foo).query_coverage"; -const vespalib::string FIELD = "elementSimilarity(foo).field_coverage"; -const vespalib::string WEIGHT = "elementSimilarity(foo).weight"; +const std::string DEFAULT = "elementSimilarity(foo)"; +const std::string PROXIMITY = "elementSimilarity(foo).proximity"; +const std::string ORDER = "elementSimilarity(foo).order"; +const std::string QUERY = "elementSimilarity(foo).query_coverage"; +const std::string FIELD = "elementSimilarity(foo).field_coverage"; +const std::string WEIGHT = "elementSimilarity(foo).weight"; FtIndex indexFoo() { FtIndex idx; @@ -55,7 +55,7 @@ struct IndexFixture { set("elementSimilarity(foo).output.weight", "max(w)"); set("elementSimilarity(bar).output.default", "avg(1)"); } - IndexFixture &set(const vespalib::string &key, const vespalib::string &value) { + IndexFixture &set(const std::string &key, const std::string &value) { Properties tmp; tmp.add(key, value); indexEnv.getProperties().import(tmp); @@ -64,10 +64,10 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - std::vector actual; + std::vector actual; FeatureDumpFixture() : IDumpFeatureVisitor(), actual() {} ~FeatureDumpFixture() override; - virtual void visitDumpFeature(const vespalib::string &name) override { + virtual void visitDumpFeature(const std::string &name) override { actual.push_back(name); } }; @@ -76,10 +76,10 @@ FeatureDumpFixture::~FeatureDumpFixture() = default; struct RankFixture : BlueprintFactoryFixture { RankFixture() : BlueprintFactoryFixture() {} - double get_feature(const vespalib::string &query, const FtIndex &index, const vespalib::string &select, + double get_feature(const std::string &query, const FtIndex &index, const std::string &select, const IndexFixture &idx_env = IndexFixture()) { - std::vector names({"elementSimilarity(foo).default", // use 'default' explicitly to verify default output name + std::vector names({"elementSimilarity(foo).default", // use 'default' explicitly to verify default output name "elementSimilarity(foo).proximity", "elementSimilarity(foo).order", "elementSimilarity(foo).query_coverage", @@ -145,11 +145,11 @@ bool cmp_lists_impl(const A &a, const B &b) { } template -void dump_list(const vespalib::string &name, const T &list) { +void dump_list(const std::string &name, const T &list) { fprintf(stderr, "list(name: '%s', size: %zu)\n", name.c_str(), list.size()); std::vector tmp(list.begin(), list.end()); std::sort(tmp.begin(), tmp.end()); - for (vespalib::string item: tmp) { + for (std::string item: tmp) { fprintf(stderr, " '%s'\n", item.c_str()); } } @@ -180,7 +180,7 @@ TEST(ElementSimilarityFeatureTest, require_that_appropriate_features_are_dumped) IndexFixture f2; FeatureDumpFixture f3; f1.visitDumpFeatures(f2.indexEnv, f3); - EXPECT_TRUE(cmp_lists(std::vector({"elementSimilarity(foo)", + EXPECT_TRUE(cmp_lists(std::vector({"elementSimilarity(foo)", "elementSimilarity(foo).proximity", "elementSimilarity(foo).order", "elementSimilarity(foo).query_coverage", @@ -190,10 +190,10 @@ TEST(ElementSimilarityFeatureTest, require_that_appropriate_features_are_dumped) f3.actual)); } -bool try_setup(ElementSimilarityBlueprint &blueprint, const IndexFixture &index, const vespalib::string &field) { +bool try_setup(ElementSimilarityBlueprint &blueprint, const IndexFixture &index, const std::string &field) { DummyDependencyHandler deps(blueprint); blueprint.setName(vespalib::make_string("%s(%s)", blueprint.getBaseName().c_str(), field.c_str())); - return ((Blueprint&)blueprint).setup(index.indexEnv, std::vector(1, field)); + return ((Blueprint&)blueprint).setup(index.indexEnv, std::vector(1, field)); } TEST(ElementSimilarityFeatureTest, require_that_setup_can_be_done_on_weighted_set_index_field) diff --git a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp index 82e227e0d357..969867e6f5ed 100644 --- a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp +++ b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp @@ -59,7 +59,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp index 1c208cb05377..10c97192c22a 100644 --- a/searchlib/src/tests/features/featurebenchmark.cpp +++ b/searchlib/src/tests/features/featurebenchmark.cpp @@ -42,46 +42,46 @@ using CollectionType = FieldInfo::CollectionType; class Benchmark : public ::testing::Test, public FtTestAppBase { public: - using KeyValueVector = std::vector >; + using KeyValueVector = std::vector >; class Config { private: - using StringMap = std::map; + using StringMap = std::map; StringMap _config; - bool isKnown(const vespalib::string & key) const; + bool isKnown(const std::string & key) const; public: Config() : _config() {} - Config(const vespalib::string & fileName) : _config() { + Config(const std::string & fileName) : _config() { init(fileName); } - void init(const vespalib::string & fileName); + void init(const std::string & fileName); - void add(const vespalib::string & key, const vespalib::string & value) { + void add(const std::string & key, const std::string & value) { _config[key] = value; } - void addIfNotFound(const vespalib::string & key, const vespalib::string & value) { + void addIfNotFound(const std::string & key, const std::string & value) { if (_config.count(key) == 0) { add(key, value); } } // known config values - vespalib::string getCase(const vespalib::string & fallback = "") const { + std::string getCase(const std::string & fallback = "") const { return getAsStr("case", fallback); } - vespalib::string getFeature(const vespalib::string & fallback = "") const { + std::string getFeature(const std::string & fallback = "") const { return getAsStr("feature", fallback); } - vespalib::string getIndex(const vespalib::string & fallback = "") const { + std::string getIndex(const std::string & fallback = "") const { return getAsStr("index", fallback); } - vespalib::string getQuery(const vespalib::string & fallback = "") const { + std::string getQuery(const std::string & fallback = "") const { return getAsStr("query", fallback); } - vespalib::string getField(const vespalib::string & fallback = "") const { + std::string getField(const std::string & fallback = "") const { return getAsStr("field", fallback); } uint32_t getNumRuns(uint32_t fallback = 1000) const { @@ -89,17 +89,17 @@ class Benchmark : public ::testing::Test, } // access "unknown" config values - vespalib::string getAsStr(const vespalib::string & key, const vespalib::string & fallback = "") const { + std::string getAsStr(const std::string & key, const std::string & fallback = "") const { StringMap::const_iterator itr = _config.find(key); if (itr != _config.end()) { - return vespalib::string(itr->second); + return std::string(itr->second); } - return vespalib::string(fallback); + return std::string(fallback); } - uint32_t getAsUint32(const vespalib::string & key, uint32_t fallback = 0) const { + uint32_t getAsUint32(const std::string & key, uint32_t fallback = 0) const { return util::strToNum(getAsStr(key, vespalib::make_string("%u", fallback))); } - double getAsDouble(const vespalib::string & key, double fallback = 0) const { + double getAsDouble(const std::string & key, double fallback = 0) const { return util::strToNum(getAsStr(key, vespalib::make_string("%f", fallback))); } @@ -121,12 +121,12 @@ class Benchmark : public ::testing::Test, void runFieldMatch(Config & cfg); void runRankingExpression(Config & cfg); - AttributePtr createAttributeVector(AVBT dt, const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, + AttributePtr createAttributeVector(AVBT dt, const std::string & name, const std::string & ctype, uint32_t numDocs, AttributeVector::largeint_t value, uint32_t valueCount); - AttributePtr createAttributeVector(const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, + AttributePtr createAttributeVector(const std::string & name, const std::string & ctype, uint32_t numDocs, AttributeVector::largeint_t value, uint32_t valueCount); - AttributePtr createStringAttributeVector(const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, - const std::vector & values); + AttributePtr createStringAttributeVector(const std::string & name, const std::string & ctype, uint32_t numDocs, + const std::vector & values); void runAttributeMatch(Config & cfg); void runAttribute(Config & cfg); void runDotProduct(Config & cfg); @@ -155,14 +155,14 @@ Benchmark::Benchmark(int argc, char **argv) Benchmark::~Benchmark() = default; bool -Benchmark::Config::isKnown(const vespalib::string & key) const +Benchmark::Config::isKnown(const std::string & key) const { - if (key == vespalib::string("case") || - key == vespalib::string("feature") || - key == vespalib::string("index") || - key == vespalib::string("query") || - key == vespalib::string("field") || - key == vespalib::string("numruns")) + if (key == std::string("case") || + key == std::string("feature") || + key == std::string("index") || + key == std::string("query") || + key == std::string("field") || + key == std::string("numruns")) { return true; } @@ -170,7 +170,7 @@ Benchmark::Config::isKnown(const vespalib::string & key) const } void -Benchmark::Config::init(const vespalib::string & fileName) +Benchmark::Config::init(const std::string & fileName) { std::ifstream is(fileName.c_str()); if (is.fail()) { @@ -181,7 +181,7 @@ Benchmark::Config::init(const vespalib::string & fileName) std::string line; std::getline(is, line); if (!line.empty()) { - std::vector values = FtUtil::tokenize(line, "="); + std::vector values = FtUtil::tokenize(line, "="); assert(values.size() == 2); add(values[0], values[1]); } @@ -239,10 +239,10 @@ Benchmark::runFieldMatch(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); - vespalib::string index = cfg.getIndex(); - vespalib::string query = cfg.getQuery(); - vespalib::string field = cfg.getField(); + std::string feature = cfg.getFeature(); + std::string index = cfg.getIndex(); + std::string query = cfg.getQuery(); + std::string field = cfg.getField(); uint32_t numRuns = cfg.getNumRuns(); FtFeatureTest ft(_factory, feature); @@ -268,7 +268,7 @@ Benchmark::runRankingExpression(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = cfg.getNumRuns(); FtFeatureTest ft(_factory, feature); @@ -284,14 +284,14 @@ Benchmark::runRankingExpression(Config & cfg) } AttributePtr -Benchmark::createAttributeVector(const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, +Benchmark::createAttributeVector(const std::string & name, const std::string & ctype, uint32_t numDocs, AttributeVector::largeint_t value, uint32_t valueCount) { return createAttributeVector(AVBT::INT32, name, ctype, numDocs, value, valueCount); } AttributePtr -Benchmark::createAttributeVector(AVBT dt, const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, +Benchmark::createAttributeVector(AVBT dt, const std::string & name, const std::string & ctype, uint32_t numDocs, AttributeVector::largeint_t value, uint32_t valueCount) { AttributePtr a; @@ -327,8 +327,8 @@ Benchmark::createAttributeVector(AVBT dt, const vespalib::string & name, const v } AttributePtr -Benchmark::createStringAttributeVector(const vespalib::string & name, const vespalib::string & ctype, uint32_t numDocs, - const std::vector & values) +Benchmark::createStringAttributeVector(const std::string & name, const std::string & ctype, uint32_t numDocs, + const std::vector & values) { AttributePtr a; if (ctype == "single") { @@ -367,7 +367,7 @@ Benchmark::runAttributeMatch(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = 1000000; uint32_t numDocs = 1000000; @@ -406,7 +406,7 @@ Benchmark::runAttribute(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = cfg.getNumRuns(); uint32_t numDocs = cfg.getAsUint32("numdocs", 1000); StringList values; @@ -439,9 +439,9 @@ Benchmark::runDotProduct(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); - vespalib::string collectionType = cfg.getAsStr("collectiontype", "wset"); - vespalib::string dataType = cfg.getAsStr("datatype", "string"); + std::string feature = cfg.getFeature(); + std::string collectionType = cfg.getAsStr("collectiontype", "wset"); + std::string dataType = cfg.getAsStr("datatype", "string"); uint32_t numRuns = cfg.getNumRuns(); uint32_t numDocs = cfg.getAsUint32("numdocs", 1000); uint32_t numValues = cfg.getAsUint32("numvalues", 10); @@ -490,7 +490,7 @@ Benchmark::runNativeAttributeMatch(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = cfg.getNumRuns(); uint32_t numDocs = cfg.getAsUint32("numdocs"); @@ -531,13 +531,13 @@ Benchmark::runNativeFieldMatch(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = cfg.getNumRuns(); FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); ft.getIndexEnv().getTableManager().addFactory(ITableFactory::SP(new FunctionTableFactory(256))); // same as backend - std::vector searchedFields; + std::vector searchedFields; searchedFields.push_back("foo"); ft.getQueryEnv().getBuilder().addIndexNode(searchedFields); setupPropertyMap(ft.getIndexEnv().getProperties(), cfg.getUnknown()); @@ -570,13 +570,13 @@ Benchmark::runNativeProximity(Config & cfg) std::cout << cfg << std::endl; std::cout << "**** config ****" << std::endl; - vespalib::string feature = cfg.getFeature(); + std::string feature = cfg.getFeature(); uint32_t numRuns = cfg.getNumRuns(); FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); ft.getIndexEnv().getTableManager().addFactory(ITableFactory::SP(new FunctionTableFactory(256))); // same as backend - std::vector searchedFields; + std::vector searchedFields; searchedFields.push_back("foo"); ft.getQueryEnv().getBuilder().addIndexNode(searchedFields); // termId 0 ft.getQueryEnv().getBuilder().addIndexNode(searchedFields); // termId 1 @@ -611,8 +611,8 @@ Benchmark::TestBody() int opt; bool optError = false; - vespalib::string file; - vespalib::string feature; + std::string file; + std::string feature; while ((opt = getopt(_argc, _argv, "c:f:")) != -1) { switch (opt) { case 'c': @@ -639,21 +639,21 @@ Benchmark::TestBody() cfg.init(file); } - if (cfg.getCase() == vespalib::string("fieldMatch")) { + if (cfg.getCase() == std::string("fieldMatch")) { runFieldMatch(cfg); - } else if (cfg.getCase() == vespalib::string("rankingExpression")) { + } else if (cfg.getCase() == std::string("rankingExpression")) { runRankingExpression(cfg); - } else if (cfg.getCase() == vespalib::string("attributeMatch")) { + } else if (cfg.getCase() == std::string("attributeMatch")) { runAttributeMatch(cfg); - } else if (cfg.getCase() == vespalib::string("attribute")) { + } else if (cfg.getCase() == std::string("attribute")) { runAttribute(cfg); - } else if (cfg.getCase() == vespalib::string("dotProduct")) { + } else if (cfg.getCase() == std::string("dotProduct")) { runDotProduct(cfg); - } else if (cfg.getCase() == vespalib::string("nativeAttributeMatch")) { + } else if (cfg.getCase() == std::string("nativeAttributeMatch")) { runNativeAttributeMatch(cfg); - } else if (cfg.getCase() == vespalib::string("nativeFieldMatch")) { + } else if (cfg.getCase() == std::string("nativeFieldMatch")) { runNativeFieldMatch(cfg); - } else if (cfg.getCase() == vespalib::string("nativeProximity")) { + } else if (cfg.getCase() == std::string("nativeProximity")) { runNativeProximity(cfg); } else { std::cout << "feature case '" << cfg.getCase() << "' is not known" << std::endl; diff --git a/searchlib/src/tests/features/first_phase_rank/first_phase_rank_test.cpp b/searchlib/src/tests/features/first_phase_rank/first_phase_rank_test.cpp index 01ba6c361240..6d8ecd9af66a 100644 --- a/searchlib/src/tests/features/first_phase_rank/first_phase_rank_test.cpp +++ b/searchlib/src/tests/features/first_phase_rank/first_phase_rank_test.cpp @@ -18,7 +18,7 @@ using search::fef::BlueprintFactory; using search::fef::ObjectStore; using search::fef::test::IndexEnvironment; using search::fef::test::DummyDependencyHandler; -using StringVector = std::vector; +using StringVector = std::vector; constexpr feature_t unranked = std::numeric_limits::max(); @@ -40,7 +40,7 @@ struct FirstPhaseRankBlueprintTest : public ::testing::Test { return factory.createBlueprint("firstPhaseRank"); } - void expect_setup_fail(const StringVector& params, const vespalib::string& exp_fail_msg) { + void expect_setup_fail(const StringVector& params, const std::string& exp_fail_msg) { auto blueprint = make_blueprint(); DummyDependencyHandler deps(*blueprint); EXPECT_FALSE(blueprint->setup(index_env, params)); diff --git a/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp index 4f3ec22ce0f5..47c631690a73 100644 --- a/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp +++ b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp @@ -22,7 +22,7 @@ using vespalib::eval::SimpleValue; using vespalib::eval::TensorSpec; template -std::unique_ptr create_param(const vespalib::string& param) { +std::unique_ptr create_param(const std::string& param) { Properties props; props.add("foo", param); return std::make_unique>(props.lookup("foo")); @@ -41,7 +41,7 @@ struct FixtureBase : ImportedAttributeFixture { virtual void setup_integer_mappings(BasicType int_type) = 0; void check_single_execution(feature_t expected, - const vespalib::string& vector, + const std::string& vector, DocId doc_id, std::unique_ptr pre_parsed = std::unique_ptr()) { RankResult result; @@ -69,9 +69,9 @@ struct FixtureBase : ImportedAttributeFixture { void check_executions(PerTypeSetupFunctor setup_func, const std::vector& types, feature_t expected, - const vespalib::string& vector, + const std::string& vector, DocId doc_id, - const vespalib::string& shared_param = "") { + const std::string& shared_param = "") { for (auto type : types) { setup_func(type); std::unique_ptr pre_parsed; @@ -83,9 +83,9 @@ struct FixtureBase : ImportedAttributeFixture { } void check_all_integer_executions(feature_t expected, - const vespalib::string& vector, + const std::string& vector, DocId doc_id, - const vespalib::string& shared_param = "") { + const std::string& shared_param = "") { check_executions([this](auto int_type){ this->setup_integer_mappings(int_type); }, {{BasicType::INT32}}, expected, vector, doc_id, shared_param); @@ -144,7 +144,7 @@ struct ArrayFixture : FixtureBase { void check_prepare_state_output(const vespalib::eval::Value & tensor, const ExpectedType & expected) { vespalib::nbostream os; encode_value(tensor, os); - vespalib::string input_vector(os.data(), os.size()); + std::string input_vector(os.data(), os.size()); check_prepare_state_output(".tensor", input_vector, expected); } @@ -155,7 +155,7 @@ struct ArrayFixture : FixtureBase { } template - void check_prepare_state_output(const vespalib::string& input_vector, const ExpectedType & expected) { + void check_prepare_state_output(const std::string& input_vector, const ExpectedType & expected) { check_prepare_state_output("", input_vector, expected); } template @@ -166,7 +166,7 @@ struct ArrayFixture : FixtureBase { } } template - void check_prepare_state_output(const vespalib::string & postfix, const vespalib::string& input_vector, const ExpectedType & expected) { + void check_prepare_state_output(const std::string & postfix, const std::string& input_vector, const ExpectedType & expected) { FtFeatureTest feature(_factory, ""); DotProductBlueprint bp; DummyDependencyHandler dependency_handler(bp); @@ -189,8 +189,8 @@ struct ArrayFixture : FixtureBase { verify(expected, *as_object); } - void check_all_float_executions(feature_t expected, const vespalib::string& vector, - DocId doc_id, const vespalib::string& shared_param = "") + void check_all_float_executions(feature_t expected, const std::string& vector, + DocId doc_id, const std::string& shared_param = "") { check_executions([this](auto float_type){ this->setup_float_mappings(float_type); }, {{BasicType::FLOAT}}, diff --git a/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp b/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp index 57e1f22171fe..e9d94536a8ab 100644 --- a/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp +++ b/searchlib/src/tests/features/internal_max_reduce_prod_join_feature/internal_max_reduce_prod_join_feature_test.cpp @@ -38,7 +38,7 @@ struct SetupFixture addAttribute("doublearray", CollectionType::ARRAY, DataType::DOUBLE); } - void addAttribute(const vespalib::string &name, const CollectionType &collType, const DataType &dataType) { + void addAttribute(const std::string &name, const CollectionType &collType, const DataType &dataType) { FieldInfo attrInfo(FieldType::ATTRIBUTE, collType, name, 0); attrInfo.set_data_type(dataType); indexEnv.getFields().push_back(attrInfo); @@ -91,7 +91,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { @@ -102,8 +102,8 @@ struct ExecFixture } void setupAttributeVectors() { - vespalib::string attrIntArray = "intarray"; - vespalib::string attrLongArray = "longarray"; + std::string attrIntArray = "intarray"; + std::string attrLongArray = "longarray"; test.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::ARRAY, DataType::INT64, attrLongArray); test.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::ARRAY, DataType::INT32, attrIntArray); diff --git a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp index 59a8f6006b65..d3a2fbef1be2 100644 --- a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp +++ b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp @@ -18,7 +18,7 @@ using namespace search::fef::test; using namespace search::features; using CollectionType = FieldInfo::CollectionType; -const vespalib::string featureName("itemRawScore(label)"); +const std::string featureName("itemRawScore(label)"); struct BlueprintFactoryFixture { BlueprintFactory factory; @@ -39,7 +39,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) override { + virtual void visitDumpFeature(const std::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} @@ -113,7 +113,7 @@ TEST_FFF("require that no features are dumped", ItemRawScoreBlueprint, IndexFixt TEST_FF("require that setup can be done on random label", ItemRawScoreBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(random_label)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "random_label"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "random_label"))); } TEST_FF("require that no label gives 0.0 item raw score", NoLabel(), RankFixture(2, 2, f1)) { diff --git a/searchlib/src/tests/features/max_reduce_prod_join_replacer/max_reduce_prod_join_replacer_test.cpp b/searchlib/src/tests/features/max_reduce_prod_join_replacer/max_reduce_prod_join_replacer_test.cpp index 752ff3d75f07..d3a052c59dc0 100644 --- a/searchlib/src/tests/features/max_reduce_prod_join_replacer/max_reduce_prod_join_replacer_test.cpp +++ b/searchlib/src/tests/features/max_reduce_prod_join_replacer/max_reduce_prod_join_replacer_test.cpp @@ -29,7 +29,7 @@ struct MyBlueprint : Blueprint { MyBlueprint(bool &was_used_out) : Blueprint("my_bp"), was_used(was_used_out) {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return std::make_unique(was_used); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { EXPECT_EQUAL(getName(), "my_bp(foo,bar)"); ASSERT_TRUE(params.size() == 2); EXPECT_EQUAL(params[0], "foo"); @@ -43,7 +43,7 @@ struct MyBlueprint : Blueprint { } }; -bool replaced(const vespalib::string &expr) { +bool replaced(const std::string &expr) { bool was_used = false; ExpressionReplacer::UP replacer = MaxReduceProdJoinReplacer::create(std::make_unique(was_used)); auto rank_function = Function::parse(expr, FeatureNameExtractor()); diff --git a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp index 45b7f089445f..5d610ba61245 100644 --- a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp +++ b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp @@ -39,7 +39,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) override { + virtual void visitDumpFeature(const std::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} @@ -84,7 +84,7 @@ struct RankFixture : BlueprintFactoryFixture, IndexFixture { std::vector barHandles; RankFixture(const std::vector &fooWeights, const std::vector &barWeights, - const vespalib::string &featureName = fooFeatureName) + const std::string &featureName = fooFeatureName) : queryEnv(&indexEnv), rankSetup(factory, indexEnv), mdl(), match_data(), rankProgram(), fooHandles(), barHandles() { @@ -143,25 +143,25 @@ TEST_FFF("require that no features are dumped", NativeDotProductBlueprint, Index TEST_FF("require that setup can be done on index field", NativeDotProductBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); } TEST_FF("require that setup can be done on attribute field", NativeDotProductBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(bar)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); } TEST_FF("require that setup fails for unknown field", NativeDotProductBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(unknown)", f1.getBaseName().c_str())); - EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "unknown"))); + EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "unknown"))); } TEST_FF("require that setup can be done without field", NativeDotProductBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector())); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector())); } TEST_F("require that not searching a field will give it 0.0 dot product", RankFixture(vec(), vec(1, 2, 3))) { diff --git a/searchlib/src/tests/features/nns_closeness/nns_closeness_test.cpp b/searchlib/src/tests/features/nns_closeness/nns_closeness_test.cpp index 908bb2a7d844..77952f418742 100644 --- a/searchlib/src/tests/features/nns_closeness/nns_closeness_test.cpp +++ b/searchlib/src/tests/features/nns_closeness/nns_closeness_test.cpp @@ -19,8 +19,8 @@ using namespace search::fef; using search::attribute::DistanceMetric; using vespalib::eval::TensorSpec; -const vespalib::string labelFeatureName("closeness(label,nns)"); -const vespalib::string fieldFeatureName("closeness(bar)"); +const std::string labelFeatureName("closeness(label,nns)"); +const std::string fieldFeatureName("closeness(bar)"); using RankFixture = DistanceClosenessFixture; @@ -46,7 +46,7 @@ TEST(NnsClosenessTest, require_that_setup_can_be_done_on_random_label) IndexEnvironmentFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(label,random_label)", f1.getBaseName().c_str())); - EXPECT_TRUE(static_cast(f1).setup(f2.indexEnv, std::vector{"label", "random_label"})); + EXPECT_TRUE(static_cast(f1).setup(f2.indexEnv, std::vector{"label", "random_label"})); } TEST(NnsClosenessTest, require_that_no_label_gives_0_closeness) diff --git a/searchlib/src/tests/features/nns_distance/nns_distance_test.cpp b/searchlib/src/tests/features/nns_distance/nns_distance_test.cpp index 899363c76526..432825de5d90 100644 --- a/searchlib/src/tests/features/nns_distance/nns_distance_test.cpp +++ b/searchlib/src/tests/features/nns_distance/nns_distance_test.cpp @@ -17,8 +17,8 @@ using namespace search::fef; using vespalib::eval::TensorSpec; -const vespalib::string labelFeatureName("distance(label,nns)"); -const vespalib::string fieldFeatureName("distance(bar)"); +const std::string labelFeatureName("distance(label,nns)"); +const std::string fieldFeatureName("distance(bar)"); using RankFixture = DistanceClosenessFixture; @@ -44,7 +44,7 @@ TEST(NnsDistanceTest, require_that_setup_can_be_done_on_random_label) IndexEnvironmentFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(label,random_label)", f1.getBaseName().c_str())); - EXPECT_TRUE(static_cast(f1).setup(f2.indexEnv, std::vector{"label", "random_label"})); + EXPECT_TRUE(static_cast(f1).setup(f2.indexEnv, std::vector{"label", "random_label"})); } TEST(NnsDistanceTest, require_that_setup_with_unknown_field_fails) @@ -53,7 +53,7 @@ TEST(NnsDistanceTest, require_that_setup_with_unknown_field_fails) IndexEnvironmentFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(field,random_fieldname)", f1.getBaseName().c_str())); - EXPECT_FALSE(static_cast(f1).setup(f2.indexEnv, std::vector{"field", "random_fieldname"})); + EXPECT_FALSE(static_cast(f1).setup(f2.indexEnv, std::vector{"field", "random_fieldname"})); } TEST(NnsDistanceTest, require_that_no_label_gives_max_double_distance) diff --git a/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp b/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp index 07cb9e422d59..cf9eac0c9529 100644 --- a/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp +++ b/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include using namespace search::fef; using namespace search::fef::test; @@ -34,15 +34,15 @@ std::string fragile_model = source_dir + "/" + "fragile.onnx"; uint32_t default_docid = 1; -vespalib::string expr_feature(const vespalib::string &name) { +std::string expr_feature(const std::string &name) { return fmt("rankingExpression(%s)", name.c_str()); } -vespalib::string onnx_feature(const vespalib::string &name) { +std::string onnx_feature(const std::string &name) { return fmt("onnx(%s)", name.c_str()); } -vespalib::string onnx_feature_old(const vespalib::string &name) { +std::string onnx_feature_old(const std::string &name) { return fmt("onnxModel(%s)", name.c_str()); } @@ -62,15 +62,15 @@ struct OnnxFeatureTest : ::testing::Test { factory.addPrototype(std::make_shared("onnxModel")); } ~OnnxFeatureTest() override; - void add_expr(const vespalib::string &name, const vespalib::string &expr) { - vespalib::string feature_name = expr_feature(name); - vespalib::string expr_name = feature_name + ".rankingScript"; + void add_expr(const std::string &name, const std::string &expr) { + std::string feature_name = expr_feature(name); + std::string expr_name = feature_name + ".rankingScript"; indexEnv.getProperties().add(expr_name, expr); } void add_onnx(OnnxModel model) { indexEnv.addOnnxModel(std::move(model)); } - bool try_compile(const vespalib::string &seed) { + bool try_compile(const std::string &seed) { resolver->addSeed(seed); if (!resolver->compile()) { return false; @@ -81,10 +81,10 @@ struct OnnxFeatureTest : ::testing::Test { program.setup(*match_data, queryEnv, overrides); return true; } - void compile(const vespalib::string &seed) { + void compile(const std::string &seed) { ASSERT_TRUE(try_compile(seed)); } - TensorSpec get(const vespalib::string &feature, uint32_t docid) const { + TensorSpec get(const std::string &feature, uint32_t docid) const { auto result = program.get_all_features(false); for (size_t i = 0; i < result.num_features(); ++i) { if (result.name_of(i) == feature) { @@ -176,7 +176,7 @@ TEST_F(OnnxFeatureTest, fragile_model_can_be_evaluated) { } struct MyIssues : Issue::Handler { - std::vector list; + std::vector list; Issue::Binding capture; MyIssues() : list(), capture(Issue::listen(*this)) {} ~MyIssues() override; diff --git a/searchlib/src/tests/features/prod_features_fieldmatch.cpp b/searchlib/src/tests/features/prod_features_fieldmatch.cpp index 668152473449..b515a23e6180 100644 --- a/searchlib/src/tests/features/prod_features_fieldmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldmatch.cpp @@ -110,7 +110,7 @@ Test::testFieldMatchBluePrint() StringList dump; ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "bar"); - vespalib::string bn = "fieldMatch(bar)"; + std::string bn = "fieldMatch(bar)"; dump.add(bn); for (uint32_t i = 1; i < out.size(); ++i) { dump.add(bn + "." + out[i]); @@ -124,7 +124,7 @@ Test::testFieldMatchBluePrint() ie.getFields()[0].setFilter(true); StringList dump; - vespalib::string bn = "fieldMatch(foo)"; + std::string bn = "fieldMatch(foo)"; dump.add(bn); dump.add(bn + ".completeness"); dump.add(bn + ".queryCompleteness"); @@ -892,7 +892,7 @@ Test::testFieldMatchExecutorRemaining() { // test with a query on an attribute field LOG(info, "Query on an attribute field"); - vespalib::string feature = "fieldMatch(foo)"; + std::string feature = "fieldMatch(foo)"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "bar"); diff --git a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp index 921b690bf6f7..4d082eaf2f4c 100644 --- a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp @@ -43,7 +43,7 @@ TEST_F(ProdFeaturesTest, test_field_term_match) StringList dump; ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "bar"); for (uint32_t term = 0; term < 5; ++term) { - vespalib::string bn = vespalib::make_string("fieldTermMatch(bar,%u)", term); + std::string bn = vespalib::make_string("fieldTermMatch(bar,%u)", term); dump.add(bn + ".firstPosition").add(bn + ".occurrences").add(bn + ".weight"); } FT_DUMP(_factory, "fieldTermMatch", ie, dump); diff --git a/searchlib/src/tests/features/prod_features_test.cpp b/searchlib/src/tests/features/prod_features_test.cpp index abc306392ac7..42d9c3f6a897 100644 --- a/searchlib/src/tests/features/prod_features_test.cpp +++ b/searchlib/src/tests/features/prod_features_test.cpp @@ -97,39 +97,39 @@ TEST_F(ProdFeaturesTest, test_ft_lib) { // toQuery FtQuery q = FtUtil::toQuery("a b!50 0.5:c!200%0.5 d%0.3 e!300 0.3:f "); ASSERT_TRUE(q.size() == 6); - EXPECT_EQ(q[0].term, vespalib::string("a")); + EXPECT_EQ(q[0].term, std::string("a")); EXPECT_EQ(q[0].termWeight.percent(), 100); EXPECT_NEAR(q[0].connexity, 0.1f, EPS); EXPECT_NEAR(q[0].significance, 0.1f, EPS); - EXPECT_EQ(q[1].term, vespalib::string("b")); + EXPECT_EQ(q[1].term, std::string("b")); EXPECT_EQ(q[1].termWeight.percent(), 50); EXPECT_NEAR(q[1].connexity, 0.1f, EPS); EXPECT_NEAR(q[1].significance, 0.1f, EPS); - EXPECT_EQ(q[2].term, vespalib::string("c")); + EXPECT_EQ(q[2].term, std::string("c")); EXPECT_EQ(q[2].termWeight.percent(), 200); EXPECT_NEAR(q[2].connexity, 0.5f, EPS); EXPECT_NEAR(q[2].significance, 0.5f, EPS); - EXPECT_EQ(q[3].term, vespalib::string("d")); + EXPECT_EQ(q[3].term, std::string("d")); EXPECT_EQ(q[3].termWeight.percent(), 100); EXPECT_NEAR(q[3].connexity, 0.1f, EPS); EXPECT_NEAR(q[3].significance, 0.3f, EPS); - EXPECT_EQ(q[4].term, vespalib::string("e")); + EXPECT_EQ(q[4].term, std::string("e")); EXPECT_EQ(q[4].termWeight.percent(), 300); EXPECT_NEAR(q[4].connexity, 0.1f, EPS); EXPECT_NEAR(q[4].significance, 0.1f, EPS); - EXPECT_EQ(q[5].term, vespalib::string("f")); + EXPECT_EQ(q[5].term, std::string("f")); EXPECT_EQ(q[5].termWeight.percent(), 100); EXPECT_NEAR(q[5].connexity, 0.3f, EPS); EXPECT_NEAR(q[5].significance, 0.1f, EPS); } { // toRankResult RankResult rr = toRankResult("foo", "a:0.5 b:-0.5 c:2 d:3 "); - std::vector keys = rr.getKeys(); + std::vector keys = rr.getKeys(); ASSERT_TRUE(keys.size() == 4); - EXPECT_EQ(keys[0], vespalib::string("foo.a")); - EXPECT_EQ(keys[1], vespalib::string("foo.b")); - EXPECT_EQ(keys[2], vespalib::string("foo.c")); - EXPECT_EQ(keys[3], vespalib::string("foo.d")); + EXPECT_EQ(keys[0], std::string("foo.a")); + EXPECT_EQ(keys[1], std::string("foo.b")); + EXPECT_EQ(keys[2], std::string("foo.c")); + EXPECT_EQ(keys[3], std::string("foo.d")); EXPECT_NEAR(rr.getScore("foo.a"), 0.5f, EPS); EXPECT_NEAR(rr.getScore("foo.b"), -0.5f, EPS); EXPECT_NEAR(rr.getScore("foo.c"), 2.0f, EPS); @@ -165,9 +165,9 @@ TEST_F(ProdFeaturesTest, test_age) } void -Test::assertAge(feature_t expAge, const vespalib::string & attr, uint64_t now, uint64_t docTime) +Test::assertAge(feature_t expAge, const std::string & attr, uint64_t now, uint64_t docTime) { - vespalib::string feature = "age(" + attr + ")"; + std::string feature = "age(" + attr + ")"; FtFeatureTest ft(_factory, feature); setupForAgeTest(ft, docTime); ft.getQueryEnv().getProperties().add(queryproperties::now::SystemTime::NAME, @@ -474,9 +474,9 @@ TEST_F(ProdFeaturesTest, test_closeness) } void -Test::assertCloseness(feature_t exp, const vespalib::string & attr, double distance, double maxDistance, double halfResponse) +Test::assertCloseness(feature_t exp, const std::string & attr, double distance, double maxDistance, double halfResponse) { - vespalib::string feature = "closeness(" + attr + ")"; + std::string feature = "closeness(" + attr + ")"; FtFeatureTest ft(_factory, feature); std::vector > positions; int32_t x = 0; @@ -549,9 +549,9 @@ TEST_F(ProdFeaturesTest, test_field_length) void -Test::assertFieldMatch(const vespalib::string & spec, - const vespalib::string & query, - const vespalib::string & field, +Test::assertFieldMatch(const std::string & spec, + const std::string & query, + const std::string & field, const fieldmatch::Params * params, uint32_t totalTermWeight, feature_t totalSignificance) @@ -559,7 +559,7 @@ Test::assertFieldMatch(const vespalib::string & spec, LOG(info, "assertFieldMatch('%s', '%s', '%s', (%u))", spec.c_str(), query.c_str(), field.c_str(), totalTermWeight); // Setup feature test. - vespalib::string feature = "fieldMatch(foo)"; + std::string feature = "fieldMatch(foo)"; FtFeatureTest ft(_factory, feature); setupFieldMatch(ft, "foo", query, field, params, totalTermWeight, totalSignificance, 1); @@ -571,18 +571,18 @@ Test::assertFieldMatch(const vespalib::string & spec, } void -Test::assertFieldMatch(const vespalib::string & spec, - const vespalib::string & query, - const vespalib::string & field, +Test::assertFieldMatch(const std::string & spec, + const std::string & query, + const std::string & field, uint32_t totalTermWeight) { assertFieldMatch(spec, query, field, nullptr, totalTermWeight); } void -Test::assertFieldMatchTS(const vespalib::string & spec, - const vespalib::string & query, - const vespalib::string & field, +Test::assertFieldMatchTS(const std::string & spec, + const std::string & query, + const std::string & field, feature_t totalSignificance) { assertFieldMatch(spec, query, field, nullptr, 0, totalSignificance); @@ -715,7 +715,7 @@ TEST_F(ProdFeaturesTest, test_foreach) } { // double loop - vespalib::string feature = + std::string feature = "foreach(fields,N,foreach(attributes,M,rankingExpression(\"value(N)+value(M)\"),true,product),true,sum)"; LOG(info, "double loop feature: '%s'", feature.c_str()); FtFeatureTest ft(_factory, feature); @@ -733,9 +733,9 @@ TEST_F(ProdFeaturesTest, test_foreach) } void -Test::assertForeachOperation(feature_t exp, const vespalib::string & cond, const vespalib::string & op) +Test::assertForeachOperation(feature_t exp, const std::string & cond, const std::string & op) { - vespalib::string feature = "foreach(fields,N,value(N)," + cond + "," + op + ")"; + std::string feature = "foreach(fields,N,value(N)," + cond + "," + op + ")"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "4.5"); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "2"); @@ -793,9 +793,9 @@ TEST_F(ProdFeaturesTest, test_freshness) } void -Test::assertFreshness(feature_t expFreshness, const vespalib::string & attr, uint32_t age, uint32_t maxAge, double halfResponse, bool logScale) +Test::assertFreshness(feature_t expFreshness, const std::string & attr, uint32_t age, uint32_t maxAge, double halfResponse, bool logScale) { - vespalib::string feature = "freshness(" + attr + ")"; + std::string feature = "freshness(" + attr + ")"; FtFeatureTest ft(_factory, feature); setupForAgeTest(ft, 60); // time = 60 if (maxAge > 0) { @@ -904,7 +904,7 @@ TEST_F(ProdFeaturesTest, test_distance) { // test 2D multi location (zcurve) // note: "aspect" is ignored now, computed from "y", and cos(60 degrees) = 0.5 - vespalib::string positions = "5:59999995," "35:60000000," "5:60000040," "35:59999960"; + std::string positions = "5:59999995," "35:60000000," "5:60000040," "35:59999960"; assert2DZDistance(static_cast(0.0f), positions, 5, 59999995, 0, 0); assert2DZDistance(static_cast(0.0f), positions, 35, 60000000, 0x10000000, 1); assert2DZDistance(static_cast(0.0f), positions, 5, 60000040, 0x20000000, 2); @@ -926,7 +926,7 @@ TEST_F(ProdFeaturesTest, test_distance) { // test geo multi location (zcurve) // note: cos(70.528779 degrees) = 1/3 - vespalib::string positions = "0:70528779," "100:70528879," "-200:70528979," "-300:70528479," "400:70528379"; + std::string positions = "0:70528779," "100:70528879," "-200:70528979," "-300:70528479," "400:70528379"; assert2DZDistance(static_cast(0.0f), positions, 0, 70528779 + 0, 0, 0); assert2DZDistance(static_cast(1.0f), positions, 100, 70528779 + 101, 0x20000000, 1); assert2DZDistance(static_cast(0.0f), positions, -200, 70528779 + 200, 0x40000000, 2); @@ -987,7 +987,7 @@ TEST_F(ProdFeaturesTest, test_distance) } void -Test::setupForDistanceTest(FtFeatureTest &ft, const vespalib::string & attrName, +Test::setupForDistanceTest(FtFeatureTest &ft, const std::string & attrName, const std::vector > & positions, bool zcurve) { auto pos = AttributeBuilder(attrName, AVC(AVBT::INT64, AVCT::ARRAY)).docs(1).get(); @@ -1006,16 +1006,16 @@ Test::setupForDistanceTest(FtFeatureTest &ft, const vespalib::string & attrName, } void -Test::assert2DZDistance(feature_t exp, const vespalib::string & positions, +Test::assert2DZDistance(feature_t exp, const std::string & positions, int32_t xquery, int32_t yquery, uint32_t xAspect, uint32_t hit_index) { LOG(info, "assert2DZDistance(%g, %s, %d, %d, %u, %u)", exp, positions.c_str(), xquery, yquery, xAspect, hit_index); FtFeatureTest ft(_factory, "distance(pos)"); - std::vector ta = FtUtil::tokenize(positions, ","); + std::vector ta = FtUtil::tokenize(positions, ","); std::vector > pos; for (const auto & s : ta) { - std::vector tb = FtUtil::tokenize(s, ":"); + std::vector tb = FtUtil::tokenize(s, ":"); auto x = util::strToNum(tb[0]); auto y = util::strToNum(tb[1]); pos.emplace_back(x, y); @@ -1146,7 +1146,7 @@ TEST_F(ProdFeaturesTest, test_distance_to_path) void Test::assertDistanceToPath(const std::vector > & pos, - const vespalib::string &path, feature_t distance, feature_t traveled, feature_t product) + const std::string &path, feature_t distance, feature_t traveled, feature_t product) { LOG(info, "Testing distance to path '%s' with %zd document locations.", path.c_str(), pos.size()); @@ -1167,7 +1167,7 @@ void verifyCorrectDotProductExecutor(BlueprintFactory & factory, std::string_view attrName, std::string_view queryVector, std::string_view expected) { - ParameterList params = {{ParameterType::ATTRIBUTE, vespalib::string(attrName)}, {ParameterType::STRING, "vector"}}; + ParameterList params = {{ParameterType::ATTRIBUTE, std::string(attrName)}, {ParameterType::STRING, "vector"}}; FtFeatureTest ft(factory, "value(0)"); Test::setupForDotProductTest(ft); ft.getQueryEnv().getProperties().add("dotProduct.vector", queryVector); @@ -1184,8 +1184,8 @@ verifyCorrectDotProductExecutor(BlueprintFactory & factory, std::string_view att template void verifyArrayParser() { - std::vector v = {"(0:2,7:-3,1:-3)", "{0:2,7:-3,1:-3}", "[2 -3 0 0 0 0 0 -3]"}; - for(const vespalib::string & s : v) { + std::vector v = {"(0:2,7:-3,1:-3)", "{0:2,7:-3,1:-3}", "[2 -3 0 0 0 0 0 -3]"}; + for(const std::string & s : v) { std::vector out; ArrayParser::parse(s, out); EXPECT_EQ(8u, out.size()); @@ -1242,8 +1242,8 @@ TEST_F(ProdFeaturesTest, test_dot_product) EXPECT_EQ(out.getVector()[0].first, e); EXPECT_EQ(out.getVector()[0].second, 1.0); } - std::vector v = {"(b:2.5,c:-3.5)", "{b:2.5,c:-3.5}"}; - for(const vespalib::string & s : v) { + std::vector v = {"(b:2.5,c:-3.5)", "{b:2.5,c:-3.5}"}; + for(const std::string & s : v) { dotproduct::wset::EnumVector out(sv); WeightedSetParser::parse(s, out); EXPECT_EQ(out.getVector().size(), 2u); @@ -1303,7 +1303,7 @@ TEST_F(ProdFeaturesTest, test_dot_product) verifyArrayParser(); verifyArrayParser(); { - vespalib::string s = "[[1:3]]"; + std::string s = "[[1:3]]"; std::vector out; ArrayParser::parse(s, out); EXPECT_EQ(0u, out.size()); @@ -1364,8 +1364,8 @@ TEST_F(ProdFeaturesTest, test_dot_product) } void -Test::assertDotProduct(feature_t exp, const vespalib::string & vector, uint32_t docId, - const vespalib::string & attribute, const vespalib::string & attributeOverride) +Test::assertDotProduct(feature_t exp, const std::string & vector, uint32_t docId, + const std::string & attribute, const std::string & attributeOverride) { RankResult rr; rr.addScore("dotProduct(" + attribute + ",vector)", exp); @@ -1744,9 +1744,9 @@ TEST_F(ProdFeaturesTest, test_matches) bool Test::assertMatches(uint32_t output, - const vespalib::string & query, - const vespalib::string & field, - const vespalib::string & feature, + const std::string & query, + const std::string & field, + const std::string & feature, uint32_t docId) { LOG(info, "assertMatches(%u, '%s', '%s', '%s')", output, query.c_str(), field.c_str(), feature.c_str()); @@ -1754,7 +1754,7 @@ Test::assertMatches(uint32_t output, // Setup feature test. FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); - std::map > index; + std::map > index; index["foo"] = FtUtil::tokenize(field); FT_SETUP(ft, FtUtil::toQuery(query), index, 1); @@ -2046,7 +2046,7 @@ TEST_F(ProdFeaturesTest, test_ranking_expression) } { // test interpreted expression - vespalib::string my_expr("3.0 + value(4.0) + reduce(tensorFromWeightedSet(query(my_tensor)),sum)"); + std::string my_expr("3.0 + value(4.0) + reduce(tensorFromWeightedSet(query(my_tensor)),sum)"); FtFeatureTest ft(_factory, getExpression(my_expr)); ft.getQueryEnv().getProperties().add("my_tensor", "{a:1,b:2,c:3}"); ASSERT_TRUE(ft.setup()); @@ -2055,8 +2055,8 @@ TEST_F(ProdFeaturesTest, test_ranking_expression) } } -vespalib::string -Test::getExpression(const vespalib::string ¶meter) const +std::string +Test::getExpression(const std::string ¶meter) const { using FNB = search::fef::FeatureNameBuilder; return FNB().baseName("rankingExpression").parameter(parameter).buildName(); @@ -2077,7 +2077,7 @@ TEST_F(ProdFeaturesTest, test_term) { StringList dump; for (uint32_t term = 0; term < 3; ++term) { - vespalib::string bn = vespalib::make_string("term(%u)", term); + std::string bn = vespalib::make_string("term(%u)", term); dump.add(bn + ".connectedness").add(bn + ".significance").add(bn + ".weight"); } FtIndexEnvironment ie; @@ -2085,7 +2085,7 @@ TEST_F(ProdFeaturesTest, test_term) FT_DUMP(_factory, "term", ie, dump); // check override for (uint32_t term = 3; term < 5; ++term) { - vespalib::string bn = vespalib::make_string("term(%u)", term); + std::string bn = vespalib::make_string("term(%u)", term); dump.add(bn + ".connectedness").add(bn + ".significance").add(bn + ".weight"); } FT_DUMP(_factory, "term", dump); // check default @@ -2189,13 +2189,13 @@ TEST_F(ProdFeaturesTest, test_term_distance) bool Test::assertTermDistance(const TermDistanceCalculator::Result & exp, - const vespalib::string & query, - const vespalib::string & field, + const std::string & query, + const std::string & field, uint32_t docId) { LOG(info, "assertTermDistance('%s', '%s')", query.c_str(), field.c_str()); - vespalib::string feature = "termDistance(foo,0,1)"; + std::string feature = "termDistance(foo,0,1)"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); diff --git a/searchlib/src/tests/features/prod_features_test.h b/searchlib/src/tests/features/prod_features_test.h index 9cd3df7a2ec3..afa900e468b7 100644 --- a/searchlib/src/tests/features/prod_features_test.h +++ b/searchlib/src/tests/features/prod_features_test.h @@ -51,33 +51,33 @@ class Test : public FtTestAppBase void testFieldMatchExecutorExceedingIterationLimit(); void testFieldMatchExecutorRemaining(); - void assertAge(feature_t expAge, const vespalib::string & attr, uint64_t now, uint64_t docTime); + void assertAge(feature_t expAge, const std::string & attr, uint64_t now, uint64_t docTime); static void setupForAgeTest(FtFeatureTest & ft, int64_t docTime); static void setupForAttributeTest(FtFeatureTest &ft, bool setup_env = true); - void assertCloseness(feature_t exp, const vespalib::string & attr, double distance, double maxDistance = 0, double halfResponse = 0); - static void setupForDistanceTest(FtFeatureTest & ft, const vespalib::string & attrName, + void assertCloseness(feature_t exp, const std::string & attr, double distance, double maxDistance = 0, double halfResponse = 0); + static void setupForDistanceTest(FtFeatureTest & ft, const std::string & attrName, const std::vector > & positions, bool zcurve); - void assert2DZDistance(feature_t exp, const vespalib::string & positions, + void assert2DZDistance(feature_t exp, const std::string & positions, int32_t xquery, int32_t yquery, uint32_t xAspect = 0, uint32_t hit_index = 0); - void assertDistanceToPath(const std::vector > & pos, const vespalib::string &path, + void assertDistanceToPath(const std::vector > & pos, const std::string &path, feature_t distance = search::features::DistanceToPathExecutor::DEFAULT_DISTANCE, feature_t traveled = 1, feature_t product = 0); - void assertDotProduct(feature_t exp, const vespalib::string & vector, uint32_t docId = 1, - const vespalib::string & attribute = "wsstr", const vespalib::string & attributeOverride=""); + void assertDotProduct(feature_t exp, const std::string & vector, uint32_t docId = 1, + const std::string & attribute = "wsstr", const std::string & attributeOverride=""); - void assertFieldMatch(const vespalib::string & spec, const vespalib::string & query, const vespalib::string & field, + void assertFieldMatch(const std::string & spec, const std::string & query, const std::string & field, const search::features::fieldmatch::Params * params = nullptr, uint32_t totalTermWeight = 0, feature_t totalSignificance = 0.0f); - void assertFieldMatch(const vespalib::string & spec, const vespalib::string & query, const vespalib::string & field, + void assertFieldMatch(const std::string & spec, const std::string & query, const std::string & field, uint32_t totalTermWeight); - void assertFieldMatchTS(const vespalib::string & spec, const vespalib::string & query, const vespalib::string & field, + void assertFieldMatchTS(const std::string & spec, const std::string & query, const std::string & field, feature_t totalSignificance); - vespalib::string getExpression(const vespalib::string ¶meter) const; - void assertForeachOperation(feature_t exp, const vespalib::string & cond, const vespalib::string & op); - void assertFreshness(feature_t expFreshness, const vespalib::string & attr, uint32_t age, uint32_t maxAge = 0, double halfResponse = 0, bool logScale = false); - bool assertTermDistance(const search::features::TermDistanceCalculator::Result & exp, const vespalib::string & query, - const vespalib::string & field, uint32_t docId = 1); - bool assertMatches(uint32_t output, const vespalib::string & query, const vespalib::string & field, - const vespalib::string & feature = "matches(foo)", uint32_t docId = 1); + std::string getExpression(const std::string ¶meter) const; + void assertForeachOperation(feature_t exp, const std::string & cond, const std::string & op); + void assertFreshness(feature_t expFreshness, const std::string & attr, uint32_t age, uint32_t maxAge = 0, double halfResponse = 0, bool logScale = false); + bool assertTermDistance(const search::features::TermDistanceCalculator::Result & exp, const std::string & query, + const std::string & field, uint32_t docId = 1); + bool assertMatches(uint32_t output, const std::string & query, const std::string & field, + const std::string & feature = "matches(foo)", uint32_t docId = 1); search::fef::BlueprintFactory _factory; }; diff --git a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp index 7e421086ee9a..59c85e0de667 100644 --- a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp +++ b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp @@ -15,7 +15,7 @@ using namespace search::fef::test; using namespace search::fef; using namespace vespalib::eval; -using TypeMap = std::map; +using TypeMap = std::map; struct DummyExecutor : FeatureExecutor { void execute(uint32_t) override {} @@ -24,7 +24,7 @@ struct DummyExecutor : FeatureExecutor { struct DummyExpression : IntrinsicExpression { FeatureType type; DummyExpression(const FeatureType &type_in) : type(type_in) {} - vespalib::string describe_self() const override { return "dummy"; } + std::string describe_self() const override { return "dummy"; } const FeatureType &result_type() const override { return type; } void prepare_shared_state(const QueryEnv &, IObjectStore &) const override { } @@ -34,9 +34,9 @@ struct DummyExpression : IntrinsicExpression { }; struct DummyReplacer : ExpressionReplacer { - vespalib::string trigger; + std::string trigger; FeatureType type; - DummyReplacer(const vespalib::string trigger_in, const FeatureType &type_in) + DummyReplacer(const std::string trigger_in, const FeatureType &type_in) : trigger(trigger_in), type(type_in) {} @@ -67,21 +67,21 @@ struct SetupResult { RankingExpressionBlueprint rank; DummyDependencyHandler deps; bool setup_ok; - SetupResult(const TypeMap &object_inputs, const vespalib::string &expression, - const vespalib::string &expression_name = ""); + SetupResult(const TypeMap &object_inputs, const std::string &expression, + const std::string &expression_name = ""); ~SetupResult(); }; SetupResult::SetupResult(const TypeMap &object_inputs, - const vespalib::string &expression, - const vespalib::string &expression_name) + const std::string &expression, + const std::string &expression_name) : stash(), index_env(), query_env(&index_env), rank(make_replacer()), deps(rank), setup_ok(false) { rank.setName("self"); for (const auto &input: object_inputs) { deps.define_object_input(input.first, ValueType::from_spec(input.second)); } - std::vector params; + std::vector params; if (expression_name.empty()) { index_env.getProperties().add("self.rankingScript", expression); } else { @@ -95,8 +95,8 @@ SetupResult::SetupResult(const TypeMap &object_inputs, SetupResult::~SetupResult() = default; void verify_output_type(const TypeMap &object_inputs, - const vespalib::string &expression, const FeatureType &expect, - const vespalib::string &expression_name = "") + const std::string &expression, const FeatureType &expect, + const std::string &expression_name = "") { SetupResult result(object_inputs, expression, expression_name); EXPECT_TRUE(result.setup_ok); @@ -110,14 +110,14 @@ void verify_output_type(const TypeMap &object_inputs, } void verify_setup_fail(const TypeMap &object_inputs, - const vespalib::string &expression) + const std::string &expression) { SetupResult result(object_inputs, expression); EXPECT_TRUE(!result.setup_ok); EXPECT_EQUAL(0u, result.deps.output.size()); } -void verify_input_count(const vespalib::string &expression, size_t expect) { +void verify_input_count(const std::string &expression, size_t expect) { SetupResult result({}, expression); EXPECT_TRUE(result.setup_ok); EXPECT_EQUAL(result.deps.input.size(), expect); diff --git a/searchlib/src/tests/features/raw_score/raw_score_test.cpp b/searchlib/src/tests/features/raw_score/raw_score_test.cpp index 05b625b631a0..09564261a6fa 100644 --- a/searchlib/src/tests/features/raw_score/raw_score_test.cpp +++ b/searchlib/src/tests/features/raw_score/raw_score_test.cpp @@ -36,7 +36,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) override { + virtual void visitDumpFeature(const std::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} @@ -107,19 +107,19 @@ TEST_FFF("require that no features are dumped", RawScoreBlueprint, IndexFixture, TEST_FF("require that setup can be done on index field", RawScoreBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); } TEST_FF("require that setup can be done on attribute field", RawScoreBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(bar)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); } TEST_FF("require that setup fails for unknown field", RawScoreBlueprint, IndexFixture) { DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(unknown)", f1.getBaseName().c_str())); - EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "unknown"))); + EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "unknown"))); } TEST_F("require that not searching a filed will give it 0.0 raw score", RankFixture(0, 3)) { diff --git a/searchlib/src/tests/features/subqueries/subqueries_test.cpp b/searchlib/src/tests/features/subqueries/subqueries_test.cpp index 8be9b0d969f6..57e2c5cbe63c 100644 --- a/searchlib/src/tests/features/subqueries/subqueries_test.cpp +++ b/searchlib/src/tests/features/subqueries/subqueries_test.cpp @@ -34,7 +34,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) override { + virtual void visitDumpFeature(const std::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp index 19d572f8b38e..46cf9dc7250d 100644 --- a/searchlib/src/tests/features/tensor/tensor_test.cpp +++ b/searchlib/src/tests/features/tensor/tensor_test.cpp @@ -43,7 +43,7 @@ using CollectionType = FieldInfo::CollectionType; namespace { -Value::UP make_empty(const vespalib::string &type) { +Value::UP make_empty(const std::string &type) { return SimpleValue::from_spec(TensorSpec(type)); } @@ -53,7 +53,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { @@ -62,15 +62,15 @@ struct ExecFixture setupQueryEnvironment(); EXPECT_TRUE(test.setup()); } - void addAttributeField(const vespalib::string &attrName) { + void addAttributeField(const std::string &attrName) { test.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, attrName); } - AttributeVector::SP createStringAttribute(const vespalib::string &attrName) { + AttributeVector::SP createStringAttribute(const std::string &attrName) { addAttributeField(attrName); return AttributeFactory::createAttribute(attrName, AVC(AVBT::STRING, AVCT::SINGLE)); } - AttributeVector::SP createTensorAttribute(const vespalib::string &attrName, - const vespalib::string &type, + AttributeVector::SP createTensorAttribute(const std::string &attrName, + const std::string &type, bool direct = false) { addAttributeField(attrName); @@ -79,14 +79,14 @@ struct ExecFixture config.setFastSearch(direct); return AttributeFactory::createAttribute(attrName, config); } - void setAttributeTensorType(const vespalib::string &attrName, const vespalib::string &type) { + void setAttributeTensorType(const std::string &attrName, const std::string &type) { type::Attribute::set(test.getIndexEnv().getProperties(), attrName, type); } - void setQueryTensorType(const vespalib::string &queryFeatureName, const vespalib::string &type) { + void setQueryTensorType(const std::string &queryFeatureName, const std::string &type) { type::QueryFeature::set(test.getIndexEnv().getProperties(), queryFeatureName, type); } - void setQueryTensorDefault(const vespalib::string &tensorName, const vespalib::string &expr) { - vespalib::string key = "query(" + tensorName + ")"; + void setQueryTensorDefault(const std::string &tensorName, const std::string &expr) { + std::string key = "query(" + tensorName + ")"; test.getIndexEnv().getProperties().add(key, expr); } void setupAttributeVectors() { @@ -126,8 +126,8 @@ struct ExecFixture attr->commit(); } } - void setQueryTensor(const vespalib::string &tensorName, - const vespalib::string &tensorTypeSpec, + void setQueryTensor(const std::string &tensorName, + const std::string &tensorTypeSpec, std::unique_ptr tensor) { vespalib::nbostream stream; diff --git a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp index c4bed9157611..a6a5269de0e2 100644 --- a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp +++ b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp @@ -40,7 +40,7 @@ Value::UP make_tensor(const TensorSpec &spec) { return SimpleValue::from_spec(spec); } -Value::UP make_empty(const vespalib::string &type) { +Value::UP make_empty(const std::string &type) { return make_tensor(TensorSpec(type)); } @@ -85,7 +85,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { diff --git a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp index 6ba4ed2c6baa..7b9dc9fe590b 100644 --- a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp +++ b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp @@ -40,7 +40,7 @@ Value::UP make_tensor(const TensorSpec &spec) { return SimpleValue::from_spec(spec); } -Value::UP make_empty(const vespalib::string &type) { +Value::UP make_empty(const std::string &type) { return make_tensor(TensorSpec(type)); } @@ -85,7 +85,7 @@ struct ExecFixture { BlueprintFactory factory; FtFeatureTest test; - ExecFixture(const vespalib::string &feature) + ExecFixture(const std::string &feature) : factory(), test(factory, feature) { diff --git a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp index 0a3e582f4923..5dbe92856d85 100644 --- a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp +++ b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp @@ -16,8 +16,8 @@ using namespace search::fef::test; using namespace search::features; using CollectionType = FieldInfo::CollectionType; -std::vector featureNamesFoo() { - std::vector f; +std::vector featureNamesFoo() { + std::vector f; f.push_back("textSimilarity(foo).score"); f.push_back("textSimilarity(foo).proximity"); f.push_back("textSimilarity(foo).order"); @@ -58,9 +58,9 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - std::vector expect; + std::vector expect; size_t dumped; - virtual void visitDumpFeature(const vespalib::string &name) override { + virtual void visitDumpFeature(const std::string &name) override { EXPECT_LT(dumped, expect.size()); EXPECT_EQ(expect[dumped++], name); } @@ -69,10 +69,10 @@ struct FeatureDumpFixture : public IDumpFeatureVisitor { struct RankFixture : BlueprintFactoryFixture { RankFixture() : BlueprintFactoryFixture() {} - double get_feature(const vespalib::string &query, const FtIndex &index, size_t select, + double get_feature(const std::string &query, const FtIndex &index, size_t select, bool useStaleMatchData = false) { - std::vector names = featureNamesFoo(); + std::vector names = featureNamesFoo(); EXPECT_TRUE(names.size() == 5u); FtFeatureTest ft(factory, names); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); @@ -122,7 +122,7 @@ TEST(TextSimilarityFeatureTest, require_that_setup_can_be_done_on_single_value_i IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(foo)", f1.getBaseName().c_str())); - EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); + EXPECT_TRUE(((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "foo"))); } TEST(TextSimilarityFeatureTest, require_that_setup_can_not_be_done_on_weighted_set_index_field) @@ -131,7 +131,7 @@ TEST(TextSimilarityFeatureTest, require_that_setup_can_not_be_done_on_weighted_s IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(bar)", f1.getBaseName().c_str())); - EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); + EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "bar"))); } TEST(TextSimilarityFeatureTest, require_that_setup_can_not_be_done_on_single_value_attribute_field) @@ -140,7 +140,7 @@ TEST(TextSimilarityFeatureTest, require_that_setup_can_not_be_done_on_single_val IndexFixture f2; DummyDependencyHandler deps(f1); f1.setName(vespalib::make_string("%s(baz)", f1.getBaseName().c_str())); - EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "baz"))); + EXPECT_TRUE(!((Blueprint&)f1).setup(f2.indexEnv, std::vector(1, "baz"))); } TEST(TextSimilarityFeatureTest, require_that_no_match_gives_zero_outputs) diff --git a/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp b/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp index ee22a49f8dbe..13a9d8af5e22 100644 --- a/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp +++ b/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp @@ -4,8 +4,8 @@ #include #include #include -#include #include +#include #include LOG_SETUP("featurenameparser_test"); @@ -13,10 +13,10 @@ LOG_SETUP("featurenameparser_test"); using namespace search::fef; struct ParamList { - std::vector list; + std::vector list; ParamList() : list() {} - ParamList(const std::vector &l) : list(l) {} - ParamList &add(const vespalib::string &str) { + ParamList(const std::vector &l) : list(l) {} + ParamList &add(const std::string &str) { list.push_back(str); return *this; } @@ -34,9 +34,9 @@ std::ostream &operator<<(std::ostream &os, const ParamList &pl) { } bool -testParse(const vespalib::string &input, bool valid, - const vespalib::string &base, ParamList pl, - const vespalib::string &output) +testParse(const std::string &input, bool valid, + const std::string &base, ParamList pl, + const std::string &output) { bool ok = true; FeatureNameParser parser(input); @@ -52,7 +52,7 @@ testParse(const vespalib::string &input, bool valid, } void -testFile(const vespalib::string &name) +testFile(const std::string &name) { char buf[4_Ki]; uint32_t lineN = 0; @@ -60,7 +60,7 @@ testFile(const vespalib::string &name) ASSERT_TRUE(f != 0); while (fgets(buf, sizeof(buf), f) != NULL) { ++lineN; - vespalib::string line(buf); + std::string line(buf); if (*line.rbegin() == '\n') { line.resize(line.size() - 1); } @@ -74,8 +74,8 @@ testFile(const vespalib::string &name) LOG(error, "(%s:%u): malformed line: '%s'", name.c_str(), lineN, line.c_str()); } else { - vespalib::string input = line.substr(0, idx); - vespalib::string expect = line.substr(idx + strlen("<=>")); + std::string input = line.substr(0, idx); + std::string expect = line.substr(idx + strlen("<=>")); EXPECT_EQ(FeatureNameParser(input).featureName(), expect) << (failed = true, ""); if (failed) { LOG(error, "(%s:%u): test failed: '%s'", diff --git a/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp b/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp index aec9050ab6bc..3c4e14c59472 100644 --- a/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp +++ b/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp @@ -164,7 +164,7 @@ TEST(FeatureOverriderTest, overrides) MatchData::UP match_data = mdl.createMatchData(); rankProgram->setup(*match_data, queryEnv, overrides); - std::map res = Utils::getAllFeatures(*rankProgram, 2); + std::map res = Utils::getAllFeatures(*rankProgram, 2); EXPECT_EQ(res.size(), 20u); EXPECT_NEAR(res["value(1)"], 1.0, 1e-6); @@ -198,7 +198,7 @@ struct SimpleRankFixture { Properties overrides; MatchData::UP match_data; RankProgram program; - static vespalib::string expr_feature(const vespalib::string &name) { + static std::string expr_feature(const std::string &name) { return fmt("rankingExpression(%s)", name.c_str()); } SimpleRankFixture() @@ -209,21 +209,21 @@ struct SimpleRankFixture { factory.addPrototype(std::make_shared()); } ~SimpleRankFixture(); - void add_expr(const vespalib::string &name, const vespalib::string &expr) { - vespalib::string feature_name = expr_feature(name); - vespalib::string expr_name = feature_name + ".rankingScript"; + void add_expr(const std::string &name, const std::string &expr) { + std::string feature_name = expr_feature(name); + std::string expr_name = feature_name + ".rankingScript"; indexEnv.getProperties().add(expr_name, expr); } - void add_override(const vespalib::string &name, const TensorSpec &spec) { + void add_override(const std::string &name, const TensorSpec &spec) { vespalib::nbostream data; auto tensor = vespalib::eval::value_from_spec(spec, FastValueBuilderFactory::get()); vespalib::eval::encode_value(*tensor, data); overrides.add(name, std::string_view(data.peek(), data.size())); } - void add_override(const vespalib::string &name, const vespalib::string &str) { + void add_override(const std::string &name, const std::string &str) { overrides.add(name, str); } - bool try_compile(const vespalib::string &seed) { + bool try_compile(const std::string &seed) { resolver->addSeed(seed); if (!resolver->compile()) { return false; @@ -234,7 +234,7 @@ struct SimpleRankFixture { program.setup(*match_data, queryEnv, overrides); return true; } - void compile(const vespalib::string &seed) { + void compile(const std::string &seed) { ASSERT_TRUE(try_compile(seed)); } void get(uint32_t docid, std::optional& spec) { @@ -250,7 +250,7 @@ bool spec_is_error(const TensorSpec& spec) { } struct MyIssues : Issue::Handler { - std::vector list; + std::vector list; Issue::Binding capture; MyIssues() : list(), capture(Issue::listen(*this)) {} ~MyIssues() override; @@ -325,7 +325,7 @@ TEST(FeatureOverriderTest, bad_format_binary_override_is_ignored) auto expect = TensorSpec::from_expr("tensor(x[3]):[1,2,3]"); ASSERT_FALSE(spec_is_error(expect)); f1.add_expr("foo", "tensor(x[3]):[1,2,3]"); - f1.add_override(f1.expr_feature("foo"), vespalib::string("bad format")); + f1.add_override(f1.expr_feature("foo"), std::string("bad format")); f1.compile(f1.expr_feature("foo")); ASSERT_EQ(issues.list.size(), 1u); EXPECT_LT(issues.list[0].find("has invalid format"), issues.list[0].size()); diff --git a/searchlib/src/tests/fef/object_passing/object_passing_test.cpp b/searchlib/src/tests/fef/object_passing/object_passing_test.cpp index 53a3aaa1c677..a0f224adae33 100644 --- a/searchlib/src/tests/fef/object_passing/object_passing_test.cpp +++ b/searchlib/src/tests/fef/object_passing/object_passing_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include using namespace search::fef; using namespace search::fef::test; @@ -46,17 +46,17 @@ struct ProxyExecutor : FeatureExecutor { }; struct ProxyBlueprint : Blueprint { - vespalib::string name; + std::string name; AcceptInput accept_input; bool object_input; bool object_output; - ProxyBlueprint(const vespalib::string &name_in, AcceptInput accept_input_in, bool object_output_in) + ProxyBlueprint(const std::string &name_in, AcceptInput accept_input_in, bool object_output_in) : Blueprint(name_in), name(name_in), accept_input(accept_input_in), object_input(false), object_output(object_output_in) {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return Blueprint::UP(new ProxyBlueprint(name, accept_input, object_output)); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { ASSERT_EQUAL(1u, params.size()); if (auto input = defineInput(params[0], accept_input)) { object_input = input.value().is_object(); @@ -84,7 +84,7 @@ struct Fixture { factory.addPrototype(std::make_shared("maybe_unbox", Blueprint::AcceptInput::ANY, false)); } - double eval(const vespalib::string &feature) { + double eval(const std::string &feature) { BlueprintResolver::SP resolver(new BlueprintResolver(factory, indexEnv)); resolver->addSeed(feature); ASSERT_TRUE(resolver->compile()); @@ -100,7 +100,7 @@ struct Fixture { return result.resolve(0).as_number(1); } - bool verify(const vespalib::string &feature) { + bool verify(const std::string &feature) { std::vector errors; return verifyFeature(factory, indexEnv, feature, "unit test", errors); } diff --git a/searchlib/src/tests/fef/parameter/parameter_test.cpp b/searchlib/src/tests/fef/parameter/parameter_test.cpp index a8acd2ea34de..53e6f110e852 100644 --- a/searchlib/src/tests/fef/parameter/parameter_test.cpp +++ b/searchlib/src/tests/fef/parameter/parameter_test.cpp @@ -14,9 +14,9 @@ using DataType = search::fef::FieldInfo::DataType; namespace search::fef { -class StringList : public std::vector { +class StringList : public std::vector { public: - StringList & add(const vespalib::string & str) { push_back(str); return *this; } + StringList & add(const std::string & str) { push_back(str); return *this; } }; class ParameterTest : public ::testing::Test { @@ -31,10 +31,10 @@ class ParameterTest : public ::testing::Test { ~ParameterTest() override; bool assertParameter(const Parameter & exp, const Parameter & act); bool validate(const IIndexEnvironment & env, - const std::vector & params, + const std::vector & params, const ParameterDescriptions & descs); bool validate(const IIndexEnvironment & env, - const std::vector & params, + const std::vector & params, const ParameterDescriptions & descs, const ParameterValidator::Result & result); }; @@ -56,7 +56,7 @@ ParameterTest::assertParameter(const Parameter & exp, const Parameter & act) bool ParameterTest::validate(const IIndexEnvironment & env, - const std::vector & params, + const std::vector & params, const ParameterDescriptions & descs) { ParameterValidator pv(env, params, descs); @@ -67,7 +67,7 @@ ParameterTest::validate(const IIndexEnvironment & env, bool ParameterTest::validate(const IIndexEnvironment & env, - const std::vector & params, + const std::vector & params, const ParameterDescriptions & descs, const ParameterValidator::Result & result) { diff --git a/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp b/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp index f4b3c878a066..a4c22796e44c 100644 --- a/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp +++ b/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp @@ -10,7 +10,7 @@ namespace search::fef { void assertTermData(const ITermData *td, uint32_t uniqueId, uint32_t numTerms, - uint32_t fieldId, uint32_t tfHandle, const vespalib::string& label) + uint32_t fieldId, uint32_t tfHandle, const std::string& label) { SCOPED_TRACE(label); // fprintf(stderr, "checking uid=%d numterms=%d field=%d handle=%d\n", uniqueId, numTerms, fieldId, tfHandle); diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp index 68c54adbb538..76a6da5e9ae6 100644 --- a/searchlib/src/tests/fef/properties/properties_test.cpp +++ b/searchlib/src/tests/fef/properties/properties_test.cpp @@ -22,8 +22,8 @@ struct CopyVisitor : public IPropertiesVisitor Properties make_props(std::initializer_list > > entries) { Properties props; for (const auto &entry: entries) { - vespalib::string key = entry.first; - for (vespalib::string value: entry.second) { + std::string key = entry.first; + for (std::string value: entry.second) { props.add(key, value); } } @@ -216,7 +216,7 @@ TEST(PropertiesTest, test_stuff) { // test index properties known by the framework { // vespa.eval.lazy_expressions - EXPECT_EQ(eval::LazyExpressions::NAME, vespalib::string("vespa.eval.lazy_expressions")); + EXPECT_EQ(eval::LazyExpressions::NAME, std::string("vespa.eval.lazy_expressions")); { Properties p; EXPECT_TRUE(eval::LazyExpressions::check(p, true)); @@ -236,7 +236,7 @@ TEST(PropertiesTest, test_stuff) } } { // vespa.eval.use_fast_forest - EXPECT_EQ(eval::UseFastForest::NAME, vespalib::string("vespa.eval.use_fast_forest")); + EXPECT_EQ(eval::UseFastForest::NAME, std::string("vespa.eval.use_fast_forest")); EXPECT_EQ(eval::UseFastForest::DEFAULT_VALUE, false); Properties p; EXPECT_EQ(eval::UseFastForest::check(p), false); @@ -244,35 +244,35 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(eval::UseFastForest::check(p), true); } { // vespa.rank.firstphase - EXPECT_EQ(rank::FirstPhase::NAME, vespalib::string("vespa.rank.firstphase")); - EXPECT_EQ(rank::FirstPhase::DEFAULT_VALUE, vespalib::string("nativeRank")); + EXPECT_EQ(rank::FirstPhase::NAME, std::string("vespa.rank.firstphase")); + EXPECT_EQ(rank::FirstPhase::DEFAULT_VALUE, std::string("nativeRank")); Properties p; - EXPECT_EQ(rank::FirstPhase::lookup(p), vespalib::string("nativeRank")); + EXPECT_EQ(rank::FirstPhase::lookup(p), std::string("nativeRank")); p.add("vespa.rank.firstphase", "specialrank"); - EXPECT_EQ(rank::FirstPhase::lookup(p), vespalib::string("specialrank")); + EXPECT_EQ(rank::FirstPhase::lookup(p), std::string("specialrank")); } { // vespa.rank.secondphase - EXPECT_EQ(rank::SecondPhase::NAME, vespalib::string("vespa.rank.secondphase")); - EXPECT_EQ(rank::SecondPhase::DEFAULT_VALUE, vespalib::string("")); + EXPECT_EQ(rank::SecondPhase::NAME, std::string("vespa.rank.secondphase")); + EXPECT_EQ(rank::SecondPhase::DEFAULT_VALUE, std::string("")); Properties p; - EXPECT_EQ(rank::SecondPhase::lookup(p), vespalib::string("")); + EXPECT_EQ(rank::SecondPhase::lookup(p), std::string("")); p.add("vespa.rank.secondphase", "specialrank"); - EXPECT_EQ(rank::SecondPhase::lookup(p), vespalib::string("specialrank")); + EXPECT_EQ(rank::SecondPhase::lookup(p), std::string("specialrank")); } { // vespa.dump.feature - EXPECT_EQ(dump::Feature::NAME, vespalib::string("vespa.dump.feature")); + EXPECT_EQ(dump::Feature::NAME, std::string("vespa.dump.feature")); EXPECT_EQ(dump::Feature::DEFAULT_VALUE.size(), 0u); Properties p; EXPECT_EQ(dump::Feature::lookup(p).size(), 0u); p.add("vespa.dump.feature", "foo"); p.add("vespa.dump.feature", "bar"); - std::vector a = dump::Feature::lookup(p); + std::vector a = dump::Feature::lookup(p); ASSERT_TRUE(a.size() == 2); - EXPECT_EQ(a[0], vespalib::string("foo")); - EXPECT_EQ(a[1], vespalib::string("bar")); + EXPECT_EQ(a[0], std::string("foo")); + EXPECT_EQ(a[1], std::string("bar")); } { // vespa.dump.ignoredefaultfeatures - EXPECT_EQ(dump::IgnoreDefaultFeatures::NAME, vespalib::string("vespa.dump.ignoredefaultfeatures")); + EXPECT_EQ(dump::IgnoreDefaultFeatures::NAME, std::string("vespa.dump.ignoredefaultfeatures")); EXPECT_EQ(dump::IgnoreDefaultFeatures::DEFAULT_VALUE, "false"); Properties p; EXPECT_TRUE(!dump::IgnoreDefaultFeatures::check(p)); @@ -280,7 +280,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_TRUE(dump::IgnoreDefaultFeatures::check(p)); } { // vespa.matching.termwise_limit - EXPECT_EQ(matching::TermwiseLimit::NAME, vespalib::string("vespa.matching.termwise_limit")); + EXPECT_EQ(matching::TermwiseLimit::NAME, std::string("vespa.matching.termwise_limit")); EXPECT_EQ(matching::TermwiseLimit::DEFAULT_VALUE, 1.0); Properties p; EXPECT_EQ(matching::TermwiseLimit::lookup(p), 1.0); @@ -288,7 +288,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matching::TermwiseLimit::lookup(p), 0.05); } { // vespa.matching.numthreads - EXPECT_EQ(matching::NumThreadsPerSearch::NAME, vespalib::string("vespa.matching.numthreadspersearch")); + EXPECT_EQ(matching::NumThreadsPerSearch::NAME, std::string("vespa.matching.numthreadspersearch")); EXPECT_EQ(matching::NumThreadsPerSearch::DEFAULT_VALUE, std::numeric_limits::max()); Properties p; EXPECT_EQ(matching::NumThreadsPerSearch::lookup(p), std::numeric_limits::max()); @@ -297,7 +297,7 @@ TEST(PropertiesTest, test_stuff) } { // vespa.matching.minhitsperthread - EXPECT_EQ(matching::MinHitsPerThread::NAME, vespalib::string("vespa.matching.minhitsperthread")); + EXPECT_EQ(matching::MinHitsPerThread::NAME, std::string("vespa.matching.minhitsperthread")); EXPECT_EQ(matching::MinHitsPerThread::DEFAULT_VALUE, 0u); Properties p; EXPECT_EQ(matching::MinHitsPerThread::lookup(p), 0u); @@ -305,7 +305,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matching::MinHitsPerThread::lookup(p), 50u); } { - EXPECT_EQ(matching::NumSearchPartitions::NAME, vespalib::string("vespa.matching.numsearchpartitions")); + EXPECT_EQ(matching::NumSearchPartitions::NAME, std::string("vespa.matching.numsearchpartitions")); EXPECT_EQ(matching::NumSearchPartitions::DEFAULT_VALUE, 1u); Properties p; EXPECT_EQ(matching::NumSearchPartitions::lookup(p), 1u); @@ -313,7 +313,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matching::NumSearchPartitions::lookup(p), 50u); } { // vespa.matchphase.degradation.attribute - EXPECT_EQ(matchphase::DegradationAttribute::NAME, vespalib::string("vespa.matchphase.degradation.attribute")); + EXPECT_EQ(matchphase::DegradationAttribute::NAME, std::string("vespa.matchphase.degradation.attribute")); EXPECT_EQ(matchphase::DegradationAttribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(matchphase::DegradationAttribute::lookup(p), ""); @@ -321,7 +321,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationAttribute::lookup(p), "foobar"); } { // vespa.matchphase.degradation.ascending - EXPECT_EQ(matchphase::DegradationAscendingOrder::NAME, vespalib::string("vespa.matchphase.degradation.ascendingorder")); + EXPECT_EQ(matchphase::DegradationAscendingOrder::NAME, std::string("vespa.matchphase.degradation.ascendingorder")); EXPECT_EQ(matchphase::DegradationAscendingOrder::DEFAULT_VALUE, false); Properties p; EXPECT_EQ(matchphase::DegradationAscendingOrder::lookup(p), false); @@ -329,7 +329,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationAscendingOrder::lookup(p), true); } { // vespa.matchphase.degradation.maxhits - EXPECT_EQ(matchphase::DegradationMaxHits::NAME, vespalib::string("vespa.matchphase.degradation.maxhits")); + EXPECT_EQ(matchphase::DegradationMaxHits::NAME, std::string("vespa.matchphase.degradation.maxhits")); EXPECT_EQ(matchphase::DegradationMaxHits::DEFAULT_VALUE, 0u); Properties p; EXPECT_EQ(matchphase::DegradationMaxHits::lookup(p), 0u); @@ -337,7 +337,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationMaxHits::lookup(p), 123789u); } { // vespa.matchphase.degradation.samplepercentage - EXPECT_EQ(matchphase::DegradationSamplePercentage::NAME, vespalib::string("vespa.matchphase.degradation.samplepercentage")); + EXPECT_EQ(matchphase::DegradationSamplePercentage::NAME, std::string("vespa.matchphase.degradation.samplepercentage")); EXPECT_EQ(matchphase::DegradationSamplePercentage::DEFAULT_VALUE, 0.2); Properties p; EXPECT_EQ(matchphase::DegradationSamplePercentage::lookup(p), 0.2); @@ -345,7 +345,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationSamplePercentage::lookup(p), 0.9); } { // vespa.matchphase.degradation.maxfiltercoverage - EXPECT_EQ(matchphase::DegradationMaxFilterCoverage::NAME, vespalib::string("vespa.matchphase.degradation.maxfiltercoverage")); + EXPECT_EQ(matchphase::DegradationMaxFilterCoverage::NAME, std::string("vespa.matchphase.degradation.maxfiltercoverage")); EXPECT_EQ(matchphase::DegradationMaxFilterCoverage::DEFAULT_VALUE, 0.2); Properties p; EXPECT_EQ(matchphase::DegradationMaxFilterCoverage::lookup(p), 0.2); @@ -353,7 +353,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationMaxFilterCoverage::lookup(p), 0.076); } { // vespa.matchphase.degradation.postfiltermultiplier - EXPECT_EQ(matchphase::DegradationPostFilterMultiplier::NAME, vespalib::string("vespa.matchphase.degradation.postfiltermultiplier")); + EXPECT_EQ(matchphase::DegradationPostFilterMultiplier::NAME, std::string("vespa.matchphase.degradation.postfiltermultiplier")); EXPECT_EQ(matchphase::DegradationPostFilterMultiplier::DEFAULT_VALUE, 1.0); Properties p; EXPECT_EQ(matchphase::DegradationPostFilterMultiplier::lookup(p), 1.0); @@ -361,7 +361,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DegradationPostFilterMultiplier::lookup(p), 0.9); } { // vespa.matchphase.diversity.attribute - EXPECT_EQ(matchphase::DiversityAttribute::NAME, vespalib::string("vespa.matchphase.diversity.attribute")); + EXPECT_EQ(matchphase::DiversityAttribute::NAME, std::string("vespa.matchphase.diversity.attribute")); EXPECT_EQ(matchphase::DiversityAttribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(matchphase::DiversityAttribute::lookup(p), ""); @@ -369,7 +369,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DiversityAttribute::lookup(p), "foobar"); } { // vespa.matchphase.diversity.mingroups - EXPECT_EQ(matchphase::DiversityMinGroups::NAME, vespalib::string("vespa.matchphase.diversity.mingroups")); + EXPECT_EQ(matchphase::DiversityMinGroups::NAME, std::string("vespa.matchphase.diversity.mingroups")); EXPECT_EQ(matchphase::DiversityMinGroups::DEFAULT_VALUE, 1u); Properties p; EXPECT_EQ(matchphase::DiversityMinGroups::lookup(p), 1u); @@ -377,7 +377,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(matchphase::DiversityMinGroups::lookup(p), 5u); } { // vespa.hitcollector.heapsize - EXPECT_EQ(hitcollector::HeapSize::NAME, vespalib::string("vespa.hitcollector.heapsize")); + EXPECT_EQ(hitcollector::HeapSize::NAME, std::string("vespa.hitcollector.heapsize")); EXPECT_EQ(hitcollector::HeapSize::DEFAULT_VALUE, 100u); Properties p; EXPECT_EQ(hitcollector::HeapSize::lookup(p), 100u); @@ -385,7 +385,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(hitcollector::HeapSize::lookup(p), 50u); } { // vespa.hitcollector.arraysize - EXPECT_EQ(hitcollector::ArraySize::NAME, vespalib::string("vespa.hitcollector.arraysize")); + EXPECT_EQ(hitcollector::ArraySize::NAME, std::string("vespa.hitcollector.arraysize")); EXPECT_EQ(hitcollector::ArraySize::DEFAULT_VALUE, 10000u); Properties p; EXPECT_EQ(hitcollector::ArraySize::lookup(p), 10000u); @@ -393,7 +393,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(hitcollector::ArraySize::lookup(p), 50u); } { // vespa.hitcollector.estimatepoint - EXPECT_EQ(hitcollector::EstimatePoint::NAME, vespalib::string("vespa.hitcollector.estimatepoint")); + EXPECT_EQ(hitcollector::EstimatePoint::NAME, std::string("vespa.hitcollector.estimatepoint")); EXPECT_EQ(hitcollector::EstimatePoint::DEFAULT_VALUE, 0xffffffffu); Properties p; EXPECT_EQ(hitcollector::EstimatePoint::lookup(p), 0xffffffffu); @@ -401,7 +401,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(hitcollector::EstimatePoint::lookup(p), 50u); } { // vespa.hitcollector.estimatelimit - EXPECT_EQ(hitcollector::EstimateLimit::NAME, vespalib::string("vespa.hitcollector.estimatelimit")); + EXPECT_EQ(hitcollector::EstimateLimit::NAME, std::string("vespa.hitcollector.estimatelimit")); EXPECT_EQ(hitcollector::EstimateLimit::DEFAULT_VALUE, 0xffffffffu); Properties p; EXPECT_EQ(hitcollector::EstimateLimit::lookup(p), 0xffffffffu); @@ -409,7 +409,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(hitcollector::EstimateLimit::lookup(p), 50u); } { // vespa.hitcollector.rankscoredroplimit - EXPECT_EQ(vespalib::string("vespa.hitcollector.rankscoredroplimit"), hitcollector::FirstPhaseRankScoreDropLimit::NAME); + EXPECT_EQ(std::string("vespa.hitcollector.rankscoredroplimit"), hitcollector::FirstPhaseRankScoreDropLimit::NAME); Properties p; auto got2 = hitcollector::FirstPhaseRankScoreDropLimit::lookup(p); EXPECT_EQ(std::optional(), got2); @@ -423,7 +423,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(std::optional(123456789.12345), hitcollector::FirstPhaseRankScoreDropLimit::lookup(p)); } { // vespa.fieldweight. - EXPECT_EQ(FieldWeight::BASE_NAME, vespalib::string("vespa.fieldweight.")); + EXPECT_EQ(FieldWeight::BASE_NAME, std::string("vespa.fieldweight.")); EXPECT_EQ(FieldWeight::DEFAULT_VALUE, 100u); Properties p; EXPECT_EQ(FieldWeight::lookup(p, "foo"), 100u); @@ -442,7 +442,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_TRUE(IsFilterField::check(p, "bar")); } { - EXPECT_EQ(mutate::on_match::Attribute::NAME, vespalib::string("vespa.mutate.on_match.attribute")); + EXPECT_EQ(mutate::on_match::Attribute::NAME, std::string("vespa.mutate.on_match.attribute")); EXPECT_EQ(mutate::on_match::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_match::Attribute::lookup(p), ""); @@ -450,7 +450,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_match::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(mutate::on_match::Operation::NAME, vespalib::string("vespa.mutate.on_match.operation")); + EXPECT_EQ(mutate::on_match::Operation::NAME, std::string("vespa.mutate.on_match.operation")); EXPECT_EQ(mutate::on_match::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_match::Operation::lookup(p), ""); @@ -458,7 +458,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_match::Operation::lookup(p), "+=1"); } { - EXPECT_EQ(mutate::on_first_phase::Attribute::NAME, vespalib::string("vespa.mutate.on_first_phase.attribute")); + EXPECT_EQ(mutate::on_first_phase::Attribute::NAME, std::string("vespa.mutate.on_first_phase.attribute")); EXPECT_EQ(mutate::on_first_phase::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_first_phase::Attribute::lookup(p), ""); @@ -466,7 +466,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_first_phase::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(mutate::on_first_phase::Operation::NAME, vespalib::string("vespa.mutate.on_first_phase.operation")); + EXPECT_EQ(mutate::on_first_phase::Operation::NAME, std::string("vespa.mutate.on_first_phase.operation")); EXPECT_EQ(mutate::on_first_phase::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_first_phase::Operation::lookup(p), ""); @@ -474,7 +474,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_first_phase::Operation::lookup(p), "+=1"); } { - EXPECT_EQ(mutate::on_second_phase::Attribute::NAME, vespalib::string("vespa.mutate.on_second_phase.attribute")); + EXPECT_EQ(mutate::on_second_phase::Attribute::NAME, std::string("vespa.mutate.on_second_phase.attribute")); EXPECT_EQ(mutate::on_second_phase::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_second_phase::Attribute::lookup(p), ""); @@ -482,7 +482,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_second_phase::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(mutate::on_second_phase::Operation::NAME, vespalib::string("vespa.mutate.on_second_phase.operation")); + EXPECT_EQ(mutate::on_second_phase::Operation::NAME, std::string("vespa.mutate.on_second_phase.operation")); EXPECT_EQ(mutate::on_second_phase::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_second_phase::Operation::lookup(p), ""); @@ -490,7 +490,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_second_phase::Operation::lookup(p), "+=1"); } { - EXPECT_EQ(mutate::on_summary::Attribute::NAME, vespalib::string("vespa.mutate.on_summary.attribute")); + EXPECT_EQ(mutate::on_summary::Attribute::NAME, std::string("vespa.mutate.on_summary.attribute")); EXPECT_EQ(mutate::on_summary::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_summary::Attribute::lookup(p), ""); @@ -498,7 +498,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_summary::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(mutate::on_summary::Operation::NAME, vespalib::string("vespa.mutate.on_summary.operation")); + EXPECT_EQ(mutate::on_summary::Operation::NAME, std::string("vespa.mutate.on_summary.operation")); EXPECT_EQ(mutate::on_summary::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(mutate::on_summary::Operation::lookup(p), ""); @@ -506,7 +506,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(mutate::on_summary::Operation::lookup(p), "+=1"); } { - EXPECT_EQ(execute::onmatch::Attribute::NAME, vespalib::string("vespa.execute.onmatch.attribute")); + EXPECT_EQ(execute::onmatch::Attribute::NAME, std::string("vespa.execute.onmatch.attribute")); EXPECT_EQ(execute::onmatch::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onmatch::Attribute::lookup(p), ""); @@ -514,7 +514,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onmatch::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(execute::onmatch::Operation::NAME, vespalib::string("vespa.execute.onmatch.operation")); + EXPECT_EQ(execute::onmatch::Operation::NAME, std::string("vespa.execute.onmatch.operation")); EXPECT_EQ(execute::onmatch::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onmatch::Operation::lookup(p), ""); @@ -522,7 +522,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onmatch::Operation::lookup(p), "++"); } { - EXPECT_EQ(execute::onrerank::Attribute::NAME, vespalib::string("vespa.execute.onrerank.attribute")); + EXPECT_EQ(execute::onrerank::Attribute::NAME, std::string("vespa.execute.onrerank.attribute")); EXPECT_EQ(execute::onrerank::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onrerank::Attribute::lookup(p), ""); @@ -530,7 +530,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onrerank::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(execute::onrerank::Operation::NAME, vespalib::string("vespa.execute.onrerank.operation")); + EXPECT_EQ(execute::onrerank::Operation::NAME, std::string("vespa.execute.onrerank.operation")); EXPECT_EQ(execute::onrerank::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onrerank::Operation::lookup(p), ""); @@ -538,7 +538,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onrerank::Operation::lookup(p), "++"); } { - EXPECT_EQ(execute::onsummary::Attribute::NAME, vespalib::string("vespa.execute.onsummary.attribute")); + EXPECT_EQ(execute::onsummary::Attribute::NAME, std::string("vespa.execute.onsummary.attribute")); EXPECT_EQ(execute::onsummary::Attribute::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onsummary::Attribute::lookup(p), ""); @@ -546,7 +546,7 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onsummary::Attribute::lookup(p), "foobar"); } { - EXPECT_EQ(execute::onsummary::Operation::NAME, vespalib::string("vespa.execute.onsummary.operation")); + EXPECT_EQ(execute::onsummary::Operation::NAME, std::string("vespa.execute.onsummary.operation")); EXPECT_EQ(execute::onsummary::Operation::DEFAULT_VALUE, ""); Properties p; EXPECT_EQ(execute::onsummary::Operation::lookup(p), ""); @@ -554,21 +554,21 @@ TEST(PropertiesTest, test_stuff) EXPECT_EQ(execute::onsummary::Operation::lookup(p), "++"); } { - EXPECT_EQ(softtimeout::Enabled::NAME, vespalib::string("vespa.softtimeout.enable")); + EXPECT_EQ(softtimeout::Enabled::NAME, std::string("vespa.softtimeout.enable")); EXPECT_TRUE(softtimeout::Enabled::DEFAULT_VALUE); Properties p; p.add(softtimeout::Enabled::NAME, "false"); EXPECT_FALSE(softtimeout::Enabled::lookup(p)); } { - EXPECT_EQ(softtimeout::Factor::NAME, vespalib::string("vespa.softtimeout.factor")); + EXPECT_EQ(softtimeout::Factor::NAME, std::string("vespa.softtimeout.factor")); EXPECT_EQ(0.5, softtimeout::Factor::DEFAULT_VALUE); Properties p; p.add(softtimeout::Factor::NAME, "0.33"); EXPECT_EQ(0.33, softtimeout::Factor::lookup(p)); } { - EXPECT_EQ(softtimeout::TailCost::NAME, vespalib::string("vespa.softtimeout.tailcost")); + EXPECT_EQ(softtimeout::TailCost::NAME, std::string("vespa.softtimeout.tailcost")); EXPECT_EQ(0.1, softtimeout::TailCost::DEFAULT_VALUE); Properties p; p.add(softtimeout::TailCost::NAME, "0.17"); @@ -595,7 +595,7 @@ TEST(PropertiesTest, test_query_feature_type_properties) TEST(PropertiesTest, test_integer_lookup) { - EXPECT_EQ(matching::NumThreadsPerSearch::NAME, vespalib::string("vespa.matching.numthreadspersearch")); + EXPECT_EQ(matching::NumThreadsPerSearch::NAME, std::string("vespa.matching.numthreadspersearch")); EXPECT_EQ(matching::NumThreadsPerSearch::DEFAULT_VALUE, std::numeric_limits::max()); { Properties p; @@ -632,7 +632,7 @@ TEST(PropertiesTest, test_integer_lookup) TEST(PropertiesTest, second_phase_rank_score_drop_limit) { std::string_view name = hitcollector::SecondPhaseRankScoreDropLimit::NAME; - EXPECT_EQ(vespalib::string("vespa.hitcollector.secondphase.rankscoredroplimit"), name); + EXPECT_EQ(std::string("vespa.hitcollector.secondphase.rankscoredroplimit"), name); Properties p; EXPECT_EQ(std::optional(), hitcollector::SecondPhaseRankScoreDropLimit::lookup(p)); EXPECT_EQ(std::optional(4.0), hitcollector::SecondPhaseRankScoreDropLimit::lookup(p, 4.0)); diff --git a/searchlib/src/tests/fef/rank_program/rank_program_test.cpp b/searchlib/src/tests/fef/rank_program/rank_program_test.cpp index b58eb508f652..4c93501c7f97 100644 --- a/searchlib/src/tests/fef/rank_program/rank_program_test.cpp +++ b/searchlib/src/tests/fef/rank_program/rank_program_test.cpp @@ -1,5 +1,4 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -15,6 +14,7 @@ #include #include #include +#include using namespace search::fef; using namespace search::fef::test; @@ -65,7 +65,7 @@ size_t count_const_features(const RankProgram &program) { return count(program, [](const LazyValue &value){ return value.is_const(); }); } -vespalib::string expr_feature(const vespalib::string &name) { +std::string expr_feature(const std::string &name) { return vespalib::make_string("rankingExpression(%s)", name.c_str()); } @@ -99,18 +99,18 @@ struct Fixture { indexEnv.getProperties().add(indexproperties::eval::UseFastForest::NAME, "true"); return *this; } - Fixture &add_expr(const vespalib::string &name, const vespalib::string &expr) { - vespalib::string feature_name = expr_feature(name); - vespalib::string expr_name = feature_name + ".rankingScript"; + Fixture &add_expr(const std::string &name, const std::string &expr) { + std::string feature_name = expr_feature(name); + std::string expr_name = feature_name + ".rankingScript"; indexEnv.getProperties().add(expr_name, expr); add(feature_name); return *this; } - Fixture &add(const vespalib::string &feature) { + Fixture &add(const std::string &feature) { resolver->addSeed(feature); return *this; } - Fixture &override(const vespalib::string &feature, double value) { + Fixture &override(const std::string &feature, double value) { overrides.add(feature, vespalib::make_string("%g", value)); return *this; } @@ -121,7 +121,7 @@ struct Fixture { match_data = mdl.createMatchData(); program.setup(*match_data, queryEnv, overrides, profiler); } - vespalib::string final_executor_name() const { + std::string final_executor_name() const { size_t n = program.num_executors(); bool failed = false; EXPECT_TRUE(n > 0) << (failed = true, ""); @@ -132,7 +132,7 @@ struct Fixture { EXPECT_EQ(1u, result.num_features()); return result.resolve(0).as_number(docid); } - double get(const vespalib::string &feature, uint32_t docid = default_docid) { + double get(const std::string &feature, uint32_t docid = default_docid) { auto result = program.get_seeds(); for (size_t i = 0; i < result.num_features(); ++i) { if (result.name_of(i) == feature) { @@ -141,9 +141,9 @@ struct Fixture { } return 31212.0; } - std::map all(uint32_t docid = default_docid) { + std::map all(uint32_t docid = default_docid) { auto result = program.get_seeds(); - std::map result_map; + std::map result_map; for (size_t i = 0; i < result.num_features(); ++i) { result_map[result.name_of(i)] = result.resolve(i).as_number(docid); } @@ -420,7 +420,7 @@ TEST(RankProgramTest, interpreted_ranking_expressions_are_pure) EXPECT_EQ(f1.get(), 7.0); } -const vespalib::string tree_expr = "if(value(1)<2,1,2)+if(value(2)<1,10,20)"; +const std::string tree_expr = "if(value(1)<2,1,2)+if(value(2)<1,10,20)"; TEST(RankProgramTest, fast_forest_gbdt_evaluation_can_be_enabled) { @@ -468,12 +468,12 @@ TEST(RankProgramTest, rank_program_can_be_profiled) if ((*b)["count"].asLong() > (*a)["count"].asLong()) { std::swap(a, b); } - EXPECT_EQ((*a)["name"].asString().make_string(), vespalib::string("mysum(value(10),ivalue(5))")); + EXPECT_EQ((*a)["name"].asString().make_string(), std::string("mysum(value(10),ivalue(5))")); EXPECT_EQ((*a)["count"].asLong(), 3); EXPECT_EQ((*a)["children"].entries(), 1u); - EXPECT_EQ((*a)["children"][0]["name"].asString().make_string(), vespalib::string("ivalue(5)")); + EXPECT_EQ((*a)["children"][0]["name"].asString().make_string(), std::string("ivalue(5)")); EXPECT_EQ((*a)["children"][0]["count"].asLong(), 3); - EXPECT_EQ((*b)["name"].asString().make_string(), vespalib::string("value(10)")); + EXPECT_EQ((*b)["name"].asString().make_string(), std::string("value(10)")); EXPECT_EQ((*b)["count"].asLong(), 1); } diff --git a/searchlib/src/tests/fef/resolver/resolver_test.cpp b/searchlib/src/tests/fef/resolver/resolver_test.cpp index 317f91d13f52..682d4dfbf4e9 100644 --- a/searchlib/src/tests/fef/resolver/resolver_test.cpp +++ b/searchlib/src/tests/fef/resolver/resolver_test.cpp @@ -87,9 +87,9 @@ TEST_F("require_that_bad_input_is_handled", Fixture) { } TEST("require that features can be described") { - EXPECT_EQUAL(BlueprintResolver::describe_feature("featureName"), vespalib::string("rank feature featureName")); - EXPECT_EQUAL(BlueprintResolver::describe_feature("rankingExpression(foo)"), vespalib::string("function foo")); - EXPECT_EQUAL(BlueprintResolver::describe_feature("rankingExpression(foo@1234.5678)"), vespalib::string("function foo")); + EXPECT_EQUAL(BlueprintResolver::describe_feature("featureName"), std::string("rank feature featureName")); + EXPECT_EQUAL(BlueprintResolver::describe_feature("rankingExpression(foo)"), std::string("function foo")); + EXPECT_EQUAL(BlueprintResolver::describe_feature("rankingExpression(foo@1234.5678)"), std::string("function foo")); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/fef/table/table_test.cpp b/searchlib/src/tests/fef/table/table_test.cpp index 9c15274c0936..0b6f92a8c66d 100644 --- a/searchlib/src/tests/fef/table/table_test.cpp +++ b/searchlib/src/tests/fef/table/table_test.cpp @@ -17,7 +17,7 @@ class TableTest : public ::testing::Test const std::string _tables2Dir; bool assertTable(const Table & act, const Table & exp); - bool assertCreateTable(const ITableFactory & tf, const vespalib::string & name, const Table & exp); + bool assertCreateTable(const ITableFactory & tf, const std::string & name, const Table & exp); void testTable(); void testFileTableFactory(); void testFunctionTableFactory(); @@ -54,7 +54,7 @@ TableTest::assertTable(const Table & act, const Table & exp) } bool -TableTest::assertCreateTable(const ITableFactory & tf, const vespalib::string & name, const Table & exp) +TableTest::assertCreateTable(const ITableFactory & tf, const std::string & name, const Table & exp) { Table::SP t = tf.createTable(name); bool failed = false; diff --git a/searchlib/src/tests/grouping/grouping_test.cpp b/searchlib/src/tests/grouping/grouping_test.cpp index 952f5d2a5db2..8bc390545e11 100644 --- a/searchlib/src/tests/grouping/grouping_test.cpp +++ b/searchlib/src/tests/grouping/grouping_test.cpp @@ -281,7 +281,7 @@ testMerge(const Grouping &a, const Grouping &b, const Grouping &c, const Group & } void -testAggregationSimple(AggregationContext & ctx, const AggregationResult & aggr, const ResultNode & ir, const vespalib::string &name) +testAggregationSimple(AggregationContext & ctx, const AggregationResult & aggr, const ResultNode & ir, const std::string &name) { ExpressionNode::CP clone(aggr); Grouping request; diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp index e65c5d812a49..0cc250ac2c70 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp @@ -231,8 +231,8 @@ TEST_MAIN() { size_t numQueries = 1000; int64_t maxGroups = -1; bool useEngine = true; - vespalib::string idType = "int"; - vespalib::string aggrType = "sum"; + std::string idType = "int"; + std::string aggrType = "sum"; if (argc > 1) { useEngine = (strcmp(argv[1], "tree") != 0); } diff --git a/searchlib/src/tests/hitcollector/hitcollector_test.cpp b/searchlib/src/tests/hitcollector/hitcollector_test.cpp index 784afea7801a..ade42275f224 100644 --- a/searchlib/src/tests/hitcollector/hitcollector_test.cpp +++ b/searchlib/src/tests/hitcollector/hitcollector_test.cpp @@ -95,7 +95,7 @@ void checkResult(ResultSet & rs, BitVector * exp) } } -void testAddHit(uint32_t numDocs, uint32_t maxHitsSize, const vespalib::string& label) +void testAddHit(uint32_t numDocs, uint32_t maxHitsSize, const std::string& label) { SCOPED_TRACE(label); diff --git a/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp b/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp index cfc138d7ee7b..e67537bc72c8 100644 --- a/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp +++ b/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp @@ -4,9 +4,9 @@ #include #include #include -#include #include #include +#include using namespace search; using namespace vespalib::datastore; @@ -36,7 +36,7 @@ build(Iterator itr) return words; } -vespalib::string +std::string toStr(Iterator itr) { WordRefVector words = build(itr); diff --git a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp index 1df24cf59eb4..4a9ba8214bb7 100644 --- a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp @@ -69,7 +69,7 @@ TEST(WordStoreTest, add_word_triggers_change_of_buffer) TEST(WordStoreTest, long_word_triggers_exception) { WordStore ws; - vespalib::string word(16_Mi + 1_Ki, 'z'); + std::string word(16_Mi + 1_Ki, 'z'); EXPECT_THROW(ws.addWord(word), vespalib::OverflowException); } diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp index f1e2e0469736..c4f49af0fe2a 100644 --- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp +++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp @@ -264,15 +264,15 @@ namespace { * that we get correct posting lists from real memory field index. */ class MockFieldIndex { - std::map, std::set> _dict; - vespalib::string _word; + std::map, std::set> _dict; + std::string _word; uint32_t _fieldId; public: MockFieldIndex(); ~MockFieldIndex(); void - setNextWord(const vespalib::string &word) { + setNextWord(const std::string &word) { _word = word; } @@ -288,7 +288,7 @@ class MockFieldIndex { _dict[std::make_pair(_word, _fieldId)].erase(docId); } - std::vector find(const vespalib::string &word, uint32_t fieldId) { + std::vector find(const std::string &word, uint32_t fieldId) { std::vector res; for (auto docId : _dict[std::make_pair(word, fieldId)] ) { res.push_back(docId); @@ -319,7 +319,7 @@ MockFieldIndex::~MockFieldIndex() = default; * needs. */ class MockWordStoreScan { - std::unordered_set> _words; + std::unordered_set> _words; public: MockWordStoreScan() @@ -327,7 +327,7 @@ class MockWordStoreScan { { } ~MockWordStoreScan(); - const vespalib::string &setWord(const vespalib::string &word) { + const std::string &setWord(const std::string &word) { return *_words.insert(word).first; } }; @@ -358,8 +358,8 @@ class MyInserter { } ~MyInserter(); - void setNextWord(const vespalib::string &word) { - const vespalib::string &w = _wordStoreScan.setWord(word); + void setNextWord(const std::string &word) { + const std::string &w = _wordStoreScan.setWord(word); _inserter->setNextWord(w); _mock.setNextWord(w); } @@ -383,7 +383,7 @@ class MyInserter { _mock.remove(docId); } - bool assertPosting(const vespalib::string &word, + bool assertPosting(const std::string &word, uint32_t fieldId) { std::vector exp = _mock.find(word, fieldId); auto itr = find_in_field_index(word, fieldId, _fieldIndexes); @@ -1289,7 +1289,7 @@ TEST_F(CjkInverterTest, require_that_cjk_indexing_is_working) } void -insertAndAssertTuple(const vespalib::string &word, uint32_t fieldId, uint32_t docId, +insertAndAssertTuple(const std::string &word, uint32_t fieldId, uint32_t docId, FieldIndexCollection &dict) { EntryRef wordRef = WrapInserter(dict, fieldId).rewind().word(word). @@ -1320,9 +1320,9 @@ struct RemoverTest : public FieldIndexCollectionTest { _pushThreads(SequencedTaskExecutor::create(push_executor, 2)) { } - void assertPostingLists(const vespalib::string &e1, - const vespalib::string &e2, - const vespalib::string &e3) { + void assertPostingLists(const std::string &e1, + const std::string &e2, + const std::string &e3) { EXPECT_TRUE(assertPostingList(e1, find("a", 1))); EXPECT_TRUE(assertPostingList(e2, find("a", 2))); EXPECT_TRUE(assertPostingList(e3, find("b", 1))); diff --git a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp index 73a6e22068c3..612f547c772e 100644 --- a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp +++ b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp @@ -14,7 +14,7 @@ using namespace search; using namespace search::memoryindex; struct WordFieldPair { - vespalib::string _word; + std::string _word; uint32_t _fieldId; WordFieldPair(std::string_view word, uint32_t fieldId) noexcept : _word(word), _fieldId(fieldId) @@ -48,7 +48,7 @@ struct MockRemoveListener : public IFieldIndexRemoveListener { _words.clear(); _expDocId = expDocId; } - vespalib::string getWords() { + std::string getWords() { std::sort(_words.begin(), _words.end()); std::ostringstream oss; oss << _words; @@ -60,12 +60,12 @@ struct MockRemoveListener : public IFieldIndexRemoveListener { struct FieldIndexRemoverTest : public ::testing::Test { MockRemoveListener _listener; std::vector> _wordStores; - std::vector> _wordToRefMaps; + std::vector> _wordToRefMaps; std::vector> _removers; FieldIndexRemoverTest(); ~FieldIndexRemoverTest() override; - vespalib::datastore::EntryRef getWordRef(const vespalib::string &word, uint32_t fieldId) { + vespalib::datastore::EntryRef getWordRef(const std::string &word, uint32_t fieldId) { auto &wordToRefMap = _wordToRefMaps[fieldId]; WordStore &wordStore = *_wordStores[fieldId]; auto itr = wordToRefMap.find(word); @@ -76,7 +76,7 @@ struct FieldIndexRemoverTest : public ::testing::Test { } return itr->second; } - FieldIndexRemoverTest &insert(const vespalib::string &word, uint32_t fieldId, uint32_t docId) { + FieldIndexRemoverTest &insert(const std::string &word, uint32_t fieldId, uint32_t docId) { assert(fieldId < _wordStores.size()); _removers[fieldId]->insert(getWordRef(word, fieldId), docId); return *this; @@ -86,7 +86,7 @@ struct FieldIndexRemoverTest : public ::testing::Test { remover->flush(); } } - vespalib::string remove(uint32_t docId) { + std::string remove(uint32_t docId) { _listener.reset(docId); uint32_t fieldId = 0; for (auto &remover : _removers) { diff --git a/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp b/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp index d81189deb99c..7e93e3b1d3f3 100644 --- a/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp +++ b/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp @@ -111,7 +111,7 @@ makeDoc17(DocBuilder &b) return doc; } -vespalib::string corruptWord = "corruptWord"; +std::string corruptWord = "corruptWord"; Document::UP makeCorruptDocument(DocBuilder &b, size_t wordOffset) @@ -141,7 +141,7 @@ make_very_long_word_document(DocBuilder& b) { StringFieldBuilder sfb(b); auto doc = b.make_document("id:ns:searchdocument::19"); - vespalib::string long_word(FieldInverter::max_word_len + 1, 'z'); + std::string long_word(FieldInverter::max_word_len + 1, 'z'); doc->setValue("f0", sfb.tokenize("before ").word(long_word).tokenize(" after").build()); return doc; } diff --git a/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp b/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp index 7bd82ffdcadf..9b7f6c19c79e 100644 --- a/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp +++ b/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp @@ -58,19 +58,19 @@ using namespace search::queryeval; //----------------------------------------------------------------------------- struct MySetup : public IFieldLengthInspector { - std::vector fields; - std::map field_lengths; + std::vector fields; + std::map field_lengths; MySetup(); ~MySetup() override; MySetup &field(const std::string &name) { fields.emplace_back(name); return *this; } - MySetup& field_length(const vespalib::string& field_name, const FieldLengthInfo& info) { + MySetup& field_length(const std::string& field_name, const FieldLengthInfo& info) { field_lengths[field_name] = info; return *this; } - FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + FieldLengthInfo get_field_length_info(const std::string& field_name) const override { auto itr = field_lengths.find(field_name); if (itr != field_lengths.end()) { return itr->second; diff --git a/searchlib/src/tests/memoryindex/url_field_inverter/url_field_inverter_test.cpp b/searchlib/src/tests/memoryindex/url_field_inverter/url_field_inverter_test.cpp index 5098e8834589..9f73f1cfcf20 100644 --- a/searchlib/src/tests/memoryindex/url_field_inverter/url_field_inverter_test.cpp +++ b/searchlib/src/tests/memoryindex/url_field_inverter/url_field_inverter_test.cpp @@ -34,7 +34,7 @@ using namespace index; namespace memoryindex { namespace { -const vespalib::string url = "url"; +const std::string url = "url"; Document::UP makeDoc10Single(DocBuilder &b) diff --git a/searchlib/src/tests/nativerank/nativerank_test.cpp b/searchlib/src/tests/nativerank/nativerank_test.cpp index d9f0782008a4..d14d2b59f835 100644 --- a/searchlib/src/tests/nativerank/nativerank_test.cpp +++ b/searchlib/src/tests/nativerank/nativerank_test.cpp @@ -41,17 +41,17 @@ class NativeRankTest : public ::testing::Test, uint32_t docId; ANAM(int32_t aw, uint32_t tw = 100, uint32_t fw = 100, uint32_t id = 1) : attributeWeight(aw), termWeight(tw), fieldWeight(fw), docId(id) {} - vespalib::string toString() const { + std::string toString() const { return vespalib::make_string("aw(%d), tw(%u), fw(%u), id(%u)", attributeWeight, termWeight.percent(), fieldWeight, docId); } }; - bool assertNativeFieldMatch(feature_t score, const vespalib::string & query, const vespalib::string & field, + bool assertNativeFieldMatch(feature_t score, const std::string & query, const std::string & field, const Properties & props = Properties(), uint32_t docId = 1); bool assertNativeAttributeMatch(feature_t score, const ANAM & t1, const ANAM & t2, const Properties & props = Properties()); - bool assertNativeProximity(feature_t score, const vespalib::string & query, const vespalib::string & field, + bool assertNativeProximity(feature_t score, const std::string & query, const std::string & field, const Properties & props = Properties(), uint32_t docId = 1); bool assertNativeRank(feature_t score, feature_t fieldMatchWeight, feature_t attributeMatchWeight, feature_t proximityWeight); }; @@ -264,15 +264,15 @@ TEST_F(NativeRankTest, test_native_field_match) bool NativeRankTest::assertNativeFieldMatch(feature_t score, - const vespalib::string & query, - const vespalib::string & field, + const std::string & query, + const std::string & field, const Properties & props, uint32_t docId) { LOG(info, "assertNativeFieldMatch(%f, '%s', '%s')", score, query.c_str(), field.c_str()); // Setup feature test. - vespalib::string feature = "nativeFieldMatch"; + std::string feature = "nativeFieldMatch"; FtFeatureTest ft(_factory, feature); StringVectorMap index; @@ -393,7 +393,7 @@ bool NativeRankTest::assertNativeAttributeMatch(feature_t score, const ANAM & t1, const ANAM & t2, const Properties & props) { LOG(info, "assertNativeAttributeMatch(%f, '%s', '%s')", score, t1.toString().c_str(), t2.toString().c_str()); - vespalib::string feature = "nativeAttributeMatch"; + std::string feature = "nativeAttributeMatch"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::WEIGHTEDSET, "foo"); ft.getIndexEnv().getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::WEIGHTEDSET, "bar"); @@ -668,15 +668,15 @@ TEST_F(NativeRankTest, test_native_proximity) bool NativeRankTest::assertNativeProximity(feature_t score, - const vespalib::string & query, - const vespalib::string & field, + const std::string & query, + const std::string & field, const Properties & props, uint32_t docId) { LOG(info, "assertNativeProximity(%f, '%s', '%s')", score, query.c_str(), field.c_str()); // Setup feature test. - vespalib::string feature = "nativeProximity"; + std::string feature = "nativeProximity"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo"); @@ -793,7 +793,7 @@ NativeRankTest::assertNativeRank(feature_t score, LOG(info, "assertNativeRank(%f, %f, %f, %f)", score, fieldMatchWeight, attributeMatchWeight, proximityWeight); // Setup feature test. - vespalib::string feature = "nativeRank"; + std::string feature = "nativeRank"; FtFeatureTest ft(_factory, feature); ft.getIndexEnv().getProperties().add("nativeRank.fieldMatchWeight", diff --git a/searchlib/src/tests/nearsearch/nearsearch_test.cpp b/searchlib/src/tests/nearsearch/nearsearch_test.cpp index aa578108b6b6..9d090e22caba 100644 --- a/searchlib/src/tests/nearsearch/nearsearch_test.cpp +++ b/searchlib/src/tests/nearsearch/nearsearch_test.cpp @@ -110,7 +110,7 @@ MyQuery::~MyQuery() {} class NearSearchTest : public ::testing::Test { protected: - void testNearSearch(MyQuery &query, uint32_t matchId, const vespalib::string& label); + void testNearSearch(MyQuery &query, uint32_t matchId, const std::string& label); NearSearchTest(); ~NearSearchTest() override; @@ -209,7 +209,7 @@ TEST_F(NearSearchTest, repeated_terms) } void -NearSearchTest::testNearSearch(MyQuery &query, uint32_t matchId, const vespalib::string& label) +NearSearchTest::testNearSearch(MyQuery &query, uint32_t matchId, const std::string& label) { SCOPED_TRACE(vespalib::make_string("%s - %u", label.c_str(), matchId)); search::queryeval::IntermediateBlueprint *near_b = nullptr; diff --git a/searchlib/src/tests/postinglistbm/postinglistbm.cpp b/searchlib/src/tests/postinglistbm/postinglistbm.cpp index 1235b0f32d43..ea8e5cb927aa 100644 --- a/searchlib/src/tests/postinglistbm/postinglistbm.cpp +++ b/searchlib/src/tests/postinglistbm/postinglistbm.cpp @@ -171,7 +171,7 @@ PostingListBM::main(int argc, char **argv) break; case 'o': { - vespalib::string operatorType(optarg); + std::string operatorType(optarg); if (operatorType == "direct") { _operatorType = StressRunner::OperatorType::Direct; } else if (operatorType == "and") { diff --git a/searchlib/src/tests/predicate/predicate_range_term_expander_test.cpp b/searchlib/src/tests/predicate/predicate_range_term_expander_test.cpp index 20d1be0bee03..b6d5194aad37 100644 --- a/searchlib/src/tests/predicate/predicate_range_term_expander_test.cpp +++ b/searchlib/src/tests/predicate/predicate_range_term_expander_test.cpp @@ -3,11 +3,12 @@ #include #include +#include #include using search::predicate::PredicateRangeTermExpander; using std::vector; -using vespalib::string; +using std::string; namespace { diff --git a/searchlib/src/tests/query/querybuilder_test.cpp b/searchlib/src/tests/query/querybuilder_test.cpp index feba1b7c232d..6415ad137e83 100644 --- a/searchlib/src/tests/query/querybuilder_test.cpp +++ b/searchlib/src/tests/query/querybuilder_test.cpp @@ -16,7 +16,7 @@ LOG_SETUP("querybuilder_test"); #include using std::string_view; -using vespalib::string; +using std::string; using search::SimpleQueryStackDumpIterator; using namespace search::query; @@ -801,7 +801,7 @@ TEST("first integer then string MultiTerm") { namespace { -std::vector in_strings = { "this", "is", "a", "test" }; +std::vector in_strings = { "this", "is", "a", "test" }; std::vector in_integers = { 24, INT64_C(93000000000) }; diff --git a/searchlib/src/tests/query/stackdumpquerycreator_test.cpp b/searchlib/src/tests/query/stackdumpquerycreator_test.cpp index 006f2c3fd33f..e7a721a1429b 100644 --- a/searchlib/src/tests/query/stackdumpquerycreator_test.cpp +++ b/searchlib/src/tests/query/stackdumpquerycreator_test.cpp @@ -14,7 +14,7 @@ LOG_SETUP("stackdumpquerycreator_test"); using search::ParseItem; using search::RawBuf; using search::SimpleQueryStackDumpIterator; -using vespalib::string; +using std::string; using namespace search::query; namespace { diff --git a/searchlib/src/tests/query/streaming/equiv_query_node_test.cpp b/searchlib/src/tests/query/streaming/equiv_query_node_test.cpp index 209306fc569c..1c4e82311c12 100644 --- a/searchlib/src/tests/query/streaming/equiv_query_node_test.cpp +++ b/searchlib/src/tests/query/streaming/equiv_query_node_test.cpp @@ -42,13 +42,13 @@ class EquivQueryNodeTest : public ::testing::Test EquivQueryNodeTest(); ~EquivQueryNodeTest(); - void assert_tfmd_pos(const vespalib::string label, + void assert_tfmd_pos(const std::string label, const TermFieldMatchDataPosition &tfmd_pos, uint32_t exp_element_id, uint32_t exp_position, int32_t exp_element_weight, uint32_t exp_element_length); - vespalib::string make_simple_equiv_stack_dump(); + std::string make_simple_equiv_stack_dump(); }; EquivQueryNodeTest::EquivQueryNodeTest() @@ -59,7 +59,7 @@ EquivQueryNodeTest::EquivQueryNodeTest() EquivQueryNodeTest::~EquivQueryNodeTest() = default; void -EquivQueryNodeTest::assert_tfmd_pos(const vespalib::string label, +EquivQueryNodeTest::assert_tfmd_pos(const std::string label, const TermFieldMatchDataPosition &tfmd_pos, uint32_t exp_element_id, uint32_t exp_position, @@ -73,7 +73,7 @@ EquivQueryNodeTest::assert_tfmd_pos(const vespalib::string label, EXPECT_EQ(exp_element_length, tfmd_pos.getElementLen()); } -vespalib::string +std::string EquivQueryNodeTest::make_simple_equiv_stack_dump() { QueryBuilder builder; diff --git a/searchlib/src/tests/query/streaming/hit_iterator_test.cpp b/searchlib/src/tests/query/streaming/hit_iterator_test.cpp index a9588ea3d6c7..313722aa09e1 100644 --- a/searchlib/src/tests/query/streaming/hit_iterator_test.cpp +++ b/searchlib/src/tests/query/streaming/hit_iterator_test.cpp @@ -25,7 +25,7 @@ make_hit_list() } void -check_seek_to_field_elem(HitIterator& it, const FieldElement& field_element, const Hit* exp_ptr, const vespalib::string& label) +check_seek_to_field_elem(HitIterator& it, const FieldElement& field_element, const Hit* exp_ptr, const std::string& label) { SCOPED_TRACE(label); EXPECT_TRUE(it.seek_to_field_element(field_element)); @@ -34,7 +34,7 @@ check_seek_to_field_elem(HitIterator& it, const FieldElement& field_element, con } void -check_seek_to_field_elem_failure(HitIterator& it, const FieldElement& field_element, const vespalib::string& label) +check_seek_to_field_elem_failure(HitIterator& it, const FieldElement& field_element, const std::string& label) { SCOPED_TRACE(label); EXPECT_FALSE(it.seek_to_field_element(field_element)); @@ -42,7 +42,7 @@ check_seek_to_field_elem_failure(HitIterator& it, const FieldElement& field_elem } void -check_step_in_field_element(HitIterator& it, FieldElement& field_element, bool exp_success, const Hit* exp_ptr, const vespalib::string& label) +check_step_in_field_element(HitIterator& it, FieldElement& field_element, bool exp_success, const Hit* exp_ptr, const std::string& label) { SCOPED_TRACE(label); EXPECT_EQ(exp_success, it.step_in_field_element(field_element)); @@ -56,7 +56,7 @@ check_step_in_field_element(HitIterator& it, FieldElement& field_element, bool e } void -check_seek_in_field_element(HitIterator& it, uint32_t position, FieldElement& field_element, bool exp_success, const Hit* exp_ptr, const vespalib::string& label) +check_seek_in_field_element(HitIterator& it, uint32_t position, FieldElement& field_element, bool exp_success, const Hit* exp_ptr, const std::string& label) { SCOPED_TRACE(label); EXPECT_EQ(exp_success, it.seek_in_field_element(position, field_element)); diff --git a/searchlib/src/tests/query/streaming/near_test.cpp b/searchlib/src/tests/query/streaming/near_test.cpp index 2f95eb13dbdf..5b8db2b34462 100644 --- a/searchlib/src/tests/query/streaming/near_test.cpp +++ b/searchlib/src/tests/query/streaming/near_test.cpp @@ -70,7 +70,7 @@ NearTest::evaluate_query(uint32_t distance, const std::vector(empty, stackDump); if (GetParam().ordered()) { diff --git a/searchlib/src/tests/query/streaming/phrase_query_node_test.cpp b/searchlib/src/tests/query/streaming/phrase_query_node_test.cpp index a6b3a1ffe05e..1be4db8c4016 100644 --- a/searchlib/src/tests/query/streaming/phrase_query_node_test.cpp +++ b/searchlib/src/tests/query/streaming/phrase_query_node_test.cpp @@ -31,7 +31,7 @@ TEST(PhraseQueryNodeTest, test_phrase_evaluate) builder.addStringTerm("c", "", 0, Weight(0)); } Node::UP node = builder.build(); - vespalib::string stackDump = StackDumpCreator::create(*node); + std::string stackDump = StackDumpCreator::create(*node); QueryNodeResultFactory empty; Query q(empty, stackDump); auto& p = dynamic_cast(q.getRoot()); diff --git a/searchlib/src/tests/query/streaming/same_element_query_node_test.cpp b/searchlib/src/tests/query/streaming/same_element_query_node_test.cpp index 779f15ddbd55..529fc0a6f4d7 100644 --- a/searchlib/src/tests/query/streaming/same_element_query_node_test.cpp +++ b/searchlib/src/tests/query/streaming/same_element_query_node_test.cpp @@ -36,7 +36,7 @@ class AllowRewrite : public QueryNodeResultFactory explicit AllowRewrite(std::string_view index) noexcept : _allowedIndex(index) {} bool allow_float_terms_rewrite(std::string_view index) const noexcept override { return index == _allowedIndex; } private: - vespalib::string _allowedIndex; + std::string _allowedIndex; }; } @@ -61,7 +61,7 @@ TEST(SameElementQueryNodeTest, a_unhandled_sameElement_stack) } namespace { - void verifyQueryTermNode(const vespalib::string & index, const QueryNode *node) { + void verifyQueryTermNode(const std::string & index, const QueryNode *node) { EXPECT_TRUE(dynamic_cast(node) != nullptr); EXPECT_EQ(index, node->getIndex()); } @@ -77,7 +77,7 @@ TEST(SameElementQueryNodeTest, test_same_element_evaluate) builder.addStringTerm("c", "f3", 2, Weight(0)); } Node::UP node = builder.build(); - vespalib::string stackDump = StackDumpCreator::create(*node); + std::string stackDump = StackDumpCreator::create(*node); QueryNodeResultFactory empty; Query q(empty, stackDump); auto * sameElem = dynamic_cast(&q.getRoot()); diff --git a/searchlib/src/tests/query/streaming_query_large_test.cpp b/searchlib/src/tests/query/streaming_query_large_test.cpp index 678580ac811f..afdd59cd36e7 100644 --- a/searchlib/src/tests/query/streaming_query_large_test.cpp +++ b/searchlib/src/tests/query/streaming_query_large_test.cpp @@ -44,7 +44,7 @@ TEST("testveryLongQueryResultingInBug6850778") { } } Node::UP node = builder.build(); - vespalib::string stackDump = StackDumpCreator::create(*node); + std::string stackDump = StackDumpCreator::create(*node); QueryNodeResultFactory factory; Query q(factory, stackDump); diff --git a/searchlib/src/tests/query/streaming_query_test.cpp b/searchlib/src/tests/query/streaming_query_test.cpp index bc0183c49763..01ae6c354c9f 100644 --- a/searchlib/src/tests/query/streaming_query_test.cpp +++ b/searchlib/src/tests/query/streaming_query_test.cpp @@ -307,7 +307,7 @@ class AllowRewrite : public QueryNodeResultFactory explicit AllowRewrite(std::string_view index) noexcept : _allowedIndex(index) {} bool allow_float_terms_rewrite(std::string_view index) const noexcept override { return index == _allowedIndex; } private: - vespalib::string _allowedIndex; + std::string _allowedIndex; }; const char TERM_UNIQ = static_cast(ParseItem::ITEM_TERM) | static_cast(ParseItem::IF_UNIQUEID); @@ -427,7 +427,7 @@ TEST(StreamingQueryTest, test_get_query_parts) } } Node::UP node = builder.build(); - vespalib::string stackDump = StackDumpCreator::create(*node); + std::string stackDump = StackDumpCreator::create(*node); QueryNodeResultFactory empty; Query q(empty, stackDump); @@ -822,7 +822,7 @@ constexpr double exp_wand_score_field_12 = 13 * 27 + 4 * 2; constexpr double exp_wand_score_field_11 = 17 * 27 + 9 * 2; void -check_wand_term(double limit, const vespalib::string& label) +check_wand_term(double limit, const std::string& label) { SCOPED_TRACE(label); search::streaming::WandTerm term({}, "index", 2); @@ -924,9 +924,9 @@ TEST(StreamingQueryTest, weighted_set_term) TEST(StreamingQueryTest, control_the_size_of_query_terms) { - EXPECT_EQ(48u + sizeof(vespalib::string), sizeof(QueryTermSimple)); - EXPECT_EQ(64u + sizeof(vespalib::string), sizeof(QueryTermUCS4)); - EXPECT_EQ(144u + 2*sizeof(vespalib::string), sizeof(QueryTerm)); + EXPECT_EQ(48u + sizeof(std::string), sizeof(QueryTermSimple)); + EXPECT_EQ(64u + sizeof(std::string), sizeof(QueryTermUCS4)); + EXPECT_EQ(144u + 2*sizeof(std::string), sizeof(QueryTerm)); } GTEST_MAIN_RUN_ALL_TESTS() diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index e88dfa3f3869..fbe6a5579813 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -625,7 +625,7 @@ TEST("testBlueprintMakeNew") EXPECT_EQUAL(2u, orig->getState().numFields()); } -vespalib::string +std::string getExpectedBlueprint() { return "(anonymous namespace)::MyOr {\n" @@ -680,7 +680,7 @@ getExpectedBlueprint() "}\n"; } -vespalib::string +std::string getExpectedSlimeBlueprint() { return "{" " '[type]': '(anonymous namespace)::MyOr'," diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp index 9e423a73cdf8..9a2cd59b135c 100644 --- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp @@ -40,7 +40,7 @@ using vespalib::make_string_short::fmt; using vespalib::normalize_class_name; using Path = std::vector>; -vespalib::string strict_equiv_name = "search::queryeval::EquivImpl >"; +std::string strict_equiv_name = "search::queryeval::EquivImpl >"; struct InvalidSelector : ISourceSelector { InvalidSelector() : ISourceSelector(Source()) {} @@ -518,9 +518,9 @@ struct SourceBlenderTestFixture { void addChildrenForSimpleSBTest(IntermediateBlueprint & parent); }; -vespalib::string path_to_str(const Path &path) { +std::string path_to_str(const Path &path) { size_t cnt = 0; - vespalib::string str("["); + std::string str("["); for (const auto &item: path) { if (cnt++ > 0) { str.append(","); @@ -533,7 +533,7 @@ vespalib::string path_to_str(const Path &path) { return str; } -vespalib::string to_str(const Inspector &value) { +std::string to_str(const Inspector &value) { if (!value.valid()) { return ""; } diff --git a/searchlib/src/tests/queryeval/blueprint/mysearch.h b/searchlib/src/tests/queryeval/blueprint/mysearch.h index e3b86a0eb84a..c1f819167014 100644 --- a/searchlib/src/tests/queryeval/blueprint/mysearch.h +++ b/searchlib/src/tests/queryeval/blueprint/mysearch.h @@ -16,7 +16,7 @@ class MySearch : public MultiSearch using MatchData = search::fef::MatchData; private: - vespalib::string _tag; + std::string _tag; bool _isLeaf; bool _isStrict; TFMDA _match; diff --git a/searchlib/src/tests/queryeval/exact_nearest_neighbor/exact_nearest_neighbor_test.cpp b/searchlib/src/tests/queryeval/exact_nearest_neighbor/exact_nearest_neighbor_test.cpp index bec627bb7baa..3b16255e9991 100644 --- a/searchlib/src/tests/queryeval/exact_nearest_neighbor/exact_nearest_neighbor_test.cpp +++ b/searchlib/src/tests/queryeval/exact_nearest_neighbor/exact_nearest_neighbor_test.cpp @@ -42,15 +42,15 @@ using BasicType = search::attribute::BasicType; using CollectionType = search::attribute::CollectionType; using Config = search::attribute::Config; -vespalib::string denseSpecDouble("tensor(x[2])"); -vespalib::string denseSpecFloat("tensor(x[2])"); -vespalib::string mixed_spec("tensor(m{},x[2])"); +std::string denseSpecDouble("tensor(x[2])"); +std::string denseSpecFloat("tensor(x[2])"); +std::string mixed_spec("tensor(m{},x[2])"); std::unique_ptr createTensor(const TensorSpec &spec) { return SimpleValue::from_spec(spec); } -std::unique_ptr createTensor(const vespalib::string& type_spec, double v1, double v2) { +std::unique_ptr createTensor(const std::string& type_spec, double v1, double v2) { auto type = vespalib::eval::ValueType::from_spec(type_spec); if (type.is_dense()) { return createTensor(TensorSpec(type_spec).add({{"x", 0}}, v1) @@ -61,7 +61,7 @@ std::unique_ptr createTensor(const vespalib::string& type_spec, double v1 } } -std::shared_ptr make_attr(const vespalib::string& name, const Config& cfg) { +std::shared_ptr make_attr(const std::string& name, const Config& cfg) { if (cfg.tensorType().is_dense()) { return std::make_shared(name, cfg); } else { @@ -71,13 +71,13 @@ std::shared_ptr make_attr(const vespalib::string& name, const C struct Fixture { Config _cfg; - vespalib::string _name; - vespalib::string _typeSpec; + std::string _name; + std::string _typeSpec; std::shared_ptr _attr; std::shared_ptr _global_filter; MatchingPhase _matching_phase; - Fixture(const vespalib::string &typeSpec) + Fixture(const std::string &typeSpec) : _cfg(BasicType::TENSOR, CollectionType::SINGLE), _name("test"), _typeSpec(typeSpec), @@ -142,8 +142,8 @@ SimpleResult find_matches(Fixture &env, const Value &qtv, double threshold = std } void -verify_iterator_returns_expected_results(const vespalib::string& attribute_tensor_type_spec, - const vespalib::string& query_tensor_type_spec) +verify_iterator_returns_expected_results(const std::string& attribute_tensor_type_spec, + const std::string& query_tensor_type_spec) { Fixture fixture(attribute_tensor_type_spec); fixture.ensureSpace(6); @@ -198,10 +198,10 @@ verify_iterator_returns_expected_results(const vespalib::string& attribute_tenso } struct TestParam { - vespalib::string attribute_tensor_type_spec; - vespalib::string query_tensor_type_spec; - TestParam(const vespalib::string& attribute_tensor_type_spec_in, - const vespalib::string& query_tensor_type_spec_in) noexcept + std::string attribute_tensor_type_spec; + std::string query_tensor_type_spec; + TestParam(const std::string& attribute_tensor_type_spec_in, + const std::string& query_tensor_type_spec_in) noexcept : attribute_tensor_type_spec(attribute_tensor_type_spec_in), query_tensor_type_spec(query_tensor_type_spec_in) {} @@ -237,8 +237,8 @@ TEST_P(ExactNearestNeighborIteratorParameterizedTest, require_that_iterator_retu } void -verify_iterator_returns_filtered_results(const vespalib::string& attribute_tensor_type_spec, - const vespalib::string& query_tensor_type_spec) +verify_iterator_returns_filtered_results(const std::string& attribute_tensor_type_spec, + const std::string& query_tensor_type_spec) { Fixture fixture(attribute_tensor_type_spec); fixture.ensureSpace(6); @@ -294,8 +294,8 @@ std::vector get_rawscores(Fixture &env, const Value &qtv) { } void -verify_iterator_sets_expected_rawscore(const vespalib::string& attribute_tensor_type_spec, - const vespalib::string& query_tensor_type_spec) +verify_iterator_sets_expected_rawscore(const std::string& attribute_tensor_type_spec, + const std::string& query_tensor_type_spec) { Fixture fixture(attribute_tensor_type_spec); fixture.ensureSpace(6); diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.cpp index 504ad057d3d9..8b6a2f1dfc63 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.cpp +++ b/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.cpp @@ -26,8 +26,8 @@ namespace search::queryeval::test { namespace { -const vespalib::string field_name = "myfield"; -const vespalib::string index_dir = "indexdir"; +const std::string field_name = "myfield"; +const std::string index_dir = "indexdir"; uint32_t calc_hits_per_term(uint32_t num_docs, double op_hit_ratio, uint32_t children, QueryOperator query_op) @@ -162,7 +162,7 @@ class MyFactory : public BenchmarkBlueprintFactory { double op_hit_ratio, uint32_t children, bool disjunct_children); std::unique_ptr make_blueprint() override; - vespalib::string get_name(Blueprint& blueprint) const override { + std::string get_name(Blueprint& blueprint) const override { return get_class_name(blueprint); } }; diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.h b/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.h index 2a90dbbbef87..c369831c110e 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.h +++ b/searchlib/src/tests/queryeval/iterator_benchmark/benchmark_blueprint_factory.h @@ -16,7 +16,7 @@ class BenchmarkBlueprintFactory { public: virtual ~BenchmarkBlueprintFactory() = default; virtual std::unique_ptr make_blueprint() = 0; - virtual vespalib::string get_name(Blueprint& blueprint) const = 0; + virtual std::string get_name(Blueprint& blueprint) const = 0; }; std::unique_ptr diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp index 1db9cd58d46a..672cf7d09dde 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp +++ b/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp @@ -8,7 +8,7 @@ using search::attribute::CollectionType; namespace search::queryeval::test { -vespalib::string +std::string to_string(const Config& attr_config) { std::ostringstream oss; @@ -29,7 +29,7 @@ to_string(const Config& attr_config) return oss.str(); } -vespalib::string +std::string to_string(QueryOperator query_op) { switch (query_op) { @@ -61,7 +61,7 @@ delete_substr_from(const std::string& source, const std::string& substr) } -vespalib::string +std::string get_class_name(const auto& obj) { auto res = obj.getClassName(); @@ -74,8 +74,8 @@ get_class_name(const auto& obj) return res; } -template vespalib::string get_class_name(const Blueprint& obj); -template vespalib::string get_class_name(const SearchIterator& obj); +template std::string get_class_name(const Blueprint& obj); +template std::string get_class_name(const SearchIterator& obj); namespace { diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/common.h b/searchlib/src/tests/queryeval/iterator_benchmark/common.h index 6341b16e96a5..8ff51d2e395a 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/common.h +++ b/searchlib/src/tests/queryeval/iterator_benchmark/common.h @@ -13,7 +13,7 @@ namespace search::queryeval::test { using search::attribute::Config; using search::index::Schema; -vespalib::string to_string(const Config& attr_config); +std::string to_string(const Config& attr_config); class FieldConfig { private: @@ -29,7 +29,7 @@ class FieldConfig { res.addIndexField(std::get<1>(_cfg)); return res; } - vespalib::string to_string() const { + std::string to_string() const { return is_attr() ? search::queryeval::test::to_string(attr_cfg()) : "diskindex"; } }; @@ -45,7 +45,7 @@ enum class QueryOperator { ParallelWeakAnd }; -vespalib::string to_string(QueryOperator query_op); +std::string to_string(QueryOperator query_op); struct HitSpec { uint32_t term_value; @@ -79,7 +79,7 @@ class HitSpecs { auto end() const { return _specs.end(); } }; -vespalib::string get_class_name(const auto& obj); +std::string get_class_name(const auto& obj); std::mt19937& get_gen(); diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.cpp index 97251781827a..9221b64ba549 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.cpp +++ b/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.cpp @@ -61,7 +61,7 @@ class DiskIndexSearchable : public BenchmarkSearchable { public: DiskIndexSearchable(std::unique_ptr index) : _index(std::move(index)) {} ~DiskIndexSearchable() { - vespalib::string index_dir = _index->getIndexDir(); + std::string index_dir = _index->getIndexDir(); _index.reset(); std::filesystem::remove_all(std::filesystem::path(index_dir)); } diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.h b/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.h index f25623de6f81..c19f396ac332 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.h +++ b/searchlib/src/tests/queryeval/iterator_benchmark/disk_index_builder.h @@ -27,7 +27,7 @@ class DiskIndexBuilder { TuneFileAttributes _tune_file_attributes; TuneFileSearch _tune_file_search; search::index::DummyFileHeaderContext _file_header_ctx; - vespalib::string _index_dir; + std::string _index_dir; search::FixedSourceSelector _selector; search::diskindex::IndexBuilder _builder; std::unique_ptr _field_builder; diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.cpp index d7be6023f00e..4ce1262ccb82 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.cpp +++ b/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.cpp @@ -43,7 +43,7 @@ IntermediateBlueprintFactory::make_blueprint() return res; } -vespalib::string +std::string IntermediateBlueprintFactory::get_name(Blueprint& blueprint) const { auto* intermediate = blueprint.asIntermediate(); diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.h b/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.h index 39b3efdaea90..45ceb763a9ce 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.h +++ b/searchlib/src/tests/queryeval/iterator_benchmark/intermediate_blueprint_factory.h @@ -14,7 +14,7 @@ namespace search::queryeval::test { */ class IntermediateBlueprintFactory : public BenchmarkBlueprintFactory { private: - vespalib::string _name; + std::string _name; std::vector> _children; std::unordered_map _child_names; @@ -28,7 +28,7 @@ class IntermediateBlueprintFactory : public BenchmarkBlueprintFactory { _children.push_back(std::move(child)); } std::unique_ptr make_blueprint() override; - vespalib::string get_name(Blueprint& blueprint) const override; + std::string get_name(Blueprint& blueprint) const override; }; class AndBlueprintFactory : public IntermediateBlueprintFactory { diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/iterator_benchmark_test.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/iterator_benchmark_test.cpp index e74fefac70e4..841b827ddca4 100644 --- a/searchlib/src/tests/queryeval/iterator_benchmark/iterator_benchmark_test.cpp +++ b/searchlib/src/tests/queryeval/iterator_benchmark/iterator_benchmark_test.cpp @@ -23,7 +23,7 @@ using search::fef::MatchData; using vespalib::make_string_short::fmt; -const vespalib::string field_name = "myfield"; +const std::string field_name = "myfield"; double budget_sec = 1.0; double estimate_actual_cost(Blueprint &bp, InFlow in_flow) { @@ -45,7 +45,7 @@ enum class PlanningAlgo { CostForceStrict }; -vespalib::string +std::string to_string(PlanningAlgo algo) { switch (algo) { @@ -63,11 +63,11 @@ struct BenchmarkResult { uint32_t hits; FlowStats flow; double actual_cost; - vespalib::string iterator_name; - vespalib::string blueprint_name; + std::string iterator_name; + std::string blueprint_name; BenchmarkResult() : BenchmarkResult(0, 0, 0, {0, 0, 0}, 0, "", "") {} BenchmarkResult(double time_ms_in, uint32_t seeks_in, uint32_t hits_in, FlowStats flow_in, double actual_cost_in, - const vespalib::string& iterator_name_in, const vespalib::string& blueprint_name_in) + const std::string& iterator_name_in, const std::string& blueprint_name_in) : time_ms(time_ms_in), seeks(seeks_in), hits(hits_in), @@ -90,7 +90,7 @@ struct Stats { Stats(double average_in, double median_in, double std_dev_in) : average(average_in), median(median_in), std_dev(std_dev_in) {} - vespalib::string to_string() const { + std::string to_string() const { std::ostringstream oss; oss << std::fixed << std::setprecision(3); oss << "{average=" << average << ", median=" << median << ", std_dev=" << std_dev << "}"; @@ -317,7 +317,7 @@ struct Sample { Sample(double v) noexcept : value(v), other(v), forced_strict(false) {} Sample(double v, double o, bool fs) noexcept : value(v), other(o), forced_strict(fs) {} bool operator<(const Sample &rhs) const noexcept { return value < rhs.value; } - vespalib::string str() const noexcept { + std::string str() const noexcept { if (other == value) { return fmt("%g", value); } @@ -429,7 +429,7 @@ void analyze_crossover(BenchmarkBlueprintFactory &fixed, std::function make_factory_shared(size_t num_docs, double op_hit_ratio) const { return std::shared_ptr(make_factory(num_docs, op_hit_ratio)); } - vespalib::string to_string() const { + std::string to_string() const { return "field=" + field_cfg.to_string() + ", query=" + test::to_string(query_op) + ", children=" + std::to_string(children); } }; diff --git a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp index 04a85c9031a9..7fb620d0f7d9 100644 --- a/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp +++ b/searchlib/src/tests/queryeval/matching_elements_search/matching_elements_search_test.cpp @@ -34,7 +34,7 @@ std::shared_ptr make_attribute(BasicType type) { return result; } -std::unique_ptr make_search(AttributeVector &attr, const std::vector &terms) +std::unique_ptr make_search(AttributeVector &attr, const std::vector &terms) { using LookupResult = IDirectPostingStore::LookupResult; auto dwa = attr.as_docid_with_weight_posting_store(); @@ -54,8 +54,8 @@ class MatchingElementsSearchTest : public ::testing::Test { public: static constexpr bool is_string = std::is_same_v; using Values = std::vector>; - using MatchResult = std::map, int32_t>; - using LookupTest = std::pair, MatchResult>; + using MatchResult = std::map, int32_t>; + using LookupTest = std::pair, MatchResult>; using LookupTests = std::vector; using AttributeSubType = std::conditional_t; static Values _values; diff --git a/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp b/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp index f6f0d1557ab4..f47f035094ed 100644 --- a/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp +++ b/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp @@ -176,7 +176,7 @@ TEST(MonitoringSearchIteratorTest, require_that_calls_are_forwarded_to_underlyin void addIterator(MonitoringSearchIterator::Dumper &d, - const vespalib::string &name, + const std::string &name, int64_t numSeeks, double avgDocIdSteps, double avgHitSkips, diff --git a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp index ddb9cab18ab8..d0b60f3ea17c 100644 --- a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp +++ b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp @@ -29,13 +29,13 @@ struct Fixture uint32_t _numDocs; bool _strict; bool _optimize; - vespalib::string _type; + std::string _type; std::vector _fillLimits; Fixture(int argc, char **argv) { _type = argv[1]; - _strict = vespalib::string(argv[2]) == vespalib::string("strict"); - _optimize = vespalib::string(argv[3]) == vespalib::string("optimize"); + _strict = std::string(argv[2]) == std::string("strict"); + _optimize = std::string(argv[3]) == std::string("optimize"); _numSearch = strtoul(argv[4], NULL, 0); _numDocs = strtoul(argv[5], NULL, 0); for (int i(6); i < argc; i++) { diff --git a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp index 0ae3031e6087..fb04e98d94fa 100644 --- a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp +++ b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp @@ -640,7 +640,7 @@ TEST(ParallelWeakAndTest, require_that_asString_on_blueprint_works) BlueprintAsStringFixture f; Node::UP term = f.spec.createNode(57, 67); Blueprint::UP bp = f.blueprint(*term); - vespalib::string expStr = "search::queryeval::ParallelWeakAndBlueprint {\n" + std::string expStr = "search::queryeval::ParallelWeakAndBlueprint {\n" " isTermLike: true\n" " fields: FieldList {\n" " [0]: Field {\n" diff --git a/searchlib/src/tests/queryeval/profiled_iterator/profiled_iterator_test.cpp b/searchlib/src/tests/queryeval/profiled_iterator/profiled_iterator_test.cpp index dbf01fac4f7b..b4ceacb71ca1 100644 --- a/searchlib/src/tests/queryeval/profiled_iterator/profiled_iterator_test.cpp +++ b/searchlib/src/tests/queryeval/profiled_iterator/profiled_iterator_test.cpp @@ -99,7 +99,7 @@ SearchIterator::UP create_weak_and() { return WeakAndSearch::create(terms, wand::MatchParams(dummy_heap), wand::TermFrequencyScorer(), 100, true, true); } -void collect(std::map &counts, const auto &node) { +void collect(std::map &counts, const auto &node) { if (!node.valid()) { return; } @@ -115,13 +115,13 @@ void collect(std::map &counts, const auto &node) { } }; -std::map collect_counts(const auto &root) { - std::map counts; +std::map collect_counts(const auto &root) { + std::map counts; collect(counts, root); return counts; } -void print_counts(const std::map &counts) { +void print_counts(const std::map &counts) { for (const auto &[name, count]: counts) { fprintf(stderr, "%s: %zu\n", name.c_str(), count); } @@ -147,7 +147,7 @@ void verify_termwise_result(SearchIterator &search, const std::vector } } -void verify_operation(ExecutionProfiler &profiler, std::map &seen, const vespalib::string &expect) { +void verify_operation(ExecutionProfiler &profiler, std::map &seen, const std::string &expect) { Slime slime; profiler.report(slime.setObject()); auto counts = collect_counts(slime.get()); @@ -162,7 +162,7 @@ void verify_operation(ExecutionProfiler &profiler, std::map seen; + std::map seen; auto root = ProfiledIterator::profile(profiler, T({1,2,3})); root->initRange(1,4); verify_operation(profiler, seen, "/SimpleSearch/init"); diff --git a/searchlib/src/tests/queryeval/queryeval_test.cpp b/searchlib/src/tests/queryeval/queryeval_test.cpp index 72b934e8af96..d91507d7da66 100644 --- a/searchlib/src/tests/queryeval/queryeval_test.cpp +++ b/searchlib/src/tests/queryeval/queryeval_test.cpp @@ -499,7 +499,7 @@ TEST(QueryEvalTest, test_rank) } } -vespalib::string +std::string getExpectedSlime() { return "{" @@ -640,7 +640,7 @@ TEST(QueryEvalTest, test_dump) .add(SBChild(simple("blend_a"), 2)) .add(SBChild(simple("blend_b"), 4)), true) }, true); - vespalib::string sas = search->asString(); + std::string sas = search->asString(); EXPECT_TRUE(sas.size() > 50); vespalib::Slime slime; search->asSlime(vespalib::slime::SlimeInserter(slime)); @@ -653,7 +653,7 @@ TEST(QueryEvalTest, test_dump) TEST(QueryEvalTest, test_field_spec) { EXPECT_EQ(8u, sizeof(FieldSpecBase)); - EXPECT_EQ(8u + sizeof(vespalib::string), sizeof(FieldSpec)); + EXPECT_EQ(8u + sizeof(std::string), sizeof(FieldSpec)); } diff --git a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp index 2bb255e2a1d1..4334c0bf49e3 100644 --- a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp +++ b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp @@ -37,7 +37,7 @@ std::unique_ptr make_blueprint(const std::vector(make_field_spec(), false); for (size_t i = 0; i < children.size(); ++i) { uint32_t field_id = i; - vespalib::string field_name = vespalib::make_string("f%u", field_id); + std::string field_name = vespalib::make_string("f%u", field_id); FieldSpec field = result->getNextChildField(field_name, field_id); auto fake = std::make_unique(field, children[i]); fake->is_attr(fake_attr); diff --git a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp index 4d84dabf8342..9b081bbf9364 100644 --- a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp +++ b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp @@ -194,7 +194,7 @@ std::vector make_expect(uint32_t begin, uint32_t end) { } void -verify(const std::vector &expect, SearchIterator &search, uint32_t begin, uint32_t end, const vespalib::string& label) +verify(const std::vector &expect, SearchIterator &search, uint32_t begin, uint32_t end, const std::string& label) { SCOPED_TRACE(label); std::vector actual; @@ -431,7 +431,7 @@ TEST(TermwiseEvalTest, require_that_the_hit_rate_must_be_high_enough_for_termwis my_or.addChild(UP(new MyBlueprint({2}, true, 2))); for (bool strict: {true, false}) { my_or.basic_plan(strict, 100); - EXPECT_TRUE(my_or.createSearch(*md)->asString().find("TermwiseSearch") == vespalib::string::npos); + EXPECT_TRUE(my_or.createSearch(*md)->asString().find("TermwiseSearch") == std::string::npos); } } @@ -447,7 +447,7 @@ TEST(TermwiseEvalTest, require_that_enough_unranked_termwise_terms_are_present_f my_or.addChild(UP(new MyBlueprint({3}, true, 3))); // <- ranked for (bool strict: {true, false}) { my_or.basic_plan(strict, 100); - EXPECT_TRUE(my_or.createSearch(*md)->asString().find("TermwiseSearch") == vespalib::string::npos); + EXPECT_TRUE(my_or.createSearch(*md)->asString().find("TermwiseSearch") == std::string::npos); } } diff --git a/searchlib/src/tests/rankingexpression/intrinsic_blueprint_adapter/intrinsic_blueprint_adapter_test.cpp b/searchlib/src/tests/rankingexpression/intrinsic_blueprint_adapter/intrinsic_blueprint_adapter_test.cpp index 951e6836cc26..8d15515d3fa4 100644 --- a/searchlib/src/tests/rankingexpression/intrinsic_blueprint_adapter/intrinsic_blueprint_adapter_test.cpp +++ b/searchlib/src/tests/rankingexpression/intrinsic_blueprint_adapter/intrinsic_blueprint_adapter_test.cpp @@ -14,26 +14,26 @@ using namespace search::fef; using vespalib::Stash; using vespalib::eval::ValueType; -vespalib::string fail_setup = "fail_setup"; -vespalib::string extra_input = "extra_input"; -vespalib::string extra_output = "extra_output"; -vespalib::string no_output = "no_output"; -vespalib::string object_result = "object_result"; -vespalib::string error_result = "error_result"; +std::string fail_setup = "fail_setup"; +std::string extra_input = "extra_input"; +std::string extra_output = "extra_output"; +std::string no_output = "no_output"; +std::string object_result = "object_result"; +std::string error_result = "error_result"; struct MyExecutor : FeatureExecutor { void execute(uint32_t) override {} }; struct MyBlueprint : Blueprint { - std::set flags; + std::set flags; MyBlueprint() : Blueprint("my_bp"), flags() {} - MyBlueprint(const std::set &flags_in) : Blueprint("my_bp"), flags(flags_in) {} - void set(const vespalib::string &flag) { flags.insert(flag); } - bool is_set(const vespalib::string &flag) const { return (flags.count(flag) > 0); } + MyBlueprint(const std::set &flags_in) : Blueprint("my_bp"), flags(flags_in) {} + void set(const std::string &flag) { flags.insert(flag); } + bool is_set(const std::string &flag) const { return (flags.count(flag) > 0); } void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return std::make_unique(flags); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override { EXPECT_EQUAL(getName(), "my_bp(foo,bar)"); ASSERT_TRUE(params.size() == 2); EXPECT_EQUAL(params[0], "foo"); diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp index a5e7fed56855..a0597eddc04a 100644 --- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp +++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp @@ -53,7 +53,7 @@ class DumpFeatureVisitor : public IDumpFeatureVisitor { public: DumpFeatureVisitor() {} - virtual void visitDumpFeature(const vespalib::string & name) override { + virtual void visitDumpFeature(const std::string & name) override { std::cout << "dump feature: " << name << std::endl; } }; @@ -86,8 +86,8 @@ class RankEnvironment class RankExecutor { private: - vespalib::string _initRank; - vespalib::string _finalRank; + std::string _initRank; + std::string _finalRank; const RankEnvironment & _rankEnv; MatchDataLayout _layout; std::unique_ptr _rs; @@ -96,13 +96,13 @@ class RankExecutor RankProgram::UP _secondPhaseProgram; public: - RankExecutor(const vespalib::string &initRank, const vespalib::string &finalRank, const RankEnvironment &rankEnv); + RankExecutor(const std::string &initRank, const std::string &finalRank, const RankEnvironment &rankEnv); ~RankExecutor(); bool setup(); RankResult execute(uint32_t docId = 1); }; -RankExecutor::RankExecutor(const vespalib::string &initRank, const vespalib::string &finalRank, +RankExecutor::RankExecutor(const std::string &initRank, const std::string &finalRank, const RankEnvironment &rankEnv) : _initRank(initRank), _finalRank(finalRank), _rankEnv(rankEnv), _layout(), _rs(), _match_data(), _firstPhaseProgram(), _secondPhaseProgram() @@ -166,7 +166,7 @@ class FeatureDumper public: FeatureDumper(const RankEnvironment & rankEnv); ~FeatureDumper(); - void addDumpFeature(const vespalib::string &name); + void addDumpFeature(const std::string &name); void configure(); bool setup(); RankResult dump(); @@ -181,7 +181,7 @@ FeatureDumper::FeatureDumper(const RankEnvironment & rankEnv) {} FeatureDumper::~FeatureDumper() {} void -FeatureDumper::addDumpFeature(const vespalib::string &name) +FeatureDumper::addDumpFeature(const std::string &name) { _setup.addDumpFeature(name); } @@ -208,7 +208,7 @@ FeatureDumper::setup() RankResult FeatureDumper::dump() { - std::map features = Utils::getSeedFeatures(*_rankProgram, 1); + std::map features = Utils::getSeedFeatures(*_rankProgram, 1); RankResult retval; for (auto itr = features.begin(); itr != features.end(); ++itr) { retval.addScore(itr->first, itr->second); @@ -230,15 +230,15 @@ class RankSetupTest : public ::testing::Test RankEnvironment _rankEnv; DumpFeatureVisitor _visitor; - bool testExecution(const vespalib::string & initRank, feature_t initScore, - const vespalib::string & finalRank = "", feature_t finalScore = 0.0f, uint32_t docId = 1); + bool testExecution(const std::string & initRank, feature_t initScore, + const std::string & finalRank = "", feature_t finalScore = 0.0f, uint32_t docId = 1); bool testExecution(const RankEnvironment &rankEnv, - const vespalib::string & initRank, feature_t initScore, - const vespalib::string & finalRank = "", feature_t finalScore = 0.0f, uint32_t docId = 1); + const std::string & initRank, feature_t initScore, + const std::string & finalRank = "", feature_t finalScore = 0.0f, uint32_t docId = 1); void testExecution(); void testFeatureDump(); - void checkFeatures(std::map &exp, std::map &actual); + void checkFeatures(std::map &exp, std::map &actual); void testFeatureNormalization(); RankSetupTest(); @@ -295,7 +295,7 @@ TEST_F(RankSetupTest, value_blueprint) DummyDependencyHandler deps(*bp); bp->setName("value"); EXPECT_EQ(bp->getName(), "value"); - std::vector params; + std::vector params; params.push_back("5.5"); params.push_back("10.5"); EXPECT_TRUE(bp->setup(_indexEnv, params)); @@ -314,7 +314,7 @@ TEST_F(RankSetupTest, value_blueprint) { // invalid params Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; EXPECT_TRUE(!bp->setup(_indexEnv, params)); } } @@ -326,7 +326,7 @@ TEST_F(RankSetupTest, double_blueprint) { // basic test Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("value(5.5).0"); params.push_back("value(10.5).0"); EXPECT_TRUE(bp->setup(_indexEnv, params)); @@ -346,7 +346,7 @@ TEST_F(RankSetupTest, sum_blueprint) { // basic test Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("value(5.5, 10.5).0"); params.push_back("value(5.5, 10.5).1"); EXPECT_TRUE(bp->setup(_indexEnv, params)); @@ -364,7 +364,7 @@ TEST_F(RankSetupTest, static_rank_blueprint) { // basic test Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("sr1"); EXPECT_TRUE(bp->setup(_indexEnv, params)); EXPECT_EQ(deps.input.size(), 0u); @@ -374,7 +374,7 @@ TEST_F(RankSetupTest, static_rank_blueprint) { // invalid params Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; EXPECT_TRUE(!bp->setup(_indexEnv, params)); params.push_back("sr1"); params.push_back("sr2"); @@ -388,7 +388,7 @@ TEST_F(RankSetupTest, chain_blueprint) { // chaining Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("basic"); params.push_back("2"); params.push_back("4"); @@ -399,7 +399,7 @@ TEST_F(RankSetupTest, chain_blueprint) { // leaf node Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("basic"); params.push_back("1"); params.push_back("4"); @@ -410,7 +410,7 @@ TEST_F(RankSetupTest, chain_blueprint) { // cycle Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; params.push_back("cycle"); params.push_back("1"); params.push_back("4"); @@ -421,7 +421,7 @@ TEST_F(RankSetupTest, chain_blueprint) { // invalid params Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); - std::vector params; + std::vector params; EXPECT_TRUE(!bp->setup(_indexEnv, params)); params.push_back("basic"); params.push_back("0"); @@ -442,7 +442,7 @@ TEST_F(RankSetupTest, cfg_value_blueprint) Blueprint::UP bp = prototype.createInstance(); DummyDependencyHandler deps(*bp); bp->setName("test_cfgvalue(foo)"); - std::vector params; + std::vector params; params.push_back("foo"); EXPECT_TRUE(bp->setup(indexEnv, params)); @@ -565,15 +565,15 @@ TEST_F(RankSetupTest, rank_setup) RankSetup rs(_factory, env); EXPECT_FALSE(rs.has_match_features()); rs.configure(); - EXPECT_EQ(rs.getFirstPhaseRank(), vespalib::string("firstphase")); - EXPECT_EQ(rs.getSecondPhaseRank(), vespalib::string("secondphase")); + EXPECT_EQ(rs.getFirstPhaseRank(), std::string("firstphase")); + EXPECT_EQ(rs.getSecondPhaseRank(), std::string("secondphase")); EXPECT_TRUE(rs.has_match_features()); ASSERT_TRUE(rs.get_match_features().size() == 2); - EXPECT_EQ(rs.get_match_features()[0], vespalib::string("match_foo")); - EXPECT_EQ(rs.get_match_features()[1], vespalib::string("match_bar")); + EXPECT_EQ(rs.get_match_features()[0], std::string("match_foo")); + EXPECT_EQ(rs.get_match_features()[1], std::string("match_bar")); ASSERT_TRUE(rs.getDumpFeatures().size() == 2); - EXPECT_EQ(rs.getDumpFeatures()[0], vespalib::string("foo")); - EXPECT_EQ(rs.getDumpFeatures()[1], vespalib::string("bar")); + EXPECT_EQ(rs.getDumpFeatures()[0], std::string("foo")); + EXPECT_EQ(rs.getDumpFeatures()[1], std::string("bar")); EXPECT_EQ(rs.getNumThreadsPerSearch(), 3u); EXPECT_EQ(rs.getMinHitsPerThread(), 8u); EXPECT_EQ(rs.getDegradationAttribute(), "mystaticrankattr"); @@ -607,15 +607,15 @@ TEST_F(RankSetupTest, rank_setup) } bool -RankSetupTest::testExecution(const vespalib::string & initRank, feature_t initScore, - const vespalib::string & finalRank, feature_t finalScore, uint32_t docId) +RankSetupTest::testExecution(const std::string & initRank, feature_t initScore, + const std::string & finalRank, feature_t finalScore, uint32_t docId) { return testExecution(_rankEnv, initRank, initScore, finalRank, finalScore, docId); } bool -RankSetupTest::testExecution(const RankEnvironment &rankEnv, const vespalib::string & initRank, feature_t initScore, - const vespalib::string & finalRank, feature_t finalScore, uint32_t docId) +RankSetupTest::testExecution(const RankEnvironment &rankEnv, const std::string & initRank, feature_t initScore, + const std::string & finalRank, feature_t finalScore, uint32_t docId) { bool ok = true; RankExecutor re(initRank, finalRank, rankEnv); @@ -635,69 +635,69 @@ RankSetupTest::testExecution(const RankEnvironment &rankEnv, const vespalib::str TEST_F(RankSetupTest, execution) { { // value executor - vespalib::string v = FNB().baseName("value").parameter("5.5").parameter("10.5").buildName(); + std::string v = FNB().baseName("value").parameter("5.5").parameter("10.5").buildName(); EXPECT_TRUE(testExecution(v + ".0", 5.5f)); EXPECT_TRUE(testExecution(v + ".0", 5.5f, v + ".1", 10.5f)); EXPECT_TRUE(testExecution(v, 5.5f)); } { // double executor - vespalib::string d1 = FNB().baseName("double").parameter("value(2).0").parameter("value(8).0").buildName(); - vespalib::string d2 = FNB().baseName("double").parameter("value(2)").parameter("value(8)").buildName(); + std::string d1 = FNB().baseName("double").parameter("value(2).0").parameter("value(8).0").buildName(); + std::string d2 = FNB().baseName("double").parameter("value(2)").parameter("value(8)").buildName(); EXPECT_TRUE(testExecution(d1 + ".0", 4.0f)); EXPECT_TRUE(testExecution(d1 + ".0", 4.0f, d1 + ".1", 16.0f)); EXPECT_TRUE(testExecution(d2, 4.0f)); } { // sum executor - vespalib::string s1 = FNB().baseName("mysum").parameter("value(2).0").parameter("value(4).0").output("out").buildName(); - vespalib::string s2 = FNB().baseName("mysum").parameter("value(2)").parameter("value(4)").buildName(); + std::string s1 = FNB().baseName("mysum").parameter("value(2).0").parameter("value(4).0").output("out").buildName(); + std::string s2 = FNB().baseName("mysum").parameter("value(2)").parameter("value(4)").buildName(); EXPECT_TRUE(testExecution(s1, 6.0f)); EXPECT_TRUE(testExecution(s2, 6.0f)); } { // static rank executor - vespalib::string sr1 = "staticrank(staticrank1)"; - vespalib::string sr2 = "staticrank(staticrank2)"; + std::string sr1 = "staticrank(staticrank1)"; + std::string sr2 = "staticrank(staticrank2)"; for (uint32_t i = 1; i < 5; ++i) { EXPECT_TRUE(testExecution(sr1, static_cast(i + 100), sr2, static_cast(i + 200), i)); } } { // test topologic sorting - vespalib::string v1 = "value(2)"; - vespalib::string d1 = FNB().baseName("double").parameter(v1).buildName(); - vespalib::string d2 = FNB().baseName("double").parameter(d1).buildName(); + std::string v1 = "value(2)"; + std::string d1 = FNB().baseName("double").parameter(v1).buildName(); + std::string d2 = FNB().baseName("double").parameter(d1).buildName(); { - vespalib::string s1 = FNB().baseName("mysum").parameter(v1).parameter(d1).parameter(d2).buildName(); + std::string s1 = FNB().baseName("mysum").parameter(v1).parameter(d1).parameter(d2).buildName(); EXPECT_TRUE(testExecution(s1, 14.0f)); } { - vespalib::string s1 = FNB().baseName("mysum").parameter(d2).parameter(d1).parameter(v1).buildName(); + std::string s1 = FNB().baseName("mysum").parameter(d2).parameter(d1).parameter(v1).buildName(); EXPECT_TRUE(testExecution(s1, 14.0f)); } } { // output used by more than one - vespalib::string v1 = "value(2)"; - vespalib::string d1 = FNB().baseName("double").parameter(v1).buildName(); - vespalib::string d2 = FNB().baseName("double").parameter(v1).buildName(); - vespalib::string s1 = FNB().baseName("mysum").parameter(d1).parameter(d2).buildName(); + std::string v1 = "value(2)"; + std::string d1 = FNB().baseName("double").parameter(v1).buildName(); + std::string d2 = FNB().baseName("double").parameter(v1).buildName(); + std::string s1 = FNB().baseName("mysum").parameter(d1).parameter(d2).buildName(); EXPECT_TRUE(testExecution(s1, 8.0f)); } { // output not shared between phases - vespalib::string v1 = "value(2)"; - vespalib::string v2 = "value(8)"; - vespalib::string d1 = FNB().baseName("double").parameter(v1).buildName(); - vespalib::string d2 = FNB().baseName("double").parameter(v2).buildName(); + std::string v1 = "value(2)"; + std::string v2 = "value(8)"; + std::string d1 = FNB().baseName("double").parameter(v1).buildName(); + std::string d2 = FNB().baseName("double").parameter(v2).buildName(); EXPECT_TRUE(testExecution(d1, 4.0f, d2, 16.0f)); } { // output shared between phases - vespalib::string v1 = "value(2)"; - vespalib::string v2 = "value(8)"; - vespalib::string v3 = "value(32)"; - vespalib::string d1 = FNB().baseName("double").parameter(v1).buildName(); - vespalib::string d2 = FNB().baseName("double").parameter(v2).buildName(); - vespalib::string d3 = FNB().baseName("double").parameter(v3).buildName(); - vespalib::string s1 = FNB().baseName("mysum").parameter(d1).parameter(d2).buildName(); - vespalib::string s2 = FNB().baseName("mysum").parameter(d2).parameter(d3).buildName(); + std::string v1 = "value(2)"; + std::string v2 = "value(8)"; + std::string v3 = "value(32)"; + std::string d1 = FNB().baseName("double").parameter(v1).buildName(); + std::string d2 = FNB().baseName("double").parameter(v2).buildName(); + std::string d3 = FNB().baseName("double").parameter(v3).buildName(); + std::string s1 = FNB().baseName("mysum").parameter(d1).parameter(d2).buildName(); + std::string s2 = FNB().baseName("mysum").parameter(d2).parameter(d3).buildName(); EXPECT_TRUE(testExecution(s1, 20.0f, s2, 80.0f)); } { // max dependency depth @@ -712,7 +712,7 @@ TEST_F(RankSetupTest, execution) indexEnv.getProperties().add("test_cfgvalue(foo).value", "2.0"); indexEnv.getProperties().add("test_cfgvalue(bar).value", "5.0"); - vespalib::string s = FNB().baseName("mysum") + std::string s = FNB().baseName("mysum") .parameter("test_cfgvalue(foo).0") .parameter("test_cfgvalue(foo).1") .buildName(); @@ -826,9 +826,9 @@ TEST_F(RankSetupTest, feature_dump) } void -RankSetupTest::checkFeatures(std::map &exp, std::map &actual) +RankSetupTest::checkFeatures(std::map &exp, std::map &actual) { - using ITR = std::map::const_iterator; + using ITR = std::map::const_iterator; ASSERT_EQ(exp.size(), actual.size()); ITR exp_itr = exp.begin(); ITR exp_end = exp.end(); @@ -879,16 +879,16 @@ TEST_F(RankSetupTest, feature_normalization) { SCOPED_TRACE("rank seed features"); - std::map actual = Utils::getSeedFeatures(*summaryProgram, 1); - std::map exp; + std::map actual = Utils::getSeedFeatures(*summaryProgram, 1); + std::map exp; exp["mysum(value(5),value(5))"] = 10.0; exp["mysum(\"value( 5 )\",\"value( 5 )\")"] = 10.0; checkFeatures(exp, actual); } { SCOPED_TRACE("all rank features (1. phase)"); - std::map actual = Utils::getAllFeatures(*firstPhaseProgram, 1); - std::map exp; + std::map actual = Utils::getAllFeatures(*firstPhaseProgram, 1); + std::map exp; exp["value(1)"] = 1.0; exp["value(1).0"] = 1.0; exp["mysum(value(1),value(1))"] = 2.0; @@ -897,8 +897,8 @@ TEST_F(RankSetupTest, feature_normalization) } { SCOPED_TRACE("all rank features (2. phase)"); - std::map actual = Utils::getAllFeatures(*secondPhaseProgram, 1); - std::map exp; + std::map actual = Utils::getAllFeatures(*secondPhaseProgram, 1); + std::map exp; exp["value(2)"] = 2.0; exp["value(2).0"] = 2.0; exp["mysum(value(2),value(2))"] = 4.0; @@ -907,8 +907,8 @@ TEST_F(RankSetupTest, feature_normalization) } { SCOPED_TRACE("all match features"); - std::map actual = Utils::getAllFeatures(*match_program, 1); - std::map exp; + std::map actual = Utils::getAllFeatures(*match_program, 1); + std::map exp; exp["value(3)"] = 3.0; exp["value(3).0"] = 3.0; exp["mysum(value(3),value(3))"] = 6.0; @@ -919,8 +919,8 @@ TEST_F(RankSetupTest, feature_normalization) } { SCOPED_TRACE("all rank features (summary)"); - std::map actual = Utils::getAllFeatures(*summaryProgram, 1); - std::map exp; + std::map actual = Utils::getAllFeatures(*summaryProgram, 1); + std::map exp; exp["value(5)"] = 5.0; exp["value(5).0"] = 5.0; exp["mysum(value(5),value(5))"] = 10.0; @@ -940,8 +940,8 @@ TEST_F(RankSetupTest, feature_normalization) { SCOPED_TRACE("dump seed features"); - std::map actual = Utils::getSeedFeatures(*rankProgram, 1); - std::map exp; + std::map actual = Utils::getSeedFeatures(*rankProgram, 1); + std::map exp; exp["mysum(value(10),value(10))"] = 20.0; exp["mysum(\"value( 10 )\",\"value( 10 )\")"] = 20.0; checkFeatures(exp, actual); @@ -949,8 +949,8 @@ TEST_F(RankSetupTest, feature_normalization) { SCOPED_TRACE("all dump features"); - std::map actual = Utils::getAllFeatures(*rankProgram, 1); - std::map exp; + std::map actual = Utils::getAllFeatures(*rankProgram, 1); + std::map exp; exp["value(10)"] = 10.0; exp["value(10).0"] = 10.0; diff --git a/searchlib/src/tests/ranksetup/verify_feature/verify_feature_test.cpp b/searchlib/src/tests/ranksetup/verify_feature/verify_feature_test.cpp index 6c6ca7ce5436..599a02339a0d 100644 --- a/searchlib/src/tests/ranksetup/verify_feature/verify_feature_test.cpp +++ b/searchlib/src/tests/ranksetup/verify_feature/verify_feature_test.cpp @@ -14,7 +14,7 @@ using namespace search::fef::test; using namespace search::fef; using vespalib::make_string_short::fmt; -typedef bool (*cmp)(const vespalib::string & a, const vespalib::string &b); +typedef bool (*cmp)(const std::string & a, const std::string &b); namespace search::fef { std::ostream &operator<<(std::ostream &os, Level level) { @@ -28,12 +28,12 @@ std::ostream &operator<<(std::ostream &os, Level level) { } } -bool equal(const vespalib::string & a, const vespalib::string &b) { +bool equal(const std::string & a, const std::string &b) { EXPECT_EQUAL(a, b); return a == b; } -bool regex(const vespalib::string & a, const vespalib::string &b) { +bool regex(const std::string & a, const std::string &b) { std::regex exp(b.c_str()); return std::regex_match(a.c_str(), exp); } diff --git a/searchlib/src/tests/searchcommon/schema/schema_test.cpp b/searchlib/src/tests/searchcommon/schema/schema_test.cpp index 20221061e454..22ed3cfdefb2 100644 --- a/searchlib/src/tests/searchcommon/schema/schema_test.cpp +++ b/searchlib/src/tests/searchcommon/schema/schema_test.cpp @@ -4,13 +4,13 @@ #include #include #include -#include #include +#include #include LOG_SETUP("schema_test"); -using vespalib::string; +using std::string; namespace search::index { @@ -19,7 +19,7 @@ using schema::CollectionType; using SIAF = Schema::ImportedAttributeField; using SIF = Schema::IndexField; -vespalib::string src_path(std::string_view prefix, std::string_view path) { +std::string src_path(std::string_view prefix, std::string_view path) { return prefix + TEST_PATH(std::string(path)); } @@ -297,7 +297,7 @@ TEST(SchemaTest, require_that_incompatible_fields_are_removed_from_intersection) TEST(SchemaTest, require_that_imported_attribute_fields_are_not_saved_to_disk) { - const vespalib::string fileName = "schema-no-imported-fields.txt"; + const std::string fileName = "schema-no-imported-fields.txt"; { Schema s; s.addImportedAttributeField(Schema::ImportedAttributeField("imported", DataType::INT32)); @@ -341,7 +341,7 @@ TEST(SchemaTest, require_that_index_field_is_loaded_with_default_values_when_pro TEST(SchemaTest, test_load_from_saved_schema_with_summary_fields) { - vespalib::string schema_name(TEST_PATH("old-schema-with-summary-fields.txt")); + std::string schema_name(TEST_PATH("old-schema-with-summary-fields.txt")); Schema s; s.addIndexField(Schema::IndexField("ifoo", DataType::STRING)); s.addIndexField(Schema::IndexField("ibar", DataType::INT32)); diff --git a/searchlib/src/tests/sort/sort_test.cpp b/searchlib/src/tests/sort/sort_test.cpp index f0047e6fe0ef..44fbb87b31e3 100644 --- a/searchlib/src/tests/sort/sort_test.cpp +++ b/searchlib/src/tests/sort/sort_test.cpp @@ -239,7 +239,7 @@ TEST("testSortSpec") TEST("testSameAsJavaOrder") { - std::vector javaOrder; + std::vector javaOrder; std::ifstream is(TEST_PATH("javaorder.zh")); while (!is.eof()) { std::string line; @@ -251,12 +251,12 @@ TEST("testSameAsJavaOrder") EXPECT_EQUAL(158u, javaOrder.size()); UcaConverter uca("zh", "PRIMARY"); vespalib::ConstBufferRef fkey = uca.convert(vespalib::ConstBufferRef(javaOrder[0].c_str(), javaOrder[0].size())); - vespalib::string prev(fkey.c_str(), fkey.size()); + std::string prev(fkey.c_str(), fkey.size()); return; // TODO: temporarily ignored as java and c++ are no longer in sync for (size_t i(1); i < javaOrder.size(); i++) { vespalib::ConstBufferRef key = uca.convert(vespalib::ConstBufferRef(javaOrder[i].c_str(), javaOrder[i].size())); vespalib::HexDump dump(key.c_str(), key.size()); - vespalib::string current(key.c_str(), key.size()); + std::string current(key.c_str(), key.size()); UErrorCode status(U_ZERO_ERROR); UCollationResult cr = uca.getCollator().compareUTF8(javaOrder[i-1].c_str(), javaOrder[i].c_str(), status); std::cout << std::setw(3) << i << ": " << status << "(" << u_errorName(status) << ") - " << cr << " '" << dump << "' : '" << javaOrder[i] << "'" << std::endl; diff --git a/searchlib/src/tests/sort/sortbenchmark.cpp b/searchlib/src/tests/sort/sortbenchmark.cpp index 2f18fcfff8c9..753238dc6d61 100644 --- a/searchlib/src/tests/sort/sortbenchmark.cpp +++ b/searchlib/src/tests/sort/sortbenchmark.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include using vespalib::Array; using vespalib::ConstBufferRef; @@ -79,7 +79,7 @@ Test::cat() const TEST_MAIN() { size_t numVectors(11); size_t values(10000000); - vespalib::string type("radix"); + std::string type("radix"); if (argc > 1) { values = strtol(argv[1], NULL, 0); if (argc > 2) { diff --git a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp index 498d1f673b05..a0dc2fe8c319 100644 --- a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp +++ b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp @@ -31,7 +31,7 @@ makeTensor(const TensorSpec &spec) struct Fixture { DenseTensorStore store; - explicit Fixture(const vespalib::string &tensorType) + explicit Fixture(const std::string &tensorType) : store(ValueType::from_spec(tensorType), {}) {} void assertSetAndGetTensor(const TensorSpec &tensorSpec) { @@ -72,7 +72,7 @@ TEST_F("require that correct empty tensor is returned for 1d bound tensor", Fixt } void -assertArraySize(const vespalib::string &tensorType, uint32_t expArraySize) { +assertArraySize(const std::string &tensorType, uint32_t expArraySize) { Fixture f(tensorType); EXPECT_EQUAL(expArraySize, f.store.getArraySize()); } @@ -95,7 +95,7 @@ TEST("require that array size is calculated correctly") } void -assert_max_buffer_entries(const vespalib::string& tensor_type, uint32_t exp_entries) +assert_max_buffer_entries(const std::string& tensor_type, uint32_t exp_entries) { Fixture f(tensor_type); EXPECT_EQUAL(exp_entries, f.store.get_max_buffer_entries()); diff --git a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp index 40c3c229b334..ed0d6f2eb6c6 100644 --- a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp +++ b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp @@ -18,7 +18,7 @@ using vespalib::eval::ValueType; using vespalib::eval::TypedCells; using vespalib::MemoryUsage; -vespalib::string tensor_type_spec("tensor(x{})"); +std::string tensor_type_spec("tensor(x{})"); class MockBigTensor : public Value { diff --git a/searchlib/src/tests/tensor/distance_calculator/distance_calculator_test.cpp b/searchlib/src/tests/tensor/distance_calculator/distance_calculator_test.cpp index 136878f0ea50..f40719a9156a 100644 --- a/searchlib/src/tests/tensor/distance_calculator/distance_calculator_test.cpp +++ b/searchlib/src/tests/tensor/distance_calculator/distance_calculator_test.cpp @@ -19,7 +19,7 @@ using search::AttributeVector; using OptSubspace = std::optional; -std::unique_ptr make_tensor(const vespalib::string& expr) { +std::unique_ptr make_tensor(const std::string& expr) { return SimpleValue::from_spec(TensorSpec::from_expr(expr)); } @@ -32,34 +32,34 @@ class DistanceCalculatorTest : public testing::Test { { } - void build_attribute(const vespalib::string& tensor_type, - const std::vector& tensor_values) { + void build_attribute(const std::string& tensor_type, + const std::vector& tensor_values) { Config cfg(BasicType::TENSOR); cfg.setTensorType(ValueType::from_spec(tensor_type)); cfg.set_distance_metric(DistanceMetric::Euclidean); attr = AttributeBuilder("doc_tensor", cfg).fill_tensor(tensor_values).get(); ASSERT_TRUE(attr.get() != nullptr); } - double calc_distance(uint32_t docid, const vespalib::string& query_tensor) { + double calc_distance(uint32_t docid, const std::string& query_tensor) { auto qt = make_tensor(query_tensor); auto calc = DistanceCalculator::make_with_validation(*attr, *qt); return calc->has_single_subspace() ? calc->calc_with_limit(docid, std::numeric_limits::max()) : calc->calc_with_limit(docid, std::numeric_limits::max()); } - double calc_rawscore(uint32_t docid, const vespalib::string& query_tensor) { + double calc_rawscore(uint32_t docid, const std::string& query_tensor) { auto qt = make_tensor(query_tensor); auto calc = DistanceCalculator::make_with_validation(*attr, *qt); return calc->has_single_subspace() ? calc->calc_raw_score(docid) : calc->calc_raw_score(docid); } - OptSubspace calc_closest_subspace(uint32_t docid, const vespalib::string& query_tensor) { + OptSubspace calc_closest_subspace(uint32_t docid, const std::string& query_tensor) { auto qt = make_tensor(query_tensor); auto calc = DistanceCalculator::make_with_validation(*attr, *qt); return calc->calc_closest_subspace(attr->asTensorAttribute()->get_vectors(docid)); } - void make_calc_throws(const vespalib::string& query_tensor) { + void make_calc_throws(const std::string& query_tensor) { auto qt = make_tensor(query_tensor); DistanceCalculator::make_with_validation(*attr, *qt); } @@ -70,7 +70,7 @@ constexpr double max_distance = std::numeric_limits::max(); TEST_F(DistanceCalculatorTest, calculation_over_dense_tensor_attribute) { build_attribute("tensor(y[2])", {"[3,10]", ""}); - vespalib::string qt = "tensor(y[2]):[7,10]"; + std::string qt = "tensor(y[2]):[7,10]"; EXPECT_DOUBLE_EQ(16, calc_distance(1, qt)); EXPECT_DOUBLE_EQ(max_distance, calc_distance(2, qt)); EXPECT_EQ(OptSubspace(0), calc_closest_subspace(1, qt)); @@ -85,8 +85,8 @@ TEST_F(DistanceCalculatorTest, calculation_over_mixed_tensor_attribute) build_attribute("tensor(x{},y[2])", {"{{x:\"a\",y:0}:3,{x:\"a\",y:1}:10,{x:\"b\",y:0}:5,{x:\"b\",y:1}:10}", "{}", ""}); - vespalib::string qt_1 = "tensor(y[2]):[9,10]"; - vespalib::string qt_2 = "tensor(y[2]):[1,10]"; + std::string qt_1 = "tensor(y[2]):[9,10]"; + std::string qt_2 = "tensor(y[2]):[1,10]"; EXPECT_DOUBLE_EQ(16, calc_distance(1, qt_1)); EXPECT_DOUBLE_EQ(4, calc_distance(1, qt_2)); EXPECT_EQ(OptSubspace(1), calc_closest_subspace(1, qt_1)); diff --git a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp index 68afcce02e13..0b962f1e90fe 100644 --- a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp @@ -264,7 +264,7 @@ class HnswIndexTest : public ::testing::Test { ASSERT_EQ(exp_levels.size(), act_node.size()); EXPECT_EQ(exp_levels, act_node.levels()); } - void expect_top_3_by_docid(const vespalib::string& label, std::vector qv, const std::vector& exp) { + void expect_top_3_by_docid(const std::string& label, std::vector qv, const std::vector& exp) { SCOPED_TRACE(label); uint32_t k = 3; uint32_t explore_k = 100; @@ -340,7 +340,7 @@ class HnswIndexTest : public ::testing::Test { this->add_document(4); } - void check_savetest_index(const vespalib::string& label) { + void check_savetest_index(const std::string& label) { SCOPED_TRACE(label); auto nodeid_for_doc_7 = get_single_nodeid(7); auto nodeid_for_doc_4 = get_single_nodeid(4); @@ -1117,7 +1117,7 @@ class TwoPhaseTest : public HnswIndexTest { this->commit(); } - uint32_t prepare_insert_during_remove_pass(bool heuristic_select_neighbors, uint32_t schedule_clear_tensor, const vespalib::string& label); + uint32_t prepare_insert_during_remove_pass(bool heuristic_select_neighbors, uint32_t schedule_clear_tensor, const std::string& label); void prepare_insert_during_remove(bool heuristic_select_neighbors); }; @@ -1126,7 +1126,7 @@ TwoPhaseTest::~TwoPhaseTest() = default; template uint32_t -TwoPhaseTest::prepare_insert_during_remove_pass(bool heuristic_select_neighbors, uint32_t schedule_clear_tensor, const vespalib::string& label) +TwoPhaseTest::prepare_insert_during_remove_pass(bool heuristic_select_neighbors, uint32_t schedule_clear_tensor, const std::string& label) { SCOPED_TRACE(label); this->init(heuristic_select_neighbors); diff --git a/searchlib/src/tests/tensor/tensor_buffer_operations/tensor_buffer_operations_test.cpp b/searchlib/src/tests/tensor/tensor_buffer_operations/tensor_buffer_operations_test.cpp index 3096f6a25ae5..abe3d04f4116 100644 --- a/searchlib/src/tests/tensor/tensor_buffer_operations/tensor_buffer_operations_test.cpp +++ b/searchlib/src/tests/tensor/tensor_buffer_operations/tensor_buffer_operations_test.cpp @@ -17,17 +17,17 @@ using vespalib::eval::Value; using vespalib::eval::ValueType; using vespalib::eval::TypedCells; -const vespalib::string tensor_type_spec("tensor(x{})"); -const vespalib::string tensor_type_2d_spec("tensor(x{},y{})"); -const vespalib::string tensor_type_2d_mixed_spec("tensor(x{},y[2])"); -const vespalib::string float_tensor_type_spec("tensor(y{})"); +const std::string tensor_type_spec("tensor(x{})"); +const std::string tensor_type_2d_spec("tensor(x{},y{})"); +const std::string tensor_type_2d_mixed_spec("tensor(x{},y[2])"); +const std::string float_tensor_type_spec("tensor(y{})"); struct TestParam { - vespalib::string _name; + std::string _name; std::vector _array_sizes; TensorSpec _tensor_spec; - TestParam(vespalib::string name, std::vector array_sizes, TensorSpec tensor_spec) + TestParam(std::string name, std::vector array_sizes, TensorSpec tensor_spec) : _name(std::move(name)), _array_sizes(std::move(array_sizes)), _tensor_spec(std::move(tensor_spec)) diff --git a/searchlib/src/tests/tensor/tensor_buffer_store/tensor_buffer_store_test.cpp b/searchlib/src/tests/tensor/tensor_buffer_store/tensor_buffer_store_test.cpp index 07d0628bb166..29ce7d0e23e2 100644 --- a/searchlib/src/tests/tensor/tensor_buffer_store/tensor_buffer_store_test.cpp +++ b/searchlib/src/tests/tensor/tensor_buffer_store/tensor_buffer_store_test.cpp @@ -19,7 +19,7 @@ using vespalib::eval::TensorSpec; using vespalib::eval::Value; using vespalib::eval::ValueType; -const vespalib::string tensor_type_spec("tensor(x{})"); +const std::string tensor_type_spec("tensor(x{})"); class TensorBufferStoreTest : public testing::Test { @@ -192,7 +192,7 @@ TEST_F(TensorBufferStoreTest, buffer_handles_range_of_subspaces) for (uint32_t x = 0; x < 400; ++x) { vespalib::asciistream x_stream; x_stream << x; - vespalib::string x_as_string = x_stream.str(); + std::string x_as_string = x_stream.str(); tensor_spec.add({{"x", x_as_string.c_str()}}, x + 1.5); auto tensor = value_from_spec(tensor_spec, FastValueBuilderFactory::get()); EXPECT_EQ(_tensor_type, tensor->type()); diff --git a/searchlib/src/tests/tensor/tensor_buffer_type_mapper/tensor_buffer_type_mapper_test.cpp b/searchlib/src/tests/tensor/tensor_buffer_type_mapper/tensor_buffer_type_mapper_test.cpp index 8897f6cc9b62..1dddd2ef51ea 100644 --- a/searchlib/src/tests/tensor/tensor_buffer_type_mapper/tensor_buffer_type_mapper_test.cpp +++ b/searchlib/src/tests/tensor/tensor_buffer_type_mapper/tensor_buffer_type_mapper_test.cpp @@ -12,11 +12,11 @@ using search::tensor::TensorBufferTypeMapper; using vespalib::datastore::ArrayStoreConfig; using vespalib::eval::ValueType; -const vespalib::string tensor_type_sparse_spec("tensor(x{})"); -const vespalib::string tensor_type_2d_spec("tensor(x{},y{})"); -const vespalib::string tensor_type_2d_mixed_spec("tensor(x{},y[2])"); -const vespalib::string float_tensor_type_spec("tensor(y{})"); -const vespalib::string tensor_type_dense_spec("tensor(x[2])"); +const std::string tensor_type_sparse_spec("tensor(x{})"); +const std::string tensor_type_2d_spec("tensor(x{},y{})"); +const std::string tensor_type_2d_mixed_spec("tensor(x{},y[2])"); +const std::string float_tensor_type_spec("tensor(y{})"); +const std::string tensor_type_dense_spec("tensor(x[2])"); namespace { @@ -28,12 +28,12 @@ constexpr size_t max_max_buffer_size = std::numeric_limits::max(); struct TestParam { - vespalib::string _name; + std::string _name; std::vector _array_sizes; std::vector _large_array_sizes; std::vector _type_id_caps; - vespalib::string _tensor_type_spec; - TestParam(vespalib::string name, std::vector array_sizes, std::vector large_array_sizes, std::vector type_id_caps, const vespalib::string& tensor_type_spec) + std::string _tensor_type_spec; + TestParam(std::string name, std::vector array_sizes, std::vector large_array_sizes, std::vector type_id_caps, const std::string& tensor_type_spec) : _name(std::move(name)), _array_sizes(std::move(array_sizes)), _large_array_sizes(std::move(large_array_sizes)), diff --git a/searchlib/src/tests/test/schema_builder/schema_builder_test.cpp b/searchlib/src/tests/test/schema_builder/schema_builder_test.cpp index 174d34080c95..4c899f390417 100644 --- a/searchlib/src/tests/test/schema_builder/schema_builder_test.cpp +++ b/searchlib/src/tests/test/schema_builder/schema_builder_test.cpp @@ -44,7 +44,7 @@ class SchemaBuilderTest : public testing::Test ~SchemaBuilderTest(); void assert_index(std::string_view name, search::index::schema::DataType exp_dt, CollectionType exp_ct); void assert_all_indexes(); - void assert_attribute(std::string_view name, search::index::schema::DataType exp_dt, CollectionType exp_ct, const vespalib::string exp_tensor_spec = ""); + void assert_attribute(std::string_view name, search::index::schema::DataType exp_dt, CollectionType exp_ct, const std::string exp_tensor_spec = ""); void assert_all_attributes(); }; @@ -78,7 +78,7 @@ SchemaBuilderTest::assert_all_indexes() } void -SchemaBuilderTest::assert_attribute(std::string_view name, search::index::schema::DataType exp_dt, CollectionType exp_ct, const vespalib::string exp_tensor_spec) +SchemaBuilderTest::assert_attribute(std::string_view name, search::index::schema::DataType exp_dt, CollectionType exp_ct, const std::string exp_tensor_spec) { auto field_id = schema.getAttributeFieldId(name); ASSERT_NE(Schema::UNKNOWN_FIELD_ID, field_id); diff --git a/searchlib/src/tests/test/string_field_builder/string_field_builder_test.cpp b/searchlib/src/tests/test/string_field_builder/string_field_builder_test.cpp index 7134068de3f5..b516ccee0edf 100644 --- a/searchlib/src/tests/test/string_field_builder/string_field_builder_test.cpp +++ b/searchlib/src/tests/test/string_field_builder/string_field_builder_test.cpp @@ -24,12 +24,12 @@ using search::test::StringFieldBuilder; namespace { -const vespalib::string SPANTREE_NAME("linguistics"); +const std::string SPANTREE_NAME("linguistics"); struct MyAnnotation { int32_t start; int32_t length; - std::optional label; + std::optional label; MyAnnotation(int32_t start_in, int32_t length_in) noexcept : start(start_in), @@ -38,7 +38,7 @@ struct MyAnnotation { { } - MyAnnotation(int32_t start_in, int32_t length_in, vespalib::string label_in) noexcept + MyAnnotation(int32_t start_in, int32_t length_in, std::string label_in) noexcept : start(start_in), length(length_in), label(label_in) @@ -75,7 +75,7 @@ class StringFieldBuilderTest : public testing::Test StringFieldBuilderTest(); ~StringFieldBuilderTest(); std::vector get_annotations(const StringFieldValue& val); - void assert_annotations(std::vector exp, const vespalib::string& plain, const StringFieldValue& val); + void assert_annotations(std::vector exp, const std::string& plain, const StringFieldValue& val); }; StringFieldBuilderTest::StringFieldBuilderTest() @@ -112,7 +112,7 @@ StringFieldBuilderTest::get_annotations(const StringFieldValue& val) } void -StringFieldBuilderTest::assert_annotations(std::vector exp, const vespalib::string& plain, const StringFieldValue& val) +StringFieldBuilderTest::assert_annotations(std::vector exp, const std::string& plain, const StringFieldValue& val) { EXPECT_EQ(exp, get_annotations(val)); EXPECT_EQ(plain, val.getValue()); diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp index e4a7b66e7b17..fa8381ef44ed 100644 --- a/searchlib/src/tests/transactionlog/translogclient_test.cpp +++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp @@ -30,23 +30,23 @@ using search::transactionlog::client::Callback; namespace { -bool createDomainTest(TransLogClient & tls, const vespalib::string & name, size_t preExistingDomains=0); -std::unique_ptr openDomainTest(TransLogClient & tls, const vespalib::string & name); -bool fillDomainTest(Session * s1, const vespalib::string & name); +bool createDomainTest(TransLogClient & tls, const std::string & name, size_t preExistingDomains=0); +std::unique_ptr openDomainTest(TransLogClient & tls, const std::string & name); +bool fillDomainTest(Session * s1, const std::string & name); void fillDomainTest(Session * s1, size_t numPackets, size_t numEntries); void fillDomainTest(Session * s1, size_t numPackets, size_t numEntries, size_t entrySize); uint32_t countFiles(const std::string& dir); void checkFilledDomainTest(Session &s1, size_t numEntries); -bool visitDomainTest(TransLogClient & tls, Session * s1, const vespalib::string & name); -void createAndFillDomain(const vespalib::string & dir, const vespalib::string & name, Encoding encoding, size_t preExistingDomains); -void verifyDomain(const vespalib::string & dir, const vespalib::string & name); +bool visitDomainTest(TransLogClient & tls, Session * s1, const std::string & name); +void createAndFillDomain(const std::string & dir, const std::string & name, Encoding encoding, size_t preExistingDomains); +void verifyDomain(const std::string & dir, const std::string & name); -vespalib::string +std::string myhex(const void * b, size_t sz) { static const char * hextab="0123456789ABCDEF"; const auto * c = static_cast(b); - vespalib::string s; + std::string s; s.reserve(sz*2); for (size_t i=0; i < sz; i++) { s += hextab[c[i] >> 4]; @@ -260,10 +260,10 @@ IMPLEMENT_IDENTIFIABLE(TestIdentifiable, Identifiable); constexpr size_t DEFAULT_PACKET_SIZE = 0xf000; bool -createDomainTest(TransLogClient & tls, const vespalib::string & name, size_t preExistingDomains) +createDomainTest(TransLogClient & tls, const std::string & name, size_t preExistingDomains) { bool retval(true); - std::vector dir; + std::vector dir; tls.listDomains(dir); EXPECT_EQUAL (dir.size(), preExistingDomains); auto s1 = tls.open(name); @@ -278,7 +278,7 @@ createDomainTest(TransLogClient & tls, const vespalib::string & name, size_t pre } std::unique_ptr -openDomainTest(TransLogClient & tls, const vespalib::string & name) +openDomainTest(TransLogClient & tls, const std::string & name) { auto s1 = tls.open(name); ASSERT_TRUE (s1); @@ -286,7 +286,7 @@ openDomainTest(TransLogClient & tls, const vespalib::string & name) } bool -fillDomainTest(Session * s1, const vespalib::string & name) +fillDomainTest(Session * s1, const std::string & name) { bool retval(true); Packet::Entry e1(1, 1, vespalib::ConstBufferRef("Content in buffer A", 20)); @@ -344,7 +344,7 @@ fillDomainTest(Session * s1, size_t numPackets, size_t numEntries) } void -fillDomainTest(IDestructorCallback::SP onDone, TransLogServer & tls, const vespalib::string & domain, size_t numPackets, size_t numEntries) +fillDomainTest(IDestructorCallback::SP onDone, TransLogServer & tls, const std::string & domain, size_t numPackets, size_t numEntries) { size_t value(0); auto domainWriter = tls.getWriter(domain); @@ -365,7 +365,7 @@ fillDomainTest(IDestructorCallback::SP onDone, TransLogServer & tls, const vespa } void -fillDomainTest(TransLogServer & tls, const vespalib::string & domain, size_t numPackets, size_t numEntries) { +fillDomainTest(TransLogServer & tls, const std::string & domain, size_t numPackets, size_t numEntries) { vespalib::Gate gate; fillDomainTest(std::make_shared(gate), tls, domain, numPackets, numEntries); gate.await(); @@ -415,7 +415,7 @@ checkFilledDomainTest(Session &s1, size_t numEntries) } bool -visitDomainTest(TransLogClient & tls, Session * s1, const vespalib::string & name) +visitDomainTest(TransLogClient & tls, Session * s1, const std::string & name) { bool retval(true); @@ -470,7 +470,7 @@ visitDomainTest(TransLogClient & tls, Session * s1, const vespalib::string & nam } double -getMaxSessionRunTime(TransLogServer &tls, const vespalib::string &domain) +getMaxSessionRunTime(TransLogServer &tls, const std::string &domain) { return tls.getDomainStats()[domain].maxSessionRunTime.count(); } @@ -478,7 +478,7 @@ getMaxSessionRunTime(TransLogServer &tls, const vespalib::string &domain) struct TLS { FNET_Transport transport; TransLogServer tls; - TLS(const vespalib::string &name, int listenPort, const vespalib::string &baseDir, + TLS(const std::string &name, int listenPort, const std::string &baseDir, const common::FileHeaderContext &fileHeaderContext, const DomainConfig & cfg, size_t maxThreads = 4) : transport(), tls(transport, name, listenPort, baseDir, fileHeaderContext, cfg, maxThreads) @@ -492,7 +492,7 @@ struct TLS { }; void -createAndFillDomain(const vespalib::string & dir, const vespalib::string & name, Encoding encoding, size_t preExistingDomains) +createAndFillDomain(const std::string & dir, const std::string & name, Encoding encoding, size_t preExistingDomains) { DummyFileHeaderContext fileHeaderContext; TLS tlss(dir, 18377, ".", fileHeaderContext, @@ -505,7 +505,7 @@ createAndFillDomain(const vespalib::string & dir, const vespalib::string & name, } void -verifyDomain(const vespalib::string & dir, const vespalib::string & name) { +verifyDomain(const std::string & dir, const std::string & name) { DummyFileHeaderContext fileHeaderContext; TLS tlss(dir, 18377, ".", fileHeaderContext, createDomainConfig(0x1000000)); TransLogClient tls(tlss.transport, "tcp/localhost:18377"); @@ -516,12 +516,12 @@ verifyDomain(const vespalib::string & dir, const vespalib::string & name) { void -testVisitOverGeneratedDomain(const vespalib::string & testDir) { +testVisitOverGeneratedDomain(const std::string & testDir) { DummyFileHeaderContext fileHeaderContext; TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000)); TransLogClient tls(tlss.transport, "tcp/localhost:18377"); - vespalib::string name("test1"); + std::string name("test1"); createDomainTest(tls, name); auto s1 = openDomainTest(tls, name); fillDomainTest(s1.get(), name); @@ -533,19 +533,19 @@ testVisitOverGeneratedDomain(const vespalib::string & testDir) { } void -testVisitOverPreExistingDomain(const vespalib::string & testDir) { +testVisitOverPreExistingDomain(const std::string & testDir) { // Depends on Test::testVisitOverGeneratedDomain() DummyFileHeaderContext fileHeaderContext; TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000)); TransLogClient tls(tlss.transport, "tcp/localhost:18377"); - vespalib::string name("test1"); + std::string name("test1"); auto s1 = openDomainTest(tls, name); visitDomainTest(tls, s1.get(), name); } void -partialUpdateTest(const vespalib::string & testDir) { +partialUpdateTest(const std::string & testDir) { DummyFileHeaderContext fileHeaderContext; TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x10000)); TransLogClient tls(tlss.transport, "tcp/localhost:18377"); @@ -612,7 +612,7 @@ TEST("testCrcVersions") { createAndFillDomain(testDir.getDir(),"ccitt_crc32", Encoding(Encoding::Crc::ccitt_crc32, Encoding::Compression::none), 0); ASSERT_TRUE(false); } catch (vespalib::IllegalArgumentException & e) { - EXPECT_TRUE(e.getMessage().find("Compression:none is not allowed for the tls") != vespalib::string::npos); + EXPECT_TRUE(e.getMessage().find("Compression:none is not allowed for the tls") != std::string::npos); } createAndFillDomain(testDir.getDir(), "xxh64", Encoding(Encoding::Crc::xxh64, Encoding::Compression::zstd), 0); @@ -625,7 +625,7 @@ TEST("testRemove") { TLS tlss(testDir.getDir(), 18377, ".", fileHeaderContext, createDomainConfig(0x10000)); TransLogClient tls(tlss.transport, "tcp/localhost:18377"); - vespalib::string name("test-delete"); + std::string name("test-delete"); createDomainTest(tls, name); auto s1 = openDomainTest(tls, name); fillDomainTest(s1.get(), name); @@ -636,7 +636,7 @@ TEST("testRemove") { namespace { void -assertVisitStats(TransLogClient &tls, const vespalib::string &domain, +assertVisitStats(TransLogClient &tls, const std::string &domain, SerialNum visitStart, SerialNum visitEnd, SerialNum expFirstSerial, SerialNum expLastSerial, uint64_t expCount, uint64_t expInOrder) @@ -667,11 +667,11 @@ assertStatus(Session &s, SerialNum expFirstSerial, SerialNum expLastSerial, uint void -testSendingAlotOfDataSync(const vespalib::string & testDir) { +testSendingAlotOfDataSync(const std::string & testDir) { const unsigned int NUM_PACKETS = 1000; const unsigned int NUM_ENTRIES = 100; const unsigned int TOTAL_NUM_ENTRIES = NUM_PACKETS * NUM_ENTRIES; - const vespalib::string MANY("many"); + const std::string MANY("many"); { DummyFileHeaderContext fileHeaderContext; TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x80000)); @@ -736,11 +736,11 @@ testSendingAlotOfDataSync(const vespalib::string & testDir) { } } -void testSendingAlotOfDataAsync(const vespalib::string & testDir) { +void testSendingAlotOfDataAsync(const std::string & testDir) { const unsigned int NUM_PACKETS = 1000; const unsigned int NUM_ENTRIES = 100; const unsigned int TOTAL_NUM_ENTRIES = NUM_PACKETS * NUM_ENTRIES; - const vespalib::string MANY("many-async"); + const std::string MANY("many-async"); { DummyFileHeaderContext fileHeaderContext; TLS tlss(testDir, 18377, ".", fileHeaderContext, createDomainConfig(0x80000)); @@ -957,9 +957,9 @@ TEST("test truncation after short read") { const unsigned int TOTAL_NUM_ENTRIES = NUM_PACKETS * NUM_ENTRIES; const unsigned int ENTRYSIZE = 4080; test::DirectoryHandler topdir("test10"); - vespalib::string domain("truncate"); - vespalib::string dir(topdir.getDir() + "/" + domain); - vespalib::string tlsspec("tcp/localhost:18377"); + std::string domain("truncate"); + std::string dir(topdir.getDir() + "/" + domain); + std::string tlsspec("tcp/localhost:18377"); DomainConfig domainConfig = createDomainConfig(0x10000); @@ -986,7 +986,7 @@ TEST("test truncation after short read") { } EXPECT_EQUAL(2u, countFiles(dir)); { - vespalib::string filename(dir + "/truncate-0000000000000017"); + std::string filename(dir + "/truncate-0000000000000017"); FastOS_File trfile(filename.c_str()); EXPECT_TRUE(trfile.OpenReadWrite(nullptr)); trfile.SetSize(trfile.getSize() - 1); diff --git a/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp b/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp index 8faec949d862..2acae31571a3 100644 --- a/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp +++ b/searchlib/src/tests/util/bufferwriter/bufferwriter_test.cpp @@ -1,11 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include #include +#include namespace search { diff --git a/searchlib/src/tests/util/folded_string_compare/folded_string_compare_test.cpp b/searchlib/src/tests/util/folded_string_compare/folded_string_compare_test.cpp index 5cc299983f01..f13221feca5b 100644 --- a/searchlib/src/tests/util/folded_string_compare/folded_string_compare_test.cpp +++ b/searchlib/src/tests/util/folded_string_compare/folded_string_compare_test.cpp @@ -2,17 +2,17 @@ #include #include -#include #include #include #include +#include using search::FoldedStringCompare; using vespalib::LowerCase; using vespalib::Utf8ReaderForZTS; using IntVec = std::vector; -using StringVec = std::vector; +using StringVec = std::vector; namespace { @@ -42,7 +42,7 @@ class FoldedStringCompareTest : public ::testing::Test template int - compare_folded_helper2(const vespalib::string& lhs, const vespalib::string& rhs) + compare_folded_helper2(const std::string& lhs, const std::string& rhs) { int ret = FoldedStringCompare::compareFolded(lhs.c_str(), rhs.c_str()); auto folded_lhs_utf32 = as_utf32(lhs.c_str()); @@ -54,7 +54,7 @@ class FoldedStringCompareTest : public ::testing::Test template int - compare_folded_helper(const vespalib::string& lhs, const vespalib::string& rhs) + compare_folded_helper(const std::string& lhs, const std::string& rhs) { int ret = compare_folded_helper2(lhs, rhs); EXPECT_EQ(-ret, (compare_folded_helper2(rhs, lhs))); @@ -62,7 +62,7 @@ class FoldedStringCompareTest : public ::testing::Test } IntVec - compare_folded(const vespalib::string& lhs, const vespalib::string& rhs) + compare_folded(const std::string& lhs, const std::string& rhs) { IntVec result; result.emplace_back(compare_folded_helper(lhs, rhs)); @@ -74,7 +74,7 @@ class FoldedStringCompareTest : public ::testing::Test template int - compare_folded_prefix_helper(const vespalib::string& lhs, const vespalib::string& rhs, size_t prefix_len) + compare_folded_prefix_helper(const std::string& lhs, const std::string& rhs, size_t prefix_len) { int ret = FoldedStringCompare::compareFoldedPrefix(lhs.c_str(), rhs.c_str(), prefix_len); EXPECT_EQ(-ret, (FoldedStringCompare::compareFoldedPrefix(rhs.c_str(), lhs.c_str(), prefix_len))); @@ -82,7 +82,7 @@ class FoldedStringCompareTest : public ::testing::Test } IntVec - compare_folded_prefix(const vespalib::string& lhs, const vespalib::string& rhs, size_t prefix_len) + compare_folded_prefix(const std::string& lhs, const std::string& rhs, size_t prefix_len) { IntVec result; result.emplace_back(compare_folded_prefix_helper(lhs, rhs, prefix_len)); @@ -93,14 +93,14 @@ class FoldedStringCompareTest : public ::testing::Test } int - compare(const vespalib::string& lhs, const vespalib::string& rhs) { + compare(const std::string& lhs, const std::string& rhs) { int ret = normalize_ret(FoldedStringCompare::compare(lhs.c_str(), rhs.c_str())); EXPECT_EQ(-ret, normalize_ret(FoldedStringCompare::compare(rhs.c_str(), lhs.c_str()))); return ret; } int - compare_prefix(const vespalib::string& lhs, const vespalib::string& rhs, size_t prefix_len) { + compare_prefix(const std::string& lhs, const std::string& rhs, size_t prefix_len) { int ret = normalize_ret(FoldedStringCompare::comparePrefix(lhs.c_str(), rhs.c_str(), prefix_len)); EXPECT_EQ(-ret, normalize_ret(FoldedStringCompare::comparePrefix(rhs.c_str(), lhs.c_str(), prefix_len))); return ret; diff --git a/searchlib/src/tests/util/rawbuf_test.cpp b/searchlib/src/tests/util/rawbuf_test.cpp index 5f8001b6af31..a55ca057f851 100644 --- a/searchlib/src/tests/util/rawbuf_test.cpp +++ b/searchlib/src/tests/util/rawbuf_test.cpp @@ -1,13 +1,13 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include +#include #include LOG_SETUP("rawbuf_test"); -using vespalib::string; +using std::string; using namespace search; namespace { diff --git a/searchlib/src/tests/util/token_extractor/token_extractor_test.cpp b/searchlib/src/tests/util/token_extractor/token_extractor_test.cpp index c3da43cca107..874c9107f650 100644 --- a/searchlib/src/tests/util/token_extractor/token_extractor_test.cpp +++ b/searchlib/src/tests/util/token_extractor/token_extractor_test.cpp @@ -17,15 +17,15 @@ using search::linguistics::TokenExtractor; using search::test::DocBuilder; using search::test::StringFieldBuilder; -using AlternativeWords = std::vector; -using AlternativeWordsOrWord = std::variant; +using AlternativeWords = std::vector; +using AlternativeWordsOrWord = std::variant; using Words = std::vector; namespace { -vespalib::string corrupt_word = "corruptWord"; +std::string corrupt_word = "corruptWord"; -vespalib::string field_name("stringfield"); +std::string field_name("stringfield"); std::unique_ptr make_corrupted_document(DocBuilder &b, size_t wordOffset) @@ -103,7 +103,7 @@ TokenExtractorTest::process(const StringFieldValue& value) alternatives.emplace_back(it->word); } } else { - result.emplace_back(vespalib::string(it->word)); + result.emplace_back(std::string(it->word)); ++it; } } diff --git a/searchlib/src/tests/vespa-fileheader-inspect/vespa-fileheader-inspect_test.cpp b/searchlib/src/tests/vespa-fileheader-inspect/vespa-fileheader-inspect_test.cpp index 6b797a9d0ead..580ec74d7e77 100644 --- a/searchlib/src/tests/vespa-fileheader-inspect/vespa-fileheader-inspect_test.cpp +++ b/searchlib/src/tests/vespa-fileheader-inspect/vespa-fileheader-inspect_test.cpp @@ -9,7 +9,7 @@ using namespace search; using namespace vespalib; -bool writeHeader(const FileHeader &header, const vespalib::string &fileName) { +bool writeHeader(const FileHeader &header, const std::string &fileName) { FastOS_File file; if (!EXPECT_TRUE(file.OpenWriteOnlyTruncate(fileName.c_str()))) { return false; @@ -20,7 +20,7 @@ bool writeHeader(const FileHeader &header, const vespalib::string &fileName) { return true; } -vespalib::string readFile(const vespalib::string &fileName) { +std::string readFile(const std::string &fileName) { FastOS_File file; ASSERT_TRUE(file.OpenReadOnly(fileName.c_str())); @@ -28,7 +28,7 @@ vespalib::string readFile(const vespalib::string &fileName) { uint32_t len = file.Read(buf, sizeof(buf)); EXPECT_LESS(len, sizeof(buf)); // make sure we got everything - vespalib::string str(buf, len); + std::string str(buf, len); return str; } @@ -57,16 +57,16 @@ TEST("testQuiet") { FileHeaderTk::addVersionTags(header); ASSERT_TRUE(writeHeader(header, "fileheader.dat")); EXPECT_TRUE(system("../../apps/vespa-fileheader-inspect/vespa-fileheader-inspect -q fileheader.dat > out") == 0); - vespalib::string str = readFile("out"); + std::string str = readFile("out"); EXPECT_TRUE(!str.empty()); for (uint32_t i = 0, numTags = header.getNumTags(); i < numTags; ++i) { const FileHeader::Tag &tag = header.getTag(i); size_t pos = str.find(tag.getName()); - EXPECT_TRUE(pos != vespalib::string::npos); + EXPECT_TRUE(pos != std::string::npos); vespalib::asciistream out; out << ";" << tag; - EXPECT_TRUE(str.find(out.str(), pos) != vespalib::string::npos); + EXPECT_TRUE(str.find(out.str(), pos) != std::string::npos); } } @@ -75,15 +75,15 @@ TEST("testVerbose") { FileHeaderTk::addVersionTags(header); ASSERT_TRUE(writeHeader(header, "fileheader.dat")); EXPECT_TRUE(system("../../apps/vespa-fileheader-inspect/vespa-fileheader-inspect fileheader.dat > out") == 0); - vespalib::string str = readFile("out"); + std::string str = readFile("out"); EXPECT_TRUE(!str.empty()); for (uint32_t i = 0, numTags = header.getNumTags(); i < numTags; ++i) { const FileHeader::Tag &tag = header.getTag(i); - EXPECT_TRUE(str.find(tag.getName()) != vespalib::string::npos); + EXPECT_TRUE(str.find(tag.getName()) != std::string::npos); vespalib::asciistream out; out << tag; - EXPECT_TRUE(str.find(out.str()) != vespalib::string::npos); + EXPECT_TRUE(str.find(out.str()) != std::string::npos); } } diff --git a/searchlib/src/vespa/searchcommon/attribute/attribute_utils.cpp b/searchlib/src/vespa/searchcommon/attribute/attribute_utils.cpp index c134acff7cec..ea74daf87ff2 100644 --- a/searchlib/src/vespa/searchcommon/attribute/attribute_utils.cpp +++ b/searchlib/src/vespa/searchcommon/attribute/attribute_utils.cpp @@ -6,7 +6,7 @@ namespace search::attribute { bool -isUpdateableInMemoryOnly(const vespalib::string &attrName, const Config &cfg) +isUpdateableInMemoryOnly(const std::string &attrName, const Config &cfg) { auto basicType = cfg.basicType().type(); return ((basicType != BasicType::Type::PREDICATE) && @@ -15,9 +15,9 @@ isUpdateableInMemoryOnly(const vespalib::string &attrName, const Config &cfg) } bool -isStructFieldAttribute(const vespalib::string &attrName) +isStructFieldAttribute(const std::string &attrName) { - return attrName.find('.') != vespalib::string::npos; + return attrName.find('.') != std::string::npos; } } diff --git a/searchlib/src/vespa/searchcommon/attribute/attribute_utils.h b/searchlib/src/vespa/searchcommon/attribute/attribute_utils.h index 30661df74dac..bb2f74c933a2 100644 --- a/searchlib/src/vespa/searchcommon/attribute/attribute_utils.h +++ b/searchlib/src/vespa/searchcommon/attribute/attribute_utils.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::attribute { @@ -23,8 +23,8 @@ class Config; * During update the complex field is first updated in the document, * then the struct field attribute is updated based on the new content of the complex field. */ -bool isUpdateableInMemoryOnly(const vespalib::string &attrName, const Config &cfg); +bool isUpdateableInMemoryOnly(const std::string &attrName, const Config &cfg); -bool isStructFieldAttribute(const vespalib::string &attrName); +bool isStructFieldAttribute(const std::string &attrName); } diff --git a/searchlib/src/vespa/searchcommon/attribute/basictype.cpp b/searchlib/src/vespa/searchcommon/attribute/basictype.cpp index 0312154690c9..525819693049 100644 --- a/searchlib/src/vespa/searchcommon/attribute/basictype.cpp +++ b/searchlib/src/vespa/searchcommon/attribute/basictype.cpp @@ -24,7 +24,7 @@ const BasicType::TypeInfo BasicType::_typeTable[BasicType::MAX_TYPE] = { }; BasicType::Type -BasicType::asType(const vespalib::string &t) +BasicType::asType(const std::string &t) { for (size_t i(0); i < sizeof(_typeTable)/sizeof(_typeTable[0]); i++) { if (t == _typeTable[i]._name) { diff --git a/searchlib/src/vespa/searchcommon/attribute/basictype.h b/searchlib/src/vespa/searchcommon/attribute/basictype.h index 4bdee5ecfd99..a79d824c2884 100644 --- a/searchlib/src/vespa/searchcommon/attribute/basictype.h +++ b/searchlib/src/vespa/searchcommon/attribute/basictype.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search::attribute { @@ -31,7 +32,7 @@ class BasicType explicit BasicType(int t) noexcept : _type(Type(t)) { } explicit BasicType(unsigned int t) noexcept : _type(Type(t)) { } BasicType(Type t) noexcept : _type(t) { } - explicit BasicType(const vespalib::string & t) : _type(asType(t)) { } + explicit BasicType(const std::string & t) : _type(asType(t)) { } Type type() const noexcept { return _type; } const char * asString() const noexcept { return asString(_type); } @@ -50,7 +51,7 @@ class BasicType private: static const char * asString(Type t) noexcept { return _typeTable[t]._name; } static size_t fixedSize(Type t) noexcept { return _typeTable[t]._fixedSize; } - static Type asType(const vespalib::string & t); + static Type asType(const std::string & t); Type _type; diff --git a/searchlib/src/vespa/searchcommon/attribute/collectiontype.cpp b/searchlib/src/vespa/searchcommon/attribute/collectiontype.cpp index 2d74c78216f7..9195ec8e75cf 100644 --- a/searchlib/src/vespa/searchcommon/attribute/collectiontype.cpp +++ b/searchlib/src/vespa/searchcommon/attribute/collectiontype.cpp @@ -12,7 +12,7 @@ const CollectionType::TypeInfo CollectionType::_typeTable[CollectionType::MAX_TY }; CollectionType::Type -CollectionType::asType(const vespalib::string &t) +CollectionType::asType(const std::string &t) { for (size_t i(0); i < sizeof(_typeTable)/sizeof(_typeTable[0]); i++) { if (t == _typeTable[i]._name) { diff --git a/searchlib/src/vespa/searchcommon/attribute/collectiontype.h b/searchlib/src/vespa/searchcommon/attribute/collectiontype.h index 2c9f6dae144e..3dd0534d5fc4 100644 --- a/searchlib/src/vespa/searchcommon/attribute/collectiontype.h +++ b/searchlib/src/vespa/searchcommon/attribute/collectiontype.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search::attribute { @@ -33,7 +34,7 @@ class CollectionType { } explicit - CollectionType(const vespalib::string & t, bool remove = false, bool create = false) + CollectionType(const std::string & t, bool remove = false, bool create = false) : _type(asType(t)), _removeIfZero(remove), _createIfNonExistant(create) @@ -62,7 +63,7 @@ class CollectionType }; static const char * asString(Type t) noexcept { return _typeTable[t]._name; } - static Type asType(const vespalib::string &t); + static Type asType(const std::string &t); Type _type : 4; bool _removeIfZero : 1; diff --git a/searchlib/src/vespa/searchcommon/attribute/i_attribute_functor.h b/searchlib/src/vespa/searchcommon/attribute/i_attribute_functor.h index 8d1ce17a0340..7383b9a59f50 100644 --- a/searchlib/src/vespa/searchcommon/attribute/i_attribute_functor.h +++ b/searchlib/src/vespa/searchcommon/attribute/i_attribute_functor.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::attribute { diff --git a/searchlib/src/vespa/searchcommon/attribute/i_search_context.h b/searchlib/src/vespa/searchcommon/attribute/i_search_context.h index a4703232c2be..60382aa53049 100644 --- a/searchlib/src/vespa/searchcommon/attribute/i_search_context.h +++ b/searchlib/src/vespa/searchcommon/attribute/i_search_context.h @@ -4,8 +4,8 @@ #include "hit_estimate.h" #include -#include #include +#include namespace search::fef { class TermFieldMatchData; } namespace search::queryeval { @@ -54,7 +54,7 @@ class ISearchContext { virtual Int64Range getAsIntegerTerm() const = 0; virtual DoubleRange getAsDoubleTerm() const = 0; virtual const QueryTermUCS4 * queryTerm() const = 0; - virtual const vespalib::string &attributeName() const = 0; + virtual const std::string &attributeName() const = 0; int32_t find(DocId docId, int32_t elementId, int32_t &weight) const { return onFind(docId, elementId, weight); } int32_t find(DocId docId, int32_t elementId) const { return onFind(docId, elementId); } diff --git a/searchlib/src/vespa/searchcommon/attribute/iattributecontext.h b/searchlib/src/vespa/searchcommon/attribute/iattributecontext.h index 394ad716e386..bc11b4efea20 100644 --- a/searchlib/src/vespa/searchcommon/attribute/iattributecontext.h +++ b/searchlib/src/vespa/searchcommon/attribute/iattributecontext.h @@ -12,7 +12,7 @@ namespace search::attribute { **/ class IAttributeContext : public IAttributeExecutor { public: - using string = vespalib::string; + using string = std::string; /** Convenience typedefs **/ using UP = std::unique_ptr; diff --git a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h index b7d142ef6823..540948aabf8c 100644 --- a/searchlib/src/vespa/searchcommon/attribute/iattributevector.h +++ b/searchlib/src/vespa/searchcommon/attribute/iattributevector.h @@ -75,7 +75,7 @@ class IAttributeVector using WeightedInt = WeightedType; using WeightedEnum = WeightedType; using WeightedConstChar = WeightedType; - using WeightedString = WeightedType; + using WeightedString = WeightedType; using EnumRefs = std::span; /** @@ -83,7 +83,7 @@ class IAttributeVector * * @return attribute name **/ - virtual const vespalib::string & getName() const = 0; + virtual const std::string & getName() const = 0; std::string_view getNamePrefix() const { std::string_view name = getName(); @@ -171,7 +171,7 @@ class IAttributeVector * @param sz the size of the buffer * @return the number of values for this document **/ -// virtual uint32_t get(DocId docId, vespalib::string * buffer, uint32_t sz) const = 0; +// virtual uint32_t get(DocId docId, std::string * buffer, uint32_t sz) const = 0; /** * Copies the values stored for the given document into the given buffer. diff --git a/searchlib/src/vespa/searchcommon/attribute/status.cpp b/searchlib/src/vespa/searchcommon/attribute/status.cpp index a8faf6ca6858..d5d026f30f10 100644 --- a/searchlib/src/vespa/searchcommon/attribute/status.cpp +++ b/searchlib/src/vespa/searchcommon/attribute/status.cpp @@ -60,10 +60,10 @@ Status::operator=(const Status& rhs) return *this; } -vespalib::string +std::string Status::createName(std::string_view index, std::string_view attr) { - vespalib::string name (index); + std::string name (index); name += ".attribute."; name += attr; return name; diff --git a/searchlib/src/vespa/searchcommon/attribute/status.h b/searchlib/src/vespa/searchcommon/attribute/status.h index 74f1152be13b..1a3c4b43e839 100644 --- a/searchlib/src/vespa/searchcommon/attribute/status.h +++ b/searchlib/src/vespa/searchcommon/attribute/status.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::attribute { @@ -40,7 +40,7 @@ class Status void incBitVectors() { _bitVectors.store(getBitVectors() + 1, std::memory_order_relaxed); } void decBitVectors() { _bitVectors.store(getBitVectors() - 1, std::memory_order_relaxed); } - static vespalib::string + static std::string createName(std::string_view index, std::string_view attr); private: std::atomic _numDocs; diff --git a/searchlib/src/vespa/searchcommon/common/datatype.cpp b/searchlib/src/vespa/searchcommon/common/datatype.cpp index 77a920ae09b6..b54e7488d9b0 100644 --- a/searchlib/src/vespa/searchcommon/common/datatype.cpp +++ b/searchlib/src/vespa/searchcommon/common/datatype.cpp @@ -3,6 +3,7 @@ #include "datatype.h" #include #include +#include #include #include @@ -49,7 +50,7 @@ const char *datatype_str[] = { "BOOL", "REFERENCE", "COMBINED"}; -vespalib::string +std::string getTypeName(DataType type) { size_t typeAsNum = static_cast(type); if (typeAsNum >= vespalib::arraysize(datatype_str)) { @@ -81,7 +82,7 @@ const char *collectiontype_str[] = { "SINGLE", "ARRAY", "WEIGHTEDSET" }; -vespalib::string +std::string getTypeName(CollectionType type) { size_t typeAsNum = static_cast(type); if (typeAsNum >= vespalib::arraysize(collectiontype_str)) { diff --git a/searchlib/src/vespa/searchcommon/common/datatype.h b/searchlib/src/vespa/searchcommon/common/datatype.h index 1af5b95aa95e..1aff91adeb4a 100644 --- a/searchlib/src/vespa/searchcommon/common/datatype.h +++ b/searchlib/src/vespa/searchcommon/common/datatype.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::index::schema { @@ -38,11 +38,11 @@ enum class CollectionType { }; DataType dataTypeFromName(std::string_view name); -vespalib::string getTypeName(DataType type); +std::string getTypeName(DataType type); std::ostream &operator<<(std::ostream &os, const DataType &type); CollectionType collectionTypeFromName(std::string_view n); -vespalib::string getTypeName(CollectionType type); +std::string getTypeName(CollectionType type); std::ostream &operator<<(std::ostream &os, const CollectionType &type); diff --git a/searchlib/src/vespa/searchcommon/common/schema.cpp b/searchlib/src/vespa/searchcommon/common/schema.cpp index 27083663134b..039eef96241c 100644 --- a/searchlib/src/vespa/searchcommon/common/schema.cpp +++ b/searchlib/src/vespa/searchcommon/common/schema.cpp @@ -30,10 +30,10 @@ writeFields(vespalib::asciistream & os, void writeFieldSets(vespalib::asciistream &os, - const vespalib::string &name, + const std::string &name, const std::vector &fss) { - vespalib::string prefix(name); + std::string prefix(name); prefix += "["; os << prefix << fss.size() << "]\n"; for (size_t i = 0; i < fss.size(); ++i) { @@ -48,9 +48,9 @@ writeFieldSets(vespalib::asciistream &os, } struct FieldName { - vespalib::string name; + std::string name; explicit FieldName(const config::StringVector & lines) - : name(ConfigParser::parse("name", lines)) + : name(ConfigParser::parse("name", lines)) { } }; @@ -89,9 +89,9 @@ Schema::Field::Field(std::string_view n, DataType dt, CollectionType ct, std::st // XXX: Resource leak if exception is thrown. Schema::Field::Field(const config::StringVector & lines) - : _name(ConfigParser::parse("name", lines)), - _dataType(schema::dataTypeFromName(ConfigParser::parse("datatype", lines))), - _collectionType(schema::collectionTypeFromName(ConfigParser::parse("collectiontype", lines))) + : _name(ConfigParser::parse("name", lines)), + _dataType(schema::dataTypeFromName(ConfigParser::parse("datatype", lines))), + _collectionType(schema::collectionTypeFromName(ConfigParser::parse("collectiontype", lines))) { } @@ -182,7 +182,7 @@ Schema::IndexField::operator!=(const IndexField &rhs) const noexcept } Schema::FieldSet::FieldSet(const config::StringVector & lines) : - _name(ConfigParser::parse("name", lines)), + _name(ConfigParser::parse("name", lines)), _fields() { auto fn = ConfigParser::parseArray>("field", lines); @@ -230,7 +230,7 @@ Schema & Schema::operator=(Schema && rhs) noexcept = default; Schema::~Schema() = default; bool -Schema::loadFromFile(const vespalib::string & fileName) +Schema::loadFromFile(const std::string & fileName) { std::ifstream file(fileName.c_str()); if (!file) { @@ -264,7 +264,7 @@ Schema::loadFromFile(const vespalib::string & fileName) } bool -Schema::saveToFile(const vespalib::string & fileName) const +Schema::saveToFile(const std::string & fileName) const { vespalib::asciistream os; writeToStream(os, true); @@ -295,7 +295,7 @@ Schema::saveToFile(const vespalib::string & fileName) const return true; } -vespalib::string +std::string Schema::toString() const { vespalib::asciistream os; @@ -306,7 +306,7 @@ Schema::toString() const namespace { Schema::IndexField cloneIndexField(const Schema::IndexField &field, - const vespalib::string &suffix) + const std::string &suffix) { return Schema::IndexField(field.getName() + suffix, field.getDataType(), @@ -449,7 +449,7 @@ template <> bool IntersectHelper::is_matching(const Schema::FieldSet &f1, const Schema::FieldSet &f2) { if (f1.getFields() != f2.getFields()) return false; - for (const vespalib::string & field : f1.getFields()) { + for (const std::string & field : f1.getFields()) { if (schema->getIndexFieldId(field) == Schema::UNKNOWN_FIELD_ID) { return false; } diff --git a/searchlib/src/vespa/searchcommon/common/schema.h b/searchlib/src/vespa/searchcommon/common/schema.h index 5b4ab7f4bbf8..4649decaa5fa 100644 --- a/searchlib/src/vespa/searchcommon/common/schema.h +++ b/searchlib/src/vespa/searchcommon/common/schema.h @@ -29,10 +29,10 @@ class Schema **/ class Field { - vespalib::string _name; + std::string _name; DataType _dataType; CollectionType _collectionType; - vespalib::string _tensor_spec; + std::string _tensor_spec; public: Field(std::string_view n, DataType dt) noexcept; @@ -52,10 +52,10 @@ class Schema virtual void write(vespalib::asciistream & os, std::string_view prefix) const; - const vespalib::string &getName() const noexcept { return _name; } + const std::string &getName() const noexcept { return _name; } DataType getDataType() const noexcept { return _dataType; } CollectionType getCollectionType() const noexcept { return _collectionType; } - const vespalib::string& get_tensor_spec() const noexcept { return _tensor_spec; } + const std::string& get_tensor_spec() const noexcept { return _tensor_spec; } bool matchingTypes(const Field &rhs) const noexcept { return getDataType() == rhs.getDataType() && @@ -113,8 +113,8 @@ class Schema **/ class FieldSet { - vespalib::string _name; - std::vector _fields; + std::string _name; + std::vector _fields; public: explicit FieldSet(std::string_view n) noexcept : _name(n), _fields() {} @@ -135,8 +135,8 @@ class Schema return *this; } - const vespalib::string &getName() const noexcept { return _name; } - const std::vector &getFields() const noexcept { return _fields; } + const std::string &getName() const noexcept { return _name; } + const std::vector &getFields() const noexcept { return _fields; } bool operator==(const FieldSet &rhs) const noexcept; bool operator!=(const FieldSet &rhs) const noexcept; @@ -149,7 +149,7 @@ class Schema std::vector _attributeFields; std::vector
_fieldSets; std::vector _importedAttributeFields; - using Name2IdMap = vespalib::hash_map; + using Name2IdMap = vespalib::hash_map; Name2IdMap _indexIds; Name2IdMap _attributeIds; Name2IdMap _fieldSetIds; @@ -174,7 +174,7 @@ class Schema * @param fileName the name of the file. * @return true if the schema could be loaded. **/ - bool loadFromFile(const vespalib::string & fileName); + bool loadFromFile(const std::string & fileName); /** * Save this schema to the file with the given name. @@ -182,9 +182,9 @@ class Schema * @param fileName the name of the file. * @return true if the schema could be saved. **/ - bool saveToFile(const vespalib::string & fileName) const; + bool saveToFile(const std::string & fileName) const; - vespalib::string toString() const; + std::string toString() const; /** * Add an index field to this schema diff --git a/searchlib/src/vespa/searchcommon/common/schemaconfigurer.cpp b/searchlib/src/vespa/searchcommon/common/schemaconfigurer.cpp index c634efd5dfb8..c8bdb5767a74 100644 --- a/searchlib/src/vespa/searchcommon/common/schemaconfigurer.cpp +++ b/searchlib/src/vespa/searchcommon/common/schemaconfigurer.cpp @@ -155,7 +155,7 @@ SchemaConfigurer::configure(const AttributesConfig &cfg) SchemaBuilder::build(cfg, _schema); } -SchemaConfigurer::SchemaConfigurer(Schema &schema, const vespalib::string &configId) +SchemaConfigurer::SchemaConfigurer(Schema &schema, const std::string &configId) : _schema(schema) { search::SubscriptionProxyNg diff --git a/searchlib/src/vespa/searchcommon/common/schemaconfigurer.h b/searchlib/src/vespa/searchcommon/common/schemaconfigurer.h index 79a0d9ea92b4..d5236c325924 100644 --- a/searchlib/src/vespa/searchcommon/common/schemaconfigurer.h +++ b/searchlib/src/vespa/searchcommon/common/schemaconfigurer.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespa::config::search::internal { class InternalIndexschemaType; @@ -51,7 +51,7 @@ class SchemaConfigurer * * @param configId the config id used to retrieve the relevant config. **/ - SchemaConfigurer(Schema & schema, const vespalib::string &configId); + SchemaConfigurer(Schema & schema, const std::string &configId); }; } diff --git a/searchlib/src/vespa/searchcommon/common/subscriptionproxyng.h b/searchlib/src/vespa/searchcommon/common/subscriptionproxyng.h index a0d25be8beb3..c27239067d96 100644 --- a/searchlib/src/vespa/searchcommon/common/subscriptionproxyng.h +++ b/searchlib/src/vespa/searchcommon/common/subscriptionproxyng.h @@ -14,7 +14,7 @@ class SubscriptionProxyNg : public config::IFetcherCallback ME &_target; Method _method; std::unique_ptr _subscriber; - vespalib::string _cfgId; + std::string _cfgId; SubscriptionProxyNg(const SubscriptionProxyNg&); SubscriptionProxyNg &operator=(const SubscriptionProxyNg&); diff --git a/searchlib/src/vespa/searchcommon/common/undefinedvalues.h b/searchlib/src/vespa/searchcommon/common/undefinedvalues.h index ece5378dcc9e..fbe3e0021b35 100644 --- a/searchlib/src/vespa/searchcommon/common/undefinedvalues.h +++ b/searchlib/src/vespa/searchcommon/common/undefinedvalues.h @@ -3,8 +3,9 @@ #pragma once #include +#include #include -#include +#include namespace search::attribute { diff --git a/searchlib/src/vespa/searchlib/aggregation/fs4hit.cpp b/searchlib/src/vespa/searchlib/aggregation/fs4hit.cpp index 5931c71828f7..a2cfc5dd0e1f 100644 --- a/searchlib/src/vespa/searchlib/aggregation/fs4hit.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/fs4hit.cpp @@ -8,10 +8,10 @@ using vespalib::Serializer; using vespalib::Deserializer; namespace { -vespalib::string _G_pathField("path"); -vespalib::string _G_docIdField("docId"); -vespalib::string _G_globalIdField("globalId"); -vespalib::string _G_distributionKeyField("distributionKey"); +std::string _G_pathField("path"); +std::string _G_docIdField("docId"); +std::string _G_globalIdField("globalId"); +std::string _G_distributionKeyField("distributionKey"); } IMPLEMENT_IDENTIFIABLE_NS2(search, aggregation, FS4Hit, Hit); diff --git a/searchlib/src/vespa/searchlib/aggregation/hit.cpp b/searchlib/src/vespa/searchlib/aggregation/hit.cpp index cf6aa01c9c96..39a6c47db5a5 100644 --- a/searchlib/src/vespa/searchlib/aggregation/hit.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/hit.cpp @@ -10,7 +10,7 @@ using vespalib::Deserializer; IMPLEMENT_IDENTIFIABLE_ABSTRACT_NS2(search, aggregation, Hit, vespalib::Identifiable); namespace { - const vespalib::string _G_rankField("rank"); + const std::string _G_rankField("rank"); } Serializer & diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h index 7602b71d568f..7b5971322589 100644 --- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h @@ -11,7 +11,7 @@ class HitsAggregationResult : public AggregationResult { public: using FloatResultNode = expression::FloatResultNode; - using SummaryClassType = vespalib::string; + using SummaryClassType = std::string; class SummaryGenerator { @@ -26,7 +26,7 @@ class HitsAggregationResult : public AggregationResult void onAggregate(const ResultNode &result, const document::Document & doc, HitRank rank) override; const ResultNode & onGetRank() const override; - vespalib::string _summaryClass; + std::string _summaryClass; uint32_t _maxHits; HitList _hits; bool _isOrdered; @@ -50,7 +50,7 @@ class HitsAggregationResult : public AggregationResult ~HitsAggregationResult() override; void postMerge() override { _hits.postMerge(_maxHits); } void setSummaryGenerator(SummaryGenerator & summaryGenerator) { _summaryGenerator = &summaryGenerator; } - const vespalib::string & getSummaryClass() const { return _summaryClass; } + const std::string & getSummaryClass() const { return _summaryClass; } HitsAggregationResult setSummaryClass(std::string_view summaryClass) { _summaryClass = summaryClass; return *this; } HitsAggregationResult &setMaxHits(uint32_t maxHits) { _maxHits = (maxHits == 0) ? std::numeric_limits::max() : maxHits; diff --git a/searchlib/src/vespa/searchlib/aggregation/vdshit.cpp b/searchlib/src/vespa/searchlib/aggregation/vdshit.cpp index eff85fe71fdf..e5b2fc0a713d 100644 --- a/searchlib/src/vespa/searchlib/aggregation/vdshit.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/vdshit.cpp @@ -11,8 +11,8 @@ using vespalib::Serializer; using vespalib::Deserializer; namespace { - vespalib::string _G_docIdField("docId"); - vespalib::string _G_summaryField("summary"); + std::string _G_docIdField("docId"); + std::string _G_summaryField("summary"); } IMPLEMENT_IDENTIFIABLE_NS2(search, aggregation, VdsHit, Hit); diff --git a/searchlib/src/vespa/searchlib/aggregation/vdshit.h b/searchlib/src/vespa/searchlib/aggregation/vdshit.h index a28bb175845d..8cef35df4356 100644 --- a/searchlib/src/vespa/searchlib/aggregation/vdshit.h +++ b/searchlib/src/vespa/searchlib/aggregation/vdshit.h @@ -20,7 +20,7 @@ class VdsHit : public Hit ~VdsHit() override; VdsHit *clone() const override { return new VdsHit(*this); } void visitMembers(vespalib::ObjectVisitor &visitor) const override; - const vespalib::string & getDocId() const noexcept { return _docId; } + const std::string & getDocId() const noexcept { return _docId; } const Summary & getSummary() const noexcept { return _summary; } VdsHit & setDocId(std::string_view docId) noexcept { _docId = docId; return *this; } VdsHit & setSummary(const void * buf, size_t sz) noexcept { @@ -32,7 +32,7 @@ class VdsHit : public Hit bool operator < (const VdsHit &b) const noexcept { return cmp(b) < 0; } private: - vespalib::string _docId; + std::string _docId; Summary _summary; }; diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp b/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp index ab641c1a39a8..8cd5db0bd8a1 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp +++ b/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp @@ -15,13 +15,13 @@ AddressSpace AddressSpaceComponents::default_multi_value_usage() { return AddressSpace(0, 0, (1ull << 32)); } -const vespalib::string AddressSpaceComponents::enum_store = "enum-store"; -const vespalib::string AddressSpaceComponents::multi_value = "multi-value"; -const vespalib::string AddressSpaceComponents::raw_store = "raw-store"; -const vespalib::string AddressSpaceComponents::tensor_store = "tensor-store"; -const vespalib::string AddressSpaceComponents::shared_string_repo = "shared-string-repo"; -const vespalib::string AddressSpaceComponents::hnsw_levels_store = "hnsw-levels-store"; -const vespalib::string AddressSpaceComponents::hnsw_links_store = "hnsw-links-store"; -const vespalib::string AddressSpaceComponents::hnsw_nodeid_mapping = "hnsw-nodeid-mapping"; +const std::string AddressSpaceComponents::enum_store = "enum-store"; +const std::string AddressSpaceComponents::multi_value = "multi-value"; +const std::string AddressSpaceComponents::raw_store = "raw-store"; +const std::string AddressSpaceComponents::tensor_store = "tensor-store"; +const std::string AddressSpaceComponents::shared_string_repo = "shared-string-repo"; +const std::string AddressSpaceComponents::hnsw_levels_store = "hnsw-levels-store"; +const std::string AddressSpaceComponents::hnsw_links_store = "hnsw-links-store"; +const std::string AddressSpaceComponents::hnsw_nodeid_mapping = "hnsw-nodeid-mapping"; } diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_components.h b/searchlib/src/vespa/searchlib/attribute/address_space_components.h index 6d28e02cfd08..eb112896dabd 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_components.h +++ b/searchlib/src/vespa/searchlib/attribute/address_space_components.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search { @@ -14,14 +14,14 @@ class AddressSpaceComponents { public: static vespalib::AddressSpace default_enum_store_usage(); static vespalib::AddressSpace default_multi_value_usage(); - static const vespalib::string enum_store; - static const vespalib::string multi_value; - static const vespalib::string raw_store; - static const vespalib::string tensor_store; - static const vespalib::string shared_string_repo; - static const vespalib::string hnsw_levels_store; - static const vespalib::string hnsw_links_store; - static const vespalib::string hnsw_nodeid_mapping; + static const std::string enum_store; + static const std::string multi_value; + static const std::string raw_store; + static const std::string tensor_store; + static const std::string shared_string_repo; + static const std::string hnsw_levels_store; + static const std::string hnsw_links_store; + static const std::string hnsw_nodeid_mapping; }; } diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_usage.cpp b/searchlib/src/vespa/searchlib/attribute/address_space_usage.cpp index 235c990b104c..3ff1db915594 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_usage.cpp +++ b/searchlib/src/vespa/searchlib/attribute/address_space_usage.cpp @@ -13,13 +13,13 @@ AddressSpaceUsage::AddressSpaceUsage() } void -AddressSpaceUsage::set(const vespalib::string& component, const vespalib::AddressSpace& usage) +AddressSpaceUsage::set(const std::string& component, const vespalib::AddressSpace& usage) { _map[component] = usage; } AddressSpace -AddressSpaceUsage::get(const vespalib::string& component) const +AddressSpaceUsage::get(const std::string& component) const { auto itr = _map.find(component); if (itr != _map.end()) { diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_usage.h b/searchlib/src/vespa/searchlib/attribute/address_space_usage.h index 89fc26ce60b7..6f075d3ed081 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_usage.h +++ b/searchlib/src/vespa/searchlib/attribute/address_space_usage.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include #include namespace search { @@ -15,13 +15,13 @@ namespace search { class AddressSpaceUsage { private: - using AddressSpaceMap = std::unordered_map>; + using AddressSpaceMap = std::unordered_map>; AddressSpaceMap _map; public: AddressSpaceUsage(); - void set(const vespalib::string& component, const vespalib::AddressSpace& usage); - vespalib::AddressSpace get(const vespalib::string& component) const; + void set(const std::string& component, const vespalib::AddressSpace& usage); + vespalib::AddressSpace get(const std::string& component) const; const AddressSpaceMap& get_all() const { return _map; } vespalib::AddressSpace enum_store_usage() const; vespalib::AddressSpace multi_value_usage() const; diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 768e5cdd3553..7d0e3689fa5c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -103,14 +103,14 @@ using search::tensor::ITensorAttribute; using vespalib::Issue; using vespalib::geo::ZCurve; using vespalib::make_string; -using vespalib::string; +using std::string; namespace search { namespace { class NodeAsKey final : public IDirectPostingStore::LookupKey { public: - NodeAsKey(const Node & node, vespalib::string & scratchPad) + NodeAsKey(const Node & node, std::string & scratchPad) : _node(node), _scratchPad(scratchPad) { } @@ -121,7 +121,7 @@ class NodeAsKey final : public IDirectPostingStore::LookupKey { private: const Node & _node; - vespalib::string & _scratchPad; + std::string & _scratchPad; }; //----------------------------------------------------------------------------- @@ -134,7 +134,7 @@ class AttributeFieldBlueprint : public SimpleLeafBlueprint const IAttributeVector& _attr; // Must take a copy of the query term for visitMembers() // as only a few ISearchContext implementations exposes the query term. - vespalib::string _query_term; + std::string _query_term; ISearchContext::UP _search_context; attribute::HitEstimate _hit_estimate; enum Type {INT, FLOAT, OTHER}; @@ -186,7 +186,7 @@ class AttributeFieldBlueprint : public SimpleLeafBlueprint const attribute::ISearchContext *get_attribute_search_context() const noexcept final { return _search_context.get(); } - bool getRange(vespalib::string &from, vespalib::string &to) const override; + bool getRange(std::string &from, std::string &to) const override; }; AttributeFieldBlueprint::~AttributeFieldBlueprint() = default; @@ -561,7 +561,7 @@ DirectWandBlueprint::set_matching_phase(MatchingPhase matching_phase) noexcept } bool -AttributeFieldBlueprint::getRange(vespalib::string &from, vespalib::string &to) const { +AttributeFieldBlueprint::getRange(std::string &from, std::string &to) const { if (_type == INT) { Int64Range range = _search_context->getAsIntegerTerm(); char buf[32]; @@ -599,7 +599,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper const IAttributeVector &_attr; const IDocidPostingStore *_dps; const IDocidWithWeightPostingStore *_dwwps; - vespalib::string _scratchPad; + std::string _scratchPad; bool has_always_btree_iterators_with_docid_and_weight() const { return (_dwwps != nullptr) && (_dwwps->has_always_btree_iterator()); @@ -650,7 +650,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper QueryTermSimple parsed_term(term, QueryTermSimple::Type::WORD); SearchContextParams scParams = createContextParams(_field.isFilter()); if (parsed_term.getMaxPerGroup() > 0) { - const IAttributeVector *diversity(getRequestContext().getAttribute(vespalib::string(parsed_term.getDiversityAttribute()))); + const IAttributeVector *diversity(getRequestContext().getAttribute(std::string(parsed_term.getDiversityAttribute()))); if (check_valid_diversity_attr(diversity)) { scParams.diversityAttribute(diversity) .diversityCutoffGroups(parsed_term.getDiversityCutoffGroups()) @@ -686,7 +686,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper static QueryTermSimple::UP extractTerm(std::string_view term_view, bool isInteger) { - vespalib::string term(term_view); + std::string term(term_view); if (isInteger) { return std::make_unique(term, QueryTermSimple::Type::WORD); } @@ -753,7 +753,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper visit_wset_or_in_term(n); } - void fail_nearest_neighbor_term(query::NearestNeighborTerm&n, const vespalib::string& error_msg) { + void fail_nearest_neighbor_term(query::NearestNeighborTerm&n, const std::string& error_msg) { Issue::report("NearestNeighborTerm(%s, %s): %s. Returning empty blueprint", _field.getName().c_str(), n.get_query_tensor_name().c_str(), error_msg.c_str()); setResult(std::make_unique(_field)); diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp index f507640f3224..f11836abff39 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp @@ -11,25 +11,25 @@ namespace search::attribute { namespace { -const vespalib::string versionTag = "version"; -const vespalib::string dataTypeTag = "datatype"; -const vespalib::string collectionTypeTag = "collectiontype"; -const vespalib::string createIfNonExistentTag = "collectiontype.createIfNonExistent"; -const vespalib::string removeIfZeroTag = "collectiontype.removeIfZero"; -const vespalib::string createSerialNumTag = "createSerialNum"; -const vespalib::string tensorTypeTag = "tensortype"; -const vespalib::string predicateArityTag = "predicate.arity"; -const vespalib::string predicateLowerBoundTag = "predicate.lower_bound"; -const vespalib::string predicateUpperBoundTag = "predicate.upper_bound"; -const vespalib::string nearest_neighbor_index_tag = "nearest_neighbor_index"; -const vespalib::string hnsw_index_value = "hnsw"; -const vespalib::string hnsw_max_links_tag = "hnsw.max_links_per_node"; -const vespalib::string hnsw_neighbors_to_explore_tag = "hnsw.neighbors_to_explore_at_insert"; -const vespalib::string hnsw_distance_metric = "hnsw.distance_metric"; -const vespalib::string doc_id_limit_tag = "docIdLimit"; -const vespalib::string enumerated_tag = "enumerated"; -const vespalib::string unique_value_count_tag = "uniqueValueCount"; -const vespalib::string total_value_count_tag = "totalValueCount"; +const std::string versionTag = "version"; +const std::string dataTypeTag = "datatype"; +const std::string collectionTypeTag = "collectiontype"; +const std::string createIfNonExistentTag = "collectiontype.createIfNonExistent"; +const std::string removeIfZeroTag = "collectiontype.removeIfZero"; +const std::string createSerialNumTag = "createSerialNum"; +const std::string tensorTypeTag = "tensortype"; +const std::string predicateArityTag = "predicate.arity"; +const std::string predicateLowerBoundTag = "predicate.lower_bound"; +const std::string predicateUpperBoundTag = "predicate.upper_bound"; +const std::string nearest_neighbor_index_tag = "nearest_neighbor_index"; +const std::string hnsw_index_value = "hnsw"; +const std::string hnsw_max_links_tag = "hnsw.max_links_per_node"; +const std::string hnsw_neighbors_to_explore_tag = "hnsw.neighbors_to_explore_at_insert"; +const std::string hnsw_distance_metric = "hnsw.distance_metric"; +const std::string doc_id_limit_tag = "docIdLimit"; +const std::string enumerated_tag = "enumerated"; +const std::string unique_value_count_tag = "uniqueValueCount"; +const std::string total_value_count_tag = "totalValueCount"; } @@ -38,7 +38,7 @@ AttributeHeader::AttributeHeader() { } -AttributeHeader::AttributeHeader(vespalib::string fileName) +AttributeHeader::AttributeHeader(std::string fileName) : _fileName(std::move(fileName)), _basicType(attribute::BasicType::Type::NONE), _collectionType(attribute::CollectionType::Type::SINGLE), @@ -57,7 +57,7 @@ AttributeHeader::AttributeHeader(vespalib::string fileName) { } -AttributeHeader::AttributeHeader(vespalib::string fileName, +AttributeHeader::AttributeHeader(std::string fileName, attribute::BasicType basicType, attribute::CollectionType collectionType, const vespalib::eval::ValueType &tensorType, @@ -154,7 +154,7 @@ AttributeHeader::internalExtractTags(const vespalib::GenericHeader &header) } AttributeHeader -AttributeHeader::extractTags(const vespalib::GenericHeader &header, const vespalib::string &file_name) +AttributeHeader::extractTags(const vespalib::GenericHeader &header, const std::string &file_name) { AttributeHeader result(file_name); result.internalExtractTags(header); diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_header.h b/searchlib/src/vespa/searchlib/attribute/attribute_header.h index 460482b36bd1..f26d7501e905 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_header.h +++ b/searchlib/src/vespa/searchlib/attribute/attribute_header.h @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include namespace search::attribute { @@ -19,7 +19,7 @@ namespace search::attribute { **/ class AttributeHeader { private: - vespalib::string _fileName; + std::string _fileName; BasicType _basicType; CollectionType _collectionType; vespalib::eval::ValueType _tensorType; @@ -38,8 +38,8 @@ class AttributeHeader { void internalExtractTags(const vespalib::GenericHeader &header); public: AttributeHeader(); - AttributeHeader(vespalib::string fileName); - AttributeHeader(vespalib::string fileName, + AttributeHeader(std::string fileName); + AttributeHeader(std::string fileName, BasicType basicType, CollectionType collectionType, const vespalib::eval::ValueType &tensorType, @@ -53,7 +53,7 @@ class AttributeHeader { uint32_t version); ~AttributeHeader(); - const vespalib::string & getFileName() const { return _fileName; } + const std::string & getFileName() const { return _fileName; } const BasicType & getBasicType() const { return _basicType; } const CollectionType &getCollectionType() const { return _collectionType; } const vespalib::eval::ValueType &getTensorType() const { return _tensorType; } @@ -69,7 +69,7 @@ class AttributeHeader { bool getPredicateParamsSet() const { return _predicateParamsSet; } bool getCollectionTypeParamsSet() const { return _collectionTypeParamsSet; } const std::optional& get_hnsw_index_params() const { return _hnsw_index_params; } - static AttributeHeader extractTags(const vespalib::GenericHeader &header, const vespalib::string &file_name); + static AttributeHeader extractTags(const vespalib::GenericHeader &header, const std::string &file_name); void addTags(vespalib::GenericHeader &header) const; vespalib::GenericHeader& get_extra_tags() noexcept { return _extra_tags; } }; diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_object_visitor.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_object_visitor.cpp index 39f39212d5ca..40318ce81218 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_object_visitor.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_object_visitor.cpp @@ -9,7 +9,7 @@ namespace search::attribute { namespace { -vespalib::string +std::string get_type(const IAttributeVector& attr) { auto coll_type = CollectionType(attr.getCollectionType()); diff --git a/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp b/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp index 1bef64bd17fe..bda76f7d05c7 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp @@ -25,7 +25,7 @@ AttributeContext::getAttribute(AttributeMap & map, std::string_view name, bool s if (readGuard) { attribute = readGuard->attribute(); } - map[vespalib::string(name)] = std::move(readGuard); + map[std::string(name)] = std::move(readGuard); return attribute; } } diff --git a/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp b/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp index fe1e6bbbb7f7..5da670b4324d 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributefactory.cpp @@ -14,7 +14,7 @@ using attribute::CollectionType; AttributeVector::SP AttributeFactory::createAttribute(string_view name_view, const Config & cfg) { - vespalib::string name(name_view); + std::string name(name_view); AttributeVector::SP ret; if (cfg.collectionType().type() == CollectionType::ARRAY) { if (cfg.fastSearch()) { diff --git a/searchlib/src/vespa/searchlib/attribute/attributefactory.h b/searchlib/src/vespa/searchlib/attribute/attributefactory.h index 3e8fe551cc59..ebb51bc8004b 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefactory.h +++ b/searchlib/src/vespa/searchlib/attribute/attributefactory.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::attribute { class Config; } namespace search { @@ -18,12 +18,12 @@ class AttributeFactory { using string_view = std::string_view; using Config = attribute::Config; using AttributeSP = std::shared_ptr; - static AttributeSP createArrayStd(vespalib::string name, const Config & cfg); - static AttributeSP createArrayFastSearch(vespalib::string name, const Config & cfg); - static AttributeSP createSetStd(vespalib::string name, const Config & cfg); - static AttributeSP createSetFastSearch(vespalib::string name, const Config & cfg); - static AttributeSP createSingleStd(vespalib::string name, const Config & cfg); - static AttributeSP createSingleFastSearch(vespalib::string name, const Config & cfg); + static AttributeSP createArrayStd(std::string name, const Config & cfg); + static AttributeSP createArrayFastSearch(std::string name, const Config & cfg); + static AttributeSP createSetStd(std::string name, const Config & cfg); + static AttributeSP createSetFastSearch(std::string name, const Config & cfg); + static AttributeSP createSingleStd(std::string name, const Config & cfg); + static AttributeSP createSingleFastSearch(std::string name, const Config & cfg); public: /** * Create an attribute vector with the given name based on the given config. diff --git a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp index 88fbc3130608..6d2ab0ed3281 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp @@ -38,24 +38,24 @@ AttributeFileSaveTarget::~AttributeFileSaveTarget() = default; bool AttributeFileSaveTarget::setup() { - const vespalib::string & baseFileName = _header.getFileName(); - vespalib::string datFileName(baseFileName + ".dat"); + const std::string & baseFileName = _header.getFileName(); + std::string datFileName(baseFileName + ".dat"); if (!_datWriter.open(datFileName)) { return false; } if (_header.getEnumerated()) { - vespalib::string udatFileName(baseFileName + ".udat"); + std::string udatFileName(baseFileName + ".udat"); if (!_udatWriter.open(udatFileName)) { return false; } } if (_header.hasMultiValue()) { - vespalib::string idxFileName(baseFileName + ".idx"); + std::string idxFileName(baseFileName + ".idx"); if (!_idxWriter.open(idxFileName)) { return false; } if (_header.hasWeightedSetType()) { - vespalib::string weightFileName(baseFileName + ".weight"); + std::string weightFileName(baseFileName + ".weight"); if (!_weightWriter.open(weightFileName)) { return false; } @@ -101,10 +101,10 @@ AttributeFileSaveTarget::udatWriter() } bool -AttributeFileSaveTarget::setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) +AttributeFileSaveTarget::setup_writer(const std::string& file_suffix, + const std::string& desc) { - vespalib::string file_name(_header.getFileName() + "." + file_suffix); + std::string file_name(_header.getFileName() + "." + file_suffix); auto writer = std::make_unique(_tune_file, _file_header_ctx, _header, desc); if (!writer->open(file_name)) { @@ -119,7 +119,7 @@ AttributeFileSaveTarget::setup_writer(const vespalib::string& file_suffix, } IAttributeFileWriter& -AttributeFileSaveTarget::get_writer(const vespalib::string& file_suffix) +AttributeFileSaveTarget::get_writer(const std::string& file_suffix) { auto itr = _writers.find(file_suffix); if (itr == _writers.end()) { diff --git a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.h b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.h index d2852e4b27e4..4b2ceca3f1a1 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.h +++ b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.h @@ -15,7 +15,7 @@ namespace search { class AttributeFileSaveTarget : public IAttributeSaveTarget { private: using FileWriterUP = std::unique_ptr; - using WriterMap = std::unordered_map>; + using WriterMap = std::unordered_map>; const TuneFileAttributes& _tune_file; const search::common::FileHeaderContext& _file_header_ctx; @@ -42,9 +42,9 @@ class AttributeFileSaveTarget : public IAttributeSaveTarget { IAttributeFileWriter &weightWriter() override; IAttributeFileWriter &udatWriter() override; - bool setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) override; - IAttributeFileWriter& get_writer(const vespalib::string& file_suffix) override; + bool setup_writer(const std::string& file_suffix, + const std::string& desc) override; + IAttributeFileWriter& get_writer(const std::string& file_suffix) override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/attributefilewriter.cpp b/searchlib/src/vespa/searchlib/attribute/attributefilewriter.cpp index 48cfd2f914c2..5a488fd5e39f 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefilewriter.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributefilewriter.cpp @@ -37,7 +37,7 @@ writeDirectIOAligned(FastOS_FileInterface &file, const void *buf, size_t length) } void -updateHeader(const vespalib::string &name, uint64_t fileBitSize) +updateHeader(const std::string &name, uint64_t fileBitSize) { vespalib::FileHeader h(FileSettings::DIRECTIO_ALIGNMENT); FastOS_File f; @@ -87,7 +87,7 @@ AttributeFileWriter:: AttributeFileWriter(const TuneFileAttributes &tuneFileAttributes, const FileHeaderContext &fileHeaderContext, const attribute::AttributeHeader &header, - const vespalib::string &desc) + const std::string &desc) : _file(new FastOS_File()), _tuneFileAttributes(tuneFileAttributes), _fileHeaderContext(fileHeaderContext), @@ -99,7 +99,7 @@ AttributeFileWriter(const TuneFileAttributes &tuneFileAttributes, AttributeFileWriter::~AttributeFileWriter() = default; bool -AttributeFileWriter::open(const vespalib::string &fileName) +AttributeFileWriter::open(const std::string &fileName) { if (_tuneFileAttributes._write.getWantSyncWrites()) { _file->EnableSyncWrites(); diff --git a/searchlib/src/vespa/searchlib/attribute/attributefilewriter.h b/searchlib/src/vespa/searchlib/attribute/attributefilewriter.h index 6e3b77ddebb7..51a92dc9f52a 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefilewriter.h +++ b/searchlib/src/vespa/searchlib/attribute/attributefilewriter.h @@ -3,7 +3,7 @@ #pragma once #include "iattributefilewriter.h" -#include +#include class FastOS_FileInterface; @@ -26,7 +26,7 @@ class AttributeFileWriter : public IAttributeFileWriter const TuneFileAttributes &_tuneFileAttributes; const search::common::FileHeaderContext &_fileHeaderContext; const attribute::AttributeHeader &_header; - vespalib::string _desc; + std::string _desc; uint64_t _fileBitSize; void addTags(vespalib::GenericHeader &header); @@ -36,12 +36,12 @@ class AttributeFileWriter : public IAttributeFileWriter AttributeFileWriter(const TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, const attribute::AttributeHeader &header, - const vespalib::string &desc); + const std::string &desc); ~AttributeFileWriter(); Buffer allocBuf(size_t size) override; void writeBuf(Buffer buf) override; std::unique_ptr allocBufferWriter() override; - bool open(const vespalib::string &fileName); + bool open(const std::string &fileName); void close(); }; diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp index 708d4020aac8..8ccc9ed76778 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp @@ -15,7 +15,7 @@ #include LOG_SETUP(".searchlib.attributemanager"); -using vespalib::string; +using std::string; using vespalib::IllegalStateException; using search::attribute::IAttributeContext; @@ -199,7 +199,7 @@ AttributeManager::createContext() const string AttributeManager::createBaseFileName(std::string_view name) const { - vespalib::string dir = getBaseDir(); + std::string dir = getBaseDir(); if ( ! getSnapshot().dirName.empty()) { dir += "/"; dir += getSnapshot().dirName; diff --git a/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.cpp b/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.cpp index 4d0187e07474..f615dfafa4b1 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.cpp @@ -79,8 +79,8 @@ writeToFile(const TuneFileAttributes &tuneFileAttributes, } bool -AttributeMemorySaveTarget::setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) +AttributeMemorySaveTarget::setup_writer(const std::string& file_suffix, + const std::string& desc) { auto writer = std::make_unique(); auto itr = _writers.find(file_suffix); @@ -92,7 +92,7 @@ AttributeMemorySaveTarget::setup_writer(const vespalib::string& file_suffix, } IAttributeFileWriter& -AttributeMemorySaveTarget::get_writer(const vespalib::string& file_suffix) +AttributeMemorySaveTarget::get_writer(const std::string& file_suffix) { auto itr = _writers.find(file_suffix); if (itr == _writers.end()) { diff --git a/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.h b/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.h index 442eeb59cd9f..1ed060b858a7 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.h +++ b/searchlib/src/vespa/searchlib/attribute/attributememorysavetarget.h @@ -22,8 +22,8 @@ class AttributeMemorySaveTarget : public IAttributeSaveTarget { using FileWriterUP = std::unique_ptr; struct WriterEntry { FileWriterUP writer; - vespalib::string desc; - WriterEntry(FileWriterUP writer_in, vespalib::string desc_in) + std::string desc; + WriterEntry(FileWriterUP writer_in, std::string desc_in) : writer(std::move(writer_in)), desc(std::move(desc_in)) {} @@ -31,7 +31,7 @@ class AttributeMemorySaveTarget : public IAttributeSaveTarget { WriterEntry & operator=(WriterEntry &&) noexcept = default; ~WriterEntry(); }; - using WriterMap = std::unordered_map>; + using WriterMap = std::unordered_map>; AttributeMemoryFileWriter _datWriter; AttributeMemoryFileWriter _idxWriter; @@ -56,9 +56,9 @@ class AttributeMemorySaveTarget : public IAttributeSaveTarget { IAttributeFileWriter &weightWriter() override; IAttributeFileWriter &udatWriter() override; - bool setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) override; - IAttributeFileWriter& get_writer(const vespalib::string& file_suffix) override; + bool setup_writer(const std::string& file_suffix, + const std::string& desc) override; + IAttributeFileWriter& get_writer(const std::string& file_suffix) override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/attributesaver.h b/searchlib/src/vespa/searchlib/attribute/attributesaver.h index fd081f44c1cf..1dd0f5d75edf 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributesaver.h +++ b/searchlib/src/vespa/searchlib/attribute/attributesaver.h @@ -35,7 +35,7 @@ class AttributeSaver bool hasGenerationGuard() const; - const vespalib::string &get_file_name() const { return _header.getFileName(); } + const std::string &get_file_name() const { return _header.getFileName(); } }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 7df56526143a..a8087b661803 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -46,10 +46,10 @@ namespace search { namespace { -const vespalib::string enumeratedTag = "enumerated"; -const vespalib::string dataTypeTag = "datatype"; -const vespalib::string collectionTypeTag = "collectiontype"; -const vespalib::string docIdLimitTag = "docIdLimit"; +const std::string enumeratedTag = "enumerated"; +const std::string dataTypeTag = "datatype"; +const std::string collectionTypeTag = "collectiontype"; +const std::string docIdLimitTag = "docIdLimit"; bool allow_paged(const search::attribute::Config& config) @@ -68,7 +68,7 @@ allow_paged(const search::attribute::Config& config) } std::unique_ptr -make_memory_allocator(const vespalib::string& name, const search::attribute::Config& config) +make_memory_allocator(const std::string& name, const search::attribute::Config& config) { if (allow_paged(config)) { return vespalib::alloc::MmapFileAllocatorFactory::instance().make_memory_allocator(name); @@ -286,7 +286,7 @@ AttributeVector::save(IAttributeSaveTarget &saveTarget, std::string_view fileNam attribute::AttributeHeader AttributeVector::createAttributeHeader(std::string_view fileName) const { - return attribute::AttributeHeader(vespalib::string(fileName), + return attribute::AttributeHeader(std::string(fileName), getConfig().basicType(), getConfig().collectionType(), getConfig().tensorType(), @@ -327,7 +327,7 @@ AttributeVector::hasLoadData() const { bool AttributeVector::isEnumeratedSaveFormat() const { - vespalib::string datName(fmt("%s.dat", getBaseFileName().c_str())); + std::string datName(fmt("%s.dat", getBaseFileName().c_str())); Fast_BufferedFile datFile(16_Ki); vespalib::FileHeader datHeader(FileSettings::DIRECTIO_ALIGNMENT); if ( ! datFile.OpenReadOnly(datName.c_str()) ) { @@ -693,7 +693,7 @@ AttributeVector::logEnumStoreEvent(const char *reason, const char *stage) jstr.beginObject(); jstr.appendKey("path").appendString(getBaseFileName()); jstr.endObject(); - vespalib::string eventName(fmt("%s.attribute.enumstore.%s", reason, stage)); + std::string eventName(fmt("%s.attribute.enumstore.%s", reason, stage)); EV_STATE(eventName.c_str(), jstr.str().data()); } diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index 32a66276fe5b..c0ba5717fa43 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -287,7 +287,7 @@ class AttributeVector : public attribute::IAttributeVector, void setBaseFileName(std::string_view name) { _baseFileName = name; } bool isUpdateableInMemoryOnly() const { return _isUpdateableInMemoryOnly; } - const vespalib::string & getName() const override final { return _baseFileName.getAttributeName(); } + const std::string & getName() const override final { return _baseFileName.getAttributeName(); } bool hasEnum() const override final; uint32_t getMaxValueCount() const override; @@ -357,7 +357,7 @@ class AttributeVector : public attribute::IAttributeVector, virtual uint32_t get(DocId doc, largeint_t *v, uint32_t sz) const override = 0; virtual uint32_t get(DocId doc, double *v, uint32_t sz) const override = 0; - virtual uint32_t get(DocId doc, vespalib::string *v, uint32_t sz) const = 0; + virtual uint32_t get(DocId doc, std::string *v, uint32_t sz) const = 0; // Implements IAttributeVector diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.cpp b/searchlib/src/vespa/searchlib/attribute/attrvector.cpp index 08f242dfb1eb..5218db1c4e83 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.cpp @@ -11,7 +11,7 @@ LOG_SETUP(".searchlib.attribute.attr_vector"); namespace search { StringDirectAttribute:: -StringDirectAttribute(const vespalib::string & baseFileName, const Config & c) +StringDirectAttribute(const std::string & baseFileName, const Config & c) : search::StringAttribute(baseFileName, c), _buffer(), _offsets(), diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.h b/searchlib/src/vespa/searchlib/attribute/attrvector.h index 8a424748ff6b..c2e769595ab4 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.h +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.h @@ -40,7 +40,7 @@ class NumericDirectAttribute : public B using largeint_t = typename B::largeint_t; using Config = typename B::Config; - NumericDirectAttribute(const vespalib::string & baseFileName, const Config & c); + NumericDirectAttribute(const std::string & baseFileName, const Config & c); ~NumericDirectAttribute() override; bool findEnum(BaseType value, EnumHandle & e) const override; @@ -63,8 +63,8 @@ class NumericDirectAttrVector : public search::NumericDirectAttribute private: using largeint_t = typename B::largeint_t; public: - NumericDirectAttrVector(const vespalib::string & baseFileName); - NumericDirectAttrVector(const vespalib::string & baseFileName, const AttributeVector::Config & c); + NumericDirectAttrVector(const std::string & baseFileName); + NumericDirectAttrVector(const std::string & baseFileName, const AttributeVector::Config & c); largeint_t getInt(DocId doc) const override { return static_cast(getHelper(doc, 0)); } double getFloat(DocId doc) const override { return getHelper(doc, 0); } uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } @@ -143,7 +143,7 @@ class StringDirectAttribute : public StringAttribute const char * getStringFromEnum(EnumHandle e) const override { return &_buffer[e]; } std::unique_ptr getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; protected: - StringDirectAttribute(const vespalib::string & baseFileName, const Config & c); + StringDirectAttribute(const std::string & baseFileName, const Config & c); ~StringDirectAttribute() override; bool findEnum(const char * value, EnumHandle & e) const override; std::vector findFoldedEnums(const char *) const override; @@ -164,14 +164,14 @@ class StringDirectAttrVector : public search::StringDirectAttribute { public: - StringDirectAttrVector(const vespalib::string & baseFileName); - StringDirectAttrVector(const vespalib::string & baseFileName, const Config & c); + StringDirectAttrVector(const std::string & baseFileName); + StringDirectAttrVector(const std::string & baseFileName, const Config & c); uint32_t get(DocId doc, const char ** v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } const char * get(DocId doc) const override { return getHelper(doc, 0); } private: - uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } + uint32_t get(DocId doc, std::string * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const override { return getAllEnumHelper(doc, e, sz); } EnumHandle getEnum(DocId doc) const override { return getEnumHelper(doc, 0); } uint32_t getValueCount(DocId doc) const override { return getValueCountHelper(doc); } diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.hpp b/searchlib/src/vespa/searchlib/attribute/attrvector.hpp index cd52d16daf44..be1ab8a3507a 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.hpp @@ -12,7 +12,7 @@ namespace search { template NumericDirectAttribute:: -NumericDirectAttribute(const vespalib::string & baseFileName, const Config & c) +NumericDirectAttribute(const std::string & baseFileName, const Config & c) : B(baseFileName, c), _data(), _idx() @@ -73,7 +73,7 @@ bool NumericDirectAttribute::addDoc(DocId & ) template NumericDirectAttrVector:: -NumericDirectAttrVector(const vespalib::string & baseFileName, const AttributeVector::Config & c) +NumericDirectAttrVector(const std::string & baseFileName, const AttributeVector::Config & c) : search::NumericDirectAttribute(baseFileName, c) { if (F::IsMultiValue()) { @@ -83,7 +83,7 @@ NumericDirectAttrVector(const vespalib::string & baseFileName, const AttributeVe template NumericDirectAttrVector:: -NumericDirectAttrVector(const vespalib::string & baseFileName) +NumericDirectAttrVector(const std::string & baseFileName) : search::NumericDirectAttribute(baseFileName, AttributeVector::Config(AttributeVector::BasicType::fromType(BaseType()), F::IsMultiValue() ? search::attribute::CollectionType::ARRAY : search::attribute::CollectionType::SINGLE)) { if (F::IsMultiValue()) { @@ -126,7 +126,7 @@ NumericDirectAttrVector::onSerializeForDescendingSort(DocId doc, void* ser template StringDirectAttrVector:: -StringDirectAttrVector(const vespalib::string & baseFileName, const Config & c) : +StringDirectAttrVector(const std::string & baseFileName, const Config & c) : search::StringDirectAttribute(baseFileName, c) { if (F::IsMultiValue()) { @@ -137,7 +137,7 @@ StringDirectAttrVector(const vespalib::string & baseFileName, const Config & c) template StringDirectAttrVector:: -StringDirectAttrVector(const vespalib::string & baseFileName) : +StringDirectAttrVector(const std::string & baseFileName) : search::StringDirectAttribute(baseFileName, Config(BasicType::STRING, F::IsMultiValue() ? search::attribute::CollectionType::ARRAY : search::attribute::CollectionType::SINGLE)) { if (F::IsMultiValue()) { diff --git a/searchlib/src/vespa/searchlib/attribute/basename.cpp b/searchlib/src/vespa/searchlib/attribute/basename.cpp index 66f1109e18d6..92944d044477 100644 --- a/searchlib/src/vespa/searchlib/attribute/basename.cpp +++ b/searchlib/src/vespa/searchlib/attribute/basename.cpp @@ -27,18 +27,18 @@ BaseName::operator = (std::string_view s) { BaseName::~BaseName() = default; -vespalib::string +std::string BaseName::createAttributeName(std::string_view s) { size_t p(s.rfind('/')); if (p == string::npos) { - return vespalib::string(s); + return std::string(s); } else { - return vespalib::string(s.substr(p+1)); + return std::string(s.substr(p+1)); } } -vespalib::string +std::string BaseName::getDirName() const { size_t p = rfind('/'); diff --git a/searchlib/src/vespa/searchlib/attribute/basename.h b/searchlib/src/vespa/searchlib/attribute/basename.h index 0e58e76f8b26..2dcb819235e3 100644 --- a/searchlib/src/vespa/searchlib/attribute/basename.h +++ b/searchlib/src/vespa/searchlib/attribute/basename.h @@ -2,14 +2,14 @@ #pragma once -#include +#include namespace search::attribute { -class BaseName : public vespalib::string +class BaseName : public std::string { public: - using string = vespalib::string; + using string = std::string; BaseName(std::string_view s); BaseName(std::string_view base, std::string_view name); BaseName & operator = (std::string_view s); diff --git a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp index 6762c0516b25..d44ed974f5aa 100644 --- a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp +++ b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.cpp @@ -18,7 +18,7 @@ BitVectorSearchCache::BitVectorSearchCache() BitVectorSearchCache::~BitVectorSearchCache() = default; void -BitVectorSearchCache::insert(const vespalib::string &term, std::shared_ptr entry) +BitVectorSearchCache::insert(const std::string &term, std::shared_ptr entry) { size_t entry_extra_memory_usage = 0; if (entry) { @@ -36,7 +36,7 @@ BitVectorSearchCache::insert(const vespalib::string &term, std::shared_ptr -BitVectorSearchCache::find(const vespalib::string &term) const +BitVectorSearchCache::find(const std::string &term) const { if (size() > 0ul) { std::shared_lock guard(_mutex); diff --git a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h index 3a38cdcea26d..37f6ee8101c4 100644 --- a/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h +++ b/searchlib/src/vespa/searchlib/attribute/bitvector_search_cache.h @@ -4,10 +4,10 @@ #include #include -#include +#include #include #include -#include +#include namespace search { class BitVector; } namespace vespalib { class MemoryUsage; } @@ -35,7 +35,7 @@ class BitVectorSearchCache { }; private: - using Cache = vespalib::hash_map>; + using Cache = vespalib::hash_map>; mutable std::shared_mutex _mutex; std::atomic _size; @@ -45,8 +45,8 @@ class BitVectorSearchCache { public: BitVectorSearchCache(); ~BitVectorSearchCache(); - void insert(const vespalib::string &term, std::shared_ptr entry); - std::shared_ptr find(const vespalib::string &term) const; + void insert(const std::string &term, std::shared_ptr entry); + std::shared_ptr find(const std::string &term) const; size_t size() const { return _size.load(std::memory_order_relaxed); } vespalib::MemoryUsage get_memory_usage() const; void clear(); diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.cpp b/searchlib/src/vespa/searchlib/attribute/changevector.cpp index e6304f8bcd40..76a99d8bfdad 100644 --- a/searchlib/src/vespa/searchlib/attribute/changevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/changevector.cpp @@ -7,7 +7,7 @@ LOG_SETUP(".searchlib.attribute.changevector"); namespace search { -StringChangeData::StringChangeData(vespalib::string s) noexcept +StringChangeData::StringChangeData(std::string s) noexcept : _s(std::move(s)) { if (StringAttribute::countZero(_s.data(), _s.size()) > 0) { diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.h b/searchlib/src/vespa/searchlib/attribute/changevector.h index 71a749a996b9..37086294720e 100644 --- a/searchlib/src/vespa/searchlib/attribute/changevector.h +++ b/searchlib/src/vespa/searchlib/attribute/changevector.h @@ -77,7 +77,7 @@ class NumericChangeData { class StringChangeData { public: - using DataType = vespalib::string; + using DataType = std::string; StringChangeData(std::string_view s) noexcept : StringChangeData(DataType(s)) {} StringChangeData(DataType s) noexcept; diff --git a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp index 077c3300177a..186441c47af2 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp @@ -21,7 +21,7 @@ using attribute::BasicType; #define CREATEFLOATARRAY(T, fname, info) static_cast(new FLOATARRAY(T)(fname, info)) AttributeVector::SP -AttributeFactory::createArrayFastSearch(vespalib::string name, const Config & info) +AttributeFactory::createArrayFastSearch(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::ARRAY); assert(info.fastSearch()); diff --git a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp index c56ba08f319b..0754cff25189 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp @@ -20,7 +20,7 @@ using attribute::BasicType; AttributeVector::SP -AttributeFactory::createArrayStd(vespalib::string name, const Config & info) +AttributeFactory::createArrayStd(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::ARRAY); AttributeVector::SP ret; diff --git a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp index 237676d31bc3..584e19b86432 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp @@ -23,7 +23,7 @@ using attribute::BasicType; AttributeVector::SP -AttributeFactory::createSetFastSearch(vespalib::string name, const Config & info) +AttributeFactory::createSetFastSearch(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::WSET); assert(info.fastSearch()); diff --git a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp index cb1e6adb2456..6ea7f3fb3ab0 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp @@ -19,7 +19,7 @@ using attribute::BasicType; AttributeVector::SP -AttributeFactory::createSetStd(vespalib::string name, const Config & info) +AttributeFactory::createSetStd(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::WSET); AttributeVector::SP ret; diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp index ee2b9fe551d8..7c477f85344d 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp @@ -18,7 +18,7 @@ namespace search { using attribute::BasicType; AttributeVector::SP -AttributeFactory::createSingleFastSearch(vespalib::string name, const Config & info) +AttributeFactory::createSingleFastSearch(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::SINGLE); assert(info.fastSearch()); diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp index cd519e8dfbfb..f807b8eac09e 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp @@ -18,7 +18,7 @@ namespace search { using attribute::BasicType; AttributeVector::SP -AttributeFactory::createSingleStd(vespalib::string name, const Config & info) +AttributeFactory::createSingleStd(std::string name, const Config & info) { assert(info.collectionType().type() == attribute::CollectionType::SINGLE); switch(info.basicType().type()) { diff --git a/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.cpp b/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.cpp index db6c0432374b..b59e43142102 100644 --- a/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.cpp +++ b/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.cpp @@ -7,17 +7,17 @@ namespace search::attribute { namespace { -const vespalib::string euclidean = "euclidean"; -const vespalib::string angular = "angular"; -const vespalib::string geodegrees = "geodegrees"; -const vespalib::string innerproduct = "innerproduct"; -const vespalib::string prenormalized_angular = "prenormalized_angular"; -const vespalib::string dotproduct = "dotproduct"; -const vespalib::string hamming = "hamming"; +const std::string euclidean = "euclidean"; +const std::string angular = "angular"; +const std::string geodegrees = "geodegrees"; +const std::string innerproduct = "innerproduct"; +const std::string prenormalized_angular = "prenormalized_angular"; +const std::string dotproduct = "dotproduct"; +const std::string hamming = "hamming"; } -vespalib::string +std::string DistanceMetricUtils::to_string(DistanceMetric metric) { switch (metric) { @@ -33,7 +33,7 @@ DistanceMetricUtils::to_string(DistanceMetric metric) } DistanceMetric -DistanceMetricUtils::to_distance_metric(const vespalib::string& metric) +DistanceMetricUtils::to_distance_metric(const std::string& metric) { if (metric == euclidean) { return DistanceMetric::Euclidean; diff --git a/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.h b/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.h index 859445df6fa4..1ef6ab8078fb 100644 --- a/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.h +++ b/searchlib/src/vespa/searchlib/attribute/distance_metric_utils.h @@ -3,14 +3,14 @@ #pragma once #include -#include +#include namespace search::attribute { class DistanceMetricUtils { public: - static vespalib::string to_string(DistanceMetric metric); - static DistanceMetric to_distance_metric(const vespalib::string& metric); + static std::string to_string(DistanceMetric metric); + static DistanceMetric to_distance_metric(const std::string& metric); }; } diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.h b/searchlib/src/vespa/searchlib/attribute/enumattribute.h index 38448c2335c1..abc7ba38526b 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.h @@ -57,7 +57,7 @@ class EnumAttribute : public B vespalib::MemoryUsage getEnumStoreValuesMemoryUsage() const override; void populate_address_space_usage(AddressSpaceUsage& usage) const override; public: - EnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + EnumAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg); ~EnumAttribute(); bool findEnum(EnumEntryType v, EnumHandle & e) const override { return _enumStore.find_enum(v, e); } const EnumStore & getEnumStore() const { return _enumStore; } diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp index 576bfed778f5..92b431879c51 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp @@ -12,7 +12,7 @@ namespace search { template EnumAttribute:: -EnumAttribute(const vespalib::string &baseFileName, +EnumAttribute(const std::string &baseFileName, const AttributeVector::Config &cfg) : B(baseFileName, cfg), _enumStore(cfg.fastSearch(), cfg.get_dictionary_config(), this->get_memory_allocator(), this->_defaultValue._data.raw()) diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp index 9086c783f978..751bb0274706 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp @@ -16,7 +16,7 @@ namespace search { //******************** CollectionType::SINGLE ********************// -SingleStringExtAttribute::SingleStringExtAttribute(const vespalib::string & name) : +SingleStringExtAttribute::SingleStringExtAttribute(const std::string & name) : StringDirectAttrVector< AttrVector::Features >(name, Config(BasicType::STRING, CollectionType::SINGLE)) { setEnum(false); @@ -67,14 +67,14 @@ MultiExtAttribute::make_read_view(attribute::IMultiValueAttribute::WeightedSe return &stash.create, T>>(this->_data, this->_idx); } -MultiStringExtAttribute::MultiStringExtAttribute(const vespalib::string & name, const CollectionType & ctype) : +MultiStringExtAttribute::MultiStringExtAttribute(const std::string & name, const CollectionType & ctype) : StringDirectAttrVector< AttrVector::Features > (name, Config(BasicType::STRING, ctype)) { setEnum(false); } -MultiStringExtAttribute::MultiStringExtAttribute(const vespalib::string & name) : +MultiStringExtAttribute::MultiStringExtAttribute(const std::string & name) : StringDirectAttrVector< AttrVector::Features > (name, Config(BasicType::STRING, CollectionType::ARRAY)) { @@ -124,7 +124,7 @@ MultiStringExtAttribute::make_read_view(attribute::IMultiValueAttribute::Weighte //******************** CollectionType::WSET ********************// -WeightedSetIntegerExtAttribute::WeightedSetIntegerExtAttribute(const vespalib::string & name) : +WeightedSetIntegerExtAttribute::WeightedSetIntegerExtAttribute(const std::string & name) : WeightedSetExtAttributeBase(name) { } @@ -164,7 +164,7 @@ WeightedSetIntegerExtAttribute::make_read_view(attribute::IMultiValueAttribute:: return &stash.create, int64_t>>(this->_data, this->_idx, this->get_weights()); } -WeightedSetFloatExtAttribute::WeightedSetFloatExtAttribute(const vespalib::string & name) : +WeightedSetFloatExtAttribute::WeightedSetFloatExtAttribute(const std::string & name) : WeightedSetExtAttributeBase(name) { } @@ -204,7 +204,7 @@ WeightedSetFloatExtAttribute::make_read_view(attribute::IMultiValueAttribute::We return &stash.create, double>>(this->_data, this->_idx, this->get_weights()); } -WeightedSetStringExtAttribute::WeightedSetStringExtAttribute(const vespalib::string & name) : +WeightedSetStringExtAttribute::WeightedSetStringExtAttribute(const std::string & name) : WeightedSetExtAttributeBase(name) { setEnum(false); diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h index 24aa8e17b364..71277f8fadb9 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h @@ -43,7 +43,7 @@ class SingleExtAttribute getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; IExtendAttribute * getExtendInterface() override { return this; } public: - SingleExtAttribute(const vespalib::string &name); + SingleExtAttribute(const std::string &name); bool addDoc(typename Super::DocId &docId) override; bool add(typename AddValueType::Type v, int32_t = 1) override; @@ -66,7 +66,7 @@ class SingleStringExtAttribute { IExtendAttribute * getExtendInterface() override { return this; } public: - SingleStringExtAttribute(const vespalib::string & name); + SingleStringExtAttribute(const std::string & name); bool addDoc(DocId & docId) override; bool add(const char * v, int32_t w = 1) override; bool onLoad(vespalib::Executor *) override { @@ -89,14 +89,14 @@ class MultiExtAttribute using BasicType = typename Super::BasicType; using QueryTermSimpleUP = AttributeVector::QueryTermSimpleUP; - MultiExtAttribute(const vespalib::string &name, const attribute::CollectionType &ctype); + MultiExtAttribute(const std::string &name, const attribute::CollectionType &ctype); private: std::unique_ptr getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; IExtendAttribute * getExtendInterface() override { return this; } public: - MultiExtAttribute(const vespalib::string &name); + MultiExtAttribute(const std::string &name); ~MultiExtAttribute() override; bool addDoc(typename Super::DocId &docId) override; @@ -126,10 +126,10 @@ class MultiStringExtAttribute : { IExtendAttribute * getExtendInterface() override { return this; } protected: - MultiStringExtAttribute(const vespalib::string & name, const attribute::CollectionType & ctype); + MultiStringExtAttribute(const std::string & name, const attribute::CollectionType & ctype); public: - MultiStringExtAttribute(const vespalib::string & name); + MultiStringExtAttribute(const std::string & name); bool addDoc(DocId & docId) override; bool add(const char * v, int32_t w = 1) override; bool onLoad(vespalib::Executor *) override { @@ -156,7 +156,7 @@ class WeightedSetExtAttributeBase : public B int32_t getWeightHelper(AttributeVector::DocId docId, uint32_t idx) const { return _weights[this->_idx[docId] + idx]; } - WeightedSetExtAttributeBase(const vespalib::string & name); + WeightedSetExtAttributeBase(const std::string & name); ~WeightedSetExtAttributeBase(); const std::vector& get_weights() const noexcept { return _weights; } }; @@ -167,7 +167,7 @@ class WeightedSetIntegerExtAttribute std::unique_ptr getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; public: - WeightedSetIntegerExtAttribute(const vespalib::string & name); + WeightedSetIntegerExtAttribute(const std::string & name); ~WeightedSetIntegerExtAttribute(); bool add(int64_t v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedInt * v, uint32_t sz) const override; @@ -181,7 +181,7 @@ class WeightedSetFloatExtAttribute std::unique_ptr getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; public: - WeightedSetFloatExtAttribute(const vespalib::string & name); + WeightedSetFloatExtAttribute(const std::string & name); ~WeightedSetFloatExtAttribute(); bool add(double v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedFloat * v, uint32_t sz) const override; @@ -208,7 +208,7 @@ class WeightedSetStringExtAttribute } public: - WeightedSetStringExtAttribute(const vespalib::string & name); + WeightedSetStringExtAttribute(const std::string & name); ~WeightedSetStringExtAttribute(); bool add(const char * v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedString * v, uint32_t sz) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp index 0b05f98821b5..d1f09918bb7f 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.hpp @@ -21,7 +21,7 @@ SingleExtAttribute::getSearch(QueryTermSimpleUP term, const attribute::Search } template -SingleExtAttribute::SingleExtAttribute(const vespalib::string &name) +SingleExtAttribute::SingleExtAttribute(const std::string &name) : Super(name, Config(BasicType::fromType(T()), attribute::CollectionType::SINGLE)) {} @@ -47,7 +47,7 @@ SingleExtAttribute::onAddDocs(typename Super::DocId lidLimit) { } template -MultiExtAttribute::MultiExtAttribute(const vespalib::string &name, const attribute::CollectionType &ctype) +MultiExtAttribute::MultiExtAttribute(const std::string &name, const attribute::CollectionType &ctype) : Super(name, Config(BasicType::fromType(T()), ctype)) { } template @@ -60,7 +60,7 @@ MultiExtAttribute::getSearch(QueryTermSimpleUP term, const attribute::SearchC } template -MultiExtAttribute::MultiExtAttribute(const vespalib::string &name) +MultiExtAttribute::MultiExtAttribute(const std::string &name) : Super(name, Config(BasicType::fromType(static_cast(0)), attribute::CollectionType::ARRAY)) {} @@ -92,7 +92,7 @@ template MultiExtAttribute::~MultiExtAttribute() = default; template -WeightedSetExtAttributeBase::WeightedSetExtAttributeBase(const vespalib::string & name) +WeightedSetExtAttributeBase::WeightedSetExtAttributeBase(const std::string & name) : B(name, attribute::CollectionType::WSET), _weights() {} diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp index 749ef7d45e8f..757abf60a45d 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp @@ -35,7 +35,7 @@ FixedSourceSelector::Iterator::Iterator(const FixedSourceSelector & sourceSelect { } FixedSourceSelector::FixedSourceSelector(queryeval::Source defaultSource, - const vespalib::string & attrBaseFileName, + const std::string & attrBaseFileName, uint32_t initialNumDocs) : SourceSelector(defaultSource, std::make_shared(attrBaseFileName, getConfig())), _source(static_cast(*_realSource)) @@ -49,7 +49,7 @@ FixedSourceSelector::FixedSourceSelector(queryeval::Source defaultSource, FixedSourceSelector::~FixedSourceSelector() = default; FixedSourceSelector::UP -FixedSourceSelector::cloneAndSubtract(const vespalib::string & attrBaseFileName, uint32_t diff) +FixedSourceSelector::cloneAndSubtract(const std::string & attrBaseFileName, uint32_t diff) { queryeval::Source newDefault = getNewSource(getDefaultSource(), diff); auto selector = std::make_unique< FixedSourceSelector>(newDefault, attrBaseFileName, _source.getNumDocs()-1); @@ -66,7 +66,7 @@ FixedSourceSelector::cloneAndSubtract(const vespalib::string & attrBaseFileName, } FixedSourceSelector::UP -FixedSourceSelector::load(const vespalib::string & baseFileName, uint32_t currentId) +FixedSourceSelector::load(const std::string & baseFileName, uint32_t currentId) { LoadInfo::UP info = extractLoadInfo(baseFileName); info->load(); diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h index 451a62bfbea8..937237e8e644 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.h @@ -28,12 +28,12 @@ class FixedSourceSelector : public SourceSelector public: FixedSourceSelector(queryeval::Source defaultSource, - const vespalib::string & attrBaseFileName, + const std::string & attrBaseFileName, uint32_t initialNumDocs = 0); ~FixedSourceSelector() override; - FixedSourceSelector::UP cloneAndSubtract(const vespalib::string & attrBaseFileName, uint32_t diff); - static FixedSourceSelector::UP load(const vespalib::string & baseFileName, uint32_t currentId); + FixedSourceSelector::UP cloneAndSubtract(const std::string & attrBaseFileName, uint32_t diff); + static FixedSourceSelector::UP load(const std::string & baseFileName, uint32_t currentId); // Inherit doc from ISourceSelector void setSource(uint32_t docId, queryeval::Source source) final override; diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp b/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp index fb32f0a4586b..df91507566a0 100644 --- a/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp @@ -43,7 +43,7 @@ class SaveBits template -FlagAttributeT::FlagAttributeT(const vespalib::string & baseFileName, const AttributeVector::Config & cfg) : +FlagAttributeT::FlagAttributeT(const std::string & baseFileName, const AttributeVector::Config & cfg) : B(baseFileName, cfg), _bitVectorHolder(), _bitVectorStore(256), diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.h b/searchlib/src/vespa/searchlib/attribute/flagattribute.h index e8d7320a0364..7cb74cf44fe0 100644 --- a/searchlib/src/vespa/searchlib/attribute/flagattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.h @@ -13,7 +13,7 @@ using FlagBaseImpl = MultiValueNumericAttribute< IntegerAttributeTemplate class FlagAttributeT : public B { public: - FlagAttributeT(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + FlagAttributeT(const std::string & baseFileName, const AttributeVector::Config & cfg); private: using DocId = AttributeVector::DocId; bool onLoad(vespalib::Executor *executor) override; diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp index 05a2903aa0fd..fff8a1d3df34 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp @@ -6,7 +6,7 @@ namespace search { -FloatingPointAttribute::FloatingPointAttribute(const vespalib::string & name, const Config & c) : +FloatingPointAttribute::FloatingPointAttribute(const std::string & name, const Config & c) : NumericAttribute(name, c), _changes() { @@ -46,7 +46,7 @@ uint32_t FloatingPointAttribute::get(DocId doc, WeightedConstChar * v, uint32_t return 0; } -uint32_t FloatingPointAttribute::get(DocId doc, vespalib::string * s, uint32_t sz) const +uint32_t FloatingPointAttribute::get(DocId doc, std::string * s, uint32_t sz) const { double * v = new double[sz]; unsigned num(static_cast(this)->get(doc, v, sz)); diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index ef70b40e741f..5214f45493ac 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -30,7 +30,7 @@ class FloatingPointAttribute : public NumericAttribute bool applyWeight(DocId doc, const FieldValue& fv, const document::AssignValueUpdate& wAdjust) override; uint32_t clearDoc(DocId doc) override; protected: - FloatingPointAttribute(const vespalib::string & name, const Config & c); + FloatingPointAttribute(const std::string & name, const Config & c); using Change = ChangeTemplate>; using ChangeVector = ChangeVectorT; ChangeVector _changes; @@ -38,7 +38,7 @@ class FloatingPointAttribute : public NumericAttribute vespalib::MemoryUsage getChangeVectorMemoryUsage() const override; private: std::span get_raw(DocId) const override; - uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override; + uint32_t get(DocId doc, std::string * v, uint32_t sz) const override; uint32_t get(DocId doc, const char ** v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override; @@ -64,8 +64,8 @@ class FloatingPointAttributeTemplate : public FloatingPointAttribute return attribute::isUndefined(get(doc)); } protected: - explicit FloatingPointAttributeTemplate(const vespalib::string & name); - FloatingPointAttributeTemplate(const vespalib::string & name, const Config & c); + explicit FloatingPointAttributeTemplate(const std::string & name); + FloatingPointAttributeTemplate(const std::string & name, const Config & c); ~FloatingPointAttributeTemplate() override; virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void load_enum_store(LoadedVector&) {} diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp index a637dcd2b1d1..cd67fe773efe 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp @@ -9,12 +9,12 @@ namespace search { template -FloatingPointAttributeTemplate::FloatingPointAttributeTemplate(const vespalib::string & name) +FloatingPointAttributeTemplate::FloatingPointAttributeTemplate(const std::string & name) : FloatingPointAttributeTemplate(name, BasicType::fromType(T())) { } template -FloatingPointAttributeTemplate::FloatingPointAttributeTemplate(const vespalib::string & name, const Config & c) +FloatingPointAttributeTemplate::FloatingPointAttributeTemplate(const std::string & name, const Config & c) : FloatingPointAttribute(name, c), _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) { diff --git a/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp index 9e96da8734e6..b5168dcb2b2d 100644 --- a/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp +++ b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.cpp @@ -13,7 +13,7 @@ class StringAsKey final : public IDirectPostingStore::LookupKey { std::string_view asString() const override { return _key; } private: - vespalib::string _key; + std::string _key; }; } diff --git a/searchlib/src/vespa/searchlib/attribute/iattributemanager.h b/searchlib/src/vespa/searchlib/attribute/iattributemanager.h index 98edd8d6b3e3..bdf9304e51f5 100644 --- a/searchlib/src/vespa/searchlib/attribute/iattributemanager.h +++ b/searchlib/src/vespa/searchlib/attribute/iattributemanager.h @@ -21,7 +21,7 @@ class IAttributeManager : public attribute::IAttributeExecutor { IAttributeManager(const IAttributeManager &) = delete; IAttributeManager & operator = (const IAttributeManager &) = delete; using SP = std::shared_ptr; - using string = vespalib::string; + using string = std::string; /** * Returns a view of the attribute vector with the given name. diff --git a/searchlib/src/vespa/searchlib/attribute/iattributesavetarget.h b/searchlib/src/vespa/searchlib/attribute/iattributesavetarget.h index b956eb5855bf..42a025d6f0dd 100644 --- a/searchlib/src/vespa/searchlib/attribute/iattributesavetarget.h +++ b/searchlib/src/vespa/searchlib/attribute/iattributesavetarget.h @@ -41,14 +41,14 @@ class IAttributeSaveTarget { * Setups a custom file writer with the given file suffix and description in the file header. * Returns false if the file writer cannot be setup or if it already exists, true otherwise. */ - virtual bool setup_writer(const vespalib::string& file_suffix, - const vespalib::string& desc) = 0; + virtual bool setup_writer(const std::string& file_suffix, + const std::string& desc) = 0; /** * Returns the file writer with the given file suffix. * Throws vespalib::IllegalArgumentException if the file writer does not exists. */ - virtual IAttributeFileWriter& get_writer(const vespalib::string& file_suffix) = 0; + virtual IAttributeFileWriter& get_writer(const std::string& file_suffix) = 0; virtual ~IAttributeSaveTarget(); }; diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h index 2d5b99573d5d..a3d505203c63 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h @@ -4,7 +4,7 @@ #include "readable_attribute_vector.h" #include -#include +#include namespace vespalib { class MemoryUsage; } @@ -58,7 +58,7 @@ class ImportedAttributeVector : public ReadableAttributeVector { return _search_cache; } void clearSearchCache(); - const vespalib::string &getName() const { + const std::string &getName() const { return _name; } @@ -67,7 +67,7 @@ class ImportedAttributeVector : public ReadableAttributeVector { vespalib::MemoryUsage get_memory_usage() const; protected: - vespalib::string _name; + std::string _name; std::shared_ptr _reference_attribute; std::shared_ptr _document_meta_store; std::shared_ptr _target_attribute; diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h index 6b6671d27f34..890a65fca947 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search { struct IDocumentMetaStoreContext; } diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp index efd456ac2bb6..1f91867cb695 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp @@ -29,7 +29,7 @@ ImportedAttributeVectorReadGuard::ImportedAttributeVectorReadGuard(std::shared_p ImportedAttributeVectorReadGuard::~ImportedAttributeVectorReadGuard() = default; -const vespalib::string& ImportedAttributeVectorReadGuard::getName() const { +const std::string& ImportedAttributeVectorReadGuard::getName() const { return _imported_attribute.getName(); } diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h index e4a372dbede6..a65dd31ec2b9 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h @@ -36,7 +36,7 @@ class ImportedAttributeVectorReadGuard : public IAttributeVector, ImportedAttributeVectorReadGuard(std::shared_ptr targetMetaStoreReadGuard, const ImportedAttributeVector &imported_attribute, bool stableEnumGuard); ~ImportedAttributeVectorReadGuard() override; - const vespalib::string &getName() const override; + const std::string &getName() const override; uint32_t getNumDocs() const override; uint32_t getValueCount(uint32_t doc) const override; uint32_t getMaxValueCount() const override; diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp index 7829003da4b5..199f314938c0 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp @@ -335,7 +335,7 @@ ImportedSearchContext::queryTerm() const { return _target_search_context->queryTerm(); } -const vespalib::string& +const std::string& ImportedSearchContext::attributeName() const { return _imported_attribute.getName(); } diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h index a805ada90516..f83e077ac720 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h @@ -30,7 +30,7 @@ class ImportedSearchContext : public ISearchContext { using AtomicTargetLid = vespalib::datastore::AtomicValueWrapper; using TargetLids = std::span; const ImportedAttributeVector& _imported_attribute; - vespalib::string _queryTerm; + std::string _queryTerm; bool _useSearchCache; std::shared_ptr _searchCacheLookup; IDocumentMetaStoreContext::IReadGuard::SP _dmsReadGuardFallback; @@ -71,7 +71,7 @@ class ImportedSearchContext : public ISearchContext { Int64Range getAsIntegerTerm() const override; DoubleRange getAsDoubleTerm() const override; const QueryTermUCS4 * queryTerm() const override; - const vespalib::string& attributeName() const override; + const std::string& attributeName() const override; using DocId = uint32_t; diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp index 7d87aadbf23b..497d90f9bb56 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp @@ -7,7 +7,7 @@ namespace search { -IntegerAttribute::IntegerAttribute(const vespalib::string & name, const Config & c) : +IntegerAttribute::IntegerAttribute(const std::string & name, const Config & c) : NumericAttribute(name, c), _changes() { @@ -29,11 +29,11 @@ uint32_t IntegerAttribute::clearDoc(DocId doc) namespace { // TODO Move to vespalib::to_string and template on value type -vespalib::string +std::string to_string(int64_t v) { char tmp[32]; auto res = std::to_chars(tmp, tmp + sizeof(tmp) - 1, v, 10); - return vespalib::string(tmp, res.ptr - tmp); + return std::string(tmp, res.ptr - tmp); } } @@ -62,7 +62,7 @@ IntegerAttribute::get_raw(DocId) const return {}; } -uint32_t IntegerAttribute::get(DocId doc, vespalib::string * s, uint32_t sz) const +uint32_t IntegerAttribute::get(DocId doc, std::string * s, uint32_t sz) const { largeint_t * v = new largeint_t[sz]; unsigned num(static_cast(this)->get(doc, v, sz)); diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 1a05e3b034b1..3ab5fa6265be 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -31,13 +31,13 @@ class IntegerAttribute : public NumericAttribute uint32_t clearDoc(DocId doc) override; vespalib::MemoryUsage getChangeVectorMemoryUsage() const override; protected: - IntegerAttribute(const vespalib::string & name, const Config & c); + IntegerAttribute(const std::string & name, const Config & c); using Change = ChangeTemplate>; using ChangeVector = ChangeVectorT; ChangeVector _changes; private: std::span get_raw(DocId) const override; - uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override; + uint32_t get(DocId doc, std::string * v, uint32_t sz) const override; uint32_t get(DocId doc, const char ** v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override; @@ -60,9 +60,9 @@ class IntegerAttributeTemplate : public IntegerAttribute T defaultValue() const { return isMutable() ? 0 : attribute::getUndefined(); } bool isUndefined(DocId doc) const override { return attribute::isUndefined(get(doc)); } protected: - IntegerAttributeTemplate(const vespalib::string & name); - IntegerAttributeTemplate(const vespalib::string & name, const Config & c); - IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType); + IntegerAttributeTemplate(const std::string & name); + IntegerAttributeTemplate(const std::string & name, const Config & c); + IntegerAttributeTemplate(const std::string & name, const Config & c, const BasicType &realType); ~IntegerAttributeTemplate() override; virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void load_enum_store(LoadedVector&) {} diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp index a7aa0c539b9e..0085c2c03136 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp @@ -11,12 +11,12 @@ namespace search { using largeint_t = attribute::IAttributeVector::largeint_t; template -IntegerAttributeTemplate::IntegerAttributeTemplate(const vespalib::string & name) +IntegerAttributeTemplate::IntegerAttributeTemplate(const std::string & name) : IntegerAttributeTemplate(name, BasicType::fromType(T())) { } template -IntegerAttributeTemplate::IntegerAttributeTemplate(const vespalib::string & name, const Config & c) +IntegerAttributeTemplate::IntegerAttributeTemplate(const std::string & name, const Config & c) : IntegerAttribute(name, c), _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) { @@ -24,7 +24,7 @@ IntegerAttributeTemplate::IntegerAttributeTemplate(const vespalib::string & n } template -IntegerAttributeTemplate::IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType) +IntegerAttributeTemplate::IntegerAttributeTemplate(const std::string & name, const Config & c, const BasicType &realType) : IntegerAttribute(name, c), _defaultValue(ChangeBase::UPDATE, 0, 0u) { diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp index 4dbf4420ac3f..7f85f427271e 100644 --- a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp +++ b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp @@ -20,7 +20,7 @@ using FileInterfaceUP = LoadUtils::FileInterfaceUP; using LoadedBufferUP = LoadUtils::LoadedBufferUP; FileInterfaceUP -LoadUtils::openFile(const AttributeVector& attr, const vespalib::string& suffix) +LoadUtils::openFile(const AttributeVector& attr, const std::string& suffix) { return FileUtil::openFile(attr.getBaseFileName() + "." + suffix); } @@ -44,13 +44,13 @@ LoadUtils::openWeight(const AttributeVector& attr) } bool -LoadUtils::file_exists(const AttributeVector& attr, const vespalib::string& suffix) +LoadUtils::file_exists(const AttributeVector& attr, const std::string& suffix) { return std::filesystem::exists(std::filesystem::path(attr.getBaseFileName() + "." + suffix)); } LoadedBufferUP -LoadUtils::loadFile(const AttributeVector& attr, const vespalib::string& suffix) +LoadUtils::loadFile(const AttributeVector& attr, const std::string& suffix) { return FileUtil::loadFile(attr.getBaseFileName() + "." + suffix); } diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.h b/searchlib/src/vespa/searchlib/attribute/load_utils.h index fb22ad39e45d..a3f19d2878af 100644 --- a/searchlib/src/vespa/searchlib/attribute/load_utils.h +++ b/searchlib/src/vespa/searchlib/attribute/load_utils.h @@ -26,13 +26,13 @@ class LoadUtils { using FileInterfaceUP = std::unique_ptr; using LoadedBufferUP = std::unique_ptr; - static FileInterfaceUP openFile(const AttributeVector& attr, const vespalib::string& suffix); + static FileInterfaceUP openFile(const AttributeVector& attr, const std::string& suffix); static FileInterfaceUP openDAT(const AttributeVector& attr); static FileInterfaceUP openIDX(const AttributeVector& attr); static FileInterfaceUP openWeight(const AttributeVector& attr); - static bool file_exists(const AttributeVector& attr, const vespalib::string& suffix); - static LoadedBufferUP loadFile(const AttributeVector& attr, const vespalib::string& suffix); + static bool file_exists(const AttributeVector& attr, const std::string& suffix); + static LoadedBufferUP loadFile(const AttributeVector& attr, const std::string& suffix); static LoadedBufferUP loadDAT(const AttributeVector& attr); static LoadedBufferUP loadIDX(const AttributeVector& attr); diff --git a/searchlib/src/vespa/searchlib/attribute/loadedvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedvalue.h index 70a125305331..e443e870010d 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedvalue.h @@ -5,6 +5,7 @@ #include "i_enum_store.h" #include #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h index 26383c00cae6..81c339cfc634 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h @@ -58,7 +58,7 @@ class MultiValueEnumAttribute : public MultiValueAttribute virtual void mergeMemoryStats(vespalib::MemoryUsage & total) { (void) total; } public: - MultiValueEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + MultiValueEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg); void onCommit() override; void onUpdateStat() override; diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp index 5afd45c2a73d..a24273c58d87 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp @@ -127,7 +127,7 @@ MultiValueEnumAttribute::load_enumerated_data(ReaderBase& attrReader, template MultiValueEnumAttribute:: -MultiValueEnumAttribute(const vespalib::string &baseFileName, +MultiValueEnumAttribute(const std::string &baseFileName, const AttributeVector::Config & cfg) : MultiValueAttribute(baseFileName, cfg) { diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h index e9c035c3aeab..0161d04c0098 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h @@ -59,7 +59,7 @@ class MultiValueNumericAttribute : public MultiValueAttribute { long onSerializeForAscendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; long onSerializeForDescendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; public: - MultiValueNumericAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & c = + MultiValueNumericAttribute(const std::string & baseFileName, const AttributeVector::Config & c = AttributeVector::Config(AttributeVector::BasicType::fromType(T()), attribute::CollectionType::ARRAY)); uint32_t getValueCount(DocId doc) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp index 1a1dab82b25e..7a1a53ea15f9 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp @@ -34,7 +34,7 @@ bool MultiValueNumericAttribute::findEnum(T value, EnumHandle & e) const template MultiValueNumericAttribute:: -MultiValueNumericAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & c) : +MultiValueNumericAttribute(const std::string & baseFileName, const AttributeVector::Config & c) : MultiValueAttribute(baseFileName, c) { } diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h index c3353fa691e7..c9367cb2527b 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h @@ -45,7 +45,7 @@ class MultiValueNumericEnumAttribute : public MultiValueEnumAttribute { long onSerializeForAscendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; long onSerializeForDescendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; public: - MultiValueNumericEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + MultiValueNumericEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg); bool onLoad(vespalib::Executor *executor) override; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp index f45ce01b0468..c548e4f0a82a 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.hpp @@ -20,7 +20,7 @@ using fileutil::LoadedBuffer; template MultiValueNumericEnumAttribute:: -MultiValueNumericEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg) +MultiValueNumericEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg) : MultiValueEnumAttribute(baseFileName, cfg) { } diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h index 3e7ff01d4848..b00ac0779a2f 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h @@ -70,7 +70,7 @@ class MultiValueNumericPostingAttribute void applyValueChanges(const DocIndices& docIndices, EnumStoreBatchUpdater& updater) override; public: - MultiValueNumericPostingAttribute(const vespalib::string & name, const AttributeVector::Config & cfg); + MultiValueNumericPostingAttribute(const std::string & name, const AttributeVector::Config & cfg); ~MultiValueNumericPostingAttribute(); void reclaim_memory(generation_t oldest_used_gen) override; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp index 9328857c919c..0d0e579f20b7 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp @@ -40,7 +40,7 @@ MultiValueNumericPostingAttribute::applyValueChanges(const DocIndices& doc } template -MultiValueNumericPostingAttribute::MultiValueNumericPostingAttribute(const vespalib::string & name, +MultiValueNumericPostingAttribute::MultiValueNumericPostingAttribute(const std::string & name, const AttributeVector::Config & cfg) : MultiValueNumericEnumAttribute(name, cfg), PostingParent(*this, this->getEnumStore()), diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h index fba6a01ecff4..749b78def3c6 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h @@ -47,8 +47,8 @@ class MultiValueStringAttributeT : public MultiValueEnumAttribute { long onSerializeForAscendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; long onSerializeForDescendingSort(DocId doc, void* serTo, long available, const common::BlobConverter* bc) const override; public: - MultiValueStringAttributeT(const vespalib::string & name, const AttributeVector::Config & c); - MultiValueStringAttributeT(const vespalib::string & name); + MultiValueStringAttributeT(const std::string & name, const AttributeVector::Config & c); + MultiValueStringAttributeT(const std::string & name); ~MultiValueStringAttributeT(); void freezeEnumDictionary() override; @@ -81,7 +81,7 @@ class MultiValueStringAttributeT : public MultiValueEnumAttribute { } return valueCount; } - uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override { + uint32_t get(DocId doc, std::string * v, uint32_t sz) const override { return getHelper(doc, v, sz); } uint32_t get(DocId doc, const char ** v, uint32_t sz) const override { diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp index 7f712001864f..3fdf113ad5b8 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.hpp @@ -22,13 +22,13 @@ namespace search { //----------------------------------------------------------------------------- template MultiValueStringAttributeT:: -MultiValueStringAttributeT(const vespalib::string &name, +MultiValueStringAttributeT(const std::string &name, const AttributeVector::Config &c) : MultiValueEnumAttribute(name, c) { } template -MultiValueStringAttributeT::MultiValueStringAttributeT(const vespalib::string &name) +MultiValueStringAttributeT::MultiValueStringAttributeT(const std::string &name) : MultiValueStringAttributeT(name, AttributeVector::Config(AttributeVector::BasicType::STRING, attribute::CollectionType::ARRAY)) { } diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h index 63a445f04760..f7d2e848a53a 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h @@ -68,8 +68,8 @@ class MultiValueStringPostingAttributeT using PostingParent::get_posting_store; using Dictionary = EnumPostingTree; - MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c); - MultiValueStringPostingAttributeT(const vespalib::string & name); + MultiValueStringPostingAttributeT(const std::string & name, const AttributeVector::Config & c); + MultiValueStringPostingAttributeT(const std::string & name); ~MultiValueStringPostingAttributeT(); void reclaim_memory(generation_t oldest_used_gen) override; diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index 371b8d920f9a..2be0fea37ca9 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -11,7 +11,7 @@ namespace search { template -MultiValueStringPostingAttributeT::MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c) +MultiValueStringPostingAttributeT::MultiValueStringPostingAttributeT(const std::string & name, const AttributeVector::Config & c) : MultiValueStringAttributeT(name, c), PostingParent(*this, this->getEnumStore()), _posting_store_adapter(this->get_posting_store(), this->_enumStore, this->getIsFilter()) @@ -19,7 +19,7 @@ MultiValueStringPostingAttributeT::MultiValueStringPostingAttributeT(const } template -MultiValueStringPostingAttributeT::MultiValueStringPostingAttributeT(const vespalib::string & name) +MultiValueStringPostingAttributeT::MultiValueStringPostingAttributeT(const std::string & name) : MultiValueStringPostingAttributeT(name, AttributeVector::Config(AttributeVector::BasicType::STRING, attribute::CollectionType::ARRAY)) { } diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h index 003d7b39c2dd..6f7cf58e06ad 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h @@ -55,7 +55,7 @@ class MultiValueAttribute : public B, void populate_address_space_usage(AddressSpaceUsage& usage) const override; public: - MultiValueAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + MultiValueAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg); ~MultiValueAttribute() override; bool addDoc(DocId & doc) override; diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp index 5a4daf1c8d3a..6d715811475c 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp @@ -24,7 +24,7 @@ constexpr bool enable_free_lists = true; template MultiValueAttribute:: -MultiValueAttribute(const vespalib::string &baseFileName, +MultiValueAttribute(const std::string &baseFileName, const AttributeVector::Config &cfg) : B(baseFileName, cfg), _mvMapping(MultiValueMapping::optimizedConfigForHugePage(MultiValueMapping::array_store_max_type_id, diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp index 4aceea171702..73f80a505aeb 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp @@ -60,7 +60,7 @@ NotImplementedAttribute::get(DocId, double *, uint32_t) const { } uint32_t -NotImplementedAttribute::get(DocId, vespalib::string *, uint32_t) const { +NotImplementedAttribute::get(DocId, std::string *, uint32_t) const { notImplemented(); } diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h index 9539ec11ea76..d79e46ac369b 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h @@ -17,7 +17,7 @@ struct NotImplementedAttribute : AttributeVector { std::span get_raw(DocId) const override; uint32_t get(DocId, largeint_t *, uint32_t) const override; uint32_t get(DocId, double *, uint32_t) const override; - uint32_t get(DocId, vespalib::string *, uint32_t) const override; + uint32_t get(DocId, std::string *, uint32_t) const override; uint32_t get(DocId, const char **, uint32_t) const override; uint32_t get(DocId, EnumHandle *, uint32_t) const override; uint32_t get(DocId, WeightedInt *, uint32_t) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.h b/searchlib/src/vespa/searchlib/attribute/numericbase.h index bbc6d46f5b71..716a892b6b2c 100644 --- a/searchlib/src/vespa/searchlib/attribute/numericbase.h +++ b/searchlib/src/vespa/searchlib/attribute/numericbase.h @@ -16,7 +16,7 @@ class NumericAttribute : public AttributeVector using EnumIndex = IEnumStore::Index; using EnumVector = IEnumStore::EnumVector; - NumericAttribute(const vespalib::string & name, const AttributeVector::Config & cfg) + NumericAttribute(const std::string & name, const AttributeVector::Config & cfg) : AttributeVector(name, cfg) { } diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp index dbb6aa51ffaf..b726394519d0 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp @@ -444,11 +444,11 @@ StringPostingSearchContext(BaseSC&& base_sc, bool useBitVector, const AttrT &toB auto comp = _enumStore.make_folded_comparator_prefix(this->queryTerm()->getTerm()); this->lookupRange(comp, comp); } else if (this->isRegex()) { - vespalib::string prefix(RegexpUtil::get_prefix(this->queryTerm()->getTerm())); + std::string prefix(RegexpUtil::get_prefix(this->queryTerm()->getTerm())); auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str()); this->lookupRange(comp, comp); } else if (this->isFuzzy()) { - vespalib::string prefix(this->getFuzzyMatcher().getPrefix()); + std::string prefix(this->getFuzzyMatcher().getPrefix()); auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str()); this->lookupRange(comp, comp); } else { diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp index 4b907c565174..26f279d240d6 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp @@ -76,11 +76,11 @@ SimpleIndexConfig createSimpleIndexConfig(const search::attribute::Config &confi } // namespace -PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name) +PredicateAttribute::PredicateAttribute(const std::string &base_file_name) : PredicateAttribute(base_file_name, Config(BasicType::PREDICATE)) {} -PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name, const Config &config) +PredicateAttribute::PredicateAttribute(const std::string &base_file_name, const Config &config) : NotImplementedAttribute(base_file_name, config), _limit_provider(*this), _index(std::make_unique(getGenerationHolder(), _limit_provider, diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h index 0d8b275ea24d..df52b51ed67c 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h @@ -38,8 +38,8 @@ class PredicateAttribute : public NotImplementedAttribute { using IntervalRange = uint16_t; using IntervalRangeVector = vespalib::RcuVectorBase; - PredicateAttribute(const vespalib::string &base_file_name); - PredicateAttribute(const vespalib::string &base_file_name, const Config &config); + PredicateAttribute(const std::string &base_file_name); + PredicateAttribute(const std::string &base_file_name, const Config &config); ~PredicateAttribute() override; diff --git a/searchlib/src/vespa/searchlib/attribute/raw_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/raw_attribute.cpp index c93d68a87862..76a71675379d 100644 --- a/searchlib/src/vespa/searchlib/attribute/raw_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/raw_attribute.cpp @@ -5,7 +5,7 @@ namespace search::attribute { -RawAttribute::RawAttribute(const vespalib::string& name, const Config& config) +RawAttribute::RawAttribute(const std::string& name, const Config& config) : NotImplementedAttribute(name, config) { } diff --git a/searchlib/src/vespa/searchlib/attribute/raw_attribute.h b/searchlib/src/vespa/searchlib/attribute/raw_attribute.h index a1a808d7783c..649cd3c879a6 100644 --- a/searchlib/src/vespa/searchlib/attribute/raw_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/raw_attribute.h @@ -12,7 +12,7 @@ namespace search::attribute { class RawAttribute : public NotImplementedAttribute { public: - RawAttribute(const vespalib::string& name, const Config& config); + RawAttribute(const std::string& name, const Config& config); ~RawAttribute() override; long onSerializeForAscendingSort(DocId doc, void* serTo, long available, const common::BlobConverter*) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/readerbase.cpp b/searchlib/src/vespa/searchlib/attribute/readerbase.cpp index ab306bee042d..40133f1ecd62 100644 --- a/searchlib/src/vespa/searchlib/attribute/readerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/readerbase.cpp @@ -15,9 +15,9 @@ namespace search { namespace { -const vespalib::string versionTag = "version"; -const vespalib::string docIdLimitTag = "docIdLimit"; -const vespalib::string createSerialNumTag = "createSerialNum"; +const std::string versionTag = "version"; +const std::string docIdLimitTag = "docIdLimit"; +const std::string createSerialNumTag = "createSerialNum"; uint64_t extractCreateSerialNum(const vespalib::GenericHeader &header) diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp index 53a5e4f92262..ab99511fc200 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp @@ -30,7 +30,7 @@ using vespalib::datastore::CompactionSpec; namespace { -const vespalib::string uniqueValueCountTag = "uniqueValueCount"; +const std::string uniqueValueCountTag = "uniqueValueCount"; uint64_t extractUniqueValueCount(const vespalib::GenericHeader &header) diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.cpp b/searchlib/src/vespa/searchlib/attribute/search_context.cpp index 2b68cf58ae6a..9236d6fc53df 100644 --- a/searchlib/src/vespa/searchlib/attribute/search_context.cpp +++ b/searchlib/src/vespa/searchlib/attribute/search_context.cpp @@ -57,7 +57,7 @@ SearchContext::fetchPostings(const queryeval::ExecuteInfo& execInfo, bool strict } } -const vespalib::string& +const std::string& SearchContext::attributeName() const { return _attr.getName(); diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.h b/searchlib/src/vespa/searchlib/attribute/search_context.h index 1b17a27b6db6..81e81b178458 100644 --- a/searchlib/src/vespa/searchlib/attribute/search_context.h +++ b/searchlib/src/vespa/searchlib/attribute/search_context.h @@ -42,7 +42,7 @@ class SearchContext : public ISearchContext const QueryTermUCS4* queryTerm() const override { return static_cast(nullptr); } - const vespalib::string& attributeName() const override; + const std::string& attributeName() const override; const AttributeVector& attribute() const { return _attr; } diff --git a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp index 6d2e16dae65e..8ad54bc0ced7 100644 --- a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.cpp @@ -13,7 +13,7 @@ using vespalib::datastore::EntryRef; namespace search::attribute { -SingleRawAttribute::SingleRawAttribute(const vespalib::string& name, const Config& config) +SingleRawAttribute::SingleRawAttribute(const std::string& name, const Config& config) : RawAttribute(name, config), _ref_vector(config.getGrowStrategy(), getGenerationHolder()), _raw_store(get_memory_allocator(), RawBufferStore::array_store_max_type_id, RawBufferStore::array_store_grow_factor) diff --git a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.h b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.h index c8638422ea6a..7331c96f0bc2 100644 --- a/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/single_raw_attribute.h @@ -26,7 +26,7 @@ class SingleRawAttribute : public RawAttribute std::unique_ptr onInitSave(std::string_view fileName) override; void populate_address_space_usage(AddressSpaceUsage& usage) const override; public: - SingleRawAttribute(const vespalib::string& name, const Config& config); + SingleRawAttribute(const std::string& name, const Config& config); ~SingleRawAttribute() override; void onCommit() override; void onUpdateStat() override; diff --git a/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.cpp index 4fdd42399449..73ab23fca5ba 100644 --- a/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.cpp @@ -8,7 +8,7 @@ LOG_SETUP(".searchlib.attribute.single_raw_ext_attribute"); namespace search::attribute { -SingleRawExtAttribute::SingleRawExtAttribute(const vespalib::string& name) +SingleRawExtAttribute::SingleRawExtAttribute(const std::string& name) : RawAttribute(name, Config(BasicType::RAW, CollectionType::SINGLE)), IExtendAttribute(), _buffer(), diff --git a/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.h b/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.h index faec19e062c7..ade71b01dddf 100644 --- a/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/single_raw_ext_attribute.h @@ -16,7 +16,7 @@ class SingleRawExtAttribute : public RawAttribute, std::vector> _buffer; std::vector> _offsets; public: - SingleRawExtAttribute(const vespalib::string& name); + SingleRawExtAttribute(const std::string& name); ~SingleRawExtAttribute() override; void onCommit() override; void onUpdateStat() override; diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp index b635e207a4f6..c99655901af9 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp @@ -21,7 +21,7 @@ using attribute::Config; using attribute::HitEstimate; SingleBoolAttribute:: -SingleBoolAttribute(const vespalib::string &baseFileName, const GrowStrategy & grow, bool paged) +SingleBoolAttribute(const std::string &baseFileName, const GrowStrategy & grow, bool paged) : IntegerAttributeTemplate(baseFileName, Config(BasicType::BOOL, CollectionType::SINGLE).setGrowStrategy(grow).setPaged(paged), BasicType::BOOL), _init_alloc(get_initial_alloc()), _bv(0, 0, getGenerationHolder(), get_memory_allocator() ? &_init_alloc : nullptr) diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h index 9fcd751f28ec..18c699079062 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.h @@ -17,7 +17,7 @@ class GrowStrategy; class SingleBoolAttribute final : public IntegerAttributeTemplate { public: - SingleBoolAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow, bool paged); + SingleBoolAttribute(const std::string & baseFileName, const GrowStrategy & grow, bool paged); ~SingleBoolAttribute() override; void onCommit() override; diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h index cc182181ae3b..ca43260d1ddb 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h @@ -101,7 +101,7 @@ class SingleValueEnumAttribute : public B, public SingleValueEnumAttributeBase { bool onAddDoc(DocId doc) override; public: - SingleValueEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); + SingleValueEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & cfg); ~SingleValueEnumAttribute(); bool addDoc(DocId & doc) override; diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index f0d12608b0d3..855388e97f85 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -15,7 +15,7 @@ namespace search { template SingleValueEnumAttribute:: -SingleValueEnumAttribute(const vespalib::string &baseFileName, +SingleValueEnumAttribute(const std::string &baseFileName, const AttributeVector::Config &cfg) : B(baseFileName, cfg), SingleValueEnumAttributeBase(cfg, getGenerationHolder(), this->get_initial_alloc()) diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h index f37a78db5d0e..70b8d013dce7 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h @@ -41,8 +41,8 @@ class SingleValueNumericAttribute final : public B { } public: - explicit SingleValueNumericAttribute(const vespalib::string & baseFileName); // Only for testing - SingleValueNumericAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & c); + explicit SingleValueNumericAttribute(const std::string & baseFileName); // Only for testing + SingleValueNumericAttribute(const std::string & baseFileName, const AttributeVector::Config & c); ~SingleValueNumericAttribute() override; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp index 1da5bfc0eeb7..b69d55ecc6c5 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp @@ -17,14 +17,14 @@ namespace search { template SingleValueNumericAttribute:: -SingleValueNumericAttribute(const vespalib::string & baseFileName) +SingleValueNumericAttribute(const std::string & baseFileName) : SingleValueNumericAttribute(baseFileName, attribute::Config(attribute::BasicType::fromType(T()), attribute::CollectionType::SINGLE)) { } template SingleValueNumericAttribute:: -SingleValueNumericAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & c) +SingleValueNumericAttribute(const std::string & baseFileName, const AttributeVector::Config & c) : B(baseFileName, c), _data(c.getGrowStrategy(), getGenerationHolder(), this->get_initial_alloc()) { } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h index 86350f616816..78c0bc56e356 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h @@ -48,7 +48,7 @@ class SingleValueNumericEnumAttribute : public SingleValueEnumAttribute { void applyArithmeticValueChange(const Change& c, EnumStoreBatchUpdater& updater) override; public: - SingleValueNumericEnumAttribute(const vespalib::string & baseFileName, + SingleValueNumericEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & c = AttributeVector::Config(AttributeVector::BasicType::fromType(T()), attribute::CollectionType::SINGLE)); diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp index 0724e5923b3e..e76fab3c75bf 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp @@ -58,7 +58,7 @@ SingleValueNumericEnumAttribute::applyArithmeticValueChange(const Change& c, template SingleValueNumericEnumAttribute:: -SingleValueNumericEnumAttribute(const vespalib::string & baseFileName, +SingleValueNumericEnumAttribute(const std::string & baseFileName, const AttributeVector::Config & c) : SingleValueEnumAttribute(baseFileName, c), _currDocValues() diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h index 749fa48565bb..d0005d35579e 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h @@ -73,7 +73,7 @@ class SingleValueNumericPostingAttribute void applyValueChanges(EnumStoreBatchUpdater& updater) override; public: - SingleValueNumericPostingAttribute(const vespalib::string & name, const AttributeVector::Config & cfg); + SingleValueNumericPostingAttribute(const std::string & name, const AttributeVector::Config & cfg); ~SingleValueNumericPostingAttribute(); void reclaim_memory(generation_t oldest_used_gen) override; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp index c74e25fbf5a2..a674d477678b 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp @@ -19,7 +19,7 @@ SingleValueNumericPostingAttribute::~SingleValueNumericPostingAttribute() } template -SingleValueNumericPostingAttribute::SingleValueNumericPostingAttribute(const vespalib::string & name, +SingleValueNumericPostingAttribute::SingleValueNumericPostingAttribute(const std::string & name, const AttributeVector::Config & c) : SingleValueNumericEnumAttribute(name, c), PostingParent(*this, this->getEnumStore()), diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp index 75a603ea96e4..08ccf4fde97c 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp @@ -15,7 +15,7 @@ namespace search { SingleValueSmallNumericAttribute:: -SingleValueSmallNumericAttribute(const vespalib::string & baseFileName, +SingleValueSmallNumericAttribute(const std::string & baseFileName, const Config & c, Word valueMask, uint32_t valueShiftShift, @@ -237,7 +237,7 @@ createConfig(BasicType bt, CollectionType ct, const GrowStrategy & grow) { } SingleValueSemiNibbleNumericAttribute:: -SingleValueSemiNibbleNumericAttribute(const vespalib::string &baseFileName, const search::GrowStrategy & grow) +SingleValueSemiNibbleNumericAttribute(const std::string &baseFileName, const search::GrowStrategy & grow) : SingleValueSmallNumericAttribute(baseFileName, createConfig(BasicType::UINT2, CollectionType::SINGLE, grow), 0x03u /* valueMask */, @@ -249,7 +249,7 @@ SingleValueSemiNibbleNumericAttribute(const vespalib::string &baseFileName, cons SingleValueNibbleNumericAttribute:: -SingleValueNibbleNumericAttribute(const vespalib::string &baseFileName, const search::GrowStrategy & grow) +SingleValueNibbleNumericAttribute(const std::string &baseFileName, const search::GrowStrategy & grow) : SingleValueSmallNumericAttribute(baseFileName, createConfig(BasicType::UINT4, CollectionType::SINGLE, grow), 0x0fu /* valueMask */, diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h index 5675a43ebc0f..3004c92b9e4c 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h @@ -58,7 +58,7 @@ class SingleValueSmallNumericAttribute : public IntegerAttributeTemplate public: - SingleValueSmallNumericAttribute(const vespalib::string & baseFileName, const Config &c, Word valueMask, + SingleValueSmallNumericAttribute(const std::string & baseFileName, const Config &c, Word valueMask, uint32_t valueShiftShift, uint32_t valueShiftMask, uint32_t wordShift); ~SingleValueSmallNumericAttribute() override; @@ -145,13 +145,13 @@ class SingleValueSmallNumericAttribute : public IntegerAttributeTemplate class SingleValueSemiNibbleNumericAttribute : public SingleValueSmallNumericAttribute { public: - SingleValueSemiNibbleNumericAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow); + SingleValueSemiNibbleNumericAttribute(const std::string & baseFileName, const GrowStrategy & grow); }; class SingleValueNibbleNumericAttribute : public SingleValueSmallNumericAttribute { public: - SingleValueNibbleNumericAttribute(const vespalib::string & baseFileName, const GrowStrategy & grow); + SingleValueNibbleNumericAttribute(const std::string & baseFileName, const GrowStrategy & grow); }; } diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h index 8e039e236286..f8da3103bae9 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h @@ -32,8 +32,8 @@ class SingleValueStringAttributeT : public SingleValueEnumAttribute { using generation_t = StringAttribute::generation_t; public: - SingleValueStringAttributeT(const vespalib::string & name, const AttributeVector::Config & c); - SingleValueStringAttributeT(const vespalib::string & name); + SingleValueStringAttributeT(const std::string & name, const AttributeVector::Config & c); + SingleValueStringAttributeT(const std::string & name); ~SingleValueStringAttributeT(); void freezeEnumDictionary() override; @@ -51,7 +51,7 @@ class SingleValueStringAttributeT : public SingleValueEnumAttribute { const char * getStringFromEnum(EnumHandle e) const override { return this->_enumStore.get_value(e); } - uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override { + uint32_t get(DocId doc, std::string * v, uint32_t sz) const override { if (sz > 0) { v[0] = get(doc); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp index 2feed941f796..85f38b54baec 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp @@ -20,13 +20,13 @@ namespace search { //----------------------------------------------------------------------------- template SingleValueStringAttributeT:: -SingleValueStringAttributeT(const vespalib::string &name, +SingleValueStringAttributeT(const std::string &name, const AttributeVector::Config & c) : SingleValueEnumAttribute(name, c) { } template -SingleValueStringAttributeT::SingleValueStringAttributeT(const vespalib::string &name) +SingleValueStringAttributeT::SingleValueStringAttributeT(const std::string &name) : SingleValueStringAttributeT(name, AttributeVector::Config(AttributeVector::BasicType::STRING)) { } diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h index 5a5b599244f8..aade025ef710 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h @@ -74,8 +74,8 @@ class SingleValueStringPostingAttributeT void applyValueChanges(EnumStoreBatchUpdater& updater) override; public: - SingleValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c); - SingleValueStringPostingAttributeT(const vespalib::string & name); + SingleValueStringPostingAttributeT(const std::string & name, const AttributeVector::Config & c); + SingleValueStringPostingAttributeT(const std::string & name); ~SingleValueStringPostingAttributeT(); void reclaim_memory(generation_t oldest_used_gen) override; diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp index 5822ab2c7862..153dbab4180b 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp @@ -11,7 +11,7 @@ namespace search { template -SingleValueStringPostingAttributeT::SingleValueStringPostingAttributeT(const vespalib::string & name, +SingleValueStringPostingAttributeT::SingleValueStringPostingAttributeT(const std::string & name, const AttributeVector::Config & c) : SingleValueStringAttributeT(name, c), PostingParent(*this, this->getEnumStore()), @@ -20,7 +20,7 @@ SingleValueStringPostingAttributeT::SingleValueStringPostingAttributeT(const } template -SingleValueStringPostingAttributeT::SingleValueStringPostingAttributeT(const vespalib::string & name) +SingleValueStringPostingAttributeT::SingleValueStringPostingAttributeT(const std::string & name) : SingleValueStringPostingAttributeT(name, AttributeVector::Config(AttributeVector::BasicType::STRING)) { } diff --git a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp index 77c86e21b2ad..ee891b9857f1 100644 --- a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp @@ -15,9 +15,9 @@ namespace search { namespace { -const vespalib::string defaultSourceTag = "Default source"; -const vespalib::string baseIdTag = "Base id"; -const vespalib::string docIdLimitTag = "Doc id limit"; +const std::string defaultSourceTag = "Default source"; +const std::string baseIdTag = "Base id"; +const std::string docIdLimitTag = "Doc id limit"; class AddMyHeaderTags : public FileHeaderContext { @@ -31,7 +31,7 @@ class AddMyHeaderTags : public FileHeaderContext { } virtual void - addTags(GenericHeader &header, const vespalib::string &name) const override + addTags(GenericHeader &header, const std::string &name) const override { using Tag = GenericHeader::Tag; _parent.addTags(header, name); @@ -43,7 +43,7 @@ class AddMyHeaderTags : public FileHeaderContext } // namespace -SourceSelector::HeaderInfo::HeaderInfo(const vespalib::string & baseFileName, +SourceSelector::HeaderInfo::HeaderInfo(const std::string & baseFileName, Source defaultSource, uint32_t baseId, uint32_t docIdLimit) : @@ -53,7 +53,7 @@ SourceSelector::HeaderInfo::HeaderInfo(const vespalib::string & baseFileName, _docIdLimit(docIdLimit) { } -SourceSelector::SaveInfo::SaveInfo(const vespalib::string & baseFileName, +SourceSelector::SaveInfo::SaveInfo(const std::string & baseFileName, Source defaultSource, uint32_t baseId, uint32_t docIdLimit, @@ -73,14 +73,14 @@ SourceSelector::SaveInfo::save(const TuneFileAttributes &tuneFileAttributes, return _memSaver.writeToFile(tuneFileAttributes, fh); } -SourceSelector::LoadInfo::LoadInfo(const vespalib::string &baseFileName) +SourceSelector::LoadInfo::LoadInfo(const std::string &baseFileName) : _header(baseFileName, 0, 0, 0) { } void SourceSelector::LoadInfo::load() { - const vespalib::string fileName = _header._baseFileName + ".dat"; + const std::string fileName = _header._baseFileName + ".dat"; Fast_BufferedFile file(16_Ki); // XXX no checking for success file.ReadOpen(fileName.c_str()); @@ -104,14 +104,14 @@ SourceSelector::SourceSelector(Source defaultSource, AttributeVector::SP realSou { } SourceSelector::SaveInfo::UP -SourceSelector::extractSaveInfo(const vespalib::string & baseFileName) +SourceSelector::extractSaveInfo(const std::string & baseFileName) { return std::make_unique(baseFileName, getDefaultSource(), getBaseId(), getDocIdLimit(), *_realSource); } SourceSelector::LoadInfo::UP -SourceSelector::extractLoadInfo(const vespalib::string & baseFileName) +SourceSelector::extractLoadInfo(const std::string & baseFileName) { return std::make_unique(baseFileName); } diff --git a/searchlib/src/vespa/searchlib/attribute/sourceselector.h b/searchlib/src/vespa/searchlib/attribute/sourceselector.h index b737bc0ea283..47e0be3f6fb0 100644 --- a/searchlib/src/vespa/searchlib/attribute/sourceselector.h +++ b/searchlib/src/vespa/searchlib/attribute/sourceselector.h @@ -20,11 +20,11 @@ class SourceSelector : public queryeval::ISourceSelector public: struct HeaderInfo { - vespalib::string _baseFileName; + std::string _baseFileName; queryeval::Source _defaultSource; uint32_t _baseId; uint32_t _docIdLimit; - HeaderInfo(const vespalib::string & baseFileName, + HeaderInfo(const std::string & baseFileName, queryeval::Source defaultSource, uint32_t baseId, uint32_t docIdLimit); @@ -37,7 +37,7 @@ class SourceSelector : public queryeval::ISourceSelector public: using UP = std::unique_ptr; using SP = std::shared_ptr; - SaveInfo(const vespalib::string & baseFileName, + SaveInfo(const std::string & baseFileName, queryeval::Source defaultSource, uint32_t baseId, uint32_t docIdLimit, @@ -53,7 +53,7 @@ class SourceSelector : public queryeval::ISourceSelector HeaderInfo _header; public: using UP = std::unique_ptr; - LoadInfo(const vespalib::string & baseFileName); + LoadInfo(const std::string & baseFileName); void load(); const HeaderInfo & header() const { return _header; } }; @@ -74,8 +74,8 @@ class SourceSelector : public queryeval::ISourceSelector * This will compute the distribution of the sources used over the whole lid space. */ Histogram getDistribution() const; - SaveInfo::UP extractSaveInfo(const vespalib::string & baseFileName); - static LoadInfo::UP extractLoadInfo(const vespalib::string & baseFileName); + SaveInfo::UP extractSaveInfo(const std::string & baseFileName); + static LoadInfo::UP extractLoadInfo(const std::string & baseFileName); void setSource(uint32_t docId, queryeval::Source source) override = 0; std::unique_ptr createIterator() const override = 0; diff --git a/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp index 49812b09c5c2..5c82c6596df1 100644 --- a/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp +++ b/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp @@ -46,11 +46,11 @@ StringSearchContext::setup_enum_hint_sc(const EnumStoreT& enum_stor auto comp = enum_store.make_folded_comparator_prefix(queryTerm()->getTerm()); enum_hint_sc.lookupRange(comp, comp); } else if (isRegex()) { - vespalib::string prefix(vespalib::RegexpUtil::get_prefix(queryTerm()->getTerm())); + std::string prefix(vespalib::RegexpUtil::get_prefix(queryTerm()->getTerm())); auto comp = enum_store.make_folded_comparator_prefix(prefix.c_str()); enum_hint_sc.lookupRange(comp, comp); } else if (isFuzzy()) { - vespalib::string prefix(getFuzzyMatcher().getPrefix()); + std::string prefix(getFuzzyMatcher().getPrefix()); auto comp = enum_store.make_folded_comparator_prefix(prefix.c_str()); enum_hint_sc.lookupRange(comp, comp); } else { diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp index 94bdd1d2a1dd..18e321bd04eb 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp @@ -27,17 +27,17 @@ StringAttribute::countZero(const char * bt, size_t sz) return size; } -StringAttribute::StringAttribute(const vespalib::string & name) : +StringAttribute::StringAttribute(const std::string & name) : AttributeVector(name, Config(BasicType::STRING)), _changes(), - _defaultValue(ChangeBase::UPDATE, 0, vespalib::string("")) + _defaultValue(ChangeBase::UPDATE, 0, std::string("")) { } -StringAttribute::StringAttribute(const vespalib::string & name, const Config & c) : +StringAttribute::StringAttribute(const std::string & name, const Config & c) : AttributeVector(name, c), _changes(), - _defaultValue(ChangeBase::UPDATE, 0, vespalib::string("")) + _defaultValue(ChangeBase::UPDATE, 0, std::string("")) { } @@ -156,14 +156,14 @@ StringAttribute::clearDoc(DocId doc) bool StringAttribute::applyWeight(DocId doc, const FieldValue & fv, const ArithmeticValueUpdate & wAdjust) { - vespalib::string v = fv.getAsString(); + std::string v = fv.getAsString(); return AttributeVector::adjustWeight(_changes, doc, StringChangeData(v), wAdjust); } bool StringAttribute::applyWeight(DocId doc, const FieldValue& fv, const document::AssignValueUpdate& wAdjust) { - vespalib::string v = fv.getAsString(); + std::string v = fv.getAsString(); return AttributeVector::adjustWeight(_changes, doc, StringChangeData(v), wAdjust); } diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index 4d982ec56004..aaadaba30298 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -24,17 +24,17 @@ class StringAttribute : public AttributeVector using LoadedVector = NoLoadedVector; using OffsetVector = std::vector>; public: - bool append(DocId doc, const vespalib::string & v, int32_t weight) { + bool append(DocId doc, const std::string & v, int32_t weight) { return AttributeVector::append(_changes, doc, StringChangeData(v), weight); } template bool append(DocId doc, Accessor & ac) { return AttributeVector::append(_changes, doc, ac); } - bool remove(DocId doc, const vespalib::string & v, int32_t weight) { + bool remove(DocId doc, const std::string & v, int32_t weight) { return AttributeVector::remove(_changes, doc, StringChangeData(v), weight); } - bool update(DocId doc, const vespalib::string & v) { + bool update(DocId doc, const std::string & v) { return AttributeVector::update(_changes, doc, StringChangeData(v)); } bool apply(DocId doc, const ArithmeticValueUpdate & op); @@ -55,8 +55,8 @@ class StringAttribute : public AttributeVector std::span get_raw(DocId) const override; static const char * defaultValue() { return ""; } protected: - StringAttribute(const vespalib::string & name); - StringAttribute(const vespalib::string & name, const Config & c); + StringAttribute(const std::string & name); + StringAttribute(const std::string & name, const Config & c); ~StringAttribute() override; using Change = ChangeTemplate; using ChangeVector = ChangeVectorT; diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp index 9080add8ff16..41c4ce8d948f 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp @@ -116,7 +116,7 @@ EncodeContext64EBase::writeBits(uint64_t data, uint32_t length) namespace { -vespalib::string noFeatures = "NoFeatures"; +std::string noFeatures = "NoFeatures"; } @@ -307,7 +307,7 @@ template void FeatureDecodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { (void) header; (void) prefix; @@ -315,7 +315,7 @@ readHeader(const vespalib::GenericHeader &header, template -const vespalib::string & +const std::string & FeatureDecodeContext::getIdentifier() const { return noFeatures; @@ -390,7 +390,7 @@ template void FeatureEncodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { (void) header; (void) prefix; @@ -401,7 +401,7 @@ template void FeatureEncodeContext:: writeHeader(vespalib::GenericHeader &header, - const vespalib::string &prefix) const + const std::string &prefix) const { (void) header; (void) prefix; @@ -409,7 +409,7 @@ writeHeader(vespalib::GenericHeader &header, template -const vespalib::string & +const std::string & FeatureEncodeContext::getIdentifier() const { return noFeatures; diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.h b/searchlib/src/vespa/searchlib/bitcompression/compression.h index c4104b9f328b..870f1a2cebe6 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/compression.h +++ b/searchlib/src/vespa/searchlib/bitcompression/compression.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include namespace vespalib { @@ -1518,9 +1518,9 @@ class FeatureDecodeContext : public DecodeContext64 { } - virtual void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix); + virtual void readHeader(const vespalib::GenericHeader &header, const std::string &prefix); - virtual const vespalib::string & getIdentifier() const; + virtual const std::string & getIdentifier() const; virtual void readFeatures(DocIdAndFeatures &features); virtual void skipFeatures(unsigned int count); virtual void unpackFeatures(const search::fef::TermFieldMatchDataArray &matchData, uint32_t docId); @@ -1604,9 +1604,9 @@ class FeatureEncodeContext : public EncodeContext64 void pad_for_memory_map_and_flush(); - virtual void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix); - virtual void writeHeader(vespalib::GenericHeader &header, const vespalib::string &prefix) const; - virtual const vespalib::string &getIdentifier() const; + virtual void readHeader(const vespalib::GenericHeader &header, const std::string &prefix); + virtual void writeHeader(vespalib::GenericHeader &header, const std::string &prefix) const; + virtual const std::string &getIdentifier() const; virtual void writeFeatures(const DocIdAndFeatures &features); virtual void setParams(const PostingListParams ¶ms); virtual void getParams(PostingListParams ¶ms) const; diff --git a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp index fa9f514e4c75..23b817f98e4d 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp @@ -957,7 +957,7 @@ PageDict4SSReader::setup(DC &ssd) _l7.clear(); - vespalib::string word; + std::string word; Counts counts; StartOffset startOffset; uint64_t pageNum = _pFirstPageNum; @@ -1063,8 +1063,8 @@ lookup(std::string_view key) uint64_t l6WordNum = 1; uint64_t wordNum = l6WordNum; - vespalib::string l6Word; // Last L6 entry word - vespalib::string word; + std::string l6Word; // Last L6 entry word + std::string word; StartOffset l6StartOffset; // Last L6 entry file offset // Setup for decoding of L6+overflow stream @@ -1191,7 +1191,7 @@ lookupOverflow(uint64_t wordNum) const uint32_t l7Ref = lb->_l7Ref; assert(l7Ref < _l7.size()); - const vespalib::string &word = _l7[l7Ref]._l7Word; + const std::string &word = _l7[l7Ref]._l7Word; uint64_t l6Offset = _ssStartOffset; StartOffset startOffset; if (l7Ref > 0) { @@ -1200,7 +1200,7 @@ lookupOverflow(uint64_t wordNum) const } StartOffset l6StartOffset; - vespalib::string l6Word; + std::string l6Word; uint32_t l7Ref2 = _l7[l7Ref]._l7Ref; if (l7Ref2 != noL7Ref()) { @@ -1322,7 +1322,7 @@ lookup(const SSReader &ssReader, _l3Word = l6Word; _l3StartOffset = l6StartOffset; - vespalib::string word; + std::string word; uint32_t l3WordOffset = 0; uint32_t l5WordOffset = l3WordOffset; uint64_t l3WordNum = l6WordNum; @@ -1521,9 +1521,9 @@ lookup(const SSReader &ssReader, uint32_t wordOffset = getPageByteSize() - wordsSize; const char *wordBuf = static_cast(page) + wordOffset; - vespalib::string countsWord(l3Word); + std::string countsWord(l3Word); StartOffset countsStartOffset = l3StartOffset; - vespalib::string word; + std::string word; Counts counts; uint32_t countsWordOffset = 0; @@ -1992,7 +1992,7 @@ PageDict4Reader::setupSPage() void -PageDict4Reader::decodePWord(vespalib::string &word) +PageDict4Reader::decodePWord(std::string &word) { assert(_wc != _we); size_t lcp = static_cast(*_wc); @@ -2011,7 +2011,7 @@ PageDict4Reader::decodePWord(vespalib::string &word) void -PageDict4Reader::decodeSPWord(vespalib::string &word) +PageDict4Reader::decodeSPWord(std::string &word) { assert(_spwc != _spwe); size_t lcp = static_cast(*_spwc); @@ -2030,7 +2030,7 @@ PageDict4Reader::decodeSPWord(vespalib::string &word) void -PageDict4Reader::decodeSSWord(vespalib::string &word) +PageDict4Reader::decodeSSWord(std::string &word) { uint64_t l6Offset = _ssd.getReadOffset(); @@ -2077,7 +2077,7 @@ PageDict4Reader::decodeSSWord(vespalib::string &word) } void -PageDict4Reader::readCounts(vespalib::string &word, uint64_t &wordNum, Counts &counts) +PageDict4Reader::readCounts(std::string &word, uint64_t &wordNum, Counts &counts) { if (_countsResidue > 0) { assert(_cc != _ce); @@ -2124,7 +2124,7 @@ PageDict4Reader::readCounts(vespalib::string &word, uint64_t &wordNum, Counts &c readOverflowCounts(word, counts); _overflowPage = false; assert(_l3Residue > 0); - vespalib::string tword; + std::string tword; if (_l3Residue > 1) { decodeSPWord(tword); } else { @@ -2152,7 +2152,7 @@ PageDict4Reader::readCounts(vespalib::string &word, uint64_t &wordNum, Counts &c } void -PageDict4Reader::readOverflowCounts(vespalib::string &word, Counts &counts) +PageDict4Reader::readOverflowCounts(std::string &word, Counts &counts) { uint64_t wordNum = _pd.readBits(64); diff --git a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.h b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.h index 4b21d03b5063..f89fd8e67537 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.h +++ b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.h @@ -3,8 +3,8 @@ #pragma once #include "countcompression.h" -#include #include +#include namespace search::bitcompression { @@ -119,7 +119,7 @@ class PageDict4SSWriter : public PageDict4PageParams private: EC &_eL6; // L6 stream - vespalib::string _l6Word; // L6 word + std::string _l6Word; // L6 word StartOffset _l6StartOffset; // file offsets + accnum uint64_t _l6PageNum; // Page number for last L6 entry uint32_t _l6SparsePageNum; // Sparse page number for last L6 entry @@ -187,10 +187,10 @@ class PageDict4SPWriter : public PageDict4PageParams ComprFileWriteContext _wcL4;// L4 buffer EC _eL5; // L5 stream ComprFileWriteContext _wcL5;// L5 buffer - vespalib::string _l3Word; // last L3 word written - vespalib::string _l4Word; // last L4 word written - vespalib::string _l5Word; // last L5 word written - vespalib::string _l6Word; // word before this sparse page + std::string _l3Word; // last L3 word written + std::string _l4Word; // last L4 word written + std::string _l5Word; // last L5 word written + std::string _l6Word; // word before this sparse page uint32_t _l3WordOffset; // Offset for next L3 word to write uint32_t _l4WordOffset; // Offset for last L4 word written uint32_t _l5WordOffset; // Offset for last L5 word written @@ -303,11 +303,11 @@ class PageDict4PWriter : public PageDict4PageParams ComprFileWriteContext _wcL1;// L1 buffer EC _eL2; // L2 stream ComprFileWriteContext _wcL2;// L2 buffer - vespalib::string _countsWord; // last counts on page - vespalib::string _l1Word; // Last L1 word written - vespalib::string _l2Word; // Last L2 word written - vespalib::string _l3Word; // word before this page - vespalib::string _pendingCountsWord; // pending counts word (counts written) + std::string _countsWord; // last counts on page + std::string _l1Word; // Last L1 word written + std::string _l2Word; // Last L2 word written + std::string _l3Word; // word before this page + std::string _pendingCountsWord; // pending counts word (counts written) uint32_t _countsWordOffset; // Offset for next counts word to write uint32_t _l1WordOffset; // Offset of last L1 word written uint32_t _l2WordOffset; // Offset of last L2 word written @@ -374,8 +374,8 @@ class PageDict4SSLookupRes using Counts = index::PostingListCounts; using StartOffset = PageDict4StartOffset; - vespalib::string _l6Word; // last L6 word before key - vespalib::string _lastWord; // L6 or overflow word >= key + std::string _l6Word; // last L6 word before key + std::string _lastWord; // L6 or overflow word >= key StartOffset _l6StartOffset; // File offsets Counts _counts; // Counts valid if overflow uint64_t _pageNum; @@ -404,7 +404,7 @@ class PageDict4SSReader : public PageDict4PageParams class L7Entry { public: - vespalib::string _l7Word; + std::string _l7Word; StartOffset _l7StartOffset; // Offsets in data files uint64_t _l7WordNum; uint64_t _l6Offset; // Offset in L6+overflow stream @@ -511,8 +511,8 @@ class PageDict4SPLookupRes : public PageDict4PageParams using SSReader = PageDict4SSReader; public: - vespalib::string _l3Word; - vespalib::string _lastWord; // L3 word >= key + std::string _l3Word; + std::string _lastWord; // L3 word >= key StartOffset _l3StartOffset; uint64_t _pageNum; uint64_t _l3WordNum; @@ -546,7 +546,7 @@ class PageDict4PLookupRes : public PageDict4PageParams StartOffset _startOffset; uint64_t _wordNum; bool _res; - vespalib::string *_nextWord; + std::string *_nextWord; public: PageDict4PLookupRes(); @@ -679,8 +679,8 @@ class PageDict4Reader : public PageDict4PageParams WV _words; WV::const_iterator _wc; WV::const_iterator _we; - vespalib::string _lastWord; - vespalib::string _lastSSWord; + std::string _lastWord; + std::string _lastSSWord; DC &_spd; uint32_t _l3Residue; @@ -702,11 +702,11 @@ class PageDict4Reader : public PageDict4PageParams void setup(); void setupPage(); void setupSPage(); - void decodePWord(vespalib::string &word); - void decodeSPWord(vespalib::string &word); - void decodeSSWord(vespalib::string &word); - void readCounts(vespalib::string &word, uint64_t &wordNum, Counts &counts); - void readOverflowCounts(vespalib::string &word, Counts &counts); + void decodePWord(std::string &word); + void decodeSPWord(std::string &word); + void decodeSSWord(std::string &word); + void readCounts(std::string &word, uint64_t &wordNum, Counts &counts); + void readOverflowCounts(std::string &word, Counts &counts); }; } diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.cpp b/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.cpp index e2b2d849f240..7acc5615bfd3 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.cpp @@ -36,7 +36,7 @@ PosOccFieldParams::operator==(const PosOccFieldParams &rhs) const } -vespalib::string +std::string PosOccFieldParams::getParamsPrefix(uint32_t idx) { vespalib::asciistream paramsPrefix; @@ -49,10 +49,10 @@ PosOccFieldParams::getParamsPrefix(uint32_t idx) void PosOccFieldParams::getParams(PostingListParams ¶ms, uint32_t idx) const { - vespalib::string paramsPrefix = getParamsPrefix(idx); - vespalib::string collStr = paramsPrefix + ".collectionType"; - vespalib::string avgElemLenStr = paramsPrefix + ".avgElemLen"; - vespalib::string nameStr = paramsPrefix + ".name"; + std::string paramsPrefix = getParamsPrefix(idx); + std::string collStr = paramsPrefix + ".collectionType"; + std::string avgElemLenStr = paramsPrefix + ".avgElemLen"; + std::string nameStr = paramsPrefix + ".name"; switch (_collectionType) { case SINGLE: @@ -73,13 +73,13 @@ PosOccFieldParams::getParams(PostingListParams ¶ms, uint32_t idx) const void PosOccFieldParams::setParams(const PostingListParams ¶ms, uint32_t idx) { - vespalib::string paramsPrefix = getParamsPrefix(idx); - vespalib::string collStr = paramsPrefix + ".collectionType"; - vespalib::string avgElemLenStr = paramsPrefix + ".avgElemLen"; - vespalib::string nameStr = paramsPrefix + ".name"; + std::string paramsPrefix = getParamsPrefix(idx); + std::string collStr = paramsPrefix + ".collectionType"; + std::string avgElemLenStr = paramsPrefix + ".avgElemLen"; + std::string nameStr = paramsPrefix + ".name"; if (params.isSet(collStr)) { - vespalib::string collVal = params.getStr(collStr); + std::string collVal = params.getStr(collStr); if (collVal == "single") { _collectionType = SINGLE; _hasElements = false; @@ -132,16 +132,16 @@ PosOccFieldParams::setSchemaParams(const Schema &schema, uint32_t fieldId) namespace { -vespalib::string field_length_infix = "field_length."; +std::string field_length_infix = "field_length."; struct FieldLengthKeys { - vespalib::string _average; - vespalib::string _samples; - FieldLengthKeys(const vespalib::string &prefix); + std::string _average; + std::string _samples; + FieldLengthKeys(const std::string &prefix); ~FieldLengthKeys(); }; -FieldLengthKeys::FieldLengthKeys(const vespalib::string &prefix) +FieldLengthKeys::FieldLengthKeys(const std::string &prefix) : _average(prefix + field_length_infix + "average"), _samples(prefix + field_length_infix + "samples") { @@ -153,12 +153,12 @@ FieldLengthKeys::~FieldLengthKeys() = default; void PosOccFieldParams::readHeader(const GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { using Tag = GenericHeader::Tag; - vespalib::string nameKey(prefix + "fieldName"); - vespalib::string collKey(prefix + "collectionType"); - vespalib::string avgElemLenKey(prefix + "avgElemLen"); + std::string nameKey(prefix + "fieldName"); + std::string collKey(prefix + "collectionType"); + std::string avgElemLenKey(prefix + "avgElemLen"); FieldLengthKeys field_length_keys(prefix); _name = header.getTag(nameKey).asString(); @@ -197,12 +197,12 @@ PosOccFieldParams::readHeader(const GenericHeader &header, void PosOccFieldParams::writeHeader(GenericHeader &header, - const vespalib::string &prefix) const + const std::string &prefix) const { using Tag = GenericHeader::Tag; - vespalib::string nameKey(prefix + "fieldName"); - vespalib::string collKey(prefix + "collectionType"); - vespalib::string avgElemLenKey(prefix + "avgElemLen"); + std::string nameKey(prefix + "fieldName"); + std::string collKey(prefix + "collectionType"); + std::string avgElemLenKey(prefix + "avgElemLen"); FieldLengthKeys field_length_keys(prefix); header.putTag(Tag(nameKey, _name)); Schema::CollectionType ct(schema::CollectionType::SINGLE); diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.h b/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.h index ea8e6bcf73c2..81aa776e9509 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.h +++ b/searchlib/src/vespa/searchlib/bitcompression/posocc_field_params.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace search::index { class PostingListParams; @@ -33,18 +33,18 @@ class PosOccFieldParams bool _hasElementWeights; uint32_t _avgElemLen; CollectionType _collectionType; - vespalib::string _name; + std::string _name; index::FieldLengthInfo _field_length_info; PosOccFieldParams(); bool operator==(const PosOccFieldParams &rhs) const; - static vespalib::string getParamsPrefix(uint32_t idx); + static std::string getParamsPrefix(uint32_t idx); void getParams(PostingListParams ¶ms, uint32_t idx) const; void setParams(const PostingListParams ¶ms, uint32_t idx); void setSchemaParams(const Schema &schema, uint32_t fieldId); - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix); - void writeHeader(vespalib::GenericHeader &header, const vespalib::string &prefix) const; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix); + void writeHeader(vespalib::GenericHeader &header, const std::string &prefix) const; const index::FieldLengthInfo &get_field_length_info() const { return _field_length_info; } void set_field_length_info(const index::FieldLengthInfo &field_length_info) { _field_length_info = field_length_info; } }; diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.cpp b/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.cpp index 8968954f34cd..7cbd1298441e 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.cpp @@ -101,9 +101,9 @@ PosOccFieldsParams::setSchemaParams(const Schema &schema, void PosOccFieldsParams::readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { - vespalib::string numFieldsKey(prefix + "numFields"); + std::string numFieldsKey(prefix + "numFields"); assertCachedParamsRef(); uint32_t numFields = header.getTag(numFieldsKey).asInteger(); assert(numFields == 1u); @@ -113,7 +113,7 @@ PosOccFieldsParams::readHeader(const vespalib::GenericHeader &header, for (uint32_t field = 0; field < numFields; ++field) { vespalib::asciistream as; as << prefix << "field[" << field << "]."; - vespalib::string subPrefix(as.view()); + std::string subPrefix(as.view()); _params[field].readHeader(header, subPrefix); } } @@ -121,9 +121,9 @@ PosOccFieldsParams::readHeader(const vespalib::GenericHeader &header, void PosOccFieldsParams::writeHeader(vespalib::GenericHeader &header, - const vespalib::string &prefix) const + const std::string &prefix) const { - vespalib::string numFieldsKey(prefix + "numFields"); + std::string numFieldsKey(prefix + "numFields"); assertCachedParamsRef(); assert(_numFields == 1u); header.putTag(GenericHeader::Tag(numFieldsKey, _numFields)); @@ -131,7 +131,7 @@ PosOccFieldsParams::writeHeader(vespalib::GenericHeader &header, for (uint32_t field = 0; field < _numFields; ++field) { vespalib::asciistream as; as << prefix << "field[" << field << "]."; - vespalib::string subPrefix(as.view()); + std::string subPrefix(as.view()); _params[field].writeHeader(header, subPrefix); } } diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.h b/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.h index df5d80b5a29d..43f06d704420 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.h +++ b/searchlib/src/vespa/searchlib/bitcompression/posocc_fields_params.h @@ -38,8 +38,8 @@ class PosOccFieldsParams void getParams(PostingListParams ¶ms) const; void setParams(const PostingListParams ¶ms); void setSchemaParams(const Schema &schema, const uint32_t indexId); - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix); - void writeHeader(vespalib::GenericHeader &header, const vespalib::string &prefix) const; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix); + void writeHeader(vespalib::GenericHeader &header, const std::string &prefix) const; void set_field_length_info(const index::FieldLengthInfo &field_length_info); }; diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp index bfd09337babe..048855d8a236 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp @@ -21,10 +21,10 @@ using namespace search::index; namespace { -vespalib::string PosOccId = "PosOcc.3"; -vespalib::string PosOccIdCooked = "PosOcc.3.Cooked"; -vespalib::string EG64PosOccId = "EG64PosOcc.3"; // Dynamic k values -vespalib::string EG64PosOccId2 = "EG64PosOcc.2"; // Fixed k values +std::string PosOccId = "PosOcc.3"; +std::string PosOccIdCooked = "PosOcc.3.Cooked"; +std::string EG64PosOccId = "EG64PosOcc.3"; // Dynamic k values +std::string EG64PosOccId2 = "EG64PosOcc.2"; // Fixed k values } @@ -35,7 +35,7 @@ template void EG2PosOccDecodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { const_cast(_fieldsParams)->readHeader(header, prefix); } @@ -399,7 +399,7 @@ template void EG2PosOccEncodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { const_cast(_fieldsParams)->readHeader(header, prefix); @@ -407,7 +407,7 @@ readHeader(const vespalib::GenericHeader &header, template -const vespalib::string & +const std::string & EG2PosOccDecodeContext::getIdentifier() const { return EG64PosOccId2; @@ -418,14 +418,14 @@ template void EG2PosOccEncodeContext:: writeHeader(vespalib::GenericHeader &header, - const vespalib::string &prefix) const + const std::string &prefix) const { _fieldsParams->writeHeader(header, prefix); } template -const vespalib::string & +const std::string & EG2PosOccEncodeContext::getIdentifier() const { return EG64PosOccId2; @@ -539,7 +539,7 @@ template void EGPosOccDecodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { ParentClass::readHeader(header, prefix); } @@ -889,14 +889,14 @@ template void EGPosOccEncodeContext:: readHeader(const vespalib::GenericHeader &header, - const vespalib::string &prefix) + const std::string &prefix) { ParentClass::readHeader(header, prefix); } template -const vespalib::string & +const std::string & EGPosOccDecodeContext::getIdentifier() const { return EG64PosOccId; @@ -907,14 +907,14 @@ template void EGPosOccEncodeContext:: writeHeader(vespalib::GenericHeader &header, - const vespalib::string &prefix) const + const std::string &prefix) const { ParentClass::writeHeader(header, prefix); } template -const vespalib::string & +const std::string & EGPosOccEncodeContext::getIdentifier() const { return EG64PosOccId; diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.h b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.h index 64ed4b5fd375..b2aa34e08de7 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.h +++ b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.h @@ -72,8 +72,8 @@ class EG2PosOccDecodeContext : public FeatureDecodeContext return *this; } - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix) override; - const vespalib::string &getIdentifier() const override; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix) override; + const std::string &getIdentifier() const override; void readFeatures(search::index::DocIdAndFeatures &features) override; void skipFeatures(unsigned int count) override; void unpackFeatures(const search::fef::TermFieldMatchDataArray &matchData, uint32_t docId) override; @@ -166,9 +166,9 @@ class EG2PosOccEncodeContext : public FeatureEncodeContext return *this; } - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix) override; - void writeHeader(vespalib::GenericHeader &header, const vespalib::string &prefix) const override; - const vespalib::string &getIdentifier() const override; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix) override; + void writeHeader(vespalib::GenericHeader &header, const std::string &prefix) const override; + const std::string &getIdentifier() const override; void writeFeatures(const DocIdAndFeatures &features) override; void setParams(const PostingListParams ¶ms) override; void getParams(PostingListParams ¶ms) const override; @@ -224,8 +224,8 @@ class EGPosOccDecodeContext : public EG2PosOccDecodeContext return *this; } - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix) override; - const vespalib::string &getIdentifier() const override; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix) override; + const std::string &getIdentifier() const override; void readFeatures(search::index::DocIdAndFeatures &features) override; void skipFeatures(unsigned int count) override; void unpackFeatures(const search::fef::TermFieldMatchDataArray &matchData, uint32_t docId) override; @@ -317,9 +317,9 @@ class EGPosOccEncodeContext : public EG2PosOccEncodeContext return *this; } - void readHeader(const vespalib::GenericHeader &header, const vespalib::string &prefix) override; - void writeHeader(vespalib::GenericHeader &header, const vespalib::string &prefix) const override; - const vespalib::string &getIdentifier() const override; + void readHeader(const vespalib::GenericHeader &header, const std::string &prefix) override; + void writeHeader(vespalib::GenericHeader &header, const std::string &prefix) const override; + const std::string &getIdentifier() const override; void writeFeatures(const DocIdAndFeatures &features) override; void setParams(const PostingListParams ¶ms) override; void getParams(PostingListParams ¶ms) const override; diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp index 03f0d1627166..e0403b54a838 100644 --- a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/searchlib/src/vespa/searchlib/common/converters.h b/searchlib/src/vespa/searchlib/common/converters.h index 869b26a9bf91..7661d3391504 100644 --- a/searchlib/src/vespa/searchlib/common/converters.h +++ b/searchlib/src/vespa/searchlib/common/converters.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace search::common { @@ -19,7 +19,7 @@ class LowercaseConverter : public BlobConverter LowercaseConverter() noexcept; private: ConstBufferRef onConvert(const ConstBufferRef & src) const override; - mutable vespalib::string _buffer; + mutable std::string _buffer; }; class ConverterFactory { diff --git a/searchlib/src/vespa/searchlib/common/documentsummary.cpp b/searchlib/src/vespa/searchlib/common/documentsummary.cpp index 9341cf92b89c..82b8b5993d3f 100644 --- a/searchlib/src/vespa/searchlib/common/documentsummary.cpp +++ b/searchlib/src/vespa/searchlib/common/documentsummary.cpp @@ -13,12 +13,12 @@ using vespalib::getLastErrorString; namespace search::docsummary { bool -DocumentSummary::readDocIdLimit(const vespalib::string &dir, uint32_t &count) +DocumentSummary::readDocIdLimit(const std::string &dir, uint32_t &count) { char numbuf[20]; Fast_BufferedFile qcntfile(4_Ki); unsigned int qcnt; - vespalib::string qcntname; + std::string qcntname; const char *p; qcntname = dir + "/docsum.qcnt"; @@ -37,9 +37,9 @@ DocumentSummary::readDocIdLimit(const vespalib::string &dir, uint32_t &count) bool -DocumentSummary::writeDocIdLimit(const vespalib::string &dir, uint32_t count) +DocumentSummary::writeDocIdLimit(const std::string &dir, uint32_t count) { - vespalib::string qcntname = dir + "/docsum.qcnt"; + std::string qcntname = dir + "/docsum.qcnt"; Fast_BufferedFile qcntfile(4_Ki); qcntfile.WriteOpen(qcntname.c_str()); diff --git a/searchlib/src/vespa/searchlib/common/documentsummary.h b/searchlib/src/vespa/searchlib/common/documentsummary.h index 5b4f92dcae75..eb921d737d6a 100644 --- a/searchlib/src/vespa/searchlib/common/documentsummary.h +++ b/searchlib/src/vespa/searchlib/common/documentsummary.h @@ -2,15 +2,16 @@ #pragma once -#include +#include +#include namespace search::docsummary { class DocumentSummary { public: - static bool readDocIdLimit(const vespalib::string &dir, uint32_t &docIdLimit); - static bool writeDocIdLimit(const vespalib::string &dir, uint32_t docIdLimit); + static bool readDocIdLimit(const std::string &dir, uint32_t &docIdLimit); + static bool writeDocIdLimit(const std::string &dir, uint32_t docIdLimit); }; } diff --git a/searchlib/src/vespa/searchlib/common/fileheadercontext.h b/searchlib/src/vespa/searchlib/common/fileheadercontext.h index 955b0e60b910..1987b8a3ee50 100644 --- a/searchlib/src/vespa/searchlib/common/fileheadercontext.h +++ b/searchlib/src/vespa/searchlib/common/fileheadercontext.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { class GenericHeader; @@ -15,7 +15,7 @@ class FileHeaderContext FileHeaderContext(); virtual ~FileHeaderContext(); - virtual void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const = 0; + virtual void addTags(vespalib::GenericHeader &header, const std::string &name) const = 0; static void addCreateAndFreezeTime(vespalib::GenericHeader &header); static void setFreezeTime(vespalib::GenericHeader &header); diff --git a/searchlib/src/vespa/searchlib/common/fileheadertags.cpp b/searchlib/src/vespa/searchlib/common/fileheadertags.cpp index c6c15f089180..c1c4013e882e 100644 --- a/searchlib/src/vespa/searchlib/common/fileheadertags.cpp +++ b/searchlib/src/vespa/searchlib/common/fileheadertags.cpp @@ -4,13 +4,13 @@ namespace search::tags { // Do not change these constants, they are persisted in many file headers. -vespalib::string FREEZE_TIME("freezeTime"); -vespalib::string CREATE_TIME("createTime"); -vespalib::string FROZEN("frozen"); -vespalib::string DOCID_LIMIT("docIdLimit"); -vespalib::string FILE_BIT_SIZE("fileBitSize"); -vespalib::string DESC("desc"); -vespalib::string ENTRY_SIZE("entrySize"); -vespalib::string NUM_KEYS("numKeys"); +std::string FREEZE_TIME("freezeTime"); +std::string CREATE_TIME("createTime"); +std::string FROZEN("frozen"); +std::string DOCID_LIMIT("docIdLimit"); +std::string FILE_BIT_SIZE("fileBitSize"); +std::string DESC("desc"); +std::string ENTRY_SIZE("entrySize"); +std::string NUM_KEYS("numKeys"); } diff --git a/searchlib/src/vespa/searchlib/common/fileheadertags.h b/searchlib/src/vespa/searchlib/common/fileheadertags.h index c7e7385160e6..4e17ff2e34b7 100644 --- a/searchlib/src/vespa/searchlib/common/fileheadertags.h +++ b/searchlib/src/vespa/searchlib/common/fileheadertags.h @@ -1,17 +1,17 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace search::tags { -extern vespalib::string FREEZE_TIME; -extern vespalib::string CREATE_TIME; -extern vespalib::string FROZEN; -extern vespalib::string DOCID_LIMIT; -extern vespalib::string FILE_BIT_SIZE; -extern vespalib::string DESC; -extern vespalib::string ENTRY_SIZE; -extern vespalib::string NUM_KEYS; +extern std::string FREEZE_TIME; +extern std::string CREATE_TIME; +extern std::string FROZEN; +extern std::string DOCID_LIMIT; +extern std::string FILE_BIT_SIZE; +extern std::string DESC; +extern std::string ENTRY_SIZE; +extern std::string NUM_KEYS; } diff --git a/searchlib/src/vespa/searchlib/common/geo_location.h b/searchlib/src/vespa/searchlib/common/geo_location.h index 58483703fcb6..38de27365162 100644 --- a/searchlib/src/vespa/searchlib/common/geo_location.h +++ b/searchlib/src/vespa/searchlib/common/geo_location.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include namespace search::common { diff --git a/searchlib/src/vespa/searchlib/common/geo_location_parser.h b/searchlib/src/vespa/searchlib/common/geo_location_parser.h index e3f24dabac1a..5be05ad14e48 100644 --- a/searchlib/src/vespa/searchlib/common/geo_location_parser.h +++ b/searchlib/src/vespa/searchlib/common/geo_location_parser.h @@ -2,10 +2,10 @@ #pragma once -#include -#include #include "geo_location.h" #include "geo_location_spec.h" +#include +#include namespace search::common { diff --git a/searchlib/src/vespa/searchlib/common/geo_location_spec.h b/searchlib/src/vespa/searchlib/common/geo_location_spec.h index f561c7355afe..73c2312d73e6 100644 --- a/searchlib/src/vespa/searchlib/common/geo_location_spec.h +++ b/searchlib/src/vespa/searchlib/common/geo_location_spec.h @@ -3,8 +3,8 @@ #pragma once #include "geo_location.h" -#include #include +#include namespace search::common { diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp index 3f6fce72c5f6..df04ba945351 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp @@ -15,18 +15,18 @@ namespace { class Parser { private: - vespalib::string _name; + std::string _name; vespalib::FilePointer _file; uint32_t _line; char _buf[2048]; bool _error; - vespalib::string _lastKey; - vespalib::string _lastValue; + std::string _lastKey; + std::string _lastValue; uint32_t _lastIdx; bool _matched; public: - Parser(const vespalib::string &name) + Parser(const std::string &name) : _name(name), _file(fopen(name.c_str(), "r")), _line(0), @@ -90,14 +90,14 @@ class Parser { if (split == nullptr || (split - _buf) == 0) { return illegalLine(); } - _lastKey = vespalib::string(_buf, split - _buf); - _lastValue = vespalib::string(split + 1, (_buf + len) - (split + 1)); + _lastKey = std::string(_buf, split - _buf); + _lastValue = std::string(split + 1, (_buf + len) - (split + 1)); _matched = false; return true; } - const vespalib::string key() const { return _lastKey; } - const vespalib::string value() const { return _lastValue; } - void parseBool(const vespalib::string &k, bool &v) { + const std::string key() const { return _lastKey; } + const std::string value() const { return _lastValue; } + void parseBool(const std::string &k, bool &v) { if (!_matched && !_error && _lastKey == k) { _matched = true; if (_lastValue == "true") { @@ -109,13 +109,13 @@ class Parser { } } } - void parseString(const vespalib::string &k, vespalib::string &v) { + void parseString(const std::string &k, std::string &v) { if (!_matched && !_error && _lastKey == k) { _matched = true; v = _lastValue; } } - void parseInt64(const vespalib::string &k, uint64_t &v) { + void parseInt64(const std::string &k, uint64_t &v) { if (!_matched && !_error && _lastKey == k) { _matched = true; char *end = nullptr; @@ -128,7 +128,7 @@ class Parser { v = val; } } - bool parseArray(const vespalib::string &name, uint32_t size) { + bool parseArray(const std::string &name, uint32_t size) { if (_matched || _error || _lastKey.length() < name.length() + 1 || strncmp(_lastKey.c_str(), name.c_str(), name.length()) != 0 @@ -136,8 +136,8 @@ class Parser { { return false; } - vespalib::string::size_type dot2 = _lastKey.find('.', name.length() + 1); - if (dot2 == vespalib::string::npos) { + std::string::size_type dot2 = _lastKey.find('.', name.length() + 1); + if (dot2 == std::string::npos) { return illegalArrayKey(); } char *end = nullptr; @@ -159,8 +159,8 @@ class Parser { namespace search { -vespalib::string -IndexMetaInfo::makeFileName(const vespalib::string &baseName) +std::string +IndexMetaInfo::makeFileName(const std::string &baseName) { if (_path.length() == 0 || _path == ".") { return baseName; @@ -193,7 +193,7 @@ IndexMetaInfo::findSnapshot(uint64_t syncToken) } -IndexMetaInfo::IndexMetaInfo(const vespalib::string &path) +IndexMetaInfo::IndexMetaInfo(const std::string &path) : _path(path), _snapshots() { @@ -283,7 +283,7 @@ IndexMetaInfo::clear() bool -IndexMetaInfo::load(const vespalib::string &baseName) +IndexMetaInfo::load(const std::string &baseName) { clear(); Parser parser(makeFileName(baseName)); @@ -302,10 +302,10 @@ IndexMetaInfo::load(const vespalib::string &baseName) bool -IndexMetaInfo::save(const vespalib::string &baseName) +IndexMetaInfo::save(const std::string &baseName) { - vespalib::string fileName = makeFileName(baseName); - vespalib::string newName = fileName + ".new"; + std::string fileName = makeFileName(baseName); + std::string newName = fileName + ".new"; std::filesystem::remove(std::filesystem::path(newName)); vespalib::FilePointer f(fopen(newName.c_str(), "w")); if (!f.valid()) { diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.h b/searchlib/src/vespa/searchlib/common/indexmetainfo.h index eb2136bdd368..f3d5d509b3b9 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.h +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include #include namespace search { @@ -14,9 +15,9 @@ class IndexMetaInfo { bool valid; uint64_t syncToken; - vespalib::string dirName; + std::string dirName; Snapshot() noexcept : valid(false), syncToken(0), dirName() {} - Snapshot(bool valid_, uint64_t syncToken_, const vespalib::string &dirName_) + Snapshot(bool valid_, uint64_t syncToken_, const std::string &dirName_) : valid(valid_), syncToken(syncToken_), dirName(dirName_) {} bool operator==(const Snapshot &rhs) const { return (valid == rhs.valid @@ -31,19 +32,19 @@ class IndexMetaInfo using SnapItr = SnapshotList::iterator; private: - vespalib::string _path; + std::string _path; SnapshotList _snapshots; - vespalib::string makeFileName(const vespalib::string &baseName); + std::string makeFileName(const std::string &baseName); Snapshot &getCreateSnapshot(uint32_t idx); SnapItr findSnapshot(uint64_t syncToken); public: - IndexMetaInfo(const vespalib::string &path); + IndexMetaInfo(const std::string &path); ~IndexMetaInfo(); - vespalib::string getPath() const { return _path; } - void setPath(const vespalib::string &path) { _path = path; } + std::string getPath() const { return _path; } + void setPath(const std::string &path) { _path = path; } const SnapshotList &snapshots() const { return _snapshots; } @@ -55,8 +56,8 @@ class IndexMetaInfo bool invalidateSnapshot(uint64_t syncToken); void clear(); - bool load(const vespalib::string &baseName = "meta-info.txt"); - bool save(const vespalib::string &baseName = "meta-info.txt"); + bool load(const std::string &baseName = "meta-info.txt"); + bool save(const std::string &baseName = "meta-info.txt"); }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/mapnames.cpp b/searchlib/src/vespa/searchlib/common/mapnames.cpp index 8e63d8658459..40367e82ee4e 100644 --- a/searchlib/src/vespa/searchlib/common/mapnames.cpp +++ b/searchlib/src/vespa/searchlib/common/mapnames.cpp @@ -4,12 +4,12 @@ namespace search { -const vespalib::string MapNames::RANK("rank"); -const vespalib::string MapNames::FEATURE("feature"); -const vespalib::string MapNames::HIGHLIGHTTERMS("highlightterms"); -const vespalib::string MapNames::MATCH("match"); -const vespalib::string MapNames::CACHES("caches"); -const vespalib::string MapNames::MODEL("model"); -const vespalib::string MapNames::TRACE("trace"); +const std::string MapNames::RANK("rank"); +const std::string MapNames::FEATURE("feature"); +const std::string MapNames::HIGHLIGHTTERMS("highlightterms"); +const std::string MapNames::MATCH("match"); +const std::string MapNames::CACHES("caches"); +const std::string MapNames::MODEL("model"); +const std::string MapNames::TRACE("trace"); } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/mapnames.h b/searchlib/src/vespa/searchlib/common/mapnames.h index 85d59ba2b6de..0ea29290d927 100644 --- a/searchlib/src/vespa/searchlib/common/mapnames.h +++ b/searchlib/src/vespa/searchlib/common/mapnames.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search { @@ -12,25 +12,25 @@ namespace search { struct MapNames { /** name of rank feature property collection **/ - static const vespalib::string RANK; + static const std::string RANK; /** name of feature override property collection **/ - static const vespalib::string FEATURE; + static const std::string FEATURE; /** name of highlightterms property collection **/ - static const vespalib::string HIGHLIGHTTERMS; + static const std::string HIGHLIGHTTERMS; /** name of match property collection **/ - static const vespalib::string MATCH; + static const std::string MATCH; /** name of cache property collection **/ - static const vespalib::string CACHES; + static const std::string CACHES; /** name of model property collection **/ - static const vespalib::string MODEL; + static const std::string MODEL; /** name of trace property collection **/ - static const vespalib::string TRACE; + static const std::string TRACE; }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/matching_elements.cpp b/searchlib/src/vespa/searchlib/common/matching_elements.cpp index bfd2b16daabb..2c5ae9423706 100644 --- a/searchlib/src/vespa/searchlib/common/matching_elements.cpp +++ b/searchlib/src/vespa/searchlib/common/matching_elements.cpp @@ -9,7 +9,7 @@ MatchingElements::MatchingElements() = default; MatchingElements::~MatchingElements() = default; void -MatchingElements::add_matching_elements(uint32_t docid, const vespalib::string &field_name, const std::vector &elements) +MatchingElements::add_matching_elements(uint32_t docid, const std::string &field_name, const std::vector &elements) { auto &list = _map[key_t(docid, field_name)]; std::vector new_list; @@ -18,7 +18,7 @@ MatchingElements::add_matching_elements(uint32_t docid, const vespalib::string & } const std::vector & -MatchingElements::get_matching_elements(uint32_t docid, const vespalib::string &field_name) const +MatchingElements::get_matching_elements(uint32_t docid, const std::string &field_name) const { static const std::vector empty; auto res = _map.find(key_t(docid, field_name)); diff --git a/searchlib/src/vespa/searchlib/common/matching_elements.h b/searchlib/src/vespa/searchlib/common/matching_elements.h index 0186c94ce94f..2cfc71a6cb62 100644 --- a/searchlib/src/vespa/searchlib/common/matching_elements.h +++ b/searchlib/src/vespa/searchlib/common/matching_elements.h @@ -1,11 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include -#include #include +#include +#include +#include namespace search { @@ -16,7 +16,7 @@ namespace search { class MatchingElements { private: - using key_t = std::pair; + using key_t = std::pair; using value_t = std::vector; std::map _map; @@ -27,8 +27,8 @@ class MatchingElements using UP = std::unique_ptr; - void add_matching_elements(uint32_t docid, const vespalib::string &field_name, const std::vector &elements); - const std::vector &get_matching_elements(uint32_t docid, const vespalib::string &field_name) const; + void add_matching_elements(uint32_t docid, const std::string &field_name, const std::vector &elements); + const std::vector &get_matching_elements(uint32_t docid, const std::string &field_name) const; }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/matching_elements_fields.h b/searchlib/src/vespa/searchlib/common/matching_elements_fields.h index 1fd5471fcbd3..1facdfb189a4 100644 --- a/searchlib/src/vespa/searchlib/common/matching_elements_fields.h +++ b/searchlib/src/vespa/searchlib/common/matching_elements_fields.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace search { @@ -17,29 +17,29 @@ namespace search { **/ class MatchingElementsFields { private: - std::set _fields; - std::map _struct_fields; + std::set _fields; + std::map _struct_fields; public: MatchingElementsFields(); ~MatchingElementsFields(); bool empty() const { return _fields.empty(); } - void add_field(const vespalib::string &field_name) { + void add_field(const std::string &field_name) { _fields.insert(field_name); } - void add_mapping(const vespalib::string &field_name, - const vespalib::string &struct_field_name) { + void add_mapping(const std::string &field_name, + const std::string &struct_field_name) { _fields.insert(field_name); _struct_fields[struct_field_name] = field_name; } - bool has_field(const vespalib::string &field_name) const { + bool has_field(const std::string &field_name) const { return (_fields.count(field_name) > 0); } - bool has_struct_field(const vespalib::string &struct_field_name) const { + bool has_struct_field(const std::string &struct_field_name) const { return (_struct_fields.find(struct_field_name) != _struct_fields.end()); } - const vespalib::string &get_enclosing_field(const vespalib::string &struct_field_name) const { - static const vespalib::string empty; + const std::string &get_enclosing_field(const std::string &struct_field_name) const { + static const std::string empty; auto res = _struct_fields.find(struct_field_name); if (res == _struct_fields.end()) { return empty; diff --git a/searchlib/src/vespa/searchlib/common/packets.cpp b/searchlib/src/vespa/searchlib/common/packets.cpp index d9ad3393e98d..c74e47f1cf7b 100644 --- a/searchlib/src/vespa/searchlib/common/packets.cpp +++ b/searchlib/src/vespa/searchlib/common/packets.cpp @@ -91,10 +91,10 @@ FS4Properties::value(uint32_t entry) const noexcept { return {c_str(pair.first), pair.second}; } -vespalib::string +std::string FS4Properties::toString(uint32_t indent) const { - vespalib::string s; + std::string s; s += make_string("%*sProperties {\n", indent, ""); s += make_string("%*s name: ", indent, ""); s += _name; diff --git a/searchlib/src/vespa/searchlib/common/packets.h b/searchlib/src/vespa/searchlib/common/packets.h index 2e9627b7ea65..5c55e7057e71 100644 --- a/searchlib/src/vespa/searchlib/common/packets.h +++ b/searchlib/src/vespa/searchlib/common/packets.h @@ -2,17 +2,17 @@ #pragma once -#include #include #include -#include #include +#include +#include class FNET_DataBuffer; namespace search::fs4transport { -using vespalib::string; +using std::string; class FS4PersistentPacketStreamer { using CompressionConfig = vespalib::compression::CompressionConfig; @@ -44,8 +44,8 @@ class FS4Properties using KeyValueVector = std::vector; KeyValueVector _entries; - vespalib::string _name; - vespalib::string _backing; + std::string _name; + std::string _backing; const char * c_str(size_t sz) const { return _backing.c_str() + sz; } void set(StringRef & e, std::string_view s); void allocEntries(uint32_t cnt); @@ -70,7 +70,7 @@ class FS4Properties setValue(entry, val.data(), val.size()); } uint32_t size() const noexcept { return _entries.size(); } - const vespalib::string & name() const noexcept { return _name; } + const std::string & name() const noexcept { return _name; } std::string_view key(uint32_t entry) const noexcept; std::string_view value(uint32_t entry) const noexcept; @@ -79,7 +79,7 @@ class FS4Properties void encode(FNET_DataBuffer &dst); bool decode(FNET_DataBuffer &src, uint32_t &len); - vespalib::string toString(uint32_t indent = 0) const; + std::string toString(uint32_t indent = 0) const; }; } diff --git a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.cpp b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.cpp index 1cdb534ae2a6..f163413c11e5 100644 --- a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.cpp +++ b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.cpp @@ -18,7 +18,7 @@ SerialNumFileHeaderContext::SerialNumFileHeaderContext( void SerialNumFileHeaderContext::addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const + const std::string &name) const { _parentFileHeaderContext.addTags(header, name); using Tag = vespalib::GenericHeader::Tag; diff --git a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h index c2518aef595a..99f5148af428 100644 --- a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h +++ b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h @@ -16,7 +16,7 @@ class SerialNumFileHeaderContext : public FileHeaderContext parentFileHeaderContext, SerialNum serialNum); - void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; + void addTags(vespalib::GenericHeader &header, const std::string &name) const override; }; } diff --git a/searchlib/src/vespa/searchlib/common/sortresults.cpp b/searchlib/src/vespa/searchlib/common/sortresults.cpp index ff5700dfee31..a0b547da5ca3 100644 --- a/searchlib/src/vespa/searchlib/common/sortresults.cpp +++ b/searchlib/src/vespa/searchlib/common/sortresults.cpp @@ -306,7 +306,7 @@ FastS_SortSpec::~FastS_SortSpec() } bool -FastS_SortSpec::Init(const string & sortStr, IAttributeContext & vecMan) +FastS_SortSpec::Init(const std::string & sortStr, IAttributeContext & vecMan) { LOG(spam, "sortStr = %s", sortStr.c_str()); bool retval(true); diff --git a/searchlib/src/vespa/searchlib/common/sortresults.h b/searchlib/src/vespa/searchlib/common/sortresults.h index 8ba1929ed12d..0e56a90af71f 100644 --- a/searchlib/src/vespa/searchlib/common/sortresults.h +++ b/searchlib/src/vespa/searchlib/common/sortresults.h @@ -95,7 +95,7 @@ class FastS_SortSpec : public FastS_IResultSorter using BinarySortData = std::vector>; using SortDataArray = std::vector>; using ConverterFactory = search::common::ConverterFactory; - vespalib::string _documentmetastore; + std::string _documentmetastore; uint16_t _partitionId; vespalib::Doom _doom; const ConverterFactory & _ucaFactory; @@ -117,7 +117,7 @@ class FastS_SortSpec : public FastS_IResultSorter std::pair getSortRef(size_t i) const { return {(const char*)(&_binarySortData[0] + _sortDataArray[i]._idx), _sortDataArray[i]._len }; } - bool Init(const vespalib::string & sortSpec, search::attribute::IAttributeContext & vecMan); + bool Init(const std::string & sortSpec, search::attribute::IAttributeContext & vecMan); void sortResults(search::RankedHit a[], uint32_t n, uint32_t topn) override; uint32_t getSortDataSize(uint32_t offset, uint32_t n); void copySortData(uint32_t offset, uint32_t n, uint32_t *idx, char *buf); diff --git a/searchlib/src/vespa/searchlib/common/sortspec.cpp b/searchlib/src/vespa/searchlib/common/sortspec.cpp index 107eafe24606..e907ed6f7176 100644 --- a/searchlib/src/vespa/searchlib/common/sortspec.cpp +++ b/searchlib/src/vespa/searchlib/common/sortspec.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include namespace search::common { @@ -41,7 +42,7 @@ SortInfo::SortInfo(std::string_view field, bool ascending, BlobConverter::SP con { } SortInfo::~SortInfo() = default; -SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFactory) : +SortSpec::SortSpec(const std::string & spec, const ConverterFactory & ucaFactory) : _spec(spec) { for (const char *pt(spec.c_str()), *mt(spec.c_str() + spec.size()); pt < mt;) { @@ -50,7 +51,7 @@ SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFa bool ascending = (*pt++ == '+'); const char *vectorName = pt; for (;pt < mt && *pt != ' '; pt++); - vespalib::string funcSpec(vectorName, pt - vectorName); + std::string funcSpec(vectorName, pt - vectorName); const char * func = funcSpec.c_str(); const char *p = func; const char *e = func+funcSpec.size(); @@ -61,23 +62,23 @@ SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFa const char * attrName = p; for(; (p < e) && (*p != ','); p++); if (*p == ',') { - vespalib::string attr(attrName, p-attrName); + std::string attr(attrName, p-attrName); p++; const char *localeName = p; for(; (p < e) && (*p != ')') && (*p != ','); p++); if (*p == ',') { - vespalib::string locale(localeName, p-localeName); + std::string locale(localeName, p-localeName); p++; const char *strengthName = p; for(; (p < e) && (*p != ')'); p++); if (*p == ')') { - vespalib::string strength(strengthName, p - strengthName); + std::string strength(strengthName, p - strengthName); emplace_back(attr, ascending, ucaFactory.create(locale, strength)); } else { throw std::runtime_error(make_string("Missing ')' at %s attr=%s locale=%s strength=%s", p, attr.c_str(), localeName, strengthName)); } } else if (*p == ')') { - vespalib::string locale(localeName, p-localeName); + std::string locale(localeName, p-localeName); emplace_back(attr, ascending, ucaFactory.create(locale, "")); } else { throw std::runtime_error(make_string("Missing ')' or ',' at %s attr=%s locale=%s", p, attr.c_str(), localeName)); @@ -90,13 +91,13 @@ SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFa const char * attrName = p; for(; (p < e) && (*p != ')'); p++); if (*p == ')') { - vespalib::string attr(attrName, p-attrName); + std::string attr(attrName, p-attrName); emplace_back(attr, ascending, std::make_shared()); } else { throw std::runtime_error("Missing ')'"); } } else { - throw std::runtime_error("Unknown func " + vespalib::string(func, p-func)); + throw std::runtime_error("Unknown func " + std::string(func, p-func)); } } else { emplace_back(funcSpec, ascending, std::shared_ptr()); diff --git a/searchlib/src/vespa/searchlib/common/sortspec.h b/searchlib/src/vespa/searchlib/common/sortspec.h index 9c947809f34f..22d0d6212793 100644 --- a/searchlib/src/vespa/searchlib/common/sortspec.h +++ b/searchlib/src/vespa/searchlib/common/sortspec.h @@ -5,7 +5,7 @@ #include "converters.h" #include #include -#include +#include #include namespace search::common { @@ -13,7 +13,7 @@ namespace search::common { struct SortInfo { SortInfo(std::string_view field, bool ascending, BlobConverter::SP converter) noexcept; ~SortInfo(); - vespalib::string _field; + std::string _field; bool _ascending; BlobConverter::SP _converter; }; @@ -22,11 +22,11 @@ class SortSpec : public std::vector { public: SortSpec() : _spec() { } - SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFactory); + SortSpec(const std::string & spec, const ConverterFactory & ucaFactory); ~SortSpec(); - const vespalib::string & getSpec() const { return _spec; } + const std::string & getSpec() const { return _spec; } private: - vespalib::string _spec; + std::string _spec; }; } diff --git a/searchlib/src/vespa/searchlib/common/stringmap.h b/searchlib/src/vespa/searchlib/common/stringmap.h index 5e8437bab8d7..4a8d3e294d9b 100644 --- a/searchlib/src/vespa/searchlib/common/stringmap.h +++ b/searchlib/src/vespa/searchlib/common/stringmap.h @@ -5,6 +5,6 @@ namespace search { -using StringStringMap = vespalib::hash_map; +using StringStringMap = vespalib::hash_map; } diff --git a/searchlib/src/vespa/searchlib/common/unique_issues.h b/searchlib/src/vespa/searchlib/common/unique_issues.h index 6057ae754ed4..672029c3f31f 100644 --- a/searchlib/src/vespa/searchlib/common/unique_issues.h +++ b/searchlib/src/vespa/searchlib/common/unique_issues.h @@ -14,7 +14,7 @@ namespace search { class UniqueIssues : public vespalib::Issue::Handler { private: - std::set _messages; + std::set _messages; public: using UP = std::unique_ptr; void handle(const vespalib::Issue &issue) override; diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp index 5f001b20dda6..a4ffc56ccc3d 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp @@ -24,12 +24,12 @@ BitVectorDictionary::BitVectorDictionary() BitVectorDictionary::~BitVectorDictionary() = default; bool -BitVectorDictionary::open(const vespalib::string &pathPrefix, +BitVectorDictionary::open(const std::string &pathPrefix, const TuneFileRandRead &tuneFileRead, BitVectorKeyScope scope) { { - vespalib::string booloccIdxName = pathPrefix + "boolocc" + getBitVectorKeyScopeSuffix(scope); + std::string booloccIdxName = pathPrefix + "boolocc" + getBitVectorKeyScopeSuffix(scope); FastOS_File idxFile; idxFile.OpenReadOnly(booloccIdxName.c_str()); if (!idxFile.IsOpened()) { @@ -63,7 +63,7 @@ BitVectorDictionary::open(const vespalib::string &pathPrefix, } } - vespalib::string booloccDatName = pathPrefix + "boolocc.bdat"; + std::string booloccDatName = pathPrefix + "boolocc.bdat"; _datFile = std::make_unique(); _datFile->setFAdviseOptions(tuneFileRead.getAdvise()); diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h index 10f07d015f3b..9e4abdb7a4df 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace search::diskindex { @@ -43,7 +43,7 @@ class BitVectorDictionary * @return true if the files could be opened. **/ bool - open(const vespalib::string &pathPrefix, + open(const std::string &pathPrefix, const TuneFileRandRead &tuneFileRead, BitVectorKeyScope scope); diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp index 8c47e5c193e4..88e27ec5aafb 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp @@ -20,7 +20,7 @@ using namespace tags; namespace { void -readHeader(vespalib::FileHeader &h, const vespalib::string &name) +readHeader(vespalib::FileHeader &h, const std::string &name) { Fast_BufferedFile file(32_Ki); file.ReadOpenExisting(name.c_str()); @@ -39,11 +39,11 @@ BitVectorFileWrite::BitVectorFileWrite(BitVectorKeyScope scope) BitVectorFileWrite::~BitVectorFileWrite() = default; void -BitVectorFileWrite::open(const vespalib::string &name, uint32_t docIdLimit, +BitVectorFileWrite::open(const std::string &name, uint32_t docIdLimit, const TuneFileSeqWrite &tuneFileWrite, const FileHeaderContext &fileHeaderContext) { - vespalib::string datname = name + ".bdat"; + std::string datname = name + ".bdat"; assert( ! _datFile); diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h index af2c49f82e4e..5473e6bfd8be 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h @@ -5,8 +5,8 @@ #include "bitvectoridxfile.h" #include #include -#include #include +#include #include class Fast_BufferedFile; @@ -28,7 +28,7 @@ class BitVectorFileWrite : public BitVectorIdxFileWrite BitVectorFileWrite(BitVectorKeyScope scope); ~BitVectorFileWrite() override; - void open(const vespalib::string &name, uint32_t docIdLimit, + void open(const std::string &name, uint32_t docIdLimit, const TuneFileSeqWrite &tuneFileWrite, const common::FileHeaderContext &fileHeaderContext) override; diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp index cec3db35d608..8c30bc8988bd 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp @@ -19,7 +19,7 @@ using namespace tags; namespace { void -readHeader(vespalib::FileHeader &h, const vespalib::string &name) +readHeader(vespalib::FileHeader &h, const std::string &name) { Fast_BufferedFile file(32_Ki); file.ReadOpenExisting(name.c_str()); @@ -47,7 +47,7 @@ BitVectorIdxFileWrite::idxSize() const } void -BitVectorIdxFileWrite::open(const vespalib::string &name, uint32_t docIdLimit, +BitVectorIdxFileWrite::open(const std::string &name, uint32_t docIdLimit, const TuneFileSeqWrite &tuneFileWrite, const FileHeaderContext &fileHeaderContext) { @@ -56,7 +56,7 @@ BitVectorIdxFileWrite::open(const vespalib::string &name, uint32_t docIdLimit, } else { _docIdLimit = docIdLimit; } - vespalib::string idxname = name + getBitVectorKeyScopeSuffix(_scope); + std::string idxname = name + getBitVectorKeyScopeSuffix(_scope); assert( !_idxFile); _idxFile = std::make_unique(); diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.h b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.h index 9f1e5ce0f809..ea3955e378b7 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.h +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.h @@ -5,7 +5,7 @@ #include "bitvectorkeyscope.h" #include #include -#include +#include class Fast_BufferedFile; @@ -38,7 +38,7 @@ class BitVectorIdxFileWrite virtual ~BitVectorIdxFileWrite(); - virtual void open(const vespalib::string &name, uint32_t docIdLimit, + virtual void open(const std::string &name, uint32_t docIdLimit, const TuneFileSeqWrite &tuneFileWrite, const common::FileHeaderContext &fileHeaderContext); diff --git a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp index 19741b3b1668..2eb70a267630 100644 --- a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.cpp @@ -26,8 +26,8 @@ DictionaryWordReader::DictionaryWordReader() DictionaryWordReader::~DictionaryWordReader() = default; bool -DictionaryWordReader::open(const vespalib::string & dictionaryName, - const vespalib::string & wordMapName, +DictionaryWordReader::open(const std::string & dictionaryName, + const std::string & wordMapName, const TuneFileSeqRead &tuneFileRead) { _old2newwordfile = std::make_unique(); diff --git a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.h b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.h index b166c834eec3..559bd5597bab 100644 --- a/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.h +++ b/searchlib/src/vespa/searchlib/diskindex/dictionarywordreader.h @@ -13,7 +13,7 @@ namespace search::diskindex { class WordAggregator { private: - vespalib::string _word; + std::string _word; uint64_t _wordNum; public: @@ -41,7 +41,7 @@ class WordAggregator class DictionaryWordReader { public: - vespalib::string _word; + std::string _word; uint64_t _wordNum; index::PostingListCounts _counts; @@ -76,8 +76,8 @@ class DictionaryWordReader _dictFile->readWord(_word, _wordNum, _counts); } - bool open(const vespalib::string & dictionaryName, - const vespalib::string & wordMapName, + bool open(const std::string & dictionaryName, + const std::string & wordMapName, const TuneFileSeqRead &tuneFileRead); void close(); diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp index 0794b84c94e8..c57229e32b8a 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp @@ -46,7 +46,7 @@ DiskIndex::Key::Key(const Key &) = default; DiskIndex::Key & DiskIndex::Key::operator = (const Key &) = default; DiskIndex::Key::~Key() = default; -DiskIndex::DiskIndex(const vespalib::string &indexDir, size_t cacheSize) +DiskIndex::DiskIndex(const std::string &indexDir, size_t cacheSize) : _indexDir(indexDir), _cacheSize(cacheSize), _schema(), @@ -65,7 +65,7 @@ DiskIndex::~DiskIndex() = default; bool DiskIndex::loadSchema() { - vespalib::string schemaName = _indexDir + "/schema.txt"; + std::string schemaName = _indexDir + "/schema.txt"; if (!_schema.loadFromFile(schemaName)) { LOG(error, "Could not open schema '%s'", schemaName.c_str()); return false; @@ -81,7 +81,7 @@ bool DiskIndex::openDictionaries(const TuneFileSearch &tuneFileSearch) { for (SchemaUtil::IndexIterator itr(_schema); itr.isValid(); ++itr) { - vespalib::string dictName = _indexDir + "/" + itr.getName() + "/dictionary"; + std::string dictName = _indexDir + "/" + itr.getName() + "/dictionary"; auto dict = std::make_unique(); if (!dict->open(dictName, tuneFileSearch._read)) { LOG(warning, "Could not open disk dictionary '%s'", dictName.c_str()); @@ -94,10 +94,10 @@ DiskIndex::openDictionaries(const TuneFileSearch &tuneFileSearch) } bool -DiskIndex::openField(const vespalib::string &fieldDir, +DiskIndex::openField(const std::string &fieldDir, const TuneFileSearch &tuneFileSearch) { - vespalib::string postingName = fieldDir + "posocc.dat.compressed"; + std::string postingName = fieldDir + "posocc.dat.compressed"; DiskPostingFile::SP pFile; BitVectorDictionary::SP bDict; @@ -152,7 +152,7 @@ DiskIndex::setup(const TuneFileSearch &tuneFileSearch) return false; } for (SchemaUtil::IndexIterator itr(_schema); itr.isValid(); ++itr) { - vespalib::string fieldDir = _indexDir + "/" + itr.getName() + "/"; + std::string fieldDir = _indexDir + "/" + itr.getName() + "/"; if (!openField(fieldDir, tuneFileSearch)) { return false; } @@ -172,7 +172,7 @@ DiskIndex::setup(const TuneFileSearch &tuneFileSearch, const DiskIndex &old) } const Schema &oldSchema = old._schema; for (SchemaUtil::IndexIterator itr(_schema); itr.isValid(); ++itr) { - vespalib::string fieldDir = _indexDir + "/" + itr.getName() + "/"; + std::string fieldDir = _indexDir + "/" + itr.getName() + "/"; SchemaUtil::IndexSettings settings = itr.getIndexSettings(); if (settings.hasError()) { return false; @@ -333,7 +333,7 @@ class LookupCache { _cache() { } const DiskIndex::LookupResult & - lookup(const vespalib::string & word, uint32_t fieldId) { + lookup(const std::string & word, uint32_t fieldId) { auto it = _cache.find(word); if (it == _cache.end()) { _cache[word] = _diskIndex.lookup(_fieldIds, word); @@ -348,7 +348,7 @@ class LookupCache { } private: - using Cache = vespalib::hash_map; + using Cache = vespalib::hash_map; DiskIndex & _diskIndex; const std::vector & _fieldIds; Cache _cache; @@ -376,7 +376,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper { template void visitTerm(TermNode &n) { - const vespalib::string termStr = termAsString(n); + const std::string termStr = termAsString(n); const DiskIndex::LookupResult & lookupRes = _cache.lookup(termStr, _fieldId); if (lookupRes.valid()) { bool useBitVector = _field.isFilter(); @@ -457,7 +457,7 @@ DiskIndex::createBlueprint(const IRequestContext & requestContext, const FieldSp } FieldLengthInfo -DiskIndex::get_field_length_info(const vespalib::string& field_name) const +DiskIndex::get_field_length_info(const std::string& field_name) const { uint32_t fieldId = _schema.getIndexFieldId(field_name); if (fieldId != Schema::UNKNOWN_FIELD_ID) { diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.h b/searchlib/src/vespa/searchlib/diskindex/diskindex.h index 0c5a4231fc2e..9766fab9138d 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.h +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.h @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include namespace search::diskindex { @@ -60,9 +60,9 @@ class DiskIndex : public queryeval::Searchable { } void push_back(uint32_t indexId) { _indexes.push_back(indexId); } const IndexList & getIndexes() const noexcept { return _indexes; } - const vespalib::string & getWord() const noexcept { return _word; } + const std::string & getWord() const noexcept { return _word; } private: - vespalib::string _word; + std::string _word; IndexList _indexes; }; @@ -72,7 +72,7 @@ class DiskIndex : public queryeval::Searchable { using DiskPostingFileDynamicKReal = ZcPosOccRandRead; using Cache = vespalib::cache, DiskIndex>>; - vespalib::string _indexDir; + std::string _indexDir; size_t _cacheSize; index::Schema _schema; std::vector _postingFiles; @@ -85,7 +85,7 @@ class DiskIndex : public queryeval::Searchable { void calculateSize(); bool loadSchema(); bool openDictionaries(const TuneFileSearch &tuneFileSearch); - bool openField(const vespalib::string &fieldDir, const TuneFileSearch &tuneFileSearch); + bool openField(const std::string &fieldDir, const TuneFileSearch &tuneFileSearch); public: /** @@ -94,7 +94,7 @@ class DiskIndex : public queryeval::Searchable { * @param indexDir the directory where the disk index is located. * @param cacheSize optional size (in bytes) of the disk dictionary lookup cache. */ - explicit DiskIndex(const vespalib::string &indexDir, size_t cacheSize=0); + explicit DiskIndex(const std::string &indexDir, size_t cacheSize=0); ~DiskIndex() override; /** @@ -147,14 +147,14 @@ class DiskIndex : public queryeval::Searchable { uint64_t getSize() const { return _size; } const index::Schema &getSchema() const { return _schema; } - const vespalib::string &getIndexDir() const { return _indexDir; } + const std::string &getIndexDir() const { return _indexDir; } /** * Needed for the Cache::BackingStore interface. */ bool read(const Key & key, LookupResultVector & result); - index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const; + index::FieldLengthInfo get_field_length_info(const std::string& field_name) const; }; void swap(DiskIndex::LookupResult & a, DiskIndex::LookupResult & b); diff --git a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp index c30b02a0c37c..582349877726 100644 --- a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.cpp @@ -28,7 +28,7 @@ namespace search::diskindex { namespace { -vespalib::string +std::string getName(uint32_t indexId) { return vespalib::make_string("fieldId(%u)", indexId); @@ -38,7 +38,7 @@ getName(uint32_t indexId) DiskTermBlueprint::DiskTermBlueprint(const FieldSpec & field, const DiskIndex & diskIndex, - const vespalib::string& query_term, + const std::string& query_term, DiskIndex::LookupResult::UP lookupRes, bool useBitVector) : SimpleLeafBlueprint(field), diff --git a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h index abdecf29c454..cc2bb9c8b6aa 100644 --- a/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h +++ b/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h @@ -15,7 +15,7 @@ class DiskTermBlueprint : public queryeval::SimpleLeafBlueprint private: queryeval::FieldSpec _field; const DiskIndex & _diskIndex; - vespalib::string _query_term; + std::string _query_term; DiskIndex::LookupResult::UP _lookupRes; bool _useBitVector; bool _fetchPostingsDone; @@ -33,7 +33,7 @@ class DiskTermBlueprint : public queryeval::SimpleLeafBlueprint **/ DiskTermBlueprint(const queryeval::FieldSpec & field, const DiskIndex & diskIndex, - const vespalib::string& query_term, + const std::string& query_term, DiskIndex::LookupResult::UP lookupRes, bool useBitVector); diff --git a/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp b/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp index 1bd79166a510..4ca7c4672366 100644 --- a/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp @@ -43,7 +43,7 @@ DocIdMapping::setup(uint32_t docIdLimit, const SelectorArray *selector, uint8_t bool -DocIdMapping::readDocIdLimit(const vespalib::string &mergedDir) +DocIdMapping::readDocIdLimit(const std::string &mergedDir) { uint32_t docIdLimit = 0; if (!search::docsummary::DocumentSummary::readDocIdLimit(mergedDir, docIdLimit)) { diff --git a/searchlib/src/vespa/searchlib/diskindex/docidmapper.h b/searchlib/src/vespa/searchlib/diskindex/docidmapper.h index 09738edf1633..9463b18e7973 100644 --- a/searchlib/src/vespa/searchlib/diskindex/docidmapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/docidmapper.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace search { class BitVector; } @@ -22,7 +22,7 @@ class DocIdMapping void clear(); void setup(uint32_t docIdLimit); void setup(uint32_t docIdLimit, const SelectorArray *selector, uint8_t selectorId); - bool readDocIdLimit(const vespalib::string &dir); + bool readDocIdLimit(const std::string &dir); }; diff --git a/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp b/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp index 735dd038f751..357b7d6e7557 100644 --- a/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/extposocc.cpp @@ -24,7 +24,7 @@ using search::index::Schema; namespace { -vespalib::string PosOccIdCooked = "PosOcc.1.Cooked"; +std::string PosOccIdCooked = "PosOcc.1.Cooked"; } @@ -75,7 +75,7 @@ makePosOccWrite(PostingListCountFileSeqWrite *const posOccCountWrite, std::unique_ptr -makePosOccRead(const vespalib::string &name, +makePosOccRead(const std::string &name, PostingListCountFileSeqRead *const posOccCountRead, const PostingListParams &featureParams, const TuneFileSeqRead &tuneFileRead) diff --git a/searchlib/src/vespa/searchlib/diskindex/extposocc.h b/searchlib/src/vespa/searchlib/diskindex/extposocc.h index 3a764afe2f50..98a5ac98893c 100644 --- a/searchlib/src/vespa/searchlib/diskindex/extposocc.h +++ b/searchlib/src/vespa/searchlib/diskindex/extposocc.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search { class TuneFileSeqRead; @@ -39,7 +39,7 @@ makePosOccWrite(index::PostingListCountFileSeqWrite *const posOccCountWrite, const index::FieldLengthInfo &field_length_info); std::unique_ptr -makePosOccRead(const vespalib::string &name, +makePosOccRead(const std::string &name, index::PostingListCountFileSeqRead *const posOccCountRead, const index::PostingListParams &featureParams, const TuneFileSeqRead &tuneFileRead); diff --git a/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp b/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp index e4834b54b17a..2291c8b7bb09 100644 --- a/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/field_merger.cpp @@ -46,8 +46,8 @@ constexpr uint32_t merge_postings_heap_limit = 4; constexpr uint32_t merge_postings_merge_chunk = 50000; constexpr uint32_t scan_chunk = 80000; -vespalib::string -createTmpPath(const vespalib::string & base, uint32_t index) { +std::string +createTmpPath(const std::string & base, uint32_t index) { vespalib::asciistream os; os << base; os << "/tmpindex"; @@ -93,7 +93,7 @@ FieldMerger::clean_tmp_dirs() { uint32_t i = 0; for (;;) { - vespalib::string tmpindexpath = createTmpPath(_field_dir, i); + std::string tmpindexpath = createTmpPath(_field_dir, i); FastOS_StatInfo statInfo; if (!FastOS_File::Stat(tmpindexpath.c_str(), &statInfo)) { if (statInfo._error == FastOS_StatInfo::FileNotFound) { @@ -106,7 +106,7 @@ FieldMerger::clean_tmp_dirs() } while (i > 0) { i--; - vespalib::string tmpindexpath = createTmpPath(_field_dir, i); + std::string tmpindexpath = createTmpPath(_field_dir, i); std::error_code ec; std::filesystem::remove_all(std::filesystem::path(tmpindexpath), ec); if (ec) { @@ -125,11 +125,11 @@ FieldMerger::open_input_word_readers() SchemaUtil::IndexIterator index(_fusion_out_index.get_schema(), _id); for (auto & oi : _fusion_out_index.get_old_indexes()) { auto reader(std::make_unique()); - const vespalib::string &tmpindexpath = createTmpPath(_field_dir, oi.getIndex()); - const vespalib::string &oldindexpath = oi.getPath(); - vespalib::string wordMapName = tmpindexpath + "/old2new.dat"; - vespalib::string fieldDir(oldindexpath + "/" + _field_name); - vespalib::string dictName(fieldDir + "/dictionary"); + const std::string &tmpindexpath = createTmpPath(_field_dir, oi.getIndex()); + const std::string &oldindexpath = oi.getPath(); + std::string wordMapName = tmpindexpath + "/old2new.dat"; + std::string fieldDir(oldindexpath + "/" + _field_name); + std::string dictName(fieldDir + "/dictionary"); const Schema &oldSchema = oi.getSchema(); if (!index.hasOldFields(oldSchema)) { continue; // drop data @@ -169,7 +169,7 @@ FieldMerger::read_mapping_files() } // Open word mapping file - vespalib::string old2newname = createTmpPath(_field_dir, oi.getIndex()) + "/old2new.dat"; + std::string old2newname = createTmpPath(_field_dir, oi.getIndex()) + "/old2new.dat"; wordNumMapping.readMappingFile(old2newname, _fusion_out_index.get_tune_file_indexing()._read); } @@ -338,8 +338,8 @@ FieldMerger::select_cooked_or_raw_features(FieldReader& reader) bool cookedFormatOK = true; PostingListParams featureParams; PostingListParams outFeatureParams; - vespalib::string cookedFormat; - vespalib::string rawFormat; + std::string cookedFormat; + std::string rawFormat; if (!reader.isValid()) { return true; diff --git a/searchlib/src/vespa/searchlib/diskindex/field_merger.h b/searchlib/src/vespa/searchlib/diskindex/field_merger.h index e8f4c0f65345..71303d07479e 100644 --- a/searchlib/src/vespa/searchlib/diskindex/field_merger.h +++ b/searchlib/src/vespa/searchlib/diskindex/field_merger.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include #include namespace search { @@ -42,8 +42,8 @@ class FieldMerger }; const uint32_t _id; - const vespalib::string _field_name; - const vespalib::string _field_dir; + const std::string _field_name; + const std::string _field_dir; const FusionOutputIndex & _fusion_out_index; std::shared_ptr _flush_token; std::vector> _word_readers; diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldreader.cpp b/searchlib/src/vespa/searchlib/diskindex/fieldreader.cpp index 4decd6bf5b88..e8ee607764a3 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldreader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fieldreader.cpp @@ -14,8 +14,8 @@ LOG_SETUP(".diskindex.fieldreader"); namespace { -vespalib::string PosOccIdCooked = "PosOcc.3.Cooked"; -vespalib::string interleaved_features("interleaved_features"); +std::string PosOccIdCooked = "PosOcc.3.Cooked"; +std::string interleaved_features("interleaved_features"); uint16_t cap_u16(uint32_t val) { return std::min(val, static_cast(std::numeric_limits::max())); } @@ -120,10 +120,10 @@ FieldReader::setup(const WordNumMapping &wordNumMapping, bool -FieldReader::open(const vespalib::string &prefix, +FieldReader::open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead) { - vespalib::string name = prefix + "posocc.dat.compressed"; + std::string name = prefix + "posocc.dat.compressed"; if (!fs::exists(fs::path(name))) { LOG(error, "Compressed posocc file %s does not exist.", name.c_str()); @@ -133,7 +133,7 @@ FieldReader::open(const vespalib::string &prefix, _dictFile = std::make_unique(); PostingListParams featureParams; _oldposoccfile = makePosOccRead(name, _dictFile.get(), featureParams, tuneFileRead); - vespalib::string cname = prefix + "dictionary"; + std::string cname = prefix + "dictionary"; if (!_dictFile->open(cname, tuneFileRead)) { LOG(error, "Could not open posocc count file %s for read", cname.c_str()); @@ -226,7 +226,7 @@ FieldReaderEmpty::FieldReaderEmpty(const IndexIterator &index) bool -FieldReaderEmpty::open(const vespalib::string &prefix, +FieldReaderEmpty::open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead) { (void) prefix; @@ -268,7 +268,7 @@ FieldReaderStripInfo::allowRawFeatures() } bool -FieldReaderStripInfo::open(const vespalib::string &prefix, const TuneFileSeqRead &tuneFileRead) +FieldReaderStripInfo::open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead) { if (!FieldReader::open(prefix, tuneFileRead)) { return false; @@ -367,8 +367,8 @@ void FieldReaderStripInfo::getFeatureParams(PostingListParams ¶ms) { FieldReader::getFeatureParams(params); - vespalib::string paramsPrefix = PosOccFieldParams::getParamsPrefix(0); - vespalib::string collStr = paramsPrefix + ".collectionType"; + std::string paramsPrefix = PosOccFieldParams::getParamsPrefix(0); + std::string collStr = paramsPrefix + ".collectionType"; if (_hasElements) { if (_hasElementWeights) { params.setStr(collStr, "weightedSet"); diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldreader.h b/searchlib/src/vespa/searchlib/diskindex/fieldreader.h index 4192bc33f79b..27373c7b1fe1 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldreader.h +++ b/searchlib/src/vespa/searchlib/diskindex/fieldreader.h @@ -50,7 +50,7 @@ class FieldReader uint64_t _oldWordNum; uint32_t _residue; uint32_t _docIdLimit; - vespalib::string _word; + std::string _word; static uint64_t noWordNumHigh() { return std::numeric_limits::max(); @@ -91,7 +91,7 @@ class FieldReader } virtual void setup(const WordNumMapping &wordNumMapping, const DocIdMapping &docIdMapping); - virtual bool open(const vespalib::string &prefix, const TuneFileSeqRead &tuneFileRead); + virtual bool open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead); virtual bool close(); virtual void setFeatureParams(const PostingListParams ¶ms); virtual void getFeatureParams(PostingListParams ¶ms); @@ -113,7 +113,7 @@ class FieldReaderEmpty : public FieldReader public: FieldReaderEmpty(const IndexIterator &index); - bool open(const vespalib::string &prefix, const TuneFileSeqRead &tuneFileRead) override; + bool open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead) override; void getFeatureParams(PostingListParams ¶ms) override; }; @@ -134,7 +134,7 @@ class FieldReaderStripInfo : public FieldReader FieldReaderStripInfo(const IndexIterator &index, std::shared_ptr); bool allowRawFeatures() override; bool need_regenerate_interleaved_features_scan() override; - bool open(const vespalib::string &prefix, const TuneFileSeqRead &tuneFileRead) override; + bool open(const std::string &prefix, const TuneFileSeqRead &tuneFileRead) override; void read() override; void scan_element_lengths(uint32_t scan_chunk) override; void getFeatureParams(PostingListParams ¶ms) override; diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp index 4eb519b422da..b0bc55f554de 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp @@ -45,7 +45,7 @@ FieldWriter::open(uint32_t minSkipDocs, const TuneFileSeqWrite &tuneFileWrite, const FileHeaderContext &fileHeaderContext) { - vespalib::string name = _prefix + "posocc.dat.compressed"; + std::string name = _prefix + "posocc.dat.compressed"; PostingListParams params; PostingListParams featureParams; @@ -69,7 +69,7 @@ FieldWriter::open(uint32_t minSkipDocs, _dictFile->setParams(countParams); _posoccfile = makePosOccWrite(_dictFile.get(), dynamicKPosOccFormat, params, featureParams, schema, indexId, field_length_info); - vespalib::string cname = _prefix + "dictionary"; + std::string cname = _prefix + "dictionary"; // Open output dictionary file if (!_dictFile->open(cname, tuneFileWrite, fileHeaderContext)) { @@ -86,7 +86,7 @@ FieldWriter::open(uint32_t minSkipDocs, } // Open output boolocc.bdat file - vespalib::string booloccbidxname = _prefix + "boolocc"; + std::string booloccbidxname = _prefix + "boolocc"; _bmapfile.open(booloccbidxname.c_str(), _docIdLimit, tuneFileWrite, fileHeaderContext); return true; @@ -181,10 +181,10 @@ static const char *termOccNames[] = }; void -FieldWriter::remove(const vespalib::string &prefix) +FieldWriter::remove(const std::string &prefix) { for (const char **j = termOccNames; *j != nullptr; ++j) { - vespalib::string tmpName = prefix + *j; + std::string tmpName = prefix + *j; std::filesystem::remove(std::filesystem::path(tmpName)); } } diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h index fba06c64b24b..4c1df97497aa 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h +++ b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h @@ -55,7 +55,7 @@ class FieldWriter { bool close(); void getFeatureParams(PostingListParams ¶ms); - static void remove(const vespalib::string &prefix); + static void remove(const std::string &prefix); private: using DictionaryFileSeqWrite = index::DictionaryFileSeqWrite; using PostingListFileSeqWrite = index::PostingListFileSeqWrite; @@ -64,8 +64,8 @@ class FieldWriter { std::unique_ptr _posoccfile; BitVectorCandidate _bvc; BitVectorFileWrite _bmapfile; - const vespalib::string _prefix; - vespalib::string _word; + const std::string _prefix; + std::string _word; const uint64_t _numWordIds; uint64_t _compactWordNum; uint64_t _wordNum; diff --git a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp index 1e01cc118913..8e9107f2086d 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp @@ -29,7 +29,7 @@ FileHeader::FileHeader() FileHeader::~FileHeader() = default; bool -FileHeader::taste(const vespalib::string &name, +FileHeader::taste(const std::string &name, const TuneFileSeqRead &tuneFileRead) { vespalib::FileHeader header; @@ -66,7 +66,7 @@ FileHeader::taste(const vespalib::string &name, _headerLen = headerLen; _bigEndian = htonl(1) == 1; if (header.hasTag("endian")) { - vespalib::string endian(header.getTag("endian").asString()); + std::string endian(header.getTag("endian").asString()); if (endian == "big") { _bigEndian = true; } else if (endian == "little") { @@ -102,7 +102,7 @@ FileHeader::taste(const vespalib::string &name, for (uint32_t i = 0; ;++i) { vespalib::asciistream as; as << "format." << i; - vespalib::string key(as.str()); + std::string key(as.str()); if (!header.hasTag(key)) { break; } @@ -112,7 +112,7 @@ FileHeader::taste(const vespalib::string &name, } bool -FileHeader::taste(const vespalib::string &name, const TuneFileSeqWrite &tuneFileWrite) +FileHeader::taste(const std::string &name, const TuneFileSeqWrite &tuneFileWrite) { TuneFileSeqRead tuneFileRead; if (tuneFileWrite.getWantDirectIO()) { @@ -122,7 +122,7 @@ FileHeader::taste(const vespalib::string &name, const TuneFileSeqWrite &tuneFile } bool -FileHeader::taste(const vespalib::string &name, const TuneFileRandRead &tuneFileSearch) +FileHeader::taste(const std::string &name, const TuneFileRandRead &tuneFileSearch) { TuneFileSeqRead tuneFileRead; if (tuneFileSearch.getWantDirectIO()) { diff --git a/searchlib/src/vespa/searchlib/diskindex/fileheader.h b/searchlib/src/vespa/searchlib/diskindex/fileheader.h index 208d950a389b..2b464961f04b 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fileheader.h +++ b/searchlib/src/vespa/searchlib/diskindex/fileheader.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace search::diskindex { @@ -16,18 +16,18 @@ class FileHeader uint32_t _version; uint32_t _headerLen; uint64_t _fileBitSize; - std::vector _formats; + std::vector _formats; public: FileHeader(); ~FileHeader(); - bool taste(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead); - bool taste(const vespalib::string &name, const TuneFileSeqWrite &tuneFileWrite); - bool taste(const vespalib::string &name, const TuneFileRandRead &tuneFileSearch); + bool taste(const std::string &name, const TuneFileSeqRead &tuneFileRead); + bool taste(const std::string &name, const TuneFileSeqWrite &tuneFileWrite); + bool taste(const std::string &name, const TuneFileRandRead &tuneFileSearch); bool getBigEndian() const { return _bigEndian; } uint32_t getVersion() const { return _version; } - const std::vector &getFormats() const { return _formats; } + const std::vector &getFormats() const { return _formats; } }; } diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp index 95d139893a84..9b7b03cb4da4 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp @@ -31,7 +31,7 @@ namespace search::diskindex { namespace { std::vector -createInputIndexes(const std::vector & sources, const SelectorArray &selector) +createInputIndexes(const std::vector & sources, const SelectorArray &selector) { assert(sources.size() <= 255); // due to source selector data type std::vector indexes; @@ -43,7 +43,7 @@ createInputIndexes(const std::vector & sources, const Selector return indexes; } -uint32_t calc_trimmed_doc_id_limit(const SelectorArray& selector, const std::vector& sources) +uint32_t calc_trimmed_doc_id_limit(const SelectorArray& selector, const std::vector& sources) { uint32_t docIdLimit = selector.size(); uint32_t trimmed_doc_id_limit = docIdLimit; @@ -58,8 +58,8 @@ uint32_t calc_trimmed_doc_id_limit(const SelectorArray& selector, const std::vec } -Fusion::Fusion(const Schema& schema, const vespalib::string& dir, - const std::vector& sources, const SelectorArray& selector, +Fusion::Fusion(const Schema& schema, const std::string& dir, + const std::vector& sources, const SelectorArray& selector, const TuneFileIndexing& tuneFileIndexing, const FileHeaderContext& fileHeaderContext) : _old_indexes(createInputIndexes(sources, selector)), diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion.h b/searchlib/src/vespa/searchlib/diskindex/fusion.h index fb940026735d..f7f16272960c 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion.h +++ b/searchlib/src/vespa/searchlib/diskindex/fusion.h @@ -37,8 +37,8 @@ class Fusion public: Fusion(const Fusion &) = delete; Fusion& operator=(const Fusion &) = delete; - Fusion(const Schema& schema, const vespalib::string& dir, - const std::vector& sources, const SelectorArray& selector, + Fusion(const Schema& schema, const std::string& dir, + const std::vector& sources, const SelectorArray& selector, const TuneFileIndexing& tuneFileIndexing, const common::FileHeaderContext& fileHeaderContext); ~Fusion(); diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.cpp b/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.cpp index 5bf764f8fd75..fa354a1c1979 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.cpp @@ -11,7 +11,7 @@ using vespalib::make_string; namespace search::diskindex { -FusionInputIndex::FusionInputIndex(const vespalib::string& path, uint32_t index, const SelectorArray& selector) +FusionInputIndex::FusionInputIndex(const std::string& path, uint32_t index, const SelectorArray& selector) : _path(path), _index(index), _selector(&selector), @@ -25,7 +25,7 @@ FusionInputIndex::~FusionInputIndex() = default; void FusionInputIndex::setup() { - vespalib::string fname = _path + "/schema.txt"; + std::string fname = _path + "/schema.txt"; if ( ! _schema.loadFromFile(fname)) { throw IllegalArgumentException(make_string("Failed loading schema %s", fname.c_str())); } diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.h b/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.h index 0fb2e8262c4f..1de56ca7bc02 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.h +++ b/searchlib/src/vespa/searchlib/diskindex/fusion_input_index.h @@ -4,7 +4,7 @@ #include "docidmapper.h" #include -#include +#include namespace search::diskindex { @@ -14,20 +14,20 @@ namespace search::diskindex { class FusionInputIndex { private: - vespalib::string _path; + std::string _path; uint32_t _index; const SelectorArray* _selector; index::Schema _schema; DocIdMapping _docIdMapping; public: - FusionInputIndex(const vespalib::string& path, uint32_t index, const SelectorArray& selector); + FusionInputIndex(const std::string& path, uint32_t index, const SelectorArray& selector); FusionInputIndex(FusionInputIndex&&) = default; FusionInputIndex & operator = (FusionInputIndex&&) = default; ~FusionInputIndex(); void setup(); - const vespalib::string& getPath() const noexcept { return _path; } + const std::string& getPath() const noexcept { return _path; } uint32_t getIndex() const noexcept { return _index; } const DocIdMapping& getDocIdMapping() const noexcept { return _docIdMapping; } const index::Schema& getSchema() const noexcept { return _schema; } diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.cpp b/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.cpp index 9a5a231c9a4c..25e70e9f2bda 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.cpp @@ -5,7 +5,7 @@ namespace search::diskindex { -FusionOutputIndex::FusionOutputIndex(const index::Schema& schema, const vespalib::string& path, const std::vector& old_indexes, uint32_t doc_id_limit, const TuneFileIndexing& tune_file_indexing, const common::FileHeaderContext& file_header_context) +FusionOutputIndex::FusionOutputIndex(const index::Schema& schema, const std::string& path, const std::vector& old_indexes, uint32_t doc_id_limit, const TuneFileIndexing& tune_file_indexing, const common::FileHeaderContext& file_header_context) : _schema(schema), _path(path), _old_indexes(std::move(old_indexes)), diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.h b/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.h index dc355375e424..c101da8523d3 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.h +++ b/searchlib/src/vespa/searchlib/diskindex/fusion_output_index.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include #include namespace search { class TuneFileIndexing; } @@ -21,7 +22,7 @@ class FusionOutputIndex { private: const index::Schema& _schema; - const vespalib::string _path; + const std::string _path; const std::vector& _old_indexes; const uint32_t _doc_id_limit; bool _dynamic_k_pos_index_format; @@ -29,13 +30,13 @@ class FusionOutputIndex const TuneFileIndexing& _tune_file_indexing; const common::FileHeaderContext& _file_header_context; public: - FusionOutputIndex(const index::Schema& schema, const vespalib::string& path, const std::vector& old_indexes, uint32_t doc_id_limit, const TuneFileIndexing& tune_file_indexing, const common::FileHeaderContext& file_header_context); + FusionOutputIndex(const index::Schema& schema, const std::string& path, const std::vector& old_indexes, uint32_t doc_id_limit, const TuneFileIndexing& tune_file_indexing, const common::FileHeaderContext& file_header_context); ~FusionOutputIndex(); void set_dynamic_k_pos_index_format(bool dynamic_k_pos_index_format) { _dynamic_k_pos_index_format = dynamic_k_pos_index_format; } void set_force_small_merge_chunk(bool force_small_merge_chunk) { _force_small_merge_chunk = force_small_merge_chunk; } const index::Schema& get_schema() const noexcept { return _schema; } - const vespalib::string& get_path() const noexcept { return _path; } + const std::string& get_path() const noexcept { return _path; } const std::vector& get_old_indexes() const noexcept { return _old_indexes; } uint32_t get_doc_id_limit() const noexcept { return _doc_id_limit; } bool get_dynamic_k_pos_index_format() const noexcept { return _dynamic_k_pos_index_format; } diff --git a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp index a984e0d07741..db9a533c398c 100644 --- a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -66,8 +67,8 @@ class FieldHandle { void add_document(const index::DocIdAndFeatures &features); const Schema::IndexField &getSchemaField(); - const vespalib::string &getName(); - vespalib::string getDir(); + const std::string &getName(); + std::string getDir(); void close(); uint32_t getIndexId() const noexcept { return _fieldId; } }; @@ -83,7 +84,7 @@ class FieldIndexBuilder : public index::FieldIndexBuilder { void add_document(const DocIdAndFeatures &features) override; private: FieldHandle _field; - vespalib::string _curWord; + std::string _curWord; uint32_t _curDocId; bool _inWord; @@ -156,7 +157,7 @@ FileHandle::open(std::string_view dir, field_length_info, tuneFileWrite, fileHeaderContext)) { LOG(error, "Could not open term writer %s for write (%s)", - vespalib::string(dir).c_str(), getLastErrorString().c_str()); + std::string(dir).c_str(), getLastErrorString().c_str()); LOG_ABORT("should not be reached"); } } @@ -212,13 +213,13 @@ FieldHandle::getSchemaField() return _schema.getIndexField(_fieldId); } -const vespalib::string & +const std::string & FieldHandle::getName() { return getSchemaField().getName(); } -vespalib::string +std::string FieldHandle::getDir() { return _builder.appendToPrefix(getName()); @@ -262,7 +263,7 @@ IndexBuilder::IndexBuilder(const Schema &schema, std::string_view prefix, uint32 if (!_prefix.empty()) { std::filesystem::create_directory(std::filesystem::path(_prefix)); } - vespalib::string schemaFile = appendToPrefix("schema.txt"); + std::string schemaFile = appendToPrefix("schema.txt"); if (!_schema.saveToFile(schemaFile)) { LOG(error, "Cannot save schema to \"%s\"", schemaFile.c_str()); LOG_ABORT("should not be reached"); @@ -287,11 +288,11 @@ IndexBuilder::startField(uint32_t fieldId) { return {}; } -vespalib::string +std::string IndexBuilder::appendToPrefix(std::string_view name) const { if (_prefix.empty()) { - return vespalib::string(name); + return std::string(name); } return _prefix + "/" + name; } diff --git a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.h b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.h index e212ea2e0de2..d2acb930cb19 100644 --- a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.h +++ b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.h @@ -28,10 +28,10 @@ class IndexBuilder : public index::IndexBuilder { ~IndexBuilder() override; std::unique_ptr startField(uint32_t fieldId) override; - vespalib::string appendToPrefix(std::string_view name) const; + std::string appendToPrefix(std::string_view name) const; private: std::vector _fields; - const vespalib::string _prefix; + const std::string _prefix; const uint32_t _docIdLimit; const uint32_t _numWordIds; const index::IFieldLengthInspector &_field_length_inspector; diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp index 65a3a0c2f947..2b182ec087b7 100644 --- a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp @@ -13,12 +13,12 @@ LOG_SETUP(".diskindex.pagedict4file"); namespace { -vespalib::string myPId("PageDict4P.1"); -vespalib::string mySPId("PageDict4SP.1"); -vespalib::string mySSId("PageDict4SS.1"); +std::string myPId("PageDict4P.1"); +std::string mySPId("PageDict4SP.1"); +std::string mySSId("PageDict4SS.1"); void -assertOpenWriteOnly(bool ok, const vespalib::string &fileName) +assertOpenWriteOnly(bool ok, const std::string &fileName) { if (!ok) { int osError = errno; @@ -51,12 +51,12 @@ using vespalib::getLastErrorString; namespace search::diskindex { struct PageDict4FileSeqRead::DictFileReadContext { - DictFileReadContext(std::string_view id, const vespalib::string & name, const TuneFileSeqRead &tune, uint32_t mmap_file_size_threshold, bool read_all_upfront); + DictFileReadContext(std::string_view id, const std::string & name, const TuneFileSeqRead &tune, uint32_t mmap_file_size_threshold, bool read_all_upfront); ~DictFileReadContext(); vespalib::FileHeader readHeader(); void readExtendedHeader(); bool close(); - const vespalib::string _id; + const std::string _id; uint64_t _fileBitSize; uint32_t _headerLen; bool _valid; @@ -65,7 +65,7 @@ struct PageDict4FileSeqRead::DictFileReadContext { FastOS_File _file; }; -PageDict4FileSeqRead::DictFileReadContext::DictFileReadContext(std::string_view id, const vespalib::string & name, +PageDict4FileSeqRead::DictFileReadContext::DictFileReadContext(std::string_view id, const std::string & name, const TuneFileSeqRead &tune, uint32_t mmap_file_size_threshold, bool read_all_upfront) : _id(id), _fileBitSize(0u), @@ -168,7 +168,7 @@ PageDict4FileSeqRead::DictFileReadContext::readExtendedHeader() } void -PageDict4FileSeqRead::readWord(vespalib::string &word, uint64_t &wordNum, PostingListCounts &counts) +PageDict4FileSeqRead::readWord(std::string &word, uint64_t &wordNum, PostingListCounts &counts) { // Map to external ids and filter by what's present in the schema. uint64_t checkWordNum = 0; @@ -190,7 +190,7 @@ PageDict4FileSeqRead::DictFileReadContext::close() { } bool -PageDict4FileSeqRead::open(const vespalib::string &name, +PageDict4FileSeqRead::open(const std::string &name, const TuneFileSeqRead &tuneFileRead) { _ss = std::make_unique(mySSId, name + ".ssdat", tuneFileRead, _mmap_file_size_threshold, true); @@ -246,14 +246,14 @@ PageDict4FileSeqRead::getParams(PostingListParams ¶ms) struct PageDict4FileSeqWrite::DictFileContext { DictFileContext(bool extended, std::string_view id, std::string_view desc, - const vespalib::string &name, const TuneFileSeqWrite &tune); + const std::string &name, const TuneFileSeqWrite &tune); ~DictFileContext(); void makeHeader(const FileHeaderContext &fileHeaderContext); bool updateHeader(uint64_t fileBitSize, uint64_t wordNum); void writeExtendedHeader(vespalib::GenericHeader &header); bool close(); - const vespalib::string _id; - const vespalib::string _desc; + const std::string _id; + const std::string _desc; const bool _extended; uint32_t _headerLen; bool _valid; @@ -263,7 +263,7 @@ struct PageDict4FileSeqWrite::DictFileContext { }; PageDict4FileSeqWrite::DictFileContext::DictFileContext(bool extended, std::string_view id, std::string_view desc, - const vespalib::string & name, const TuneFileSeqWrite &tune) + const std::string & name, const TuneFileSeqWrite &tune) : _id(id), _desc(desc), _extended(extended), @@ -327,7 +327,7 @@ PageDict4FileSeqWrite::writeWord(std::string_view word, const PostingListCounts } bool -PageDict4FileSeqWrite::open(const vespalib::string &name, +PageDict4FileSeqWrite::open(const std::string &name, const TuneFileSeqWrite &tune, const FileHeaderContext &fileHeaderContext) { diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.h b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.h index 1b2af6458338..22db27c2e8e0 100644 --- a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.h +++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.h @@ -35,8 +35,8 @@ class PageDict4FileSeqRead : public index::DictionaryFileSeqRead * Read word and counts. Only nonzero counts are returned. If at * end of dictionary then noWordNumHigh() is returned as word number. */ - void readWord(vespalib::string &word, uint64_t &wordNum, PostingListCounts &counts) override; - bool open(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead) override; + void readWord(std::string &word, uint64_t &wordNum, PostingListCounts &counts) override; + bool open(const std::string &name, const TuneFileSeqRead &tuneFileRead) override; bool close() override; void getParams(index::PostingListParams ¶ms) override; void set_mmap_file_size_threshold(uint32_t v) { _mmap_file_size_threshold = v; } @@ -74,7 +74,7 @@ class PageDict4FileSeqWrite : public index::DictionaryFileSeqWrite * Open dictionary file for sequential write. The index with most * words should be first for optimal compression. */ - bool open(const vespalib::string &name, const TuneFileSeqWrite &tune, + bool open(const std::string &name, const TuneFileSeqWrite &tune, const FileHeaderContext &fileHeaderContext) override; bool close() override; diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp index 70fd0091e339..71754146965b 100644 --- a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp @@ -10,9 +10,9 @@ LOG_SETUP(".diskindex.pagedict4randread"); namespace { -vespalib::string myPId("PageDict4P.1"); -vespalib::string mySPId("PageDict4SP.1"); -vespalib::string mySSId("PageDict4SS.1"); +std::string myPId("PageDict4P.1"); +std::string mySPId("PageDict4SP.1"); +std::string mySSId("PageDict4SS.1"); } @@ -199,12 +199,12 @@ PageDict4RandRead::lookup(std::string_view word, bool -PageDict4RandRead::open(const vespalib::string &name, +PageDict4RandRead::open(const std::string &name, const TuneFileRandRead &tuneFileRead) { - vespalib::string pname = name + ".pdat"; - vespalib::string spname = name + ".spdat"; - vespalib::string ssname = name + ".ssdat"; + std::string pname = name + ".pdat"; + std::string spname = name + ".spdat"; + std::string ssname = name + ".ssdat"; int mmapFlags(tuneFileRead.getMemoryMapFlags()); _ssfile->enableMemoryMap(mmapFlags); diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.h b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.h index 4398d1ba7c2c..453b82df525b 100644 --- a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.h +++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.h @@ -48,7 +48,7 @@ class PageDict4RandRead : public index::DictionaryFileRandRead bool lookup(std::string_view word, uint64_t &wordNum, PostingListOffsetAndCounts &offsetAndCounts) override; - bool open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) override; + bool open(const std::string &name, const TuneFileRandRead &tuneFileRead) override; bool close() override; uint64_t getNumWordIds() const override; diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp index bda0a0594b70..ff79618c8224 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp @@ -14,7 +14,7 @@ WordNumMapping::WordNumMapping() void -WordNumMapping::readMappingFile(const vespalib::string &name, +WordNumMapping::readMappingFile(const std::string &name, const TuneFileSeqRead &tuneFileRead) { // Open word mapping file diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h index 03587319805c..0e21130e4f69 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h @@ -3,8 +3,8 @@ #include #include -#include #include +#include namespace search::diskindex { @@ -33,7 +33,7 @@ class WordNumMapping } uint64_t getOldDictSize() const { return _oldDictSize; } - void readMappingFile(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead); + void readMappingFile(const std::string &name, const TuneFileSeqRead &tuneFileRead); void noMappingFile(); void clear(); void setup(uint32_t numWordIds); diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposocc.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposocc.cpp index 2dc49130efb2..854d50dffddc 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposocc.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/zcposocc.cpp @@ -43,7 +43,7 @@ setFeatureParams(const PostingListParams ¶ms) } -const vespalib::string & +const std::string & Zc4PosOccSeqRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; @@ -100,7 +100,7 @@ setFeatureParams(const PostingListParams ¶ms) } -const vespalib::string & +const std::string & ZcPosOccSeqRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposocc.h b/searchlib/src/vespa/searchlib/diskindex/zcposocc.h index d8507bb075d8..f9fd9f18c92f 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposocc.h +++ b/searchlib/src/vespa/searchlib/diskindex/zcposocc.h @@ -18,7 +18,7 @@ class Zc4PosOccSeqRead : public Zc4PostingSeqRead public: Zc4PosOccSeqRead(index::PostingListCountFileSeqRead *countFile); void setFeatureParams(const PostingListParams ¶ms) override; - static const vespalib::string &getSubIdentifier(); + static const std::string &getSubIdentifier(); const index::FieldLengthInfo &get_field_length_info() const override; }; @@ -47,7 +47,7 @@ class ZcPosOccSeqRead : public Zc4PostingSeqRead public: ZcPosOccSeqRead(index::PostingListCountFileSeqRead *countFile); void setFeatureParams(const PostingListParams ¶ms) override; - static const vespalib::string &getSubIdentifier(); + static const std::string &getSubIdentifier(); const index::FieldLengthInfo &get_field_length_info() const override; }; diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp index 4ce4314cb849..567e5758bfab 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include LOG_SETUP(".diskindex.zcposoccrandread"); @@ -25,9 +26,9 @@ using search::ComprFileReadContext; namespace { -vespalib::string myId4("Zc.4"); -vespalib::string myId5("Zc.5"); -vespalib::string interleaved_features("interleaved_features"); +std::string myId4("Zc.4"); +std::string myId5("Zc.5"); +std::string interleaved_features("interleaved_features"); } @@ -153,7 +154,7 @@ ZcPosOccRandRead::readPostingList(const PostingListCounts &counts, bool ZcPosOccRandRead:: -open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) +open(const std::string &name, const TuneFileRandRead &tuneFileRead) { _file->setFAdviseOptions(tuneFileRead.getAdvise()); if (tuneFileRead.getWantMemoryMap()) { @@ -182,7 +183,7 @@ ZcPosOccRandRead::close() template void -ZcPosOccRandRead::readHeader(const vespalib::string &identifier) +ZcPosOccRandRead::readHeader(const std::string &identifier) { DecodeContext d(&_fieldsParams); ComprFileReadContext drc(d); @@ -232,14 +233,14 @@ ZcPosOccRandRead::readHeader() readHeader>(myId5); } -const vespalib::string & +const std::string & ZcPosOccRandRead::getIdentifier() { return myId5; } -const vespalib::string & +const std::string & ZcPosOccRandRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; @@ -267,13 +268,13 @@ Zc4PosOccRandRead::readHeader() readHeader >(myId4); } -const vespalib::string & +const std::string & Zc4PosOccRandRead::getIdentifier() { return myId4; } -const vespalib::string & +const std::string & Zc4PosOccRandRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.h b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.h index 2278cd69a836..a1e2fbaa895e 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.h +++ b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.h @@ -43,13 +43,13 @@ class ZcPosOccRandRead : public index::PostingListFileRandRead void readPostingList(const PostingListCounts &counts, uint32_t firstSegment, uint32_t numSegments, PostingListHandle &handle) override; - bool open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) override; + bool open(const std::string &name, const TuneFileRandRead &tuneFileRead) override; bool close() override; template - void readHeader(const vespalib::string &identifier); + void readHeader(const std::string &identifier); virtual void readHeader(); - static const vespalib::string &getIdentifier(); - static const vespalib::string &getSubIdentifier(); + static const std::string &getIdentifier(); + static const std::string &getSubIdentifier(); const index::FieldLengthInfo &get_field_length_info() const override; }; @@ -61,8 +61,8 @@ class Zc4PosOccRandRead : public ZcPosOccRandRead void readHeader() override; - static const vespalib::string &getIdentifier(); - static const vespalib::string &getSubIdentifier(); + static const std::string &getIdentifier(); + static const std::string &getSubIdentifier(); }; diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp index fba6a9001058..98259997bfbe 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp @@ -15,9 +15,9 @@ LOG_SETUP(".diskindex.zcposting"); namespace { -vespalib::string myId5("Zc.5"); -vespalib::string myId4("Zc.4"); -vespalib::string interleaved_features("interleaved_features"); +std::string myId5("Zc.5"); +std::string myId4("Zc.4"); +std::string interleaved_features("interleaved_features"); } @@ -64,7 +64,7 @@ Zc4PostingSeqRead::readCounts(const PostingListCounts &counts) bool -Zc4PostingSeqRead::open(const vespalib::string &name, +Zc4PostingSeqRead::open(const std::string &name, const TuneFileSeqRead &tuneFileRead) { if (tuneFileRead.getWantDirectIO()) { @@ -137,7 +137,7 @@ Zc4PostingSeqRead::readHeader() { FeatureDecodeContextBE &d = _reader.get_decode_features(); auto &posting_params = _reader.get_posting_params(); - const vespalib::string &myId = posting_params._dynamic_k ? myId5 : myId4; + const std::string &myId = posting_params._dynamic_k ? myId5 : myId4; vespalib::FileHeader header; d.readHeader(header, _file.getSize()); @@ -178,7 +178,7 @@ Zc4PostingSeqRead::readHeader() } -const vespalib::string & +const std::string & Zc4PostingSeqRead::getIdentifier(bool dynamic_k) { return (dynamic_k ? myId5 : myId4); @@ -225,7 +225,7 @@ Zc4PostingSeqWrite::makeHeader(const FileHeaderContext &fileHeaderContext) EncodeContext &e = _writer.get_encode_context(); ComprFileWriteContext &wce = _writer.get_write_context(); - const vespalib::string &myId = _writer.get_dynamic_k() ? myId5 : myId4; + const std::string &myId = _writer.get_dynamic_k() ? myId5 : myId4; vespalib::FileHeader header; using Tag = vespalib::GenericHeader::Tag; @@ -274,7 +274,7 @@ Zc4PostingSeqWrite::updateHeader() bool -Zc4PostingSeqWrite::open(const vespalib::string &name, +Zc4PostingSeqWrite::open(const std::string &name, const TuneFileSeqWrite &tuneFileWrite, const FileHeaderContext &fileHeaderContext) { diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposting.h b/searchlib/src/vespa/searchlib/diskindex/zcposting.h index c0132db83b51..2c2eca93fb66 100644 --- a/searchlib/src/vespa/searchlib/diskindex/zcposting.h +++ b/searchlib/src/vespa/searchlib/diskindex/zcposting.h @@ -38,12 +38,12 @@ class Zc4PostingSeqRead : public index::PostingListFileSeqRead void readDocIdAndFeatures(DocIdAndFeatures &features) override; void readCounts(const PostingListCounts &counts) override; // Fill in for next word - bool open(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead) override; + bool open(const std::string &name, const TuneFileSeqRead &tuneFileRead) override; bool close() override; void getParams(PostingListParams ¶ms) override; void getFeatureParams(PostingListParams ¶ms) override; void readHeader(); - static const vespalib::string &getIdentifier(bool dynamic_k); + static const std::string &getIdentifier(bool dynamic_k); }; @@ -75,7 +75,7 @@ class Zc4PostingSeqWrite : public index::PostingListFileSeqWrite void writeDocIdAndFeatures(const DocIdAndFeatures &features) override; void flushWord() override; - bool open(const vespalib::string &name, + bool open(const std::string &name, const TuneFileSeqWrite &tuneFileWrite, const search::common::FileHeaderContext &fileHeaderContext) override; diff --git a/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp b/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp index c22f35374a46..5c32fd29f8b7 100644 --- a/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp +++ b/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp @@ -13,7 +13,7 @@ using vespalib::compression::decompress; using vespalib::compression::computeMaxCompressedsize; using vespalib::compression::CompressionConfig; -ChunkException::ChunkException(const vespalib::string & msg, std::string_view location) : +ChunkException::ChunkException(const std::string & msg, std::string_view location) : Exception(make_string("Illegal chunk: %s", msg.c_str()), location) { } diff --git a/searchlib/src/vespa/searchlib/docstore/chunkformat.h b/searchlib/src/vespa/searchlib/docstore/chunkformat.h index 6eee91d702f5..b4dbc48568e5 100644 --- a/searchlib/src/vespa/searchlib/docstore/chunkformat.h +++ b/searchlib/src/vespa/searchlib/docstore/chunkformat.h @@ -12,7 +12,7 @@ namespace search { class ChunkException : public vespalib::Exception { public: - ChunkException(const vespalib::string & msg, std::string_view location); + ChunkException(const std::string & msg, std::string_view location); }; // This is an interface for implementing a chunk format diff --git a/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.cpp b/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.cpp index 74ad7d109125..d3c3ff06f2e5 100644 --- a/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.cpp +++ b/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.cpp @@ -5,8 +5,8 @@ namespace search { -vespalib::string -DataStoreFileChunkId::createName(const vespalib::string &baseName) const +std::string +DataStoreFileChunkId::createName(const std::string &baseName) const { FileChunk::NameId id(_nameId); return id.createName(baseName); diff --git a/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.h b/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.h index 86e10633a689..5b19971c50b5 100644 --- a/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.h +++ b/searchlib/src/vespa/searchlib/docstore/data_store_file_chunk_id.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search { @@ -19,7 +20,7 @@ class DataStoreFileChunkId { } uint64_t nameId() const { return _nameId; } - vespalib::string createName(const vespalib::string &baseName) const; + std::string createName(const std::string &baseName) const; bool operator<(const DataStoreFileChunkId &rhs) const { return _nameId < rhs._nameId; } diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.h b/searchlib/src/vespa/searchlib/docstore/documentstore.h index aa849371b6d4..52a875088823 100644 --- a/searchlib/src/vespa/searchlib/docstore/documentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/documentstore.h @@ -76,7 +76,7 @@ class DocumentStore : public IDocumentStore size_t getMaxSpreadAsBloat() const override { return _backingStore.getMaxSpreadAsBloat(); } vespalib::CacheStats getCacheStats() const override; size_t memoryMeta() const override { return _backingStore.memoryMeta(); } - const vespalib::string & getBaseDir() const override { return _backingStore.getBaseDir(); } + const std::string & getBaseDir() const override { return _backingStore.getBaseDir(); } void accept(IDocumentStoreReadVisitor &visitor, IDocumentStoreVisitorProgress &visitorProgress, const document::DocumentTypeRepo &repo) override; void accept(IDocumentStoreRewriteVisitor &visitor, IDocumentStoreVisitorProgress &visitorProgress, diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp index c57650bb16f3..7d4867a817be 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp @@ -29,7 +29,7 @@ namespace { constexpr size_t ALIGNMENT=0x1000; constexpr size_t ENTRY_BIAS_SIZE=8; -const vespalib::string DOC_ID_LIMIT_KEY("docIdLimit"); +const std::string DOC_ID_LIMIT_KEY("docIdLimit"); } @@ -43,24 +43,24 @@ FileChunk::ChunkInfo::ChunkInfo(uint64_t offset, uint32_t size, uint64_t lastSer assert(valid()); } -vespalib::string -FileChunk::NameId::createName(const vespalib::string &baseName) const { +std::string +FileChunk::NameId::createName(const std::string &baseName) const { vespalib::asciistream os; os << baseName << '/' << vespalib::setfill('0') << vespalib::setw(19) << getId(); return os.str(); } -vespalib::string -FileChunk::createIdxFileName(const vespalib::string & name) { +std::string +FileChunk::createIdxFileName(const std::string & name) { return name + ".idx"; } -vespalib::string -FileChunk::createDatFileName(const vespalib::string & name) { +std::string +FileChunk::createDatFileName(const std::string & name) { return name + ".dat"; } -FileChunk::FileChunk(FileId fileId, NameId nameId, const vespalib::string & baseName, +FileChunk::FileChunk(FileId fileId, NameId nameId, const std::string & baseName, const TuneFileSummary & tune, const IBucketizer * bucketizer) : _fileId(fileId), _nameId(nameId), @@ -509,9 +509,9 @@ FileChunk::getMemoryUsage() const } bool -FileChunk::isIdxFileEmpty(const vespalib::string & name) +FileChunk::isIdxFileEmpty(const std::string & name) { - vespalib::string fileName(name + ".idx"); + std::string fileName(name + ".idx"); FastOS_File idxFile(fileName.c_str()); idxFile.enableMemoryMap(0); if (idxFile.OpenReadOnly()) { @@ -531,16 +531,16 @@ FileChunk::isIdxFileEmpty(const vespalib::string & name) } void -FileChunk::eraseIdxFile(const vespalib::string & name) +FileChunk::eraseIdxFile(const std::string & name) { - vespalib::string fileName(createIdxFileName(name)); + std::string fileName(createIdxFileName(name)); std::filesystem::remove(std::filesystem::path(fileName)); } void -FileChunk::eraseDatFile(const vespalib::string & name) +FileChunk::eraseDatFile(const std::string & name) { - vespalib::string fileName(createDatFileName(name)); + std::string fileName(createDatFileName(name)); std::filesystem::remove(std::filesystem::path(fileName)); } diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h index 1668d0301410..1bf69a7369cb 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h @@ -77,7 +77,7 @@ class FileChunk public: explicit NameId(size_t id) noexcept : _id(id) { } uint64_t getId() const { return _id; } - vespalib::string createName(const vespalib::string &baseName) const; + std::string createName(const std::string &baseName) const; bool operator == (const NameId & rhs) const { return _id == rhs._id; } bool operator != (const NameId & rhs) const { return _id != rhs._id; } bool operator < (const NameId & rhs) const { return _id < rhs._id; } @@ -105,7 +105,7 @@ class FileChunk using LidBufferMap = vespalib::hash_map>; using UP = std::unique_ptr; using SubChunkId = uint32_t; - FileChunk(FileId fileId, NameId nameId, const vespalib::string &baseName, const TuneFileSummary &tune, + FileChunk(FileId fileId, NameId nameId, const std::string &baseName, const TuneFileSummary &tune, const IBucketizer *bucketizer); virtual ~FileChunk(); @@ -162,7 +162,7 @@ class FileChunk uint32_t getDocIdLimit() const { return _docIdLimit; } virtual vespalib::system_time getModificationTime() const; virtual bool frozen() const { return true; } - const vespalib::string & getName() const { return _name; } + const std::string & getName() const { return _name; } void appendTo(vespalib::Executor & executor, const IGetLid & db, IWriteData & dest, uint32_t numChunks, IFileChunkVisitorProgress *visitorProgress, vespalib::CpuUsage::Category cpu_category); @@ -194,11 +194,11 @@ class FileChunk */ static uint64_t readIdxHeader(FastOS_FileInterface &idxFile, uint32_t &docIdLimit); static uint64_t readDataHeader(FileRandRead &idxFile); - static bool isIdxFileEmpty(const vespalib::string & name); - static void eraseIdxFile(const vespalib::string & name); - static void eraseDatFile(const vespalib::string & name); - static vespalib::string createIdxFileName(const vespalib::string & name); - static vespalib::string createDatFileName(const vespalib::string & name); + static bool isIdxFileEmpty(const std::string & name); + static void eraseIdxFile(const std::string & name); + static void eraseDatFile(const std::string & name); + static std::string createIdxFileName(const std::string & name); + static std::string createDatFileName(const std::string & name); private: class TmpChunkMeta : public ChunkMeta, public std::vector @@ -213,7 +213,7 @@ class FileChunk using File = std::unique_ptr; const FileId _fileId; const NameId _nameId; - const vespalib::string _name; + const std::string _name; std::atomic _erasedCount; std::atomic _erasedBytes; std::atomic _diskFootprint; @@ -251,8 +251,8 @@ class FileChunk const IBucketizer * _bucketizer; std::atomic _addedBytes; TuneFileSummary _tune; - vespalib::string _dataFileName; - vespalib::string _idxFileName; + std::string _dataFileName; + std::string _idxFileName; ChunkInfoVector _chunkInfo; std::atomic _lastPersistedSerialNum; uint32_t _dataHeaderLen; diff --git a/searchlib/src/vespa/searchlib/docstore/idatastore.cpp b/searchlib/src/vespa/searchlib/docstore/idatastore.cpp index e14e56703a90..7a9539fd005b 100644 --- a/searchlib/src/vespa/searchlib/docstore/idatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/idatastore.cpp @@ -4,7 +4,7 @@ namespace search { -IDataStore::IDataStore(const vespalib::string& dirName) : +IDataStore::IDataStore(const std::string& dirName) : _docIdLimit(0), _dirName(dirName) { diff --git a/searchlib/src/vespa/searchlib/docstore/idatastore.h b/searchlib/src/vespa/searchlib/docstore/idatastore.h index 208797d7cb1f..688bd3892bc0 100644 --- a/searchlib/src/vespa/searchlib/docstore/idatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/idatastore.h @@ -4,10 +4,10 @@ #include "data_store_file_chunk_stats.h" #include -#include #include #include #include +#include #include namespace vespalib { class DataBuffer; } @@ -46,7 +46,7 @@ class IDataStore : public common::ICompactableLidSpace * * @param dirName The directory that will contain the data file. **/ - IDataStore(const vespalib::string & dirName); + IDataStore(const std::string & dirName); ~IDataStore() override; /** @@ -178,7 +178,7 @@ class IDataStore : public common::ICompactableLidSpace /** * Returns the name of the base directory where the data file is stored. **/ - const vespalib::string & getBaseDir() const { return _dirName; } + const std::string & getBaseDir() const { return _dirName; } protected: void setDocIdLimit(uint32_t docIdLimit) { @@ -192,7 +192,7 @@ class IDataStore : public common::ICompactableLidSpace private: std::atomic _docIdLimit; - vespalib::string _dirName; + std::string _dirName; }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h index bdb815d6acf5..80f67076c735 100644 --- a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h @@ -169,7 +169,7 @@ class IDocumentStore : public common::ICompactableLidSpace /** * Returns the base directory from which all structures are stored. **/ - virtual const vespalib::string & getBaseDir() const = 0; + virtual const std::string & getBaseDir() const = 0; /** * Visit all documents found in document store. diff --git a/searchlib/src/vespa/searchlib/docstore/liddatastore.h b/searchlib/src/vespa/searchlib/docstore/liddatastore.h index b87987c95c25..5ae0bfadd8bd 100644 --- a/searchlib/src/vespa/searchlib/docstore/liddatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/liddatastore.h @@ -18,7 +18,7 @@ class LidDataStore : public IDataStore * * @param dirName The directory that will contain the data file. **/ - LidDataStore(const vespalib::string & dirName) : IDataStore(dirName), _lastSyncToken(0) { } + LidDataStore(const std::string & dirName) : IDataStore(dirName), _lastSyncToken(0) { } /** diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index 45028e124f1f..4a391fdd5380 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -60,7 +60,7 @@ LogDataStore::Config::operator == (const Config & rhs) const { (_fileConfig == rhs._fileConfig); } -LogDataStore::LogDataStore(vespalib::Executor &executor, const vespalib::string &dirName, const Config &config, +LogDataStore::LogDataStore(vespalib::Executor &executor, const std::string &dirName, const Config &config, const GrowStrategy &growStrategy, const TuneFileSummary &tune, const FileHeaderContext &fileHeaderContext, transactionlog::SyncProxy &tlSyncer, IBucketizer::SP bucketizer, bool readOnly) @@ -294,7 +294,7 @@ LogDataStore::remove(uint64_t serialNum, uint32_t lid) namespace { -vespalib::string bloatMsg(size_t bloat, size_t usage) { +std::string bloatMsg(size_t bloat, size_t usage) { return make_string("Disk bloat is now at %ld of %ld at %2.2f percent", bloat, usage, (bloat*100.0)/usage); } @@ -620,16 +620,16 @@ LogDataStore::getDiskBloat() const return sz; } -vespalib::string +std::string LogDataStore::createFileName(NameId id) const { return id.createName(getBaseDir()); } -vespalib::string +std::string LogDataStore::createDatFileName(NameId id) const { return FileChunk::createDatFileName(id.createName(getBaseDir())); } -vespalib::string +std::string LogDataStore::createIdxFileName(NameId id) const { return FileChunk::createIdxFileName(id.createName(getBaseDir())); } @@ -668,8 +668,8 @@ LogDataStore::createWritableFile(FileId fileId, SerialNum serialNum) namespace { -vespalib::string -lsSingleFile(const vespalib::string & fileName) +std::string +lsSingleFile(const std::string & fileName) { fs::path path(fileName); return make_string("%s %20" PRIu64 " %12" PRIdMAX, fileName.c_str(), vespalib::count_ns(fs::last_write_time(path).time_since_epoch()), fs::file_size(path)); @@ -677,10 +677,10 @@ lsSingleFile(const vespalib::string & fileName) } -vespalib::string +std::string LogDataStore::ls(const NameIdSet & partList) { - vespalib::string s; + std::string s; for (auto it(++partList.begin()), mt(partList.end()); it != mt; ++it) { s += lsSingleFile(createDatFileName(*it)); s += "\n"; @@ -690,7 +690,7 @@ LogDataStore::ls(const NameIdSet & partList) } static bool -hasNonHeaderData(const vespalib::string &name) +hasNonHeaderData(const std::string &name) { FastOS_File file(name.c_str()); if (!file.OpenReadOnly()) @@ -722,13 +722,13 @@ void LogDataStore::verifyModificationTime(const NameIdSet & partList) { NameId nameId(*partList.begin()); - vespalib::string datName(createDatFileName(nameId)); - vespalib::string idxName(createIdxFileName(nameId)); + std::string datName(createDatFileName(nameId)); + std::string idxName(createIdxFileName(nameId)); vespalib::file_time prevDatTime = fs::last_write_time(fs::path(datName)); vespalib::file_time prevIdxTime = fs::last_write_time(fs::path(idxName)); for (auto it(++partList.begin()), mt(partList.end()); it != mt; ++it) { - vespalib::string prevDatNam(datName); - vespalib::string prevIdxNam(idxName); + std::string prevDatNam(datName); + std::string prevIdxNam(idxName); nameId = *it; datName = createDatFileName(nameId); idxName = createIdxFileName(nameId); @@ -797,7 +797,7 @@ LogDataStore::eraseEmptyIdxFiles(NameIdSet partList) { NameIdSet nonEmptyIdxPartList; for (const auto & part : partList) { - vespalib::string name(createFileName(part)); + std::string name(createFileName(part)); if (FileChunk::isIdxFileEmpty(name)) { LOG(warning, "We detected an empty idx file for part '%s'. Erasing it.", name.c_str()); FileChunk::eraseIdxFile(name); @@ -845,7 +845,7 @@ LogDataStore::eraseIncompleteCompactedFiles(NameIdSet partList) NameIdSet toRemove = findIncompleteCompactedFiles(partList); for (NameId toBeRemoved : toRemove) { partList.erase(toBeRemoved); - vespalib::string name(createFileName(toBeRemoved)); + std::string name(createFileName(toBeRemoved)); LOG(warning, "'%s' has been detected as an incompletely compacted file. Erasing it.", name.c_str()); FileChunk::eraseIdxFile(name); FileChunk::eraseDatFile(name); @@ -876,11 +876,11 @@ LogDataStore::eraseDanglingDatFiles(const NameIdSet &partList, const NameIdSet & NameId ibase(ii == iie ? endMarker : *ii); NameId dbase(di == die ? endMarker : *di); if (ibase < dbase) { - vespalib::string name(createFileName(ibase)); + std::string name(createFileName(ibase)); const char *s = name.c_str(); throw runtime_error(make_string( "Missing file '%s.dat', found '%s.idx'", s, s)); } else if (dbase < ibase) { - vespalib::string fileName = createFileName(dbase); + std::string fileName = createFileName(dbase); LOG(warning, "Removing dangling file '%s'", FileChunk::createDatFileName(fileName).c_str()); FileChunk::eraseDatFile(fileName); ++di; @@ -892,22 +892,22 @@ LogDataStore::eraseDanglingDatFiles(const NameIdSet &partList, const NameIdSet & } LogDataStore::NameIdSet -LogDataStore::scanDir(const vespalib::string &dir, const vespalib::string &suffix) +LogDataStore::scanDir(const std::string &dir, const std::string &suffix) { NameIdSet baseFiles; std::filesystem::directory_iterator dir_scan{std::filesystem::path(dir)}; for (auto& entry : dir_scan) { if (entry.is_regular_file()) { - vespalib::string file(entry.path().filename().string()); + std::string file(entry.path().filename().string()); if (file.size() > suffix.size() && file.find(suffix.c_str()) == file.size() - suffix.size()) { - vespalib::string base(file.substr(0, file.find(suffix.c_str()))); + std::string base(file.substr(0, file.find(suffix.c_str()))); char *err(nullptr); errno = 0; NameId baseId(strtoul(base.c_str(), &err, 10)); if ((errno == 0) && (err[0] == '\0')) { - vespalib::string tmpFull = createFileName(baseId); - vespalib::string tmp = tmpFull.substr(tmpFull.rfind('/') + 1); + std::string tmpFull = createFileName(baseId); + std::string tmp = tmpFull.substr(tmpFull.rfind('/') + 1); assert(tmp == base); baseFiles.insert(baseId); } else { diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.h b/searchlib/src/vespa/searchlib/docstore/logdatastore.h index 97050d72cd7e..55dfbb16290d 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.h @@ -87,7 +87,7 @@ class LogDataStore : public IDataStore, public ISetLid, public IGetLid * The caller must keep it alive for the semantic * lifetime of the log data store. */ - LogDataStore(vespalib::Executor &executor, const vespalib::string &dirName, const Config & config, + LogDataStore(vespalib::Executor &executor, const std::string &dirName, const Config & config, const GrowStrategy &growStrategy, const TuneFileSummary &tune, const search::common::FileHeaderContext &fileHeaderContext, transactionlog::SyncProxy &tlSyncer, IBucketizer::SP bucketizer, bool readOnly = false); @@ -200,10 +200,10 @@ class LogDataStore : public IDataStore, public ISetLid, public IGetLid NameIdSet eraseIncompleteCompactedFiles(NameIdSet partList); void internalFlushAll(); - NameIdSet scanDir(const vespalib::string &dir, const vespalib::string &suffix); + NameIdSet scanDir(const std::string &dir, const std::string &suffix); FileId allocateFileId(const MonitorGuard & guard); void setNewFileChunk(const MonitorGuard & guard, FileChunk::UP fileChunk); - vespalib::string ls(const NameIdSet & partList); + std::string ls(const NameIdSet & partList); WriteableFileChunk & getActive(const MonitorGuard & guard); const WriteableFileChunk & getActive(const MonitorGuard & guard) const; @@ -215,9 +215,9 @@ class LogDataStore : public IDataStore, public ISetLid, public IGetLid FileChunk::UP createReadOnlyFile(FileId fileId, NameId nameId); FileChunk::UP createWritableFile(FileId fileId, SerialNum serialNum); FileChunk::UP createWritableFile(FileId fileId, SerialNum serialNum, NameId nameId); - vespalib::string createFileName(NameId id) const; - vespalib::string createDatFileName(NameId id) const; - vespalib::string createIdxFileName(NameId id) const; + std::string createFileName(NameId id) const; + std::string createDatFileName(NameId id) const; + std::string createIdxFileName(NameId id) const; void requireSpace(MonitorGuard guard, WriteableFileChunk & active, vespalib::CpuUsage::Category cpu_category); bool isReadOnly() const { return _readOnly; } diff --git a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp index e3f1f9e4b348..e416e01e0b0d 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp @@ -14,7 +14,7 @@ LogDocumentStore::Config::operator == (const Config & rhs) const { } LogDocumentStore::LogDocumentStore(vespalib::Executor & executor, - const vespalib::string & baseDir, + const std::string & baseDir, const Config & config, const GrowStrategy & growStrategy, const TuneFileSummary & tuneFileSummary, diff --git a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h index c53cdea0eb2a..2e8f660007f7 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h @@ -43,7 +43,7 @@ class LogDocumentStore : public DocumentStore * The caller must keep it alive for the semantic * lifetime of the log data store. */ - LogDocumentStore(vespalib::Executor & executor, const vespalib::string & baseDir, const Config & config, + LogDocumentStore(vespalib::Executor & executor, const std::string & baseDir, const Config & config, const GrowStrategy & growStrategy, const TuneFileSummary &tuneFileSummary, const common::FileHeaderContext &fileHeaderContext, transactionlog::SyncProxy &tlSyncer, IBucketizer::SP bucketizer); diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp index b68d27e731d6..5d1581106452 100644 --- a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp +++ b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp @@ -10,7 +10,7 @@ LOG_SETUP(".search.docstore.randreaders"); namespace search { -DirectIORandRead::DirectIORandRead(const vespalib::string & fileName) +DirectIORandRead::DirectIORandRead(const std::string & fileName) : _file(std::make_unique(fileName.c_str())), _alignment(1), _granularity(1), @@ -54,7 +54,7 @@ DirectIORandRead::getSize() const { } -MMapRandRead::MMapRandRead(const vespalib::string & fileName, int mmapFlags, int fadviseOptions) +MMapRandRead::MMapRandRead(const std::string & fileName, int mmapFlags, int fadviseOptions) : _file(std::make_unique(fileName.c_str())) { _file->enableMemoryMap(mmapFlags); @@ -65,7 +65,7 @@ MMapRandRead::MMapRandRead(const vespalib::string & fileName, int mmapFlags, int } -NormalRandRead::NormalRandRead(const vespalib::string & fileName) +NormalRandRead::NormalRandRead(const std::string & fileName) : _file(std::make_unique(fileName.c_str())) { if ( ! _file->OpenReadOnly()) { @@ -93,7 +93,7 @@ MMapRandRead::getMapping() { return _file->MemoryMapPtr(0); } -MMapRandReadDynamic::MMapRandReadDynamic(const vespalib::string &fileName, int mmapFlags, int fadviseOptions) +MMapRandReadDynamic::MMapRandReadDynamic(const std::string &fileName, int mmapFlags, int fadviseOptions) : _fileName(fileName), _holder(), _mmapFlags(mmapFlags), diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.h b/searchlib/src/vespa/searchlib/docstore/randreaders.h index 69895ba7e010..97e40a6f1f7b 100644 --- a/searchlib/src/vespa/searchlib/docstore/randreaders.h +++ b/searchlib/src/vespa/searchlib/docstore/randreaders.h @@ -4,7 +4,7 @@ #include "randread.h" #include -#include +#include class FastOS_FileInterface; @@ -13,7 +13,7 @@ namespace search { class DirectIORandRead : public FileRandRead { public: - DirectIORandRead(const vespalib::string & fileName); + DirectIORandRead(const std::string & fileName); FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override; int64_t getSize() const override; private: @@ -26,7 +26,7 @@ class DirectIORandRead : public FileRandRead class MMapRandRead : public FileRandRead { public: - MMapRandRead(const vespalib::string & fileName, int mmapFlags, int fadviseOptions); + MMapRandRead(const std::string & fileName, int mmapFlags, int fadviseOptions); FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override; int64_t getSize() const override; const void * getMapping(); @@ -37,13 +37,13 @@ class MMapRandRead : public FileRandRead class MMapRandReadDynamic : public FileRandRead { public: - MMapRandReadDynamic(const vespalib::string & fileName, int mmapFlags, int fadviseOptions); + MMapRandReadDynamic(const std::string & fileName, int mmapFlags, int fadviseOptions); FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override; int64_t getSize() const override; private: static bool contains(const FastOS_FileInterface & file, size_t sz); void remap(size_t end); - vespalib::string _fileName; + std::string _fileName; vespalib::PtrHolder _holder; int _mmapFlags; int _fadviseOptions; @@ -53,7 +53,7 @@ class MMapRandReadDynamic : public FileRandRead class NormalRandRead : public FileRandRead { public: - NormalRandRead(const vespalib::string & fileName); + NormalRandRead(const std::string & fileName); FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override; int64_t getSize() const override; private: diff --git a/searchlib/src/vespa/searchlib/docstore/summaryexceptions.cpp b/searchlib/src/vespa/searchlib/docstore/summaryexceptions.cpp index c8119ada5a41..9c6b671ab0f4 100644 --- a/searchlib/src/vespa/searchlib/docstore/summaryexceptions.cpp +++ b/searchlib/src/vespa/searchlib/docstore/summaryexceptions.cpp @@ -12,7 +12,7 @@ SummaryException::SummaryException(std::string_view msg, FastOS_FileInterface &file, std::string_view location) : IoException(make_string("%s : Failing file = '%s'. Reason given by OS = '%s'", - vespalib::string(msg).c_str(), file.GetFileName(), file.getLastErrorString().c_str()), + std::string(msg).c_str(), file.GetFileName(), file.getLastErrorString().c_str()), getErrorType(file.GetLastError()), location) { } diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp index 297b8f660992..093b4f95d667 100644 --- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp @@ -75,7 +75,7 @@ class ProcessedChunk WriteableFileChunk:: WriteableFileChunk(vespalib::Executor &executor, FileId fileId, NameId nameId, - const vespalib::string &baseName, + const std::string &baseName, uint64_t initialSerialNum, uint32_t docIdLimit, const Config &config, diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h index 49cdf6ae3ff0..6dc33540cce2 100644 --- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h @@ -43,7 +43,7 @@ class WriteableFileChunk : public FileChunk public: using UP = std::unique_ptr; WriteableFileChunk(vespalib::Executor & executor, FileId fileId, NameId nameId, - const vespalib::string & baseName, uint64_t initialSerialNum, + const std::string & baseName, uint64_t initialSerialNum, uint32_t docIdLimit, const Config & config, const TuneFileSummary &tune, const common::FileHeaderContext &fileHeaderContext, const IBucketizer * bucketizer); diff --git a/searchlib/src/vespa/searchlib/engine/docsumrequest.h b/searchlib/src/vespa/searchlib/engine/docsumrequest.h index 447bb390816b..bbaee6d7b144 100644 --- a/searchlib/src/vespa/searchlib/engine/docsumrequest.h +++ b/searchlib/src/vespa/searchlib/engine/docsumrequest.h @@ -15,7 +15,7 @@ class DocsumRequest : public Request using UP = std::unique_ptr; using SP = std::shared_ptr; using Source = LazySource; - using FieldList = std::vector; + using FieldList = std::vector; class Hit { public: @@ -26,7 +26,7 @@ class DocsumRequest : public Request mutable uint32_t docid; // converted in backend }; - vespalib::string resultClassName; + std::string resultClassName; std::vector hits; DocsumRequest(); diff --git a/searchlib/src/vespa/searchlib/engine/propertiesmap.cpp b/searchlib/src/vespa/searchlib/engine/propertiesmap.cpp index abc0b272d2a4..4ad9c207d475 100644 --- a/searchlib/src/vespa/searchlib/engine/propertiesmap.cpp +++ b/searchlib/src/vespa/searchlib/engine/propertiesmap.cpp @@ -20,7 +20,7 @@ PropertiesMap::~PropertiesMap() = default; fef::Properties & PropertiesMap::lookupCreate(std::string_view name) { - return _propertiesMap[vespalib::string(name)]; + return _propertiesMap[std::string(name)]; } const fef::Properties & @@ -35,5 +35,5 @@ PropertiesMap::lookup(std::string_view name) const } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, search::fef::Properties); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, search::fef::Properties); diff --git a/searchlib/src/vespa/searchlib/engine/propertiesmap.h b/searchlib/src/vespa/searchlib/engine/propertiesmap.h index 922b0915ef09..5b50f888c00d 100644 --- a/searchlib/src/vespa/searchlib/engine/propertiesmap.h +++ b/searchlib/src/vespa/searchlib/engine/propertiesmap.h @@ -15,7 +15,7 @@ class PropertiesMap { private: using Props = search::fef::Properties; - using PropsMap = vespalib::hash_map; + using PropsMap = vespalib::hash_map; static Props _emptyProperties; PropsMap _propertiesMap; diff --git a/searchlib/src/vespa/searchlib/engine/proto_converter.cpp b/searchlib/src/vespa/searchlib/engine/proto_converter.cpp index b21de31eab0b..519b4f7785ee 100644 --- a/searchlib/src/vespa/searchlib/engine/proto_converter.cpp +++ b/searchlib/src/vespa/searchlib/engine/proto_converter.cpp @@ -15,7 +15,7 @@ namespace search::engine { namespace { -std::string escape_message(const vespalib::string &item) { +std::string escape_message(const std::string &item) { static const char hexdigits[] = "0123456789ABCDEF"; std::string r; r.reserve(item.size()); @@ -36,8 +36,8 @@ std::string escape_message(const vespalib::string &item) { } template -vespalib::string make_sort_spec(const T &sorting) { - vespalib::string spec; +std::string make_sort_spec(const T &sorting) { + std::string spec; for (const auto &field_spec: sorting) { if (!spec.empty()) { spec.push_back(' '); @@ -183,7 +183,7 @@ ProtoConverter::search_reply_to_proto(const SearchReply &reply, ProtoSearchReply const auto &slime_trace = reply.propertiesMap.trace().lookup("slime"); proto.set_slime_trace(slime_trace.get().data(), slime_trace.get().size()); if (reply.my_issues) { - reply.my_issues->for_each_message([&](const vespalib::string &err_msg) + reply.my_issues->for_each_message([&](const std::string &err_msg) { auto *err_obj = proto.add_errors(); err_obj->set_message(escape_message(err_msg)); @@ -240,7 +240,7 @@ ProtoConverter::docsum_reply_to_proto(const DocsumReply &reply, ProtoDocsumReply proto.set_slime_summaries(buf.obtain().data, buf.obtain().size); } if (reply.hasIssues()) { - reply.issues().for_each_message([&](const vespalib::string &err_msg) + reply.issues().for_each_message([&](const std::string &err_msg) { auto *err_obj = proto.add_errors(); err_obj->set_message(escape_message(err_msg)); diff --git a/searchlib/src/vespa/searchlib/engine/request.h b/searchlib/src/vespa/searchlib/engine/request.h index b11353196821..7edb58a871db 100644 --- a/searchlib/src/vespa/searchlib/engine/request.h +++ b/searchlib/src/vespa/searchlib/engine/request.h @@ -39,8 +39,8 @@ class Request public: /// Everything here should move up to private section and have accessors bool dumpFeatures; - vespalib::string ranking; - vespalib::string location; + std::string ranking; + std::string location; PropertiesMap propertiesMap; std::vector stackDump; std::vector sessionId; diff --git a/searchlib/src/vespa/searchlib/engine/searchrequest.h b/searchlib/src/vespa/searchlib/engine/searchrequest.h index d6807806cd53..0b1c4e3c839f 100644 --- a/searchlib/src/vespa/searchlib/engine/searchrequest.h +++ b/searchlib/src/vespa/searchlib/engine/searchrequest.h @@ -17,7 +17,7 @@ class SearchRequest : public Request uint32_t offset; uint32_t maxhits; - vespalib::string sortSpec; + std::string sortSpec; std::vector groupSpec; SearchRequest(); diff --git a/searchlib/src/vespa/searchlib/engine/trace.cpp b/searchlib/src/vespa/searchlib/engine/trace.cpp index 26c565518d40..134245fb2c0f 100644 --- a/searchlib/src/vespa/searchlib/engine/trace.cpp +++ b/searchlib/src/vespa/searchlib/engine/trace.cpp @@ -137,7 +137,7 @@ void Trace::done() { root().setDouble("duration_ms", vespalib::count_ns(_relativeTime.timeSinceDawn())/1000000.0); } -vespalib::string +std::string Trace::toString() const { return hasTrace() ? slime().toString() : ""; } diff --git a/searchlib/src/vespa/searchlib/engine/trace.h b/searchlib/src/vespa/searchlib/engine/trace.h index c6868565e91b..6a2ab148fc99 100644 --- a/searchlib/src/vespa/searchlib/engine/trace.h +++ b/searchlib/src/vespa/searchlib/engine/trace.h @@ -2,10 +2,10 @@ #pragma once -#include #include #include #include +#include namespace vespalib { class Slime; } namespace vespalib::slime { struct Cursor; } @@ -106,7 +106,7 @@ class Trace */ void done(); - vespalib::string toString() const; + std::string toString() const; bool hasTrace() const { return static_cast(_trace); } Cursor & getRoot() const { return root(); } Cursor & getTraces() const { return traces(); } diff --git a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp index c713aee68037..bd63833d967a 100644 --- a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp @@ -19,7 +19,7 @@ ArrayAtLookup::ArrayAtLookup() noexcept ArrayAtLookup::~ArrayAtLookup() = default; ArrayAtLookup & ArrayAtLookup::operator=(const ArrayAtLookup &rhs) = default; -ArrayAtLookup::ArrayAtLookup(const vespalib::string &attribute, ExpressionNode::UP indexExpr) +ArrayAtLookup::ArrayAtLookup(const std::string &attribute, ExpressionNode::UP indexExpr) : AttributeNode(attribute), _currentIndex(), _indexExpression(std::move(indexExpr)) diff --git a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.h b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.h index aec3097b0387..0d42520ba575 100644 --- a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.h @@ -18,7 +18,7 @@ class ArrayAtLookup : public AttributeNode ArrayAtLookup() noexcept; ~ArrayAtLookup() override; - ArrayAtLookup(const vespalib::string &attribute, ExpressionNode::UP arg); + ArrayAtLookup(const std::string &attribute, ExpressionNode::UP arg); ArrayAtLookup(const search::attribute::IAttributeVector &attr, ExpressionNode::UP indexArg); ArrayAtLookup(const ArrayAtLookup &rhs); ArrayAtLookup & operator= (const ArrayAtLookup &rhs); diff --git a/searchlib/src/vespa/searchlib/expression/arrayoperationnode.h b/searchlib/src/vespa/searchlib/expression/arrayoperationnode.h index 9cd436bc3825..6ac95a6518f6 100644 --- a/searchlib/src/vespa/searchlib/expression/arrayoperationnode.h +++ b/searchlib/src/vespa/searchlib/expression/arrayoperationnode.h @@ -36,7 +36,7 @@ class ArrayOperationNode : public FunctionNode } private: - vespalib::string _attributeName; + std::string _attributeName; const attribute::IAttributeVector * _attribute; DocId _docId; }; diff --git a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp index 6944aa168c24..6b4e24066c06 100644 --- a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp +++ b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp @@ -43,7 +43,7 @@ class BadKeyHandler : public AttributeMapLookupNode::KeyHandler template KeyType -convertKey(const IAttributeVector &, const vespalib::string &key) +convertKey(const IAttributeVector &, const std::string &key) { KeyType ret; vespalib::asciistream is(key); @@ -52,15 +52,15 @@ convertKey(const IAttributeVector &, const vespalib::string &key) } template <> -vespalib::string -convertKey(const IAttributeVector &, const vespalib::string &key) +std::string +convertKey(const IAttributeVector &, const std::string &key) { return key; } template <> EnumHandle -convertKey(const IAttributeVector &attribute, const vespalib::string &key) +convertKey(const IAttributeVector &attribute, const std::string &key) { EnumHandle ret; if (!attribute.findEnum(key.c_str(), ret)) { @@ -76,7 +76,7 @@ class KeyHandlerT : public AttributeMapLookupNode::KeyHandler KeyType _key; public: - KeyHandlerT(const IAttributeVector &attribute, const vespalib::string &key) + KeyHandlerT(const IAttributeVector &attribute, const std::string &key) : KeyHandler(attribute), _keys(), _key(convertKey(attribute, key)) @@ -98,7 +98,7 @@ KeyHandlerT::~KeyHandlerT() = default; using IntegerKeyHandler = KeyHandlerT; using FloatKeyHandler = KeyHandlerT; -using StringKeyHandler = KeyHandlerT; +using StringKeyHandler = KeyHandlerT; using EnumKeyHandler = KeyHandlerT; template @@ -191,7 +191,7 @@ using StringValueHandler = ValueHandlerT; using EnumValueHandler = ValueHandlerT; const IAttributeVector * -findAttribute(const search::attribute::IAttributeContext &attrCtx, bool useEnumOptimization, const vespalib::string &name) +findAttribute(const search::attribute::IAttributeContext &attrCtx, bool useEnumOptimization, const std::string &name) { const IAttributeVector *attribute = useEnumOptimization ? attrCtx.getAttributeStableEnum(name) : attrCtx.getAttribute(name); if (attribute == nullptr) { diff --git a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h index d3b701f4e977..e81119f8df47 100644 --- a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h +++ b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h @@ -15,10 +15,10 @@ class AttributeMapLookupNode : public AttributeNode using IAttributeVector = search::attribute::IAttributeVector; class KeyHandler; private: - vespalib::string _keyAttributeName; - vespalib::string _valueAttributeName; - vespalib::string _key; - vespalib::string _keySourceAttributeName; + std::string _keyAttributeName; + std::string _valueAttributeName; + std::string _key; + std::string _keySourceAttributeName; const IAttributeVector *_keyAttribute; const IAttributeVector *_keySourceAttribute; diff --git a/searchlib/src/vespa/searchlib/expression/attributenode.h b/searchlib/src/vespa/searchlib/expression/attributenode.h index 1a7f5b7dc4a2..81fad3c4cb94 100644 --- a/searchlib/src/vespa/searchlib/expression/attributenode.h +++ b/searchlib/src/vespa/searchlib/expression/attributenode.h @@ -54,7 +54,7 @@ class AttributeNode : public FunctionNode const attribute::IAttributeVector *getAttribute() const { return _scratchResult ? _scratchResult->getAttribute() : nullptr; } - const vespalib::string & getAttributeName() const noexcept { return _attributeName; } + const std::string & getAttributeName() const noexcept { return _attributeName; } void enableEnumOptimization(bool enable) noexcept { _useEnumOptimization = enable; } public: @@ -91,7 +91,7 @@ class AttributeNode : public FunctionNode } virtual void cleanup(); bool onExecute() const override; - vespalib::string _attributeName; + std::string _attributeName; }; } diff --git a/searchlib/src/vespa/searchlib/expression/bucketresultnode.cpp b/searchlib/src/vespa/searchlib/expression/bucketresultnode.cpp index 12a3d345faf4..06b0517e4159 100644 --- a/searchlib/src/vespa/searchlib/expression/bucketresultnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/bucketresultnode.cpp @@ -5,8 +5,8 @@ namespace search::expression { IMPLEMENT_IDENTIFIABLE_ABSTRACT_NS2(search, expression, BucketResultNode, vespalib::Identifiable); -const vespalib::string BucketResultNode::_toField("to"); -const vespalib::string BucketResultNode::_fromField("from"); +const std::string BucketResultNode::_toField("to"); +const std::string BucketResultNode::_fromField("from"); } diff --git a/searchlib/src/vespa/searchlib/expression/bucketresultnode.h b/searchlib/src/vespa/searchlib/expression/bucketresultnode.h index e1912f61d6aa..a15c7cd37169 100644 --- a/searchlib/src/vespa/searchlib/expression/bucketresultnode.h +++ b/searchlib/src/vespa/searchlib/expression/bucketresultnode.h @@ -11,8 +11,8 @@ class BucketResultNode : public ResultNode DECLARE_ABSTRACT_EXPRESSIONNODE(BucketResultNode); void set(const ResultNode & rhs) override { (void) rhs; } protected: - static const vespalib::string _fromField; - static const vespalib::string _toField; + static const std::string _fromField; + static const std::string _toField; private: int64_t onGetInteger(size_t index) const override { (void) index; return 0; } double onGetFloat(size_t index) const override { (void) index; return 0; } diff --git a/searchlib/src/vespa/searchlib/expression/catserializer.cpp b/searchlib/src/vespa/searchlib/expression/catserializer.cpp index b406eddee96f..405144c56309 100644 --- a/searchlib/src/vespa/searchlib/expression/catserializer.cpp +++ b/searchlib/src/vespa/searchlib/expression/catserializer.cpp @@ -9,7 +9,7 @@ namespace search::expression { using vespalib::Serializer; using vespalib::Deserializer; -using vespalib::string; +using std::string; CatSerializer & CatSerializer::put(std::string_view value) { diff --git a/searchlib/src/vespa/searchlib/expression/catserializer.h b/searchlib/src/vespa/searchlib/expression/catserializer.h index 358ff2381f61..a0588632ce6f 100644 --- a/searchlib/src/vespa/searchlib/expression/catserializer.h +++ b/searchlib/src/vespa/searchlib/expression/catserializer.h @@ -25,7 +25,7 @@ class CatSerializer : public vespalib::NBOSerializer, public ResultSerializer CatSerializer & get(uint64_t & value) override; CatSerializer & get(double & value) override; CatSerializer & get(float & value) override; - CatSerializer & get(vespalib::string & value) override; + CatSerializer & get(std::string & value) override; private: CatSerializer & nop(const void * value) __attribute__((noinline)); diff --git a/searchlib/src/vespa/searchlib/expression/current_index_setup.cpp b/searchlib/src/vespa/searchlib/expression/current_index_setup.cpp index 2bafb3a4a232..a370fe2a1293 100644 --- a/searchlib/src/vespa/searchlib/expression/current_index_setup.cpp +++ b/searchlib/src/vespa/searchlib/expression/current_index_setup.cpp @@ -9,7 +9,7 @@ namespace search::expression { void CurrentIndexSetup::Usage::notify_unbound_struct_usage(std::string_view name) { - _unbound.insert(vespalib::string(name)); + _unbound.insert(std::string(name)); } CurrentIndexSetup::Usage::Usage() @@ -66,7 +66,7 @@ CurrentIndexSetup::resolve(std::string_view field_name) const void CurrentIndexSetup::bind(std::string_view struct_name, const CurrentIndex &index) { - auto res = _bound.insert(std::make_pair(vespalib::string(struct_name), + auto res = _bound.insert(std::make_pair(std::string(struct_name), std::addressof(index))); assert(res.second); // struct must be either bound or unbound } diff --git a/searchlib/src/vespa/searchlib/expression/current_index_setup.h b/searchlib/src/vespa/searchlib/expression/current_index_setup.h index 682e16edea8f..8b812cf08807 100644 --- a/searchlib/src/vespa/searchlib/expression/current_index_setup.h +++ b/searchlib/src/vespa/searchlib/expression/current_index_setup.h @@ -3,9 +3,9 @@ #pragma once #include "currentindex.h" -#include #include #include +#include #include namespace search::expression { @@ -15,7 +15,7 @@ class CurrentIndexSetup { class Usage { private: friend class CurrentIndexSetup; - vespalib::hash_set _unbound; + vespalib::hash_set _unbound; void notify_unbound_struct_usage(std::string_view name); public: Usage(); @@ -33,7 +33,7 @@ class CurrentIndexSetup { }; }; private: - vespalib::hash_map _bound; + vespalib::hash_map _bound; Usage *_usage; [[nodiscard]] Usage *capture(Usage *usage) noexcept { return std::exchange(_usage, usage); diff --git a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h index 70a59060bd56..2a8953e46af2 100644 --- a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h +++ b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h @@ -27,11 +27,11 @@ class DocumentAccessorNode : public ExpressionNode void setDoc(const document::Document & doc) { onDoc(doc); } void setDocType(const document::DocumentType & docType) { onDocType(docType); } - virtual const vespalib::string & getFieldName() const { return _S_docId; } + virtual const std::string & getFieldName() const { return _S_docId; } private: virtual void onDoc(const document::Document & doc) = 0; virtual void onDocType(const document::DocumentType & docType) = 0; - static const vespalib::string _S_docId; + static const std::string _S_docId; }; } diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp index 6c5de68f8571..5aa9d9a35e59 100644 --- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp @@ -21,7 +21,7 @@ IMPLEMENT_EXPRESSIONNODE(DocumentFieldNode, DocumentAccessorNode); IMPLEMENT_EXPRESSIONNODE(GetYMUMChecksumFunctionNode, DocumentAccessorNode); IMPLEMENT_EXPRESSIONNODE(GetDocIdNamespaceSpecificFunctionNode, DocumentAccessorNode); -const vespalib::string DocumentAccessorNode::_S_docId("documentid"); +const std::string DocumentAccessorNode::_S_docId("documentid"); DocumentFieldNode::~DocumentFieldNode() = default; @@ -99,11 +99,11 @@ deduceResultNode(std::string_view fieldName, const FieldValue & fv, bool preserv value.reset(new RawResultNodeVector()); } else { throw std::runtime_error(make_string("Can not deduce correct resultclass for documentfield '%s' in based on class '%s'. It nests down to %s which is not expected", - vespalib::string(fieldName).c_str(), fv.className(), rInfo.name())); + std::string(fieldName).c_str(), fv.className(), rInfo.name())); } } else { throw std::runtime_error(make_string("Can not deduce correct resultclass for documentfield '%s' in based on class '%s'", - vespalib::string(fieldName).c_str(), fv.className())); + std::string(fieldName).c_str(), fv.className())); } return value; } @@ -272,7 +272,7 @@ class String2ResultNode : public ResultNode String2ResultNode * clone() const override { return new String2ResultNode(_s); } void set(const ResultNode&) override; size_t hash() const override { return 0; } - vespalib::string _s; + std::string _s; }; void String2ResultNode::set(const ResultNode&) @@ -287,7 +287,7 @@ void GetDocIdNamespaceSpecificFunctionNode::onDoc(const Document & doc) } namespace { -const vespalib::string _G_valueField("value"); +const std::string _G_valueField("value"); } Serializer & GetDocIdNamespaceSpecificFunctionNode::onSerialize(Serializer & os) const @@ -307,7 +307,7 @@ GetDocIdNamespaceSpecificFunctionNode::visitMembers(vespalib::ObjectVisitor &vis void GetYMUMChecksumFunctionNode::onDoc(const Document & doc) { - vespalib::string ymumid(doc.getId().getScheme().getNamespaceSpecific()); + std::string ymumid(doc.getId().getScheme().getNamespaceSpecific()); try { char decoded[20]; diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h index 753729337c37..b3b3be9fe0b3 100644 --- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h +++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h @@ -39,7 +39,7 @@ class DocumentFieldNode : public DocumentAccessorNode DocumentFieldNode & operator = (const DocumentFieldNode & rhs); DocumentFieldNode(DocumentFieldNode && rhs) noexcept = default; DocumentFieldNode & operator = (DocumentFieldNode && rhs) noexcept = default; - const vespalib::string & getFieldName() const override { return _fieldName; } + const std::string & getFieldName() const override { return _fieldName; } public: class Handler : public document::fieldvalue::IteratorHandler { public: @@ -76,7 +76,7 @@ class DocumentFieldNode : public DocumentAccessorNode document::FieldPath _fieldPath; mutable ResultNode::CP _value; mutable std::unique_ptr _handler; - vespalib::string _fieldName; + std::string _fieldName; const document::Document * _doc; }; diff --git a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp index fc07f7751118..7295bb4bf9b1 100644 --- a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp +++ b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp @@ -293,7 +293,7 @@ MaxFunctionNode::getInitialValue() const } else if (arg.inherits(IntegerResultNodeVector::classId)) { initial.reset(new Int64ResultNode(std::numeric_limits::min())); } else { - throw std::runtime_error(vespalib::string("Can not choose an initial value for class ") + arg.getClass().name()); + throw std::runtime_error(std::string("Can not choose an initial value for class ") + arg.getClass().name()); } return initial; } @@ -308,7 +308,7 @@ MinFunctionNode::getInitialValue() const } else if (arg.inherits(IntegerResultNodeVector::classId)) { initial.reset(new Int64ResultNode(std::numeric_limits::max())); } else { - throw std::runtime_error(vespalib::string("Can not choose an initial value for class ") + arg.getClass().name()); + throw std::runtime_error(std::string("Can not choose an initial value for class ") + arg.getClass().name()); } return initial; } diff --git a/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.cpp index 45f4f8e5fb1f..f472a69ac2a3 100644 --- a/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.cpp @@ -21,7 +21,7 @@ InterpolatedLookup::InterpolatedLookup() noexcept InterpolatedLookup::~InterpolatedLookup() = default; -InterpolatedLookup::InterpolatedLookup(const vespalib::string &attribute, ExpressionNode::UP arg) +InterpolatedLookup::InterpolatedLookup(const std::string &attribute, ExpressionNode::UP arg) : AttributeNode(attribute), _lookupExpression(std::move(arg)) { diff --git a/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.h b/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.h index 57b699c821d8..0994ffa67130 100644 --- a/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/interpolatedlookupfunctionnode.h @@ -15,7 +15,7 @@ class InterpolatedLookup : public AttributeNode InterpolatedLookup() noexcept; ~InterpolatedLookup() override; - InterpolatedLookup(const vespalib::string &attribute, ExpressionNode::UP arg); + InterpolatedLookup(const std::string &attribute, ExpressionNode::UP arg); InterpolatedLookup(const search::attribute::IAttributeVector &attr, ExpressionNode::UP lookupArg); InterpolatedLookup(const InterpolatedLookup &rhs); InterpolatedLookup & operator= (const InterpolatedLookup &rhs); diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp index 577c7f8b1c14..bbd32c613587 100644 --- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp @@ -35,7 +35,7 @@ void NumericFunctionNode::onPrepare(bool preserveAccurateTypes) } else if (getArg(0).getResult()->getClass().inherits(StringResultNodeVector::classId)) { _handler.reset(new FlattenStringHandler(*this)); } else { - throw std::runtime_error(vespalib::string("No FlattenHandler for ") + getArg(0).getResult()->getClass().name()); + throw std::runtime_error(std::string("No FlattenHandler for ") + getArg(0).getResult()->getClass().name()); } } else { if (getResult()->getClass().inherits(IntegerResultNodeVector::classId)) { diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.cpp b/searchlib/src/vespa/searchlib/expression/resultnode.cpp index 8fd436faa7dd..b7712b885dfb 100644 --- a/searchlib/src/vespa/searchlib/expression/resultnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/resultnode.cpp @@ -17,61 +17,61 @@ ResultNode::onGetEnum(size_t index) const { uint64_t ResultNode::radixAsc(const void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::radixAsc(const void * buf) must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::radixAsc(const void * buf) must be overloaded by'" + std::string(getClass().name()) + "'."); } uint64_t ResultNode::radixDesc(const void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::radixDesc(const void * buf) must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::radixDesc(const void * buf) must be overloaded by'" + std::string(getClass().name()) + "'."); } size_t ResultNode::hash(const void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::hash(const void * buf) must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::hash(const void * buf) must be overloaded by'" + std::string(getClass().name()) + "'."); } void ResultNode::decode(const void * buf) { (void) buf; - throw std::runtime_error("ResultNode::decode(const void * buf) must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::decode(const void * buf) must be overloaded by'" + std::string(getClass().name()) + "'."); } void ResultNode::encode(void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::encode(void * buf) const must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::encode(void * buf) const must be overloaded by'" + std::string(getClass().name()) + "'."); } void ResultNode::swap(void * buf) { (void) buf; - throw std::runtime_error("ResultNode::swap(void * buf) must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::swap(void * buf) must be overloaded by'" + std::string(getClass().name()) + "'."); } void ResultNode::create(void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::create(void * buf) const must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::create(void * buf) const must be overloaded by'" + std::string(getClass().name()) + "'."); } void ResultNode::destroy(void * buf) const { (void) buf; - throw std::runtime_error("ResultNode::destroy(void * buf) const must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::destroy(void * buf) const must be overloaded by'" + std::string(getClass().name()) + "'."); } int ResultNode::cmpMem(const void * a, const void *b) const { (void) a; (void) b; - throw std::runtime_error("ResultNode::cmpMem(const void * a, const void *b) const must be overloaded by'" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::cmpMem(const void * a, const void *b) const must be overloaded by'" + std::string(getClass().name()) + "'."); } size_t ResultNode::getRawByteSize() const { - throw std::runtime_error("ResultNode::getRawByteSize() const must be overloaded by '" + vespalib::string(getClass().name()) + "'."); + throw std::runtime_error("ResultNode::getRawByteSize() const must be overloaded by '" + std::string(getClass().name()) + "'."); } const BucketResultNode& diff --git a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp index 3a0034908bab..243c1231ae49 100644 --- a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp +++ b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp @@ -41,8 +41,8 @@ IMPLEMENT_RESULTNODE(FloatResultNode, NumericResultNode); namespace { -const vespalib::string TRUE = "true"; -const vespalib::string FALSE = "false"; +const std::string TRUE = "true"; +const std::string FALSE = "false"; size_t hashBuf(const void *s, size_t sz) { @@ -341,7 +341,7 @@ size_t StringResultNode::hash() const { return hashBuf(_value.c_str(), _value.s size_t StringResultNode::hash(const void * buf) const { - const vespalib::string & s = *static_cast(buf); + const std::string & s = *static_cast(buf); return hashBuf(s.c_str(), s.size()); } diff --git a/searchlib/src/vespa/searchlib/expression/strcatserializer.cpp b/searchlib/src/vespa/searchlib/expression/strcatserializer.cpp index 8b5a186332e1..e6216bcb7142 100644 --- a/searchlib/src/vespa/searchlib/expression/strcatserializer.cpp +++ b/searchlib/src/vespa/searchlib/expression/strcatserializer.cpp @@ -7,7 +7,7 @@ namespace search::expression { using vespalib::Serializer; -using vespalib::string; +using std::string; StrCatSerializer & StrCatSerializer::put(const vespalib::Identifiable & value) { diff --git a/searchlib/src/vespa/searchlib/expression/stringresultnode.h b/searchlib/src/vespa/searchlib/expression/stringresultnode.h index bc5953ff7fec..f4bc1a8fb4de 100644 --- a/searchlib/src/vespa/searchlib/expression/stringresultnode.h +++ b/searchlib/src/vespa/searchlib/expression/stringresultnode.h @@ -18,7 +18,7 @@ class StringResultNode : public SingleResultNode void set(const ResultNode & rhs) override; StringResultNode & append(const ResultNode & rhs); StringResultNode & clear() { _value.clear(); return *this; } - const vespalib::string & get() const { return _value; } + const std::string & get() const { return _value; } void set(std::string_view value) { _value = value; } void min(const ResultNode & b) override; void max(const ResultNode & b) override; @@ -28,24 +28,24 @@ class StringResultNode : public SingleResultNode private: int cmpMem(const void * a, const void *b) const override { - return static_cast(a)->compare(*static_cast(b)); + return static_cast(a)->compare(*static_cast(b)); } void create(void * buf) const override { - new (buf) vespalib::string(); + new (buf) std::string(); } void destroy(void * buf) const override { - using string = vespalib::string; + using string = std::string; static_cast(buf)->string::~string(); } void decode(const void * buf) override { - _value = *static_cast(buf); + _value = *static_cast(buf); } void encode(void * buf) const override { - *static_cast(buf) = _value; + *static_cast(buf) = _value; } void swap(void * buf) override { - std::swap(*static_cast(buf), _value); + std::swap(*static_cast(buf), _value); } size_t hash(const void * buf) const override; @@ -55,7 +55,7 @@ class StringResultNode : public SingleResultNode int64_t onGetInteger(size_t index) const override; double onGetFloat(size_t index) const override; ConstBufferRef onGetString(size_t index, BufferRef buf) const override; - vespalib::string _value; + std::string _value; }; } diff --git a/searchlib/src/vespa/searchlib/features/agefeature.h b/searchlib/src/vespa/searchlib/features/agefeature.h index 8bce4d338d9e..3ab3d091dd6c 100644 --- a/searchlib/src/vespa/searchlib/features/agefeature.h +++ b/searchlib/src/vespa/searchlib/features/agefeature.h @@ -26,7 +26,7 @@ class AgeExecutor : public fef::FeatureExecutor { */ class AgeBlueprint : public fef::Blueprint { private: - vespalib::string _attribute; + std::string _attribute; public: AgeBlueprint() : fef::Blueprint("age") { } diff --git a/searchlib/src/vespa/searchlib/features/array_parser.cpp b/searchlib/src/vespa/searchlib/features/array_parser.cpp index fd7b6df0b8dc..f9e837cbe488 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.cpp +++ b/searchlib/src/vespa/searchlib/features/array_parser.cpp @@ -8,7 +8,7 @@ LOG_SETUP(".features.array_parser"); namespace search::features { void -ArrayParser::parse(const vespalib::string &input, std::vector &output) +ArrayParser::parse(const std::string &input, std::vector &output) { parse, int16_t>(input, output); } diff --git a/searchlib/src/vespa/searchlib/features/array_parser.h b/searchlib/src/vespa/searchlib/features/array_parser.h index 68580a3b2698..2e3402535bcc 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.h +++ b/searchlib/src/vespa/searchlib/features/array_parser.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include #include namespace search::features { @@ -36,12 +37,12 @@ class ArrayParser }; template - static void parse(const vespalib::string &input, OutputType &output); + static void parse(const std::string &input, OutputType &output); - static void parse(const vespalib::string &input, std::vector &output); + static void parse(const std::string &input, std::vector &output); template - static void parsePartial(const vespalib::string &input, OutputType &output); + static void parsePartial(const std::string &input, OutputType &output); }; } diff --git a/searchlib/src/vespa/searchlib/features/array_parser.hpp b/searchlib/src/vespa/searchlib/features/array_parser.hpp index 724a335c5c57..21c53e7f2195 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.hpp +++ b/searchlib/src/vespa/searchlib/features/array_parser.hpp @@ -15,7 +15,7 @@ namespace search::features { template void -ArrayParser::parse(const vespalib::string &input, OutputType &output) +ArrayParser::parse(const std::string &input, OutputType &output) { using SparseVector = std::vector>; SparseVector sparse; @@ -31,7 +31,7 @@ ArrayParser::parse(const vespalib::string &input, OutputType &output) template void -ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) +ArrayParser::parsePartial(const std::string &input, OutputType &output) { size_t len = input.size(); if (len >= 2) { @@ -43,7 +43,7 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) size_t key; char colon; while ( ! s.empty() ) { - vespalib::string::size_type commaPos(s.find(',')); + std::string::size_type commaPos(s.find(',')); std::string_view item(s.substr(0, commaPos)); vespalib::asciistream is(item); try { @@ -53,15 +53,15 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) } else { Issue::report("Could not parse item '%s' in query vector '%s', skipping. " "Expected ':' between dimension and component.", - vespalib::string(item).c_str(), input.c_str()); + std::string(item).c_str(), input.c_str()); return; } } catch (vespalib::IllegalArgumentException & e) { Issue::report("Could not parse item '%s' in query vector '%s', skipping. " - "Incorrect type of operands", vespalib::string(item).c_str(), input.c_str()); + "Incorrect type of operands", std::string(item).c_str(), input.c_str()); return; } - if (commaPos != vespalib::string::npos) { + if (commaPos != std::string::npos) { s = s.substr(commaPos+1); } else { s = std::string_view(); @@ -76,7 +76,7 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) output.emplace_back(value, index++); } catch (vespalib::IllegalArgumentException & e) { Issue::report("Could not parse item[%ld] = '%s' in query vector '%s', skipping. " - "Incorrect type of operands", output.size(), is.c_str(), vespalib::string(s).c_str()); + "Incorrect type of operands", output.size(), is.c_str(), std::string(s).c_str()); return; } } @@ -87,6 +87,6 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) } template void -ArrayParser::parse(const vespalib::string &input, std::vector &); +ArrayParser::parse(const std::string &input, std::vector &); } diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp index 5b3176685034..78df3b57ca84 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp @@ -348,7 +348,7 @@ struct ArrayExecutorCreator { }; fef::FeatureExecutor & -createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, const vespalib::string &attrName, const vespalib::string &extraParam, vespalib::Stash &stash) +createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, const std::string &attrName, const std::string &extraParam, vespalib::Stash &stash) { if (attribute == nullptr) { Issue::report("attribute feature: The attribute vector '%s' was not found, returning default values.", @@ -433,7 +433,7 @@ createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, } fef::FeatureExecutor & -createTensorAttributeExecutor(const IAttributeVector *attribute, const vespalib::string &attrName, +createTensorAttributeExecutor(const IAttributeVector *attribute, const std::string &attrName, const ValueType &tensorType, vespalib::Stash &stash) { @@ -509,7 +509,7 @@ AttributeBlueprint::setup(const fef::IIndexEnvironment & env, if (params.size() == 2) { _extra = params[1].getValue(); } - vespalib::string attrType = type::Attribute::lookup(env.getProperties(), _attrName); + std::string attrType = type::Attribute::lookup(env.getProperties(), _attrName); if (!attrType.empty()) { _tensorType = ValueType::from_spec(attrType); if (_tensorType.is_error()) { diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.h b/searchlib/src/vespa/searchlib/features/attributefeature.h index 8fd39f2ec92f..af19ffb5be95 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.h +++ b/searchlib/src/vespa/searchlib/features/attributefeature.h @@ -15,9 +15,9 @@ namespace search::features { */ class AttributeBlueprint : public fef::Blueprint { private: - vespalib::string _attrName; // the name of the attribute vector - vespalib::string _attrKey; // Used for looking up the attribute in the ObjectStore. - vespalib::string _extra; // the index or key + std::string _attrName; // the name of the attribute vector + std::string _attrKey; // Used for looking up the attribute in the ObjectStore. + std::string _extra; // the index or key vespalib::eval::ValueType _tensorType; uint8_t _numOutputs; diff --git a/searchlib/src/vespa/searchlib/features/bm25_feature.cpp b/searchlib/src/vespa/searchlib/features/bm25_feature.cpp index 6e0fb1f9c399..2533e2531086 100644 --- a/searchlib/src/vespa/searchlib/features/bm25_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/bm25_feature.cpp @@ -109,9 +109,9 @@ Bm25Executor::execute(uint32_t doc_id) } Trinary -Bm25Blueprint::lookup_param(const fef::Properties& props, const vespalib::string& param, double& result) const +Bm25Blueprint::lookup_param(const fef::Properties& props, const std::string& param, double& result) const { - vespalib::string key = getBaseName() + "(" + _field->name() + ")." + param; + std::string key = getBaseName() + "(" + _field->name() + ")." + param; auto value = props.lookup(key); if (value.found()) { try { @@ -127,7 +127,7 @@ Bm25Blueprint::lookup_param(const fef::Properties& props, const vespalib::string } Trinary -Bm25Blueprint::lookup_param(const fef::Properties& props, const vespalib::string& param, std::optional& result) const +Bm25Blueprint::lookup_param(const fef::Properties& props, const std::string& param, std::optional& result) const { double tmp_result; auto lres = lookup_param(props, param, tmp_result); @@ -190,8 +190,8 @@ Bm25Blueprint::setup(const fef::IIndexEnvironment& env, const fef::ParameterList namespace { -vespalib::string -make_avg_field_length_key(const vespalib::string& base_name, const vespalib::string& field_name) +std::string +make_avg_field_length_key(const std::string& base_name, const std::string& field_name) { return base_name + ".afl." + field_name; } @@ -201,7 +201,7 @@ make_avg_field_length_key(const vespalib::string& base_name, const vespalib::str void Bm25Blueprint::prepareSharedState(const fef::IQueryEnvironment& env, fef::IObjectStore& store) const { - vespalib::string key = make_avg_field_length_key(getBaseName(), _field->name()); + std::string key = make_avg_field_length_key(getBaseName(), _field->name()); if (store.get(key) == nullptr) { double avg_field_length = _avg_field_length.value_or(env.get_average_field_length(_field->name())); store.add(key, std::make_unique>(avg_field_length)); diff --git a/searchlib/src/vespa/searchlib/features/bm25_feature.h b/searchlib/src/vespa/searchlib/features/bm25_feature.h index 4a2f0e12452d..bc0f6bb0901c 100644 --- a/searchlib/src/vespa/searchlib/features/bm25_feature.h +++ b/searchlib/src/vespa/searchlib/features/bm25_feature.h @@ -57,8 +57,8 @@ class Bm25Blueprint : public fef::Blueprint { double _b_param; std::optional _avg_field_length; - vespalib::Trinary lookup_param(const fef::Properties& props, const vespalib::string& param, double& result) const; - vespalib::Trinary lookup_param(const fef::Properties& props, const vespalib::string& param, std::optional& result) const; + vespalib::Trinary lookup_param(const fef::Properties& props, const std::string& param, double& result) const; + vespalib::Trinary lookup_param(const fef::Properties& props, const std::string& param, std::optional& result) const; public: Bm25Blueprint(); diff --git a/searchlib/src/vespa/searchlib/features/closenessfeature.cpp b/searchlib/src/vespa/searchlib/features/closenessfeature.cpp index d19b979c360e..94561f5dd140 100644 --- a/searchlib/src/vespa/searchlib/features/closenessfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/closenessfeature.cpp @@ -25,7 +25,7 @@ class ConvertRawScoreToCloseness : public fef::FeatureExecutor { } public: ConvertRawScoreToCloseness(const fef::IQueryEnvironment &env, uint32_t fieldId); - ConvertRawScoreToCloseness(const fef::IQueryEnvironment &env, const vespalib::string &label); + ConvertRawScoreToCloseness(const fef::IQueryEnvironment &env, const std::string &label); void execute(uint32_t docId) override; }; @@ -35,7 +35,7 @@ ConvertRawScoreToCloseness::ConvertRawScoreToCloseness(const fef::IQueryEnvironm { } -ConvertRawScoreToCloseness::ConvertRawScoreToCloseness(const fef::IQueryEnvironment &env, const vespalib::string &label) +ConvertRawScoreToCloseness::ConvertRawScoreToCloseness(const fef::IQueryEnvironment &env, const std::string &label) : _bundle(env, std::nullopt, label, "closeness"), _md(nullptr) { @@ -108,7 +108,7 @@ ClosenessBlueprint::setup(const IIndexEnvironment & env, const search::fef::ParameterList & params) { // params[0] = attribute name - vespalib::string arg = params[0].getValue(); + std::string arg = params[0].getValue(); if (params.size() == 2) { // params[0] = field / label // params[0] = attribute name / label value diff --git a/searchlib/src/vespa/searchlib/features/closenessfeature.h b/searchlib/src/vespa/searchlib/features/closenessfeature.h index 7ebbbb6bf657..c19339befb16 100644 --- a/searchlib/src/vespa/searchlib/features/closenessfeature.h +++ b/searchlib/src/vespa/searchlib/features/closenessfeature.h @@ -29,7 +29,7 @@ class ClosenessBlueprint : public fef::Blueprint { feature_t _maxDistance; feature_t _scaleDistance; feature_t _halfResponse; - vespalib::string _arg_string; + std::string _arg_string; uint32_t _attr_id; bool _use_geo_pos; bool _use_nns_tensor; diff --git a/searchlib/src/vespa/searchlib/features/closest_feature.cpp b/searchlib/src/vespa/searchlib/features/closest_feature.cpp index a720c2f0f465..3aef93e90506 100644 --- a/searchlib/src/vespa/searchlib/features/closest_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/closest_feature.cpp @@ -232,7 +232,7 @@ ClosestBlueprint::setup(const fef::IIndexEnvironment & env, const fef::Parameter } auto fi = env.getFieldByName(_field_name); assert(fi != nullptr); - vespalib::string attr_type_spec = type::Attribute::lookup(env.getProperties(), _field_name); + std::string attr_type_spec = type::Attribute::lookup(env.getProperties(), _field_name); if (attr_type_spec.empty()) { LOG(error, "%s: Field %s lacks a type in index properties", getName().c_str(), _field_name.c_str()); return false; diff --git a/searchlib/src/vespa/searchlib/features/closest_feature.h b/searchlib/src/vespa/searchlib/features/closest_feature.h index 649b2affead4..4aee8b367917 100644 --- a/searchlib/src/vespa/searchlib/features/closest_feature.h +++ b/searchlib/src/vespa/searchlib/features/closest_feature.h @@ -11,11 +11,11 @@ namespace search::features { * Implements the blueprint for the closest executor. */ class ClosestBlueprint : public fef::Blueprint { - vespalib::string _field_name; + std::string _field_name; vespalib::eval::ValueType _field_tensor_type; vespalib::eval::ValueType _output_tensor_type; uint32_t _field_id; - std::optional _item_label; + std::optional _item_label; std::unique_ptr _empty_output; std::vector _identity_space; vespalib::eval::TypedCells _identity_cells; diff --git a/searchlib/src/vespa/searchlib/features/constant_feature.h b/searchlib/src/vespa/searchlib/features/constant_feature.h index 016be53050b9..f51d11be20cd 100644 --- a/searchlib/src/vespa/searchlib/features/constant_feature.h +++ b/searchlib/src/vespa/searchlib/features/constant_feature.h @@ -16,7 +16,7 @@ namespace search::features { */ class ConstantBlueprint : public fef::Blueprint { private: - vespalib::string _key; // 'foo' + std::string _key; // 'foo' std::unique_ptr _value; public: diff --git a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h index 144ffe24f31d..296d159c14c3 100644 --- a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h +++ b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h @@ -18,7 +18,7 @@ struct DebugAttributeWaitParams { class DebugAttributeWaitBlueprint : public fef::Blueprint { private: - vespalib::string _attribute; + std::string _attribute; DebugAttributeWaitParams _params; public: diff --git a/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.cpp b/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.cpp index 1bc0b4a705e2..79b059ed2de7 100644 --- a/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.cpp +++ b/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.cpp @@ -23,8 +23,8 @@ namespace { void prepare_query_tensor(const fef::IQueryEnvironment& env, fef::IObjectStore& store, - const vespalib::string& query_tensor_name, - const vespalib::string& feature_name) + const std::string& query_tensor_name, + const std::string& feature_name) { try { auto qvalue = QueryValue::from_config(query_tensor_name, env.getIndexEnvironment()); @@ -38,8 +38,8 @@ prepare_query_tensor(const fef::IQueryEnvironment& env, std::unique_ptr make_distance_calculator(const fef::IQueryEnvironment& env, const search::attribute::IAttributeVector& attr, - const vespalib::string& query_tensor_name, - const vespalib::string& feature_name) + const std::string& query_tensor_name, + const std::string& feature_name) { try { auto qvalue = QueryValue::from_config(query_tensor_name, env.getIndexEnvironment()); @@ -63,7 +63,7 @@ make_distance_calculator(const fef::IQueryEnvironment& env, const search::attribute::IAttributeVector* resolve_attribute_for_field(const fef::IQueryEnvironment& env, uint32_t field_id, - const vespalib::string& feature_name) + const std::string& feature_name) { const auto* field = env.getIndexEnvironment().getField(field_id); if (field != nullptr) { @@ -95,7 +95,7 @@ DistanceCalculatorBundle::Element::~Element() = default; DistanceCalculatorBundle::DistanceCalculatorBundle(const fef::IQueryEnvironment& env, uint32_t field_id, - const vespalib::string& feature_name) + const std::string& feature_name) : _elems(), _min_rawscore(0.0) @@ -120,8 +120,8 @@ DistanceCalculatorBundle::DistanceCalculatorBundle(const fef::IQueryEnvironment& DistanceCalculatorBundle::DistanceCalculatorBundle(const fef::IQueryEnvironment& env, std::optional field_id, - const vespalib::string& label, - const vespalib::string& feature_name) + const std::string& label, + const std::string& feature_name) : _elems(), _min_rawscore(0.0) { @@ -155,7 +155,7 @@ void DistanceCalculatorBundle::prepare_shared_state(const fef::IQueryEnvironment& env, fef::IObjectStore& store, uint32_t field_id, - const vespalib::string& feature_name) + const std::string& feature_name) { for (uint32_t i = 0; i < env.getNumTerms(); ++i) { search::fef::TermFieldHandle handle = util::getTermFieldHandle(env, i, field_id); @@ -171,8 +171,8 @@ DistanceCalculatorBundle::prepare_shared_state(const fef::IQueryEnvironment& env void DistanceCalculatorBundle::prepare_shared_state(const fef::IQueryEnvironment& env, fef::IObjectStore& store, - const vespalib::string& label, - const vespalib::string& feature_name) + const std::string& label, + const std::string& feature_name) { const auto* term = util::getTermByLabel(env, label); if ((term != nullptr) && term->query_tensor_name().has_value()) { diff --git a/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.h b/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.h index a8a6eb93b0eb..86ab5f9e2fa0 100644 --- a/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.h +++ b/searchlib/src/vespa/searchlib/features/distance_calculator_bundle.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include #include namespace search::tensor { class DistanceCalculator; } @@ -39,12 +39,12 @@ class DistanceCalculatorBundle { public: DistanceCalculatorBundle(const fef::IQueryEnvironment& env, uint32_t field_id, - const vespalib::string& feature_name); + const std::string& feature_name); DistanceCalculatorBundle(const fef::IQueryEnvironment& env, std::optional field_id, - const vespalib::string& label, - const vespalib::string& feature_name); + const std::string& label, + const std::string& feature_name); const std::vector& elements() const { return _elems; } @@ -53,12 +53,12 @@ class DistanceCalculatorBundle { static void prepare_shared_state(const fef::IQueryEnvironment& env, fef::IObjectStore& store, uint32_t field_id, - const vespalib::string& feature_name); + const std::string& feature_name); static void prepare_shared_state(const fef::IQueryEnvironment& env, fef::IObjectStore& store, - const vespalib::string& label, - const vespalib::string& feature_name); + const std::string& label, + const std::string& feature_name); }; } diff --git a/searchlib/src/vespa/searchlib/features/distancefeature.cpp b/searchlib/src/vespa/searchlib/features/distancefeature.cpp index 65a764d8b440..ff214cf7169f 100644 --- a/searchlib/src/vespa/searchlib/features/distancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/distancefeature.cpp @@ -33,7 +33,7 @@ class ConvertRawscoreToDistance : public fef::FeatureExecutor { } public: ConvertRawscoreToDistance(const fef::IQueryEnvironment &env, uint32_t fieldId); - ConvertRawscoreToDistance(const fef::IQueryEnvironment &env, const vespalib::string &label); + ConvertRawscoreToDistance(const fef::IQueryEnvironment &env, const std::string &label); void execute(uint32_t docId) override; }; @@ -43,7 +43,7 @@ ConvertRawscoreToDistance::ConvertRawscoreToDistance(const fef::IQueryEnvironmen { } -ConvertRawscoreToDistance::ConvertRawscoreToDistance(const fef::IQueryEnvironment &env, const vespalib::string &label) +ConvertRawscoreToDistance::ConvertRawscoreToDistance(const fef::IQueryEnvironment &env, const std::string &label) : _bundle(env, std::nullopt, label, "distance"), _md(nullptr) { @@ -191,7 +191,7 @@ DistanceBlueprint::createInstance() const } bool -DistanceBlueprint::setup_geopos(const vespalib::string &attr) +DistanceBlueprint::setup_geopos(const std::string &attr) { _attr_name = attr; _use_geo_pos = true; @@ -204,7 +204,7 @@ DistanceBlueprint::setup_geopos(const vespalib::string &attr) } bool -DistanceBlueprint::setup_nns(const vespalib::string &attr) +DistanceBlueprint::setup_nns(const std::string &attr) { _attr_name = attr; _use_nns_tensor = true; @@ -217,7 +217,7 @@ DistanceBlueprint::setup(const IIndexEnvironment & env, const ParameterList & params) { // params[0] = attribute name - vespalib::string arg = params[0].getValue(); + std::string arg = params[0].getValue(); if (params.size() == 2) { // params[0] = field / label // params[1] = attribute name / label value @@ -234,7 +234,7 @@ DistanceBlueprint::setup(const IIndexEnvironment & env, } } _field_name = arg; - vespalib::string z = document::PositionDataType::getZCurveFieldName(arg); + std::string z = document::PositionDataType::getZCurveFieldName(arg); const FieldInfo *fi = env.getFieldByName(z); if (fi != nullptr && fi->hasAttribute()) { // can't check anything here because streaming has wrong information diff --git a/searchlib/src/vespa/searchlib/features/distancefeature.h b/searchlib/src/vespa/searchlib/features/distancefeature.h index 7d5caad482d8..2a84078061c8 100644 --- a/searchlib/src/vespa/searchlib/features/distancefeature.h +++ b/searchlib/src/vespa/searchlib/features/distancefeature.h @@ -23,16 +23,16 @@ class DistanceExecutor { */ class DistanceBlueprint : public fef::Blueprint { private: - vespalib::string _field_name; - vespalib::string _label_name; - vespalib::string _attr_name; + std::string _field_name; + std::string _label_name; + std::string _attr_name; uint32_t _attr_id; bool _use_geo_pos; bool _use_nns_tensor; bool _use_item_label; - bool setup_geopos(const vespalib::string &attr); - bool setup_nns(const vespalib::string &attr); + bool setup_geopos(const std::string &attr); + bool setup_nns(const std::string &attr); public: DistanceBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h index 7f1b11a54f0b..837a5b15bbbe 100644 --- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h +++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h @@ -45,7 +45,7 @@ class DistanceToPathExecutor : public fef::FeatureExecutor { */ class DistanceToPathBlueprint : public fef::Blueprint { private: - vespalib::string _posAttr; // Name of the position attribute. + std::string _posAttr; // Name of the position attribute. public: DistanceToPathBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp index 805775dc644b..cbad69bf49e6 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp @@ -181,7 +181,7 @@ template class SingleDotProductByWeightedValueExecutor final : public fef::FeatureExecutor { public: using WeightedSetReadView = attribute::IWeightedSetReadView; - using StoredKeyType = std::conditional_t,vespalib::string,BaseType>; + using StoredKeyType = std::conditional_t,std::string,BaseType>; SingleDotProductByWeightedValueExecutor(const WeightedSetReadView * weighted_set_read_view, BaseType key, feature_t value) : _weighted_set_read_view(weighted_set_read_view), _key(key), @@ -665,16 +665,16 @@ attemptParseArrayQueryVector(const IAttributeVector & attribute, const Property return std::unique_ptr(); } -vespalib::string -make_queryvector_key(const vespalib::string & base, const vespalib::string & subKey) { - vespalib::string key(base); +std::string +make_queryvector_key(const std::string & base, const std::string & subKey) { + std::string key(base); key.append(".vector."); key.append(subKey); return key; } -const vespalib::string & -make_queryvector_key_for_attribute(const IAttributeVector & attribute, const vespalib::string & key, vespalib::string & scratchPad) { +const std::string & +make_queryvector_key_for_attribute(const IAttributeVector & attribute, const std::string & key, std::string & scratchPad) { if (attribute.hasEnum() && (attribute.getCollectionType() == attribute::CollectionType::WSET)) { scratchPad = key; scratchPad.append(".").append(attribute.getName()); @@ -683,9 +683,9 @@ make_queryvector_key_for_attribute(const IAttributeVector & attribute, const ves return key; } -vespalib::string -make_attribute_key(const vespalib::string & base, const vespalib::string & subKey) { - vespalib::string key(base); +std::string +make_attribute_key(const std::string & base, const std::string & subKey) { + std::string key(base); key.append(".attribute."); key.append(subKey); return key; @@ -709,7 +709,7 @@ namespace { fef::Anything::UP createQueryVector(const IQueryEnvironment & env, const IAttributeVector * attribute, - const vespalib::string & baseName, const vespalib::string & queryVector) + const std::string & baseName, const std::string & queryVector) { fef::Anything::UP arguments; if (attribute->getCollectionType() == attribute::CollectionType::ARRAY) { @@ -779,7 +779,7 @@ DotProductBlueprint::DotProductBlueprint() : DotProductBlueprint::~DotProductBlueprint() = default; -const vespalib::string & +const std::string & DotProductBlueprint::getAttribute(const IQueryEnvironment & env) const { Property prop = env.getProperties().lookup(getBaseName(), _attributeOverride); @@ -828,7 +828,7 @@ DotProductBlueprint::prepareSharedState(const IQueryEnvironment & env, IObjectSt if (queryVector == nullptr) { fef::Anything::UP arguments = createQueryVector(env, attribute, getBaseName(), _queryVector); if (arguments) { - vespalib::string scratchPad; + std::string scratchPad; store.add(make_queryvector_key_for_attribute(*attribute, _queryVectorKey, scratchPad), std::move(arguments)); } } @@ -853,7 +853,7 @@ DotProductBlueprint::createExecutor(const IQueryEnvironment & env, vespalib::Sta getAttribute(env).c_str()); return stash.create(); } - vespalib::string scratchPad; + std::string scratchPad; const fef::Anything * queryVectorArg = env.getObjectStore().get(make_queryvector_key_for_attribute(*attribute, _queryVectorKey, scratchPad)); if (queryVectorArg != nullptr) { return createFromObject(attribute, *queryVectorArg, stash); diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h index 240b3a78327a..f19b90ee77a3 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h @@ -29,8 +29,8 @@ struct Converter { }; template <> -struct Converter { - const char * convert(const vespalib::string & value) const { return value.c_str(); } +struct Converter { + const char * convert(const std::string & value) const { return value.c_str(); } }; template @@ -85,7 +85,7 @@ extern template class IntegerVectorT; using IntegerVector = IntegerVectorT; -using StringVectorBase = VectorBase; +using StringVectorBase = VectorBase; /** * Represents a vector where the dimensions are string values. @@ -245,13 +245,13 @@ class SparseDotProductByArrayReadViewExecutor : public SparseDotProductExecutorB class DotProductBlueprint : public fef::Blueprint { private: using IAttributeVector = attribute::IAttributeVector; - vespalib::string _defaultAttribute; - vespalib::string _attributeOverride; - vespalib::string _queryVector; - vespalib::string _attrKey; - vespalib::string _queryVectorKey; + std::string _defaultAttribute; + std::string _attributeOverride; + std::string _queryVector; + std::string _attrKey; + std::string _queryVectorKey; - const vespalib::string & getAttribute(const fef::IQueryEnvironment & env) const; + const std::string & getAttribute(const fef::IQueryEnvironment & env) const; const IAttributeVector * upgradeIfNecessary(const IAttributeVector * attribute, const fef::IQueryEnvironment & env) const; public: diff --git a/searchlib/src/vespa/searchlib/features/element_completeness_feature.h b/searchlib/src/vespa/searchlib/features/element_completeness_feature.h index aad829500695..670510e5de48 100644 --- a/searchlib/src/vespa/searchlib/features/element_completeness_feature.h +++ b/searchlib/src/vespa/searchlib/features/element_completeness_feature.h @@ -95,7 +95,7 @@ class ElementCompletenessExecutor : public fef::FeatureExecutor class ElementCompletenessBlueprint : public fef::Blueprint { private: - std::vector _output; + std::vector _output; ElementCompletenessParams _params; public: diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp index cceb0e20de51..95ebc71bbe4b 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp @@ -62,7 +62,7 @@ struct SumAggregator : Aggregator { }; Aggregator::UP -create_aggregator(const vespalib::string &name) { +create_aggregator(const std::string &name) { if (name == "max") { return Aggregator::UP(new MaxAggregator()); } @@ -323,16 +323,16 @@ ElementSimilarityExecutor::~ElementSimilarityExecutor() = default; //----------------------------------------------------------------------------- -std::vector > -extract_properties(const fef::Properties &props, const vespalib::string &ns, - const vespalib::string &first_name, const vespalib::string &first_default) +std::vector > +extract_properties(const fef::Properties &props, const std::string &ns, + const std::string &first_name, const std::string &first_default) { struct MyVisitor : fef::IPropertiesVisitor { - const vespalib::string &first_name; - std::vector > &result; + const std::string &first_name; + std::vector > &result; - MyVisitor(const vespalib::string &first_name_in, - std::vector > &result_in) + MyVisitor(const std::string &first_name_in, + std::vector > &result_in) : first_name(first_name_in), result(result_in) {} @@ -342,15 +342,15 @@ extract_properties(const fef::Properties &props, const vespalib::string &ns, } } }; - std::vector > result; + std::vector > result; result.emplace_back(first_name, props.lookup(ns, first_name).get(first_default)); MyVisitor my_visitor(first_name, result); props.visitNamespace(ns, my_visitor); return result; } -std::vector > -get_outputs(const fef::Properties &props, const vespalib::string &feature) { +std::vector > +get_outputs(const fef::Properties &props, const std::string &feature) { return extract_properties(props, feature + ".output", "default", "max((0.35*p+0.15*o+0.30*q+0.20*f)*w)"); } @@ -407,9 +407,9 @@ ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, const fef:: auto outputs = get_outputs(env.getProperties(), fnb.buildName()); for (const auto &entry: outputs) { describeOutput(entry.first, entry.second); - vespalib::string aggr_name; - vespalib::string expr; - vespalib::string error; + std::string aggr_name; + std::string expr; + std::string error; if (!vespalib::eval::Function::unwrap(entry.second, aggr_name, expr, error)) { LOG(warning, "'%s': could not extract aggregator and expression for output '%s' from config value '%s' (%s)", @@ -421,7 +421,7 @@ ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, const fef:: LOG(warning, "'%s': unknown aggregator '%s'", fnb.buildName().c_str(), aggr_name.c_str()); return false; } - std::vector args({"p", "o", "q", "f", "w"}); + std::vector args({"p", "o", "q", "f", "w"}); auto function = vespalib::eval::Function::parse(args, expr); if (function->has_error()) { LOG(warning, "'%s': per-element expression parse error: %s", diff --git a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h index 387b5ab2aabb..8a70260661b8 100644 --- a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h +++ b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h @@ -36,8 +36,8 @@ class EuclideanDistanceExecutor : public fef::FeatureExecutor { */ class EuclideanDistanceBlueprint : public fef::Blueprint { private: - vespalib::string _attributeName; - vespalib::string _queryVector; + std::string _attributeName; + std::string _queryVector; public: EuclideanDistanceBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp b/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp index a937b3d4b41c..613c5377683a 100644 --- a/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp @@ -169,7 +169,7 @@ FieldInfoBlueprint::setup(const fef::IIndexEnvironment &indexEnv, return true; } if (params.size() == 1) { - vespalib::string name = params[0].getValue(); + std::string name = params[0].getValue(); const fef::FieldInfo *fi = indexEnv.getFieldByName(name); if (fi != 0) { _fieldId = fi->id(); diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp index 9f76da54d341..e19d77a5122d 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp @@ -225,7 +225,7 @@ Computer::fieldIndexToSemanticDistance(int j, uint32_t zeroJ) const } } -vespalib::string +std::string Computer::toString() const { return vespalib::make_string("Computer(%d query terms,%d field terms,%s)", diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.h b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.h index 90e12645666c..ad798f63e675 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.h @@ -204,7 +204,7 @@ class Computer { * * @return A string representation. */ - vespalib::string toString() const; + std::string toString() const; /** * Returns the simple metrics computed while traversing the list of query terms in the constructor. diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp index 03758dc46bc4..7edd41abfe75 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp @@ -12,7 +12,7 @@ using namespace search::fef; namespace search::features::fieldmatch { -ComputerSharedState::ComputerSharedState(const vespalib::string& propertyNamespace, const PhraseSplitterQueryEnv& splitter_query_env, +ComputerSharedState::ComputerSharedState(const std::string& propertyNamespace, const PhraseSplitterQueryEnv& splitter_query_env, const FieldInfo& fieldInfo, const Params& params) : _field_id(fieldInfo.id()), _params(params), diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h index 39564f6126f0..bc8643b7aa64 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h @@ -22,7 +22,7 @@ class ComputerSharedState { * @param fieldInfo The info object of the matched field. * @param params The parameter object for this computer. */ - ComputerSharedState(const vespalib::string& propertyNamespace, const fef::PhraseSplitterQueryEnv& splitter_query_env, + ComputerSharedState(const std::string& propertyNamespace, const fef::PhraseSplitterQueryEnv& splitter_query_env, const fef::FieldInfo& fieldInfo, const Params& params); ~ComputerSharedState(); diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp index 371a94341f98..02cef6be3e11 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp @@ -329,7 +329,7 @@ Metrics::onNewSegment(uint32_t, uint32_t j, uint32_t) _segmentStarts.push_back(j); } -vespalib::string +std::string Metrics::toString() const { return vespalib::make_string("Metrics(match %f)", getMatch()); diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h index ddec235d032e..f67fbd830384 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h @@ -2,9 +2,9 @@ #pragma once #include -#include -#include #include +#include +#include namespace search::features::fieldmatch { @@ -523,7 +523,7 @@ class Metrics { * * @return A string representation. */ - vespalib::string toString() const; + std::string toString() const; private: const Computer *_source; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp index 6a2bacda3cc2..f9245b53191a 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp @@ -63,7 +63,7 @@ SegmentStart::offerHistory(int previousJ, const Metrics & metrics) return true; // accept } -vespalib::string +std::string SegmentStart::toString() { if (_i == _owner->getNumQueryTerms()) { return vespalib::make_string("Last segment: Complete match %f, previous j %d (%s).", diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.h b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.h index c62656aa6e00..2f91424fa529 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include "metrics.h" +#include +#include namespace search::features::fieldmatch { @@ -164,7 +164,7 @@ class SegmentStart { * * @return A string representation. */ - vespalib::string toString(); + std::string toString(); private: Computer *_owner; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp index 0989c39a3d28..9955ef901122 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp @@ -17,7 +17,7 @@ SimpleMetrics::SimpleMetrics(const Params & params) : { } -vespalib::string SimpleMetrics::toString() const +std::string SimpleMetrics::toString() const { vespalib::asciistream ss; ss << "matches(" << _matches << "), matchedWithPosOcc(" << _matchesWithPosOcc << "), "; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.h b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.h index 86a82787552d..ce0ff690759f 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include "params.h" +#include namespace search::features::fieldmatch { @@ -175,7 +175,7 @@ class SimpleMetrics { * * @return String representation. **/ - vespalib::string toString() const; + std::string toString() const; }; } diff --git a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h index 756cb98e3ea8..34992276001d 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h @@ -13,7 +13,7 @@ namespace search::features { class FieldMatchBlueprint : public fef::Blueprint { private: const fef::FieldInfo * _field; - vespalib::string _shared_state_key; + std::string _shared_state_key; fieldmatch::Params _params; public: diff --git a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp index 8ce0188fa510..1cd24a4cae62 100644 --- a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp @@ -83,13 +83,13 @@ FieldTermMatchBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment search::fef::IDumpFeatureVisitor &visitor) const { const search::fef::Properties &props = env.getProperties(); - const vespalib::string &baseName = getBaseName(); + const std::string &baseName = getBaseName(); int baseNumTerms = atoi(props.lookup(baseName, "numTerms").get("5").c_str()); for (uint32_t i = 0; i < env.getNumFields(); ++i) { const search::fef::FieldInfo& field = *env.getField(i); if (field.type() == search::fef::FieldType::INDEX) { - const vespalib::string &fieldName = field.name(); + const std::string &fieldName = field.name(); const search::fef::Property &prop = props.lookup(baseName, "numTerms", fieldName); int numTerms = prop.found() ? atoi(prop.get().c_str()) : baseNumTerms; for (int term = 0; term < numTerms; ++term) { diff --git a/searchlib/src/vespa/searchlib/features/first_phase_rank_lookup.cpp b/searchlib/src/vespa/searchlib/features/first_phase_rank_lookup.cpp index 2dfaabb83262..16a8baceb6cc 100644 --- a/searchlib/src/vespa/searchlib/features/first_phase_rank_lookup.cpp +++ b/searchlib/src/vespa/searchlib/features/first_phase_rank_lookup.cpp @@ -11,7 +11,7 @@ namespace search::features { namespace { -const vespalib::string key = "firstPhaseRankLookup"; +const std::string key = "firstPhaseRankLookup"; } diff --git a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h index 02d843ffe048..35f623f8544d 100644 --- a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h +++ b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h @@ -76,7 +76,7 @@ class FlowCompletenessExecutor : public fef::FeatureExecutor class FlowCompletenessBlueprint : public fef::Blueprint { private: - std::vector _output; + std::vector _output; FlowCompletenessParams _params; public: diff --git a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp index 45847bc32b6c..85f9fe974483 100644 --- a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp @@ -41,7 +41,7 @@ ForeachExecutor::execute(uint32_t) bool -ForeachBlueprint::decideDimension(const vespalib::string & param) +ForeachBlueprint::decideDimension(const std::string & param) { if (param == "terms") { _dimension = TERMS; @@ -58,7 +58,7 @@ ForeachBlueprint::decideDimension(const vespalib::string & param) } bool -ForeachBlueprint::decideCondition(const vespalib::string & condition, const vespalib::string & operation) +ForeachBlueprint::decideCondition(const std::string & condition, const std::string & operation) { if (condition == "true") { return decideOperation(TrueCondition(), operation); @@ -75,7 +75,7 @@ ForeachBlueprint::decideCondition(const vespalib::string & condition, const vesp template bool -ForeachBlueprint::decideOperation(CO condition, const vespalib::string & operation) +ForeachBlueprint::decideOperation(CO condition, const std::string & operation) { if (operation == "sum") { setExecutorCreator(condition); @@ -140,8 +140,8 @@ ForeachBlueprint::setup(const IIndexEnvironment & env, return false; } - const vespalib::string & variable = params[1].getValue(); - const vespalib::string & feature = params[2].getValue(); + const std::string & variable = params[1].getValue(); + const std::string & feature = params[2].getValue(); if (_dimension == TERMS) { uint32_t maxTerms = util::strToNum(env.getProperties().lookup(getBaseName(), "maxTerms").get("16")); diff --git a/searchlib/src/vespa/searchlib/features/foreachfeature.h b/searchlib/src/vespa/searchlib/features/foreachfeature.h index 1b9d26b3b3a3..bffd68bc26dc 100644 --- a/searchlib/src/vespa/searchlib/features/foreachfeature.h +++ b/searchlib/src/vespa/searchlib/features/foreachfeature.h @@ -142,10 +142,10 @@ class ForeachBlueprint : public fef::Blueprint { std::unique_ptr _executorCreator; size_t _num_inputs; - bool decideDimension(const vespalib::string & param); - bool decideCondition(const vespalib::string & condition, const vespalib::string & operation); + bool decideDimension(const std::string & param); + bool decideCondition(const std::string & condition, const std::string & operation); template - bool decideOperation(CO condition, const vespalib::string & operation); + bool decideOperation(CO condition, const std::string & operation); template void setExecutorCreator(CO condition); diff --git a/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.cpp b/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.cpp index d59a7e66d471..3169947e3470 100644 --- a/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.cpp @@ -96,7 +96,7 @@ GreatCircleDistanceBlueprint::createInstance() const } bool -GreatCircleDistanceBlueprint::setup_geopos(const vespalib::string &attr) +GreatCircleDistanceBlueprint::setup_geopos(const std::string &attr) { _attr_name = attr; describeOutput("km", "The distance (in km) from the query position."); @@ -125,7 +125,7 @@ GreatCircleDistanceBlueprint::setup(const IIndexEnvironment & env, LOG(error, "Wants 2 parameters, but got %zd", params.size()); return false; } - vespalib::string z = document::PositionDataType::getZCurveFieldName(_field_name); + std::string z = document::PositionDataType::getZCurveFieldName(_field_name); const auto *fi = env.getFieldByName(z); if (fi != nullptr && fi->hasAttribute()) { auto dt = fi->get_data_type(); diff --git a/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.h b/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.h index f079429622e4..6579fbc3d42c 100644 --- a/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.h +++ b/searchlib/src/vespa/searchlib/features/great_circle_distance_feature.h @@ -39,9 +39,9 @@ class GCDExecutor : public fef::FeatureExecutor { */ class GreatCircleDistanceBlueprint : public fef::Blueprint { private: - vespalib::string _field_name; - vespalib::string _attr_name; - bool setup_geopos(const vespalib::string &attr); + std::string _field_name; + std::string _attr_name; + bool setup_geopos(const std::string &attr); public: GreatCircleDistanceBlueprint(); ~GreatCircleDistanceBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp index e7592707bb64..0d5e139fd4be 100644 --- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp @@ -173,9 +173,9 @@ selectExecutor(const IAttributeVector *attribute, V && vector, vespalib::Stash & return stash.create(); } -vespalib::string -make_queryvector_key(const vespalib::string & base, const vespalib::string & subKey) { - vespalib::string key(base); +std::string +make_queryvector_key(const std::string & base, const std::string & subKey) { + std::string key(base); key.append(".vector."); key.append(subKey); return key; diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.h b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.h index ce38521325c5..2b334eff2686 100644 --- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.h +++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.h @@ -24,10 +24,10 @@ namespace search::features { */ class InternalMaxReduceProdJoinBlueprint : public fef::Blueprint { private: - vespalib::string _attribute; - vespalib::string _queryVector; - vespalib::string _attrKey; - vespalib::string _queryVectorKey; + std::string _attribute; + std::string _queryVector; + std::string _attrKey; + std::string _queryVectorKey; public: InternalMaxReduceProdJoinBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp index d370e293456f..c4bac4d48f09 100644 --- a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp @@ -75,7 +75,7 @@ ItemRawScoreBlueprint::createExecutor(const IQueryEnvironment &queryEnv, vespali ItemRawScoreBlueprint::HandleVector ItemRawScoreBlueprint::resolve(const IQueryEnvironment &env, - const vespalib::string &label) + const std::string &label) { HandleVector handles; const ITermData *term = util::getTermByLabel(env, label); diff --git a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h index eb2deb762f3e..85613b25b8ef 100644 --- a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h +++ b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h @@ -43,7 +43,7 @@ class ItemRawScoreBlueprint : public fef::Blueprint { private: using HandleVector = std::vector; - vespalib::string _label; + std::string _label; public: ItemRawScoreBlueprint() : Blueprint("itemRawScore"), _label() {} ~ItemRawScoreBlueprint() override; @@ -57,7 +57,7 @@ class ItemRawScoreBlueprint : public fef::Blueprint bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; - static HandleVector resolve(const fef::IQueryEnvironment &env, const vespalib::string &label); + static HandleVector resolve(const fef::IQueryEnvironment &env, const std::string &label); }; } diff --git a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp index 7ed92328a4b7..e36c8cd72781 100644 --- a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp @@ -155,10 +155,10 @@ JaroWinklerDistanceBlueprint::setup(const search::fef::IIndexEnvironment &env, { _config.fieldId = params[0].asField()->id(); - vespalib::string boostThreshold = env.getProperties().lookup(getName(), "boostThreshold").getAt(0); + std::string boostThreshold = env.getProperties().lookup(getName(), "boostThreshold").getAt(0); _config.boostThreshold = boostThreshold.empty() ? 0.7f : vespalib::locale::c::atof(boostThreshold.c_str()); - vespalib::string prefixSize = env.getProperties().lookup(getName(), "prefixSize").getAt(0); + std::string prefixSize = env.getProperties().lookup(getName(), "prefixSize").getAt(0); _config.prefixSize = prefixSize.empty() ? 4 : atoi(prefixSize.c_str()); defineInput(vespalib::make_string("fieldLength(%s)", params[0].getValue().c_str())); diff --git a/searchlib/src/vespa/searchlib/features/max_reduce_prod_join_replacer.cpp b/searchlib/src/vespa/searchlib/features/max_reduce_prod_join_replacer.cpp index 009fb2e72b58..04fbfa30dffd 100644 --- a/searchlib/src/vespa/searchlib/features/max_reduce_prod_join_replacer.cpp +++ b/searchlib/src/vespa/searchlib/features/max_reduce_prod_join_replacer.cpp @@ -56,7 +56,7 @@ bool match_prod_join(const Node &node) { return false; } -bool match_max_reduce(const Node &node, vespalib::string &reduce_dim) { +bool match_max_reduce(const Node &node, std::string &reduce_dim) { auto reduce = as(node); if (!reduce || (reduce->aggr() != Aggr::MAX) || (reduce->dimensions().size() > 1)) { return false; @@ -67,7 +67,7 @@ bool match_max_reduce(const Node &node, vespalib::string &reduce_dim) { return true; } -bool match_function(const Function &function, vespalib::string &reduce_dim) { +bool match_function(const Function &function, std::string &reduce_dim) { const Node &expect_max = function.root(); if ((function.num_params() == 2) && match_max_reduce(expect_max, reduce_dim)) { const Node &expect_mul = expect_max.get_child(0); @@ -78,17 +78,17 @@ bool match_function(const Function &function, vespalib::string &reduce_dim) { return false; } -void try_extract_param(const vespalib::string &feature, const vespalib::string &wanted_wrapper, - vespalib::string ¶m, vespalib::string &dim) +void try_extract_param(const std::string &feature, const std::string &wanted_wrapper, + std::string ¶m, std::string &dim) { FeatureNameParser parser(feature); if (parser.valid() && (parser.parameters().size() >= 1) && (parser.parameters().size() <= 2)) { - vespalib::string wrapper; - vespalib::string body; - vespalib::string error; + std::string wrapper; + std::string body; + std::string error; if (Function::unwrap(parser.parameters()[0], wrapper, body, error) && (wrapper == wanted_wrapper)) { @@ -103,12 +103,12 @@ void try_extract_param(const vespalib::string &feature, const vespalib::string & } struct MatchInputs { - vespalib::string attribute; - vespalib::string attribute_dim; - vespalib::string query; - vespalib::string query_dim; + std::string attribute; + std::string attribute_dim; + std::string query; + std::string query_dim; MatchInputs() : attribute(), attribute_dim(), query(), query_dim() {} - void process(const vespalib::string ¶m) { + void process(const std::string ¶m) { if (param.starts_with("tensorFromLabels")) { try_extract_param(param, "attribute", attribute, attribute_dim); } else if (param.starts_with("tensorFromWeightedSet")) { @@ -127,7 +127,7 @@ struct MaxReduceProdJoinReplacerImpl : ExpressionReplacer { IntrinsicExpression::UP maybe_replace(const Function &function, const IIndexEnvironment &env) const override { - vespalib::string reduce_dim; + std::string reduce_dim; if (match_function(function, reduce_dim)) { MatchInputs match_inputs; match_inputs.process(function.param_name(0)); diff --git a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp index e0282ac97553..8027a4ceb5d3 100644 --- a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp @@ -100,8 +100,8 @@ NativeAttributeMatchBlueprint::NativeAttributeMatchBlueprint() : } namespace { -const vespalib::string DefaultWeightTable = "linear(1,0)"; -const vespalib::string WeightTableName = "weightTable"; +const std::string DefaultWeightTable = "linear(1,0)"; +const std::string WeightTableName = "weightTable"; } void diff --git a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp index 8d838d626a7e..970193b8842b 100644 --- a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp @@ -137,7 +137,7 @@ NativeFieldMatchBlueprint::setup(const IIndexEnvironment & env, vespalib::asciistream shared_state_key_builder; _params.resize(env.getNumFields()); FieldWrapper fields(env, params, FieldType::INDEX); - vespalib::string defaultFirstOccImportance = env.getProperties().lookup(getBaseName(), "firstOccurrenceImportance").get("0.5"); + std::string defaultFirstOccImportance = env.getProperties().lookup(getBaseName(), "firstOccurrenceImportance").get("0.5"); shared_state_key_builder << "fef.nativeFieldMatch["; bool first_field = true; for (uint32_t i = 0; i < fields.getNumFields(); ++i) { diff --git a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h index d30d45f2c165..ab680e797fbb 100644 --- a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h @@ -111,9 +111,9 @@ class NativeFieldMatchExecutor : public fef::FeatureExecutor class NativeFieldMatchBlueprint : public fef::Blueprint { private: NativeFieldMatchParams _params; - vespalib::string _defaultFirstOcc; - vespalib::string _defaultNumOcc; - vespalib::string _shared_state_key; + std::string _defaultFirstOcc; + std::string _defaultNumOcc; + std::string _shared_state_key; public: NativeFieldMatchBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp index 3f3e019b4ae1..cfa7913d9367 100644 --- a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp @@ -176,7 +176,7 @@ NativeProximityBlueprint::setup(const IIndexEnvironment & env, _params.resize(env.getNumFields()); _params.slidingWindow = util::strToNum(env.getProperties().lookup(getBaseName(), "slidingWindowSize").get("4")); FieldWrapper fields(env, params, FieldType::INDEX); - vespalib::string defaultProximityImportance = env.getProperties().lookup(getBaseName(), "proximityImportance").get("0.5"); + std::string defaultProximityImportance = env.getProperties().lookup(getBaseName(), "proximityImportance").get("0.5"); shared_state_key_builder << "fef.nativeProximity["; bool first_field = true; for (uint32_t i = 0; i < fields.getNumFields(); ++i) { diff --git a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h index 2bed9a37b2fc..3bc61270e935 100644 --- a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h @@ -100,9 +100,9 @@ class NativeProximityExecutor : public fef::FeatureExecutor { class NativeProximityBlueprint : public fef::Blueprint { private: NativeProximityParams _params; - vespalib::string _defaultProximityBoost; - vespalib::string _defaultRevProximityBoost; - vespalib::string _shared_state_key; + std::string _defaultProximityBoost; + std::string _defaultRevProximityBoost; + std::string _shared_state_key; public: NativeProximityBlueprint(); diff --git a/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp b/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp index 9b3e52448857..81c9a1373394 100644 --- a/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp @@ -14,8 +14,8 @@ using namespace search::fef; namespace { -vespalib::string -buildFeatureName(const vespalib::string & baseName, const search::features::FieldWrapper & fields) +std::string +buildFeatureName(const std::string & baseName, const search::features::FieldWrapper & fields) { std::ostringstream oss; oss << baseName << "("; @@ -104,17 +104,17 @@ NativeRankBlueprint::setup(const IIndexEnvironment & env, (env.getProperties().lookup(getBaseName(), "fieldMatchWeight").get("100")); _params.attributeMatchWeight = util::strToNum (env.getProperties().lookup(getBaseName(), "attributeMatchWeight").get("100")); - vespalib::string defProxWeight = "25"; + std::string defProxWeight = "25"; if (!useTableNormalization(env)) { defProxWeight = "100"; // must use another weight to match the default boost tables } _params.proximityWeight = util::strToNum (env.getProperties().lookup(getBaseName(), "proximityWeight").get(defProxWeight)); - vespalib::string nfm = "nativeFieldMatch"; - vespalib::string np = "nativeProximity"; - vespalib::string nam = "nativeAttributeMatch"; - vespalib::string zero = "value(0)"; + std::string nfm = "nativeFieldMatch"; + std::string np = "nativeProximity"; + std::string nam = "nativeAttributeMatch"; + std::string zero = "value(0)"; // handle parameter list if (!params.empty()) { @@ -165,7 +165,7 @@ bool NativeRankBlueprint::useTableNormalization(const search::fef::IIndexEnvironment & env) { Property norm = env.getProperties().lookup("nativeRank", "useTableNormalization"); - return (!(norm.found() && (norm.get() == vespalib::string("false")))); + return (!(norm.found() && (norm.get() == std::string("false")))); } } diff --git a/searchlib/src/vespa/searchlib/features/onnx_feature.cpp b/searchlib/src/vespa/searchlib/features/onnx_feature.cpp index cedf9a055038..b43d98e5f5d3 100644 --- a/searchlib/src/vespa/searchlib/features/onnx_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/onnx_feature.cpp @@ -36,8 +36,8 @@ namespace search::features { namespace { -vespalib::string normalize_name(const vespalib::string &name, const char *context) { - vespalib::string result; +std::string normalize_name(const std::string &name, const char *context) { + std::string result; for (char c : name) { if (std::isalnum(static_cast(c))) { result.push_back(c); @@ -51,8 +51,8 @@ vespalib::string normalize_name(const vespalib::string &name, const char *contex return result; } -vespalib::string my_dry_run(const Onnx &model, const Onnx::WireInfo &wire) { - vespalib::string error_msg; +std::string my_dry_run(const Onnx &model, const Onnx::WireInfo &wire) { + std::string error_msg; try { Onnx::EvalContext context(model, wire); std::vector inputs; diff --git a/searchlib/src/vespa/searchlib/features/queryterm.cpp b/searchlib/src/vespa/searchlib/features/queryterm.cpp index 21ec40d3a81d..c55315f923dd 100644 --- a/searchlib/src/vespa/searchlib/features/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/features/queryterm.cpp @@ -33,7 +33,7 @@ QueryTermHelper::QueryTermHelper(const IQueryEnvironment &env) namespace { using QueryTermVectorWrapper = AnyWrapper; -const vespalib::string QUERY_TERMS_KEY("querytermhelper.queryterms"); +const std::string QUERY_TERMS_KEY("querytermhelper.queryterms"); } const QueryTermVector & diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp index 5d78a70415e5..aa10eed753ae 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp +++ b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp @@ -27,7 +27,7 @@ struct IntrinsicBlueprint : IntrinsicExpression { FeatureType type; IntrinsicBlueprint(Blueprint::UP blueprint_in, const FeatureType &type_in) : blueprint(std::move(blueprint_in)), type(type_in) {} - vespalib::string describe_self() const override { return blueprint->getName(); } + std::string describe_self() const override { return blueprint->getName(); } const FeatureType &result_type() const override { return type; } void prepare_shared_state(const QueryEnv & env, fef::IObjectStore & store) const override { blueprint->prepareSharedState(env, store); @@ -42,15 +42,15 @@ struct ResultTypeExtractor : Blueprint::DependencyHandler { bool too_much; bool failed; ResultTypeExtractor() : result_type(), too_much(false), failed(false) {} - std::optional resolve_input(const vespalib::string &, Blueprint::AcceptInput) override { + std::optional resolve_input(const std::string &, Blueprint::AcceptInput) override { too_much = true; return std::nullopt; } - void define_output(const vespalib::string &, FeatureType type) override { + void define_output(const std::string &, FeatureType type) override { too_much = (too_much || result_type.has_value()); result_type.emplace(std::move(type)); } - void fail(const vespalib::string &) override { failed = true; } + void fail(const std::string &) override { failed = true; } bool valid() const { return (is_valid(result_type) && !too_much && !failed); } const FeatureType &get() const { return result_type.value(); } }; @@ -60,7 +60,7 @@ struct ResultTypeExtractor : Blueprint::DependencyHandler { IntrinsicExpression::UP IntrinsicBlueprintAdapter::try_create(const search::fef::Blueprint &proto, const search::fef::IIndexEnvironment &env, - const std::vector ¶ms) + const std::vector ¶ms) { FeatureNameBuilder name_builder; ResultTypeExtractor result_type; diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.h b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.h index 44bc0635e502..5a6a7e961098 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.h +++ b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.h @@ -3,7 +3,7 @@ #pragma once #include "intrinsic_expression.h" -#include +#include #include namespace search::fef { class Blueprint; } @@ -19,7 +19,7 @@ struct IntrinsicBlueprintAdapter { static IntrinsicExpression::UP try_create(const search::fef::Blueprint &proto, const search::fef::IIndexEnvironment &env, - const std::vector ¶ms); + const std::vector ¶ms); }; } // namespace search::features::rankingexpression diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h index c7bcdb5540dc..5c9d23deca5d 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h +++ b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace vespalib { class Stash; } @@ -25,7 +25,7 @@ struct IntrinsicExpression { using FeatureExecutor = search::fef::FeatureExecutor; using QueryEnv = search::fef::IQueryEnvironment; using UP = std::unique_ptr; - virtual vespalib::string describe_self() const = 0; + virtual std::string describe_self() const = 0; virtual const FeatureType &result_type() const = 0; virtual void prepare_shared_state(const QueryEnv & env, fef::IObjectStore & store) const = 0; virtual FeatureExecutor &create_executor(const QueryEnv &queryEnv, vespalib::Stash &stash) const = 0; diff --git a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp index 4eee57bc3a27..d9a9fe994fc3 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp @@ -30,8 +30,8 @@ namespace search::features { namespace { -vespalib::string list_issues(const std::vector &issues) { - vespalib::string result; +std::string list_issues(const std::vector &issues) { + std::string result; for (const auto &issue: issues) { result += vespalib::make_string(" issue: %s\n", issue.c_str()); } @@ -276,7 +276,7 @@ RankingExpressionBlueprint::setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) { // Retrieve and concatenate whatever config is available. - vespalib::string script = ""; + std::string script = ""; fef::Property property = env.getProperties().lookup(getName(), "rankingScript"); fef::Property expr_name = env.getProperties().lookup(getName(), "expressionName"); if (property.size() > 0) { diff --git a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h index 38cfd8c58158..92819d15e7dd 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace search::tensor { class ITensorAttribute; } namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp index 2a362f5faf96..c738f021d7cd 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp @@ -12,13 +12,13 @@ using vespalib::eval::Function; namespace search { namespace features { -vespalib::string TensorFactoryBlueprint::ATTRIBUTE_SOURCE = "attribute"; -vespalib::string TensorFactoryBlueprint::QUERY_SOURCE = "query"; +std::string TensorFactoryBlueprint::ATTRIBUTE_SOURCE = "attribute"; +std::string TensorFactoryBlueprint::QUERY_SOURCE = "query"; bool -TensorFactoryBlueprint::extractSource(const vespalib::string &source) +TensorFactoryBlueprint::extractSource(const std::string &source) { - vespalib::string error; + std::string error; bool unwrapOk = Function::unwrap(source, _sourceType, _sourceParam, error); if (!unwrapOk) { LOG(error, "Failed to extract source param: '%s'", error.c_str()); @@ -32,7 +32,7 @@ TensorFactoryBlueprint::extractSource(const vespalib::string &source) return true; } -TensorFactoryBlueprint::TensorFactoryBlueprint(const vespalib::string &baseName) +TensorFactoryBlueprint::TensorFactoryBlueprint(const std::string &baseName) : Blueprint(baseName), _sourceType(), _sourceParam(), diff --git a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h index 71f3699db9ce..a93ddf798bdb 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h +++ b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include namespace search::features { @@ -14,16 +14,16 @@ namespace search::features { class TensorFactoryBlueprint : public fef::Blueprint { protected: - static vespalib::string ATTRIBUTE_SOURCE; - static vespalib::string QUERY_SOURCE; + static std::string ATTRIBUTE_SOURCE; + static std::string QUERY_SOURCE; - vespalib::string _sourceType; - vespalib::string _sourceParam; - vespalib::string _dimension; + std::string _sourceType; + std::string _sourceParam; + std::string _dimension; vespalib::eval::ValueType _valueType; - bool extractSource(const vespalib::string &source); - TensorFactoryBlueprint(const vespalib::string &baseName); + bool extractSource(const std::string &source); + TensorFactoryBlueprint(const std::string &baseName); ~TensorFactoryBlueprint(); public: diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h index b610e81a7afc..68a4a7d6bd60 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include using vespalib::eval::FastValueBuilderFactory; using vespalib::eval::CellType; @@ -49,7 +49,7 @@ TensorFromAttributeExecutor::execute(uint32_t docId) auto factory = FastValueBuilderFactory::get(); auto builder = factory.create_value_builder(_type, 1, 1, _attrBuffer.size()); for (size_t i = 0; i < _attrBuffer.size(); ++i) { - vespalib::string label(_attrBuffer[i].value()); + std::string label(_attrBuffer[i].value()); _addr_ref.clear(); _addr_ref.push_back(label); auto cell_array = builder->add_subspace(_addr_ref); diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp index 6d397c75ebf6..b1acafb3c163 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp @@ -64,7 +64,7 @@ namespace { FeatureExecutor & createAttributeExecutor(const search::fef::IQueryEnvironment &env, - const vespalib::string &attrName, + const std::string &attrName, const ValueType &valueType, vespalib::Stash &stash) { @@ -99,13 +99,13 @@ createAttributeExecutor(const search::fef::IQueryEnvironment &env, FeatureExecutor & createQueryExecutor(const search::fef::IQueryEnvironment &env, - const vespalib::string &queryKey, + const std::string &queryKey, const ValueType &valueType, vespalib::Stash &stash) { search::fef::Property prop = env.getProperties().lookup(queryKey); if (prop.found() && !prop.get().empty()) { - std::vector vector; + std::vector vector; ArrayParser::parse(prop.get(), vector); auto factory = FastValueBuilderFactory::get(); auto builder = factory.create_value_builder(valueType, 1, 1, vector.size()); diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp index e1b14eb9d9c4..ac60f67e8068 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp @@ -33,7 +33,7 @@ namespace { struct WeightedStringVector { std::vector _data; - void insert(vespalib::string key, std::string_view weight) { + void insert(std::string key, std::string_view weight) { _data.emplace_back(std::move(key), util::strToNum(weight)); } }; @@ -76,7 +76,7 @@ namespace { FeatureExecutor & createAttributeExecutor(const search::fef::IQueryEnvironment &env, - const vespalib::string &attrName, + const std::string &attrName, const ValueType &valueType, vespalib::Stash &stash) { @@ -105,7 +105,7 @@ createAttributeExecutor(const search::fef::IQueryEnvironment &env, FeatureExecutor & createQueryExecutor(const search::fef::IQueryEnvironment &env, - const vespalib::string &queryKey, + const std::string &queryKey, const ValueType &valueType, vespalib::Stash &stash) { diff --git a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp index 795d27ae3919..0c61d2778584 100644 --- a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp @@ -167,7 +167,7 @@ void TermEditDistanceExecutor::logRow(const std::vector &row, size_t numCols) { if (LOG_WOULD_LOG(info)) { - vespalib::string str = "[ "; + std::string str = "[ "; for (size_t i = 0; i < numCols; ++i) { str.append(vespalib::make_string("%5.2f", row[i].cost)); if (i < numCols - 1) { @@ -202,11 +202,11 @@ TermEditDistanceBlueprint::setup(const search::fef::IIndexEnvironment &env, { _config.fieldId = params[0].asField()->id(); - vespalib::string costDel = env.getProperties().lookup(getName(), "costDel").getAt(0); + std::string costDel = env.getProperties().lookup(getName(), "costDel").getAt(0); _config.costDel = costDel.empty() ? 1.0f : vespalib::locale::c::atof(costDel.c_str()); - vespalib::string costIns = env.getProperties().lookup(getName(), "costIns").getAt(0); + std::string costIns = env.getProperties().lookup(getName(), "costIns").getAt(0); _config.costIns = costIns.empty() ? 1.0f : vespalib::locale::c::atof(costIns.c_str()); - vespalib::string costSub = env.getProperties().lookup(getName(), "costSub").getAt(0); + std::string costSub = env.getProperties().lookup(getName(), "costSub").getAt(0); _config.costSub = costSub.empty() ? 1.0f : vespalib::locale::c::atof(costSub.c_str()); defineInput(vespalib::make_string("fieldLength(%s)", params[0].getValue().c_str())); diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp index 98b14d1b445d..6c1989600c49 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp @@ -163,11 +163,11 @@ TextSimilarityExecutor::handle_bind_match_data(const fef::MatchData &md) //----------------------------------------------------------------------------- -const vespalib::string TextSimilarityBlueprint::score_output("score"); -const vespalib::string TextSimilarityBlueprint::proximity_output("proximity"); -const vespalib::string TextSimilarityBlueprint::order_output("order"); -const vespalib::string TextSimilarityBlueprint::query_coverage_output("queryCoverage"); -const vespalib::string TextSimilarityBlueprint::field_coverage_output("fieldCoverage"); +const std::string TextSimilarityBlueprint::score_output("score"); +const std::string TextSimilarityBlueprint::proximity_output("proximity"); +const std::string TextSimilarityBlueprint::order_output("order"); +const std::string TextSimilarityBlueprint::query_coverage_output("queryCoverage"); +const std::string TextSimilarityBlueprint::field_coverage_output("fieldCoverage"); TextSimilarityBlueprint::TextSimilarityBlueprint() : Blueprint("textSimilarity"), _field_id(fef::IllegalHandle) {} diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h index 9cc93b8c860b..d48c63c6a4b8 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h @@ -47,11 +47,11 @@ class TextSimilarityExecutor : public fef::FeatureExecutor class TextSimilarityBlueprint : public fef::Blueprint { private: - static const vespalib::string score_output; - static const vespalib::string proximity_output; - static const vespalib::string order_output; - static const vespalib::string query_coverage_output; - static const vespalib::string field_coverage_output; + static const std::string score_output; + static const std::string proximity_output; + static const std::string order_output; + static const std::string query_coverage_output; + static const std::string field_coverage_output; uint32_t _field_id; diff --git a/searchlib/src/vespa/searchlib/features/utils.cpp b/searchlib/src/vespa/searchlib/features/utils.cpp index 6565232f477b..63c6bdd4043b 100644 --- a/searchlib/src/vespa/searchlib/features/utils.cpp +++ b/searchlib/src/vespa/searchlib/features/utils.cpp @@ -147,11 +147,11 @@ calculate_legacy_significance(const ITermData& termData) } const search::fef::Table * -lookupTable(const search::fef::IIndexEnvironment & env, const vespalib::string & featureName, - const vespalib::string & table, const vespalib::string & fieldName, const vespalib::string & fallback) +lookupTable(const search::fef::IIndexEnvironment & env, const std::string & featureName, + const std::string & table, const std::string & fieldName, const std::string & fallback) { - vespalib::string tn1 = env.getProperties().lookup(featureName, table).get(fallback); - vespalib::string tn2 = env.getProperties().lookup(featureName, table, fieldName).get(tn1); + std::string tn1 = env.getProperties().lookup(featureName, table).get(fallback); + std::string tn2 = env.getProperties().lookup(featureName, table, fieldName).get(tn1); const search::fef::Table * retval = env.getTableManager().getTable(tn2); if (retval == nullptr) { LOG(warning, "Could not find the %s '%s' to be used for field '%s' in feature '%s'", @@ -161,7 +161,7 @@ lookupTable(const search::fef::IIndexEnvironment & env, const vespalib::string & } const ITermData * -getTermByLabel(const search::fef::IQueryEnvironment &env, const vespalib::string &label) +getTermByLabel(const search::fef::IQueryEnvironment &env, const std::string &label) { // Labeling the query item with unique id '5' with the label 'foo' // is represented as: [vespa.label.foo.id: "5"] diff --git a/searchlib/src/vespa/searchlib/features/utils.h b/searchlib/src/vespa/searchlib/features/utils.h index 270f32909303..866fbe40b46f 100644 --- a/searchlib/src/vespa/searchlib/features/utils.h +++ b/searchlib/src/vespa/searchlib/features/utils.h @@ -138,8 +138,8 @@ feature_t calculate_legacy_significance(const search::fef::ITermData& termData); * @return the table pointer or NULL if not found. **/ const search::fef::Table * -lookupTable(const search::fef::IIndexEnvironment & env, const vespalib::string & featureName, - const vespalib::string & table, const vespalib::string & fieldName, const vespalib::string & fallback); +lookupTable(const search::fef::IIndexEnvironment & env, const std::string & featureName, + const std::string & table, const std::string & fieldName, const std::string & fallback); /** * Obtain query information for a term/field combination. @@ -180,7 +180,7 @@ getTermFieldHandle(const search::fef::IQueryEnvironment &env, uint32_t termId, u * @param label query item label **/ const search::fef::ITermData * -getTermByLabel(const search::fef::IQueryEnvironment &env, const vespalib::string &label); +getTermByLabel(const search::fef::IQueryEnvironment &env, const std::string &label); std::optional lookup_document_frequency(const search::fef::IQueryEnvironment& env, const search::fef::ITermData& term); diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h index 37d614a26d1e..e28c543e3347 100644 --- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h +++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::features { @@ -17,7 +17,7 @@ class WeightedSetParser { public: template - static void parse(const vespalib::string &input, OutputType &output); + static void parse(const std::string &input, OutputType &output); }; } diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp index c5edcce34303..08fafb0a5bd7 100644 --- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp +++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp @@ -11,7 +11,7 @@ namespace search::features { template void -WeightedSetParser::parse(const vespalib::string &input, OutputType &output) +WeightedSetParser::parse(const std::string &input, OutputType &output) { size_t len = input.size(); // Note that we still handle '(' and ')' for backward compatibility. @@ -19,23 +19,23 @@ WeightedSetParser::parse(const vespalib::string &input, OutputType &output) (input[0] == '(' && input[len - 1] == ')')) ) { std::string_view s(input.data()+1, len - 2); while ( ! s.empty() ) { - vespalib::string::size_type commaPos(s.find(',')); + std::string::size_type commaPos(s.find(',')); std::string_view item(s.substr(0, commaPos)); - vespalib::string::size_type colonPos(item.find(':')); - if (colonPos != vespalib::string::npos) { - vespalib::string tmpKey(item.substr(0, colonPos)); - vespalib::string::size_type start(tmpKey.find_first_not_of(' ')); - if (start == vespalib::string::npos) { + std::string::size_type colonPos(item.find(':')); + if (colonPos != std::string::npos) { + std::string tmpKey(item.substr(0, colonPos)); + std::string::size_type start(tmpKey.find_first_not_of(' ')); + if (start == std::string::npos) { start = colonPos; // Spaces only => empty key } - vespalib::string key(tmpKey.data() + start, colonPos - start); + std::string key(tmpKey.data() + start, colonPos - start); std::string_view value(item.substr(colonPos+1)); output.insert(key, value); } else { Issue::report("weighted set parser: Could not parse item '%s' in input string '%s', skipping. " - "Expected ':' between key and weight.", vespalib::string(item).c_str(), input.c_str()); + "Expected ':' between key and weight.", std::string(item).c_str(), input.c_str()); } - if (commaPos != vespalib::string::npos) { + if (commaPos != std::string::npos) { s = s.substr(commaPos+1); } else { s = std::string_view(); diff --git a/searchlib/src/vespa/searchlib/fef/blueprint.cpp b/searchlib/src/vespa/searchlib/fef/blueprint.cpp index 095e612c3e0a..3d1d0f5d64d1 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprint.cpp @@ -3,19 +3,20 @@ #include "blueprint.h" #include "parametervalidator.h" #include +#include #include namespace search::fef { std::optional -Blueprint::defineInput(const vespalib::string & inName, AcceptInput accept) +Blueprint::defineInput(const std::string & inName, AcceptInput accept) { assert(_dependency_handler != nullptr); return _dependency_handler->resolve_input(inName, accept); } void -Blueprint::describeOutput(const vespalib::string & outName, std::string_view desc, FeatureType type) +Blueprint::describeOutput(const std::string & outName, std::string_view desc, FeatureType type) { (void) desc; assert(_dependency_handler != nullptr); @@ -27,7 +28,7 @@ Blueprint::fail(const char *format, ...) { va_list ap; va_start(ap, format); - vespalib::string msg = vespalib::make_string_va(format, ap); + std::string msg = vespalib::make_string_va(format, ap); va_end(ap); assert(_dependency_handler != nullptr); _dependency_handler->fail(msg); @@ -81,7 +82,7 @@ Blueprint::prepareSharedState(const IQueryEnvironment & queryEnv, IObjectStore & using IAttributeVectorWrapper = AnyWrapper; const attribute::IAttributeVector * -Blueprint::lookupAndStoreAttribute(const vespalib::string & key, std::string_view attrName, +Blueprint::lookupAndStoreAttribute(const std::string & key, std::string_view attrName, const IQueryEnvironment & env, IObjectStore & store) { const Anything * obj = store.get(key); @@ -94,7 +95,7 @@ Blueprint::lookupAndStoreAttribute(const vespalib::string & key, std::string_vie } const attribute::IAttributeVector * -Blueprint::lookupAttribute(const vespalib::string & key, std::string_view attrName, const IQueryEnvironment & env) +Blueprint::lookupAttribute(const std::string & key, std::string_view attrName, const IQueryEnvironment & env) { const Anything * attributeArg = env.getObjectStore().get(key); const IAttributeVector * attribute = (attributeArg != nullptr) @@ -106,7 +107,7 @@ Blueprint::lookupAttribute(const vespalib::string & key, std::string_view attrNa return attribute;; } -vespalib::string +std::string Blueprint::createAttributeKey(std::string_view attrName) { return "fef.attribute.key." + attrName; } diff --git a/searchlib/src/vespa/searchlib/fef/blueprint.h b/searchlib/src/vespa/searchlib/fef/blueprint.h index 3eb78a3b65b6..c7d494701b7d 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprint.h +++ b/searchlib/src/vespa/searchlib/fef/blueprint.h @@ -44,9 +44,9 @@ class Blueprint * executor setup. **/ struct DependencyHandler { - virtual std::optional resolve_input(const vespalib::string &feature_name, AcceptInput accept_type) = 0; - virtual void define_output(const vespalib::string &output_name, FeatureType type) = 0; - virtual void fail(const vespalib::string &msg) = 0; + virtual std::optional resolve_input(const std::string &feature_name, AcceptInput accept_type) = 0; + virtual void define_output(const std::string &output_name, FeatureType type) = 0; + virtual void fail(const std::string &msg) = 0; virtual ~DependencyHandler() = default; }; @@ -60,7 +60,7 @@ class Blueprint **/ using SP = std::shared_ptr; - using string = vespalib::string; + using string = std::string; using StringVector = std::vector; private: @@ -89,7 +89,7 @@ class Blueprint * @param inName feature name of input * @param type accepted input type **/ - std::optional defineInput(const vespalib::string & inName, + std::optional defineInput(const std::string & inName, AcceptInput accept = AcceptInput::NUMBER); /** @@ -105,7 +105,7 @@ class Blueprint * @param outName output name * @param desc output description **/ - void describeOutput(const vespalib::string & outName, std::string_view desc, + void describeOutput(const std::string & outName, std::string_view desc, FeatureType type = FeatureType::number()); /** @@ -124,14 +124,14 @@ class Blueprint * for later use in createExecutor **/ static const IAttributeVector * - lookupAndStoreAttribute(const vespalib::string & key, std::string_view attrName, + lookupAndStoreAttribute(const std::string & key, std::string_view attrName, const IQueryEnvironment & env, IObjectStore & objectStore); /** * Used to lookup attribute from the most efficient source. **/ static const IAttributeVector * - lookupAttribute(const vespalib::string & key, std::string_view attrName, const IQueryEnvironment & env); - static vespalib::string createAttributeKey(std::string_view attrName); + lookupAttribute(const std::string & key, std::string_view attrName, const IQueryEnvironment & env); + static std::string createAttributeKey(std::string_view attrName); public: Blueprint(const Blueprint &) = delete; @@ -156,7 +156,7 @@ class Blueprint * * @return blueprint base name **/ - const vespalib::string & getBaseName() const { return _baseName; } + const std::string & getBaseName() const { return _baseName; } /** * This method may indicate which features that should be dumped diff --git a/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp b/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp index 6f53fc0c57d5..d7d556c5b49a 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp @@ -16,7 +16,7 @@ BlueprintFactory::BlueprintFactory() void BlueprintFactory::addPrototype(Blueprint::SP proto) { - vespalib::string name = proto->getBaseName(); + std::string name = proto->getBaseName(); if (_blueprintMap.find(name) != _blueprintMap.end()) { LOG(warning, "Blueprint prototype overwritten: %s", name.c_str()); } @@ -33,7 +33,7 @@ BlueprintFactory::visitDumpFeatures(const IIndexEnvironment &indexEnv, } Blueprint::SP -BlueprintFactory::createBlueprint(const vespalib::string &name) const +BlueprintFactory::createBlueprint(const std::string &name) const { auto itr = _blueprintMap.find(name); if (itr == _blueprintMap.end()) { diff --git a/searchlib/src/vespa/searchlib/fef/blueprintfactory.h b/searchlib/src/vespa/searchlib/fef/blueprintfactory.h index 2fbf98324292..0978cace8728 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintfactory.h +++ b/searchlib/src/vespa/searchlib/fef/blueprintfactory.h @@ -3,8 +3,8 @@ #pragma once #include "iblueprintregistry.h" -#include #include +#include namespace search::fef { @@ -20,7 +20,7 @@ class BlueprintFactory : public IBlueprintRegistry { private: using BlueprintSP = std::shared_ptr; - using BlueprintMap = std::map; + using BlueprintMap = std::map; BlueprintMap _blueprintMap; @@ -51,7 +51,7 @@ class BlueprintFactory : public IBlueprintRegistry * @return fresh and clean blueprint of the appropriate class * @param name feature executor base name **/ - BlueprintSP createBlueprint(const vespalib::string &name) const; + BlueprintSP createBlueprint(const std::string &name) const; }; } diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp index 146a5412017b..d2712c64e74d 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp @@ -4,6 +4,7 @@ #include "blueprintfactory.h" #include "featurenameparser.h" #include "blueprint.h" +#include #include #include #include @@ -21,7 +22,7 @@ constexpr int TRACE_SKIP_POS = 10; using Accept = Blueprint::AcceptInput; -vespalib::string describe(const vespalib::string &feature_name) { +std::string describe(const std::string &feature_name) { return BlueprintResolver::describe_feature(feature_name); } @@ -56,7 +57,7 @@ struct Compiler : public Blueprint::DependencyHandler { : spec(std::move(blueprint)), parser(parser_in) {} }; using Stack = std::vector; - using Errors = std::vector; + using Errors = std::vector; struct FrameGuard { Stack &stack; @@ -73,8 +74,8 @@ struct Compiler : public Blueprint::DependencyHandler { Errors errors; ExecutorSpecList &spec_list; FeatureMap &feature_map; - std::set setup_set; - std::set failed_set; + std::set setup_set; + std::set failed_set; const char *min_stack; const char *max_stack; @@ -107,8 +108,8 @@ struct Compiler : public Blueprint::DependencyHandler { Frame &self() { return resolve_stack.back(); } [[nodiscard]] bool failed() const { return !failed_set.empty(); } - vespalib::string make_trace(bool skip_self) { - vespalib::string trace; + std::string make_trace(bool skip_self) { + std::string trace; auto pos = resolve_stack.rbegin(); auto end = resolve_stack.rend(); if ((pos != end) && skip_self) { @@ -130,11 +131,11 @@ struct Compiler : public Blueprint::DependencyHandler { return trace; } - FeatureRef fail(const vespalib::string &feature_name, const vespalib::string &reason, bool skip_self = false) { + FeatureRef fail(const std::string &feature_name, const std::string &reason, bool skip_self = false) { if (failed_set.count(feature_name) == 0) { failed_set.insert(feature_name); auto trace = make_trace(skip_self); - vespalib::string msg; + std::string msg; msg = fmt("invalid %s: %s\n%s", describe(feature_name).c_str(), reason.c_str(), trace.c_str()); vespalib::chomp(msg); errors.emplace_back(msg); @@ -143,7 +144,7 @@ struct Compiler : public Blueprint::DependencyHandler { return {}; } - void fail_self(const vespalib::string &reason) { + void fail_self(const std::string &reason) { fail(self().parser.featureName(), reason, true); } @@ -180,7 +181,7 @@ struct Compiler : public Blueprint::DependencyHandler { } } - FeatureRef resolve_feature(const vespalib::string &feature_name, Accept accept_type) { + FeatureRef resolve_feature(const std::string &feature_name, Accept accept_type) { auto parser = std::make_unique(feature_name); if (!parser->valid()) { return fail(feature_name, "malformed name"); @@ -208,7 +209,7 @@ struct Compiler : public Blueprint::DependencyHandler { return fail(parser->featureName(), fmt("unknown output: '%s'", parser->output().c_str())); } - std::optional resolve_input(const vespalib::string &feature_name, Accept accept_type) override { + std::optional resolve_input(const std::string &feature_name, Accept accept_type) override { assert(self().spec.output_types.empty()); // require: 'resolve inputs' before 'define outputs' auto ref = resolve_feature(feature_name, accept_type); if (!ref.valid()) { @@ -220,8 +221,8 @@ struct Compiler : public Blueprint::DependencyHandler { return spec_list[ref.executor].output_types[ref.output]; } - void define_output(const vespalib::string &output_name, FeatureType type) override { - vespalib::string feature_name = self().parser.executorName(); + void define_output(const std::string &output_name, FeatureType type) override { + std::string feature_name = self().parser.executorName(); if (!output_name.empty()) { feature_name.push_back('.'); feature_name.append(output_name); @@ -234,7 +235,7 @@ struct Compiler : public Blueprint::DependencyHandler { self().spec.output_types.push_back(std::move(type)); } - void fail(const vespalib::string &msg) override { + void fail(const std::string &msg) override { fail_self(msg); } }; @@ -266,8 +267,8 @@ BlueprintResolver::BlueprintResolver(const BlueprintFactory &factory, { } -vespalib::string -BlueprintResolver::describe_feature(const vespalib::string &name) +std::string +BlueprintResolver::describe_feature(const std::string &name) { auto parser = std::make_unique(name); if (parser->valid() && diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h index bfd2e84064df..b83847119956 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h +++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h @@ -25,7 +25,7 @@ class BlueprintResolver public: using SP = std::shared_ptr; using BlueprintSP = std::shared_ptr; - using Warnings = std::vector; + using Warnings = std::vector; /** * Low-level reference to a single output from a feature @@ -45,7 +45,7 @@ class BlueprintResolver : executor(executor_in), output(output_in) {} [[nodiscard]] bool valid() const { return (executor != undef); } }; - using FeatureMap = std::map; + using FeatureMap = std::map; /** * Thin blueprint wrapper with additional information about how @@ -84,7 +84,7 @@ class BlueprintResolver private: const BlueprintFactory &_factory; const IIndexEnvironment &_indexEnv; - std::vector _seeds; + std::vector _seeds; ExecutorSpecList _executorSpecs; FeatureMap _featureMap; FeatureMap _seedMap; @@ -109,7 +109,7 @@ class BlueprintResolver // // rankingExpression(foo@hash) -> function 'foo' // feature -> rank feature 'feature' - static vespalib::string describe_feature(const vespalib::string &name); + static std::string describe_feature(const std::string &name); /** * Add a feature name to the list of seeds. During compilation, diff --git a/searchlib/src/vespa/searchlib/fef/feature_resolver.h b/searchlib/src/vespa/searchlib/fef/feature_resolver.h index e5ec993dd598..a602e4312744 100644 --- a/searchlib/src/vespa/searchlib/fef/feature_resolver.h +++ b/searchlib/src/vespa/searchlib/fef/feature_resolver.h @@ -14,19 +14,19 @@ namespace search::fef { class FeatureResolver { private: - std::vector _names; + std::vector _names; std::vector _features; std::vector _is_object; public: FeatureResolver(size_t size_hint); ~FeatureResolver(); - void add(const vespalib::string &name, LazyValue feature, bool is_object) { + void add(const std::string &name, LazyValue feature, bool is_object) { _names.push_back(name); _features.push_back(feature); _is_object.push_back(is_object); } size_t num_features() const { return _names.size(); } - const vespalib::string &name_of(size_t i) const { return _names[i]; } + const std::string &name_of(size_t i) const { return _names[i]; } bool is_object(size_t i) const { return _is_object[i]; } LazyValue resolve(size_t i) const { return _features[i]; } }; diff --git a/searchlib/src/vespa/searchlib/fef/featureexecutor.cpp b/searchlib/src/vespa/searchlib/fef/featureexecutor.cpp index a8c606b769a2..3d50838c9e47 100644 --- a/searchlib/src/vespa/searchlib/fef/featureexecutor.cpp +++ b/searchlib/src/vespa/searchlib/fef/featureexecutor.cpp @@ -8,7 +8,7 @@ namespace search::fef { FeatureExecutor::FeatureExecutor() = default; -vespalib::string +std::string FeatureExecutor::getClassName() const { return vespalib::getClassName(*this); diff --git a/searchlib/src/vespa/searchlib/fef/featureexecutor.h b/searchlib/src/vespa/searchlib/fef/featureexecutor.h index 5e21ae1e1175..d7f975cf68fd 100644 --- a/searchlib/src/vespa/searchlib/fef/featureexecutor.h +++ b/searchlib/src/vespa/searchlib/fef/featureexecutor.h @@ -120,7 +120,7 @@ class FeatureExecutor * * @return fully qualified class name **/ - vespalib::string getClassName() const; + std::string getClassName() const; // bind order per executor: inputs, outputs, match_data void bind_inputs(std::span inputs); diff --git a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp index 2381a15db39f..a3104c7741d4 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp @@ -25,7 +25,7 @@ bool isSpace(char c) { } } -bool isBlank(const vespalib::string &str) { +bool isBlank(const std::string &str) { for (uint32_t i = 0; i < str.size(); ++i) { if (!isSpace(str[i])) { return false; @@ -34,7 +34,7 @@ bool isBlank(const vespalib::string &str) { return true; } -void appendQuoted(char c, vespalib::string &str) { +void appendQuoted(char c, std::string &str) { switch (c) { case '\\': str.append("\\\\"); @@ -66,9 +66,9 @@ void appendQuoted(char c, vespalib::string &str) { } } -vespalib::string quoteString(const vespalib::string &str) +std::string quoteString(const std::string &str) { - vespalib::string res; + std::string res; res.push_back('"'); for (uint32_t i = 0; i < str.size(); ++i) { appendQuoted(str[i], res); @@ -91,14 +91,14 @@ FeatureNameBuilder::FeatureNameBuilder() FeatureNameBuilder::~FeatureNameBuilder() = default; FeatureNameBuilder & -FeatureNameBuilder::baseName(const vespalib::string &str) +FeatureNameBuilder::baseName(const std::string &str) { _baseName = str; return *this; } FeatureNameBuilder & -FeatureNameBuilder::parameter(const vespalib::string &str, bool exact) +FeatureNameBuilder::parameter(const std::string &str, bool exact) { if (str.empty() || (!exact && isBlank(str))) { _parameters.push_back(""); @@ -121,16 +121,16 @@ FeatureNameBuilder::clearParameters() } FeatureNameBuilder & -FeatureNameBuilder::output(const vespalib::string &str) +FeatureNameBuilder::output(const std::string &str) { _output = str; return *this; } -vespalib::string +std::string FeatureNameBuilder::buildName() const { - vespalib::string ret; + std::string ret; if (!_baseName.empty()) { ret = _baseName; if (!_parameters.empty()) { diff --git a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.h b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.h index ad04255acf12..83e9094c236c 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.h +++ b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.h @@ -2,7 +2,7 @@ #pragma once -#include +#include #include namespace search::fef { @@ -15,9 +15,9 @@ namespace search::fef { class FeatureNameBuilder { private: - vespalib::string _baseName; - std::vector _parameters; - vespalib::string _output; + std::string _baseName; + std::vector _parameters; + std::string _output; public: /** @@ -32,7 +32,7 @@ class FeatureNameBuilder * @return this object, for chaining * @param str base name **/ - FeatureNameBuilder &baseName(const vespalib::string &str); + FeatureNameBuilder &baseName(const std::string &str); /** * Add a parameter to the end of the parameter list. @@ -43,7 +43,7 @@ class FeatureNameBuilder * exact string value. If this is false, the framework is allowed * to normalize the string as if it was a feature name. **/ - FeatureNameBuilder ¶meter(const vespalib::string &str, bool exact = true); + FeatureNameBuilder ¶meter(const std::string &str, bool exact = true); /** * Clear the list of parameters. @@ -58,7 +58,7 @@ class FeatureNameBuilder * @return this object, for chaining * @param str output name **/ - FeatureNameBuilder &output(const vespalib::string &str); + FeatureNameBuilder &output(const std::string &str); /** * Build a full feature name from the information put into this @@ -66,7 +66,7 @@ class FeatureNameBuilder * * @return feature name **/ - vespalib::string buildName() const; + std::string buildName() const; }; } diff --git a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp index 181be5e1bc36..4df11ae2df41 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp +++ b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp @@ -31,7 +31,7 @@ class IsLogged { private: A _a; - vespalib::string _name; + std::string _name; public: IsLogged(A a) : _a(a), _name(a.getName()) {} @@ -48,7 +48,7 @@ class DoLog { private: A _a; - vespalib::string _name; + std::string _name; public: DoLog(A a) : _a(a), _name(a.getName()) {} @@ -83,13 +83,13 @@ DoLog doLog(A a) { class ParseContext { private: - const vespalib::string &_str; // the input string. TODO Use std::string_view + const std::string &_str; // the input string. TODO Use std::string_view uint32_t _pos; // current position char _curr; // current character, 0 means eos bool _error; // flag indicating whether we have a parse error public: - ParseContext(const vespalib::string &in) : _str(in), _pos(0), + ParseContext(const std::string &in) : _str(in), _pos(0), _curr((in.empty()) ? 0 : in[0]), _error(false) {} uint32_t pos() const { return _pos; } @@ -155,7 +155,7 @@ class IsSpace return false; } } - vespalib::string getName() const { return "IsSpace"; } + std::string getName() const { return "IsSpace"; } }; class Ident @@ -185,7 +185,7 @@ class IsIdent bool operator()(char c) const { return _G_ident.isValid(c); } - vespalib::string getName() const { return "IsIdent"; } + std::string getName() const { return "IsIdent"; } }; class IsChar @@ -198,7 +198,7 @@ class IsChar bool operator()(char c) const { return (c == _c); } - vespalib::string getName() const { return vespalib::make_string("IsChar(%c)", _c); } + std::string getName() const { return vespalib::make_string("IsChar(%c)", _c); } }; template @@ -212,7 +212,7 @@ class IsNot bool operator()(char c) { return !(_a(c)); } - vespalib::string getName() const { return vespalib::make_string("IsNot(%s)", _a.getName().c_str()); } + std::string getName() const { return vespalib::make_string("IsNot(%s)", _a.getName().c_str()); } }; template @@ -227,7 +227,7 @@ class IsEither bool operator()(char c) { return (_a(c) || _b(c)); } - vespalib::string getName() const { return vespalib::make_string("IsEither(%s,%s)", + std::string getName() const { return vespalib::make_string("IsEither(%s,%s)", _a.getName().c_str(), _b.getName().c_str()); } }; @@ -249,7 +249,7 @@ class IsEndQuote } return (c == '"'); } - vespalib::string getName() const { return "IsEndQuote"; } + std::string getName() const { return "IsEndQuote"; } }; //----------------------------------------------------------------------------- @@ -259,22 +259,22 @@ class DoIgnore public: bool operator()(char) { return true; } bool done() { return true; } - vespalib::string getName() const { return "doIgnore"; } + std::string getName() const { return "doIgnore"; } }; class DoSave { private: - vespalib::string &_dst; + std::string &_dst; public: - DoSave(vespalib::string &str) : _dst(str) {} + DoSave(std::string &str) : _dst(str) {} bool operator()(char c) { _dst.push_back(c); return true; } bool done() { return !_dst.empty(); } - vespalib::string getName() const { return "doSave"; } + std::string getName() const { return "doSave"; } }; class DoDequote @@ -283,10 +283,10 @@ class DoDequote bool _escape; // true means we are dequoting something int _hex; // how many hex numbers left to read unsigned char _c; // save up hex decoded char here - vespalib::string &_dst; // where to save the dequoted string + std::string &_dst; // where to save the dequoted string public: - explicit DoDequote(vespalib::string &str) : _escape(false), _hex(0), _c(0), _dst(str) {} + explicit DoDequote(std::string &str) : _escape(false), _hex(0), _c(0), _dst(str) {} bool operator()(char c) { if (_escape) { if (_hex > 0) { @@ -347,7 +347,7 @@ class DoDequote return true; } bool done() { return !_escape; } - vespalib::string getName() const { return "doDequote"; } + std::string getName() const { return "doDequote"; } }; //----------------------------------------------------------------------------- @@ -372,23 +372,23 @@ IsEndQuote isEndQuote() { return IsEndQuote(); } DoIgnore doIgnore() { return DoIgnore(); } -DoSave doSave(vespalib::string &str) { return DoSave(str); } +DoSave doSave(std::string &str) { return DoSave(str); } -DoDequote doDequote(vespalib::string &str) { return DoDequote(str); } +DoDequote doDequote(std::string &str) { return DoDequote(str); } //----------------------------------------------------------------------------- // need forward declaration of this for recursive parsing -bool normalizeFeatureName(ParseContext &ctx, vespalib::string &name); +bool normalizeFeatureName(ParseContext &ctx, std::string &name); -bool parseParameters(ParseContext &ctx, std::vector ¶meters) +bool parseParameters(ParseContext &ctx, std::vector ¶meters) { ctx.scan(isSpace(), doIgnore()); if (!ctx.eatChar('(')) { return true; // no parameters = ok } for (;;) { - vespalib::string param; + std::string param; ctx.scan(isSpace(), doIgnore()); switch (ctx.get()) { case ')': @@ -419,7 +419,7 @@ bool parseParameters(ParseContext &ctx, std::vector ¶meter } } -bool parseOutput(ParseContext &ctx, vespalib::string &output) +bool parseOutput(ParseContext &ctx, std::string &output) { ctx.scan(isSpace(), doIgnore()); if (!ctx.eatChar('.')) { @@ -429,18 +429,18 @@ bool parseOutput(ParseContext &ctx, vespalib::string &output) return ctx.scan(isEither(isIdent(), isChar('.')), doSave(output)); } -bool parseFeatureName(ParseContext &ctx, vespalib::string &baseName, - std::vector ¶meters, vespalib::string &output) +bool parseFeatureName(ParseContext &ctx, std::string &baseName, + std::vector ¶meters, std::string &output) { return (ctx.scan(isIdent(), doSave(baseName)) && parseParameters(ctx, parameters) && parseOutput(ctx, output)); } -bool normalizeFeatureName(ParseContext &ctx, vespalib::string &name) { - vespalib::string baseName; - std::vector params; - vespalib::string output; +bool normalizeFeatureName(ParseContext &ctx, std::string &name) { + std::string baseName; + std::vector params; + std::string output; if (!parseFeatureName(ctx, baseName, params, output)) { return false; } diff --git a/searchlib/src/vespa/searchlib/fef/featurenameparser.h b/searchlib/src/vespa/searchlib/fef/featurenameparser.h index ead5b5cd3852..3f57d76f899a 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenameparser.h +++ b/searchlib/src/vespa/searchlib/fef/featurenameparser.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include #include namespace search::fef { @@ -14,7 +15,7 @@ namespace search::fef { class FeatureNameParser { public: - using string = vespalib::string; + using string = std::string; using StringVector = std::vector; private: bool _valid; @@ -34,7 +35,7 @@ class FeatureNameParser * * @param featureName feature name **/ - FeatureNameParser(const vespalib::string &featureName); + FeatureNameParser(const std::string &featureName); ~FeatureNameParser(); /** diff --git a/searchlib/src/vespa/searchlib/fef/fieldinfo.h b/searchlib/src/vespa/searchlib/fef/fieldinfo.h index 966c7a2dfcd0..eddea006f6d5 100644 --- a/searchlib/src/vespa/searchlib/fef/fieldinfo.h +++ b/searchlib/src/vespa/searchlib/fef/fieldinfo.h @@ -4,7 +4,8 @@ #include "fieldtype.h" #include -#include +#include +#include namespace search::fef { @@ -19,7 +20,7 @@ class FieldInfo public: using CollectionType = search::index::schema::CollectionType; using DataType = search::index::schema::DataType; - using string = vespalib::string; + using string = std::string; private: FieldType _type; DataType _data_type; diff --git a/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp b/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp index b111a2ddbce9..d5461087fe73 100644 --- a/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp @@ -8,15 +8,15 @@ LOG_SETUP(".fef.filetablefactory"); namespace search::fef { -FileTableFactory::FileTableFactory(const vespalib::string & path) : +FileTableFactory::FileTableFactory(const std::string & path) : _path(path) { } Table::SP -FileTableFactory::createTable(const vespalib::string & name) const +FileTableFactory::createTable(const std::string & name) const { - vespalib::string completeName(_path); + std::string completeName(_path); completeName.append("/"); completeName.append(name); std::ifstream file(completeName.c_str(), std::ifstream::in); diff --git a/searchlib/src/vespa/searchlib/fef/filetablefactory.h b/searchlib/src/vespa/searchlib/fef/filetablefactory.h index 1222f93cfaea..7b60e90fc2a4 100644 --- a/searchlib/src/vespa/searchlib/fef/filetablefactory.h +++ b/searchlib/src/vespa/searchlib/fef/filetablefactory.h @@ -12,20 +12,20 @@ namespace search::fef { class FileTableFactory : public ITableFactory { private: - vespalib::string _path; + std::string _path; public: /** * Creates a new factory for table files that are located in the given path. **/ - FileTableFactory(const vespalib::string & path); + FileTableFactory(const std::string & path); /** * Creates a table by reading the file 'path/name' and setting up a Table object. * The numbers in the file should be separated with ' ' or '\n'. * Table::SP(NULL) is returned if the file 'path/name' is not found. **/ - Table::SP createTable(const vespalib::string & name) const override; + Table::SP createTable(const std::string & name) const override; }; } diff --git a/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp b/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp index 9a4d67ec4c9b..38247bb0da31 100644 --- a/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp @@ -9,7 +9,7 @@ LOG_SETUP(".fef.functiontablefactory"); namespace { -void logArgumentWarning(const vespalib::string & name, size_t exp, size_t act) +void logArgumentWarning(const std::string & name, size_t exp, size_t act) { LOG(warning, "Cannot create table for function '%s'. Wrong number of arguments: expected %zu to %zu, but got %zu", name.c_str(), exp, exp + 1, act); @@ -20,7 +20,7 @@ void logArgumentWarning(const vespalib::string & name, size_t exp, size_t act) namespace search::fef { bool -FunctionTableFactory::checkArgs(const std::vector & args, size_t exp, size_t & tableSize) const +FunctionTableFactory::checkArgs(const std::vector & args, size_t exp, size_t & tableSize) const { if (exp <= args.size() && args.size() <= (exp + 1)) { if (args.size() == (exp + 1)) { @@ -34,7 +34,7 @@ FunctionTableFactory::checkArgs(const std::vector & args, size } bool -FunctionTableFactory::isSupported(const vespalib::string & type) const +FunctionTableFactory::isSupported(const std::string & type) const { return (isExpDecay(type) || isLogGrowth(type) || isLinear(type)); } @@ -75,7 +75,7 @@ FunctionTableFactory::FunctionTableFactory(size_t defaultTableSize) : } Table::SP -FunctionTableFactory::createTable(const vespalib::string & name) const +FunctionTableFactory::createTable(const std::string & name) const { ParsedName p; if (parseFunctionName(name, p)) { @@ -108,11 +108,11 @@ FunctionTableFactory::createTable(const vespalib::string & name) const } bool -FunctionTableFactory::parseFunctionName(const vespalib::string & name, ParsedName & parsed) +FunctionTableFactory::parseFunctionName(const std::string & name, ParsedName & parsed) { size_t ps = name.find('('); size_t pe = name.find(')'); - if (ps == vespalib::string::npos || pe == vespalib::string::npos) { + if (ps == std::string::npos || pe == std::string::npos) { LOG(warning, "Parse error: Did not find '(' and ')' in function name '%s'", name.c_str()); return false; } @@ -121,7 +121,7 @@ FunctionTableFactory::parseFunctionName(const vespalib::string & name, ParsedNam return false; } parsed.type = name.substr(0, ps); - vespalib::string args = name.substr(ps + 1, pe - ps - 1); + std::string args = name.substr(ps + 1, pe - ps - 1); if (!args.empty()) { vespalib::StringTokenizer tokenizer(args); for (const auto & token : tokenizer) { diff --git a/searchlib/src/vespa/searchlib/fef/functiontablefactory.h b/searchlib/src/vespa/searchlib/fef/functiontablefactory.h index 1e513ded6a3e..307b38417001 100644 --- a/searchlib/src/vespa/searchlib/fef/functiontablefactory.h +++ b/searchlib/src/vespa/searchlib/fef/functiontablefactory.h @@ -19,8 +19,8 @@ class FunctionTableFactory : public ITableFactory { public: struct ParsedName { - vespalib::string type; - std::vector args; + std::string type; + std::vector args; ParsedName() noexcept : type(), args() {} }; @@ -32,20 +32,20 @@ class FunctionTableFactory : public ITableFactory /** * Creates a table where the given name specifies the function and arguments to use. **/ - [[nodiscard]] Table::SP createTable(const vespalib::string & name) const override; + [[nodiscard]] Table::SP createTable(const std::string & name) const override; /** * Parses the given function name and returns true if success. **/ - static bool parseFunctionName(const vespalib::string & name, ParsedName & parsed); + static bool parseFunctionName(const std::string & name, ParsedName & parsed); private: size_t _defaultTableSize; - bool checkArgs(const std::vector & args, size_t exp, size_t & tableSize) const; - bool isSupported(const vespalib::string & type) const; - bool isExpDecay(const vespalib::string & type) const { return type == "expdecay"; } - bool isLogGrowth(const vespalib::string & type) const { return type == "loggrowth"; } - bool isLinear(const vespalib::string & type) const { return type == "linear"; } + bool checkArgs(const std::vector & args, size_t exp, size_t & tableSize) const; + bool isSupported(const std::string & type) const; + bool isExpDecay(const std::string & type) const { return type == "expdecay"; } + bool isLogGrowth(const std::string & type) const { return type == "loggrowth"; } + bool isLinear(const std::string & type) const { return type == "linear"; } Table::SP createExpDecay(double w, double t, size_t len) const; Table::SP createLogGrowth(double w, double t, double s, size_t len) const; Table::SP createLinear(double w, double t, size_t len) const; diff --git a/searchlib/src/vespa/searchlib/fef/i_ranking_assets_repo.h b/searchlib/src/vespa/searchlib/fef/i_ranking_assets_repo.h index 227c454e5225..ba811d690860 100644 --- a/searchlib/src/vespa/searchlib/fef/i_ranking_assets_repo.h +++ b/searchlib/src/vespa/searchlib/fef/i_ranking_assets_repo.h @@ -13,9 +13,9 @@ class OnnxModel; * Empty strings or nullptrs indicates nothing found. */ struct IRankingAssetsRepo { - virtual vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const = 0; - virtual vespalib::string getExpression(const vespalib::string &name) const = 0; - virtual const search::fef::OnnxModel *getOnnxModel(const vespalib::string &name) const = 0; + virtual vespalib::eval::ConstantValue::UP getConstant(const std::string &name) const = 0; + virtual std::string getExpression(const std::string &name) const = 0; + virtual const search::fef::OnnxModel *getOnnxModel(const std::string &name) const = 0; virtual ~IRankingAssetsRepo() = default; }; diff --git a/searchlib/src/vespa/searchlib/fef/idumpfeaturevisitor.h b/searchlib/src/vespa/searchlib/fef/idumpfeaturevisitor.h index 489a1374be13..c7dad7493b94 100644 --- a/searchlib/src/vespa/searchlib/fef/idumpfeaturevisitor.h +++ b/searchlib/src/vespa/searchlib/fef/idumpfeaturevisitor.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::fef { @@ -20,7 +20,7 @@ class IDumpFeatureVisitor * * @param name full feature name **/ - virtual void visitDumpFeature(const vespalib::string &name) = 0; + virtual void visitDumpFeature(const std::string &name) = 0; virtual ~IDumpFeatureVisitor() = default; }; diff --git a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h index 748d7c5f3249..d275b303ea66 100644 --- a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace vespalib::eval { struct ConstantValue; } @@ -21,7 +21,7 @@ class OnnxModel; class IIndexEnvironment { public: - using string = vespalib::string; + using string = std::string; /** * This enum defines the different motivations the framework has * for configuring a feature blueprint. RANK means the feature is @@ -100,17 +100,17 @@ class IIndexEnvironment /** * Returns a constant rank value with the given name or null ptr if no such value exists. */ - virtual std::unique_ptr getConstantValue(const vespalib::string &name) const = 0; + virtual std::unique_ptr getConstantValue(const std::string &name) const = 0; /** * Returns the ranking expression with the given name or empty string if not found. **/ - virtual vespalib::string getRankingExpression(const vespalib::string &name) const = 0; + virtual std::string getRankingExpression(const std::string &name) const = 0; /** * Get configuration for the given onnx model. **/ - virtual const OnnxModel *getOnnxModel(const vespalib::string &name) const = 0; + virtual const OnnxModel *getOnnxModel(const std::string &name) const = 0; virtual uint32_t getDistributionKey() const = 0; diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp index 66327a74424b..f67af176ead6 100644 --- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp @@ -10,9 +10,9 @@ namespace search::fef::indexproperties { namespace { -vespalib::string -lookupString(const Properties &props, const vespalib::string &name, - const vespalib::string &defaultValue) +std::string +lookupString(const Properties &props, const std::string &name, + const std::string &defaultValue) { Property p = props.lookup(name); if (p.found()) { @@ -21,13 +21,13 @@ lookupString(const Properties &props, const vespalib::string &name, return defaultValue; } -std::vector -lookupStringVector(const Properties &props, const vespalib::string &name, - const std::vector &defaultValue) +std::vector +lookupStringVector(const Properties &props, const std::string &name, + const std::vector &defaultValue) { Property p = props.lookup(name); if (p.found()) { - std::vector retval; + std::vector retval; for (uint32_t i = 0; i < p.size(); ++i) { retval.push_back(p.getAt(i)); } @@ -47,13 +47,13 @@ lookup_opt_double(const Properties &props, std::string_view name, std::optional< } double -lookupDouble(const Properties &props, const vespalib::string &name, double defaultValue) +lookupDouble(const Properties &props, const std::string &name, double defaultValue) { return lookup_opt_double(props, name, defaultValue).value(); } uint32_t -lookupUint32(const Properties &props, const vespalib::string &name, uint32_t defaultValue) +lookupUint32(const Properties &props, const std::string &name, uint32_t defaultValue) { Property p = props.lookup(name); uint32_t value(defaultValue); @@ -68,7 +68,7 @@ lookupUint32(const Properties &props, const vespalib::string &name, uint32_t def } bool -lookupBool(const Properties &props, const vespalib::string &name, bool defaultValue) +lookupBool(const Properties &props, const std::string &name, bool defaultValue) { Property p = props.lookup(name); if (p.found()) { @@ -78,8 +78,8 @@ lookupBool(const Properties &props, const vespalib::string &name, bool defaultVa } bool -checkIfTrue(const Properties &props, const vespalib::string &name, - const vespalib::string &defaultValue) +checkIfTrue(const Properties &props, const std::string &name, + const std::string &defaultValue) { return (props.lookup(name).get(defaultValue) == "true"); } @@ -88,7 +88,7 @@ checkIfTrue(const Properties &props, const vespalib::string &name, namespace eval { -const vespalib::string LazyExpressions::NAME("vespa.eval.lazy_expressions"); +const std::string LazyExpressions::NAME("vespa.eval.lazy_expressions"); bool LazyExpressions::check(const Properties &props, bool default_value) @@ -96,7 +96,7 @@ LazyExpressions::check(const Properties &props, bool default_value) return lookupBool(props, NAME, default_value); } -const vespalib::string UseFastForest::NAME("vespa.eval.use_fast_forest"); +const std::string UseFastForest::NAME("vespa.eval.use_fast_forest"); const bool UseFastForest::DEFAULT_VALUE(false); bool UseFastForest::check(const Properties &props) { return lookupBool(props, NAME, DEFAULT_VALUE); } @@ -104,19 +104,19 @@ bool UseFastForest::check(const Properties &props) { return lookupBool(props, NA namespace rank { -const vespalib::string FirstPhase::NAME("vespa.rank.firstphase"); -const vespalib::string FirstPhase::DEFAULT_VALUE("nativeRank"); +const std::string FirstPhase::NAME("vespa.rank.firstphase"); +const std::string FirstPhase::DEFAULT_VALUE("nativeRank"); -vespalib::string +std::string FirstPhase::lookup(const Properties &props) { return lookupString(props, NAME, DEFAULT_VALUE); } -const vespalib::string SecondPhase::NAME("vespa.rank.secondphase"); -const vespalib::string SecondPhase::DEFAULT_VALUE(""); +const std::string SecondPhase::NAME("vespa.rank.secondphase"); +const std::string SecondPhase::DEFAULT_VALUE(""); -vespalib::string +std::string SecondPhase::lookup(const Properties &props) { return lookupString(props, NAME, DEFAULT_VALUE); @@ -128,36 +128,36 @@ namespace execute { namespace onmatch { - const vespalib::string Attribute::NAME("vespa.execute.onmatch.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.execute.onmatch.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.execute.onmatch.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.execute.onmatch.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string & defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string & defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } } namespace onrerank { - const vespalib::string Attribute::NAME("vespa.execute.onrerank.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.execute.onrerank.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.execute.onrerank.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.execute.onrerank.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -165,18 +165,18 @@ namespace onrerank { namespace onsummary { - const vespalib::string Attribute::NAME("vespa.execute.onsummary.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.execute.onsummary.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.execute.onsummary.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.execute.onsummary.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -185,7 +185,7 @@ namespace onsummary { namespace temporary { -const vespalib::string WeakAndRange::NAME("vespa.weakand.range"); +const std::string WeakAndRange::NAME("vespa.weakand.range"); const double WeakAndRange::DEFAULT_VALUE(1.0); double @@ -204,61 +204,61 @@ WeakAndRange::lookup(const Properties &props, double defaultValue) namespace mutate { -const vespalib::string AllowQueryOverride::NAME("vespa.mutate.allow_query_override"); +const std::string AllowQueryOverride::NAME("vespa.mutate.allow_query_override"); bool AllowQueryOverride::check(const Properties &props) { return lookupBool(props, NAME, false); } namespace on_match { - const vespalib::string Attribute::NAME("vespa.mutate.on_match.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.mutate.on_match.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.mutate.on_match.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.mutate.on_match.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string & defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string & defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } } namespace on_first_phase { - const vespalib::string Attribute::NAME("vespa.mutate.on_first_phase.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.mutate.on_first_phase.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.mutate.on_first_phase.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.mutate.on_first_phase.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } } namespace on_second_phase { - const vespalib::string Attribute::NAME("vespa.mutate.on_second_phase.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.mutate.on_second_phase.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.mutate.on_second_phase.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.mutate.on_second_phase.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -266,18 +266,18 @@ namespace on_second_phase { namespace on_summary { - const vespalib::string Attribute::NAME("vespa.mutate.on_summary.attribute"); - const vespalib::string Attribute::DEFAULT_VALUE(""); - const vespalib::string Operation::NAME("vespa.mutate.on_summary.operation"); - const vespalib::string Operation::DEFAULT_VALUE(""); + const std::string Attribute::NAME("vespa.mutate.on_summary.attribute"); + const std::string Attribute::DEFAULT_VALUE(""); + const std::string Operation::NAME("vespa.mutate.on_summary.operation"); + const std::string Operation::DEFAULT_VALUE(""); - vespalib::string - Attribute::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Attribute::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } - vespalib::string - Operation::lookup(const Properties &props, const vespalib::string &defaultValue) { + std::string + Operation::lookup(const Properties &props, const std::string &defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -285,16 +285,16 @@ namespace on_summary { } // namespace mutate namespace feature_rename { - const vespalib::string Rename::NAME("vespa.feature.rename"); + const std::string Rename::NAME("vespa.feature.rename"); - std::vector> + std::vector> Rename::lookup(const Properties &props) { - std::vector> retval; + std::vector> retval; Property p = props.lookup(NAME); if (p.found()) { for (uint32_t i = 0; i+1 < p.size(); i += 2) { - vespalib::string from = p.getAt(i); - vespalib::string to = p.getAt(i+1); + std::string from = p.getAt(i); + std::string to = p.getAt(i+1); retval.emplace_back(from, to); } } @@ -304,10 +304,10 @@ namespace feature_rename { namespace match { -const vespalib::string Feature::NAME("vespa.match.feature"); -const std::vector Feature::DEFAULT_VALUE; +const std::string Feature::NAME("vespa.match.feature"); +const std::vector Feature::DEFAULT_VALUE; -std::vector +std::vector Feature::lookup(const Properties &props) { return lookupStringVector(props, NAME, DEFAULT_VALUE); @@ -317,10 +317,10 @@ Feature::lookup(const Properties &props) namespace summary { -const vespalib::string Feature::NAME("vespa.summary.feature"); -const std::vector Feature::DEFAULT_VALUE; +const std::string Feature::NAME("vespa.summary.feature"); +const std::vector Feature::DEFAULT_VALUE; -std::vector +std::vector Feature::lookup(const Properties &props) { return lookupStringVector(props, NAME, DEFAULT_VALUE); @@ -330,17 +330,17 @@ Feature::lookup(const Properties &props) namespace dump { -const vespalib::string Feature::NAME("vespa.dump.feature"); -const std::vector Feature::DEFAULT_VALUE; +const std::string Feature::NAME("vespa.dump.feature"); +const std::vector Feature::DEFAULT_VALUE; -std::vector +std::vector Feature::lookup(const Properties &props) { return lookupStringVector(props, NAME, DEFAULT_VALUE); } -const vespalib::string IgnoreDefaultFeatures::NAME("vespa.dump.ignoredefaultfeatures"); -const vespalib::string IgnoreDefaultFeatures::DEFAULT_VALUE("false"); +const std::string IgnoreDefaultFeatures::NAME("vespa.dump.ignoredefaultfeatures"); +const std::string IgnoreDefaultFeatures::DEFAULT_VALUE("false"); bool IgnoreDefaultFeatures::check(const Properties &props) @@ -352,7 +352,7 @@ IgnoreDefaultFeatures::check(const Properties &props) namespace matching { -const vespalib::string TermwiseLimit::NAME("vespa.matching.termwise_limit"); +const std::string TermwiseLimit::NAME("vespa.matching.termwise_limit"); const double TermwiseLimit::DEFAULT_VALUE(1.0); double @@ -367,7 +367,7 @@ TermwiseLimit::lookup(const Properties &props, double defaultValue) return lookupDouble(props, NAME, defaultValue); } -const vespalib::string NumThreadsPerSearch::NAME("vespa.matching.numthreadspersearch"); +const std::string NumThreadsPerSearch::NAME("vespa.matching.numthreadspersearch"); const uint32_t NumThreadsPerSearch::DEFAULT_VALUE(std::numeric_limits::max()); uint32_t @@ -382,7 +382,7 @@ NumThreadsPerSearch::lookup(const Properties &props, uint32_t defaultValue) return lookupUint32(props, NAME, defaultValue); } -const vespalib::string NumSearchPartitions::NAME("vespa.matching.numsearchpartitions"); +const std::string NumSearchPartitions::NAME("vespa.matching.numsearchpartitions"); const uint32_t NumSearchPartitions::DEFAULT_VALUE(1); uint32_t @@ -397,7 +397,7 @@ NumSearchPartitions::lookup(const Properties &props, uint32_t defaultValue) return lookupUint32(props, NAME, defaultValue); } -const vespalib::string MinHitsPerThread::NAME("vespa.matching.minhitsperthread"); +const std::string MinHitsPerThread::NAME("vespa.matching.minhitsperthread"); const uint32_t MinHitsPerThread::DEFAULT_VALUE(0); uint32_t @@ -412,7 +412,7 @@ MinHitsPerThread::lookup(const Properties &props, uint32_t defaultValue) return lookupUint32(props, NAME, defaultValue); } -const vespalib::string GlobalFilterLowerLimit::NAME("vespa.matching.global_filter.lower_limit"); +const std::string GlobalFilterLowerLimit::NAME("vespa.matching.global_filter.lower_limit"); const double GlobalFilterLowerLimit::DEFAULT_VALUE(0.05); @@ -428,7 +428,7 @@ GlobalFilterLowerLimit::lookup(const Properties &props, double defaultValue) return lookupDouble(props, NAME, defaultValue); } -const vespalib::string GlobalFilterUpperLimit::NAME("vespa.matching.global_filter.upper_limit"); +const std::string GlobalFilterUpperLimit::NAME("vespa.matching.global_filter.upper_limit"); const double GlobalFilterUpperLimit::DEFAULT_VALUE(1.0); @@ -444,7 +444,7 @@ GlobalFilterUpperLimit::lookup(const Properties &props, double defaultValue) return lookupDouble(props, NAME, defaultValue); } -const vespalib::string TargetHitsMaxAdjustmentFactor::NAME("vespa.matching.nns.target_hits_max_adjustment_factor"); +const std::string TargetHitsMaxAdjustmentFactor::NAME("vespa.matching.nns.target_hits_max_adjustment_factor"); const double TargetHitsMaxAdjustmentFactor::DEFAULT_VALUE(20.0); @@ -460,7 +460,7 @@ TargetHitsMaxAdjustmentFactor::lookup(const Properties& props, double defaultVal return lookupDouble(props, NAME, defaultValue); } -const vespalib::string FuzzyAlgorithm::NAME("vespa.matching.fuzzy.algorithm"); +const std::string FuzzyAlgorithm::NAME("vespa.matching.fuzzy.algorithm"); const vespalib::FuzzyMatchingAlgorithm FuzzyAlgorithm::DEFAULT_VALUE(vespalib::FuzzyMatchingAlgorithm::DfaTable); vespalib::FuzzyMatchingAlgorithm @@ -476,13 +476,13 @@ FuzzyAlgorithm::lookup(const Properties& props, vespalib::FuzzyMatchingAlgorithm return vespalib::fuzzy_matching_algorithm_from_string(value, default_value); } -const vespalib::string SortBlueprintsByCost::NAME("vespa.matching.sort_blueprints_by_cost"); +const std::string SortBlueprintsByCost::NAME("vespa.matching.sort_blueprints_by_cost"); const bool SortBlueprintsByCost::DEFAULT_VALUE(false); bool SortBlueprintsByCost::check(const Properties &props, bool fallback) { return lookupBool(props, NAME, fallback); } -const vespalib::string AlwaysMarkPhraseExpensive::NAME("vespa.matching.always_mark_phrase_expensive"); +const std::string AlwaysMarkPhraseExpensive::NAME("vespa.matching.always_mark_phrase_expensive"); const bool AlwaysMarkPhraseExpensive::DEFAULT_VALUE(false); bool AlwaysMarkPhraseExpensive::check(const Properties &props, bool fallback) { return lookupBool(props, NAME, fallback); @@ -492,7 +492,7 @@ bool AlwaysMarkPhraseExpensive::check(const Properties &props, bool fallback) { namespace softtimeout { -const vespalib::string Enabled::NAME("vespa.softtimeout.enable"); +const std::string Enabled::NAME("vespa.softtimeout.enable"); const bool Enabled::DEFAULT_VALUE(true); bool Enabled::lookup(const Properties &props) { @@ -503,14 +503,14 @@ bool Enabled::lookup(const Properties &props, bool defaultValue) { return lookupBool(props, NAME, defaultValue); } -const vespalib::string TailCost::NAME("vespa.softtimeout.tailcost"); +const std::string TailCost::NAME("vespa.softtimeout.tailcost"); const double TailCost::DEFAULT_VALUE(0.1); double TailCost::lookup(const Properties &props) { return lookupDouble(props, NAME, DEFAULT_VALUE); } -const vespalib::string Factor::NAME("vespa.softtimeout.factor"); +const std::string Factor::NAME("vespa.softtimeout.factor"); const double Factor::DEFAULT_VALUE(0.5); double Factor::lookup(const Properties &props) { @@ -528,38 +528,38 @@ bool Factor::isPresent(const Properties &props) { namespace matchphase { -const vespalib::string DegradationAttribute::NAME("vespa.matchphase.degradation.attribute"); -const vespalib::string DegradationAttribute::DEFAULT_VALUE(""); +const std::string DegradationAttribute::NAME("vespa.matchphase.degradation.attribute"); +const std::string DegradationAttribute::DEFAULT_VALUE(""); -const vespalib::string DegradationAscendingOrder::NAME("vespa.matchphase.degradation.ascendingorder"); +const std::string DegradationAscendingOrder::NAME("vespa.matchphase.degradation.ascendingorder"); const bool DegradationAscendingOrder::DEFAULT_VALUE(false); -const vespalib::string DegradationMaxHits::NAME("vespa.matchphase.degradation.maxhits"); +const std::string DegradationMaxHits::NAME("vespa.matchphase.degradation.maxhits"); const uint32_t DegradationMaxHits::DEFAULT_VALUE(0); -const vespalib::string DegradationSamplePercentage::NAME("vespa.matchphase.degradation.samplepercentage"); +const std::string DegradationSamplePercentage::NAME("vespa.matchphase.degradation.samplepercentage"); const double DegradationSamplePercentage::DEFAULT_VALUE(0.2); -const vespalib::string DegradationMaxFilterCoverage::NAME("vespa.matchphase.degradation.maxfiltercoverage"); +const std::string DegradationMaxFilterCoverage::NAME("vespa.matchphase.degradation.maxfiltercoverage"); const double DegradationMaxFilterCoverage::DEFAULT_VALUE(0.2); -const vespalib::string DegradationPostFilterMultiplier::NAME("vespa.matchphase.degradation.postfiltermultiplier"); +const std::string DegradationPostFilterMultiplier::NAME("vespa.matchphase.degradation.postfiltermultiplier"); const double DegradationPostFilterMultiplier::DEFAULT_VALUE(1.0); -const vespalib::string DiversityAttribute::NAME("vespa.matchphase.diversity.attribute"); -const vespalib::string DiversityAttribute::DEFAULT_VALUE(""); +const std::string DiversityAttribute::NAME("vespa.matchphase.diversity.attribute"); +const std::string DiversityAttribute::DEFAULT_VALUE(""); -const vespalib::string DiversityMinGroups::NAME("vespa.matchphase.diversity.mingroups"); +const std::string DiversityMinGroups::NAME("vespa.matchphase.diversity.mingroups"); const uint32_t DiversityMinGroups::DEFAULT_VALUE(1); -const vespalib::string DiversityCutoffFactor::NAME("vespa.matchphase.diversity.cutoff.factor"); +const std::string DiversityCutoffFactor::NAME("vespa.matchphase.diversity.cutoff.factor"); const double DiversityCutoffFactor::DEFAULT_VALUE(10.0); -const vespalib::string DiversityCutoffStrategy::NAME("vespa.matchphase.diversity.cutoff.strategy"); -const vespalib::string DiversityCutoffStrategy::DEFAULT_VALUE("loose"); +const std::string DiversityCutoffStrategy::NAME("vespa.matchphase.diversity.cutoff.strategy"); +const std::string DiversityCutoffStrategy::DEFAULT_VALUE("loose"); -vespalib::string -DegradationAttribute::lookup(const Properties &props, const vespalib::string & defaultValue) +std::string +DegradationAttribute::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -594,8 +594,8 @@ DegradationPostFilterMultiplier::lookup(const Properties &props, double defaultV return lookupDouble(props, NAME, defaultValue); } -vespalib::string -DiversityAttribute::lookup(const Properties &props, const vespalib::string & defaultValue) +std::string +DiversityAttribute::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -612,8 +612,8 @@ DiversityCutoffFactor::lookup(const Properties &props, double defaultValue) return lookupDouble(props, NAME, defaultValue); } -vespalib::string -DiversityCutoffStrategy::lookup(const Properties &props, const vespalib::string & defaultValue) +std::string +DiversityCutoffStrategy::lookup(const Properties &props, const std::string & defaultValue) { return lookupString(props, NAME, defaultValue); } @@ -622,7 +622,7 @@ DiversityCutoffStrategy::lookup(const Properties &props, const vespalib::string namespace trace { -const vespalib::string Level::NAME("tracelevel"); +const std::string Level::NAME("tracelevel"); const uint32_t Level::DEFAULT_VALUE(0); uint32_t @@ -641,7 +641,7 @@ Level::lookup(const Properties &props, uint32_t defaultValue) namespace hitcollector { -const vespalib::string HeapSize::NAME("vespa.hitcollector.heapsize"); +const std::string HeapSize::NAME("vespa.hitcollector.heapsize"); const uint32_t HeapSize::DEFAULT_VALUE(100); uint32_t @@ -656,7 +656,7 @@ HeapSize::lookup(const Properties &props, uint32_t defaultValue) return lookupUint32(props, NAME, defaultValue); } -const vespalib::string ArraySize::NAME("vespa.hitcollector.arraysize"); +const std::string ArraySize::NAME("vespa.hitcollector.arraysize"); const uint32_t ArraySize::DEFAULT_VALUE(10000); uint32_t @@ -671,7 +671,7 @@ ArraySize::lookup(const Properties &props, uint32_t defaultValue) return lookupUint32(props, NAME, defaultValue); } -const vespalib::string EstimatePoint::NAME("vespa.hitcollector.estimatepoint"); +const std::string EstimatePoint::NAME("vespa.hitcollector.estimatepoint"); const uint32_t EstimatePoint::DEFAULT_VALUE(0xffffffff); uint32_t @@ -680,7 +680,7 @@ EstimatePoint::lookup(const Properties &props) return lookupUint32(props, NAME, DEFAULT_VALUE); } -const vespalib::string EstimateLimit::NAME("vespa.hitcollector.estimatelimit"); +const std::string EstimateLimit::NAME("vespa.hitcollector.estimatelimit"); const uint32_t EstimateLimit::DEFAULT_VALUE(0xffffffff); uint32_t @@ -689,7 +689,7 @@ EstimateLimit::lookup(const Properties &props) return lookupUint32(props, NAME, DEFAULT_VALUE); } -const vespalib::string FirstPhaseRankScoreDropLimit::NAME("vespa.hitcollector.rankscoredroplimit"); +const std::string FirstPhaseRankScoreDropLimit::NAME("vespa.hitcollector.rankscoredroplimit"); const std::optional FirstPhaseRankScoreDropLimit::DEFAULT_VALUE(std::nullopt); std::optional @@ -704,7 +704,7 @@ FirstPhaseRankScoreDropLimit::lookup(const Properties &props, std::optional SecondPhaseRankScoreDropLimit::DEFAULT_VALUE(std::nullopt); std::optional @@ -722,27 +722,27 @@ SecondPhaseRankScoreDropLimit::lookup(const Properties &props, std::optional #include -#include +#include #include +#include #include namespace search::fef { class Properties; } @@ -24,13 +25,13 @@ namespace eval { // lazy evaluation of expressions. affects rank/summary/dump struct LazyExpressions { - static const vespalib::string NAME; + static const std::string NAME; static bool check(const Properties &props, bool default_value); }; // use fast-forest evaluation for gbdt expressions. affects rank/summary/dump struct UseFastForest { - static const vespalib::string NAME; + static const std::string NAME; static const bool DEFAULT_VALUE; static bool check(const Properties &props); }; @@ -43,18 +44,18 @@ namespace rank { * Property for the feature name used for first phase rank. **/ struct FirstPhase { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props); }; /** * Property for the feature name used for second phase rank. **/ struct SecondPhase { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props); }; } // namespace rank @@ -66,8 +67,8 @@ namespace feature_rename { * with a different name, typically rankingExpression(foo) -> foo **/ struct Rename { - static const vespalib::string NAME; - static std::vector> lookup(const Properties &props); + static const std::string NAME; + static std::vector> lookup(const Properties &props); }; @@ -80,9 +81,9 @@ namespace match { * reply (match features). **/ struct Feature { - static const vespalib::string NAME; - static const std::vector DEFAULT_VALUE; - static std::vector lookup(const Properties &props); + static const std::string NAME; + static const std::vector DEFAULT_VALUE; + static std::vector lookup(const Properties &props); }; } // namespace match @@ -94,9 +95,9 @@ namespace summary { * summaryfeatures docsum field **/ struct Feature { - static const vespalib::string NAME; - static const std::vector DEFAULT_VALUE; - static std::vector lookup(const Properties &props); + static const std::string NAME; + static const std::vector DEFAULT_VALUE; + static std::vector lookup(const Properties &props); }; } // namespace summary @@ -107,9 +108,9 @@ namespace dump { * Property for the set of feature names used for dumping. **/ struct Feature { - static const vespalib::string NAME; - static const std::vector DEFAULT_VALUE; - static std::vector lookup(const Properties &props); + static const std::string NAME; + static const std::vector DEFAULT_VALUE; + static std::vector lookup(const Properties &props); }; /** @@ -117,8 +118,8 @@ namespace dump { * dumping. **/ struct IgnoreDefaultFeatures { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; + static const std::string NAME; + static const std::string DEFAULT_VALUE; static bool check(const Properties &props); }; @@ -126,53 +127,53 @@ namespace dump { namespace execute::onmatch { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace execute::onrerank { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace execute::onsummary { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace mutate { //TODO Remove October 2022 struct AllowQueryOverride { - static const vespalib::string NAME; + static const std::string NAME; static bool check(const Properties &props); }; } @@ -186,7 +187,7 @@ namespace temporary { * 0.0 which is default gives default legacy behavior. **/ struct WeakAndRange { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -195,61 +196,61 @@ struct WeakAndRange { namespace mutate::on_match { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace mutate::on_first_phase { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace mutate::on_second_phase { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } namespace mutate::on_summary { struct Attribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; struct Operation { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } @@ -262,7 +263,7 @@ namespace matching { * is 1 (never). **/ struct TermwiseLimit { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -272,7 +273,7 @@ namespace matching { * Property for the number of threads used per search. **/ struct NumThreadsPerSearch { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -281,7 +282,7 @@ namespace matching { * Property for the minimum number of hits per thread. **/ struct MinHitsPerThread { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -291,7 +292,7 @@ namespace matching { * A partition is a unit of work for the search threads. **/ struct NumSearchPartitions { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -304,7 +305,7 @@ namespace matching { * then don't build a global filter. The effect will be falling back to bruteforce instead of approximation. **/ struct GlobalFilterLowerLimit { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -319,7 +320,7 @@ namespace matching { * adding 20% margin to handle some correlation between filter and rest of query. **/ struct GlobalFilterUpperLimit { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -334,7 +335,7 @@ namespace matching { * This property ensures an upper bound of adjustedTargetHits, avoiding that the search in the HNSW index takes too long. **/ struct TargetHitsMaxAdjustmentFactor { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -344,7 +345,7 @@ namespace matching { * Property to control the algorithm using for fuzzy matching. **/ struct FuzzyAlgorithm { - static const vespalib::string NAME; + static const std::string NAME; static const vespalib::FuzzyMatchingAlgorithm DEFAULT_VALUE; static vespalib::FuzzyMatchingAlgorithm lookup(const Properties& props); static vespalib::FuzzyMatchingAlgorithm lookup(const Properties& props, vespalib::FuzzyMatchingAlgorithm default_value); @@ -353,7 +354,7 @@ namespace matching { * Sort blueprints based on relative cost estimate rather than est_hits **/ struct SortBlueprintsByCost { - static const vespalib::string NAME; + static const std::string NAME; static const bool DEFAULT_VALUE; static bool check(const Properties &props) { return check(props, DEFAULT_VALUE); } static bool check(const Properties &props, bool fallback); @@ -364,7 +365,7 @@ namespace matching { * under all intermediate iterators, not only AND. **/ struct AlwaysMarkPhraseExpensive { - static const vespalib::string NAME; + static const std::string NAME; static const bool DEFAULT_VALUE; static bool check(const Properties &props) { return check(props, DEFAULT_VALUE); } static bool check(const Properties &props, bool fallback); @@ -377,7 +378,7 @@ namespace softtimeout { * Default is off, but will change in Q1 2017 */ struct Enabled { - static const vespalib::string NAME; + static const std::string NAME; static const bool DEFAULT_VALUE; static bool lookup(const Properties &props); static bool lookup(const Properties &props, bool defaultValue); @@ -388,7 +389,7 @@ namespace softtimeout { * Be it summary fetching or what not. default is 0.10 or 10%. */ struct TailCost { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); }; @@ -398,7 +399,7 @@ namespace softtimeout { * The backend starts off with a value of 0.5. */ struct Factor { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props); static double lookup(const Properties &props, double defaultValue); @@ -412,17 +413,17 @@ namespace matchphase { * Property for the attribute used for graceful degradation during match phase. **/ struct DegradationAttribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; /** * Property for the order used for graceful degradation during match phase. **/ struct DegradationAscendingOrder { - static const vespalib::string NAME; + static const std::string NAME; static const bool DEFAULT_VALUE; static bool lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static bool lookup(const Properties &props, bool defaultValue); @@ -432,7 +433,7 @@ namespace matchphase { * Property for how many hits the used wanted for graceful degradation during match phase. **/ struct DegradationMaxHits { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -442,14 +443,14 @@ namespace matchphase { * Property for how many hits out of wanted hits to collect before considering graceful degradation during match phase. **/ struct DegradationSamplePercentage { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static double lookup(const Properties &props, double defaultValue); }; struct DegradationMaxFilterCoverage { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static double lookup(const Properties &props, double defaultValue); @@ -460,7 +461,7 @@ namespace matchphase { * > 1 favors pre filtering, less favour post filtering **/ struct DegradationPostFilterMultiplier { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static double lookup(const Properties &props, double defaultValue); @@ -472,10 +473,10 @@ namespace matchphase { * string; the default) diversity will be disabled. **/ struct DiversityAttribute { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; /** @@ -484,23 +485,23 @@ namespace matchphase { * is 1 (the default) diversity will be disabled. **/ struct DiversityMinGroups { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static uint32_t lookup(const Properties &props, uint32_t defaultValue); }; struct DiversityCutoffFactor { - static const vespalib::string NAME; + static const std::string NAME; static const double DEFAULT_VALUE; static double lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } static double lookup(const Properties &props, double defaultValue); }; struct DiversityCutoffStrategy { - static const vespalib::string NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } - static vespalib::string lookup(const Properties &props, const vespalib::string & defaultValue); + static const std::string NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props) { return lookup(props, DEFAULT_VALUE); } + static std::string lookup(const Properties &props, const std::string & defaultValue); }; } // namespace matchphase @@ -511,7 +512,7 @@ namespace trace { * Property for the heap size used in the hit collector. **/ struct Level { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -526,7 +527,7 @@ namespace hitcollector { * Property for the heap size used in the hit collector. **/ struct HeapSize { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -536,7 +537,7 @@ namespace hitcollector { * Property for the array size used in the hit collector. **/ struct ArraySize { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); static uint32_t lookup(const Properties &props, uint32_t defaultValue); @@ -547,7 +548,7 @@ namespace hitcollector { * Specifies when to estimate the total number of hits. **/ struct EstimatePoint { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); }; @@ -557,7 +558,7 @@ namespace hitcollector { * Specifies the limit for a hit estimate. If the estimate is above the limit abort ranking. **/ struct EstimateLimit { - static const vespalib::string NAME; + static const std::string NAME; static const uint32_t DEFAULT_VALUE; static uint32_t lookup(const Properties &props); }; @@ -568,7 +569,7 @@ namespace hitcollector { * Drop a hit if the first phase rank score <= drop limit. **/ struct FirstPhaseRankScoreDropLimit { - static const vespalib::string NAME; + static const std::string NAME; static const std::optional DEFAULT_VALUE; static std::optional lookup(const Properties &props); static std::optional lookup(const Properties &props, std::optional default_value); @@ -580,7 +581,7 @@ namespace hitcollector { * rescored) <= drop limit. **/ struct SecondPhaseRankScoreDropLimit { - static const vespalib::string NAME; + static const std::string NAME; static const std::optional DEFAULT_VALUE; static std::optional lookup(const Properties &props); static std::optional lookup(const Properties &props, std::optional default_value); @@ -592,19 +593,19 @@ namespace hitcollector { * Property for the field weight of a field. **/ struct FieldWeight { - static const vespalib::string BASE_NAME; + static const std::string BASE_NAME; static const uint32_t DEFAULT_VALUE; - static uint32_t lookup(const Properties &props, const vespalib::string &fieldName); + static uint32_t lookup(const Properties &props, const std::string &fieldName); }; /** * Property for whether a field is a filter field. **/ struct IsFilterField { - static const vespalib::string BASE_NAME; - static const vespalib::string DEFAULT_VALUE; - static void set(Properties &props, const vespalib::string &fieldName); - static bool check(const Properties &props, const vespalib::string &fieldName); + static const std::string BASE_NAME; + static const std::string DEFAULT_VALUE; + static void set(Properties &props, const std::string &fieldName); + static bool check(const Properties &props, const std::string &fieldName); }; namespace type { @@ -614,10 +615,10 @@ namespace type { * Currently, only tensor types are specified using this. */ struct Attribute { - static const vespalib::string BASE_NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props, const vespalib::string &attributeName); - static void set(Properties &props, const vespalib::string &attributeName, const vespalib::string &type); + static const std::string BASE_NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props, const std::string &attributeName); + static void set(Properties &props, const std::string &attributeName, const std::string &type); }; /** @@ -625,10 +626,10 @@ struct Attribute { * Currently, only tensor types are specified using this. */ struct QueryFeature { - static const vespalib::string BASE_NAME; - static const vespalib::string DEFAULT_VALUE; - static vespalib::string lookup(const Properties &props, const vespalib::string &queryFeatureName); - static void set(Properties &props, const vespalib::string &queryFeatureName, const vespalib::string &type); + static const std::string BASE_NAME; + static const std::string DEFAULT_VALUE; + static std::string lookup(const Properties &props, const std::string &queryFeatureName); + static void set(Properties &props, const std::string &queryFeatureName, const std::string &type); }; } // namespace type diff --git a/searchlib/src/vespa/searchlib/fef/iqueryenvironment.h b/searchlib/src/vespa/searchlib/fef/iqueryenvironment.h index 16f0191c094f..ee6c484b164a 100644 --- a/searchlib/src/vespa/searchlib/fef/iqueryenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/iqueryenvironment.h @@ -80,7 +80,7 @@ class IQueryEnvironment * * @return average field length **/ - virtual double get_average_field_length(const vespalib::string &field_name) const = 0; + virtual double get_average_field_length(const std::string &field_name) const = 0; /** * Returns a const view of the index environment. diff --git a/searchlib/src/vespa/searchlib/fef/itablefactory.h b/searchlib/src/vespa/searchlib/fef/itablefactory.h index c00ad8389545..f55fa157750f 100644 --- a/searchlib/src/vespa/searchlib/fef/itablefactory.h +++ b/searchlib/src/vespa/searchlib/fef/itablefactory.h @@ -2,8 +2,8 @@ #pragma once -#include #include "table.h" +#include namespace search::fef { @@ -22,7 +22,7 @@ class ITableFactory * Creates a table with the given name. * Table::SP(NULL) is returned if the table cannot be created. **/ - virtual Table::SP createTable(const vespalib::string & name) const = 0; + virtual Table::SP createTable(const std::string & name) const = 0; /** * Virtual destructor to allow safe subclassing. diff --git a/searchlib/src/vespa/searchlib/fef/itablemanager.h b/searchlib/src/vespa/searchlib/fef/itablemanager.h index b78444f8a365..cab7d139eb58 100644 --- a/searchlib/src/vespa/searchlib/fef/itablemanager.h +++ b/searchlib/src/vespa/searchlib/fef/itablemanager.h @@ -15,7 +15,7 @@ class ITableManager /** * Returns a const view of the table with the given name or NULL if not found. **/ - virtual const Table * getTable(const vespalib::string & name) const = 0; + virtual const Table * getTable(const std::string & name) const = 0; virtual ~ITableManager() = default; }; diff --git a/searchlib/src/vespa/searchlib/fef/itermdata.h b/searchlib/src/vespa/searchlib/fef/itermdata.h index 827f16351675..ec8d62ffe382 100644 --- a/searchlib/src/vespa/searchlib/fef/itermdata.h +++ b/searchlib/src/vespa/searchlib/fef/itermdata.h @@ -4,9 +4,9 @@ #include "itermfielddata.h" #include -#include #include #include +#include namespace search::fef { @@ -39,7 +39,7 @@ class ITermData /** * Returns the name of a query tensor this term is referencing, if set. */ - virtual std::optional query_tensor_name() const = 0; + virtual std::optional query_tensor_name() const = 0; /** * Get number of fields searched diff --git a/searchlib/src/vespa/searchlib/fef/objectstore.cpp b/searchlib/src/vespa/searchlib/fef/objectstore.cpp index a90702a88a6f..a15bd4cdc853 100644 --- a/searchlib/src/vespa/searchlib/fef/objectstore.cpp +++ b/searchlib/src/vespa/searchlib/fef/objectstore.cpp @@ -18,7 +18,7 @@ ObjectStore::~ObjectStore() } void -ObjectStore::add(const vespalib::string & key, Anything::UP value) +ObjectStore::add(const std::string & key, Anything::UP value) { auto found = _objectMap.find(key); if (found != _objectMap.end()) { @@ -29,14 +29,14 @@ ObjectStore::add(const vespalib::string & key, Anything::UP value) } const Anything * -ObjectStore::get(const vespalib::string & key) const +ObjectStore::get(const std::string & key) const { auto found = _objectMap.find(key); return (found != _objectMap.end()) ? found->second : NULL; } Anything * -ObjectStore::get_mutable(const vespalib::string& key) +ObjectStore::get_mutable(const std::string& key) { auto found = _objectMap.find(key); return (found != _objectMap.end()) ? found->second : nullptr; diff --git a/searchlib/src/vespa/searchlib/fef/objectstore.h b/searchlib/src/vespa/searchlib/fef/objectstore.h index d2d768ee3381..a6ef1a1c50b7 100644 --- a/searchlib/src/vespa/searchlib/fef/objectstore.h +++ b/searchlib/src/vespa/searchlib/fef/objectstore.h @@ -37,9 +37,9 @@ class IObjectStore { public: virtual ~IObjectStore() = default; - virtual void add(const vespalib::string & key, Anything::UP value) = 0; - virtual const Anything * get(const vespalib::string & key) const = 0; - virtual Anything* get_mutable(const vespalib::string& key) = 0; + virtual void add(const std::string & key, Anything::UP value) = 0; + virtual const Anything * get(const std::string & key) const = 0; + virtual Anything* get_mutable(const std::string& key) = 0; }; /** @@ -50,11 +50,11 @@ class ObjectStore : public IObjectStore public: ObjectStore(); ~ObjectStore() override; - void add(const vespalib::string & key, Anything::UP value) override; - const Anything * get(const vespalib::string & key) const override; - Anything* get_mutable(const vespalib::string & key) override; + void add(const std::string & key, Anything::UP value) override; + const Anything * get(const std::string & key) const override; + Anything* get_mutable(const std::string & key) override; private: - using ObjectMap = vespalib::hash_map; + using ObjectMap = vespalib::hash_map; ObjectMap _objectMap; }; diff --git a/searchlib/src/vespa/searchlib/fef/onnx_model.cpp b/searchlib/src/vespa/searchlib/fef/onnx_model.cpp index c9a565e285e7..ca4e8ae5b97e 100644 --- a/searchlib/src/vespa/searchlib/fef/onnx_model.cpp +++ b/searchlib/src/vespa/searchlib/fef/onnx_model.cpp @@ -5,8 +5,8 @@ namespace search::fef { -OnnxModel::OnnxModel(const vespalib::string &name_in, - const vespalib::string &file_path_in) +OnnxModel::OnnxModel(const std::string &name_in, + const std::string &file_path_in) : _name(name_in), _file_path(file_path_in), _input_features(), @@ -20,13 +20,13 @@ OnnxModel & OnnxModel::operator =(OnnxModel &&) noexcept = default; OnnxModel::~OnnxModel() = default; OnnxModel & -OnnxModel::input_feature(const vespalib::string &model_input_name, const vespalib::string &input_feature) { +OnnxModel::input_feature(const std::string &model_input_name, const std::string &input_feature) { _input_features[model_input_name] = input_feature; return *this; } OnnxModel & -OnnxModel::output_name(const vespalib::string &model_output_name, const vespalib::string &output_name) { +OnnxModel::output_name(const std::string &model_output_name, const std::string &output_name) { _output_names[model_output_name] = output_name; return *this; } @@ -38,8 +38,8 @@ OnnxModel::dry_run_on_setup(bool value) return *this; } -std::optional -OnnxModel::input_feature(const vespalib::string &model_input_name) const { +std::optional +OnnxModel::input_feature(const std::string &model_input_name) const { auto pos = _input_features.find(model_input_name); if (pos != _input_features.end()) { return pos->second; @@ -47,8 +47,8 @@ OnnxModel::input_feature(const vespalib::string &model_input_name) const { return std::nullopt; } -std::optional -OnnxModel::output_name(const vespalib::string &model_output_name) const { +std::optional +OnnxModel::output_name(const std::string &model_output_name) const { auto pos = _output_names.find(model_output_name); if (pos != _output_names.end()) { return pos->second; diff --git a/searchlib/src/vespa/searchlib/fef/onnx_model.h b/searchlib/src/vespa/searchlib/fef/onnx_model.h index 62b6012bf652..c0e4d16099a0 100644 --- a/searchlib/src/vespa/searchlib/fef/onnx_model.h +++ b/searchlib/src/vespa/searchlib/fef/onnx_model.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace search::fef { @@ -15,32 +15,32 @@ namespace search::fef { **/ class OnnxModel { private: - vespalib::string _name; - vespalib::string _file_path; - std::map _input_features; - std::map _output_names; + std::string _name; + std::string _file_path; + std::map _input_features; + std::map _output_names; bool _dry_run_on_setup; public: - OnnxModel(const vespalib::string &name_in, - const vespalib::string &file_path_in); + OnnxModel(const std::string &name_in, + const std::string &file_path_in); OnnxModel(OnnxModel &&) noexcept; OnnxModel & operator=(OnnxModel &&) noexcept; OnnxModel(const OnnxModel &) = delete; OnnxModel & operator =(const OnnxModel &) = delete; ~OnnxModel(); - const vespalib::string &name() const { return _name; } - const vespalib::string &file_path() const { return _file_path; } - OnnxModel &input_feature(const vespalib::string &model_input_name, const vespalib::string &input_feature); - OnnxModel &output_name(const vespalib::string &model_output_name, const vespalib::string &output_name); + const std::string &name() const { return _name; } + const std::string &file_path() const { return _file_path; } + OnnxModel &input_feature(const std::string &model_input_name, const std::string &input_feature); + OnnxModel &output_name(const std::string &model_output_name, const std::string &output_name); OnnxModel &dry_run_on_setup(bool value); - std::optional input_feature(const vespalib::string &model_input_name) const; - std::optional output_name(const vespalib::string &model_output_name) const; + std::optional input_feature(const std::string &model_input_name) const; + std::optional output_name(const std::string &model_output_name) const; bool dry_run_on_setup() const { return _dry_run_on_setup; } bool operator==(const OnnxModel &rhs) const; - const std::map &inspect_input_features() const { return _input_features; } - const std::map &inspect_output_names() const { return _output_names; } + const std::map &inspect_input_features() const { return _input_features; } + const std::map &inspect_output_names() const { return _output_names; } }; } diff --git a/searchlib/src/vespa/searchlib/fef/onnx_models.cpp b/searchlib/src/vespa/searchlib/fef/onnx_models.cpp index 56f20ab4ee7e..be5a66a32d1e 100644 --- a/searchlib/src/vespa/searchlib/fef/onnx_models.cpp +++ b/searchlib/src/vespa/searchlib/fef/onnx_models.cpp @@ -24,7 +24,7 @@ OnnxModels::operator==(const OnnxModels &rhs) const } const OnnxModels::Model * -OnnxModels::getModel(const vespalib::string &name) const +OnnxModels::getModel(const std::string &name) const { auto itr = _models.find(name); if (itr != _models.end()) { diff --git a/searchlib/src/vespa/searchlib/fef/onnx_models.h b/searchlib/src/vespa/searchlib/fef/onnx_models.h index d4f6c8ef2c22..4736a458c251 100644 --- a/searchlib/src/vespa/searchlib/fef/onnx_models.h +++ b/searchlib/src/vespa/searchlib/fef/onnx_models.h @@ -4,8 +4,8 @@ #include "onnx_model.h" #include -#include #include +#include #include namespace search::fef { @@ -21,7 +21,7 @@ class OnnxModels { using Vector = std::vector; private: - using Map = std::map; + using Map = std::map; Map _models; public: @@ -33,7 +33,7 @@ class OnnxModels { OnnxModels & operator =(const OnnxModels &) = delete; ~OnnxModels(); bool operator==(const OnnxModels &rhs) const; - [[nodiscard]] const Model *getModel(const vespalib::string &name) const; + [[nodiscard]] const Model *getModel(const std::string &name) const; [[nodiscard]] size_t size() const { return _models.size(); } static void configure(const ModelConfig &config, Model &model); }; diff --git a/searchlib/src/vespa/searchlib/fef/parameter.cpp b/searchlib/src/vespa/searchlib/fef/parameter.cpp index 01dd231fabcb..9fa0e80ed826 100644 --- a/searchlib/src/vespa/searchlib/fef/parameter.cpp +++ b/searchlib/src/vespa/searchlib/fef/parameter.cpp @@ -5,7 +5,7 @@ namespace search { namespace fef { -Parameter::Parameter(ParameterType::Enum type, const vespalib::string & value) : +Parameter::Parameter(ParameterType::Enum type, const std::string & value) : _type(type), _stringVal(value), _doubleVal(0), diff --git a/searchlib/src/vespa/searchlib/fef/parameter.h b/searchlib/src/vespa/searchlib/fef/parameter.h index de547f05ba3f..4ac4483d4109 100644 --- a/searchlib/src/vespa/searchlib/fef/parameter.h +++ b/searchlib/src/vespa/searchlib/fef/parameter.h @@ -2,9 +2,9 @@ #pragma once -#include #include "fieldinfo.h" #include "parameterdescriptions.h" +#include namespace search::fef { @@ -15,18 +15,18 @@ namespace search::fef { class Parameter { private: ParameterType::Enum _type; - vespalib::string _stringVal; + std::string _stringVal; double _doubleVal; int64_t _intVal; const search::fef::FieldInfo * _fieldVal; public: - Parameter(ParameterType::Enum type, const vespalib::string & value); + Parameter(ParameterType::Enum type, const std::string & value); Parameter & setDouble(double val) { _doubleVal = val; return *this; } Parameter & setInteger(int64_t val) { _intVal = val; return *this; } Parameter & setField(const search::fef::FieldInfo * val) { _fieldVal = val; return *this; } ParameterType::Enum getType() const { return _type; } - const vespalib::string & getValue() const { return _stringVal; } + const std::string & getValue() const { return _stringVal; } double asDouble() const { return _doubleVal; } int64_t asInteger() const { return _intVal; } const search::fef::FieldInfo * asField() const { return _fieldVal; } diff --git a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h index 3e17497b4c74..5d2672461ba1 100644 --- a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h +++ b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h @@ -3,6 +3,7 @@ #pragma once #include +#include #include #include diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp index a36f03e6bcd4..8267ff29c8c6 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp @@ -32,10 +32,10 @@ bool checkDataType(ParameterDataTypeSet accept, search::index::schema::DataType class ValidateException { public: - ValidateException(const vespalib::string & message) : _message(message) { } - const vespalib::string & getMessage() const { return _message; } + ValidateException(const std::string & message) : _message(message) { } + const std::string & getMessage() const { return _message; } private: - vespalib::string _message; + std::string _message; }; } // namespace search::fef:: diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.h b/searchlib/src/vespa/searchlib/fef/parametervalidator.h index 47d2750a5497..6033fea05b5f 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.h +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.h @@ -16,7 +16,7 @@ namespace search::fef { */ class ParameterValidator { public: - using string = vespalib::string; + using string = std::string; using StringVector = std::vector; /** * This class contains the result after running a validation for a given parameter description. diff --git a/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.h b/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.h index c4b73b38276d..dba428f4cea2 100644 --- a/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.h +++ b/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.h @@ -77,7 +77,7 @@ class PhraseSplitterQueryEnv : public IQueryEnvironment return _queryEnv.getAllLocations(); } const attribute::IAttributeContext & getAttributeContext() const override { return _queryEnv.getAttributeContext(); } - double get_average_field_length(const vespalib::string &field_name) const override { return _queryEnv.get_average_field_length(field_name); } + double get_average_field_length(const std::string &field_name) const override { return _queryEnv.get_average_field_length(field_name); } const IIndexEnvironment & getIndexEnvironment() const override { return _queryEnv.getIndexEnvironment(); } // Accessor methods used by PhraseSplitter diff --git a/searchlib/src/vespa/searchlib/fef/properties.cpp b/searchlib/src/vespa/searchlib/fef/properties.cpp index 7a29f02d00b8..518c674602d1 100644 --- a/searchlib/src/vespa/searchlib/fef/properties.cpp +++ b/searchlib/src/vespa/searchlib/fef/properties.cpp @@ -3,6 +3,7 @@ #include "properties.h" #include #include +#include #include namespace search::fef { @@ -56,7 +57,7 @@ Properties::add(std::string_view key, std::string_view value) if (node != _data.end()) { v = &node->second; } else { - v = &_data[vespalib::string(key)]; + v = &_data[std::string(key)]; } v->emplace_back(value); ++_numValues; @@ -150,8 +151,8 @@ Properties::visitProperties(IPropertiesVisitor &visitor) const void Properties::visitNamespace(std::string_view ns, IPropertiesVisitor &visitor) const { - vespalib::string tmp; - vespalib::string prefix = ns + "."; + std::string tmp; + std::string prefix = ns + "."; for (const auto& elem : _data) { if ((elem.first.find(prefix) == 0) && (elem.first.size() > prefix.size())) @@ -181,7 +182,7 @@ Property Properties::lookup(std::string_view namespace1, std::string_view key) c if (namespace1.empty() || key.empty()) { return {}; } - vespalib::string fullKey(namespace1); + std::string fullKey(namespace1); fullKey.append(".").append(key); return lookup(fullKey); } @@ -193,7 +194,7 @@ Property Properties::lookup(std::string_view namespace1, if (namespace1.empty() || namespace2.empty() || key.empty()) { return {}; } - vespalib::string fullKey(namespace1); + std::string fullKey(namespace1); fullKey.append(".").append(namespace2).append(".").append(key); return lookup(fullKey); } @@ -206,7 +207,7 @@ Property Properties::lookup(std::string_view namespace1, if (namespace1.empty() || namespace2.empty() || namespace3.empty() || key.empty()) { return {}; } - vespalib::string fullKey(namespace1); + std::string fullKey(namespace1); fullKey.append(".").append(namespace2).append(".").append(namespace3).append(".").append(key); return lookup(fullKey); } @@ -219,4 +220,4 @@ void Properties::swap(Properties & rhs) noexcept } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, search::fef::Property::Values); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, search::fef::Property::Values); diff --git a/searchlib/src/vespa/searchlib/fef/properties.h b/searchlib/src/vespa/searchlib/fef/properties.h index 610d3c213b79..40ea539343a0 100644 --- a/searchlib/src/vespa/searchlib/fef/properties.h +++ b/searchlib/src/vespa/searchlib/fef/properties.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include #include namespace search::fef { @@ -23,7 +23,7 @@ class Properties; class Property { public: - using Value = vespalib::string; + using Value = std::string; using Values = std::vector; private: friend class Properties; @@ -141,7 +141,7 @@ class IPropertiesVisitor class Properties { private: - using Key = vespalib::string; + using Key = std::string; using Value = Property::Values; using Map = vespalib::hash_map, std::equal_to<>, vespalib::hashtable_base::and_modulator>; diff --git a/searchlib/src/vespa/searchlib/fef/query_value.cpp b/searchlib/src/vespa/searchlib/fef/query_value.cpp index 3ef0b1c19663..4faae91dbe8f 100644 --- a/searchlib/src/vespa/searchlib/fef/query_value.cpp +++ b/searchlib/src/vespa/searchlib/fef/query_value.cpp @@ -32,13 +32,13 @@ namespace search::fef { using ValueWrapper = AnyWrapper; -InvalidValueTypeException::InvalidValueTypeException(const vespalib::string& query_key, const vespalib::string& type_str_in) +InvalidValueTypeException::InvalidValueTypeException(const std::string& query_key, const std::string& type_str_in) : vespalib::Exception("Invalid type '" + type_str_in + "' for query value '" + query_key + "'"), _type_str(type_str_in) { } -InvalidTensorValueException::InvalidTensorValueException(const vespalib::eval::ValueType& type, const vespalib::string& expr_in) +InvalidTensorValueException::InvalidTensorValueException(const vespalib::eval::ValueType& type, const std::string& expr_in) : vespalib::Exception("Could not create tensor value of type '" + type.to_spec() + "' from the expression '" + expr_in + "'"), _expr(expr_in) { @@ -54,7 +54,7 @@ namespace { * "'" if it exists. */ feature_t -as_feature(const vespalib::string& str) +as_feature(const std::string& str) { char *end; errno = 0; @@ -79,7 +79,7 @@ empty_tensor(const ValueType& type) // Create a tensor value by evaluating a self-contained expression. std::unique_ptr -as_tensor(const vespalib::string& expr, const ValueType& wanted_type) +as_tensor(const std::string& expr, const ValueType& wanted_type) { const auto& factory = vespalib::eval::FastValueBuilderFactory::get(); auto fun = Function::parse(expr); @@ -100,7 +100,7 @@ std::unique_ptr decode_tensor_value(Property prop, const ValueType& value_type) { if (prop.found() && !prop.get().empty()) { - const vespalib::string& value = prop.get(); + const std::string& value = prop.get(); vespalib::nbostream stream(value.data(), value.size()); try { auto tensor = vespalib::eval::decode_value(stream, vespalib::eval::FastValueBuilderFactory::get()); @@ -153,7 +153,7 @@ QueryValue::QueryValue() { } -QueryValue::QueryValue(const vespalib::string& key, vespalib::eval::ValueType type) +QueryValue::QueryValue(const std::string& key, vespalib::eval::ValueType type) : _key(key), _name("query(" + key + ")"), _old_key("$" + key), @@ -165,9 +165,9 @@ QueryValue::QueryValue(const vespalib::string& key, vespalib::eval::ValueType ty QueryValue::~QueryValue() = default; QueryValue -QueryValue::from_config(const vespalib::string& key, const IIndexEnvironment& env) +QueryValue::from_config(const std::string& key, const IIndexEnvironment& env) { - vespalib::string type_str = type::QueryFeature::lookup(env.getProperties(), key); + std::string type_str = type::QueryFeature::lookup(env.getProperties(), key); ValueType type = type_str.empty() ? ValueType::double_type() : ValueType::from_spec(type_str); if (type.is_error()) { throw InvalidValueTypeException(key, type_str); diff --git a/searchlib/src/vespa/searchlib/fef/query_value.h b/searchlib/src/vespa/searchlib/fef/query_value.h index 8265142b4b24..c09a127758ac 100644 --- a/searchlib/src/vespa/searchlib/fef/query_value.h +++ b/searchlib/src/vespa/searchlib/fef/query_value.h @@ -5,8 +5,8 @@ #include "properties.h" #include #include -#include #include +#include namespace vespalib::eval { struct Value; } @@ -21,11 +21,11 @@ class IQueryEnvironment; */ class InvalidValueTypeException : public vespalib::Exception { private: - vespalib::string _type_str; + std::string _type_str; public: - InvalidValueTypeException(const vespalib::string& query_key, const vespalib::string& type_str_in); - const vespalib::string& type_str() const { return _type_str; } + InvalidValueTypeException(const std::string& query_key, const std::string& type_str_in); + const std::string& type_str() const { return _type_str; } }; /** @@ -33,11 +33,11 @@ class InvalidValueTypeException : public vespalib::Exception { */ class InvalidTensorValueException : public vespalib::Exception { private: - vespalib::string _expr; + std::string _expr; public: - InvalidTensorValueException(const vespalib::eval::ValueType& type, const vespalib::string& expr_in); - const vespalib::string& expr() const { return _expr; } + InvalidTensorValueException(const vespalib::eval::ValueType& type, const std::string& expr_in); + const std::string& expr() const { return _expr; } }; /** @@ -48,10 +48,10 @@ class InvalidTensorValueException : public vespalib::Exception { */ class QueryValue { private: - vespalib::string _key; // 'foo' - vespalib::string _name; // 'query(foo)' - vespalib::string _old_key; // '$foo' - vespalib::string _stored_value_key; // query.value.foo + std::string _key; // 'foo' + std::string _name; // 'query(foo)' + std::string _old_key; // '$foo' + std::string _stored_value_key; // query.value.foo vespalib::eval::ValueType _type; Property config_lookup(const IIndexEnvironment& env) const; @@ -59,7 +59,7 @@ class QueryValue { public: QueryValue(); - QueryValue(const vespalib::string& key, vespalib::eval::ValueType type); + QueryValue(const std::string& key, vespalib::eval::ValueType type); ~QueryValue(); /** @@ -67,7 +67,7 @@ class QueryValue { * * Throws InvalidValueTypeException if the value type is an error. */ - static QueryValue from_config(const vespalib::string& key, const IIndexEnvironment& env); + static QueryValue from_config(const std::string& key, const IIndexEnvironment& env); const vespalib::eval::ValueType& type() const { return _type; } diff --git a/searchlib/src/vespa/searchlib/fef/queryproperties.cpp b/searchlib/src/vespa/searchlib/fef/queryproperties.cpp index f5ab8055181d..f00fda5dfaa4 100644 --- a/searchlib/src/vespa/searchlib/fef/queryproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/queryproperties.cpp @@ -7,7 +7,7 @@ namespace fef { namespace queryproperties { namespace now { -const vespalib::string SystemTime::NAME("vespa.now"); +const std::string SystemTime::NAME("vespa.now"); } // namespace now } // namespace queryproperties diff --git a/searchlib/src/vespa/searchlib/fef/queryproperties.h b/searchlib/src/vespa/searchlib/fef/queryproperties.h index b7129449e1c1..2d32fef87cb0 100644 --- a/searchlib/src/vespa/searchlib/fef/queryproperties.h +++ b/searchlib/src/vespa/searchlib/fef/queryproperties.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search { namespace fef { @@ -31,7 +31,7 @@ namespace now { /** * Property name. **/ - static const vespalib::string NAME; + static const std::string NAME; }; } // namespace now diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp index 6687a94a2808..39357e9c4f59 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp +++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp @@ -64,7 +64,7 @@ struct OverrideVisitor : public IPropertiesVisitor const auto &feature_type = specs[ref.executor].output_types[ref.output]; if (feature_type.is_object()) { const auto &value_type = feature_type.type(); - const vespalib::string &encoded_value = prop.get(); + const std::string &encoded_value = prop.get(); vespalib::nbostream stream(encoded_value.data(), encoded_value.size()); try { auto tensor = vespalib::eval::decode_value(stream, vespalib::eval::FastValueBuilderFactory::get()); @@ -109,7 +109,7 @@ struct ProfiledExecutor : FeatureExecutor { ExecutionProfiler::TaskId self; ProfiledExecutor(ExecutionProfiler &profiler_in, FeatureExecutor &executor_in, - const vespalib::string &name) + const std::string &name) : profiler(profiler_in), executor(executor_in), self(profiler.resolve(name)) {} void handle_bind_match_data(const MatchData &md) override { executor.bind_match_data(md); @@ -291,9 +291,9 @@ RankProgram::setup(const MatchData &md, LOG(debug, "Num executors = %ld, hot stash = %ld, cold stash = %ld, match data fields = %d", _executors.size(), _hot_stash.count_used(), _cold_stash.count_used(), md.getNumTermFields()); if (LOG_WOULD_LOG(debug)) { - vespalib::hash_map executorStats; + vespalib::hash_map executorStats; for (const FeatureExecutor * executor : _executors) { - vespalib::string name = executor->getClassName(); + std::string name = executor->getClassName(); if (executorStats.find(name) == executorStats.end()) { executorStats[name] = 1; } else { diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.h b/searchlib/src/vespa/searchlib/fef/rank_program.h index 3129289fdef1..c9cf2c4e0547 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.h +++ b/searchlib/src/vespa/searchlib/fef/rank_program.h @@ -7,9 +7,9 @@ #include "properties.h" #include "matchdata.h" #include "feature_resolver.h" -#include #include #include +#include namespace vespalib { class ExecutionProfiler; } diff --git a/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.cpp b/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.cpp index ec9b166115ab..a6a9514ea20b 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.cpp +++ b/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.cpp @@ -23,7 +23,7 @@ namespace search::fef { constexpr vespalib::duration file_resolve_timeout = 60min; -RankingAssetsBuilder::RankingAssetsBuilder(FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec) +RankingAssetsBuilder::RankingAssetsBuilder(FNET_Transport* transport, const std::string& file_distributor_connection_spec) : _file_acquirer(), _time_box(vespalib::to_s(file_resolve_timeout), 5) { @@ -34,10 +34,10 @@ RankingAssetsBuilder::RankingAssetsBuilder(FNET_Transport* transport, const vesp RankingAssetsBuilder::~RankingAssetsBuilder() = default; -vespalib::string -RankingAssetsBuilder::resolve_file(const vespalib::string& desc, const vespalib::string& fileref) +std::string +RankingAssetsBuilder::resolve_file(const std::string& desc, const std::string& fileref) { - vespalib::string file_path; + std::string file_path; LOG(debug, "Waiting for file acquirer (%s, ref='%s')", desc.c_str(), fileref.c_str()); while (_time_box.hasTimeLeft() && (file_path == "")) { file_path = _file_acquirer->wait_for(fileref, _time_box.timeLeft()); @@ -60,7 +60,7 @@ RankingAssetsBuilder::build(const OnnxModelsConfig& config) if (_file_acquirer) { for (const auto& rc : config.model) { auto desc = fmt("name='%s'", rc.name.c_str()); - vespalib::string file_path = resolve_file(desc, rc.fileref); + std::string file_path = resolve_file(desc, rc.fileref); models.emplace_back(rc.name, file_path); OnnxModels::configure(rc, models.back()); } @@ -75,7 +75,7 @@ RankingAssetsBuilder::build(const RankingConstantsConfig& config) if (_file_acquirer) { for (const auto& rc : config.constant) { auto desc = fmt("name='%s', type='%s'", rc.name.c_str(), rc.type.c_str()); - vespalib::string file_path = resolve_file(desc, rc.fileref); + std::string file_path = resolve_file(desc, rc.fileref); constants.emplace_back(rc.name, rc.type, file_path); } } @@ -89,7 +89,7 @@ RankingAssetsBuilder::build(const RankingExpressionsConfig& config) if (_file_acquirer) { for (const auto& rc : config.expression) { auto desc = fmt("name='%s'", rc.name.c_str()); - vespalib::string filePath = resolve_file(desc, rc.fileref); + std::string filePath = resolve_file(desc, rc.fileref); expressions.add(rc.name, filePath); } } diff --git a/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.h b/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.h index 9233bd36f747..343248ac3db2 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.h +++ b/searchlib/src/vespa/searchlib/fef/ranking_assets_builder.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include class FNET_Transport; @@ -25,9 +25,9 @@ class RankingAssetsBuilder { std::unique_ptr _file_acquirer; vespalib::TimeBox _time_box; - vespalib::string resolve_file(const vespalib::string& desc, const vespalib::string& fileref); + std::string resolve_file(const std::string& desc, const std::string& fileref); public: - RankingAssetsBuilder(FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec); + RankingAssetsBuilder(FNET_Transport* transport, const std::string& file_distributor_connection_spec); ~RankingAssetsBuilder(); std::shared_ptr build(const vespa::config::search::core::OnnxModelsConfig& config); std::shared_ptr build(const vespa::config::search::core::RankingConstantsConfig& config); diff --git a/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.cpp b/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.cpp index f32722cb96d6..68705c2cf3c0 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.cpp +++ b/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.cpp @@ -20,7 +20,7 @@ RankingAssetsRepo::RankingAssetsRepo(const ConstantValueFactory &factory, RankingAssetsRepo::~RankingAssetsRepo() = default; ConstantValue::UP -RankingAssetsRepo::getConstant(const vespalib::string &name) const +RankingAssetsRepo::getConstant(const std::string &name) const { if ( ! _constants) return {}; const RankingConstants::Constant *constant = _constants->getConstant(name); @@ -30,13 +30,13 @@ RankingAssetsRepo::getConstant(const vespalib::string &name) const return {}; } -vespalib::string -RankingAssetsRepo::getExpression(const vespalib::string &name) const { +std::string +RankingAssetsRepo::getExpression(const std::string &name) const { return _rankingExpressions ? _rankingExpressions->loadExpression(name) : ""; } const OnnxModel * -RankingAssetsRepo::getOnnxModel(const vespalib::string &name) const { +RankingAssetsRepo::getOnnxModel(const std::string &name) const { return _onnxModels ? _onnxModels->getModel(name) : nullptr; } diff --git a/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.h b/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.h index ee68a0c1a769..af7fb773e6a6 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.h +++ b/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.h @@ -31,9 +31,9 @@ class RankingAssetsRepo : public IRankingAssetsRepo { std::shared_ptr expressions, std::shared_ptr models); ~RankingAssetsRepo() override; - vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override; - vespalib::string getExpression(const vespalib::string &name) const override; - const OnnxModel *getOnnxModel(const vespalib::string &name) const override; + vespalib::eval::ConstantValue::UP getConstant(const std::string &name) const override; + std::string getExpression(const std::string &name) const override; + const OnnxModel *getOnnxModel(const std::string &name) const override; }; } diff --git a/searchlib/src/vespa/searchlib/fef/ranking_constants.cpp b/searchlib/src/vespa/searchlib/fef/ranking_constants.cpp index d8436eb104ff..ba79763ff8a4 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_constants.cpp +++ b/searchlib/src/vespa/searchlib/fef/ranking_constants.cpp @@ -4,9 +4,9 @@ namespace search::fef { -RankingConstants::Constant::Constant(const vespalib::string &name_in, - const vespalib::string &type_in, - const vespalib::string &filePath_in) +RankingConstants::Constant::Constant(const std::string &name_in, + const std::string &type_in, + const std::string &filePath_in) : name(name_in), type(type_in), filePath(filePath_in) @@ -46,7 +46,7 @@ RankingConstants::operator==(const RankingConstants &rhs) const } const RankingConstants::Constant * -RankingConstants::getConstant(const vespalib::string &name) const +RankingConstants::getConstant(const std::string &name) const { auto itr = _constants.find(name); if (itr != _constants.end()) { diff --git a/searchlib/src/vespa/searchlib/fef/ranking_constants.h b/searchlib/src/vespa/searchlib/fef/ranking_constants.h index 1c68b87a0172..a6b52bc5c1f8 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_constants.h +++ b/searchlib/src/vespa/searchlib/fef/ranking_constants.h @@ -2,10 +2,10 @@ #pragma once -#include #include -#include #include +#include +#include namespace search::fef { @@ -15,13 +15,13 @@ namespace search::fef { class RankingConstants { public: struct Constant { - vespalib::string name; - vespalib::string type; - vespalib::string filePath; + std::string name; + std::string type; + std::string filePath; - Constant(const vespalib::string &name_in, - const vespalib::string &type_in, - const vespalib::string &filePath_in); + Constant(const std::string &name_in, + const std::string &type_in, + const std::string &filePath_in); ~Constant(); bool operator==(const Constant &rhs) const; }; @@ -29,7 +29,7 @@ class RankingConstants { using Vector = std::vector; private: - using Map = std::map; + using Map = std::map; Map _constants; public: @@ -41,7 +41,7 @@ class RankingConstants { explicit RankingConstants(const Vector &constants); ~RankingConstants(); bool operator==(const RankingConstants &rhs) const; - const Constant *getConstant(const vespalib::string &name) const; + const Constant *getConstant(const std::string &name) const; size_t size() const { return _constants.size(); } }; diff --git a/searchlib/src/vespa/searchlib/fef/ranking_expressions.cpp b/searchlib/src/vespa/searchlib/fef/ranking_expressions.cpp index c5d500ff0428..24f882ee4ead 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_expressions.cpp +++ b/searchlib/src/vespa/searchlib/fef/ranking_expressions.cpp @@ -12,8 +12,8 @@ namespace search::fef { namespace { -vespalib::string extract_data(vespalib::Input &input) { - vespalib::string result; +std::string extract_data(vespalib::Input &input) { + std::string result; for (auto chunk = input.obtain(); chunk.size > 0; chunk = input.obtain()) { result.append(std::string_view(chunk.data, chunk.size)); input.evict(chunk.size); @@ -28,14 +28,14 @@ RankingExpressions::RankingExpressions(RankingExpressions &&rhs) noexcept = defa RankingExpressions::~RankingExpressions() = default; RankingExpressions & -RankingExpressions::add(const vespalib::string &name, const vespalib::string &path) +RankingExpressions::add(const std::string &name, const std::string &path) { _expressions.insert_or_assign(name, path); return *this; } -vespalib::string -RankingExpressions::loadExpression(const vespalib::string &name) const +std::string +RankingExpressions::loadExpression(const std::string &name) const { auto pos = _expressions.find(name); if (pos == _expressions.end()) { diff --git a/searchlib/src/vespa/searchlib/fef/ranking_expressions.h b/searchlib/src/vespa/searchlib/fef/ranking_expressions.h index 6c4c5f5108e6..941bf09387db 100644 --- a/searchlib/src/vespa/searchlib/fef/ranking_expressions.h +++ b/searchlib/src/vespa/searchlib/fef/ranking_expressions.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace search::fef { @@ -16,7 +16,7 @@ class RankingExpressions { private: // expression name -> full_path of expression file - std::map _expressions; + std::map _expressions; public: RankingExpressions(); @@ -29,8 +29,8 @@ class RankingExpressions return _expressions == rhs._expressions; } size_t size() const { return _expressions.size(); } - RankingExpressions &add(const vespalib::string &name, const vespalib::string &path); - vespalib::string loadExpression(const vespalib::string &name) const; + RankingExpressions &add(const std::string &name, const std::string &path); + std::string loadExpression(const std::string &name) const; }; } diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp index b0a17ff4d24e..2410a86b2ab8 100644 --- a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp +++ b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp @@ -17,7 +17,7 @@ class VisitorAdapter : public search::fef::IDumpFeatureVisitor public: explicit VisitorAdapter(search::fef::BlueprintResolver &resolver) : _resolver(resolver) {} - void visitDumpFeature(const vespalib::string &name) override { + void visitDumpFeature(const std::string &name) override { _resolver.addSeed(name); } }; @@ -93,12 +93,12 @@ RankSetup::configure() for (const auto &feature: match::Feature::lookup(_indexEnv.getProperties())) { add_match_feature(feature); } - std::vector summaryFeatures = summary::Feature::lookup(_indexEnv.getProperties()); + std::vector summaryFeatures = summary::Feature::lookup(_indexEnv.getProperties()); for (const auto & feature : summaryFeatures) { addSummaryFeature(feature); } setIgnoreDefaultRankFeatures(dump::IgnoreDefaultFeatures::check(_indexEnv.getProperties())); - std::vector dumpFeatures = dump::Feature::lookup(_indexEnv.getProperties()); + std::vector dumpFeatures = dump::Feature::lookup(_indexEnv.getProperties()); for (const auto & feature : dumpFeatures) { addDumpFeature(feature); } @@ -146,35 +146,35 @@ RankSetup::configure() } void -RankSetup::setFirstPhaseRank(const vespalib::string &featureName) +RankSetup::setFirstPhaseRank(const std::string &featureName) { assert(!_compiled); _firstPhaseRankFeature = featureName; } void -RankSetup::setSecondPhaseRank(const vespalib::string &featureName) +RankSetup::setSecondPhaseRank(const std::string &featureName) { assert(!_compiled); _secondPhaseRankFeature = featureName; } void -RankSetup::add_match_feature(const vespalib::string &match_feature) +RankSetup::add_match_feature(const std::string &match_feature) { assert(!_compiled); _match_features.push_back(match_feature); } void -RankSetup::addSummaryFeature(const vespalib::string &summaryFeature) +RankSetup::addSummaryFeature(const std::string &summaryFeature) { assert(!_compiled); _summaryFeatures.push_back(summaryFeature); } void -RankSetup::addDumpFeature(const vespalib::string &dumpFeature) +RankSetup::addDumpFeature(const std::string &dumpFeature) { assert(!_compiled); _dumpFeatures.push_back(dumpFeature); @@ -199,7 +199,7 @@ RankSetup::compile() _firstPhaseRankFeature = parser.featureName(); _first_phase_resolver->addSeed(_firstPhaseRankFeature); } else { - vespalib::string e = fmt("invalid feature name for first phase rank: '%s'", _firstPhaseRankFeature.c_str()); + std::string e = fmt("invalid feature name for first phase rank: '%s'", _firstPhaseRankFeature.c_str()); _warnings.emplace_back(e); _compileError = true; } @@ -210,7 +210,7 @@ RankSetup::compile() _secondPhaseRankFeature = parser.featureName(); _second_phase_resolver->addSeed(_secondPhaseRankFeature); } else { - vespalib::string e = fmt("invalid feature name for second phase rank: '%s'", _secondPhaseRankFeature.c_str()); + std::string e = fmt("invalid feature name for second phase rank: '%s'", _secondPhaseRankFeature.c_str()); _warnings.emplace_back(e); _compileError = true; } @@ -257,7 +257,7 @@ RankSetup::prepareSharedState(const IQueryEnvironment &queryEnv, IObjectStore &o } } -vespalib::string +std::string RankSetup::getJoinedWarnings() const { vespalib::asciistream os; for (const auto & m : _warnings) { diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.h b/searchlib/src/vespa/searchlib/fef/ranksetup.h index 0a9a3a80dec1..a0198b194cf9 100644 --- a/searchlib/src/vespa/searchlib/fef/ranksetup.h +++ b/searchlib/src/vespa/searchlib/fef/ranksetup.h @@ -35,8 +35,8 @@ class RankSetup {} ~MutateOperation(); bool enabled() const noexcept { return !_attribute.empty() && !_operation.empty(); } - vespalib::string _attribute; - vespalib::string _operation; + std::string _attribute; + std::string _operation; }; private: const BlueprintFactory &_factory; @@ -46,9 +46,9 @@ class RankSetup BlueprintResolver::SP _match_resolver; BlueprintResolver::SP _summary_resolver; BlueprintResolver::SP _dumpResolver; - vespalib::string _firstPhaseRankFeature; - vespalib::string _secondPhaseRankFeature; - vespalib::string _degradationAttribute; + std::string _firstPhaseRankFeature; + std::string _secondPhaseRankFeature; + std::string _degradationAttribute; double _termwise_limit; uint32_t _numThreads; uint32_t _minHitsPerThread; @@ -63,9 +63,9 @@ class RankSetup double _degradationPostFilterMultiplier; std::optional _first_phase_rank_score_drop_limit; std::optional _second_phase_rank_score_drop_limit; - std::vector _match_features; - std::vector _summaryFeatures; - std::vector _dumpFeatures; + std::vector _match_features; + std::vector _summaryFeatures; + std::vector _dumpFeatures; Warnings _warnings; StringStringMap _feature_rename_map; bool _sort_blueprints_by_cost; @@ -74,10 +74,10 @@ class RankSetup bool _compileError; bool _degradationAscendingOrder; bool _always_mark_phrase_expensive; - vespalib::string _diversityAttribute; + std::string _diversityAttribute; uint32_t _diversityMinGroups; double _diversityCutoffFactor; - vespalib::string _diversityCutoffStrategy; + std::string _diversityCutoffStrategy; bool _softTimeoutEnabled; double _softTimeoutTailCost; double _global_filter_lower_limit; @@ -124,14 +124,14 @@ class RankSetup * * @param featureName full feature name for first phase rank **/ - void setFirstPhaseRank(const vespalib::string &featureName); + void setFirstPhaseRank(const std::string &featureName); /** * Returns the first phase ranking. * * @return feature name for first phase rank **/ - const vespalib::string &getFirstPhaseRank() const { return _firstPhaseRankFeature; } + const std::string &getFirstPhaseRank() const { return _firstPhaseRankFeature; } /** * This method is invoked during setup (before invoking the @ref @@ -139,14 +139,14 @@ class RankSetup * * @param featureName full feature name for second phase rank **/ - void setSecondPhaseRank(const vespalib::string &featureName); + void setSecondPhaseRank(const std::string &featureName); /** * Returns the second phase ranking. * * @return feature name for second phase rank **/ - const vespalib::string &getSecondPhaseRank() const { return _secondPhaseRankFeature; } + const std::string &getSecondPhaseRank() const { return _secondPhaseRankFeature; } /** * Set the termwise limit @@ -219,7 +219,7 @@ class RankSetup uint32_t getArraySize() const { return _arraySize; } /** get name of attribute to use for graceful degradation in match phase */ - vespalib::string getDegradationAttribute() const { + std::string getDegradationAttribute() const { return _degradationAttribute; } /** check whether attribute should be used in ascending order during graceful degradation in match phase */ @@ -244,7 +244,7 @@ class RankSetup } /** get the attribute used to ensure diversity during match phase limiting **/ - vespalib::string getDiversityAttribute() const { + std::string getDiversityAttribute() const { return _diversityAttribute; } @@ -257,12 +257,12 @@ class RankSetup return _diversityCutoffFactor; } - const vespalib::string & getDiversityCutoffStrategy() const { + const std::string & getDiversityCutoffStrategy() const { return _diversityCutoffStrategy; } /** set name of attribute to use for graceful degradation in match phase */ - void setDegradationAttribute(const vespalib::string &name) { + void setDegradationAttribute(const std::string &name) { _degradationAttribute = name; } /** set whether attribute should be used in ascending order during graceful degradation in match phase */ @@ -289,7 +289,7 @@ class RankSetup } /** set the attribute used to ensure diversity during match phase limiting **/ - void setDiversityAttribute(const vespalib::string &value) { + void setDiversityAttribute(const std::string &value) { _diversityAttribute = value; } @@ -302,7 +302,7 @@ class RankSetup _diversityCutoffFactor = value; } - void setDiversityCutoffStrategy(const vespalib::string & value) { + void setDiversityCutoffStrategy(const std::string & value) { _diversityCutoffStrategy = value; } @@ -358,7 +358,7 @@ class RankSetup * * @param match_feature full feature name of a match feature **/ - void add_match_feature(const vespalib::string &match_feature); + void add_match_feature(const std::string &match_feature); /** * This method may be used to indicate that certain features @@ -366,7 +366,7 @@ class RankSetup * * @param summaryFeature full feature name of a summary feature **/ - void addSummaryFeature(const vespalib::string &summaryFeature); + void addSummaryFeature(const std::string &summaryFeature); /** * @return whether there are any match features @@ -378,7 +378,7 @@ class RankSetup * * @return vector of match feature names. **/ - const std::vector &get_match_features() const { return _match_features; } + const std::vector &get_match_features() const { return _match_features; } const StringStringMap &get_feature_rename_map() const { return _feature_rename_map; } @@ -387,7 +387,7 @@ class RankSetup * * @return vector of summary feature names. **/ - const std::vector &getSummaryFeatures() const { return _summaryFeatures; } + const std::vector &getSummaryFeatures() const { return _summaryFeatures; } /** * Set the flag indicating whether we should ignore the default @@ -419,14 +419,14 @@ class RankSetup * * @param dumpFeature full feature name of a dump feature **/ - void addDumpFeature(const vespalib::string &dumpFeature); + void addDumpFeature(const std::string &dumpFeature); /** * Returns a const view of the dump features added. * * @return vector of dump feature names. **/ - const std::vector &getDumpFeatures() const { return _dumpFeatures; } + const std::vector &getDumpFeatures() const { return _dumpFeatures; } /** * Create blueprints, resolve dependencies and form a strategy for @@ -444,7 +444,7 @@ class RankSetup * Will return any accumulated warnings during compile * @return joined string of warnings separated by newline */ - vespalib::string getJoinedWarnings() const; + std::string getJoinedWarnings() const; // These functions create rank programs for different tasks. Note // that the setup function must be called on rank programs for diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.h b/searchlib/src/vespa/searchlib/fef/simpletermdata.h index 6155953a546c..6b65db16e5fd 100644 --- a/searchlib/src/vespa/searchlib/fef/simpletermdata.h +++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.h @@ -19,7 +19,7 @@ class SimpleTermData final : public ITermData query::Weight _weight; uint32_t _numTerms; uint32_t _uniqueId; - std::optional _query_tensor_name; + std::optional _query_tensor_name; std::vector _fields; public: @@ -38,7 +38,7 @@ class SimpleTermData final : public ITermData [[nodiscard]] uint32_t getUniqueId() const override { return _uniqueId; } - [[nodiscard]] std::optional query_tensor_name() const override { return _query_tensor_name; } + [[nodiscard]] std::optional query_tensor_name() const override { return _query_tensor_name; } [[nodiscard]] size_t numFields() const override { return _fields.size(); } @@ -85,7 +85,7 @@ class SimpleTermData final : public ITermData return *this; } - SimpleTermData &set_query_tensor_name(const vespalib::string &name) { + SimpleTermData &set_query_tensor_name(const std::string &name) { _query_tensor_name = name; return *this; } diff --git a/searchlib/src/vespa/searchlib/fef/tablemanager.cpp b/searchlib/src/vespa/searchlib/fef/tablemanager.cpp index 581d65fddf45..d71710d7602d 100644 --- a/searchlib/src/vespa/searchlib/fef/tablemanager.cpp +++ b/searchlib/src/vespa/searchlib/fef/tablemanager.cpp @@ -9,7 +9,7 @@ TableManager::TableManager() = default; TableManager::~TableManager() = default; const Table * -TableManager::getTable(const vespalib::string & name) const +TableManager::getTable(const std::string & name) const { std::lock_guard guard(_lock); auto itr = _cache.find(name); diff --git a/searchlib/src/vespa/searchlib/fef/tablemanager.h b/searchlib/src/vespa/searchlib/fef/tablemanager.h index bdd12155e3ae..6262524b004b 100644 --- a/searchlib/src/vespa/searchlib/fef/tablemanager.h +++ b/searchlib/src/vespa/searchlib/fef/tablemanager.h @@ -20,7 +20,7 @@ class TableManager : public ITableManager TableManager(const TableManager &); TableManager &operator=(const TableManager &); - using TableCache = std::map; + using TableCache = std::map; std::vector _factories; mutable TableCache _cache; mutable std::mutex _lock; @@ -42,7 +42,7 @@ class TableManager : public ITableManager * The first table that is successfully created is added it to the cache and returned. * 3. Return NULL. **/ - const Table * getTable(const vespalib::string & name) const override; + const Table * getTable(const std::string & name) const override; }; } diff --git a/searchlib/src/vespa/searchlib/fef/test/attribute_map.h b/searchlib/src/vespa/searchlib/fef/test/attribute_map.h index 78646f746447..17561d6acc0c 100644 --- a/searchlib/src/vespa/searchlib/fef/test/attribute_map.h +++ b/searchlib/src/vespa/searchlib/fef/test/attribute_map.h @@ -19,8 +19,8 @@ namespace search::fef::test { * attribute map for their lookups. */ class AttributeMap { - std::map> _attributes; - std::map> _guards; + std::map> _attributes; + std::map> _guards; public: using IAttributeVector = attribute::IAttributeVector; ~AttributeMap(); @@ -34,7 +34,7 @@ class AttributeMap { } const IAttributeVector * getAttribute(std::string_view name_view) const { - vespalib::string name(name_view); + std::string name(name_view); auto attrItr = _attributes.find(name); if (attrItr != _attributes.end()) { return attrItr->second.get(); diff --git a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp index 35ed5f742e67..3a221fdb498e 100644 --- a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp @@ -25,13 +25,13 @@ DummyDependencyHandler::~DummyDependencyHandler() } void -DummyDependencyHandler::define_object_input(const vespalib::string &name, const vespalib::eval::ValueType &type) +DummyDependencyHandler::define_object_input(const std::string &name, const vespalib::eval::ValueType &type) { object_type_map.emplace(name, FeatureType::object(type)); } std::optional -DummyDependencyHandler::resolve_input(const vespalib::string &feature_name, Blueprint::AcceptInput accept_type) +DummyDependencyHandler::resolve_input(const std::string &feature_name, Blueprint::AcceptInput accept_type) { input.push_back(feature_name); accept_input.push_back(accept_type); @@ -51,14 +51,14 @@ DummyDependencyHandler::resolve_input(const vespalib::string &feature_name, Blue } void -DummyDependencyHandler::define_output(const vespalib::string &output_name, FeatureType type) +DummyDependencyHandler::define_output(const std::string &output_name, FeatureType type) { output.push_back(output_name); output_type.push_back(std::move(type)); } void -DummyDependencyHandler::fail(const vespalib::string &msg) +DummyDependencyHandler::fail(const std::string &msg) { fail_msg = msg; } diff --git a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.h b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.h index 6242dde9355c..055e91af5c35 100644 --- a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.h +++ b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.h @@ -3,11 +3,11 @@ #pragma once #include -#include -#include #include #include #include +#include +#include namespace search::fef::test { @@ -18,20 +18,20 @@ namespace search::fef::test { struct DummyDependencyHandler : public Blueprint::DependencyHandler { Blueprint &blueprint; - std::map object_type_map; + std::map object_type_map; bool accept_type_mismatch; - std::vector input; + std::vector input; std::vector accept_input; - std::vector output; + std::vector output; std::vector output_type; - vespalib::string fail_msg; + std::string fail_msg; explicit DummyDependencyHandler(Blueprint &blueprint_in); ~DummyDependencyHandler(); - void define_object_input(const vespalib::string &name, const vespalib::eval::ValueType &type); - std::optional resolve_input(const vespalib::string &feature_name, Blueprint::AcceptInput accept_type) override; - void define_output(const vespalib::string &output_name, FeatureType type) override; - void fail(const vespalib::string &msg) override; + void define_object_input(const std::string &name, const vespalib::eval::ValueType &type); + std::optional resolve_input(const std::string &feature_name, Blueprint::AcceptInput accept_type) override; + void define_output(const std::string &output_name, FeatureType type) override; + void fail(const std::string &msg) override; }; } diff --git a/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp b/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp index b83293c6ad8c..c3854055034c 100644 --- a/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp @@ -14,7 +14,7 @@ FeatureTest::FeatureTest(BlueprintFactory &factory, const IndexEnvironment &indexEnv, QueryEnvironment &queryEnv, MatchDataLayout &layout, - const std::vector &features, + const std::vector &features, const Properties &overrides) : _factory(factory), _indexEnv(indexEnv), @@ -35,7 +35,7 @@ FeatureTest::FeatureTest(BlueprintFactory &factory, const IndexEnvironment &indexEnv, QueryEnvironment &queryEnv, MatchDataLayout &layout, - const vespalib::string &feature, + const std::string &feature, const Properties &overrides) : _factory(factory), _indexEnv(indexEnv), @@ -123,7 +123,7 @@ FeatureTest::executeOnly(RankResult & result, uint32_t docId) LOG(error, "Setup not done."); return false; } - std::map all = Utils::getAllFeatures(*_rankProgram, docId); + std::map all = Utils::getAllFeatures(*_rankProgram, docId); for (auto itr = all.begin(); itr != all.end(); ++itr) { result.addScore(itr->first, itr->second); } diff --git a/searchlib/src/vespa/searchlib/fef/test/featuretest.h b/searchlib/src/vespa/searchlib/fef/test/featuretest.h index bdcacdc88579..b5a984fc581a 100644 --- a/searchlib/src/vespa/searchlib/fef/test/featuretest.h +++ b/searchlib/src/vespa/searchlib/fef/test/featuretest.h @@ -38,7 +38,7 @@ class FeatureTest { const IndexEnvironment &indexEnv, QueryEnvironment &queryEnv, MatchDataLayout &layout, - const std::vector &features, + const std::vector &features, const Properties &overrides); ~FeatureTest(); @@ -56,7 +56,7 @@ class FeatureTest { const IndexEnvironment &indexEnv, QueryEnvironment &queryEnv, MatchDataLayout &layout, - const vespalib::string &feature, + const std::string &feature, const Properties &overrides); /** * Necessary method to setup the internal feature execution manager. A test will typically assert on the return of @@ -112,7 +112,7 @@ class FeatureTest { BlueprintFactory &_factory; const IndexEnvironment &_indexEnv; QueryEnvironment &_queryEnv; - std::vector _features; + std::vector _features; MatchDataLayout &_layout; const Properties &_overrides; BlueprintResolver::SP _resolver; diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp index b3b42a179d81..5c75270876f4 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp @@ -25,7 +25,7 @@ FtQueryEnvironment::~FtQueryEnvironment() = default; FtDumpFeatureVisitor::FtDumpFeatureVisitor() = default; -FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const vespalib::string &feature) : +FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const std::string &feature) : _indexEnv(), _queryEnv(_indexEnv), _overrides(), @@ -33,7 +33,7 @@ FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const vespa { } -FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector &features) +FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector &features) : _indexEnv(), _queryEnv(_indexEnv), _overrides(), @@ -46,11 +46,11 @@ FtFeatureTest::~FtFeatureTest() = default; //--------------------------------------------------------------------------------------------------------------------- // FtUtil //--------------------------------------------------------------------------------------------------------------------- -std::vector -FtUtil::tokenize(const vespalib::string & str, const vespalib::string & separator) +std::vector +FtUtil::tokenize(const std::string & str, const std::string & separator) { - std::vector retval; - if (separator != vespalib::string("")) { + std::vector retval; + if (separator != std::string("")) { vespalib::StringTokenizer tnz(str, separator); tnz.removeEmptyTokens(); for (auto token : tnz) { @@ -66,14 +66,14 @@ FtUtil::tokenize(const vespalib::string & str, const vespalib::string & separato FtQuery -FtUtil::toQuery(const vespalib::string & query, const vespalib::string & separator) +FtUtil::toQuery(const std::string & query, const std::string & separator) { - std::vector prepQuery = FtUtil::tokenize(query, separator); + std::vector prepQuery = FtUtil::tokenize(query, separator); FtQuery retval(prepQuery.size()); for (uint32_t i = 0; i < prepQuery.size(); ++i) { - std::vector significanceSplit = FtUtil::tokenize(prepQuery[i], vespalib::string("%")); - std::vector weightSplit = FtUtil::tokenize(significanceSplit[0], vespalib::string("!")); - std::vector connexitySplit = FtUtil::tokenize(weightSplit[0], vespalib::string(":")); + std::vector significanceSplit = FtUtil::tokenize(prepQuery[i], std::string("%")); + std::vector weightSplit = FtUtil::tokenize(significanceSplit[0], std::string("!")); + std::vector connexitySplit = FtUtil::tokenize(weightSplit[0], std::string(":")); if (connexitySplit.size() > 1) { retval[i].term = connexitySplit[1]; retval[i].connexity = util::strToNum(connexitySplit[0]); @@ -91,14 +91,14 @@ FtUtil::toQuery(const vespalib::string & query, const vespalib::string & separat } RankResult -FtUtil::toRankResult(const vespalib::string & baseName, const vespalib::string & result, const vespalib::string & separator) +FtUtil::toRankResult(const std::string & baseName, const std::string & result, const std::string & separator) { RankResult retval; - std::vector prepResult = FtUtil::tokenize(result, separator); + std::vector prepResult = FtUtil::tokenize(result, separator); for (const auto & str : prepResult) { - std::vector rs = FtUtil::tokenize(str, ":"); - vespalib::string name = rs[0]; - vespalib::string value = rs[1]; + std::vector rs = FtUtil::tokenize(str, ":"); + std::string name = rs[0]; + std::string value = rs[1]; retval.addScore(baseName + "." + name, search::features::util::strToNum(value)); } return retval; diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.h b/searchlib/src/vespa/searchlib/fef/test/ftlib.h index 865f3ba0c320..64e8c6b8a0f3 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.h +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.h @@ -17,24 +17,24 @@ using search::feature_t; //--------------------------------------------------------------------------------------------------------------------- // StringList //--------------------------------------------------------------------------------------------------------------------- -class StringList : public std::vector { +class StringList : public std::vector { public: StringList &add(std::string_view str) { emplace_back(str); return *this; } - StringList &clear() { std::vector::clear(); return *this; } + StringList &clear() { std::vector::clear(); return *this; } }; //--------------------------------------------------------------------------------------------------------------------- // StringMap //--------------------------------------------------------------------------------------------------------------------- -class StringMap : public std::map { +class StringMap : public std::map { public: - StringMap &add(const vespalib::string &key, const vespalib::string &val) { + StringMap &add(const std::string &key, const std::string &val) { iterator it = insert(std::make_pair(key, val)).first; it->second = val; return *this; } StringMap &clear() { - std::map::clear(); + std::map::clear(); return *this; } }; @@ -42,10 +42,10 @@ class StringMap : public std::map { //--------------------------------------------------------------------------------------------------------------------- // StringSet //--------------------------------------------------------------------------------------------------------------------- -class StringSet : public std::set { +class StringSet : public std::set { public: - StringSet & add(const vespalib::string & str) { insert(str); return *this; } - StringSet & clear() { std::set::clear(); return *this; } + StringSet & add(const std::string & str) { insert(str); return *this; } + StringSet & clear() { std::set::clear(); return *this; } }; @@ -84,12 +84,12 @@ class FtQueryEnvironment : public search::fef::test::QueryEnvironment { class FtDumpFeatureVisitor : public search::fef::IDumpFeatureVisitor { private: - std::vector _features; + std::vector _features; public: FtDumpFeatureVisitor(); - void visitDumpFeature(const vespalib::string & name) override { _features.push_back(name); } - const std::vector & features() const { return _features; } + void visitDumpFeature(const std::string & name) override { _features.push_back(name); } + const std::vector & features() const { return _features; } }; //--------------------------------------------------------------------------------------------------------------------- @@ -97,8 +97,8 @@ class FtDumpFeatureVisitor : public search::fef::IDumpFeatureVisitor //--------------------------------------------------------------------------------------------------------------------- class FtFeatureTest { public: - FtFeatureTest(search::fef::BlueprintFactory &factory, const vespalib::string &feature); - FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector &features); + FtFeatureTest(search::fef::BlueprintFactory &factory, const std::string &feature); + FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector &features); ~FtFeatureTest(); bool setup() { return _test.setup(); } @@ -123,10 +123,10 @@ class FtFeatureTest { // FtQueryTerm //--------------------------------------------------------------------------------------------------------------------- struct FtQueryTerm { - FtQueryTerm(const vespalib::string t, uint32_t tw = 100, feature_t co = 0.1f, feature_t si = 0.1f) : + FtQueryTerm(const std::string t, uint32_t tw = 100, feature_t co = 0.1f, feature_t si = 0.1f) : term(t), termWeight(tw), connexity(co), significance(si) {} FtQueryTerm() noexcept : term(), termWeight(100), connexity(0.1f), significance(0.1f) {} - vespalib::string term; + std::string term; search::query::Weight termWeight; feature_t connexity; feature_t significance; @@ -139,18 +139,18 @@ struct FtQueryTerm { }; using FtQuery = std::vector; -using StringVectorMap = std::map >; +using StringVectorMap = std::map >; //--------------------------------------------------------------------------------------------------------------------- // FtUtil //--------------------------------------------------------------------------------------------------------------------- class FtUtil { public: - static std::vector tokenize(const vespalib::string & str, const vespalib::string & separator = " "); - static FtQuery toQuery(const vespalib::string & query, const vespalib::string & separator = " "); - static search::fef::test::RankResult toRankResult(const vespalib::string & baseName, - const vespalib::string & result, - const vespalib::string & separator = " "); + static std::vector tokenize(const std::string & str, const std::string & separator = " "); + static FtQuery toQuery(const std::string & query, const std::string & separator = " "); + static search::fef::test::RankResult toRankResult(const std::string & baseName, + const std::string & result, + const std::string & separator = " "); }; //--------------------------------------------------------------------------------------------------------------------- @@ -158,24 +158,24 @@ class FtUtil { //--------------------------------------------------------------------------------------------------------------------- struct FtIndex { struct Element { - using Tokens = std::vector; + using Tokens = std::vector; int32_t weight; Tokens tokens; Element(int32_t w, const Tokens &t) : weight(w), tokens(t) {} }; using Field = std::vector; - using FieldMap = std::map; + using FieldMap = std::map; FieldMap index; // raw content of all fields - vespalib::string cursor; // last referenced field + std::string cursor; // last referenced field FtIndex() : index(), cursor() {} ~FtIndex(); - FtIndex &field(const vespalib::string &name) { + FtIndex &field(const std::string &name) { cursor = name; index[name]; return *this; } - FtIndex &element(const vespalib::string &content, int32_t weight = 1) { + FtIndex &element(const std::string &content, int32_t weight = 1) { assert(!cursor.empty()); index[cursor].push_back(Element(weight, FtUtil::tokenize(content, " "))); return *this; diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp index 3d9af0e49183..8a642854a609 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp @@ -32,7 +32,7 @@ IndexEnvironment::getFieldByName(const string &name) const vespalib::eval::ConstantValue::UP -IndexEnvironment::getConstantValue(const vespalib::string &name) const +IndexEnvironment::getConstantValue(const std::string &name) const { auto it = _constants.find(name); if (it != _constants.end()) { @@ -43,7 +43,7 @@ IndexEnvironment::getConstantValue(const vespalib::string &name) const } void -IndexEnvironment::addConstantValue(const vespalib::string &name, +IndexEnvironment::addConstantValue(const std::string &name, vespalib::eval::ValueType type, std::unique_ptr value) { @@ -52,8 +52,8 @@ IndexEnvironment::addConstantValue(const vespalib::string &name, (void) insertRes; } -vespalib::string -IndexEnvironment::getRankingExpression(const vespalib::string &name) const +std::string +IndexEnvironment::getRankingExpression(const std::string &name) const { auto pos = _expressions.find(name); if (pos != _expressions.end()) { @@ -63,13 +63,13 @@ IndexEnvironment::getRankingExpression(const vespalib::string &name) const } void -IndexEnvironment::addRankingExpression(const vespalib::string &name, const vespalib::string &value) +IndexEnvironment::addRankingExpression(const std::string &name, const std::string &value) { _expressions.insert_or_assign(name, value); } const OnnxModel * -IndexEnvironment::getOnnxModel(const vespalib::string &name) const +IndexEnvironment::getOnnxModel(const std::string &name) const { auto pos = _models.find(name); if (pos != _models.end()) { diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h index 35b5b607ca33..39c01df32bbf 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h @@ -47,9 +47,9 @@ class IndexEnvironment : public IIndexEnvironment ~ConstantRef() override = default; }; - using ConstantsMap = std::map; - using ExprMap = std::map; - using ModelMap = std::map; + using ConstantsMap = std::map; + using ExprMap = std::map; + using ModelMap = std::map; IndexEnvironment(); IndexEnvironment(const IndexEnvironment &) = delete; @@ -80,16 +80,16 @@ class IndexEnvironment : public IIndexEnvironment /** Returns a reference to the table manager of this. */ TableManager &getTableManager() { return _tableMan; } - vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override; + vespalib::eval::ConstantValue::UP getConstantValue(const std::string &name) const override; - void addConstantValue(const vespalib::string &name, + void addConstantValue(const std::string &name, vespalib::eval::ValueType type, std::unique_ptr value); - vespalib::string getRankingExpression(const vespalib::string &name) const override; - void addRankingExpression(const vespalib::string &name, const vespalib::string &value); + std::string getRankingExpression(const std::string &name) const override; + void addRankingExpression(const std::string &name, const std::string &value); - const OnnxModel *getOnnxModel(const vespalib::string &name) const override; + const OnnxModel *getOnnxModel(const std::string &name) const override; void addOnnxModel(OnnxModel model); private: diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp index e8ea11e8ab71..f6b56e70931f 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp @@ -13,7 +13,7 @@ IndexEnvironmentBuilder::IndexEnvironmentBuilder(IndexEnvironment &env) : IndexEnvironmentBuilder & IndexEnvironmentBuilder::addField(const FieldType &type, const FieldInfo::CollectionType &coll, - const vespalib::string &name) + const std::string &name) { return addField(type, coll, FieldInfo::DataType::DOUBLE, name); } @@ -22,7 +22,7 @@ IndexEnvironmentBuilder & IndexEnvironmentBuilder::addField(const FieldType &type, const FieldInfo::CollectionType &coll, const FieldInfo::DataType &dataType, - const vespalib::string &name) + const std::string &name) { uint32_t idx = _env.getFields().size(); FieldInfo field(type, coll, name, idx); diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h index 4ce235e501aa..4c9c26766f22 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h @@ -26,7 +26,7 @@ class IndexEnvironmentBuilder { */ IndexEnvironmentBuilder &addField(const FieldType &type, const FieldInfo::CollectionType &coll, - const vespalib::string &name); + const std::string &name); /** * Add a field to the index environment with specified data type. @@ -39,7 +39,7 @@ class IndexEnvironmentBuilder { IndexEnvironmentBuilder &addField(const FieldType &type, const FieldInfo::CollectionType &coll, const FieldInfo::DataType &dataType, - const vespalib::string &name); + const std::string &name); /** Returns a reference to the index environment of this. */ IndexEnvironment &getIndexEnv() { return _env; } diff --git a/searchlib/src/vespa/searchlib/fef/test/labels.h b/searchlib/src/vespa/searchlib/fef/test/labels.h index 6ad4478bd2b3..0aad45fa0a44 100644 --- a/searchlib/src/vespa/searchlib/fef/test/labels.h +++ b/searchlib/src/vespa/searchlib/fef/test/labels.h @@ -16,9 +16,9 @@ struct NoLabel : public Labels { ~NoLabel() override; }; struct SingleLabel : public Labels { - vespalib::string label; + std::string label; uint32_t uid; - SingleLabel(const vespalib::string &l, uint32_t x) : label(l), uid(x) {} + SingleLabel(const std::string &l, uint32_t x) : label(l), uid(x) {} virtual void inject(Properties &p) const override { vespalib::asciistream key; key << "vespa.label." << label << ".id"; diff --git a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp index 41551ac10621..686ff5067dd9 100644 --- a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp @@ -40,7 +40,7 @@ MatchDataBuilder::getTermFieldMatchData(uint32_t termId, uint32_t fieldId) bool -MatchDataBuilder::setFieldLength(const vespalib::string &fieldName, uint32_t length) +MatchDataBuilder::setFieldLength(const std::string &fieldName, uint32_t length) { const FieldInfo *info = _queryEnv.getIndexEnv()->getFieldByName(fieldName); if (info == nullptr) { @@ -52,7 +52,7 @@ MatchDataBuilder::setFieldLength(const vespalib::string &fieldName, uint32_t len } bool -MatchDataBuilder::addElement(const vespalib::string &fieldName, int32_t weight, uint32_t length) +MatchDataBuilder::addElement(const std::string &fieldName, int32_t weight, uint32_t length) { const FieldInfo *info = _queryEnv.getIndexEnv()->getFieldByName(fieldName); if (info == nullptr) { @@ -64,7 +64,7 @@ MatchDataBuilder::addElement(const vespalib::string &fieldName, int32_t weight, } bool -MatchDataBuilder::addOccurence(const vespalib::string &fieldName, uint32_t termId, uint32_t pos, uint32_t element) +MatchDataBuilder::addOccurence(const std::string &fieldName, uint32_t termId, uint32_t pos, uint32_t element) { const FieldInfo *info = _queryEnv.getIndexEnv()->getFieldByName(fieldName); if (info == nullptr) { @@ -85,7 +85,7 @@ MatchDataBuilder::addOccurence(const vespalib::string &fieldName, uint32_t termI } bool -MatchDataBuilder::setWeight(const vespalib::string &fieldName, uint32_t termId, int32_t weight) +MatchDataBuilder::setWeight(const std::string &fieldName, uint32_t termId, int32_t weight) { const FieldInfo *info = _queryEnv.getIndexEnv()->getFieldByName(fieldName); if (info == nullptr) { @@ -135,7 +135,7 @@ MatchDataBuilder::apply(uint32_t docId) // For log, attempt to lookup field name. const FieldInfo *info = _queryEnv.getIndexEnv()->getField(fieldId); - vespalib::string name = info != nullptr ? info->name() : vespalib::make_string("%d", fieldId).c_str(); + std::string name = info != nullptr ? info->name() : vespalib::make_string("%d", fieldId).c_str(); // For each occurence of that term, in that field, do for (const auto& occ : field_elem.second) { diff --git a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h index 753e1596520f..81452d6d1046 100644 --- a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h @@ -90,7 +90,7 @@ class MatchDataBuilder { * @param length The length to set. * @return Whether or not the field length could be set. */ - bool setFieldLength(const vespalib::string &fieldName, uint32_t length); + bool setFieldLength(const std::string &fieldName, uint32_t length); /** * Adds an element to a named field. This will fail if the named field does not exist. @@ -100,7 +100,7 @@ class MatchDataBuilder { * @param length The length of the element. * @return Whether or not the element could be added. */ - bool addElement(const vespalib::string &fieldName, int32_t weight, uint32_t length); + bool addElement(const std::string &fieldName, int32_t weight, uint32_t length); /** * Adds an occurence of a term to the named field, at the given @@ -114,7 +114,7 @@ class MatchDataBuilder { * @param element The element containing the occurence. * @return Whether or not the occurence could be added. */ - bool addOccurence(const vespalib::string &fieldName, uint32_t termId, uint32_t pos, uint32_t element = 0); + bool addOccurence(const std::string &fieldName, uint32_t termId, uint32_t pos, uint32_t element = 0); /** * Sets the weight for an attribute match. @@ -124,7 +124,7 @@ class MatchDataBuilder { * @param weight The weight of the match. * @return Whether or not the occurence could be added. **/ - bool setWeight(const vespalib::string &fieldName, uint32_t termId, int32_t weight); + bool setWeight(const std::string &fieldName, uint32_t termId, int32_t weight); /** * Apply the content of this builder to the underlying match data. diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h index 8d183abd9da7..fb96a7bd060e 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h @@ -48,7 +48,7 @@ class QueryEnvironment : public IQueryEnvironment return locations; } const search::attribute::IAttributeContext &getAttributeContext() const override { return *_attrCtx; } - double get_average_field_length(const vespalib::string& field_name) const override { + double get_average_field_length(const std::string& field_name) const override { auto itr = _avg_field_lengths.find(field_name); if (itr != _avg_field_lengths.end()) { return itr->second; diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp index 1ae14f197033..d6912867eaa2 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp @@ -29,7 +29,7 @@ QueryEnvironmentBuilder::addAllFields() } SimpleTermData * -QueryEnvironmentBuilder::addIndexNode(const std::vector &fieldNames) +QueryEnvironmentBuilder::addIndexNode(const std::vector &fieldNames) { _queryEnv.getTerms().push_back(SimpleTermData()); SimpleTermData &td = _queryEnv.getTerms().back(); @@ -46,7 +46,7 @@ QueryEnvironmentBuilder::addIndexNode(const std::vector &field } SimpleTermData * -QueryEnvironmentBuilder::addAttributeNode(const vespalib::string &attrName) +QueryEnvironmentBuilder::addAttributeNode(const std::string &attrName) { const FieldInfo *info = _queryEnv.getIndexEnv()->getFieldByName(attrName); if (info == nullptr || info->type() != FieldType::ATTRIBUTE) { @@ -56,7 +56,7 @@ QueryEnvironmentBuilder::addAttributeNode(const vespalib::string &attrName) } SimpleTermData * -QueryEnvironmentBuilder::add_virtual_node(const vespalib::string &virtual_field) +QueryEnvironmentBuilder::add_virtual_node(const std::string &virtual_field) { const auto *info = _queryEnv.getIndexEnv()->getFieldByName(virtual_field); if (info == nullptr || info->type() != FieldType::VIRTUAL) { @@ -77,7 +77,7 @@ QueryEnvironmentBuilder::add_node(const FieldInfo &info) } QueryEnvironmentBuilder& -QueryEnvironmentBuilder::set_avg_field_length(const vespalib::string& field_name, double avg_field_length) +QueryEnvironmentBuilder::set_avg_field_length(const std::string& field_name, double avg_field_length) { _queryEnv.get_avg_field_lengths()[field_name] = avg_field_length; return *this; diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h index 36a77e7618bd..e7a689441cd3 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h @@ -35,7 +35,7 @@ class QueryEnvironmentBuilder { * * @return Pointer to the corresponding term data or NULL if one of the fields does not exists. */ - SimpleTermData *addIndexNode(const std::vector &fieldNames); + SimpleTermData *addIndexNode(const std::vector &fieldNames); /** * Add an attribute node searching in the given attribute to this query environment. @@ -43,12 +43,12 @@ class QueryEnvironmentBuilder { * * @return Pointer to the corresponding term data or NULL if attribute does not exists. */ - SimpleTermData *addAttributeNode(const vespalib::string & attrName); + SimpleTermData *addAttributeNode(const std::string & attrName); /** * Add a term node searching in the given virtual field. */ - SimpleTermData *add_virtual_node(const vespalib::string &virtual_field); + SimpleTermData *add_virtual_node(const std::string &virtual_field); /** Returns a reference to the query environment of this. */ QueryEnvironment &getQueryEnv() { return _queryEnv; } @@ -62,7 +62,7 @@ class QueryEnvironmentBuilder { /** Returns a const reference to the match data layout of this. */ const MatchDataLayout &getLayout() const { return _layout; } - QueryEnvironmentBuilder& set_avg_field_length(const vespalib::string& field_name, double avg_field_length); + QueryEnvironmentBuilder& set_avg_field_length(const std::string& field_name, double avg_field_length); private: QueryEnvironmentBuilder(const QueryEnvironmentBuilder &); // hide diff --git a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp index 1ee3fe1c139d..a5c8757e8987 100644 --- a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp @@ -16,14 +16,14 @@ RankResult::RankResult() : } RankResult & -RankResult::addScore(const vespalib::string & featureName, feature_t score) +RankResult::addScore(const std::string & featureName, feature_t score) { _rankScores[featureName] = score; return *this; } feature_t -RankResult::getScore(const vespalib::string & featureName) const +RankResult::getScore(const std::string & featureName) const { auto itr = _rankScores.find(featureName); if (itr != _rankScores.end()) { @@ -69,8 +69,8 @@ RankResult::clear() return *this; } -std::vector & -RankResult::getKeys(std::vector &ret) +std::vector & +RankResult::getKeys(std::vector &ret) { for (const auto& score : _rankScores) { ret.push_back(score.first); @@ -78,10 +78,10 @@ RankResult::getKeys(std::vector &ret) return ret; } -std::vector +std::vector RankResult::getKeys() { - std::vector ret; + std::vector ret; return getKeys(ret); } diff --git a/searchlib/src/vespa/searchlib/fef/test/rankresult.h b/searchlib/src/vespa/searchlib/fef/test/rankresult.h index f377c3a03b2d..9cf45a78046b 100644 --- a/searchlib/src/vespa/searchlib/fef/test/rankresult.h +++ b/searchlib/src/vespa/searchlib/fef/test/rankresult.h @@ -2,9 +2,9 @@ #pragma once #include -#include -#include #include +#include +#include namespace search::fef::test { @@ -13,7 +13,7 @@ class RankResult { /** * Convenience typedefs. */ - using RankScores = std::map; + using RankScores = std::map; public: /** @@ -28,7 +28,7 @@ class RankResult { * @param score The score of that feature. * @return This, to allow chaining. */ - RankResult &addScore(const vespalib::string & featureName, feature_t score); + RankResult &addScore(const std::string & featureName, feature_t score); /** * Returns the score of a given feature. @@ -36,7 +36,7 @@ class RankResult { * @param featureName The name of the feature. * @return The score of that feature. */ - feature_t getScore(const vespalib::string & featureName) const; + feature_t getScore(const std::string & featureName) const; /** * Implements equality operator. @@ -67,14 +67,14 @@ class RankResult { * @param ret The vector to fill. * @return Reference to the 'ret' param. */ - std::vector &getKeys(std::vector &ret); + std::vector &getKeys(std::vector &ret); /** * Creates and returns a vector with the key strings of this. * * @return List of all key strings. */ - std::vector getKeys(); + std::vector getKeys(); /** * Sets the epsilon used when comparing this rank result to another. diff --git a/searchlib/src/vespa/searchlib/fef/utils.cpp b/searchlib/src/vespa/searchlib/fef/utils.cpp index 1b660ba380e0..da69825195d2 100644 --- a/searchlib/src/vespa/searchlib/fef/utils.cpp +++ b/searchlib/src/vespa/searchlib/fef/utils.cpp @@ -31,13 +31,13 @@ Utils::getObjectFeature(const RankProgram &rankProgram, uint32_t docid) namespace { -std::map +std::map resolveFeatures(const FeatureResolver &resolver, uint32_t docid) { - std::map result; + std::map result; size_t numFeatures = resolver.num_features(); for (size_t i = 0; i < numFeatures; ++i) { - const vespalib::string &name = resolver.name_of(i); + const std::string &name = resolver.name_of(i); feature_t value = resolver.resolve(i).as_number(docid); result.insert(std::make_pair(name, value)); } @@ -46,27 +46,27 @@ resolveFeatures(const FeatureResolver &resolver, uint32_t docid) } -std::map +std::map Utils::getSeedFeatures(const RankProgram &rankProgram, uint32_t docid) { FeatureResolver resolver(rankProgram.get_seeds()); return resolveFeatures(resolver, docid); } -std::map +std::map Utils::getAllFeatures(const RankProgram &rankProgram, uint32_t docid) { FeatureResolver resolver(rankProgram.get_all_features()); return resolveFeatures(resolver, docid); } -std::vector +std::vector Utils::extract_feature_names(const FeatureResolver& resolver, const StringStringMap& renames) { - std::vector result; + std::vector result; result.reserve(resolver.num_features()); for (size_t i = 0; i < resolver.num_features(); ++i) { - vespalib::string name = resolver.name_of(i); + std::string name = resolver.name_of(i); auto iter = renames.find(name); if (iter != renames.end()) { name = iter->second; diff --git a/searchlib/src/vespa/searchlib/fef/utils.h b/searchlib/src/vespa/searchlib/fef/utils.h index 830fbcf9340a..3debaaf3647e 100644 --- a/searchlib/src/vespa/searchlib/fef/utils.h +++ b/searchlib/src/vespa/searchlib/fef/utils.h @@ -28,17 +28,17 @@ struct Utils /** * Extract all seed feature values from the given rank program. **/ - static std::map getSeedFeatures(const RankProgram &rankProgram, uint32_t docid); + static std::map getSeedFeatures(const RankProgram &rankProgram, uint32_t docid); /** * Extract all feature values from the given rank program. **/ - static std::map getAllFeatures(const RankProgram &rankProgram, uint32_t docid); + static std::map getAllFeatures(const RankProgram &rankProgram, uint32_t docid); /* * Extract features names for the given feature resolver. */ - std::vector + std::vector static extract_feature_names(const FeatureResolver& resolver, const search::StringStringMap& renames); /* diff --git a/searchlib/src/vespa/searchlib/fef/verify_feature.cpp b/searchlib/src/vespa/searchlib/fef/verify_feature.cpp index be4566aea542..e8d3bb3815bf 100644 --- a/searchlib/src/vespa/searchlib/fef/verify_feature.cpp +++ b/searchlib/src/vespa/searchlib/fef/verify_feature.cpp @@ -25,7 +25,7 @@ bool verifyFeature(const BlueprintFactory &factory, for (const auto & msg : warnings) { errors.emplace_back(Level::WARNING, msg); } - vespalib::string msg = fmt("verification failed: %s (%s)",BlueprintResolver::describe_feature(featureName).c_str(), desc.c_str()); + std::string msg = fmt("verification failed: %s (%s)",BlueprintResolver::describe_feature(featureName).c_str(), desc.c_str()); errors.emplace_back(Level::ERROR, msg); } return result; diff --git a/searchlib/src/vespa/searchlib/fef/verify_feature.h b/searchlib/src/vespa/searchlib/fef/verify_feature.h index 9f048084c036..68a1256b1b0e 100644 --- a/searchlib/src/vespa/searchlib/fef/verify_feature.h +++ b/searchlib/src/vespa/searchlib/fef/verify_feature.h @@ -2,7 +2,7 @@ #pragma once -#include +#include #include namespace search::fef { @@ -11,7 +11,7 @@ class BlueprintFactory; class IIndexEnvironment; enum class Level {INFO, WARNING, ERROR}; -using Message = std::pair; +using Message = std::pair; /** * Verify whether a specific feature can be computed. If the feature diff --git a/searchlib/src/vespa/searchlib/index/dictionaryfile.h b/searchlib/src/vespa/searchlib/index/dictionaryfile.h index 4b12bbc894a7..5a89628152f6 100644 --- a/searchlib/src/vespa/searchlib/index/dictionaryfile.h +++ b/searchlib/src/vespa/searchlib/index/dictionaryfile.h @@ -24,7 +24,7 @@ class DictionaryFileSeqRead : public PostingListCountFileSeqRead { * Read word and counts. Only nonzero counts are returned. If at * end of dictionary then noWordNumHigh() is returned as word number. */ - virtual void readWord(vespalib::string &word, uint64_t &wordNum, PostingListCounts &counts) = 0; + virtual void readWord(std::string &word, uint64_t &wordNum, PostingListCounts &counts) = 0; static uint64_t noWordNum() { return 0u; } @@ -65,7 +65,7 @@ class DictionaryFileRandRead { /** * Open dictionary file for random read. */ - virtual bool open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) = 0; + virtual bool open(const std::string &name, const TuneFileRandRead &tuneFileRead) = 0; /** * Close dictionary file. diff --git a/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.cpp b/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.cpp index 61a714aaa1d0..66d45c7ffc17 100644 --- a/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.cpp +++ b/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.cpp @@ -9,7 +9,7 @@ namespace search::index { -vespalib::string DummyFileHeaderContext::_creator; +std::string DummyFileHeaderContext::_creator; DummyFileHeaderContext::DummyFileHeaderContext() : common::FileHeaderContext(), @@ -33,7 +33,7 @@ DummyFileHeaderContext::disableFileName() void DummyFileHeaderContext::addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const + const std::string &name) const { using Tag = vespalib::GenericHeader::Tag; @@ -51,7 +51,7 @@ DummyFileHeaderContext::addTags(vespalib::GenericHeader &header, } void -DummyFileHeaderContext::setCreator(const vespalib::string &creator) +DummyFileHeaderContext::setCreator(const std::string &creator) { _creator = creator; } diff --git a/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.h b/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.h index 87cffc94733b..0e8f1909d434 100644 --- a/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.h +++ b/searchlib/src/vespa/searchlib/index/dummyfileheadercontext.h @@ -9,16 +9,16 @@ namespace search::index { class DummyFileHeaderContext : public common::FileHeaderContext { bool _disableFileName; - vespalib::string _hostName; + std::string _hostName; pid_t _pid; - static vespalib::string _creator; + static std::string _creator; public: DummyFileHeaderContext(); ~DummyFileHeaderContext(); void disableFileName(); - void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; - static void setCreator(const vespalib::string &creator); + void addTags(vespalib::GenericHeader &header, const std::string &name) const override; + static void setCreator(const std::string &creator); }; } diff --git a/searchlib/src/vespa/searchlib/index/i_field_length_inspector.h b/searchlib/src/vespa/searchlib/index/i_field_length_inspector.h index 76b9cb49b843..eb9804d452b5 100644 --- a/searchlib/src/vespa/searchlib/index/i_field_length_inspector.h +++ b/searchlib/src/vespa/searchlib/index/i_field_length_inspector.h @@ -3,7 +3,7 @@ #pragma once #include "field_length_info.h" -#include +#include namespace search::index { @@ -17,7 +17,7 @@ class IFieldLengthInspector { /** * Returns the field length info for the given index field, or empty info if the field is not found. */ - virtual FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const = 0; + virtual FieldLengthInfo get_field_length_info(const std::string& field_name) const = 0; }; } diff --git a/searchlib/src/vespa/searchlib/index/indexbuilder.h b/searchlib/src/vespa/searchlib/index/indexbuilder.h index c355f6b55581..95ff174d819e 100644 --- a/searchlib/src/vespa/searchlib/index/indexbuilder.h +++ b/searchlib/src/vespa/searchlib/index/indexbuilder.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace search::index { diff --git a/searchlib/src/vespa/searchlib/index/postinglistcountfile.h b/searchlib/src/vespa/searchlib/index/postinglistcountfile.h index 65e74aab2bf6..a88af118ab28 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistcountfile.h +++ b/searchlib/src/vespa/searchlib/index/postinglistcountfile.h @@ -3,7 +3,7 @@ #include "postinglistcounts.h" #include -#include +#include namespace search::common { class FileHeaderContext; } @@ -32,7 +32,7 @@ class PostingListCountFileSeqRead { /** * Open posting list count file for sequential read. */ - virtual bool open(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead) = 0; + virtual bool open(const std::string &name, const TuneFileSeqRead &tuneFileRead) = 0; /** * Close posting list count file. @@ -55,7 +55,7 @@ class PostingListCountFileSeqWrite { /** * Open posting list count file for sequential write. */ - virtual bool open(const vespalib::string &name, + virtual bool open(const std::string &name, const TuneFileSeqWrite &tuneFileWrite, const common::FileHeaderContext &fileHeaderContext) = 0; diff --git a/searchlib/src/vespa/searchlib/index/postinglistfile.cpp b/searchlib/src/vespa/searchlib/index/postinglistfile.cpp index a09b41f312d0..dba6a977f68c 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistfile.cpp +++ b/searchlib/src/vespa/searchlib/index/postinglistfile.cpp @@ -116,7 +116,7 @@ readPostingList(const PostingListCounts &counts, } bool -PostingListFileRandReadPassThrough::open(const vespalib::string &name, +PostingListFileRandReadPassThrough::open(const std::string &name, const TuneFileRandRead &tuneFileRead) { bool ret = _lower->open(name, tuneFileRead); diff --git a/searchlib/src/vespa/searchlib/index/postinglistfile.h b/searchlib/src/vespa/searchlib/index/postinglistfile.h index a2f8eca007eb..1750e7bc7b81 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistfile.h +++ b/searchlib/src/vespa/searchlib/index/postinglistfile.h @@ -4,7 +4,7 @@ #include "postinglistcounts.h" #include "postinglisthandle.h" #include -#include +#include class FastOS_FileInterface; @@ -39,7 +39,7 @@ class PostingListFileSeqRead { /** * Open posting list file for sequential read. */ - virtual bool open(const vespalib::string &name, const TuneFileSeqRead &tuneFileRead) = 0; + virtual bool open(const std::string &name, const TuneFileSeqRead &tuneFileRead) = 0; /** * Close posting list file. @@ -92,7 +92,7 @@ class PostingListFileSeqWrite { * Open posting list file for sequential write. */ virtual bool - open(const vespalib::string &name, + open(const std::string &name, const TuneFileSeqWrite &tuneFileWrite, const common::FileHeaderContext &fileHeaderContext) = 0; @@ -166,7 +166,7 @@ class PostingListFileRandRead { /** * Open posting list file for random read. */ - virtual bool open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) = 0; + virtual bool open(const std::string &name, const TuneFileRandRead &tuneFileRead) = 0; /** * Close posting list file. @@ -203,7 +203,7 @@ class PostingListFileRandReadPassThrough : public PostingListFileRandRead { void readPostingList(const PostingListCounts &counts, uint32_t firstSegment, uint32_t numSegments, PostingListHandle &handle) override; - bool open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) override; + bool open(const std::string &name, const TuneFileRandRead &tuneFileRead) override; bool close() override; }; diff --git a/searchlib/src/vespa/searchlib/index/postinglistparams.cpp b/searchlib/src/vespa/searchlib/index/postinglistparams.cpp index dc47d3067670..b77973b10aa2 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistparams.cpp +++ b/searchlib/src/vespa/searchlib/index/postinglistparams.cpp @@ -5,14 +5,14 @@ namespace { -vespalib::string empty; +std::string empty; } namespace search::index { bool -PostingListParams::isSet(const vespalib::string &key) const +PostingListParams::isSet(const std::string &key) const { auto it = _map.find(key); if (it != _map.end()) { @@ -22,14 +22,14 @@ PostingListParams::isSet(const vespalib::string &key) const } void -PostingListParams::setStr(const vespalib::string &key, - const vespalib::string &val) +PostingListParams::setStr(const std::string &key, + const std::string &val) { _map[key] = val; } -const vespalib::string & -PostingListParams::getStr(const vespalib::string &key) const +const std::string & +PostingListParams::getStr(const std::string &key) const { auto it = _map.find(key); if (it != _map.end()) { @@ -51,7 +51,7 @@ PostingListParams::add(const PostingListParams & toAdd) } void -PostingListParams::erase(const vespalib::string &key) +PostingListParams::erase(const std::string &key) { _map.erase(key); } @@ -64,7 +64,7 @@ PostingListParams::operator!=(const PostingListParams &rhs) const template void -PostingListParams::set(const vespalib::string &key, const TYPE &val) +PostingListParams::set(const std::string &key, const TYPE &val) { std::ostringstream os; @@ -74,7 +74,7 @@ PostingListParams::set(const vespalib::string &key, const TYPE &val) template void -PostingListParams::get(const vespalib::string &key, TYPE &val) const +PostingListParams::get(const std::string &key, TYPE &val) const { std::istringstream is; auto it = _map.find(key); @@ -85,33 +85,33 @@ PostingListParams::get(const vespalib::string &key, TYPE &val) const } template void -PostingListParams::set(const vespalib::string &key, const bool &val); +PostingListParams::set(const std::string &key, const bool &val); template void -PostingListParams::get(const vespalib::string &key, bool &val) const; +PostingListParams::get(const std::string &key, bool &val) const; template void -PostingListParams::set(const vespalib::string& key, const int& val); +PostingListParams::set(const std::string& key, const int& val); template void -PostingListParams::get(const vespalib::string& key, int& val) const; +PostingListParams::get(const std::string& key, int& val) const; template void -PostingListParams::set(const vespalib::string& key, const unsigned int& val); +PostingListParams::set(const std::string& key, const unsigned int& val); template void -PostingListParams::get(const vespalib::string& key, unsigned int& val) const; +PostingListParams::get(const std::string& key, unsigned int& val) const; template void -PostingListParams::set(const vespalib::string& key, const unsigned long& val); +PostingListParams::set(const std::string& key, const unsigned long& val); template void -PostingListParams::get(const vespalib::string& key, unsigned long& val) const; +PostingListParams::get(const std::string& key, unsigned long& val) const; template void -PostingListParams::set(const vespalib::string& key, const unsigned long long& val); +PostingListParams::set(const std::string& key, const unsigned long long& val); template void -PostingListParams::get(const vespalib::string& key, unsigned long long& val) const; +PostingListParams::get(const std::string& key, unsigned long long& val) const; } diff --git a/searchlib/src/vespa/searchlib/index/postinglistparams.h b/searchlib/src/vespa/searchlib/index/postinglistparams.h index f338aa60153f..545e03cd7b8a 100644 --- a/searchlib/src/vespa/searchlib/index/postinglistparams.h +++ b/searchlib/src/vespa/searchlib/index/postinglistparams.h @@ -2,25 +2,25 @@ #pragma once #include -#include +#include namespace search::index { class PostingListParams { - using Map = std::map; + using Map = std::map; Map _map; public: template - void set(const vespalib::string &key, const TYPE &val); + void set(const std::string &key, const TYPE &val); template - void get(const vespalib::string &key, TYPE &val) const; + void get(const std::string &key, TYPE &val) const; - bool isSet(const vespalib::string &key) const; - void setStr(const vespalib::string &key, const vespalib::string &val); - const vespalib::string & getStr(const vespalib::string &key) const; + bool isSet(const std::string &key) const; + void setStr(const std::string &key, const std::string &val); + const std::string & getStr(const std::string &key) const; void clear(); - void erase(const vespalib::string &key); + void erase(const std::string &key); bool operator!=(const PostingListParams &rhs) const; void add(const PostingListParams & toAdd); }; diff --git a/searchlib/src/vespa/searchlib/index/schema_index_fields.cpp b/searchlib/src/vespa/searchlib/index/schema_index_fields.cpp index 2dd1b623b702..a188ae1aff2e 100644 --- a/searchlib/src/vespa/searchlib/index/schema_index_fields.cpp +++ b/searchlib/src/vespa/searchlib/index/schema_index_fields.cpp @@ -22,12 +22,12 @@ SchemaIndexFields::setup(const Schema &schema) // Detect all URI fields (flattened structs). for (uint32_t fieldId = 0; fieldId < numIndexFields; ++fieldId) { const Schema::IndexField &field = schema.getIndexField(fieldId); - const vespalib::string &name = field.getName(); + const std::string &name = field.getName(); size_t dotPos = name.find('.'); - if (dotPos != vespalib::string::npos) { - const vespalib::string suffix = name.substr(dotPos + 1); + if (dotPos != std::string::npos) { + const std::string suffix = name.substr(dotPos + 1); if (suffix == "scheme") { - const vespalib::string shortName = name.substr(0, dotPos); + const std::string shortName = name.substr(0, dotPos); UriField uriField; uriField.setup(schema, shortName); if (uriField.valid(schema, field.getCollectionType())) { diff --git a/searchlib/src/vespa/searchlib/index/schemautil.cpp b/searchlib/src/vespa/searchlib/index/schemautil.cpp index 98574f8485b8..f786407fa596 100644 --- a/searchlib/src/vespa/searchlib/index/schemautil.cpp +++ b/searchlib/src/vespa/searchlib/index/schemautil.cpp @@ -35,7 +35,7 @@ SchemaUtil::IndexIterator::hasOldFields(const Schema &oldSchema) const assert(isValid()); const Schema::IndexField &newField = getSchema().getIndexField(getIndex()); - const vespalib::string &fieldName = newField.getName(); + const std::string &fieldName = newField.getName(); uint32_t oldFieldId = oldSchema.getIndexFieldId(fieldName); if (oldFieldId == Schema::UNKNOWN_FIELD_ID) { return false; @@ -54,7 +54,7 @@ SchemaUtil::IndexIterator::hasMatchingOldFields(const Schema &oldSchema) const assert(isValid()); const Schema::IndexField &newField = getSchema().getIndexField(getIndex()); - const vespalib::string &fieldName = newField.getName(); + const std::string &fieldName = newField.getName(); uint32_t oldFieldId = oldSchema.getIndexFieldId(fieldName); if (oldFieldId == Schema::UNKNOWN_FIELD_ID) { return false; @@ -74,7 +74,7 @@ SchemaUtil::IndexIterator::has_matching_use_interleaved_features(const Schema &o { assert(isValid()); const Schema::IndexField &newField = getSchema().getIndexField(getIndex()); - const vespalib::string &fieldName = newField.getName(); + const std::string &fieldName = newField.getName(); uint32_t oldFieldId = oldSchema.getIndexFieldId(fieldName); if (oldFieldId == Schema::UNKNOWN_FIELD_ID) { return false; diff --git a/searchlib/src/vespa/searchlib/index/schemautil.h b/searchlib/src/vespa/searchlib/index/schemautil.h index da84d0727185..a2aa00234e15 100644 --- a/searchlib/src/vespa/searchlib/index/schemautil.h +++ b/searchlib/src/vespa/searchlib/index/schemautil.h @@ -67,7 +67,7 @@ class SchemaUtil { : _schema(schema), _index(Schema::UNKNOWN_FIELD_ID) { - const vespalib::string &name = rhs.getName(); + const std::string &name = rhs.getName(); _index = schema.getIndexFieldId(name); } @@ -79,7 +79,7 @@ class SchemaUtil { return _index; } - const vespalib::string &getName() const { + const std::string &getName() const { return _schema.getIndexField(_index).getName(); } diff --git a/searchlib/src/vespa/searchlib/index/uri_field.cpp b/searchlib/src/vespa/searchlib/index/uri_field.cpp index b60cab9015db..3b0a980d2f83 100644 --- a/searchlib/src/vespa/searchlib/index/uri_field.cpp +++ b/searchlib/src/vespa/searchlib/index/uri_field.cpp @@ -58,7 +58,7 @@ UriField::valid(const Schema &schema, const Schema::CollectionType & collectionT } void -UriField::setup(const Schema &schema, const vespalib::string &field) +UriField::setup(const Schema &schema, const std::string &field) { _all = schema.getIndexFieldId(field); _scheme = schema.getIndexFieldId(field + ".scheme"); @@ -73,7 +73,7 @@ UriField::setup(const Schema &schema, const vespalib::string &field) bool UriField::mightBePartofUri(std::string_view name) { size_t dotPos = name.find('.'); - if ((dotPos != 0) && (dotPos != vespalib::string::npos)) { + if ((dotPos != 0) && (dotPos != std::string::npos)) { std::string_view suffix = name.substr(dotPos + 1); return ((suffix == "all") || (suffix == "scheme") || (suffix == "host") || (suffix == "port") || (suffix == "path") || (suffix == "query") || (suffix == "fragment") || (suffix == "hostname")); diff --git a/searchlib/src/vespa/searchlib/index/uri_field.h b/searchlib/src/vespa/searchlib/index/uri_field.h index fbbc534fe48d..3c853d360054 100644 --- a/searchlib/src/vespa/searchlib/index/uri_field.h +++ b/searchlib/src/vespa/searchlib/index/uri_field.h @@ -33,7 +33,7 @@ class UriField bool broken(const Schema &schema, const Schema::CollectionType &collectionType) const; bool valid(const Schema &schema, const Schema::CollectionType &collectionType) const; - void setup(const Schema &schema, const vespalib::string &field); + void setup(const Schema &schema, const std::string &field); void markUsed(UsedFieldsMap &usedFields) const; static bool mightBePartofUri(std::string_view name); }; diff --git a/searchlib/src/vespa/searchlib/memoryindex/feature_store.cpp b/searchlib/src/vespa/searchlib/memoryindex/feature_store.cpp index 035bbc716442..19ef8e1f22d0 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/feature_store.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/feature_store.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace search::memoryindex { diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp index 365e2b050c01..f1f62dcbd4b4 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp @@ -225,7 +225,7 @@ FieldIndex::commit() template queryeval::SearchIterator::UP -FieldIndex::make_search_iterator(const vespalib::string& term, +FieldIndex::make_search_iterator(const std::string& term, uint32_t field_id, fef::TermFieldMatchDataArray match_data) const { @@ -245,7 +245,7 @@ class MemoryTermBlueprint : public SimpleLeafBlueprint { PostingListIteratorType _posting_itr; const FeatureStore& _feature_store; const uint32_t _field_id; - const vespalib::string _query_term; + const std::string _query_term; const bool _use_bit_vector; public: @@ -254,7 +254,7 @@ class MemoryTermBlueprint : public SimpleLeafBlueprint { const FeatureStore& feature_store, const queryeval::FieldSpec& field, uint32_t field_id, - const vespalib::string& query_term, + const std::string& query_term, bool use_bit_vector) : SimpleLeafBlueprint(field), _guard(), @@ -305,7 +305,7 @@ class MemoryTermBlueprint : public SimpleLeafBlueprint { template std::unique_ptr -FieldIndex::make_term_blueprint(const vespalib::string& term, +FieldIndex::make_term_blueprint(const std::string& term, const queryeval::FieldSpec& field, uint32_t field_id) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.h b/searchlib/src/vespa/searchlib/memoryindex/field_index.h index c33aab47e830..f7d4b33de37a 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index.h +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.h @@ -92,10 +92,10 @@ class FieldIndex : public FieldIndexBase { /** * Should only by used by unit tests. */ - queryeval::SearchIterator::UP make_search_iterator(const vespalib::string& term, uint32_t field_id, + queryeval::SearchIterator::UP make_search_iterator(const std::string& term, uint32_t field_id, fef::TermFieldMatchDataArray match_data) const; - std::unique_ptr make_term_blueprint(const vespalib::string& term, + std::unique_ptr make_term_blueprint(const std::string& term, const queryeval::FieldSpec& field, uint32_t field_id) override; }; diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index_base.h b/searchlib/src/vespa/searchlib/memoryindex/field_index_base.h index 0c0999470759..9560ee168dd8 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index_base.h +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index_base.h @@ -11,8 +11,9 @@ #include #include #include -#include #include +#include +#include namespace search::memoryindex { diff --git a/searchlib/src/vespa/searchlib/memoryindex/i_field_index.h b/searchlib/src/vespa/searchlib/memoryindex/i_field_index.h index b7cad9d1c382..bbdbea3ccc53 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/i_field_index.h +++ b/searchlib/src/vespa/searchlib/memoryindex/i_field_index.h @@ -39,7 +39,7 @@ class IFieldIndex { virtual void compactFeatures() = 0; virtual void dump(search::index::FieldIndexBuilder& builder) = 0; - virtual std::unique_ptr make_term_blueprint(const vespalib::string& term, + virtual std::unique_ptr make_term_blueprint(const std::string& term, const queryeval::FieldSpec& field, uint32_t field_id) = 0; diff --git a/searchlib/src/vespa/searchlib/memoryindex/i_field_index_remove_listener.h b/searchlib/src/vespa/searchlib/memoryindex/i_field_index_remove_listener.h index 64574bd4782d..70cb0e9792fd 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/i_field_index_remove_listener.h +++ b/searchlib/src/vespa/searchlib/memoryindex/i_field_index_remove_listener.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search::memoryindex { diff --git a/searchlib/src/vespa/searchlib/memoryindex/i_ordered_field_index_inserter.h b/searchlib/src/vespa/searchlib/memoryindex/i_ordered_field_index_inserter.h index cb35ffca43b7..cc7432dd0f09 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/i_ordered_field_index_inserter.h +++ b/searchlib/src/vespa/searchlib/memoryindex/i_ordered_field_index_inserter.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace search::index { class DocIdAndFeatures; } diff --git a/searchlib/src/vespa/searchlib/memoryindex/invert_context.cpp b/searchlib/src/vespa/searchlib/memoryindex/invert_context.cpp index 262994222a3c..01accc55dc66 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/invert_context.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/invert_context.cpp @@ -18,7 +18,7 @@ using document::Field; namespace { std::unique_ptr -get_field(const DocumentType& doc_type, const vespalib::string& name) +get_field(const DocumentType& doc_type, const std::string& name) { std::unique_ptr fp; if ( ! doc_type.hasField(name)) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/invert_context.h b/searchlib/src/vespa/searchlib/memoryindex/invert_context.h index 2ef6e07b833d..2db700be8d69 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/invert_context.h +++ b/searchlib/src/vespa/searchlib/memoryindex/invert_context.h @@ -32,7 +32,7 @@ class InvertContext : public BundledFieldsContext { using IndexedFields = std::vector>; std::vector _pushers; - vespalib::string _document_field_names; + std::string _document_field_names; mutable IndexedFields _document_fields; mutable IndexedFields _document_uri_fields; mutable const document::DataType* _data_type; diff --git a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp index 09a608f424ff..2e53b306d0c3 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp @@ -155,7 +155,7 @@ class CreateBlueprintVisitor : public CreateBlueprintVisitorHelper { template void visitTerm(TermNode &n) { - const vespalib::string termStr = queryeval::termAsString(n); + const std::string termStr = queryeval::termAsString(n); LOG(debug, "searching for '%s' in '%s'", termStr.c_str(), _field.getName().c_str()); IFieldIndex* fieldIndex = _fieldIndexes.getFieldIndex(_fieldId); @@ -244,7 +244,7 @@ MemoryIndex::getPrunedSchema() const } FieldLengthInfo -MemoryIndex::get_field_length_info(const vespalib::string& field_name) const +MemoryIndex::get_field_length_info(const std::string& field_name) const { uint32_t field_id = _schema.getIndexFieldId(field_name); if (field_id != Schema::UNKNOWN_FIELD_ID) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/memory_index.h b/searchlib/src/vespa/searchlib/memoryindex/memory_index.h index b04274e52c7c..6ac34657ad73 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memory_index.h +++ b/searchlib/src/vespa/searchlib/memoryindex/memory_index.h @@ -174,7 +174,7 @@ class MemoryIndex : public queryeval::Searchable { uint64_t getStaticMemoryFootprint() const { return _staticMemoryFootprint; } - index::FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const; + index::FieldLengthInfo get_field_length_info(const std::string& field_name) const; void insert_write_context_state(vespalib::slime::Cursor& object) const; }; diff --git a/searchlib/src/vespa/searchlib/memoryindex/ordered_field_index_inserter.cpp b/searchlib/src/vespa/searchlib/memoryindex/ordered_field_index_inserter.cpp index 75f5b38ce896..2f0f260a9add 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/ordered_field_index_inserter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/ordered_field_index_inserter.cpp @@ -4,7 +4,6 @@ #include "i_field_index_insert_listener.h" #include -#include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include LOG_SETUP(".searchlib.memoryindex.ordered_document_inserter"); diff --git a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp index 637aec7a7790..7465282ebc3a 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp @@ -19,11 +19,11 @@ namespace search::memoryindex { namespace { -static vespalib::string HOSTNAME_BEGIN("StArThOsT"); -static vespalib::string HOSTNAME_END("EnDhOsT"); +static std::string HOSTNAME_BEGIN("StArThOsT"); +static std::string HOSTNAME_END("EnDhOsT"); static size_t -lowercaseToken(vespalib::string &dest, const char *src, size_t srcSize) +lowercaseToken(std::string &dest, const char *src, size_t srcSize) { dest.clear(); dest.reserve(8 + srcSize); @@ -114,20 +114,20 @@ void UrlFieldInverter::processUrlField(const FieldValue &url_field, const Document& doc) { assert(url_field.isA(FieldValue::Type::STRING)); - const vespalib::string &url_str = + const std::string &url_str = static_cast(url_field).getValue(); processUrlOldStyle(url_str, doc); return; } void -UrlFieldInverter::processUrlOldStyle(const vespalib::string &s, const Document& doc) +UrlFieldInverter::processUrlOldStyle(const std::string &s, const Document& doc) { URL url(reinterpret_cast(s.data()), s.size()); _hostname->addWord(HOSTNAME_BEGIN, doc); - vespalib::string lowToken; + std::string lowToken; const unsigned char *t; URL::URL_CONTEXT url_context; while ((t = url.GetToken(url_context))) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.h b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.h index fd776b92d76a..ecc894b61e92 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.h +++ b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.h @@ -31,7 +31,7 @@ class UrlFieldInverter { void processUrlField(const document::FieldValue &url_field, const document::Document& doc); - void processUrlOldStyle(const vespalib::string &s, const document::Document& doc); + void processUrlOldStyle(const std::string &s, const document::Document& doc); void processArrayUrlField(const document::ArrayFieldValue &field, const document::Document& doc); diff --git a/searchlib/src/vespa/searchlib/memoryindex/word_store.h b/searchlib/src/vespa/searchlib/memoryindex/word_store.h index 20951430c058..dd3d0ffe10cf 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/word_store.h +++ b/searchlib/src/vespa/searchlib/memoryindex/word_store.h @@ -4,7 +4,7 @@ #include #include -#include +#include namespace search::memoryindex { diff --git a/searchlib/src/vespa/searchlib/parsequery/parse.h b/searchlib/src/vespa/searchlib/parsequery/parse.h index a05c68bea46e..994b1b6bc56c 100644 --- a/searchlib/src/vespa/searchlib/parsequery/parse.h +++ b/searchlib/src/vespa/searchlib/parsequery/parse.h @@ -5,7 +5,7 @@ #include "item_creator.h" #include #include -#include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp index 54e9fe7a5eb0..9582c4acecb4 100644 --- a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp +++ b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using search::query::IntegerTermVector; using search::query::PredicateQueryTerm; @@ -239,14 +240,14 @@ SimpleQueryStackDumpIterator::readPredicate(const char *&p) { std::string_view key = read_string_view(p); std::string_view value = read_string_view(p); uint64_t sub_queries = read_value(p); - _predicate_query_term->addFeature(vespalib::string(key), vespalib::string(value), sub_queries); + _predicate_query_term->addFeature(std::string(key), std::string(value), sub_queries); } count = readCompressedPositiveInt(p); for (size_t i = 0; i < count; ++i) { std::string_view key = read_string_view(p); uint64_t value = read_value(p); uint64_t sub_queries = read_value(p); - _predicate_query_term->addRangeFeature(vespalib::string(key), value, sub_queries); + _predicate_query_term->addRangeFeature(std::string(key), value, sub_queries); } } diff --git a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h index 34285e9a6083..2e064b803416 100644 --- a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h +++ b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.h @@ -3,8 +3,9 @@ #pragma once #include "parse.h" -#include +#include #include +#include namespace search::query { @@ -144,7 +145,7 @@ class SimpleQueryStackDumpIterator std::unique_ptr get_terms(); std::string_view index_as_view() const noexcept { return _curr_index_name; } - vespalib::string index_as_string() const noexcept { return vespalib::string(_curr_index_name); } + std::string index_as_string() const noexcept { return std::string(_curr_index_name); } std::string_view getTerm() const noexcept { return _curr_term; } int64_t getIntegerTerm() const noexcept { return _curr_integer_term; } diff --git a/searchlib/src/vespa/searchlib/predicate/common.cpp b/searchlib/src/vespa/searchlib/predicate/common.cpp index 806eda9a0aba..a68a8d88c841 100644 --- a/searchlib/src/vespa/searchlib/predicate/common.cpp +++ b/searchlib/src/vespa/searchlib/predicate/common.cpp @@ -5,9 +5,9 @@ namespace search::predicate { -const vespalib::string Constants::z_star_attribute_name = "z-star"; +const std::string Constants::z_star_attribute_name = "z-star"; const uint64_t Constants::z_star_hash = PredicateHash::hash64(Constants::z_star_attribute_name); -const vespalib::string Constants::z_star_compressed_attribute_name = "z-star-compressed"; +const std::string Constants::z_star_compressed_attribute_name = "z-star-compressed"; const uint64_t Constants::z_star_compressed_hash = PredicateHash::hash64(Constants::z_star_compressed_attribute_name); } diff --git a/searchlib/src/vespa/searchlib/predicate/common.h b/searchlib/src/vespa/searchlib/predicate/common.h index 6428b27fc095..bbb0b8ab52c4 100644 --- a/searchlib/src/vespa/searchlib/predicate/common.h +++ b/searchlib/src/vespa/searchlib/predicate/common.h @@ -10,9 +10,9 @@ using BTreeSet = vespalib::btree::BTree +#include +#include namespace search::predicate { /** diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h index a5e0e5d0509f..f74c652a461e 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h @@ -9,7 +9,7 @@ #include "predicate_interval.h" #include #include -#include +#include #include namespace search::predicate { diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_range_expander.h b/searchlib/src/vespa/searchlib/predicate/predicate_range_expander.h index 22171d0d04d3..a8a708db7aae 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_range_expander.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_range_expander.h @@ -19,7 +19,7 @@ class PredicateRangeExpander { template static void addEdgePartition(const char *label, uint64_t value, bool negative, InsertIt out) { - vespalib::string to_hash = + std::string to_hash = vespalib::make_string("%s%s%" PRIu64, label, negative? "=-" : "=", value); debugLog("Hashing edge partition %s", to_hash.c_str()); @@ -36,7 +36,7 @@ class PredicateRangeExpander { if (negative) { std::swap(to, from); } - vespalib::string to_hash = + std::string to_hash = vespalib::make_string("%s%s%" PRIu64 "-%" PRIu64, label, negative? "=-" : "=", from, to); debugLog("Hashing partition %s", to_hash.c_str()); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h b/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h index aac47b90cb35..24e0787e7650 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h @@ -2,11 +2,11 @@ #pragma once -#include #include -#include #include +#include #include +#include namespace search::predicate { @@ -38,7 +38,7 @@ class PredicateRangeTermExpander { } template - void expand(const vespalib::string &key, int64_t value, Handler &handler); + void expand(const std::string &key, int64_t value, Handler &handler); }; @@ -46,7 +46,7 @@ class PredicateRangeTermExpander { * Handler must implement handleRange(string) and handleEdge(string, uint64_t). */ template -void PredicateRangeTermExpander::expand(const vespalib::string &key, int64_t signed_value, Handler &handler) { +void PredicateRangeTermExpander::expand(const std::string &key, int64_t signed_value, Handler &handler) { if (signed_value < _lower_bound || signed_value > _upper_bound) { vespalib::Issue::report("predicate_range_term_expander: Search outside bounds should have been rejected by ValidatePredicateSearcher."); return; diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.cpp b/searchlib/src/vespa/searchlib/predicate/simple_index.cpp index 55d1247066d9..60c0ca471ee0 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.cpp @@ -17,7 +17,7 @@ bool log_enabled() { return LOG_WOULD_LOG(debug); } -void log_debug(vespalib::string &str) { +void log_debug(std::string &str) { LOG(debug, "%s", str.c_str()); } diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp index b1a6f9b1a494..12a9ae7873ad 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp @@ -9,7 +9,7 @@ namespace search::predicate { namespace simpleindex { bool log_enabled(); - void log_debug(vespalib::string &str); + void log_debug(std::string &str); } template diff --git a/searchlib/src/vespa/searchlib/query/query_normalization.cpp b/searchlib/src/vespa/searchlib/query/query_normalization.cpp index dd6842d99d24..94027b2ee7bf 100644 --- a/searchlib/src/vespa/searchlib/query/query_normalization.cpp +++ b/searchlib/src/vespa/searchlib/query/query_normalization.cpp @@ -2,6 +2,7 @@ #include "query_normalization.h" #include +#include #include namespace search { @@ -32,11 +33,11 @@ requireFold(TermType type, Normalizing normalizing) { : Normalizing::NONE; } -vespalib::string +std::string fold(std::string_view s) { const auto * curr = reinterpret_cast(s.data()); const unsigned char * end = curr + s.size(); - vespalib::string folded; + std::string folded; for (; curr < end;) { uint32_t c_ucs4 = *curr; if (c_ucs4 < 0x80) { @@ -58,11 +59,11 @@ fold(std::string_view s) { return folded; } -vespalib::string +std::string lowercase(std::string_view s) { const auto * curr = reinterpret_cast(s.data()); const unsigned char * end = curr + s.size(); - vespalib::string folded; + std::string folded; for (; curr < end;) { uint32_t c_ucs4 = *curr; if (c_ucs4 < 0x80) { @@ -85,14 +86,14 @@ operator<<(std::ostream &os, Normalizing n) { return os; } -vespalib::string +std::string QueryNormalization::optional_fold(std::string_view s, TermType type, Normalizing normalizing) { switch ( requireFold(type, normalizing)) { - case Normalizing::NONE: return vespalib::string(s); + case Normalizing::NONE: return std::string(s); case Normalizing::LOWERCASE: return lowercase(s); case Normalizing::LOWERCASE_AND_FOLD: return fold(s); } - return vespalib::string(s); + return std::string(s); } } diff --git a/searchlib/src/vespa/searchlib/query/query_normalization.h b/searchlib/src/vespa/searchlib/query/query_normalization.h index 00d51b7de4f8..396480985426 100644 --- a/searchlib/src/vespa/searchlib/query/query_normalization.h +++ b/searchlib/src/vespa/searchlib/query/query_normalization.h @@ -1,8 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include +#include namespace search { @@ -36,7 +37,7 @@ class QueryNormalization { virtual ~QueryNormalization() = default; virtual bool is_text_matching(std::string_view index) const noexcept = 0; virtual Normalizing normalizing_mode(std::string_view index) const noexcept = 0; - static vespalib::string optional_fold(std::string_view s, TermType type, Normalizing normalizing); + static std::string optional_fold(std::string_view s, TermType type, Normalizing normalizing); }; } diff --git a/searchlib/src/vespa/searchlib/query/query_term_decoder.h b/searchlib/src/vespa/searchlib/query/query_term_decoder.h index bbeefbb0fcc3..b423b0af50f9 100644 --- a/searchlib/src/vespa/searchlib/query/query_term_decoder.h +++ b/searchlib/src/vespa/searchlib/query/query_term_decoder.h @@ -3,7 +3,7 @@ #pragma once #include "query_term_simple.h" -#include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/query/query_term_simple.cpp b/searchlib/src/vespa/searchlib/query/query_term_simple.cpp index b13cf3951448..94def555c64a 100644 --- a/searchlib/src/vespa/searchlib/query/query_term_simple.cpp +++ b/searchlib/src/vespa/searchlib/query/query_term_simple.cpp @@ -50,7 +50,7 @@ struct FloatDecoder { static T fromstr(const char * q, const char * qend, const char ** end) noexcept { T v(0); #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 190000 - vespalib::string tmp(q, qend - q); + std::string tmp(q, qend - q); char* tmp_end = nullptr; const char *tmp_cstring = tmp.c_str(); if constexpr (std::is_same_v) { @@ -260,7 +260,7 @@ QueryTermSimple::QueryTermSimple(const string & term_, Type type) size_t numParts(0); while (! rest.empty() && ((numParts + 1) < NELEMS(parts))) { size_t pos(rest.find(';')); - if (pos != vespalib::string::npos) { + if (pos != std::string::npos) { parts[numParts++] = rest.substr(0, pos); rest = rest.substr(pos + 1); if (rest.empty()) { @@ -351,7 +351,7 @@ QueryTermSimple::getAsNumericTerm(T & lower, T & upper, D d) const noexcept return valid; } -vespalib::string +std::string QueryTermSimple::getClassName() const { return vespalib::getClassName(*this); @@ -360,7 +360,7 @@ QueryTermSimple::getClassName() const } void -visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const search::QueryTermSimple *obj) +visit(vespalib::ObjectVisitor &self, const std::string &name, const search::QueryTermSimple *obj) { if (obj != nullptr) { self.openStruct(name, obj->getClassName()); @@ -372,7 +372,7 @@ visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const search: } void -visit(vespalib::ObjectVisitor &self, const vespalib::string &name, const search::QueryTermSimple &obj) +visit(vespalib::ObjectVisitor &self, const std::string &name, const search::QueryTermSimple &obj) { visit(self, name, &obj); } diff --git a/searchlib/src/vespa/searchlib/query/query_term_simple.h b/searchlib/src/vespa/searchlib/query/query_term_simple.h index 44a7d0c607b2..44b6c5d3a584 100644 --- a/searchlib/src/vespa/searchlib/query/query_term_simple.h +++ b/searchlib/src/vespa/searchlib/query/query_term_simple.h @@ -3,8 +3,8 @@ #include "query_normalization.h" #include -#include #include +#include namespace search { @@ -14,7 +14,7 @@ namespace search { class QueryTermSimple { public: using UP = std::unique_ptr; - using string = vespalib::string; + using string = std::string; using string_view = std::string_view; using Type = TermType; @@ -93,8 +93,8 @@ class QueryTermSimple { } -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::QueryTermSimple &obj); -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::QueryTermSimple *obj); diff --git a/searchlib/src/vespa/searchlib/query/streaming/nearest_neighbor_query_node.h b/searchlib/src/vespa/searchlib/query/streaming/nearest_neighbor_query_node.h index c901edbd0258..bb8c8df05d29 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/nearest_neighbor_query_node.h +++ b/searchlib/src/vespa/searchlib/query/streaming/nearest_neighbor_query_node.h @@ -44,7 +44,7 @@ class NearestNeighborQueryNode: public QueryTerm { bool evaluate() const override; void reset() override; NearestNeighborQueryNode* as_nearest_neighbor_query_node() noexcept override; - const vespalib::string& get_query_tensor_name() const { return getTermString(); } + const std::string& get_query_tensor_name() const { return getTermString(); } uint32_t get_target_hits() const { return _target_hits; } double get_distance_threshold() const { return _distance_threshold; } void set_raw_score_calc(RawScoreCalculator* calc_in) { _calc = calc_in; } diff --git a/searchlib/src/vespa/searchlib/query/streaming/query.h b/searchlib/src/vespa/searchlib/query/streaming/query.h index b359686b6961..b372ced670f8 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/query.h +++ b/searchlib/src/vespa/searchlib/query/streaming/query.h @@ -22,8 +22,8 @@ class QueryConnector : public QueryNode size_t depth() const override; size_t width() const override; virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; - void setIndex(vespalib::string index) override { _index = std::move(index); } - const vespalib::string & getIndex() const override { return _index; } + void setIndex(std::string index) override { _index = std::move(index); } + const std::string & getIndex() const override { return _index; } static std::unique_ptr create(ParseItem::ItemType type); virtual bool isFlattenable(ParseItem::ItemType type) const { (void) type; return false; } const QueryNodeList & getChildren() const { return _children; } @@ -31,8 +31,8 @@ class QueryConnector : public QueryNode size_t size() const { return _children.size(); } const QueryNode::UP & operator [](size_t index) const { return _children[index]; } private: - vespalib::string _opName; - vespalib::string _index; + std::string _opName; + std::string _index; QueryNodeList _children; }; diff --git a/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp b/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp index e0baf00a9b90..badf3e2c129d 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/querynode.cpp @@ -98,7 +98,7 @@ QueryNode::Build(const QueryNode * parent, const QueryNodeResultFactory & factor case ParseItem::ITEM_PURE_WEIGHTED_LONG: case ParseItem::ITEM_FUZZY: { - vespalib::string index(queryRep.index_as_view()); + std::string index(queryRep.index_as_view()); if (index.empty()) { if ((type == ParseItem::ITEM_PURE_WEIGHTED_STRING) || (type == ParseItem::ITEM_PURE_WEIGHTED_LONG)) { index = parent->getIndex(); @@ -213,7 +213,7 @@ std::unique_ptr QueryNode::build_nearest_neighbor_query_node(const QueryNodeResultFactory& factory, SimpleQueryStackDumpIterator& query_rep) { std::string_view query_tensor_name = query_rep.getTerm(); - vespalib::string field_name = query_rep.index_as_string(); + std::string field_name = query_rep.index_as_string(); int32_t unique_id = query_rep.getUniqueId(); auto weight = query_rep.GetWeight(); uint32_t target_hits = query_rep.getTargetHits(); @@ -226,7 +226,7 @@ void QueryNode::populate_multi_term(Normalizing string_normalize_mode, MultiTerm& mt, SimpleQueryStackDumpIterator& queryRep) { char buf[24]; - vespalib::string subterm; + std::string subterm; auto arity = queryRep.getArity(); for (size_t i = 0; i < arity && queryRep.next(); i++) { std::unique_ptr term; @@ -288,7 +288,7 @@ QueryNode::build_weighted_set_term(const QueryNodeResultFactory& factory, Simple std::unique_ptr QueryNode::build_phrase_term(const QueryNodeResultFactory& factory, SimpleQueryStackDumpIterator& queryRep) { - vespalib::string index(queryRep.index_as_view()); + std::string index(queryRep.index_as_view()); if (index.empty()) { index = SimpleQueryStackDumpIterator::DEFAULT_INDEX; } diff --git a/searchlib/src/vespa/searchlib/query/streaming/querynode.h b/searchlib/src/vespa/searchlib/query/streaming/querynode.h index 1feb989b3903..e5b42b23fb15 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/querynode.h +++ b/searchlib/src/vespa/searchlib/query/streaming/querynode.h @@ -52,8 +52,8 @@ class QueryNode virtual void getLeaves(QueryTermList & tl) = 0; /// Gives you all leafs of this tree. Indicating that they are all const. virtual void getLeaves(ConstQueryTermList & tl) const = 0; - virtual void setIndex(vespalib::string index) = 0; - virtual const vespalib::string & getIndex() const = 0; + virtual void setIndex(std::string index) = 0; + virtual const std::string & getIndex() const = 0; /// Return the depth of this tree. virtual size_t depth() const { return 1; } diff --git a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h index 94ec5c792903..38d13cc8b799 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/queryterm.h +++ b/searchlib/src/vespa/searchlib/query/streaming/queryterm.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace search::fef { @@ -97,7 +97,7 @@ class QueryTerm : public QueryTermUCS4, public QueryNode QueryNodeResultBase & getQueryItem() { return *_result; } const HitList & getHitList() const { return _hitList; } void visitMembers(vespalib::ObjectVisitor &visitor) const override; - void setIndex(vespalib::string index_) override { _index = std::move(index_); } + void setIndex(std::string index_) override { _index = std::move(index_); } const string & getIndex() const override { return _index; } void set_fuzzy_max_edit_distance(uint32_t fuzzy_max_edit_distance) noexcept { _fuzzy_max_edit_distance = fuzzy_max_edit_distance; } void set_fuzzy_prefix_lock_length(uint32_t fuzzy_prefix_length) noexcept { _fuzzy_prefix_lock_length = fuzzy_prefix_length; } diff --git a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h index 475c17d55325..f38dcfad2be3 100644 --- a/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h +++ b/searchlib/src/vespa/searchlib/query/tree/intermediatenodes.h @@ -31,14 +31,14 @@ class Or : public QueryNodeMixin { class WeakAnd : public QueryNodeMixin { uint32_t _targetNumHits; - vespalib::string _view; + std::string _view; public: virtual ~WeakAnd() = 0; - WeakAnd(uint32_t targetNumHits, vespalib::string view) : _targetNumHits(targetNumHits), _view(std::move(view)) {} + WeakAnd(uint32_t targetNumHits, std::string view) : _targetNumHits(targetNumHits), _view(std::move(view)) {} uint32_t getTargetNumHits() const { return _targetNumHits; } - const vespalib::string & getView() const { return _view; } + const std::string & getView() const { return _view; } }; //----------------------------------------------------------------------------- @@ -95,7 +95,7 @@ class ONear : public QueryNodeMixin class Phrase : public QueryNodeMixin, public Term { public: - Phrase(vespalib::string view, int32_t id, Weight weight) + Phrase(std::string view, int32_t id, Weight weight) : Term(std::move(view), id, weight), _expensive(false) {} virtual ~Phrase() = 0; Phrase &set_expensive(bool value) { @@ -109,7 +109,7 @@ class Phrase : public QueryNodeMixin, public Term { class SameElement : public QueryNodeMixin, public Term { public: - SameElement(vespalib::string view, int32_t id, Weight weight) + SameElement(std::string view, int32_t id, Weight weight) : Term(std::move(view), id, weight), _expensive(false) {} virtual ~SameElement() = 0; SameElement &set_expensive(bool value) { diff --git a/searchlib/src/vespa/searchlib/query/tree/location.h b/searchlib/src/vespa/searchlib/query/tree/location.h index 7f759916cbe2..83fdabbf4477 100644 --- a/searchlib/src/vespa/searchlib/query/tree/location.h +++ b/searchlib/src/vespa/searchlib/query/tree/location.h @@ -2,10 +2,10 @@ #pragma once -#include #include #include "point.h" #include "rectangle.h" +#include namespace vespalib { class asciistream; } namespace search::query { diff --git a/searchlib/src/vespa/searchlib/query/tree/predicate_query_term.h b/searchlib/src/vespa/searchlib/query/tree/predicate_query_term.h index 15c75a787292..00c3456a1ecd 100644 --- a/searchlib/src/vespa/searchlib/query/tree/predicate_query_term.h +++ b/searchlib/src/vespa/searchlib/query/tree/predicate_query_term.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include #include namespace search::query { @@ -16,15 +16,15 @@ class PredicateQueryTerm { template class Entry { - vespalib::string _key; + std::string _key; ValueType _value; uint64_t _sub_query_bitmap; public: - Entry(vespalib::string key, ValueType value, uint64_t sub_query_bitmap = ALL_SUB_QUERIES) noexcept + Entry(std::string key, ValueType value, uint64_t sub_query_bitmap = ALL_SUB_QUERIES) noexcept : _key(std::move(key)), _value(std::move(value)), _sub_query_bitmap(sub_query_bitmap) {} - const vespalib::string & getKey() const { return _key; } + const std::string & getKey() const { return _key; } const ValueType & getValue() const { return _value; } uint64_t getSubQueryBitmap() const { return _sub_query_bitmap; } bool operator==(const Entry &other) const { @@ -34,7 +34,7 @@ class PredicateQueryTerm { } }; - std::vector> _features; + std::vector> _features; std::vector> _range_features; public: @@ -42,15 +42,15 @@ class PredicateQueryTerm { PredicateQueryTerm() noexcept : _features(), _range_features() {} - void addFeature(vespalib::string key, vespalib::string value, uint64_t sub_query_bitmask = ALL_SUB_QUERIES) { + void addFeature(std::string key, std::string value, uint64_t sub_query_bitmask = ALL_SUB_QUERIES) { _features.emplace_back(std::move(key), std::move(value), sub_query_bitmask); } - void addRangeFeature(vespalib::string key, uint64_t value, uint64_t sub_query_bitmask = ALL_SUB_QUERIES) { + void addRangeFeature(std::string key, uint64_t value, uint64_t sub_query_bitmask = ALL_SUB_QUERIES) { _range_features.emplace_back(std::move(key), value, sub_query_bitmask); } - const std::vector> &getFeatures() const + const std::vector> &getFeatures() const { return _features; } const std::vector> &getRangeFeatures() const { return _range_features; } diff --git a/searchlib/src/vespa/searchlib/query/tree/querybuilder.cpp b/searchlib/src/vespa/searchlib/query/tree/querybuilder.cpp index 2e1d2d42afa7..1294f0cbd847 100644 --- a/searchlib/src/vespa/searchlib/query/tree/querybuilder.cpp +++ b/searchlib/src/vespa/searchlib/query/tree/querybuilder.cpp @@ -6,7 +6,7 @@ #include #include -using vespalib::string; +using std::string; using vespalib::make_string; using vespalib::getClassName; diff --git a/searchlib/src/vespa/searchlib/query/tree/querybuilder.h b/searchlib/src/vespa/searchlib/query/tree/querybuilder.h index 9eb2423ebb68..c32046461dfb 100644 --- a/searchlib/src/vespa/searchlib/query/tree/querybuilder.h +++ b/searchlib/src/vespa/searchlib/query/tree/querybuilder.h @@ -51,7 +51,7 @@ class QueryBuilderBase }; Node::UP _root; std::stack _nodes; - vespalib::string _error_msg; + std::string _error_msg; protected: QueryBuilderBase(); @@ -84,7 +84,7 @@ class QueryBuilderBase /** * If build failed, the reason is stored here. */ - vespalib::string error() const { return _error_msg; } + std::string error() const { return _error_msg; } /** * After an error, reset() must be called before attempting to @@ -92,8 +92,8 @@ class QueryBuilderBase */ void reset(); - void reportError(const vespalib::string &msg); - void reportError(const vespalib::string &msg, const Node & incomming, const Node & root); + void reportError(const std::string &msg); + void reportError(const std::string &msg, const Node & incomming, const Node & root); }; @@ -119,7 +119,7 @@ template typename NodeTypes::Or *createOr() { return new typename NodeTypes::Or; } template -typename NodeTypes::WeakAnd *createWeakAnd(uint32_t targetNumHits, const vespalib::string & view) { +typename NodeTypes::WeakAnd *createWeakAnd(uint32_t targetNumHits, const std::string & view) { return new typename NodeTypes::WeakAnd(targetNumHits, view); } template @@ -127,24 +127,24 @@ typename NodeTypes::Equiv *createEquiv(int32_t id, Weight weight) { return new typename NodeTypes::Equiv(id, weight); } template -typename NodeTypes::Phrase *createPhrase(const vespalib::string & view, int32_t id, Weight weight) { +typename NodeTypes::Phrase *createPhrase(const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::Phrase(view, id, weight); } template -typename NodeTypes::SameElement *createSameElement(const vespalib::string & view, int32_t id, Weight weight) { +typename NodeTypes::SameElement *createSameElement(const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::SameElement(view, id, weight); } template -typename NodeTypes::WeightedSetTerm *createWeightedSetTerm(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight) { +typename NodeTypes::WeightedSetTerm *createWeightedSetTerm(uint32_t num_terms, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::WeightedSetTerm(num_terms, view, id, weight); } template -typename NodeTypes::DotProduct *createDotProduct(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight) { +typename NodeTypes::DotProduct *createDotProduct(uint32_t num_terms, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::DotProduct(num_terms, view, id, weight); } template typename NodeTypes::WandTerm * -createWandTerm(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight, uint32_t targetNumHits, int64_t scoreThreshold, double thresholdBoostFactor) { +createWandTerm(uint32_t num_terms, const std::string & view, int32_t id, Weight weight, uint32_t targetNumHits, int64_t scoreThreshold, double thresholdBoostFactor) { return new typename NodeTypes::WandTerm(num_terms, view, id, weight, targetNumHits, scoreThreshold, thresholdBoostFactor); } template @@ -164,56 +164,56 @@ typename NodeTypes::ONear *createONear(size_t distance) { // Term nodes template typename NodeTypes::NumberTerm * -createNumberTerm(const vespalib::string & term, const vespalib::string & view, int32_t id, Weight weight) { +createNumberTerm(const std::string & term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::NumberTerm(term, view, id, weight); } template typename NodeTypes::PrefixTerm * -createPrefixTerm(const vespalib::string & term, const vespalib::string & view, int32_t id, Weight weight) { +createPrefixTerm(const std::string & term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::PrefixTerm(term, view, id, weight); } template typename NodeTypes::RangeTerm * -createRangeTerm(const Range &term, const vespalib::string & view, int32_t id, Weight weight) { +createRangeTerm(const Range &term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::RangeTerm(term, view, id, weight); } template typename NodeTypes::StringTerm * -createStringTerm(const vespalib::string & term, const vespalib::string & view, int32_t id, Weight weight) { +createStringTerm(const std::string & term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::StringTerm(term, view, id, weight); } template typename NodeTypes::SubstringTerm * -createSubstringTerm(const vespalib::string & term, const vespalib::string & view, int32_t id, Weight weight) { +createSubstringTerm(const std::string & term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::SubstringTerm(term, view, id, weight); } template typename NodeTypes::SuffixTerm * -createSuffixTerm(std::string_view term, const vespalib::string & view, int32_t id, Weight weight) { - return new typename NodeTypes::SuffixTerm(vespalib::string(term), view, id, weight); +createSuffixTerm(std::string_view term, const std::string & view, int32_t id, Weight weight) { + return new typename NodeTypes::SuffixTerm(std::string(term), view, id, weight); } template typename NodeTypes::LocationTerm * -createLocationTerm(const Location &loc, const vespalib::string & view, int32_t id, Weight weight) { +createLocationTerm(const Location &loc, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::LocationTerm(loc, view, id, weight); } template typename NodeTypes::PredicateQuery * -createPredicateQuery(PredicateQueryTerm::UP term, const vespalib::string & view, int32_t id, Weight weight) { +createPredicateQuery(PredicateQueryTerm::UP term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::PredicateQuery(std::move(term), view, id, weight); } template typename NodeTypes::RegExpTerm * -createRegExpTerm(const vespalib::string & term, const vespalib::string & view, int32_t id, Weight weight) { +createRegExpTerm(const std::string & term, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::RegExpTerm(term, view, id, weight); } template typename NodeTypes::NearestNeighborTerm * -create_nearest_neighbor_term(std::string_view query_tensor_name, vespalib::string field_name, +create_nearest_neighbor_term(std::string_view query_tensor_name, std::string field_name, int32_t id, Weight weight, uint32_t target_num_hits, bool allow_approximate, uint32_t explore_additional_hits, double distance_threshold) @@ -225,14 +225,14 @@ create_nearest_neighbor_term(std::string_view query_tensor_name, vespalib::strin template typename NodeTypes::FuzzyTerm * -createFuzzyTerm(std::string_view term, const vespalib::string & view, int32_t id, Weight weight, +createFuzzyTerm(std::string_view term, const std::string & view, int32_t id, Weight weight, uint32_t max_edit_distance, uint32_t prefix_lock_length, bool prefix_match) { - return new typename NodeTypes::FuzzyTerm(vespalib::string(term), view, id, weight, max_edit_distance, prefix_lock_length, prefix_match); + return new typename NodeTypes::FuzzyTerm(std::string(term), view, id, weight, max_edit_distance, prefix_lock_length, prefix_match); } template typename NodeTypes::InTerm * -create_in_term(std::unique_ptr terms, MultiTerm::Type type, const vespalib::string & view, int32_t id, Weight weight) { +create_in_term(std::unique_ptr terms, MultiTerm::Type type, const std::string & view, int32_t id, Weight weight) { return new typename NodeTypes::InTerm(std::move(terms), type, view, id, weight); } @@ -252,7 +252,7 @@ class QueryBuilder : public QueryBuilderBase { public: using string_view = std::string_view; - using string = vespalib::string; + using string = std::string; typename NodeTypes::And &addAnd(int child_count) { return addIntermediate(createAnd(), child_count); } diff --git a/searchlib/src/vespa/searchlib/query/tree/range.h b/searchlib/src/vespa/searchlib/query/tree/range.h index dbe74e7bf0e0..a29ac1a29b98 100644 --- a/searchlib/src/vespa/searchlib/query/tree/range.h +++ b/searchlib/src/vespa/searchlib/query/tree/range.h @@ -2,20 +2,21 @@ #pragma once -#include +#include + namespace vespalib { class asciistream; } namespace search::query { class Range { - vespalib::string _range; + std::string _range; public: Range() noexcept : _range() {} Range(int64_t f, int64_t t); - Range(vespalib::string range) noexcept : _range(std::move(range)) {} + Range(std::string range) noexcept : _range(std::move(range)) {} - const vespalib::string & getRangeString() const { return _range; } + const std::string & getRangeString() const { return _range; } }; inline bool operator==(const Range &r1, const Range &r2) { diff --git a/searchlib/src/vespa/searchlib/query/tree/simplequery.h b/searchlib/src/vespa/searchlib/query/tree/simplequery.h index f9a44ae73974..85569f3d02bd 100644 --- a/searchlib/src/vespa/searchlib/query/tree/simplequery.h +++ b/searchlib/src/vespa/searchlib/query/tree/simplequery.h @@ -38,8 +38,8 @@ struct SimpleOr : Or ~SimpleOr() override; }; struct SimpleWeakAnd : WeakAnd { - SimpleWeakAnd(uint32_t targetNumHits, vespalib::string view) : - WeakAnd(targetNumHits, vespalib::string(std::move(view))) + SimpleWeakAnd(uint32_t targetNumHits, std::string view) : + WeakAnd(targetNumHits, std::string(std::move(view))) {} }; struct SimpleEquiv : Equiv { @@ -48,34 +48,34 @@ struct SimpleEquiv : Equiv { ~SimpleEquiv() override; }; struct SimplePhrase : Phrase { - SimplePhrase(vespalib::string view, int32_t id, Weight weight) + SimplePhrase(std::string view, int32_t id, Weight weight) : Phrase(std::move(view), id, weight) {} ~SimplePhrase() override; }; struct SimpleSameElement : SameElement { - SimpleSameElement(vespalib::string view, int32_t id, Weight weight) + SimpleSameElement(std::string view, int32_t id, Weight weight) : SameElement(std::move(view), id, weight) {} ~SimpleSameElement() override; }; struct SimpleWeightedSetTerm : WeightedSetTerm { - SimpleWeightedSetTerm(uint32_t num_terms, vespalib::string view, int32_t id, Weight weight) + SimpleWeightedSetTerm(uint32_t num_terms, std::string view, int32_t id, Weight weight) : WeightedSetTerm(num_terms, std::move(view), id, weight) {} ~SimpleWeightedSetTerm() override; }; struct SimpleDotProduct : DotProduct { - SimpleDotProduct(uint32_t num_terms, vespalib::string view, int32_t id, Weight weight) + SimpleDotProduct(uint32_t num_terms, std::string view, int32_t id, Weight weight) : DotProduct(num_terms, std::move(view), id, weight) {} ~SimpleDotProduct() override; }; struct SimpleWandTerm : WandTerm { - SimpleWandTerm(uint32_t num_terms, vespalib::string view, int32_t id, Weight weight, + SimpleWandTerm(uint32_t num_terms, std::string view, int32_t id, Weight weight, uint32_t targetNumHits, int64_t scoreThreshold, double thresholdBoostFactor) : WandTerm(num_terms, std::move(view), id, weight, targetNumHits, scoreThreshold, thresholdBoostFactor) {} ~SimpleWandTerm() override; }; struct SimpleInTerm : InTerm { - SimpleInTerm(std::unique_ptr terms, MultiTerm::Type type, vespalib::string view, int32_t id, Weight weight) + SimpleInTerm(std::unique_ptr terms, MultiTerm::Type type, std::string view, int32_t id, Weight weight) : InTerm(std::move(terms), type, std::move(view), id, weight) { } @@ -86,61 +86,61 @@ struct SimpleRank : Rank ~SimpleRank() override; }; struct SimpleNumberTerm : NumberTerm { - SimpleNumberTerm(Type term, vespalib::string view, int32_t id, Weight weight) + SimpleNumberTerm(Type term, std::string view, int32_t id, Weight weight) : NumberTerm(term, std::move(view), id, weight) { } ~SimpleNumberTerm() override; }; struct SimpleLocationTerm : LocationTerm { - SimpleLocationTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleLocationTerm(const Type &term, std::string view, int32_t id, Weight weight) : LocationTerm(term, std::move(view), id, weight) { } ~SimpleLocationTerm() override; }; struct SimplePrefixTerm : PrefixTerm { - SimplePrefixTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimplePrefixTerm(const Type &term, std::string view, int32_t id, Weight weight) : PrefixTerm(term, std::move(view), id, weight) { } ~SimplePrefixTerm() override; }; struct SimpleRangeTerm : RangeTerm { - SimpleRangeTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleRangeTerm(const Type &term, std::string view, int32_t id, Weight weight) : RangeTerm(term, std::move(view), id, weight) { } ~SimpleRangeTerm() override; }; struct SimpleStringTerm : StringTerm { - SimpleStringTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleStringTerm(const Type &term, std::string view, int32_t id, Weight weight) : StringTerm(term, std::move(view), id, weight) { } ~SimpleStringTerm() override; }; struct SimpleSubstringTerm : SubstringTerm { - SimpleSubstringTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleSubstringTerm(const Type &term, std::string view, int32_t id, Weight weight) : SubstringTerm(term, std::move(view), id, weight) { } ~SimpleSubstringTerm() override; }; struct SimpleSuffixTerm : SuffixTerm { - SimpleSuffixTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleSuffixTerm(const Type &term, std::string view, int32_t id, Weight weight) : SuffixTerm(term, std::move(view), id, weight) { } ~SimpleSuffixTerm() override; }; struct SimplePredicateQuery : PredicateQuery { - SimplePredicateQuery(PredicateQueryTerm::UP term, vespalib::string view, int32_t id, Weight weight) + SimplePredicateQuery(PredicateQueryTerm::UP term, std::string view, int32_t id, Weight weight) : PredicateQuery(std::move(term), std::move(view), id, weight) { } ~SimplePredicateQuery() override; }; struct SimpleRegExpTerm : RegExpTerm { - SimpleRegExpTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) + SimpleRegExpTerm(const Type &term, std::string view, int32_t id, Weight weight) : RegExpTerm(term, std::move(view), id, weight) { } ~SimpleRegExpTerm() override; }; struct SimpleNearestNeighborTerm : NearestNeighborTerm { - SimpleNearestNeighborTerm(std::string_view query_tensor_name, vespalib::string field_name, + SimpleNearestNeighborTerm(std::string_view query_tensor_name, std::string field_name, int32_t id, Weight weight, uint32_t target_num_hits, bool allow_approximate, uint32_t explore_additional_hits, double distance_threshold) @@ -151,7 +151,7 @@ struct SimpleNearestNeighborTerm : NearestNeighborTerm { ~SimpleNearestNeighborTerm() override; }; struct SimpleFuzzyTerm : FuzzyTerm { - SimpleFuzzyTerm(const Type &term, vespalib::string view, int32_t id, Weight weight, uint32_t max_edit_distance, + SimpleFuzzyTerm(const Type &term, std::string view, int32_t id, Weight weight, uint32_t max_edit_distance, uint32_t prefix_lock_length, bool prefix_match) : FuzzyTerm(term, std::move(view), id, weight, max_edit_distance, prefix_lock_length, prefix_match) { diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.cpp b/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.cpp index fbfb2c44f832..40ff7d46d3dd 100644 --- a/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.cpp +++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.cpp @@ -11,7 +11,7 @@ #include #include -using vespalib::string; +using std::string; using std::vector; using search::ParseItem; using search::RawBuf; @@ -67,7 +67,7 @@ class QueryNodeConverter : public QueryVisitor { double nboVal = vespalib::nbo::n2h(i); _buf.append(&nboVal, sizeof(double)); } - void append(const vespalib::string &s) { appendString(s); } + void append(const std::string &s) { appendString(s); } void append(uint64_t l) { appendLong(l); } template @@ -107,14 +107,14 @@ class QueryNodeConverter : public QueryVisitor { visitNodes(node.getChildren()); } - void createIntermediate(const Intermediate &node, ParseItem::ItemType type, const vespalib::string & view) { + void createIntermediate(const Intermediate &node, ParseItem::ItemType type, const std::string & view) { append_type_and_features(type, 0); appendCompressedPositiveNumber(node.getChildren().size()); appendString(view); visitNodes(node.getChildren()); } - void createIntermediateX(const Intermediate &node, ParseItem::ItemType type, size_t target_num_hits, const vespalib::string & view) { + void createIntermediateX(const Intermediate &node, ParseItem::ItemType type, size_t target_num_hits, const std::string & view) { append_type_and_features(type, 0); appendCompressedPositiveNumber(node.getChildren().size()); appendCompressedPositiveNumber(target_num_hits); diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.h index a27e8ef3971f..e05edc7f452c 100644 --- a/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.h +++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpcreator.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::query { @@ -10,7 +10,7 @@ class Node; struct StackDumpCreator { // Creates a stack dump from a query tree. - static vespalib::string create(const Node &node); + static std::string create(const Node &node); }; } diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h index 38c34ae21a1c..f384d16fda67 100644 --- a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h +++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h @@ -30,9 +30,9 @@ class StackDumpQueryCreator { QueryBuilder builder; // Make sure that the life time of what pureTermView refers to exceeds that of pureTermView. - // Especially make sure that do not create any stack local objects like vespalib::string + // Especially make sure that do not create any stack local objects like std::string // with smaller scope, that you refer with pureTermView. - vespalib::string pureTermView; + std::string pureTermView; while (!builder.hasError() && queryStack.next()) { Term *t = createQueryTerm(queryStack, builder, pureTermView); if (!builder.hasError() && t) { @@ -58,7 +58,7 @@ class StackDumpQueryCreator { StackDumpQueryCreatorHelper::populateMultiTerm(queryStack, builder, mt); } static Term * - createQueryTerm(search::SimpleQueryStackDumpIterator &queryStack, QueryBuilder & builder, vespalib::string & pureTermView) { + createQueryTerm(search::SimpleQueryStackDumpIterator &queryStack, QueryBuilder & builder, std::string & pureTermView) { uint32_t arity = queryStack.getArity(); ParseItem::ItemType type = queryStack.getType(); Node::UP node; @@ -141,8 +141,8 @@ class StackDumpQueryCreator { } else if (type == ParseItem::ITEM_FALSE) { builder.add_false_node(); } else { - vespalib::string term(queryStack.getTerm()); - vespalib::string view = queryStack.index_as_string(); + std::string term(queryStack.getTerm()); + std::string view = queryStack.index_as_string(); int32_t id = queryStack.getUniqueId(); Weight weight = queryStack.GetWeight(); @@ -153,7 +153,7 @@ class StackDumpQueryCreator { } else if (type == ParseItem::ITEM_PURE_WEIGHTED_LONG) { char buf[24]; auto res = std::to_chars(buf, buf + sizeof(buf), queryStack.getIntegerTerm(), 10); - t = &builder.addNumberTerm(vespalib::string(buf, res.ptr - buf), pureTermView, id, weight); + t = &builder.addNumberTerm(std::string(buf, res.ptr - buf), pureTermView, id, weight); } else if (type == ParseItem::ITEM_PREFIXTERM) { t = &builder.addPrefixTerm(term, view, id, weight); } else if (type == ParseItem::ITEM_SUBSTRINGTERM) { @@ -171,7 +171,7 @@ class StackDumpQueryCreator { t = &builder.addLocationTerm(loc, view, id, weight); } else if (type == ParseItem::ITEM_NUMTERM) { if (Term::isPossibleRangeTerm(term)) { - Range range({vespalib::string(term)}); + Range range({std::string(term)}); t = &builder.addRangeTerm(range, view, id, weight); } else { t = &builder.addNumberTerm(term, view, id, weight); diff --git a/searchlib/src/vespa/searchlib/query/tree/string_term_vector.h b/searchlib/src/vespa/searchlib/query/tree/string_term_vector.h index cdf899c8f068..5855e270424d 100644 --- a/searchlib/src/vespa/searchlib/query/tree/string_term_vector.h +++ b/searchlib/src/vespa/searchlib/query/tree/string_term_vector.h @@ -12,7 +12,7 @@ namespace search::query { * Weights are not stored, all terms have weight 1. */ class StringTermVector : public TermVector { - std::vector _terms; + std::vector _terms; public: explicit StringTermVector(uint32_t sz); ~StringTermVector() override; diff --git a/searchlib/src/vespa/searchlib/query/tree/term.cpp b/searchlib/src/vespa/searchlib/query/tree/term.cpp index faf427adfd45..4520b0f99efa 100644 --- a/searchlib/src/vespa/searchlib/query/tree/term.cpp +++ b/searchlib/src/vespa/searchlib/query/tree/term.cpp @@ -7,7 +7,7 @@ namespace search::query { Term::~Term() = default; -Term::Term(const vespalib::string & view, int32_t id, Weight weight) +Term::Term(const std::string & view, int32_t id, Weight weight) : _view(view), _id(id), _weight(weight), diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h index 69b90e45bfa0..732638221475 100644 --- a/searchlib/src/vespa/searchlib/query/tree/term.h +++ b/searchlib/src/vespa/searchlib/query/tree/term.h @@ -3,7 +3,7 @@ #include "node.h" #include -#include +#include namespace search::query { @@ -13,7 +13,7 @@ namespace search::query { */ class Term { - vespalib::string _view; + std::string _view; int32_t _id; Weight _weight; bool _ranked; @@ -23,7 +23,7 @@ class Term public: virtual ~Term() = 0; - void setView(vespalib::string view) { _view = std::move(view); } + void setView(std::string view) { _view = std::move(view); } void setRanked(bool ranked) noexcept { _ranked = ranked; } void setPositionData(bool position_data) noexcept { _position_data = position_data; } // Used for fuzzy prefix matching. Not to be confused with distinct Prefix query term type @@ -31,7 +31,7 @@ class Term void setStateFrom(const Term& other); - const vespalib::string & getView() const noexcept { return _view; } + const std::string & getView() const noexcept { return _view; } Weight getWeight() const noexcept { return _weight; } int32_t getId() const noexcept { return _id; } [[nodiscard]] bool isRanked() const noexcept { return _ranked; } @@ -42,12 +42,12 @@ class Term return (term[0] == '[' || term[0] == '<' || term[0] == '>'); } protected: - Term(const vespalib::string & view, int32_t id, Weight weight); + Term(const std::string & view, int32_t id, Weight weight); }; class TermNode : public Node, public Term { protected: - TermNode(const vespalib::string & view, int32_t id, Weight weight) : Term(view, id, weight) {} + TermNode(const std::string & view, int32_t id, Weight weight) : Term(view, id, weight) {} }; /** * Generic functionality for most of Term's derived classes. @@ -63,12 +63,12 @@ class TermBase : public TermNode { const T &getTerm() const { return _term; } protected: - TermBase(T term, const vespalib::string & view, int32_t id, Weight weight); + TermBase(T term, const std::string & view, int32_t id, Weight weight); }; template -TermBase::TermBase(T term, const vespalib::string & view, int32_t id, Weight weight) +TermBase::TermBase(T term, const std::string & view, int32_t id, Weight weight) : TermNode(view, id, weight), _term(std::move(term)) {} diff --git a/searchlib/src/vespa/searchlib/query/tree/term_vector.h b/searchlib/src/vespa/searchlib/query/tree/term_vector.h index 6d316a363650..5de502518d3a 100644 --- a/searchlib/src/vespa/searchlib/query/tree/term_vector.h +++ b/searchlib/src/vespa/searchlib/query/tree/term_vector.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include #include namespace search::query { diff --git a/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp b/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp index b3bd8eef8ad1..2a20ac30e418 100644 --- a/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp +++ b/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp @@ -9,7 +9,7 @@ using vespalib::IllegalArgumentException; using vespalib::make_string_short::fmt; namespace search::query { -StringTerm::StringTerm(const Type &term, vespalib::string view, int32_t id, Weight weight) +StringTerm::StringTerm(const Type &term, std::string view, int32_t id, Weight weight) : QueryNodeMixinType(term, std::move(view), id, weight) {} @@ -56,7 +56,7 @@ class WeightedStringTermVector final : public TermVector { } [[nodiscard]] uint32_t size() const override { return _terms.size(); } private: - std::vector> _terms; + std::vector> _terms; }; class WeightedIntegerTermVector final : public TermVector { diff --git a/searchlib/src/vespa/searchlib/query/tree/termnodes.h b/searchlib/src/vespa/searchlib/query/tree/termnodes.h index bd94b2591606..cb023127ed98 100644 --- a/searchlib/src/vespa/searchlib/query/tree/termnodes.h +++ b/searchlib/src/vespa/searchlib/query/tree/termnodes.h @@ -9,15 +9,16 @@ #include "term.h" #include "term_vector.h" #include "const_bool_nodes.h" +#include namespace search::query { -using StringBase = TermBase; +using StringBase = TermBase; class NumberTerm : public QueryNodeMixin { public: - NumberTerm(Type term, const vespalib::string & view, int32_t id, Weight weight) + NumberTerm(Type term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} virtual ~NumberTerm() = 0; }; @@ -27,7 +28,7 @@ class NumberTerm : public QueryNodeMixin class PrefixTerm : public QueryNodeMixin { public: - PrefixTerm(const Type &term, const vespalib::string & view, + PrefixTerm(const Type &term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} @@ -39,7 +40,7 @@ class PrefixTerm : public QueryNodeMixin class RangeTerm : public QueryNodeMixin > { public: - RangeTerm(const Type& term, const vespalib::string & view, + RangeTerm(const Type& term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} @@ -51,7 +52,7 @@ class RangeTerm : public QueryNodeMixin > class StringTerm : public QueryNodeMixin { public: - StringTerm(const Type &term, vespalib::string, int32_t id, Weight weight); + StringTerm(const Type &term, std::string, int32_t id, Weight weight); virtual ~StringTerm() = 0; }; @@ -60,7 +61,7 @@ class StringTerm : public QueryNodeMixin class SubstringTerm : public QueryNodeMixin { public: - SubstringTerm(const Type &term, const vespalib::string & view, int32_t id, Weight weight) + SubstringTerm(const Type &term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} virtual ~SubstringTerm() = 0; @@ -71,7 +72,7 @@ class SubstringTerm : public QueryNodeMixin class SuffixTerm : public QueryNodeMixin { public: - SuffixTerm(const Type &term, const vespalib::string & view, int32_t id, Weight weight) + SuffixTerm(const Type &term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} virtual ~SuffixTerm() = 0; @@ -82,7 +83,7 @@ class SuffixTerm : public QueryNodeMixin class LocationTerm : public QueryNodeMixin > { public: - LocationTerm(const Type &term, const vespalib::string & view, int32_t id, Weight weight) + LocationTerm(const Type &term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} bool isLocationTerm() const override { return true; } @@ -95,7 +96,7 @@ class PredicateQuery : public QueryNodeMixin > { public: - PredicateQuery(PredicateQueryTerm::UP term, const vespalib::string & view, int32_t id, Weight weight) + PredicateQuery(PredicateQueryTerm::UP term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(std::move(term), view, id, weight) {} }; @@ -105,7 +106,7 @@ class PredicateQuery : public QueryNodeMixin { public: - RegExpTerm(const Type &term, const vespalib::string & view, int32_t id, Weight weight) + RegExpTerm(const Type &term, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(term, view, id, weight) {} virtual ~RegExpTerm() = 0; @@ -118,7 +119,7 @@ class FuzzyTerm : public QueryNodeMixin { uint32_t _prefix_lock_length; // Prefix match mode is stored in parent Term public: - FuzzyTerm(const Type &term, const vespalib::string & view, int32_t id, Weight weight, uint32_t max_edit_distance, + FuzzyTerm(const Type &term, const std::string & view, int32_t id, Weight weight, uint32_t max_edit_distance, uint32_t prefix_lock_length, bool prefix_match) : QueryNodeMixinType(term, view, id, weight), _max_edit_distance(max_edit_distance), @@ -146,14 +147,14 @@ class FuzzyTerm : public QueryNodeMixin { */ class NearestNeighborTerm : public QueryNodeMixin { private: - vespalib::string _query_tensor_name; + std::string _query_tensor_name; uint32_t _target_num_hits; bool _allow_approximate; uint32_t _explore_additional_hits; double _distance_threshold; public: - NearestNeighborTerm(std::string_view query_tensor_name, vespalib::string field_name, + NearestNeighborTerm(std::string_view query_tensor_name, std::string field_name, int32_t id, Weight weight, uint32_t target_num_hits, bool allow_approximate, uint32_t explore_additional_hits, double distance_threshold) @@ -165,7 +166,7 @@ class NearestNeighborTerm : public QueryNodeMixin _distance_threshold(distance_threshold) {} virtual ~NearestNeighborTerm() {} - const vespalib::string& get_query_tensor_name() const { return _query_tensor_name; } + const std::string& get_query_tensor_name() const { return _query_tensor_name; } uint32_t get_target_num_hits() const { return _target_num_hits; } bool get_allow_approximate() const { return _allow_approximate; } uint32_t get_explore_additional_hits() const { return _explore_additional_hits; } @@ -199,7 +200,7 @@ class MultiTerm : public Node { class WeightedSetTerm : public QueryNodeMixin, public Term { public: - WeightedSetTerm(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight) + WeightedSetTerm(uint32_t num_terms, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(num_terms), Term(view, id, weight) {} @@ -208,7 +209,7 @@ class WeightedSetTerm : public QueryNodeMixin, publi class DotProduct : public QueryNodeMixin, public Term { public: - DotProduct(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight) + DotProduct(uint32_t num_terms, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(num_terms), Term(view, id, weight) {} @@ -221,7 +222,7 @@ class WandTerm : public QueryNodeMixin, public Term { int64_t _scoreThreshold; double _thresholdBoostFactor; public: - WandTerm(uint32_t num_terms, const vespalib::string & view, int32_t id, Weight weight, + WandTerm(uint32_t num_terms, const std::string & view, int32_t id, Weight weight, uint32_t targetNumHits, int64_t scoreThreshold, double thresholdBoostFactor) : QueryNodeMixinType(num_terms), Term(view, id, weight), @@ -237,7 +238,7 @@ class WandTerm : public QueryNodeMixin, public Term { class InTerm : public QueryNodeMixin, public Term { public: - InTerm(std::unique_ptr terms, MultiTerm::Type type, const vespalib::string & view, int32_t id, Weight weight) + InTerm(std::unique_ptr terms, MultiTerm::Type type, const std::string & view, int32_t id, Weight weight) : QueryNodeMixinType(std::move(terms), type), Term(view, id, weight) { diff --git a/searchlib/src/vespa/searchlib/queryeval/andsearchstrict.h b/searchlib/src/vespa/searchlib/queryeval/andsearchstrict.h index 54a3464f7476..1ed4cd548264 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andsearchstrict.h +++ b/searchlib/src/vespa/searchlib/queryeval/andsearchstrict.h @@ -3,6 +3,7 @@ #pragma once #include "andsearchnostrict.h" +#include namespace search::queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp index 5a16f1c71a5d..6a9527057151 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp @@ -367,7 +367,7 @@ Blueprint::create_default_filter(FilterConstraint constraint) } } -vespalib::string +std::string Blueprint::asString() const { vespalib::ObjectDumper dumper; @@ -384,7 +384,7 @@ Blueprint::asSlime(const vespalib::slime::Inserter & inserter) const return cursor; } -vespalib::string +std::string Blueprint::getClassName() const { return vespalib::getClassName(*this); @@ -828,7 +828,7 @@ LeafBlueprint::createSearch(fef::MatchData &md) const } bool -LeafBlueprint::getRange(vespalib::string &, vespalib::string &) const { +LeafBlueprint::getRange(std::string &, std::string &) const { return false; } diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h index 95a33bfe0f6b..a26e8922d6b6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h @@ -401,9 +401,9 @@ class Blueprint static SearchIteratorUP create_default_filter(FilterConstraint constraint); // for debug dumping - vespalib::string asString() const; + std::string asString() const; vespalib::slime::Cursor & asSlime(const vespalib::slime::Inserter & cursor) const; - virtual vespalib::string getClassName() const; + virtual std::string getClassName() const; virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; virtual bool isEquiv() const noexcept { return false; } virtual bool isWhiteList() const noexcept { return false; } @@ -566,7 +566,7 @@ class LeafBlueprint : public Blueprint SearchIteratorUP createSearch(fef::MatchData &md) const override; const LeafBlueprint * asLeaf() const noexcept final { return this; } - virtual bool getRange(vespalib::string & from, vespalib::string & to) const; + virtual bool getRange(std::string & from, std::string & to) const; virtual SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda) const = 0; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp index 52ebdc57933a..ed55ac278636 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp @@ -58,7 +58,7 @@ CreateBlueprintVisitorHelper::visitPhrase(query::Phrase &n) { void CreateBlueprintVisitorHelper::handleNumberTermAsText(query::NumberTerm &n) { - vespalib::string termStr = termAsString(n); + std::string termStr = termAsString(n); queryeval::SplitFloat splitter(termStr); if (splitter.parts() > 1) { query::SimplePhrase phraseNode(n.getView(), n.getId(), n.getWeight()); @@ -85,7 +85,7 @@ CreateBlueprintVisitorHelper::createWeightedSet(std::unique_ptr bp, NODE &n) FieldSpec childField(_field); for (size_t i = 0; i < n.getNumTerms(); ++i) { auto term = n.getAsString(i); - query::SimpleStringTerm node(vespalib::string(term.first), n.getView(), 0, term.second); // TODO Temporary + query::SimpleStringTerm node(std::string(term.first), n.getView(), 0, term.second); // TODO Temporary childField.setBase(bp->getNextChildField(_field)); bp->addTerm(_searchable.createBlueprint(_requestContext, childField, node), term.second.percent(), estimate); } diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h index c42fe6b2c09a..a0f4d365e926 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h @@ -37,13 +37,13 @@ class FakeRequestContext : public IRequestContext ? _attributeContext->getAttribute(name) : nullptr; } - vespalib::eval::Value* get_query_tensor(const vespalib::string& tensor_name) const override { + vespalib::eval::Value* get_query_tensor(const std::string& tensor_name) const override { if (_query_tensor && (tensor_name == _query_tensor_name)) { return _query_tensor.get(); } return nullptr; } - void set_query_tensor(const vespalib::string& name, const vespalib::eval::TensorSpec& tensor_spec) { + void set_query_tensor(const std::string& name, const vespalib::eval::TensorSpec& tensor_spec) { _query_tensor_name = name; _query_tensor = vespalib::eval::value_from_spec(tensor_spec, vespalib::eval::FastValueBuilderFactory::get()); } @@ -54,7 +54,7 @@ class FakeRequestContext : public IRequestContext std::unique_ptr _clock; const vespalib::Doom _doom; attribute::IAttributeContext *_attributeContext; - vespalib::string _query_tensor_name; + std::string _query_tensor_name; std::unique_ptr _query_tensor; search::attribute::AttributeBlueprintParams _attribute_blueprint_params; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp index 6c6d0aac5e27..00535fef3332 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp @@ -9,8 +9,8 @@ namespace search::queryeval { -FakeSearch::FakeSearch(const vespalib::string &tag, const vespalib::string &field, - const vespalib::string &term, const FakeResult &res, +FakeSearch::FakeSearch(const std::string &tag, const std::string &field, + const std::string &term, const FakeResult &res, fef::TermFieldMatchDataArray tfmda) : _tag(tag), _field(field), _term(term), _result(res), _offset(0), _tfmda(std::move(tfmda)), diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_search.h b/searchlib/src/vespa/searchlib/queryeval/fake_search.h index a1737feec1cb..febce6bffd71 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_search.h @@ -12,9 +12,9 @@ namespace search::queryeval { class FakeSearch : public SearchIterator { private: - vespalib::string _tag; - vespalib::string _field; - vespalib::string _term; + std::string _tag; + std::string _field; + std::string _term; FakeResult _result; uint32_t _offset; fef::TermFieldMatchDataArray _tfmda; @@ -25,9 +25,9 @@ class FakeSearch : public SearchIterator void next() { ++_offset; } public: - FakeSearch(const vespalib::string &tag, - const vespalib::string &field, - const vespalib::string &term, + FakeSearch(const std::string &tag, + const std::string &field, + const std::string &term, const FakeResult &res, fef::TermFieldMatchDataArray tfmda); void attr_ctx(const attribute::ISearchContext *ctx) { _ctx = ctx; } diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp index fc4d5ddf7eff..d24055412645 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp @@ -29,8 +29,8 @@ FakeSearchable::FakeSearchable() } FakeSearchable & -FakeSearchable::addResult(const vespalib::string &field, - const vespalib::string &term, +FakeSearchable::addResult(const std::string &field, + const std::string &term, const FakeResult &result) { _map[Key(field, term)] = result; @@ -46,12 +46,12 @@ template class LookupVisitor : public CreateBlueprintVisitorHelper { const Map &_map; - const vespalib::string _tag; + const std::string _tag; bool _is_attr; public: LookupVisitor(Searchable &searchable, const IRequestContext & requestContext, - const Map &map, const vespalib::string &tag, bool is_attr, const FieldSpec &field); + const Map &map, const std::string &tag, bool is_attr, const FieldSpec &field); ~LookupVisitor(); template @@ -72,7 +72,7 @@ class LookupVisitor : public CreateBlueprintVisitorHelper template LookupVisitor::LookupVisitor(Searchable &searchable, const IRequestContext & requestContext, - const Map &map, const vespalib::string &tag, bool is_attr, const FieldSpec &field) + const Map &map, const std::string &tag, bool is_attr, const FieldSpec &field) : CreateBlueprintVisitorHelper(searchable, field, requestContext), _map(map), _tag(tag), @@ -86,7 +86,7 @@ template template void LookupVisitor::visitTerm(TermNode &n) { - const vespalib::string term_string = termAsString(n); + const std::string term_string = termAsString(n); FakeResult result; auto pos = _map.find(typename Map::key_type(getField().getName(), term_string)); diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h index 21606c967ad2..94a207e5a394 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h @@ -4,8 +4,8 @@ #include "searchable.h" #include "fake_result.h" -#include #include +#include namespace search::queryeval { @@ -15,10 +15,10 @@ namespace search::queryeval { class FakeSearchable : public Searchable { private: - using Key = std::pair; + using Key = std::pair; using Map = std::map; - vespalib::string _tag; + std::string _tag; Map _map; bool _is_attr; @@ -35,7 +35,7 @@ class FakeSearchable : public Searchable * @return this object for chaining * @param t tag **/ - FakeSearchable &tag(const vespalib::string &t) { + FakeSearchable &tag(const std::string &t) { _tag = t; return *this; } @@ -59,8 +59,8 @@ class FakeSearchable : public Searchable * @param term search term in string form * @param result the fake result **/ - FakeSearchable &addResult(const vespalib::string &field, - const vespalib::string &term, + FakeSearchable &addResult(const std::string &field, + const std::string &term, const FakeResult &result); using Searchable::createBlueprint; diff --git a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp b/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp index c199e0d6e7a0..c7aab3a5f84b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp @@ -5,11 +5,11 @@ namespace search::queryeval { -FieldSpec::FieldSpec(const vespalib::string & name, uint32_t fieldId, fef::TermFieldHandle handle) noexcept +FieldSpec::FieldSpec(const std::string & name, uint32_t fieldId, fef::TermFieldHandle handle) noexcept : FieldSpec(name, fieldId, handle, false) {} -FieldSpec::FieldSpec(const vespalib::string & name, uint32_t fieldId, +FieldSpec::FieldSpec(const std::string & name, uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_) noexcept : FieldSpecBase(fieldId, handle, isFilter_), _name(name) diff --git a/searchlib/src/vespa/searchlib/queryeval/field_spec.h b/searchlib/src/vespa/searchlib/queryeval/field_spec.h index 0be9874333da..2a13df14276f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/field_spec.h +++ b/searchlib/src/vespa/searchlib/queryeval/field_spec.h @@ -3,8 +3,8 @@ #pragma once #include -#include #include +#include #include namespace search::fef { @@ -46,17 +46,17 @@ class FieldSpecBase class FieldSpec : public FieldSpecBase { public: - FieldSpec(const vespalib::string & name, uint32_t fieldId, fef::TermFieldHandle handle) noexcept; - FieldSpec(const vespalib::string & name, uint32_t fieldId, + FieldSpec(const std::string & name, uint32_t fieldId, fef::TermFieldHandle handle) noexcept; + FieldSpec(const std::string & name, uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_) noexcept; ~FieldSpec(); void setBase(FieldSpecBase base) noexcept { FieldSpecBase::operator =(base); } - const vespalib::string & getName() const noexcept { return _name; } + const std::string & getName() const noexcept { return _name; } private: - vespalib::string _name; // field name + std::string _name; // field name }; /** diff --git a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h index 8b15bfdc6609..31c6be2fbfcf 100644 --- a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h +++ b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::attribute { struct AttributeBlueprintParams; } namespace search::attribute { class IAttributeVector; } @@ -45,7 +45,7 @@ class IRequestContext * Returns the tensor of the given name that was passed with the query. * Returns nullptr if the tensor is not found or if it is not a tensor. */ - virtual const vespalib::eval::Value* get_query_tensor(const vespalib::string& tensor_name) const = 0; + virtual const vespalib::eval::Value* get_query_tensor(const std::string& tensor_name) const = 0; virtual const search::attribute::AttributeBlueprintParams& get_attribute_blueprint_params() const = 0; diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp index 9d19ba87af79..aa1c02e25d22 100644 --- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp @@ -93,7 +93,7 @@ SimpleBlueprint::SimpleBlueprint(const SimpleResult &result) SimpleBlueprint::~SimpleBlueprint() = default; SimpleBlueprint & -SimpleBlueprint::tag(const vespalib::string &t) +SimpleBlueprint::tag(const std::string &t) { _tag = t; return *this; @@ -104,9 +104,9 @@ SimpleBlueprint::tag(const vespalib::string &t) namespace { struct FakeContext : attribute::ISearchContext { - const vespalib::string &name; + const std::string &name; const FakeResult &result; - FakeContext(const vespalib::string &name_in, const FakeResult &result_in) + FakeContext(const std::string &name_in, const FakeResult &result_in) : name(name_in), result(result_in) {} int32_t onFind(DocId docid, int32_t elemid, int32_t &weight) const override { for (const auto &doc: result.inspect()) { @@ -132,7 +132,7 @@ struct FakeContext : attribute::ISearchContext { Int64Range getAsIntegerTerm() const override { abort(); } DoubleRange getAsDoubleTerm() const override { abort(); } const QueryTermUCS4 * queryTerm() const override { abort(); } - const vespalib::string &attributeName() const override { return name; } + const std::string &attributeName() const override { return name; } uint32_t get_committed_docid_limit() const noexcept override; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h index 2657c5cf15f2..7dcb0bf25170 100644 --- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h +++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.h @@ -39,7 +39,7 @@ class AlwaysTrueBlueprint : public SimpleLeafBlueprint class SimpleBlueprint : public SimpleLeafBlueprint { private: - vespalib::string _tag; + std::string _tag; SimpleResult _result; protected: @@ -48,8 +48,8 @@ class SimpleBlueprint : public SimpleLeafBlueprint public: SimpleBlueprint(const SimpleResult &result); ~SimpleBlueprint() override; - SimpleBlueprint &tag(const vespalib::string &tag); - const vespalib::string &tag() const { return _tag; } + SimpleBlueprint &tag(const std::string &tag); + const std::string &tag() const { return _tag; } FlowStats calculate_flow_stats(uint32_t docid_limit) const override; SearchIterator::UP createFilterSearch(FilterConstraint constraint) const override; }; @@ -59,8 +59,8 @@ class SimpleBlueprint : public SimpleLeafBlueprint class FakeBlueprint : public SimpleLeafBlueprint { private: - vespalib::string _tag; - vespalib::string _term; + std::string _tag; + std::string _term; FieldSpec _field; FakeResult _result; std::unique_ptr _ctx; @@ -73,16 +73,16 @@ class FakeBlueprint : public SimpleLeafBlueprint FakeBlueprint(const FieldSpec &field, const FakeResult &result); ~FakeBlueprint() override; - FakeBlueprint &tag(const vespalib::string &t) { + FakeBlueprint &tag(const std::string &t) { _tag = t; return *this; } - const vespalib::string &tag() const { return _tag; } + const std::string &tag() const { return _tag; } FakeBlueprint &is_attr(bool value); bool is_attr() const { return bool(_ctx); } - FakeBlueprint &term(const vespalib::string &t) { + FakeBlueprint &term(const std::string &t) { _term = t; return *this; } diff --git a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp index 8c767946b1d3..219fcc32970b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.cpp @@ -60,19 +60,19 @@ struct EqualCStringValue { template class FilterMatchingElementsSearch : public MatchingElementsSearch { const AttributeType& _attr; - vespalib::string _field_name; + std::string _field_name; AttributeContent _content; using EqualFunc = std::conditional_t, EqualCStringValue, std::equal_to<>>; vespalib::hash_set, EqualFunc> _matches; public: - FilterMatchingElementsSearch(const IAttributeVector &attr, const vespalib::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries); + FilterMatchingElementsSearch(const IAttributeVector &attr, const std::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries); void find_matching_elements(uint32_t doc_id, MatchingElements& result) override; void initRange(uint32_t begin_id, uint32_t end_id) override; }; template -FilterMatchingElementsSearch::FilterMatchingElementsSearch(const IAttributeVector &attr, const vespalib::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries) +FilterMatchingElementsSearch::FilterMatchingElementsSearch(const IAttributeVector &attr, const std::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries) : _attr(dynamic_cast(attr)), _field_name(field_name), _content(), @@ -113,7 +113,7 @@ FilterMatchingElementsSearch::initRange(uint32_t, uin } std::unique_ptr -MatchingElementsSearch::create(const IAttributeVector &attr, const vespalib::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries) +MatchingElementsSearch::create(const IAttributeVector &attr, const std::string& field_name, EntryRef dictionary_snapshot, std::span dict_entries) { if (attr.as_docid_with_weight_posting_store() == nullptr) { return {}; diff --git a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h index eb260277aea7..d42aef49dcce 100644 --- a/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/matching_elements_search.h @@ -27,7 +27,7 @@ class MatchingElementsSearch { virtual void find_matching_elements(uint32_t doc_id, MatchingElements& result) = 0; virtual void initRange(uint32_t begin_id, uint32_t end_id) = 0; - static std::unique_ptr create(const search::attribute::IAttributeVector &attr, const vespalib::string& field_name, vespalib::datastore::EntryRef dictionary_snapshot, std::span dict_entries); + static std::unique_ptr create(const search::attribute::IAttributeVector &attr, const std::string& field_name, vespalib::datastore::EntryRef dictionary_snapshot, std::span dict_entries); }; } diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp index 62d402bff428..16e86c9967ad 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp @@ -25,7 +25,7 @@ MonitoringSearchIterator::Dumper::addIndent() if (n < 0) { n = 0; } - _str.append(vespalib::string(n, ' ')); + _str.append(std::string(n, ' ')); } void @@ -34,18 +34,18 @@ MonitoringSearchIterator::Dumper::addText(std::string_view value) addIndent(); _str.append(value); uint32_t extraSpaces = value.size() < _textFormatWidth ? _textFormatWidth - value.size() : 0; - _str.append(make_string(":%s ", vespalib::string(extraSpaces, ' ').c_str())); + _str.append(make_string(":%s ", std::string(extraSpaces, ' ').c_str())); } void -MonitoringSearchIterator::Dumper::addInt(int64_t value, const vespalib::string &desc) +MonitoringSearchIterator::Dumper::addInt(int64_t value, const std::string &desc) { _str.append(make_string("%*" PRId64 " %s", _intFormatWidth, value, desc.c_str())); } void -MonitoringSearchIterator::Dumper::addFloat(double value, const vespalib::string &desc) +MonitoringSearchIterator::Dumper::addFloat(double value, const std::string &desc) { _str.append(make_string("%*.*f %s", _floatFormatWidth, _floatFormatPrecision, value, desc.c_str())); @@ -177,7 +177,7 @@ MonitoringSearchIterator::countHitSkips(uint32_t docId) return numHitSkips; } -MonitoringSearchIterator::MonitoringSearchIterator(const vespalib::string &name, +MonitoringSearchIterator::MonitoringSearchIterator(const std::string &name, SearchIterator::UP search, bool collectHitSkipStats) : _name(name), diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h index a98d7da54152..35aad8d262c8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h @@ -59,14 +59,14 @@ class MonitoringSearchIterator : public SearchIterator uint32_t _intFormatWidth; uint32_t _floatFormatWidth; uint32_t _floatFormatPrecision; - vespalib::string _str; + std::string _str; int _currIndent; std::stack _stack; void addIndent(); void addText(std::string_view value); - void addInt(int64_t value, const vespalib::string &desc); - void addFloat(double value, const vespalib::string &desc); + void addInt(int64_t value, const std::string &desc); + void addFloat(double value, const std::string &desc); void openScope(); void closeScope(); @@ -78,7 +78,7 @@ class MonitoringSearchIterator : public SearchIterator uint32_t floatFormatPrecision = 2); ~Dumper() override; - vespalib::string toString() const { return _str; } + std::string toString() const { return _str; } void openStruct(std::string_view name, std::string_view type) override; void closeStruct() override; @@ -93,7 +93,7 @@ class MonitoringSearchIterator : public SearchIterator using UP = std::unique_ptr; private: - const vespalib::string _name; + const std::string _name; const SearchIterator::UP _search; const bool _collectHitSkipStats; Stats _stats; @@ -101,7 +101,7 @@ class MonitoringSearchIterator : public SearchIterator uint32_t countHitSkips(uint32_t docId); public: - MonitoringSearchIterator(const vespalib::string &name, + MonitoringSearchIterator(const std::string &name, SearchIterator::UP search, bool collectHitSkipStats); ~MonitoringSearchIterator() override; diff --git a/searchlib/src/vespa/searchlib/queryeval/multibitvectoriterator.h b/searchlib/src/vespa/searchlib/queryeval/multibitvectoriterator.h index 67a4e1163989..a60737e0532d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/multibitvectoriterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/multibitvectoriterator.h @@ -5,6 +5,7 @@ #include "multisearch.h" #include "unpackinfo.h" #include +#include namespace vespalib::hwaccelerated { class IAccelerated; } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp index 951855b43bb1..43ead0ed4dea 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp @@ -20,7 +20,7 @@ namespace search::queryeval { namespace { -vespalib::string +std::string to_string(NearestNeighborBlueprint::Algorithm algorithm) { using NNBA = NearestNeighborBlueprint::Algorithm; diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp index 75e8d5df6f9e..d17f9957b386 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp @@ -24,7 +24,7 @@ using search::query::PredicateQueryTerm; using std::make_pair; using std::pair; using std::vector; -using vespalib::string; +using std::string; using namespace search::predicate; namespace search::queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.cpp index a8f1c8922622..8a188b6699a5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.cpp @@ -25,7 +25,7 @@ struct TaskGuard { ~TaskGuard() { profiler.complete(); } }; -vespalib::string name_of(const auto &obj) { +std::string name_of(const auto &obj) { auto name = vespalib::getClassName(obj); auto end = name.find("<"); auto ns = name.rfind("::", end); @@ -34,11 +34,11 @@ vespalib::string name_of(const auto &obj) { } std::unique_ptr create(Profiler &profiler, - const vespalib::string &path, + const std::string &path, std::unique_ptr search, auto ctor_token) { - vespalib::string prefix = fmt("%s%s/", path.c_str(), name_of(*search).c_str()); + std::string prefix = fmt("%s%s/", path.c_str(), name_of(*search).c_str()); return std::make_unique(profiler, std::move(search), profiler.resolve(prefix + "init"), profiler.resolve(prefix + "seek"), @@ -101,7 +101,7 @@ ProfiledIterator::visitMembers(vespalib::ObjectVisitor &visitor) const } std::unique_ptr -ProfiledIterator::profile(Profiler &profiler, std::unique_ptr node, const vespalib::string &path) +ProfiledIterator::profile(Profiler &profiler, std::unique_ptr node, const std::string &path) { node->transform_children([&](auto child, size_t i){ return profile(profiler, std::move(child), fmt("%s%zu/", path.c_str(), i)); diff --git a/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.h b/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.h index dc276d266cf6..6707da446fb1 100644 --- a/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/profiled_iterator.h @@ -54,7 +54,7 @@ class ProfiledIterator : public SearchIterator const PostingInfo *getPostingInfo() const override { return _search->getPostingInfo(); } static std::unique_ptr profile(Profiler &profiler, std::unique_ptr node, - const vespalib::string &path = "/"); + const std::string &path = "/"); }; } // namespace diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp index 44cb75aace27..dc72423e6fd6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp @@ -26,7 +26,7 @@ SameElementBlueprint::SameElementBlueprint(const FieldSpec &field, bool expensiv SameElementBlueprint::~SameElementBlueprint() = default; FieldSpec -SameElementBlueprint::getNextChildField(const vespalib::string &field_name, uint32_t field_id) +SameElementBlueprint::getNextChildField(const std::string &field_name, uint32_t field_id) { return {field_name, field_id, _layout.allocTermField(field_id), false}; } diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h index 1d7fc017f692..728d0bbe8baa 100644 --- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h @@ -17,7 +17,7 @@ class SameElementBlueprint : public ComplexLeafBlueprint HitEstimate _estimate; fef::MatchDataLayout _layout; std::vector _terms; - vespalib::string _field_name; + std::string _field_name; public: SameElementBlueprint(const FieldSpec &field, bool expensive); @@ -29,7 +29,7 @@ class SameElementBlueprint : public ComplexLeafBlueprint bool isWhiteList() const noexcept final { return true; } // used by create visitor - FieldSpec getNextChildField(const vespalib::string &field_name, uint32_t field_id); + FieldSpec getNextChildField(const std::string &field_name, uint32_t field_id); // used by create visitor void addTerm(Blueprint::UP term); @@ -45,7 +45,7 @@ class SameElementBlueprint : public ComplexLeafBlueprint SearchIteratorUP createFilterSearch(FilterConstraint constraint) const override; void visitMembers(vespalib::ObjectVisitor &visitor) const override; const std::vector &terms() const { return _terms; } - const vespalib::string &field_name() const { return _field_name; } + const std::string &field_name() const { return _field_name; } }; } diff --git a/searchlib/src/vespa/searchlib/queryeval/searchiterator.cpp b/searchlib/src/vespa/searchlib/queryeval/searchiterator.cpp index ea35acfc969a..979b83f51031 100644 --- a/searchlib/src/vespa/searchlib/queryeval/searchiterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/searchiterator.cpp @@ -87,7 +87,7 @@ SearchIterator::and_hits_into(BitVector &result, uint32_t begin_id) } } -vespalib::string +std::string SearchIterator::asString() const { vespalib::ObjectDumper dumper; @@ -104,7 +104,7 @@ SearchIterator::asSlime(const vespalib::slime::Inserter & inserter) const return cursor; } -vespalib::string +std::string SearchIterator::getClassName() const { return vespalib::getClassName(*this); diff --git a/searchlib/src/vespa/searchlib/queryeval/searchiterator.h b/searchlib/src/vespa/searchlib/queryeval/searchiterator.h index 5c79e0ba7568..30969d333ab6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/searchiterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/searchiterator.h @@ -4,11 +4,11 @@ #include "posting_info.h" #include "begin_and_end_id.h" -#include #include +#include #include +#include #include -#include namespace vespalib { class ObjectVisitor; } namespace vespalib::slime { @@ -291,7 +291,7 @@ class SearchIterator * * @return structured human-readable representation of this object **/ - vespalib::string asString() const; + std::string asString() const; /** * Create a slime representation of this object. This @@ -310,7 +310,7 @@ class SearchIterator * * @return fully qualified class name **/ - virtual vespalib::string getClassName() const; + virtual std::string getClassName() const; /** * Visit each of the members of this object. This method should be diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h index 8ee49183f516..ecddbafc7a5b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h index 3d7af1c46479..54213b7b9a79 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h @@ -14,7 +14,7 @@ namespace search::queryeval { class SimpleSearch : public SearchIterator { private: - vespalib::string _tag; + std::string _tag; SimpleResult _result; uint32_t _index; bool _strict; @@ -28,7 +28,7 @@ class SimpleSearch : public SearchIterator public: SimpleSearch(const SimpleResult &result, bool strict = true); - SimpleSearch &tag(const vespalib::string &t) { + SimpleSearch &tag(const std::string &t) { _tag = t; return *this; } diff --git a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp index 9fd533a16258..7c0926f078df 100644 --- a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.cpp @@ -184,7 +184,7 @@ SourceBlenderSearch::create(std::unique_ptr sourceSele } -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::queryeval::SourceBlenderSearch::Child &obj) { self.openStruct(name, "search::queryeval::SourceBlenderSearch::Child"); diff --git a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.h b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.h index 679e3d35186d..f42248577f2e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/sourceblendersearch.h @@ -78,6 +78,6 @@ class SourceBlenderSearch : public SearchIterator } -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::queryeval::SourceBlenderSearch::Child &obj); diff --git a/searchlib/src/vespa/searchlib/queryeval/split_float.h b/searchlib/src/vespa/searchlib/queryeval/split_float.h index 78a979b465d0..657c5a7ff359 100644 --- a/searchlib/src/vespa/searchlib/queryeval/split_float.h +++ b/searchlib/src/vespa/searchlib/queryeval/split_float.h @@ -3,19 +3,19 @@ #pragma once +#include #include -#include namespace search::queryeval { class SplitFloat { private: - std::vector _parts; + std::vector _parts; public: explicit SplitFloat(std::string_view input); size_t parts() const { return _parts.size(); } - const vespalib::string &getPart(size_t i) const { return _parts[i]; } + const std::string &getPart(size_t i) const { return _parts[i]; } }; } diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp index 365c29362c3b..5b7b9c96e772 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp @@ -40,7 +40,7 @@ using search::query::TrueQueryNode; using search::query::WandTerm; using search::query::WeakAnd; using search::query::WeightedSetTerm; -using vespalib::string; +using std::string; using std::string_view; namespace search::queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.h b/searchlib/src/vespa/searchlib/queryeval/termasstring.h index 54913bb48707..ef7137f07d3a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termasstring.h +++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.h @@ -2,13 +2,13 @@ #pragma once -#include +#include namespace search::query { class Node; } namespace search::queryeval { -vespalib::string termAsString(const search::query::Node &term_node); -std::string_view termAsString(const search::query::Node &term_node, vespalib::string & scratchPad); +std::string termAsString(const search::query::Node &term_node); +std::string_view termAsString(const search::query::Node &term_node, std::string & scratchPad); } diff --git a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp index 04dda3e66cd3..a0302a73a318 100644 --- a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp @@ -84,7 +84,7 @@ UnpackInfo::needUnpack(size_t index) const return false; } -vespalib::string +std::string UnpackInfo::toString() const { vespalib::asciistream os; diff --git a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.h b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.h index 64efd66b8c0e..98ca9a44b76c 100644 --- a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.h +++ b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace search::queryeval { @@ -51,7 +52,7 @@ class UnpackInfo } } - vespalib::string toString() const; + std::string toString() const; }; struct NoUnpack { diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp index eaaa06acd0f4..3554ab2b849f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp @@ -16,7 +16,7 @@ VectorizedIteratorTerms::~VectorizedIteratorTerms() = default; } -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::queryeval::wand::Term &obj) { self.openStruct(name, "search::queryeval::wand::Term"); diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h index 18fee3c77259..69b6c4d78ce4 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h @@ -154,8 +154,8 @@ struct MaxSkipOrder { namespace { template -vespalib::string do_stringify(const vespalib::string &title, ITR begin, ITR end, const F &f) { - vespalib::string result = vespalib::make_string("[%s]{", title.c_str()); +std::string do_stringify(const std::string &title, ITR begin, ITR end, const F &f) { + std::string result = vespalib::make_string("[%s]{", title.c_str()); for (ITR pos = begin; pos != end; ++pos) { if (pos != begin) { result.append(", "); @@ -202,7 +202,7 @@ class VectorizedState uint32_t seek(uint16_t ref, uint32_t docid) { return _iteratorPack.seek(ref, docid); } int32_t get_weight(uint16_t ref, uint32_t docid) { return _iteratorPack.get_weight(ref, docid); } - vespalib::string stringify_docid() const; + std::string stringify_docid() const; }; template @@ -242,7 +242,7 @@ VectorizedState::init_state(const Input &input, const Scorer & sco } template -vespalib::string +std::string VectorizedState::stringify_docid() const { auto range = assemble(Ident(), NumericOrder(_docId.size())); return do_stringify("state{docid}", range.begin(), range.end(), @@ -367,7 +367,7 @@ class DualHeap } ref_t *present_begin() const { return _present; } ref_t *present_end() const { return _past; } - vespalib::string stringify() const; + std::string stringify() const; }; template @@ -407,7 +407,7 @@ DualHeap::init() { } template -vespalib::string +std::string DualHeap::stringify() const { return "Heaps: " + do_stringify("future", _future, _present, @@ -724,7 +724,7 @@ class Algorithm //----------------------------------------------------------------------------- -void visit(vespalib::ObjectVisitor &self, const vespalib::string &name, +void visit(vespalib::ObjectVisitor &self, const std::string &name, const search::queryeval::wand::Term &obj); //----------------------------------------------------------------------------- diff --git a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp index bf3645e8524d..f5ffeffa2712 100644 --- a/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.cpp @@ -15,18 +15,18 @@ class WeightedSetTermMatchingElementsSearch : public MatchingElementsSearch { fef::TermFieldMatchData _tfmd; fef::TermFieldMatchDataArray _tfmda; - vespalib::string _field_name; + std::string _field_name; const std::vector &_terms; std::unique_ptr _search; public: - WeightedSetTermMatchingElementsSearch(const WeightedSetTermBlueprint& bp, const vespalib::string& field_name, const std::vector &terms); + WeightedSetTermMatchingElementsSearch(const WeightedSetTermBlueprint& bp, const std::string& field_name, const std::vector &terms); ~WeightedSetTermMatchingElementsSearch() override; void find_matching_elements(uint32_t docid, MatchingElements& result) override; void initRange(uint32_t begin_id, uint32_t end_id) override; }; -WeightedSetTermMatchingElementsSearch::WeightedSetTermMatchingElementsSearch(const WeightedSetTermBlueprint& bp, const vespalib::string& field_name, const std::vector &terms) +WeightedSetTermMatchingElementsSearch::WeightedSetTermMatchingElementsSearch(const WeightedSetTermBlueprint& bp, const std::string& field_name, const std::vector &terms) : _tfmd(), _tfmda(), _field_name(field_name), diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp index 6021016445f8..160a418ffa82 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp @@ -44,7 +44,7 @@ constexpr size_t max_level_array_size = 16; constexpr size_t max_link_array_size = 193; constexpr vespalib::duration MAX_COUNT_DURATION(1000ms); -const vespalib::string hnsw_max_squared_norm = "hnsw.max_squared_norm"; +const std::string hnsw_max_squared_norm = "hnsw.max_squared_norm"; void save_mips_max_distance(GenericHeader& header, DistanceFunctionFactory& dff) { auto* mips_dff = dynamic_cast(&dff); diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp index 7842e82d4f7f..a6185a7fd1f6 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp @@ -45,7 +45,7 @@ createEmptyTensor(const ValueType &type) return vespalib::eval::value_from_spec(empty_spec, factory); } -vespalib::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const ValueType &tensorType) +std::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const ValueType &tensorType) { return vespalib::make_string("Field tensor type is '%s' but other tensor type is '%s'", fieldTensorType.to_spec().c_str(), diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.cpp index 223c9d7d1f21..e6bf9508b670 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.cpp @@ -33,7 +33,7 @@ namespace search::tensor { inline namespace loader { constexpr uint32_t LOAD_COMMIT_INTERVAL = 256; -const vespalib::string tensorTypeTag("tensortype"); +const std::string tensorTypeTag("tensortype"); bool can_use_index_save_file(const search::attribute::Config &config, const AttributeHeader& header) diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.cpp index 14ebe9329e49..36000c6741cb 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.cpp @@ -27,7 +27,7 @@ TensorAttributeSaver::TensorAttributeSaver(GenerationHandler::Guard &&guard, TensorAttributeSaver::~TensorAttributeSaver() = default; -vespalib::string +std::string TensorAttributeSaver::index_file_suffix() { return "nnidx"; diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.h b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.h index 5190520173bd..df85d26e0a42 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute_saver.h @@ -38,7 +38,7 @@ class TensorAttributeSaver : public AttributeSaver { ~TensorAttributeSaver() override; - static vespalib::string index_file_suffix(); + static std::string index_file_suffix(); }; } diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.cpp index 716d54d0a716..3fa549557206 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.cpp @@ -32,7 +32,7 @@ create_empty_tensor(const ValueType& type) } -TensorExtAttribute::TensorExtAttribute(const vespalib::string& name, const Config& cfg) +TensorExtAttribute::TensorExtAttribute(const std::string& name, const Config& cfg) : NotImplementedAttribute(name, cfg), ITensorAttribute(), IExtendAttribute(), diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.h b/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.h index 0434c2ab65f5..253f5fdfe277 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_ext_attribute.h @@ -28,7 +28,7 @@ class TensorExtAttribute : public NotImplementedAttribute, std::unique_ptr _empty_tensor; public: - TensorExtAttribute(const vespalib::string& name, const Config& cfg); + TensorExtAttribute(const std::string& name, const Config& cfg); ~TensorExtAttribute() override; const ITensorAttribute* asTensorAttribute() const override; void onCommit() override; diff --git a/searchlib/src/vespa/searchlib/test/attribute_builder.cpp b/searchlib/src/vespa/searchlib/test/attribute_builder.cpp index 1730eea4c4db..a2615ac52a3a 100644 --- a/searchlib/src/vespa/searchlib/test/attribute_builder.cpp +++ b/searchlib/src/vespa/searchlib/test/attribute_builder.cpp @@ -17,7 +17,7 @@ using vespalib::eval::TensorSpec; namespace search::attribute::test { -AttributeBuilder::AttributeBuilder(const vespalib::string& name, const Config& cfg) +AttributeBuilder::AttributeBuilder(const std::string& name, const Config& cfg) : _attr_ptr(AttributeFactory::createAttribute(name, cfg)), _attr(*_attr_ptr) { @@ -158,23 +158,23 @@ AttributeBuilder::fill_wset(std::initializer_list values) } AttributeBuilder& -AttributeBuilder::fill(std::initializer_list values) +AttributeBuilder::fill(std::initializer_list values) { - fill_helper(_attr, values); + fill_helper(_attr, values); return *this; } AttributeBuilder& AttributeBuilder::fill_array(std::initializer_list values) { - fill_array_helper(_attr, values); + fill_array_helper(_attr, values); return *this; } AttributeBuilder& AttributeBuilder::fill_wset(std::initializer_list values) { - fill_wset_helper(_attr, values); + fill_wset_helper(_attr, values); return *this; } @@ -186,11 +186,11 @@ AttributeBuilder::fill(std::initializer_list> values) } AttributeBuilder& -AttributeBuilder::fill_tensor(const std::vector& values) +AttributeBuilder::fill_tensor(const std::vector& values) { add_docs(_attr, values.size()); auto& real = dynamic_cast(_attr); - vespalib::string tensor_type = real.getConfig().tensorType().to_spec(); + std::string tensor_type = real.getConfig().tensorType().to_spec(); uint32_t docid = 1; for (const auto& value : values) { if (!value.empty()) { diff --git a/searchlib/src/vespa/searchlib/test/attribute_builder.h b/searchlib/src/vespa/searchlib/test/attribute_builder.h index 56487166e994..c77820576f0e 100644 --- a/searchlib/src/vespa/searchlib/test/attribute_builder.h +++ b/searchlib/src/vespa/searchlib/test/attribute_builder.h @@ -3,11 +3,11 @@ #pragma once #include -#include #include +#include +#include #include #include -#include namespace search { class AttributeVector; } namespace search::attribute { class Config; } @@ -25,15 +25,15 @@ class AttributeBuilder { public: using WeightedInt = std::pair; using WeightedDouble = std::pair; - using WeightedString = std::pair; + using WeightedString = std::pair; using IntList = std::initializer_list; using DoubleList = std::initializer_list; - using StringList = std::initializer_list; + using StringList = std::initializer_list; using WeightedIntList = std::initializer_list; using WeightedDoubleList = std::initializer_list; using WeightedStringList = std::initializer_list; - AttributeBuilder(const vespalib::string& name, const Config& cfg); + AttributeBuilder(const std::string& name, const Config& cfg); AttributeBuilder& docs(size_t num_docs); @@ -50,7 +50,7 @@ class AttributeBuilder { AttributeBuilder& fill_wset(std::initializer_list values); // Fill functions for string attributes - AttributeBuilder& fill(std::initializer_list values); + AttributeBuilder& fill(std::initializer_list values); AttributeBuilder& fill_array(std::initializer_list values); AttributeBuilder& fill_wset(std::initializer_list values); @@ -65,7 +65,7 @@ class AttributeBuilder { * E.g "[1, 2]" is expanded to "tensor(x[2]):[1, 2]". * If the string value is empty no tensor is set for that document. */ - AttributeBuilder& fill_tensor(const std::vector& values); + AttributeBuilder& fill_tensor(const std::vector& values); std::shared_ptr get() const { return _attr_ptr; } }; diff --git a/searchlib/src/vespa/searchlib/test/directory_handler.h b/searchlib/src/vespa/searchlib/test/directory_handler.h index 1874e7bd1d79..7632fdf18c0f 100644 --- a/searchlib/src/vespa/searchlib/test/directory_handler.h +++ b/searchlib/src/vespa/searchlib/test/directory_handler.h @@ -2,25 +2,25 @@ #pragma once -#include #include +#include namespace search::test { class DirectoryHandler { private: - vespalib::string _mkdir; - vespalib::string _rmdir; + std::string _mkdir; + std::string _rmdir; bool _cleanup; public: - DirectoryHandler(const vespalib::string &mkdir) + DirectoryHandler(const std::string &mkdir) : DirectoryHandler(mkdir, mkdir) { } - DirectoryHandler(const vespalib::string &mkdir, - const vespalib::string &rmdir) + DirectoryHandler(const std::string &mkdir, + const std::string &rmdir) : _mkdir(mkdir), _rmdir(rmdir), _cleanup(true) @@ -33,7 +33,7 @@ class DirectoryHandler } } void cleanup(bool v) { _cleanup = v; } - const vespalib::string & getDir() const { return _mkdir; } + const std::string & getDir() const { return _mkdir; } }; } diff --git a/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.cpp b/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.cpp index 76f4f1061688..b271b32d526e 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.cpp @@ -21,7 +21,7 @@ PageDict4MemSeqReader::PageDict4MemSeqReader(uint32_t chunkSize, uint64_t numWor PageDict4MemSeqReader::~PageDict4MemSeqReader() = default; void -PageDict4MemSeqReader::readCounts(vespalib::string &word, +PageDict4MemSeqReader::readCounts(std::string &word, uint64_t &wordNum, PostingListCounts &counts) { diff --git a/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.h b/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.h index a766e0d0f2f3..55084c1eea31 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.h +++ b/searchlib/src/vespa/searchlib/test/diskindex/pagedict4_mem_seq_reader.h @@ -26,7 +26,7 @@ class PageDict4MemSeqReader PageDict4MemSeqReader(uint32_t chunkSize, uint64_t numWordIds, ThreeLevelCountWriteBuffers &wb); ~PageDict4MemSeqReader(); - void readCounts(vespalib::string &word, + void readCounts(std::string &word, uint64_t &wordNum, PostingListCounts &counts); }; diff --git a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp index f4a603e7d303..f95c2df14f8f 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp @@ -20,7 +20,7 @@ using index::schema::DataType; namespace { class MockFieldLengthInspector : public IFieldLengthInspector { - FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + FieldLengthInfo get_field_length_info(const std::string& field_name) const override { if (field_name == "f1") { return {3.5, 21}; } else if (field_name == "f2") { diff --git a/searchlib/src/vespa/searchlib/test/doc_builder.cpp b/searchlib/src/vespa/searchlib/test/doc_builder.cpp index fe3c79962867..18df9054ab84 100644 --- a/searchlib/src/vespa/searchlib/test/doc_builder.cpp +++ b/searchlib/src/vespa/searchlib/test/doc_builder.cpp @@ -55,14 +55,14 @@ DocBuilder::~DocBuilder() = default; std::unique_ptr -DocBuilder::make_document(vespalib::string document_id) const +DocBuilder::make_document(std::string document_id) const { auto doc = std::make_unique(get_repo(), get_document_type(), DocumentId(document_id)); return doc; } const DataType& -DocBuilder::get_data_type(const vespalib::string &name) const +DocBuilder::get_data_type(const std::string &name) const { const DataType *type = _repo->getDataType(*_document_type, name); assert(type); diff --git a/searchlib/src/vespa/searchlib/test/doc_builder.h b/searchlib/src/vespa/searchlib/test/doc_builder.h index 133da4aa5a16..0631ab1c4406 100644 --- a/searchlib/src/vespa/searchlib/test/doc_builder.h +++ b/searchlib/src/vespa/searchlib/test/doc_builder.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include namespace document { class ArrayFieldValue; @@ -38,8 +38,8 @@ class DocBuilder { const document::DocumentTypeRepo& get_repo() const noexcept { return *_repo; } std::shared_ptr get_repo_sp() const noexcept { return _repo; } const document::DocumentType& get_document_type() const noexcept { return *_document_type; } - std::unique_ptr make_document(vespalib::string document_id) const; - const document::DataType &get_data_type(const vespalib::string &name) const; + std::unique_ptr make_document(std::string document_id) const; + const document::DataType &get_data_type(const std::string &name) const; const DocumenttypesConfig& get_documenttypes_config() const noexcept { return *_document_types_config; } document::ArrayFieldValue make_array(std::string_view field_name); document::WeightedSetFieldValue make_wset(std::string_view field_name); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.h b/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.h index 24911ffafba6..695f39340823 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.h @@ -10,8 +10,8 @@ using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; #include -#include #include +#include namespace search::fakedata { diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h index 0cb965d48ef7..0d66dd1a4208 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h @@ -3,8 +3,8 @@ #include "fakeposting.h" #include -#include #include +#include namespace search::index { class Schema; } diff --git a/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.cpp b/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.cpp index e04f6d478b0c..0e7e261f1851 100644 --- a/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.cpp +++ b/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.cpp @@ -31,8 +31,8 @@ namespace search::features::test { namespace { std::shared_ptr -create_tensor_attribute(const vespalib::string& attr_name, - const vespalib::string& tensor_type, +create_tensor_attribute(const std::string& attr_name, + const std::string& tensor_type, DistanceMetric distance_metric, bool direct_tensor, uint32_t docid_limit) @@ -60,19 +60,19 @@ FeatureDumpFixture::~FeatureDumpFixture() = default; DistanceClosenessFixture::DistanceClosenessFixture(size_t fooCnt, size_t barCnt, const Labels& labels, - const vespalib::string& featureName, - const vespalib::string& query_tensor, + const std::string& featureName, + const std::string& query_tensor, DistanceMetric distance_metric) : DistanceClosenessFixture("tensor(x[2])", false, fooCnt, barCnt, labels, featureName, query_tensor, distance_metric) { } -DistanceClosenessFixture::DistanceClosenessFixture(const vespalib::string& tensor_type, +DistanceClosenessFixture::DistanceClosenessFixture(const std::string& tensor_type, bool direct_tensor, size_t fooCnt, size_t barCnt, const Labels& labels, - const vespalib::string& featureName, - const vespalib::string& query_tensor, + const std::string& featureName, + const std::string& query_tensor, DistanceMetric distance_metric) : queryEnv(&indexEnv), rankSetup(factory, indexEnv), mdl(), match_data(), rankProgram(), fooHandles(), barHandles(), @@ -129,8 +129,8 @@ DistanceClosenessFixture::set_attribute_tensor(uint32_t docid, const vespalib::e } void -DistanceClosenessFixture::set_query_tensor(const vespalib::string& query_tensor_name, - const vespalib::string& tensor_type, +DistanceClosenessFixture::set_query_tensor(const std::string& query_tensor_name, + const std::string& tensor_type, const TensorSpec& spec) { search::fef::indexproperties::type::QueryFeature::set(indexEnv.getProperties(), query_tensor_name, tensor_type); diff --git a/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.h b/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.h index 9cac16b03d10..2f7374af9cb8 100644 --- a/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.h +++ b/searchlib/src/vespa/searchlib/test/features/distance_closeness_fixture.h @@ -39,7 +39,7 @@ struct IndexEnvironmentFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) override { + virtual void visitDumpFeature(const std::string &) override { FAIL() << "no features should be dumped"; } FeatureDumpFixture() : IDumpFeatureVisitor() {} @@ -61,19 +61,19 @@ struct DistanceClosenessFixture : BlueprintFactoryFixture, IndexEnvironmentFixtu uint32_t docid_limit; bool _failed; DistanceClosenessFixture(size_t fooCnt, size_t barCnt, - const Labels &labels, const vespalib::string &featureName, - const vespalib::string& query_tensor = "", + const Labels &labels, const std::string &featureName, + const std::string& query_tensor = "", search::attribute::DistanceMetric distance_metric = search::attribute::DistanceMetric::Euclidean); - DistanceClosenessFixture(const vespalib::string& tensor_type, + DistanceClosenessFixture(const std::string& tensor_type, bool direct_tensor, size_t fooCnt, size_t barCnt, - const Labels &labels, const vespalib::string &featureName, - const vespalib::string& query_tensor = "", + const Labels &labels, const std::string &featureName, + const std::string& query_tensor = "", search::attribute::DistanceMetric distance_metric = search::attribute::DistanceMetric::Euclidean); ~DistanceClosenessFixture(); void set_attribute_tensor(uint32_t docid, const vespalib::eval::TensorSpec& spec); - void set_query_tensor(const vespalib::string& query_tensor_name, - const vespalib::string& tensor_type, + void set_query_tensor(const std::string& query_tensor_name, + const std::string& tensor_type, const vespalib::eval::TensorSpec& spec); feature_t getScore(uint32_t docId) { return Utils::getScoreFeature(*rankProgram, docId); diff --git a/searchlib/src/vespa/searchlib/test/ft_test_app_base.cpp b/searchlib/src/vespa/searchlib/test/ft_test_app_base.cpp index 6e7ba5366be6..698e9f2b17a0 100644 --- a/searchlib/src/vespa/searchlib/test/ft_test_app_base.cpp +++ b/searchlib/src/vespa/searchlib/test/ft_test_app_base.cpp @@ -57,14 +57,14 @@ FtTestAppBase::FT_SETUP_OK(const search::fef::Blueprint &prototype, const search } void -FtTestAppBase::FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const vespalib::string &baseName) +FtTestAppBase::FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const std::string &baseName) { StringList empty; FT_DUMP(factory, baseName, empty); } void -FtTestAppBase::FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, +FtTestAppBase::FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const std::string &baseName, search::fef::test::IndexEnvironment &env) { StringList empty; @@ -72,7 +72,7 @@ FtTestAppBase::FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const vespa } void -FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, +FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const std::string &baseName, const StringList &expected) { search::fef::test::IndexEnvironment ie; @@ -80,7 +80,7 @@ FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::s } void -FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, +FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const std::string &baseName, search::fef::test::IndexEnvironment &env, const StringList &expected) { @@ -96,7 +96,7 @@ FtTestAppBase::FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::s void FtTestAppBase::FT_EQUAL(const std::vector &expected, const std::vector &actual, - const vespalib::string &prefix) + const std::string &prefix) { FT_LOG(prefix + " expected", expected); FT_LOG(prefix + " actual ", actual); @@ -113,7 +113,7 @@ FtTestAppBase::FT_LOG(const search::fef::Blueprint &prototype, const search::fef const StringList ¶ms) { LOG(info, "Testing blueprint '%s'.", prototype.getBaseName().c_str()); - std::vector arr; + std::vector arr; for (const auto & it : env.getFields()) { arr.push_back(it.name()); } @@ -122,9 +122,9 @@ FtTestAppBase::FT_LOG(const search::fef::Blueprint &prototype, const search::fef } void -FtTestAppBase::FT_LOG(const vespalib::string &prefix, const std::vector &arr) +FtTestAppBase::FT_LOG(const std::string &prefix, const std::vector &arr) { - vespalib::string str = prefix + " = [ "; + std::string str = prefix + " = [ "; for (uint32_t i = 0; i < arr.size(); ++i) { str.append("'").append(arr[i]).append("'"); if (i < arr.size() - 1) { @@ -136,7 +136,7 @@ FtTestAppBase::FT_LOG(const vespalib::string &prefix, const std::vectorsetFieldLength(it->first, it->second.size())); for (uint32_t i = 0; i < it->second.size(); ++i) { size_t pos = query.find_first_of(it->second[i]); - if (pos != vespalib::string::npos) { + if (pos != std::string::npos) { LOG(debug, "Occurence of '%c' added to field '%s' at position %d.", query[pos], it->first.c_str(), i); ASSERT_TRUE(mdb->addOccurence(it->first, pos, i)); } @@ -207,7 +207,7 @@ FtTestAppBase::FT_SETUP(FtFeatureTest &test, const FtQuery &query, const FtIndex const FtIndex::Element &element = field[e]; ASSERT_TRUE(mdb->addElement(itr->first, element.weight, element.tokens.size())); for (size_t t = 0; t < element.tokens.size(); ++t) { - const vespalib::string &token = element.tokens[t]; + const std::string &token = element.tokens[t]; for (size_t q = 0; q < query.size(); ++q) { if (query[q].term == token) { ASSERT_TRUE(mdb->addOccurence(itr->first, q, t, e)); @@ -229,22 +229,22 @@ FtTestAppBase::setupQueryEnv(FtQueryEnvironment & queryEnv, const FtQuery & quer queryEnv.getTerms()[i].setUniqueId(i); queryEnv.getTerms()[i].setWeight(query[i].termWeight); if (i > 0) { - vespalib::string from = vespalib::make_string("vespa.term.%u.connexity", i); - vespalib::string to = vespalib::make_string("%u", i - 1); - vespalib::string connexity = vespalib::make_string("%f", query[i].connexity); + std::string from = vespalib::make_string("vespa.term.%u.connexity", i); + std::string to = vespalib::make_string("%u", i - 1); + std::string connexity = vespalib::make_string("%f", query[i].connexity); queryEnv.getProperties().add(from, to); queryEnv.getProperties().add(from, connexity); } - vespalib::string term = vespalib::make_string("vespa.term.%u.significance", i); - vespalib::string significance = vespalib::make_string("%f", query[i].significance); + std::string term = vespalib::make_string("vespa.term.%u.significance", i); + std::string significance = vespalib::make_string("%f", query[i].significance); queryEnv.getProperties().add(term, significance); LOG(debug, "Add term node: '%s'", query[i].term.c_str()); } } void -FtTestAppBase::setupFieldMatch(FtFeatureTest & ft, const vespalib::string & indexName, - const vespalib::string & query, const vespalib::string & field, +FtTestAppBase::setupFieldMatch(FtFeatureTest & ft, const std::string & indexName, + const std::string & query, const std::string & field, const fieldmatch::Params * params, uint32_t totalTermWeight, feature_t totalSignificance, uint32_t docId) { @@ -276,16 +276,16 @@ FtTestAppBase::setupFieldMatch(FtFeatureTest & ft, const vespalib::string & inde vespalib::make_string("%f", totalSignificance)); } - std::map > index; + std::map > index; index[indexName] = FtUtil::tokenize(field); FT_SETUP(ft, FtUtil::toQuery(query), index, docId); } RankResult -FtTestAppBase::toRankResult(const vespalib::string & baseName, - const vespalib::string & result, - const vespalib::string & separator) +FtTestAppBase::toRankResult(const std::string & baseName, + const std::string & result, + const std::string & separator) { return FtUtil::toRankResult(baseName, result, separator); } diff --git a/searchlib/src/vespa/searchlib/test/ft_test_app_base.h b/searchlib/src/vespa/searchlib/test/ft_test_app_base.h index f4fc1c11b767..2e0374fcb67d 100644 --- a/searchlib/src/vespa/searchlib/test/ft_test_app_base.h +++ b/searchlib/src/vespa/searchlib/test/ft_test_app_base.h @@ -18,7 +18,7 @@ * Base class for test application used by feature unit tests. */ struct FtTestAppBase { - using string = vespalib::string; + using string = std::string; static void FT_SETUP_FAIL(const search::fef::Blueprint &prototype, const StringList ¶ms); static void FT_SETUP_FAIL(const search::fef::Blueprint &prototype, const search::fef::test::IndexEnvironment &env, const StringList ¶ms); @@ -27,40 +27,40 @@ struct FtTestAppBase { static void FT_SETUP_OK(const search::fef::Blueprint &prototype, const search::fef::test::IndexEnvironment &env, const StringList ¶ms, const StringList &expectedIn, const StringList &expectedOut); - static void FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const vespalib::string &baseName); - static void FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, + static void FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const std::string &baseName); + static void FT_DUMP_EMPTY(search::fef::BlueprintFactory &factory, const std::string &baseName, search::fef::test::IndexEnvironment &env); - static void FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, + static void FT_DUMP(search::fef::BlueprintFactory &factory, const std::string &baseName, const StringList &expected); - static void FT_DUMP(search::fef::BlueprintFactory &factory, const vespalib::string &baseName, + static void FT_DUMP(search::fef::BlueprintFactory &factory, const std::string &baseName, search::fef::test::IndexEnvironment &env, const StringList &expected); static void FT_EQUAL(const std::vector &expected, const std::vector &actual, - const vespalib::string & prefix = ""); + const std::string & prefix = ""); static void FT_LOG(const search::fef::Blueprint &prototype, const search::fef::test::IndexEnvironment &env, const StringList ¶ms); - static void FT_LOG(const vespalib::string &prefix, const std::vector &arr); + static void FT_LOG(const std::string &prefix, const std::vector &arr); - static void FT_SETUP(FtFeatureTest & test, const vespalib::string & query, const StringMap & index, uint32_t docId); + static void FT_SETUP(FtFeatureTest & test, const std::string & query, const StringMap & index, uint32_t docId); static void FT_SETUP(FtFeatureTest & test, const FtQuery & query, const StringVectorMap & index, uint32_t docId); static void FT_SETUP(FtFeatureTest &test, const FtQuery &query, const FtIndex &index, uint32_t docId); static void setupQueryEnv(FtQueryEnvironment & queryEnv, const FtQuery & query); - static void setupFieldMatch(FtFeatureTest & test, const vespalib::string & indexName, - const vespalib::string & query, const vespalib::string & field, + static void setupFieldMatch(FtFeatureTest & test, const std::string & indexName, + const std::string & query, const std::string & field, const search::features::fieldmatch::Params * params, uint32_t totalTermWeight, feature_t totalSignificance, uint32_t docId); - static search::fef::test::RankResult toRankResult(const vespalib::string & baseName, - const vespalib::string & result, - const vespalib::string & separator = " "); + static search::fef::test::RankResult toRankResult(const std::string & baseName, + const std::string & result, + const std::string & separator = " "); template - static bool assertCreateInstance(const T & prototype, const vespalib::string & baseName) { + static bool assertCreateInstance(const T & prototype, const std::string & baseName) { search::fef::Blueprint::UP bp = prototype.createInstance(); #ifdef ENABLE_GTEST_MIGRATION bool failed = false; diff --git a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.cpp b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.cpp index 838c5bdef360..ddfbc773e38f 100644 --- a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.cpp +++ b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.cpp @@ -53,7 +53,7 @@ GlobalId dummy_gid(uint32_t doc_index) { } std::unique_ptr word_term(std::string_view term) { - return std::make_unique(vespalib::string(term), QueryTermSimple::Type::WORD); + return std::make_unique(std::string(term), QueryTermSimple::Type::WORD); } diff --git a/searchlib/src/vespa/searchlib/test/index/mock_field_length_inspector.h b/searchlib/src/vespa/searchlib/test/index/mock_field_length_inspector.h index 3b8e549f94d1..919d2e9e505b 100644 --- a/searchlib/src/vespa/searchlib/test/index/mock_field_length_inspector.h +++ b/searchlib/src/vespa/searchlib/test/index/mock_field_length_inspector.h @@ -10,7 +10,7 @@ namespace search::index::test { * Mock of IFieldLengthInspector returning empty field info for all fields. */ class MockFieldLengthInspector : public IFieldLengthInspector { - FieldLengthInfo get_field_length_info(const vespalib::string& field_name) const override { + FieldLengthInfo get_field_length_info(const std::string& field_name) const override { (void) field_name; return FieldLengthInfo(); } diff --git a/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.cpp b/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.cpp index c7fc666452b9..0a86b28d9c2c 100644 --- a/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.cpp +++ b/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.cpp @@ -8,7 +8,7 @@ namespace search::expression::test { namespace { -vespalib::string indirectKeyMarker("attribute("); +std::string indirectKeyMarker("attribute("); } @@ -22,13 +22,13 @@ makeAttributeMapLookupNode(std::string_view attributeName) auto rightBracePos = attributeName.rfind('}'); keyName << baseName << ".key"; valueName << baseName << ".value" << attributeName.substr(rightBracePos + 1); - if (rightBracePos != vespalib::string::npos && rightBracePos > leftBracePos) { + if (rightBracePos != std::string::npos && rightBracePos > leftBracePos) { if (attributeName[leftBracePos + 1] == '"' && attributeName[rightBracePos - 1] == '"') { - vespalib::string key(attributeName.substr(leftBracePos + 2, rightBracePos - leftBracePos - 3)); + std::string key(attributeName.substr(leftBracePos + 2, rightBracePos - leftBracePos - 3)); return std::make_unique(attributeName, keyName.view(), valueName.view(), key, ""); } else if (attributeName.substr(leftBracePos + 1, indirectKeyMarker.size()) == indirectKeyMarker && attributeName[rightBracePos - 1] == ')') { auto startPos = leftBracePos + 1 + indirectKeyMarker.size(); - vespalib::string keySourceAttributeName(attributeName.substr(startPos, rightBracePos - 1 - startPos)); + std::string keySourceAttributeName(attributeName.substr(startPos, rightBracePos - 1 - startPos)); return std::make_unique(attributeName, keyName.view(), valueName.view(), "", keySourceAttributeName); } } diff --git a/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.h b/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.h index af7475bcd4ee..b7524d6a342b 100644 --- a/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.h +++ b/searchlib/src/vespa/searchlib/test/make_attribute_map_lookup_node.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace search::expression { class AttributeNode; } diff --git a/searchlib/src/vespa/searchlib/test/memoryindex/ordered_field_index_inserter_backend.h b/searchlib/src/vespa/searchlib/test/memoryindex/ordered_field_index_inserter_backend.h index b3f8f4dd0a28..dfac41a36eba 100644 --- a/searchlib/src/vespa/searchlib/test/memoryindex/ordered_field_index_inserter_backend.h +++ b/searchlib/src/vespa/searchlib/test/memoryindex/ordered_field_index_inserter_backend.h @@ -2,8 +2,9 @@ #pragma once -#include +#include #include +#include namespace search::index { class DocIdAndFeatures; } diff --git a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp index 9ce9fa68769f..0ff4dec130b4 100644 --- a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp +++ b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp @@ -7,7 +7,7 @@ namespace search::attribute::test { AttributeVector::SP MockAttributeManager::findAttribute(std::string_view name) const { - auto itr = _attributes.find(vespalib::string(name)); + auto itr = _attributes.find(std::string(name)); if (itr != _attributes.end()) { return itr->second; } @@ -55,7 +55,7 @@ MockAttributeManager::createContext() const { void MockAttributeManager::addAttribute(std::string_view name, const AttributeVector::SP &attr) { attr->addReservedDoc(); - _attributes[vespalib::string(name)] = attr; + _attributes[std::string(name)] = attr; } void MockAttributeManager::addAttribute(const AttributeVector::SP &attr) { diff --git a/searchlib/src/vespa/searchlib/test/schema_builder.cpp b/searchlib/src/vespa/searchlib/test/schema_builder.cpp index e1c19e9b3763..d61a0f96428b 100644 --- a/searchlib/src/vespa/searchlib/test/schema_builder.cpp +++ b/searchlib/src/vespa/searchlib/test/schema_builder.cpp @@ -134,7 +134,7 @@ SchemaBuilder::add_attribute(std::string_view field_name) auto ct = get_collection_type(field.getDataType()); auto& type = get_nested_type(field.getDataType()); auto dt = get_data_type(type); - vespalib::string tensor_type_spec; + std::string tensor_type_spec; assert(type.getId() != DataType::Type::T_URI); if (type.getId() == DataType::Type::T_TENSOR) { assert(ct == search::index::schema::CollectionType::SINGLE); diff --git a/searchlib/src/vespa/searchlib/test/schema_builder.h b/searchlib/src/vespa/searchlib/test/schema_builder.h index c322d45800f0..b5e9a389ef01 100644 --- a/searchlib/src/vespa/searchlib/test/schema_builder.h +++ b/searchlib/src/vespa/searchlib/test/schema_builder.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include #include namespace search::test { diff --git a/searchlib/src/vespa/searchlib/test/string_field_builder.cpp b/searchlib/src/vespa/searchlib/test/string_field_builder.cpp index d81572d89133..699ad560370b 100644 --- a/searchlib/src/vespa/searchlib/test/string_field_builder.cpp +++ b/searchlib/src/vespa/searchlib/test/string_field_builder.cpp @@ -57,7 +57,7 @@ StringFieldBuilder::add_span() } StringFieldBuilder& -StringFieldBuilder::token(const vespalib::string& val, bool is_word) +StringFieldBuilder::token(const std::string& val, bool is_word) { if (val.empty()) { return *this; @@ -75,7 +75,7 @@ StringFieldBuilder::token(const vespalib::string& val, bool is_word) } StringFieldBuilder& -StringFieldBuilder::alt_word(const vespalib::string& val) +StringFieldBuilder::alt_word(const std::string& val) { assert(_last_span != nullptr); _span_tree->annotate(*_last_span, @@ -85,10 +85,10 @@ StringFieldBuilder::alt_word(const vespalib::string& val) } StringFieldBuilder& -StringFieldBuilder::tokenize(const vespalib::string& val) +StringFieldBuilder::tokenize(const std::string& val) { Utf8Reader reader(val); - vespalib::string token_buffer; + std::string token_buffer; Utf8Writer writer(token_buffer); uint32_t c = 0u; bool old_word = false; diff --git a/searchlib/src/vespa/searchlib/test/string_field_builder.h b/searchlib/src/vespa/searchlib/test/string_field_builder.h index a3a24c00e237..64587e96d678 100644 --- a/searchlib/src/vespa/searchlib/test/string_field_builder.h +++ b/searchlib/src/vespa/searchlib/test/string_field_builder.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace document { class SpanList; @@ -21,7 +21,7 @@ class DocBuilder; * Helper class to build annotated string field. */ class StringFieldBuilder { - vespalib::string _value; + std::string _value; size_t _span_start; document::SpanList* _span_list; // owned by _span_tree std::unique_ptr _span_tree; @@ -32,11 +32,11 @@ class StringFieldBuilder { public: StringFieldBuilder(const DocBuilder& doc_builder); ~StringFieldBuilder(); - StringFieldBuilder& token(const vespalib::string& val, bool is_word); - StringFieldBuilder& word(const vespalib::string& val) { return token(val, true); } + StringFieldBuilder& token(const std::string& val, bool is_word); + StringFieldBuilder& word(const std::string& val) { return token(val, true); } StringFieldBuilder& space() { return token(" ", false); } - StringFieldBuilder& tokenize(const vespalib::string& val); - StringFieldBuilder& alt_word(const vespalib::string& val); + StringFieldBuilder& tokenize(const std::string& val); + StringFieldBuilder& alt_word(const std::string& val); document::StringFieldValue build(); }; diff --git a/searchlib/src/vespa/searchlib/test/test_features.cpp b/searchlib/src/vespa/searchlib/test/test_features.cpp index 69372d2e68a4..3db36bb7ac73 100644 --- a/searchlib/src/vespa/searchlib/test/test_features.cpp +++ b/searchlib/src/vespa/searchlib/test/test_features.cpp @@ -20,7 +20,7 @@ struct ImpureValueExecutor : FeatureExecutor { }; bool -ImpureValueBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) +ImpureValueBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) { bool failed = false; EXPECT_EQ(1u, params.size()) << (failed = true, ""); @@ -45,7 +45,7 @@ struct DocidExecutor : FeatureExecutor { }; bool -DocidBlueprint::setup(const IIndexEnvironment &, const std::vector &) +DocidBlueprint::setup(const IIndexEnvironment &, const std::vector &) { describeOutput("out", "the local document id"); return true; @@ -70,7 +70,7 @@ struct BoxingExecutor : FeatureExecutor { }; bool -BoxingBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) +BoxingBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) { bool failed = false; EXPECT_EQ(1u, params.size()) << (failed = true, ""); @@ -101,7 +101,7 @@ struct TrackingExecutor : FeatureExecutor { }; bool -TrackingBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) +TrackingBlueprint::setup(const IIndexEnvironment &, const std::vector ¶ms) { bool failed = false; EXPECT_EQ(1u, params.size()) << (failed = true, ""); diff --git a/searchlib/src/vespa/searchlib/test/test_features.h b/searchlib/src/vespa/searchlib/test/test_features.h index 9377cb57da86..9e218f1792f3 100644 --- a/searchlib/src/vespa/searchlib/test/test_features.h +++ b/searchlib/src/vespa/searchlib/test/test_features.h @@ -17,7 +17,7 @@ struct ImpureValueBlueprint : Blueprint { ImpureValueBlueprint() : Blueprint("ivalue"), value(31212.0) {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return Blueprint::UP(new ImpureValueBlueprint()); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; FeatureExecutor &createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const override; }; @@ -28,7 +28,7 @@ struct DocidBlueprint : Blueprint { DocidBlueprint() : Blueprint("docid") {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return Blueprint::UP(new DocidBlueprint()); } - bool setup(const IIndexEnvironment &, const std::vector &) override; + bool setup(const IIndexEnvironment &, const std::vector &) override; FeatureExecutor &createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const override; }; @@ -39,7 +39,7 @@ struct BoxingBlueprint : Blueprint { BoxingBlueprint() : Blueprint("box") {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return Blueprint::UP(new BoxingBlueprint()); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; FeatureExecutor &createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const override; }; @@ -51,7 +51,7 @@ struct TrackingBlueprint : Blueprint { TrackingBlueprint(size_t &ext_cnt_in) : Blueprint("track"), ext_cnt(ext_cnt_in) {} void visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const override {} Blueprint::UP createInstance() const override { return Blueprint::UP(new TrackingBlueprint(ext_cnt)); } - bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; + bool setup(const IIndexEnvironment &, const std::vector ¶ms) override; FeatureExecutor &createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp b/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp index 3daf5644e5ed..36f6fd6ab12c 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp @@ -13,7 +13,7 @@ using namespace std::chrono_literals; namespace search::transactionlog::client { -SessionKey::SessionKey(const vespalib::string & domain, int sessionId) +SessionKey::SessionKey(const std::string & domain, int sessionId) : _domain(domain), _sessionId(sessionId) { } @@ -29,7 +29,7 @@ SessionKey::cmp(const SessionKey & b) const return diff; } -Session::Session(const vespalib::string & domain, TransLogClient & tlc) +Session::Session(const std::string & domain, TransLogClient & tlc) : _tlc(tlc), _domain(domain), _sessionId(0) @@ -56,7 +56,7 @@ Session::commit(const vespalib::ConstBufferRef & buf) if (retval) { req->internal_subref(); } else { - vespalib::string msg; + std::string msg; if (req->GetReturn() != nullptr) { msg = req->GetReturn()->GetValue(1)._string._str; } else { @@ -128,7 +128,7 @@ Session::clear() _sessionId = 0; } -Visitor::Visitor(const vespalib::string & domain, TransLogClient & tlc, Callback & callBack) : +Visitor::Visitor(const std::string & domain, TransLogClient & tlc, Callback & callBack) : Session(domain, tlc), _callback(callBack) { diff --git a/searchlib/src/vespa/searchlib/transactionlog/client_session.h b/searchlib/src/vespa/searchlib/transactionlog/client_session.h index 7c9bf38b7c2f..fd6f01f1a4b7 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/client_session.h +++ b/searchlib/src/vespa/searchlib/transactionlog/client_session.h @@ -4,7 +4,7 @@ #include "client_common.h" #include #include -#include +#include class FRT_RPCRequest; @@ -15,19 +15,19 @@ class TransLogClient; class SessionKey { public: - SessionKey(const vespalib::string & domain, int sessionId); + SessionKey(const std::string & domain, int sessionId); ~SessionKey(); bool operator < (const SessionKey & b) const { return cmp(b) < 0; } private: int cmp(const SessionKey & b) const; - vespalib::string _domain; + std::string _domain; int _sessionId; }; class Session { public: - Session(const vespalib::string & domain, TransLogClient & tlc); + Session(const std::string & domain, TransLogClient & tlc); virtual ~Session(); /// You can commit data of any registered type to any channel. bool commit(const vespalib::ConstBufferRef & packet); @@ -41,13 +41,13 @@ class Session virtual void eof() { } bool close(); void clear(); - const vespalib::string & getDomain() const { return _domain; } + const std::string & getDomain() const { return _domain; } const TransLogClient & getTLC() const { return _tlc; } protected: bool init(FRT_RPCRequest * req); bool run(); TransLogClient & _tlc; - vespalib::string _domain; + std::string _domain; int _sessionId; }; @@ -55,7 +55,7 @@ class Session class Visitor : public Session { public: - Visitor(const vespalib::string & domain, TransLogClient & tlc, Callback & callBack); + Visitor(const std::string & domain, TransLogClient & tlc, Callback & callBack); bool visit(const SerialNum & from, const SerialNum & to); virtual ~Visitor() override; RPC::Result visit(const Packet & packet) override { return _callback.receive(packet); } diff --git a/searchlib/src/vespa/searchlib/transactionlog/common.h b/searchlib/src/vespa/searchlib/transactionlog/common.h index 639c3087e8a8..86e43aec6793 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/common.h +++ b/searchlib/src/vespa/searchlib/transactionlog/common.h @@ -118,14 +118,14 @@ class Writer { class WriterFactory { public: virtual ~WriterFactory() = default; - virtual std::shared_ptr getWriter(const vespalib::string & domainName) const = 0; + virtual std::shared_ptr getWriter(const std::string & domainName) const = 0; }; class Destination { public: virtual ~Destination() = default; - virtual bool send(int32_t id, const vespalib::string & domain, const Packet & packet) = 0; - virtual bool sendDone(int32_t id, const vespalib::string & domain) = 0; + virtual bool send(int32_t id, const std::string & domain, const Packet & packet) = 0; + virtual bool sendDone(int32_t id, const std::string & domain) = 0; virtual bool connected() const = 0; virtual bool ok() const = 0; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp index ba5fd3b2f380..b013a79ed794 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp @@ -22,7 +22,7 @@ LOG_SETUP(".transactionlog.domain"); -using vespalib::string; +using std::string; using vespalib::make_string_short::fmt; using vespalib::makeLambdaTask; using vespalib::CpuUsage; @@ -487,10 +487,10 @@ Domain::scanDir() { SerialNumList res; std::filesystem::directory_iterator dir_scan{std::filesystem::path(dir())}; - vespalib::string prefix = _name + "-"; + std::string prefix = _name + "-"; for (auto& entry : dir_scan) { if (entry.is_regular_file()) { - vespalib::string ename = entry.path().filename().string(); + std::string ename = entry.path().filename().string(); if (ename.substr(0, prefix.size()) == prefix) { const char *p = &ename[prefix.size()]; uint64_t num = strtoull(p, nullptr, 10); diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.h b/searchlib/src/vespa/searchlib/transactionlog/domain.h index e5c512c9cd6c..245c6ad87fe9 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domain.h +++ b/searchlib/src/vespa/searchlib/transactionlog/domain.h @@ -19,13 +19,13 @@ class Domain : public Writer using SP = std::shared_ptr; using DomainPartSP = std::shared_ptr; using FileHeaderContext = common::FileHeaderContext; - Domain(const vespalib::string &name, const vespalib::string &baseDir, vespalib::Executor & executor, + Domain(const std::string &name, const std::string &baseDir, vespalib::Executor & executor, const DomainConfig & cfg, const FileHeaderContext &fileHeaderContext); ~Domain() override; DomainInfo getDomainInfo() const; - const vespalib::string & name() const { return _name; } + const std::string & name() const { return _name; } bool erase(SerialNum to); void append(const Packet & packet, Writer::DoneCallback onDone) override; @@ -48,8 +48,8 @@ class Domain : public Writer SerialNum findOldestActiveVisit() const; DomainPartSP findPart(SerialNum s); - static vespalib::string - getDir(const vespalib::string & base, const vespalib::string & domain) { + static std::string + getDir(const std::string & base, const std::string & domain) { return base + "/" + domain; } uint64_t size() const; @@ -69,7 +69,7 @@ class Domain : public Writer size_t byteSize(const UniqueLock & guard) const; uint64_t size(const UniqueLock & guard) const; void cleanSessions(); - vespalib::string dir() const { return getDir(_baseDir, _name); } + std::string dir() const { return getDir(_baseDir, _name); } void addPart(SerialNum partId, bool isLastPart); DomainPartSP optionallyRotateFile(SerialNum serialNum); @@ -88,14 +88,14 @@ class Domain : public Writer std::unique_ptr _singleCommitter; Executor &_executor; std::atomic _sessionId; - vespalib::string _name; + std::string _name; DomainPartList _parts; mutable std::mutex _partsMutex; std::mutex _currentChunkMutex; mutable std::mutex _sessionMutex; SessionList _sessions; DurationSeconds _maxSessionRunTime; - vespalib::string _baseDir; + std::string _baseDir; const FileHeaderContext &_fileHeaderContext; bool _markedDeleted; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainconfig.h b/searchlib/src/vespa/searchlib/transactionlog/domainconfig.h index 1c37c6bc2fe5..b5bbb7cdcd0c 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainconfig.h +++ b/searchlib/src/vespa/searchlib/transactionlog/domainconfig.h @@ -33,7 +33,7 @@ struct PartInfo { SerialNumRange range; size_t numEntries; size_t byteSize; - vespalib::string file; + std::string file; PartInfo(SerialNumRange range_in, size_t numEntries_in, size_t byteSize_in, std::string_view file_in) : range(range_in), numEntries(numEntries_in), @@ -55,6 +55,6 @@ struct DomainInfo { : range(), numEntries(0), byteSize(0), maxSessionRunTime(), parts() {} }; -using DomainStats = std::map; +using DomainStats = std::map; } diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp index 0a8d9105597a..d6e2930d4791 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp @@ -13,7 +13,7 @@ LOG_SETUP(".transactionlog.domainpart"); using vespalib::make_string_short::fmt; using vespalib::FileHeader; -using vespalib::string; +using std::string; using vespalib::getLastErrorString; using vespalib::IllegalHeaderException; using vespalib::nbostream; diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.h b/searchlib/src/vespa/searchlib/transactionlog/domainpart.h index 5e766b1b3247..efb6be7e66d7 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.h +++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.h @@ -19,12 +19,12 @@ class DomainPart { using SP = std::shared_ptr; DomainPart(const DomainPart &) = delete; DomainPart& operator=(const DomainPart &) = delete; - DomainPart(const vespalib::string &name, const vespalib::string &baseDir, SerialNum s, + DomainPart(const std::string &name, const std::string &baseDir, SerialNum s, const common::FileHeaderContext &FileHeaderContext, bool allowTruncate); ~DomainPart(); - const vespalib::string &fileName() const { return _fileName; } + const std::string &fileName() const { return _fileName; } void commit(const SerializedChunk & serialized); bool erase(SerialNum to); bool visit(FastOS_FileInterface &file, SerialNumRange &r, Packet &packet); @@ -80,7 +80,7 @@ class DomainPart { std::atomic _range_to; std::atomic _sz; std::atomic _byteSize; - vespalib::string _fileName; + std::string _fileName; std::unique_ptr _transLog; std::vector _skipList; uint32_t _headerLen; diff --git a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp index 45f2722729c2..dcfdb18281b6 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp @@ -51,7 +51,7 @@ TransLogServerExplorer::get_state(const Inserter &inserter, bool full) const inserter.insertObject(); } -std::vector +std::vector TransLogServerExplorer::get_children_names() const { return _server->getDomainNames(); diff --git a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h index 22e2877e61d4..82d141070ab5 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h +++ b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h @@ -21,7 +21,7 @@ class TransLogServerExplorer : public vespalib::StateExplorer TransLogServerExplorer(TransLogServerSP server) : _server(std::move(server)) {} ~TransLogServerExplorer() override; void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; - std::vector get_children_names() const override; + std::vector get_children_names() const override; std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp index af992c1e5518..8da8fa547a20 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp @@ -45,7 +45,7 @@ struct RpcTask : public vespalib::Executor::Task { } -TransLogClient::TransLogClient(FNET_Transport & transport, const vespalib::string & rpcTarget) : +TransLogClient::TransLogClient(FNET_Transport & transport, const std::string & rpcTarget) : _executor(std::make_unique(1, translogclient_rpc_callback)), _rpcTarget(rpcTarget), _sessions(), @@ -85,7 +85,7 @@ TransLogClient::disconnect() } bool -TransLogClient::create(const vespalib::string & domain) +TransLogClient::create(const std::string & domain) { FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("createDomain"); @@ -96,7 +96,7 @@ TransLogClient::create(const vespalib::string & domain) } bool -TransLogClient::remove(const vespalib::string & domain) +TransLogClient::remove(const std::string & domain) { FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("deleteDomain"); @@ -107,7 +107,7 @@ TransLogClient::remove(const vespalib::string & domain) } std::unique_ptr -TransLogClient::open(const vespalib::string & domain) +TransLogClient::open(const std::string & domain) { FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("openDomain"); @@ -121,13 +121,13 @@ TransLogClient::open(const vespalib::string & domain) } std::unique_ptr -TransLogClient::createVisitor(const vespalib::string & domain, Callback & callBack) +TransLogClient::createVisitor(const std::string & domain, Callback & callBack) { return std::make_unique(domain, *this, callBack); } bool -TransLogClient::listDomains(std::vector & dir) +TransLogClient::listDomains(std::vector & dir) { FRT_RPCRequest *req = _supervisor->AllocRPCRequest(); req->SetMethodName("listDomains"); @@ -161,7 +161,7 @@ TransLogClient::rpc(FRT_RPCRequest * req) } Session * -TransLogClient::findSession(const vespalib::string & domainName, int sessionId) +TransLogClient::findSession(const std::string & domainName, int sessionId) { SessionKey key(domainName, sessionId); auto found = _sessions.find(key); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h index 24954871dd1b..75fa53955e93 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h @@ -22,25 +22,25 @@ class Visitor; class TransLogClient : private FRT_Invokable { public: - TransLogClient(FNET_Transport & transport, const vespalib::string & rpctarget); + TransLogClient(FNET_Transport & transport, const std::string & rpctarget); TransLogClient(const TransLogClient &) = delete; TransLogClient& operator=(const TransLogClient &) = delete; ~TransLogClient() override; /// Here you create a new domain - bool create(const vespalib::string & domain); + bool create(const std::string & domain); /// Here you remove a domain - bool remove(const vespalib::string & domain); + bool remove(const std::string & domain); /// Here you open an existing domain - std::unique_ptr open(const vespalib::string & domain); + std::unique_ptr open(const std::string & domain); /// Here you can get a list of available domains. - bool listDomains(std::vector & dir); - std::unique_ptr createVisitor(const vespalib::string & domain, Callback & callBack); + bool listDomains(std::vector & dir); + std::unique_ptr createVisitor(const std::string & domain, Callback & callBack); bool isConnected() const; void disconnect(); bool reconnect(); - const vespalib::string &getRPCTarget() const { return _rpcTarget; } + const std::string &getRPCTarget() const { return _rpcTarget; } private: friend Session; friend Visitor; @@ -50,12 +50,12 @@ class TransLogClient : private FRT_Invokable void visitCallbackRPC_hook(FRT_RPCRequest *req); void eofCallbackRPC_hook(FRT_RPCRequest *req); int32_t rpc(FRT_RPCRequest * req); - Session * findSession(const vespalib::string & domain, int sessionId); + Session * findSession(const std::string & domain, int sessionId); using SessionMap = std::map< SessionKey, Session * >; std::unique_ptr _executor; - vespalib::string _rpcTarget; + std::string _rpcTarget; SessionMap _sessions; //Brute force lock for subscriptions. For multithread safety. std::mutex _lock; diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index 93a9c4afcc02..db6d088d7c28 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -79,19 +79,19 @@ VESPA_THREAD_STACK_TAG(tls_executor); } -TransLogServer::TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, +TransLogServer::TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const FileHeaderContext &fileHeaderContext) : TransLogServer(transport, name, listenPort, baseDir, fileHeaderContext, DomainConfig().setEncoding(Encoding(Encoding::xxh64, Encoding::Compression::zstd)) .setPartSizeLimit(0x10000000).setChunkSizeLimit(0x40000)) {} -TransLogServer::TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, +TransLogServer::TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const FileHeaderContext &fileHeaderContext, const DomainConfig & cfg) : TransLogServer(transport, name, listenPort, baseDir, fileHeaderContext, cfg, 4) {} -TransLogServer::TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, +TransLogServer::TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const FileHeaderContext &fileHeaderContext, const DomainConfig & cfg, size_t maxThreads) : FRT_Invokable(), _name(name), @@ -110,7 +110,7 @@ TransLogServer::TransLogServer(FNET_Transport & transport, const vespalib::strin if ((retval = makeDirectory(dir())) == 0) { std::ifstream domainDir(domainList().c_str()); while (domainDir.good() && !domainDir.eof()) { - vespalib::string domainName; + std::string domainName; domainDir >> domainName; if ( ! domainName.empty()) { try { @@ -225,10 +225,10 @@ TransLogServer::getDomainStats() const return retval; } -std::vector +std::vector TransLogServer::getDomainNames() { - std::vector names; + std::vector names; ReadGuard guard(_domainMutex); for(const auto &domain: _domains) { names.push_back(domain.first); @@ -240,7 +240,7 @@ Domain::SP TransLogServer::findDomain(std::string_view domainName) const { ReadGuard domainGuard(_domainMutex); - auto found(_domains.find(vespalib::string(domainName))); + auto found(_domains.find(std::string(domainName))); if (found != _domains.end()) { return found->second; } @@ -338,12 +338,12 @@ constexpr double NEVER(-1.0); void writeDomainDir(std::shared_lock &guard, - vespalib::string dir, - vespalib::string domainList, - const std::map> &domains) + std::string dir, + std::string domainList, + const std::map> &domains) { (void) guard; - vespalib::string domainListTmp(domainList + ".tmp"); + std::string domainListTmp(domainList + ".tmp"); std::filesystem::remove(std::filesystem::path(domainListTmp)); std::ofstream domainDir(domainListTmp.c_str(), std::ios::trunc); for (const auto &domainEntry : domains) { @@ -368,7 +368,7 @@ class RPCDestination : public Destination { return _ok; } - bool send(int32_t id, const vespalib::string & domain, const Packet & packet) override { + bool send(int32_t id, const std::string & domain, const Packet & packet) override { FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); req->SetMethodName("visitCallback"); req->GetParams()->AddString(domain.c_str()); @@ -377,7 +377,7 @@ class RPCDestination : public Destination { return send(req); } - bool sendDone(int32_t id, const vespalib::string & domain) override { + bool sendDone(int32_t id, const std::string & domain) override { FRT_RPCRequest *req = _supervisor.AllocRPCRequest(); req->SetMethodName("eofCallback"); req->GetParams()->AddString(domain.c_str()); @@ -458,7 +458,7 @@ void TransLogServer::deleteDomain(FRT_RPCRequest *req) { uint32_t retval(0); - vespalib::string msg("ok"); + std::string msg("ok"); FRT_Values & params = *req->GetParams(); FRT_Values & ret = *req->GetReturn(); @@ -516,7 +516,7 @@ TransLogServer::listDomains(FRT_RPCRequest *req) FRT_Values & ret = *req->GetReturn(); LOG(debug, "listDomains()"); - vespalib::string domains; + std::string domains; ReadGuard domainGuard(_domainMutex); for (const auto& elem : _domains) { domains += elem.second->name(); @@ -548,7 +548,7 @@ TransLogServer::domainStatus(FRT_RPCRequest *req) } std::shared_ptr -TransLogServer::getWriter(const vespalib::string & domainName) const +TransLogServer::getWriter(const std::string & domainName) const { Domain::SP domain(findDomain(domainName)); if (domain) { diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index dc49719a81d8..30cd85bdeeea 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -24,15 +24,15 @@ class TransLogServer : private FRT_Invokable, public WriterFactory friend class TransLogServerExplorer; using SP = std::shared_ptr; using DomainSP = std::shared_ptr; - TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, + TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const common::FileHeaderContext &fileHeaderContext, const DomainConfig & cfg, size_t maxThreads); - TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, + TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const common::FileHeaderContext &fileHeaderContext, const DomainConfig & cfg); - TransLogServer(FNET_Transport & transport, const vespalib::string &name, int listenPort, const vespalib::string &baseDir, + TransLogServer(FNET_Transport & transport, const std::string &name, int listenPort, const std::string &baseDir, const common::FileHeaderContext &fileHeaderContext); ~TransLogServer() override; DomainStats getDomainStats() const; - std::shared_ptr getWriter(const vespalib::string & domainName) const override; + std::shared_ptr getWriter(const std::string & domainName) const override; TransLogServer & setDomainConfig(const DomainConfig & cfg); private: @@ -54,19 +54,19 @@ class TransLogServer : private FRT_Invokable, public WriterFactory void domainSessionClose(FRT_RPCRequest *req); void domainSync(FRT_RPCRequest *req); - std::vector getDomainNames(); + std::vector getDomainNames(); DomainSP findDomain(std::string_view name) const; - vespalib::string dir() const { return _baseDir + "/" + _name; } - vespalib::string domainList() const { return dir() + "/" + _name + ".domains"; } + std::string dir() const { return _baseDir + "/" + _name; } + std::string domainList() const { return dir() + "/" + _name + ".domains"; } - using DomainList = std::map; + using DomainList = std::map; using ReadGuard = std::shared_lock; using WriteGuard = std::unique_lock; bool running() const { return !_closed.load(std::memory_order_relaxed); } - vespalib::string _name; - vespalib::string _baseDir; + std::string _name; + std::string _baseDir; DomainConfig _domainConfig; vespalib::ThreadStackExecutor _executor; std::thread _thread; diff --git a/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp b/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp index 592d1f0ecf7a..8ad9c36a0b10 100644 --- a/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp +++ b/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp @@ -2,8 +2,9 @@ #include "ucaconverter.h" #include -#include +#include #include +#include #include #include LOG_SETUP(".search.common.sortspec"); diff --git a/searchlib/src/vespa/searchlib/uca/ucaconverter.h b/searchlib/src/vespa/searchlib/uca/ucaconverter.h index 1f96df249963..123dc76d2969 100644 --- a/searchlib/src/vespa/searchlib/uca/ucaconverter.h +++ b/searchlib/src/vespa/searchlib/uca/ucaconverter.h @@ -4,10 +4,10 @@ #include #include -#include #include -#include #include +#include +#include namespace search { @@ -30,7 +30,7 @@ class UcaConverter : public BlobConverter const Collator & getCollator() const { return *_collator; } private: struct Buffer { - vespalib::string _data; + std::string _data; uint8_t *ptr() { return (uint8_t *)_data.data(); } int32_t siz() { return _data.size(); } Buffer() : _data() { diff --git a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.cpp b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.cpp index 0e607cbcf9b2..0ef98510760c 100644 --- a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.cpp @@ -12,7 +12,7 @@ IMPLEMENT_EXPRESSIONNODE(UcaFunctionNode, UnaryFunctionNode); UcaFunctionNode::UcaFunctionNode() = default; UcaFunctionNode::~UcaFunctionNode() = default; -UcaFunctionNode::UcaFunctionNode(ExpressionNode::UP arg, const vespalib::string & locale, const vespalib::string & strength) : +UcaFunctionNode::UcaFunctionNode(ExpressionNode::UP arg, const std::string & locale, const std::string & strength) : UnaryFunctionNode(std::move(arg)), _locale(locale), _strength(strength), diff --git a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h index e8deaa4beff8..e53ce255af48 100644 --- a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h +++ b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h @@ -16,7 +16,7 @@ class UcaFunctionNode : public UnaryFunctionNode DECLARE_NBO_SERIALIZE; UcaFunctionNode(); ~UcaFunctionNode() override; - UcaFunctionNode(ExpressionNode::UP arg, const vespalib::string & locale, const vespalib::string & strength); + UcaFunctionNode(ExpressionNode::UP arg, const std::string & locale, const std::string & strength); UcaFunctionNode(const UcaFunctionNode & rhs); UcaFunctionNode & operator = (const UcaFunctionNode & rhs); private: @@ -48,8 +48,8 @@ class UcaFunctionNode : public UnaryFunctionNode private: RawResultNodeVector & _result; }; - vespalib::string _locale; - vespalib::string _strength; + std::string _locale; + std::string _strength; common::BlobConverter::SP _collator; std::unique_ptr _handler; }; diff --git a/searchlib/src/vespa/searchlib/util/filekit.cpp b/searchlib/src/vespa/searchlib/util/filekit.cpp index 04f15635860a..cfe958cd8ce4 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.cpp +++ b/searchlib/src/vespa/searchlib/util/filekit.cpp @@ -10,7 +10,7 @@ LOG_SETUP(".filekit"); namespace search { vespalib::system_time -FileKit::getModificationTime(const vespalib::string &name) +FileKit::getModificationTime(const std::string &name) { FastOS_StatInfo statInfo; if (FastOS_File::Stat(name.c_str(), &statInfo)) { diff --git a/searchlib/src/vespa/searchlib/util/filekit.h b/searchlib/src/vespa/searchlib/util/filekit.h index dc8a18810e6f..31ec3eb934d8 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.h +++ b/searchlib/src/vespa/searchlib/util/filekit.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search { @@ -14,7 +14,7 @@ class FileKit * Returns the modification time of the given file/directory, * or time stamp 0 if stating of file/directory fails. **/ - static vespalib::system_time getModificationTime(const vespalib::string &name); + static vespalib::system_time getModificationTime(const std::string &name); }; } diff --git a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp index 7b5ef8ec1bad..c8a990ef1e8a 100644 --- a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp +++ b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp @@ -11,7 +11,7 @@ namespace search { namespace { -const vespalib::string fileBitSizeTag = "fileBitSize"; +const std::string fileBitSizeTag = "fileBitSize"; bool byteAligned(uint64_t bitSize) { @@ -23,7 +23,7 @@ bool byteAligned(uint64_t bitSize) bool FileSizeCalculator::extractFileSize(const vespalib::GenericHeader &header, size_t headerLen, - vespalib::string fileName, uint64_t &fileSize) + std::string fileName, uint64_t &fileSize) { if (!header.hasTag(fileBitSizeTag)) { return true; diff --git a/searchlib/src/vespa/searchlib/util/filesizecalculator.h b/searchlib/src/vespa/searchlib/util/filesizecalculator.h index 4f91b7ccf26c..4135072e9ad0 100644 --- a/searchlib/src/vespa/searchlib/util/filesizecalculator.h +++ b/searchlib/src/vespa/searchlib/util/filesizecalculator.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace vespalib { class GenericHeader; } @@ -19,7 +20,7 @@ class FileSizeCalculator public: static bool extractFileSize(const vespalib::GenericHeader &header, size_t headerLen, - vespalib::string fileName, uint64_t &fileSize); + std::string fileName, uint64_t &fileSize); }; } diff --git a/searchlib/src/vespa/searchlib/util/fileutil.cpp b/searchlib/src/vespa/searchlib/util/fileutil.cpp index 25aa2345cb7e..a2e9ca35970f 100644 --- a/searchlib/src/vespa/searchlib/util/fileutil.cpp +++ b/searchlib/src/vespa/searchlib/util/fileutil.cpp @@ -21,7 +21,7 @@ using vespalib::getLastErrorString; namespace search::fileutil { -LoadedMmap::LoadedMmap(const vespalib::string &fileName) +LoadedMmap::LoadedMmap(const std::string &fileName) : LoadedBuffer(nullptr, 0), _mapBuffer(nullptr), _mapSize(0) @@ -83,7 +83,7 @@ LoadedMmap::~LoadedMmap() { namespace search { std::unique_ptr -FileUtil::openFile(const vespalib::string &fileName) +FileUtil::openFile(const std::string &fileName) { auto file = std::make_unique(); file->EnableDirectIO(); @@ -98,7 +98,7 @@ using fileutil::LoadedBuffer; using fileutil::LoadedMmap; LoadedBuffer::UP -FileUtil::loadFile(const vespalib::string &fileName) +FileUtil::loadFile(const std::string &fileName) { auto data = std::make_unique(fileName); FastOS_File file(fileName.c_str()); diff --git a/searchlib/src/vespa/searchlib/util/fileutil.h b/searchlib/src/vespa/searchlib/util/fileutil.h index a85193675eb9..57861bdafb3a 100644 --- a/searchlib/src/vespa/searchlib/util/fileutil.h +++ b/searchlib/src/vespa/searchlib/util/fileutil.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include using vespalib::GenericHeader; @@ -42,7 +42,7 @@ class LoadedMmap : public LoadedBuffer void * _mapBuffer; size_t _mapSize; public: - explicit LoadedMmap(const vespalib::string &fileName); + explicit LoadedMmap(const std::string &fileName); ~LoadedMmap() override; }; @@ -60,13 +60,13 @@ class FileUtil * Opens and returns the file with the given name for reading. * Enables direct IO on the file. **/ - static std::unique_ptr openFile(const vespalib::string &fileName); + static std::unique_ptr openFile(const std::string &fileName); /** * Loads and returns the file with the given name. * Mmaps the file into the returned buffer. **/ - static fileutil::LoadedBuffer::UP loadFile(const vespalib::string &fileName); + static fileutil::LoadedBuffer::UP loadFile(const std::string &fileName); }; class FileReaderBase diff --git a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp index a8074f227745..78eec2c6d2ff 100644 --- a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp +++ b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp @@ -3,6 +3,7 @@ #include "foldedstringcompare.h" #include #include +#include using vespalib::LowerCase; using vespalib::Utf8ReaderForZTS; diff --git a/searchlib/src/vespa/searchlib/util/linguisticsannotation.cpp b/searchlib/src/vespa/searchlib/util/linguisticsannotation.cpp index c8aef561319d..770a1568fdc0 100644 --- a/searchlib/src/vespa/searchlib/util/linguisticsannotation.cpp +++ b/searchlib/src/vespa/searchlib/util/linguisticsannotation.cpp @@ -4,6 +4,6 @@ namespace search::linguistics { -const vespalib::string SPANTREE_NAME("linguistics"); +const std::string SPANTREE_NAME("linguistics"); } diff --git a/searchlib/src/vespa/searchlib/util/linguisticsannotation.h b/searchlib/src/vespa/searchlib/util/linguisticsannotation.h index 83a19bed986c..7bd7c7876044 100644 --- a/searchlib/src/vespa/searchlib/util/linguisticsannotation.h +++ b/searchlib/src/vespa/searchlib/util/linguisticsannotation.h @@ -2,10 +2,10 @@ #pragma once -#include +#include namespace search::linguistics { -extern const vespalib::string SPANTREE_NAME; +extern const std::string SPANTREE_NAME; } diff --git a/searchlib/src/vespa/searchlib/util/logutil.cpp b/searchlib/src/vespa/searchlib/util/logutil.cpp index 18381cda786f..5291af165f6e 100644 --- a/searchlib/src/vespa/searchlib/util/logutil.cpp +++ b/searchlib/src/vespa/searchlib/util/logutil.cpp @@ -8,13 +8,13 @@ using vespalib::JSONStringer; namespace search::util { -vespalib::string -LogUtil::extractLastElements(const vespalib::string & path, size_t numElems) +std::string +LogUtil::extractLastElements(const std::string & path, size_t numElems) { - std::vector elems; + std::vector elems; for (size_t pos = 0; pos < path.size(); ) { size_t fpos = path.find('/', pos); - if (fpos == vespalib::string::npos) { + if (fpos == std::string::npos) { fpos = path.size(); } size_t len = fpos - pos; @@ -23,7 +23,7 @@ LogUtil::extractLastElements(const vespalib::string & path, size_t numElems) } pos = fpos + 1; } - vespalib::string retval; + std::string retval; if (numElems >= elems.size() && path[0] == '/') { retval.append("/"); } @@ -37,7 +37,7 @@ LogUtil::extractLastElements(const vespalib::string & path, size_t numElems) } void -LogUtil::logDir(JSONStringer & jstr, const vespalib::string & path, size_t numElems) +LogUtil::logDir(JSONStringer & jstr, const std::string & path, size_t numElems) { jstr.beginObject(); jstr.appendKey("dir").appendString(LogUtil::extractLastElements(path, numElems)); diff --git a/searchlib/src/vespa/searchlib/util/logutil.h b/searchlib/src/vespa/searchlib/util/logutil.h index f6d525e6167f..69049243141d 100644 --- a/searchlib/src/vespa/searchlib/util/logutil.h +++ b/searchlib/src/vespa/searchlib/util/logutil.h @@ -11,7 +11,7 @@ class LogUtil { * Extract the last num elements from the given path and * return a new path with these elements. **/ - static vespalib::string extractLastElements(const vespalib::string & path, size_t numElems); + static std::string extractLastElements(const std::string & path, size_t numElems); /** * Log the given directory (with size) to the given json stringer. @@ -20,7 +20,7 @@ class LogUtil { * @param path the path of the directory to log. * @param numElems the last number of elements from the path to log. **/ - static void logDir(vespalib::JSONStringer & jstr, const vespalib::string & path, size_t numElems); + static void logDir(vespalib::JSONStringer & jstr, const std::string & path, size_t numElems); }; } diff --git a/searchlib/src/vespa/searchlib/util/randomgenerator.h b/searchlib/src/vespa/searchlib/util/randomgenerator.h index 66c739deef6d..e56acbf91a46 100644 --- a/searchlib/src/vespa/searchlib/util/randomgenerator.h +++ b/searchlib/src/vespa/searchlib/util/randomgenerator.h @@ -3,9 +3,9 @@ #pragma once #include -#include -#include #include +#include +#include namespace search { class RandomGenerator @@ -30,9 +30,9 @@ class RandomGenerator return (divider == 0 ? _rnd.lrand48() : min + _rnd.lrand48() % divider); } - vespalib::string getRandomString(uint32_t minLen, uint32_t maxLen) { + std::string getRandomString(uint32_t minLen, uint32_t maxLen) { uint32_t len = rand(minLen, maxLen); - vespalib::string retval; + std::string retval; for (uint32_t i = 0; i < len; ++i) { char c = static_cast(rand('a', 'z')); retval.push_back(c); @@ -40,7 +40,7 @@ class RandomGenerator return retval; } - void fillRandomStrings(std::vector & vec, uint32_t numStrings, + void fillRandomStrings(std::vector & vec, uint32_t numStrings, uint32_t minLen, uint32_t maxLen) { vec.clear(); vec.reserve(numStrings); diff --git a/searchlib/src/vespa/searchlib/util/token_extractor.cpp b/searchlib/src/vespa/searchlib/util/token_extractor.cpp index 354bdeadc795..7e0f729cc4ac 100644 --- a/searchlib/src/vespa/searchlib/util/token_extractor.cpp +++ b/searchlib/src/vespa/searchlib/util/token_extractor.cpp @@ -96,7 +96,7 @@ constexpr size_t max_fmt_len = 100; // Max length of word in logs } -TokenExtractor::TokenExtractor(const vespalib::string& field_name, size_t max_word_len) +TokenExtractor::TokenExtractor(const std::string& field_name, size_t max_word_len) : _field_name(field_name), _max_word_len(max_word_len) { diff --git a/searchlib/src/vespa/searchlib/util/token_extractor.h b/searchlib/src/vespa/searchlib/util/token_extractor.h index cdb6b727c84f..4be53d7305ef 100644 --- a/searchlib/src/vespa/searchlib/util/token_extractor.h +++ b/searchlib/src/vespa/searchlib/util/token_extractor.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace document { @@ -21,7 +21,7 @@ namespace search::linguistics { * Class used to extract tokens from annotated string field value. */ class TokenExtractor { - const vespalib::string& _field_name; + const std::string& _field_name; size_t _max_word_len; public: @@ -54,7 +54,7 @@ class TokenExtractor { void consider_word(std::vector& terms, std::string_view text, const document::Span& span, const document::FieldValue* fv, const document::Document* doc) const; public: - TokenExtractor(const vespalib::string& field_name, size_t max_word_len); + TokenExtractor(const std::string& field_name, size_t max_word_len); ~TokenExtractor(); void extract(std::vector& terms, const document::StringFieldValue::SpanTrees& trees, std::string_view text, const document::Document* doc) const; std::string_view sanitize_word(std::string_view word, const document::Document* doc) const; diff --git a/searchsummary/src/tests/docsummary/annotation_converter/annotation_converter_test.cpp b/searchsummary/src/tests/docsummary/annotation_converter/annotation_converter_test.cpp index a43e8c507a2f..b3e71211e93f 100644 --- a/searchsummary/src/tests/docsummary/annotation_converter/annotation_converter_test.cpp +++ b/searchsummary/src/tests/docsummary/annotation_converter/annotation_converter_test.cpp @@ -45,12 +45,12 @@ get_document_types_config() class MockJuniperConverter : public IJuniperConverter { - vespalib::string _result; + std::string _result; public: void convert(std::string_view input, vespalib::slime::Inserter&) override { _result = input; } - const vespalib::string& get_result() const noexcept { return _result; } + const std::string& get_result() const noexcept { return _result; } }; } @@ -67,9 +67,9 @@ class AnnotationConverterTest : public testing::Test void set_span_tree(StringFieldValue& value, std::unique_ptr tree); StringFieldValue make_annotated_string(); StringFieldValue make_annotated_chinese_string(); - vespalib::string make_exp_il_annotated_string(); - vespalib::string make_exp_il_annotated_chinese_string(); - void expect_annotated(const vespalib::string& exp, const StringFieldValue& fv); + std::string make_exp_il_annotated_string(); + std::string make_exp_il_annotated_chinese_string(); + void expect_annotated(const std::string& exp, const StringFieldValue& fv); }; AnnotationConverterTest::AnnotationConverterTest() @@ -118,7 +118,7 @@ AnnotationConverterTest::make_annotated_chinese_string() return value; } -vespalib::string +std::string AnnotationConverterTest::make_exp_il_annotated_string() { using namespace juniper::separators; @@ -130,7 +130,7 @@ AnnotationConverterTest::make_exp_il_annotated_string() return exp.str(); } -vespalib::string +std::string AnnotationConverterTest::make_exp_il_annotated_chinese_string() { using namespace juniper::separators; @@ -141,7 +141,7 @@ AnnotationConverterTest::make_exp_il_annotated_chinese_string() } void -AnnotationConverterTest::expect_annotated(const vespalib::string& exp, const StringFieldValue& fv) +AnnotationConverterTest::expect_annotated(const std::string& exp, const StringFieldValue& fv) { MockJuniperConverter juniper_converter; AnnotationConverter annotation_converter(juniper_converter); @@ -155,7 +155,7 @@ AnnotationConverterTest::expect_annotated(const vespalib::string& exp, const Str TEST_F(AnnotationConverterTest, convert_plain_string) { using namespace juniper::separators; - vespalib::string exp("Foo Bar Baz"); + std::string exp("Foo Bar Baz"); StringFieldValue plain_string("Foo Bar Baz"); expect_annotated(exp + unit_separator_string, plain_string); } diff --git a/searchsummary/src/tests/docsummary/attribute_combiner/attribute_combiner_test.cpp b/searchsummary/src/tests/docsummary/attribute_combiner/attribute_combiner_test.cpp index ebb11e20f899..004ffb518289 100644 --- a/searchsummary/src/tests/docsummary/attribute_combiner/attribute_combiner_test.cpp +++ b/searchsummary/src/tests/docsummary/attribute_combiner/attribute_combiner_test.cpp @@ -39,8 +39,8 @@ struct AttributeCombinerTest : public ::testing::Test AttributeCombinerTest(); ~AttributeCombinerTest() override; - void set_field(const vespalib::string &field_name, bool filter_elements); - void assertWritten(const vespalib::string &exp, uint32_t docId); + void set_field(const std::string &field_name, bool filter_elements); + void assertWritten(const std::string &exp, uint32_t docId); }; AttributeCombinerTest::AttributeCombinerTest() @@ -76,7 +76,7 @@ AttributeCombinerTest::AttributeCombinerTest() AttributeCombinerTest::~AttributeCombinerTest() = default; void -AttributeCombinerTest::set_field(const vespalib::string &field_name, bool filter_elements) +AttributeCombinerTest::set_field(const std::string &field_name, bool filter_elements) { if (filter_elements) { _matching_elems_fields = std::make_shared(); @@ -87,7 +87,7 @@ AttributeCombinerTest::set_field(const vespalib::string &field_name, bool filter } void -AttributeCombinerTest::assertWritten(const vespalib::string &exp_slime_as_json, uint32_t docId) +AttributeCombinerTest::assertWritten(const std::string &exp_slime_as_json, uint32_t docId) { vespalib::Slime act; vespalib::slime::SlimeInserter inserter(act); diff --git a/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp b/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp index e360c3005b83..3f984af36f4f 100644 --- a/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp +++ b/searchsummary/src/tests/docsummary/attribute_tokens_dfw/attribute_tokens_dfw_test.cpp @@ -24,7 +24,7 @@ class AttributeTokensDFWTest : public ::testing::Test { MockStateCallback _callback; GetDocsumsState _state; std::shared_ptr _matching_elems_fields; - vespalib::string _field_name; + std::string _field_name; public: AttributeTokensDFWTest() @@ -43,7 +43,7 @@ class AttributeTokensDFWTest : public ::testing::Test { } ~AttributeTokensDFWTest() {} - void setup(const vespalib::string& field_name) { + void setup(const std::string& field_name) { _writer = std::make_unique(field_name); _writer->setIndex(0); auto attr = _state._attrCtx->getAttribute(field_name); @@ -54,7 +54,7 @@ class AttributeTokensDFWTest : public ::testing::Test { _state._attributes[0] = attr; } - void expect_field(const vespalib::string& exp_slime_as_json, uint32_t docid) { + void expect_field(const std::string& exp_slime_as_json, uint32_t docid) { vespalib::Slime act; vespalib::slime::SlimeInserter inserter(act); if (!_writer->isDefaultValue(docid, _state)) { diff --git a/searchsummary/src/tests/docsummary/attributedfw/attributedfw_test.cpp b/searchsummary/src/tests/docsummary/attributedfw/attributedfw_test.cpp index 8d6cd6a34bb6..ea4a0cdade6b 100644 --- a/searchsummary/src/tests/docsummary/attributedfw/attributedfw_test.cpp +++ b/searchsummary/src/tests/docsummary/attributedfw/attributedfw_test.cpp @@ -34,7 +34,7 @@ class AttributeDFWTest : public ::testing::Test { MockStateCallback _callback; GetDocsumsState _state; std::shared_ptr _matching_elems_fields; - vespalib::string _field_name; + std::string _field_name; public: AttributeDFWTest() @@ -58,7 +58,7 @@ class AttributeDFWTest : public ::testing::Test { } ~AttributeDFWTest() {} - void setup(const vespalib::string& field_name, bool filter_elements) { + void setup(const std::string& field_name, bool filter_elements) { if (filter_elements) { _matching_elems_fields = std::make_shared(); } @@ -76,7 +76,7 @@ class AttributeDFWTest : public ::testing::Test { _state._attributes[0] = attr; } - void expect_field(const vespalib::string& exp_slime_as_json, uint32_t docid) { + void expect_field(const std::string& exp_slime_as_json, uint32_t docid) { vespalib::Slime act; vespalib::slime::SlimeInserter inserter(act); if (!_writer->isDefaultValue(docid, _state)) { diff --git a/searchsummary/src/tests/docsummary/document_id_dfw/document_id_dfw_test.cpp b/searchsummary/src/tests/docsummary/document_id_dfw/document_id_dfw_test.cpp index 99fd51975408..b393495ad57c 100644 --- a/searchsummary/src/tests/docsummary/document_id_dfw/document_id_dfw_test.cpp +++ b/searchsummary/src/tests/docsummary/document_id_dfw/document_id_dfw_test.cpp @@ -39,9 +39,9 @@ using vespalib::slime::SlimeInserter; namespace { const int32_t doc_type_id = 787121340; -const vespalib::string doc_type_name = "test"; -const vespalib::string header_name = doc_type_name + ".header"; -const vespalib::string body_name = doc_type_name + ".body"; +const std::string doc_type_name = "test"; +const std::string header_name = doc_type_name + ".header"; +const std::string body_name = doc_type_name + ".body"; std::unique_ptr @@ -61,7 +61,7 @@ struct MyGetDocsumsStateCallback : GetDocsumsStateCallback { class DocumentIdDFWTest : public ::testing::Test { - vespalib::string _field_name; + std::string _field_name; vespalib::Memory _field_name_view; std::unique_ptr _result_config; std::unique_ptr _repo; @@ -71,7 +71,7 @@ class DocumentIdDFWTest : public ::testing::Test DocumentIdDFWTest(); ~DocumentIdDFWTest() override; - std::unique_ptr make_docsum_store_document(const vespalib::string &id); + std::unique_ptr make_docsum_store_document(const std::string &id); vespalib::Slime write(const IDocsumStoreDocument* doc); vespalib::Memory get_field_name_view() const noexcept { return _field_name_view; } }; @@ -93,7 +93,7 @@ DocumentIdDFWTest::~DocumentIdDFWTest() = default; std::unique_ptr -DocumentIdDFWTest::make_docsum_store_document(const vespalib::string& id) +DocumentIdDFWTest::make_docsum_store_document(const std::string& id) { auto doc = std::make_unique(*_repo, *_document_type, DocumentId(id)); return std::make_unique(std::move(doc)); @@ -115,7 +115,7 @@ DocumentIdDFWTest::write(const IDocsumStoreDocument* doc) TEST_F(DocumentIdDFWTest, insert_document_id) { - vespalib::string id("id::test::0"); + std::string id("id::test::0"); auto doc = make_docsum_store_document(id); auto slime = write(doc.get()); EXPECT_TRUE(slime.get()[get_field_name_view()].valid()); diff --git a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp index 3333ccfd44b2..4d9f5fc34335 100644 --- a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp +++ b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp @@ -21,7 +21,7 @@ using search::SingleInt64ExtAttribute; using search::attribute::IAttributeContext; using search::attribute::IAttributeVector; using search::attribute::IAttributeFunctor; -using vespalib::string; +using std::string; using std::vector; namespace search::docsummary { @@ -84,7 +84,7 @@ struct MyGetDocsumsStateCallback : GetDocsumsStateCallback { template void checkWritePositionField(AttrType &attr, - uint32_t doc_id, const vespalib::string &expect_json) { + uint32_t doc_id, const std::string &expect_json) { for (AttributeVector::DocId i = 0; i < doc_id + 1; ) { attr.addDoc(i); if (i == 007) { diff --git a/searchsummary/src/tests/docsummary/query_term_filter_factory/query_term_filter_factory_test.cpp b/searchsummary/src/tests/docsummary/query_term_filter_factory/query_term_filter_factory_test.cpp index 55c8bccef277..f54b006ae6f4 100644 --- a/searchsummary/src/tests/docsummary/query_term_filter_factory/query_term_filter_factory_test.cpp +++ b/searchsummary/src/tests/docsummary/query_term_filter_factory/query_term_filter_factory_test.cpp @@ -24,7 +24,7 @@ class QueryTermFilterFactoryTest : public testing::Test { _factory = std::make_unique(_schema); } - bool check_view(const vespalib::string& view, const vespalib::string& summary_field) { + bool check_view(const std::string& view, const std::string& summary_field) { if (!_factory) { make_factory(); } @@ -32,7 +32,7 @@ class QueryTermFilterFactoryTest : public testing::Test { return query_term_filter->use_view(view); } - void add_field_set(const vespalib::string& field_set_name, const std::vector& field_names) { + void add_field_set(const std::string& field_set_name, const std::vector& field_names) { FieldSet field_set(field_set_name); for (auto& field_name : field_names) { field_set.addField(field_name); diff --git a/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp b/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp index 895d4d0045f2..60e1cd214ac4 100644 --- a/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp +++ b/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp @@ -88,7 +88,7 @@ make_tensor(const TensorSpec &spec) return SimpleValue::from_spec(spec); } -vespalib::string +std::string slime_to_string(const Slime& slime) { SimpleBuffer buf; @@ -96,7 +96,7 @@ slime_to_string(const Slime& slime) return buf.get().make_string(); } -vespalib::string +std::string make_slime_data_string(std::string_view data) { Slime slime; @@ -105,7 +105,7 @@ make_slime_data_string(std::string_view data) return slime_to_string(slime); } -vespalib::string +std::string make_slime_tensor_string(const Value& value) { vespalib::nbostream s; @@ -147,7 +147,7 @@ get_document_types_config() class MockStringFieldConverter : public IStringFieldConverter { - std::vector _result; + std::vector _result; bool _render_wset_as_array; bool _insert; public: @@ -165,7 +165,7 @@ class MockStringFieldConverter : public IStringFieldConverter inserter.insertString(Memory(input.getValueRef())); } } - const std::vector& get_result() const noexcept { return _result; } + const std::vector& get_result() const noexcept { return _result; } bool render_weighted_set_as_array() const override { return _render_wset_as_array; } @@ -181,8 +181,8 @@ class SlimeFillerTest : public testing::Test SlimeFillerTest(); ~SlimeFillerTest() override; - const DataType& get_data_type(const vespalib::string& name) const; - const ReferenceDataType& get_as_ref_type(const vespalib::string& name) const; + const DataType& get_data_type(const std::string& name) const; + const ReferenceDataType& get_as_ref_type(const std::string& name) const; ArrayFieldValue make_array(); ArrayFieldValue make_empty_array(); WeightedSetFieldValue make_weighted_set(); @@ -190,17 +190,17 @@ class SlimeFillerTest : public testing::Test MapFieldValue make_map(); MapFieldValue make_empty_map(); StructFieldValue make_nested_value(int i); - void expect_insert(const vespalib::string& exp, const FieldValue& fv, const std::vector* matching_elems); - void expect_insert(const vespalib::string& exp, const FieldValue& fv); - void expect_insert_filtered(const vespalib::string& exp, const FieldValue& fv, const std::vector& matching_elems); - void expect_insert(const vespalib::string& exp, const FieldValue& fv, SlimeFillerFilter& filter); - void expect_insert_callback(const std::vector& exp, const FieldValue& fv); + void expect_insert(const std::string& exp, const FieldValue& fv, const std::vector* matching_elems); + void expect_insert(const std::string& exp, const FieldValue& fv); + void expect_insert_filtered(const std::string& exp, const FieldValue& fv, const std::vector& matching_elems); + void expect_insert(const std::string& exp, const FieldValue& fv, SlimeFillerFilter& filter); + void expect_insert_callback(const std::vector& exp, const FieldValue& fv); // Following 4 member functions tests static member functions in SlimeFiller - void expect_insert_summary_field(const vespalib::string& exp, const FieldValue& fv); - void expect_insert_summary_field_with_filter(const vespalib::string& exp, const FieldValue& fv, const std::vector& matching_elems); - void expect_insert_summary_field_with_field_filter(const vespalib::string& exp, const FieldValue& fv, const SlimeFillerFilter* filter); - void expect_insert_juniper_field(const std::vector& exp, const vespalib::string& exp_slime, const FieldValue& fv); - void expect_insert_summary_field_with_converter(const std::vector& exp, const vespalib::string& exp_slime, const FieldValue& fv, MockStringFieldConverter& converter); + void expect_insert_summary_field(const std::string& exp, const FieldValue& fv); + void expect_insert_summary_field_with_filter(const std::string& exp, const FieldValue& fv, const std::vector& matching_elems); + void expect_insert_summary_field_with_field_filter(const std::string& exp, const FieldValue& fv, const SlimeFillerFilter* filter); + void expect_insert_juniper_field(const std::vector& exp, const std::string& exp_slime, const FieldValue& fv); + void expect_insert_summary_field_with_converter(const std::vector& exp, const std::string& exp_slime, const FieldValue& fv, MockStringFieldConverter& converter); }; SlimeFillerTest::SlimeFillerTest() @@ -213,7 +213,7 @@ SlimeFillerTest::SlimeFillerTest() SlimeFillerTest::~SlimeFillerTest() = default; const DataType& -SlimeFillerTest::get_data_type(const vespalib::string& name) const +SlimeFillerTest::get_data_type(const std::string& name) const { const DataType *type = _repo->getDataType(*_document_type, name); assert(type != nullptr); @@ -221,7 +221,7 @@ SlimeFillerTest::get_data_type(const vespalib::string& name) const } const ReferenceDataType& -SlimeFillerTest::get_as_ref_type(const vespalib::string& name) const { +SlimeFillerTest::get_as_ref_type(const std::string& name) const { return dynamic_cast(get_data_type(name)); } @@ -292,7 +292,7 @@ SlimeFillerTest::make_nested_value(int i) } void -SlimeFillerTest::expect_insert(const vespalib::string& exp, const FieldValue& fv, const std::vector* matching_elems) +SlimeFillerTest::expect_insert(const std::string& exp, const FieldValue& fv, const std::vector* matching_elems) { Slime slime; SlimeInserter inserter(slime); @@ -303,19 +303,19 @@ SlimeFillerTest::expect_insert(const vespalib::string& exp, const FieldValue& fv } void -SlimeFillerTest::expect_insert_filtered(const vespalib::string& exp, const FieldValue& fv, const std::vector& matching_elems) +SlimeFillerTest::expect_insert_filtered(const std::string& exp, const FieldValue& fv, const std::vector& matching_elems) { expect_insert(exp, fv, &matching_elems); } void -SlimeFillerTest::expect_insert(const vespalib::string& exp, const FieldValue& fv) +SlimeFillerTest::expect_insert(const std::string& exp, const FieldValue& fv) { expect_insert(exp, fv, nullptr); } void -SlimeFillerTest::expect_insert(const vespalib::string& exp, const FieldValue& fv, SlimeFillerFilter& filter) +SlimeFillerTest::expect_insert(const std::string& exp, const FieldValue& fv, SlimeFillerFilter& filter) { Slime slime; SlimeInserter inserter(slime); @@ -326,7 +326,7 @@ SlimeFillerTest::expect_insert(const vespalib::string& exp, const FieldValue& fv } void -SlimeFillerTest::expect_insert_callback(const std::vector& exp, const FieldValue& fv) +SlimeFillerTest::expect_insert_callback(const std::vector& exp, const FieldValue& fv) { Slime slime; SlimeInserter inserter(slime); @@ -340,7 +340,7 @@ SlimeFillerTest::expect_insert_callback(const std::vector& exp } void -SlimeFillerTest::expect_insert_summary_field(const vespalib::string& exp, const FieldValue& fv) +SlimeFillerTest::expect_insert_summary_field(const std::string& exp, const FieldValue& fv) { Slime slime; SlimeInserter inserter(slime); @@ -350,7 +350,7 @@ SlimeFillerTest::expect_insert_summary_field(const vespalib::string& exp, const } void -SlimeFillerTest::expect_insert_summary_field_with_filter(const vespalib::string& exp, const FieldValue& fv, const std::vector& matching_elems) +SlimeFillerTest::expect_insert_summary_field_with_filter(const std::string& exp, const FieldValue& fv, const std::vector& matching_elems) { Slime slime; SlimeInserter inserter(slime); @@ -360,7 +360,7 @@ SlimeFillerTest::expect_insert_summary_field_with_filter(const vespalib::string& } void -SlimeFillerTest::expect_insert_summary_field_with_field_filter(const vespalib::string& exp, const FieldValue& fv, const SlimeFillerFilter* filter) +SlimeFillerTest::expect_insert_summary_field_with_field_filter(const std::string& exp, const FieldValue& fv, const SlimeFillerFilter* filter) { Slime slime; SlimeInserter inserter(slime); @@ -370,7 +370,7 @@ SlimeFillerTest::expect_insert_summary_field_with_field_filter(const vespalib::s } void -SlimeFillerTest::expect_insert_juniper_field(const std::vector& exp, const vespalib::string& exp_slime, const FieldValue& fv) +SlimeFillerTest::expect_insert_juniper_field(const std::vector& exp, const std::string& exp_slime, const FieldValue& fv) { Slime slime; SlimeInserter inserter(slime); @@ -383,7 +383,7 @@ SlimeFillerTest::expect_insert_juniper_field(const std::vector } void -SlimeFillerTest::expect_insert_summary_field_with_converter(const std::vector& exp, const vespalib::string& exp_slime, const FieldValue& fv, MockStringFieldConverter& converter) +SlimeFillerTest::expect_insert_summary_field_with_converter(const std::vector& exp, const std::string& exp_slime, const FieldValue& fv, MockStringFieldConverter& converter) { Slime slime; SlimeInserter inserter(slime); @@ -605,7 +605,7 @@ TEST_F(SlimeFillerTest, insert_struct_map) TEST_F(SlimeFillerTest, insert_string_with_callback) { - vespalib::string exp("Foo Bar Baz"); + std::string exp("Foo Bar Baz"); StringFieldValue plain_string(exp); expect_insert_callback({exp}, plain_string); } diff --git a/searchsummary/src/tests/docsummary/tokens_converter/tokens_converter_test.cpp b/searchsummary/src/tests/docsummary/tokens_converter/tokens_converter_test.cpp index 3d92cee601ad..38f275433791 100644 --- a/searchsummary/src/tests/docsummary/tokens_converter/tokens_converter_test.cpp +++ b/searchsummary/src/tests/docsummary/tokens_converter/tokens_converter_test.cpp @@ -34,7 +34,7 @@ using vespalib::slime::SlimeInserter; namespace { -vespalib::string +std::string slime_to_string(const Slime& slime) { SimpleBuffer buf; @@ -61,7 +61,7 @@ class TokensConverterTest : public testing::Test std::shared_ptr _repo; const DocumentType* _document_type; document::FixedTypeRepo _fixed_repo; - vespalib::string _dummy_field_name; + std::string _dummy_field_name; TokenExtractor _token_extractor; TokensConverterTest(); @@ -69,8 +69,8 @@ class TokensConverterTest : public testing::Test void set_span_tree(StringFieldValue& value, std::unique_ptr tree); StringFieldValue make_annotated_string(bool alt_tokens); StringFieldValue make_annotated_chinese_string(); - vespalib::string make_exp_annotated_chinese_string_tokens(); - vespalib::string convert(const StringFieldValue& fv); + std::string make_exp_annotated_chinese_string_tokens(); + std::string convert(const StringFieldValue& fv); }; TokensConverterTest::TokensConverterTest() @@ -124,13 +124,13 @@ TokensConverterTest::make_annotated_chinese_string() return value; } -vespalib::string +std::string TokensConverterTest::make_exp_annotated_chinese_string_tokens() { return R"(["我就是那个","大灰狼"])"; } -vespalib::string +std::string TokensConverterTest::convert(const StringFieldValue& fv) { TokensConverter converter(_token_extractor); @@ -142,28 +142,28 @@ TokensConverterTest::convert(const StringFieldValue& fv) TEST_F(TokensConverterTest, convert_empty_string) { - vespalib::string exp(R"([])"); + std::string exp(R"([])"); StringFieldValue plain_string(""); EXPECT_EQ(exp, convert(plain_string)); } TEST_F(TokensConverterTest, convert_plain_string) { - vespalib::string exp(R"([])"); + std::string exp(R"([])"); StringFieldValue plain_string("Foo Bar Baz"); EXPECT_EQ(exp, convert(plain_string)); } TEST_F(TokensConverterTest, convert_annotated_string) { - vespalib::string exp(R"(["foo","baz"])"); + std::string exp(R"(["foo","baz"])"); auto annotated_string = make_annotated_string(false); EXPECT_EQ(exp, convert(annotated_string)); } TEST_F(TokensConverterTest, convert_annotated_string_with_alternatives) { - vespalib::string exp(R"(["foo",["bar","baz"]])"); + std::string exp(R"(["foo",["bar","baz"]])"); auto annotated_string = make_annotated_string(true); EXPECT_EQ(exp, convert(annotated_string)); } diff --git a/searchsummary/src/tests/juniper/appender_test.cpp b/searchsummary/src/tests/juniper/appender_test.cpp index 17cd4a774722..d17db17833e1 100644 --- a/searchsummary/src/tests/juniper/appender_test.cpp +++ b/searchsummary/src/tests/juniper/appender_test.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include using namespace juniper; @@ -24,10 +24,10 @@ struct FixtureBase _appender(&_cfg) { } - void assertString(const vespalib::string &input, const vespalib::string &output) { + void assertString(const std::string &input, const std::string &output) { std::vector buf; _appender.append(buf, input.c_str(), input.size()); - EXPECT_EQUAL(output, vespalib::string(&buf[0], buf.size())); + EXPECT_EQUAL(output, std::string(&buf[0], buf.size())); } }; diff --git a/searchsummary/src/tests/juniper/auxTest.cpp b/searchsummary/src/tests/juniper/auxTest.cpp index a2ef4648c28c..68f4426e8867 100644 --- a/searchsummary/src/tests/juniper/auxTest.cpp +++ b/searchsummary/src/tests/juniper/auxTest.cpp @@ -829,7 +829,7 @@ AuxTest::TestSpecialTokenRegistry() void AuxTest::TestWhiteSpacePreserved() { - vespalib::string input = "\x1f" + std::string input = "\x1f" "best" "\x1f" " " @@ -858,8 +858,8 @@ AuxTest::TestWhiteSpacePreserved() _test(static_cast(res)); juniper::Summary* sum = juniper::GetTeaser(*res, nullptr); - vespalib::string expected = "best of \nmetallica"; - vespalib::string actual(sum->Text(), sum->Length()); + std::string expected = "best of \nmetallica"; + std::string actual(sum->Text(), sum->Length()); _test(actual == expected); } diff --git a/searchsummary/src/tests/juniper/latintokenizertest.h b/searchsummary/src/tests/juniper/latintokenizertest.h index acdfd71ac7bb..2bdba9af3493 100644 --- a/searchsummary/src/tests/juniper/latintokenizertest.h +++ b/searchsummary/src/tests/juniper/latintokenizertest.h @@ -126,7 +126,7 @@ class LatinTokenizerTest : public Test token = lt->GetNextToken(); char temp = *token.second; *token.second = '\0'; - vespalib::string word = vespalib::make_string("%s", token.first); + std::string word = vespalib::make_string("%s", token.first); *token.second = temp; PushDesc(vespalib::make_string("%s%s == %s", "word: ", word.c_str(), correct).c_str()); diff --git a/searchsummary/src/tests/juniper/queryvisitor_test.cpp b/searchsummary/src/tests/juniper/queryvisitor_test.cpp index 402cc80d8f43..96adc14f628b 100644 --- a/searchsummary/src/tests/juniper/queryvisitor_test.cpp +++ b/searchsummary/src/tests/juniper/queryvisitor_test.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include using namespace juniper; @@ -24,10 +24,10 @@ struct MyQueryItem : public QueryItem class MyQuery : public juniper::IQuery { private: - vespalib::string _term; + std::string _term; public: - explicit MyQuery(const vespalib::string &term) : _term(term) {} + explicit MyQuery(const std::string &term) : _term(term) {} bool Traverse(IQueryVisitor* v) const override { MyQueryItem item; @@ -45,7 +45,7 @@ struct Fixture QueryModifier modifier; QueryHandle handle; QueryVisitor visitor; - explicit Fixture(const vespalib::string &term) + explicit Fixture(const std::string &term) : query(term), modifier(), handle(query, "", modifier), @@ -62,7 +62,7 @@ TEST_F("require that terms are picked up by the query visitor", Fixture("my_term EXPECT_EQUAL(1, node->_arity); QueryTerm *term = node->_children[0]->AsTerm(); ASSERT_TRUE(term != nullptr); - EXPECT_EQUAL("my_term", vespalib::string(term->term())); + EXPECT_EQUAL("my_term", std::string(term->term())); } TEST_F("require that empty terms are ignored by the query visitor", Fixture("")) diff --git a/searchsummary/src/tests/juniper/test.h b/searchsummary/src/tests/juniper/test.h index f0234beddd7a..3c27902ad54b 100644 --- a/searchsummary/src/tests/juniper/test.h +++ b/searchsummary/src/tests/juniper/test.h @@ -57,12 +57,12 @@ #pragma once -#include +#include #include +#include +#include #include #include -#include -#include // The following have underscores because they are macros // (and it's impolite to usurp other users' functions!). diff --git a/searchsummary/src/vespa/juniper/Matcher.cpp b/searchsummary/src/vespa/juniper/Matcher.cpp index 5978dce9fc80..bf94800bbee5 100644 --- a/searchsummary/src/vespa/juniper/Matcher.cpp +++ b/searchsummary/src/vespa/juniper/Matcher.cpp @@ -7,10 +7,10 @@ #include "result.h" #include "juniperparams.h" #include "config.h" -#include #include -#include #include +#include +#include #include LOG_SETUP(".juniper.matcher"); diff --git a/searchsummary/src/vespa/juniper/Matcher.h b/searchsummary/src/vespa/juniper/Matcher.h index 3ff4f36e2d6f..04067b839cab 100644 --- a/searchsummary/src/vespa/juniper/Matcher.h +++ b/searchsummary/src/vespa/juniper/Matcher.h @@ -14,14 +14,14 @@ #define TokenDispatcher DocScanner #endif -#include -#include -#include -#include #include "ITokenProcessor.h" #include "querynode.h" #include "matchobject.h" #include "querymodifier.h" +#include +#include +#include +#include #ifdef __hpux__ // HP-UX does "magic" with max and min macros so algorithm must have been included diff --git a/searchsummary/src/vespa/juniper/SummaryConfig.cpp b/searchsummary/src/vespa/juniper/SummaryConfig.cpp index efd4dc1d1a81..8bd99e5f4c9c 100644 --- a/searchsummary/src/vespa/juniper/SummaryConfig.cpp +++ b/searchsummary/src/vespa/juniper/SummaryConfig.cpp @@ -2,8 +2,8 @@ #define _NEED_SUMMARY_CONFIG_IMPL 1 #include "SummaryConfig.h" -#include #include +#include SummaryConfig* CreateSummaryConfig(const char* highlight_on, const char* highlight_off, diff --git a/searchsummary/src/vespa/juniper/SummaryConfig.h b/searchsummary/src/vespa/juniper/SummaryConfig.h index 6e8c80f2962a..eb53c4f4ed03 100644 --- a/searchsummary/src/vespa/juniper/SummaryConfig.h +++ b/searchsummary/src/vespa/juniper/SummaryConfig.h @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // #pragma once + #include enum ConfigFlag { diff --git a/searchsummary/src/vespa/juniper/hashbase.h b/searchsummary/src/vespa/juniper/hashbase.h index 788b24e703e2..eac780a0ce58 100644 --- a/searchsummary/src/vespa/juniper/hashbase.h +++ b/searchsummary/src/vespa/juniper/hashbase.h @@ -3,6 +3,7 @@ #include #include +#include // Simple default order that everybody has - pointer order: template diff --git a/searchsummary/src/vespa/juniper/juniper_separators.cpp b/searchsummary/src/vespa/juniper/juniper_separators.cpp index 007fa0c5d2e3..b3dd0053d40a 100644 --- a/searchsummary/src/vespa/juniper/juniper_separators.cpp +++ b/searchsummary/src/vespa/juniper/juniper_separators.cpp @@ -4,11 +4,11 @@ namespace juniper::separators { -vespalib::string interlinear_annotation_anchor_string("\xef\xbf\xb9"); // U+FFF9 -vespalib::string interlinear_annotation_separator_string("\xef\xbf\xba"); // U+FFFA -vespalib::string interlinear_annotation_terminator_string("\xef\xbf\xbb"); // U+FFFB -vespalib::string group_separator_string("\x1d"); -vespalib::string record_separator_string("\x1e"); -vespalib::string unit_separator_string("\x1f"); +std::string interlinear_annotation_anchor_string("\xef\xbf\xb9"); // U+FFF9 +std::string interlinear_annotation_separator_string("\xef\xbf\xba"); // U+FFFA +std::string interlinear_annotation_terminator_string("\xef\xbf\xbb"); // U+FFFB +std::string group_separator_string("\x1d"); +std::string record_separator_string("\x1e"); +std::string unit_separator_string("\x1f"); } diff --git a/searchsummary/src/vespa/juniper/juniper_separators.h b/searchsummary/src/vespa/juniper/juniper_separators.h index 9d5ba8afcf6a..a6a733fe46f1 100644 --- a/searchsummary/src/vespa/juniper/juniper_separators.h +++ b/searchsummary/src/vespa/juniper/juniper_separators.h @@ -2,19 +2,19 @@ #pragma once -#include +#include namespace juniper::separators { // Separators used in strings passed to juniper. // UTF-8 encoded separarators -extern vespalib::string interlinear_annotation_anchor_string; -extern vespalib::string interlinear_annotation_separator_string; -extern vespalib::string interlinear_annotation_terminator_string; -extern vespalib::string group_separator_string; -extern vespalib::string record_separator_string; -extern vespalib::string unit_separator_string; +extern std::string interlinear_annotation_anchor_string; +extern std::string interlinear_annotation_separator_string; +extern std::string interlinear_annotation_terminator_string; +extern std::string group_separator_string; +extern std::string record_separator_string; +extern std::string unit_separator_string; // UTF-32 separators constexpr char32_t interlinear_annotation_anchor = U'\xfff9'; diff --git a/searchsummary/src/vespa/juniper/juniperdebug.h b/searchsummary/src/vespa/juniper/juniperdebug.h index 35bbba9fd6bf..9d8eeee5a134 100644 --- a/searchsummary/src/vespa/juniper/juniperdebug.h +++ b/searchsummary/src/vespa/juniper/juniperdebug.h @@ -2,8 +2,8 @@ #pragma once // Include something from STL so that _STLPORT_VERSION gets defined if appropriate -#include #include +#include /* Juniper debug macro */ diff --git a/searchsummary/src/vespa/juniper/juniperparams.h b/searchsummary/src/vespa/juniper/juniperparams.h index f4cc8c6a8dae..0ee510264b6e 100644 --- a/searchsummary/src/vespa/juniper/juniperparams.h +++ b/searchsummary/src/vespa/juniper/juniperparams.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include class SummaryConfig; diff --git a/searchsummary/src/vespa/juniper/matchelem.h b/searchsummary/src/vespa/juniper/matchelem.h index 743df79b0da7..2961266e8930 100644 --- a/searchsummary/src/vespa/juniper/matchelem.h +++ b/searchsummary/src/vespa/juniper/matchelem.h @@ -3,9 +3,9 @@ #pragma once -#include -#include #include "querynode.h" +#include +#include class Matcher; class key_occ; diff --git a/searchsummary/src/vespa/juniper/query.h b/searchsummary/src/vespa/juniper/query.h index 3003faad8adf..40e5cf628920 100644 --- a/searchsummary/src/vespa/juniper/query.h +++ b/searchsummary/src/vespa/juniper/query.h @@ -3,9 +3,9 @@ #pragma once #include -#include #include #include +#include #ifndef JUNIPER_RPIF #define JUNIPER_RPIF 1 diff --git a/searchsummary/src/vespa/juniper/query_item.h b/searchsummary/src/vespa/juniper/query_item.h index de8c70984f1c..a0174d5c978e 100644 --- a/searchsummary/src/vespa/juniper/query_item.h +++ b/searchsummary/src/vespa/juniper/query_item.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::parseitem { enum class ItemCreator; } diff --git a/searchsummary/src/vespa/juniper/querymodifier.h b/searchsummary/src/vespa/juniper/querymodifier.h index 812a0fa4b334..0ca76c6c246f 100644 --- a/searchsummary/src/vespa/juniper/querymodifier.h +++ b/searchsummary/src/vespa/juniper/querymodifier.h @@ -4,7 +4,6 @@ #include "simplemap.h" #include "query.h" #include "rewriter.h" -#include #include #include diff --git a/searchsummary/src/vespa/juniper/querynode.h b/searchsummary/src/vespa/juniper/querynode.h index a0f1756c41a9..de17b387bf7d 100644 --- a/searchsummary/src/vespa/juniper/querynode.h +++ b/searchsummary/src/vespa/juniper/querynode.h @@ -3,10 +3,10 @@ #pragma once -#include -#include #include #include "querymodifier.h" +#include +#include /** The internal query data structure used by the matching engine * in Matcher.h @@ -161,7 +161,7 @@ class QueryTerm : public QueryExpr juniper::Rewriter* rewriter; juniper::string_matcher* reduce_matcher; private: - vespalib::string _term; + std::string _term; ucs4_t* _ucs4_term; }; diff --git a/searchsummary/src/vespa/juniper/queryparser.cpp b/searchsummary/src/vespa/juniper/queryparser.cpp index 7f3d130a39c0..0119d83efad7 100644 --- a/searchsummary/src/vespa/juniper/queryparser.cpp +++ b/searchsummary/src/vespa/juniper/queryparser.cpp @@ -43,8 +43,8 @@ class QueryParserQueryItem : public QueryItem int get_weight() const override; ItemCreator get_creator() const override; - vespalib::string _name; - vespalib::string _index; + std::string _name; + std::string _index; std::vector> _child; bool _prefix; int _p1; diff --git a/searchsummary/src/vespa/juniper/stringmap.h b/searchsummary/src/vespa/juniper/stringmap.h index 36c3b6b8afcb..85b02f5823ee 100644 --- a/searchsummary/src/vespa/juniper/stringmap.h +++ b/searchsummary/src/vespa/juniper/stringmap.h @@ -10,7 +10,7 @@ class Fast_StringMap { private: - using Map = vespalib::hash_map; + using Map = vespalib::hash_map; Map _backing; public: void Insert(const char* key, const char* value); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/annotation_converter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/annotation_converter.cpp index 79e355256402..127da0ebe954 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/annotation_converter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/annotation_converter.cpp @@ -30,7 +30,7 @@ getSpanString(std::string_view s, const Span &span) return {s.data() + span.from(), static_cast(span.length())}; } -vespalib::string dummy_field_name; +std::string dummy_field_name; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp index 7e383d372a31..a13ba72675b3 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.cpp @@ -26,15 +26,15 @@ class ArrayAttributeFieldWriterState : public DocsumFieldWriterState { // AttributeFieldWriter instances are owned by stash passed to constructor std::vector _writers; - const vespalib::string& _field_name; + const std::string& _field_name; const MatchingElements* const _matching_elements; public: - ArrayAttributeFieldWriterState(const std::vector &fieldNames, - const std::vector &attributeNames, + ArrayAttributeFieldWriterState(const std::vector &fieldNames, + const std::vector &attributeNames, IAttributeContext &context, vespalib::Stash& stash, - const vespalib::string &field_name, + const std::string &field_name, const MatchingElements* matching_elements, bool is_map_of_scalar); ~ArrayAttributeFieldWriterState() override; @@ -42,11 +42,11 @@ class ArrayAttributeFieldWriterState : public DocsumFieldWriterState void insertField(uint32_t docId, vespalib::slime::Inserter &target) override; }; -ArrayAttributeFieldWriterState::ArrayAttributeFieldWriterState(const std::vector &fieldNames, - const std::vector &attributeNames, +ArrayAttributeFieldWriterState::ArrayAttributeFieldWriterState(const std::vector &fieldNames, + const std::vector &attributeNames, IAttributeContext &context, vespalib::Stash& stash, - const vespalib::string &field_name, + const std::string &field_name, const MatchingElements *matching_elements, bool is_map_of_scalar) : DocsumFieldWriterState(), @@ -109,7 +109,7 @@ ArrayAttributeFieldWriterState::insertField(uint32_t docId, vespalib::slime::Ins } -ArrayAttributeCombinerDFW::ArrayAttributeCombinerDFW(const vespalib::string &fieldName, +ArrayAttributeCombinerDFW::ArrayAttributeCombinerDFW(const std::string &fieldName, const StructFieldsResolver& fields_resolver, bool filter_elements, std::shared_ptr matching_elems_fields) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h index f0af328bfe57..59074ae3b506 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/array_attribute_combiner_dfw.h @@ -19,13 +19,13 @@ class StructFieldsResolver; */ class ArrayAttributeCombinerDFW : public AttributeCombinerDFW { - std::vector _fields; - std::vector _attributeNames; + std::vector _fields; + std::vector _attributeNames; bool _is_map_of_scalar; DocsumFieldWriterState* allocFieldWriterState(search::attribute::IAttributeContext &context, vespalib::Stash &stash, const MatchingElements* matching_elements) const override; public: - ArrayAttributeCombinerDFW(const vespalib::string &fieldName, + ArrayAttributeCombinerDFW(const std::string &fieldName, const StructFieldsResolver& fields_resolver, bool filter_elements, std::shared_ptr matching_elems_fields); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.cpp index 443d064f4ee5..96d01427bbad 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.cpp @@ -16,7 +16,7 @@ using search::attribute::IAttributeContext; namespace search::docsummary { -AttributeCombinerDFW::AttributeCombinerDFW(const vespalib::string &fieldName, bool filter_elements, +AttributeCombinerDFW::AttributeCombinerDFW(const std::string &fieldName, bool filter_elements, std::shared_ptr matching_elems_fields) : SimpleDFW(), _stateIndex(0), @@ -36,7 +36,7 @@ AttributeCombinerDFW::setFieldWriterStateIndex(uint32_t fieldWriterStateIndex) } std::unique_ptr -AttributeCombinerDFW::create(const vespalib::string &fieldName, IAttributeContext &attrCtx, bool filter_elements, +AttributeCombinerDFW::create(const std::string &fieldName, IAttributeContext &attrCtx, bool filter_elements, std::shared_ptr matching_elems_fields) { StructFieldsResolver structFields(fieldName, attrCtx, true); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.h index 3cfadc3e2c58..9ab4b513716b 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/attribute_combiner_dfw.h @@ -27,9 +27,9 @@ class AttributeCombinerDFW : public SimpleDFW protected: uint32_t _stateIndex; const bool _filter_elements; - vespalib::string _fieldName; + std::string _fieldName; std::shared_ptr _matching_elems_fields; - AttributeCombinerDFW(const vespalib::string &fieldName, bool filter_elements, + AttributeCombinerDFW(const std::string &fieldName, bool filter_elements, std::shared_ptr matching_elems_fields); protected: virtual DocsumFieldWriterState* allocFieldWriterState(search::attribute::IAttributeContext &context, vespalib::Stash& stash, const MatchingElements* matching_elements) const = 0; @@ -37,7 +37,7 @@ class AttributeCombinerDFW : public SimpleDFW ~AttributeCombinerDFW() override; bool isGenerated() const override { return true; } bool setFieldWriterStateIndex(uint32_t fieldWriterStateIndex) override; - static std::unique_ptr create(const vespalib::string &fieldName, search::attribute::IAttributeContext &attrCtx, + static std::unique_ptr create(const std::string &fieldName, search::attribute::IAttributeContext &attrCtx, bool filter_elements, std::shared_ptr matching_elems_fields); void insertField(uint32_t docid, GetDocsumsState& state, vespalib::slime::Inserter &target) const override; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp index 87608786d32d..9b1e14683555 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.cpp @@ -36,7 +36,7 @@ make_read_view(const IAttributeVector& attribute, vespalib::Stash& stash) } void -insert_value(std::string_view value, Inserter& inserter, vespalib::string& scratch, bool lowercase) +insert_value(std::string_view value, Inserter& inserter, std::string& scratch, bool lowercase) { Cursor& arr = inserter.insertArray(1); ArrayInserter ai(arr); @@ -58,7 +58,7 @@ insert_value(std::string_view value, Inserter& inserter, vespalib::string& scrat class MultiAttributeTokensDFWState : public DocsumFieldWriterState { const IMultiValueReadView* _read_view; - vespalib::string _lowercase_scratch; + std::string _lowercase_scratch; bool _lowercase; public: MultiAttributeTokensDFWState(const IAttributeVector& attr, vespalib::Stash& stash); @@ -96,7 +96,7 @@ MultiAttributeTokensDFWState::insertField(uint32_t docid, Inserter& target) class SingleAttributeTokensDFWState : public DocsumFieldWriterState { const IAttributeVector& _attr; - vespalib::string _lowercase_scratch; + std::string _lowercase_scratch; bool _lowercase; public: SingleAttributeTokensDFWState(const IAttributeVector& attr); @@ -138,7 +138,7 @@ make_field_writer_state(const IAttributeVector& attr, vespalib::Stash& stash) return &stash.create(); } -AttributeTokensDFW::AttributeTokensDFW(const vespalib::string& input_field_name) +AttributeTokensDFW::AttributeTokensDFW(const std::string& input_field_name) : DocsumFieldWriter(), _input_field_name(input_field_name) { @@ -146,7 +146,7 @@ AttributeTokensDFW::AttributeTokensDFW(const vespalib::string& input_field_name) AttributeTokensDFW::~AttributeTokensDFW() = default; -const vespalib::string& +const std::string& AttributeTokensDFW::getAttributeName() const { return _input_field_name; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.h index 53bb3d732900..099fe388301a 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/attribute_tokens_dfw.h @@ -14,13 +14,13 @@ namespace search::docsummary { class AttributeTokensDFW : public DocsumFieldWriter { private: - vespalib::string _input_field_name; + std::string _input_field_name; uint32_t _state_index; // index into _fieldWriterStates in GetDocsumsState protected: - const vespalib::string & getAttributeName() const override; + const std::string & getAttributeName() const override; public: - AttributeTokensDFW(const vespalib::string& input_field_name); + AttributeTokensDFW(const std::string& input_field_name); ~AttributeTokensDFW() override; bool isGenerated() const override; bool setFieldWriterStateIndex(uint32_t fieldWriterStateIndex) override; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp index 0fc26387c00d..339bb93c11ca 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp @@ -35,7 +35,7 @@ using vespalib::slime::Symbol; namespace search::docsummary { -AttrDFW::AttrDFW(const vespalib::string & attrName) : +AttrDFW::AttrDFW(const std::string & attrName) : _attrName(attrName) { } @@ -51,7 +51,7 @@ namespace { class SingleAttrDFW : public AttrDFW { public: - explicit SingleAttrDFW(const vespalib::string & attrName) : + explicit SingleAttrDFW(const std::string & attrName) : AttrDFW(attrName) { } void insertField(uint32_t docid, GetDocsumsState& state, Inserter &target) const override; @@ -133,18 +133,18 @@ make_read_view(const IAttributeVector& attribute, vespalib::Stash& stash) template class MultiAttrDFWState : public DocsumFieldWriterState { - const vespalib::string& _field_name; + const std::string& _field_name; const IMultiValueReadView* _read_view; const MatchingElements* _matching_elements; public: - MultiAttrDFWState(const vespalib::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements); + MultiAttrDFWState(const std::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements); ~MultiAttrDFWState() override; void insertField(uint32_t docid, Inserter& target) override; }; template -MultiAttrDFWState::MultiAttrDFWState(const vespalib::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) +MultiAttrDFWState::MultiAttrDFWState(const std::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) : _field_name(field_name), _read_view(make_read_view(attr, stash)), _matching_elements(matching_elements) @@ -240,7 +240,7 @@ class MultiAttrDFW : public AttrDFW { std::shared_ptr _matching_elems_fields; public: - MultiAttrDFW(const vespalib::string& attr_name, bool filter_elements, std::shared_ptr matching_elems_fields) + MultiAttrDFW(const std::string& attr_name, bool filter_elements, std::shared_ptr matching_elems_fields) : AttrDFW(attr_name), _filter_elements(filter_elements), _state_index(0), @@ -263,7 +263,7 @@ MultiAttrDFW::setFieldWriterStateIndex(uint32_t fieldWriterStateIndex) template DocsumFieldWriterState* -make_field_writer_state_helper(const vespalib::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) +make_field_writer_state_helper(const std::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) { bool is_weighted_set = attr.hasWeightedSetType(); if (is_weighted_set) { @@ -274,7 +274,7 @@ make_field_writer_state_helper(const vespalib::string& field_name, const IAttrib } DocsumFieldWriterState* -make_field_writer_state(const vespalib::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) +make_field_writer_state(const std::string& field_name, const IAttributeVector& attr, vespalib::Stash& stash, const MatchingElements* matching_elements) { auto type = attr.getBasicType(); switch (type) { @@ -337,7 +337,7 @@ create_multi_writer(const IAttributeVector& attr, bool filter_elements, std::sha std::unique_ptr AttributeDFWFactory::create(const IAttributeManager& attr_mgr, - const vespalib::string& attr_name, + const std::string& attr_name, bool filter_elements, std::shared_ptr matching_elems_fields) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h index 2d1eb71d248a..8c7613902e71 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h @@ -19,7 +19,7 @@ namespace search::docsummary { class AttributeDFWFactory { public: static std::unique_ptr create(const IAttributeManager& attr_mgr, - const vespalib::string& attr_name, + const std::string& attr_name, bool filter_elements = false, std::shared_ptr matching_elems_fields = std::shared_ptr()); }; @@ -27,12 +27,12 @@ class AttributeDFWFactory { class AttrDFW : public SimpleDFW { private: - vespalib::string _attrName; + std::string _attrName; protected: const attribute::IAttributeVector& get_attribute(const GetDocsumsState& s) const; - const vespalib::string & getAttributeName() const override { return _attrName; } + const std::string & getAttributeName() const override { return _attrName; } public: - explicit AttrDFW(const vespalib::string & attrName); + explicit AttrDFW(const std::string & attrName); bool isGenerated() const override { return true; } }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.cpp index 89b8c74a9d78..5259c1eede92 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.cpp @@ -9,7 +9,7 @@ LOG_SETUP(".searchlib.docsummary.copy_dfw"); namespace search::docsummary { -CopyDFW::CopyDFW(const vespalib::string& inputField) +CopyDFW::CopyDFW(const std::string& inputField) : _input_field_name(inputField) { } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.h index abcddc5a3096..be8e067f5292 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/copy_dfw.h @@ -14,10 +14,10 @@ class ResultConfig; class CopyDFW : public DocsumFieldWriter { private: - vespalib::string _input_field_name; + std::string _input_field_name; public: - explicit CopyDFW(const vespalib::string& inputField); + explicit CopyDFW(const std::string& inputField); ~CopyDFW() override; bool isGenerated() const override { return false; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.cpp index ffc0bcd3ec87..9cbf5ae7017e 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.cpp @@ -4,9 +4,9 @@ namespace search::docsummary { -const vespalib::string DocsumFieldWriter::_empty(""); +const std::string DocsumFieldWriter::_empty(""); -const vespalib::string& +const std::string& DocsumFieldWriter::getAttributeName() const { return _empty; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.h b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.h index 4aebcc71851b..646aa6385fe4 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace vespalib::slime { struct Inserter; } @@ -24,14 +25,14 @@ class DocsumFieldWriter virtual ~DocsumFieldWriter() = default; virtual bool isGenerated() const = 0; virtual void insertField(uint32_t docid, const IDocsumStoreDocument* doc, GetDocsumsState& state, vespalib::slime::Inserter &target) const = 0; - virtual const vespalib::string & getAttributeName() const; + virtual const std::string & getAttributeName() const; virtual bool isDefaultValue(uint32_t docid, const GetDocsumsState& state) const; void setIndex(size_t v) { _index = v; } size_t getIndex() const { return _index; } virtual bool setFieldWriterStateIndex(uint32_t fieldWriterStateIndex); private: size_t _index; - static const vespalib::string _empty; + static const std::string _empty; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.cpp index d3fc71b3173c..61ad9f8ce58a 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.cpp @@ -4,21 +4,21 @@ namespace search::docsummary::command { -const vespalib::string abs_distance("absdist"); -const vespalib::string attribute("attribute"); -const vespalib::string attribute_combiner("attributecombiner"); -const vespalib::string attribute_tokens("attribute-tokens"); -const vespalib::string copy("copy"); -const vespalib::string documentid("documentid"); -const vespalib::string dynamic_teaser("dynamicteaser"); -const vespalib::string empty("empty"); -const vespalib::string geo_position("geopos"); -const vespalib::string matched_attribute_elements_filter("matchedattributeelementsfilter"); -const vespalib::string matched_elements_filter("matchedelementsfilter"); -const vespalib::string positions("positions"); -const vespalib::string rank_features("rankfeatures"); -const vespalib::string summary_features("summaryfeatures"); -const vespalib::string tokens("tokens"); +const std::string abs_distance("absdist"); +const std::string attribute("attribute"); +const std::string attribute_combiner("attributecombiner"); +const std::string attribute_tokens("attribute-tokens"); +const std::string copy("copy"); +const std::string documentid("documentid"); +const std::string dynamic_teaser("dynamicteaser"); +const std::string empty("empty"); +const std::string geo_position("geopos"); +const std::string matched_attribute_elements_filter("matchedattributeelementsfilter"); +const std::string matched_elements_filter("matchedelementsfilter"); +const std::string positions("positions"); +const std::string rank_features("rankfeatures"); +const std::string summary_features("summaryfeatures"); +const std::string tokens("tokens"); } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.h b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.h index d77416f2df54..d6f842934add 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_commands.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::docsummary::command { @@ -10,20 +10,20 @@ namespace search::docsummary::command { * This contains all commands that map to specific docsum field writer(s) when setting up a summary result class. */ -extern const vespalib::string abs_distance; -extern const vespalib::string attribute; -extern const vespalib::string attribute_combiner; -extern const vespalib::string attribute_tokens; -extern const vespalib::string copy; -extern const vespalib::string documentid; -extern const vespalib::string dynamic_teaser; -extern const vespalib::string empty; -extern const vespalib::string geo_position; -extern const vespalib::string matched_attribute_elements_filter; -extern const vespalib::string matched_elements_filter; -extern const vespalib::string positions; -extern const vespalib::string rank_features; -extern const vespalib::string summary_features; -extern const vespalib::string tokens; +extern const std::string abs_distance; +extern const std::string attribute; +extern const std::string attribute_combiner; +extern const std::string attribute_tokens; +extern const std::string copy; +extern const std::string documentid; +extern const std::string dynamic_teaser; +extern const std::string empty; +extern const std::string geo_position; +extern const std::string matched_attribute_elements_filter; +extern const std::string matched_elements_filter; +extern const std::string positions; +extern const std::string rank_features; +extern const std::string summary_features; +extern const std::string tokens; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp index b11a0eb73cc1..b6ac1e16151b 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp @@ -43,7 +43,7 @@ namespace { void throw_if_nullptr(const std::unique_ptr& writer, - const vespalib::string& command) + const std::string& command) { if ( ! writer) { throw IllegalArgumentException("Failed to create docsum field writer for command '" + command + "'."); @@ -53,15 +53,15 @@ throw_if_nullptr(const std::unique_ptr& writer, } void -DocsumFieldWriterFactory::throw_missing_source(const vespalib::string& command) +DocsumFieldWriterFactory::throw_missing_source(const std::string& command) { throw IllegalArgumentException("Missing source for command '" + command + "'."); } std::unique_ptr -DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& field_name, - const vespalib::string& command, - const vespalib::string& source, +DocsumFieldWriterFactory::create_docsum_field_writer(const std::string& field_name, + const std::string& command, + const std::string& source, std::shared_ptr matching_elems_fields) { std::unique_ptr fieldWriter; @@ -127,12 +127,12 @@ DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& fie } else if (command == command::attribute_combiner) { if (has_attribute_manager()) { auto attr_ctx = getEnvironment().getAttributeManager()->createContext(); - const vespalib::string& source_field = source.empty() ? field_name : source; + const std::string& source_field = source.empty() ? field_name : source; fieldWriter = AttributeCombinerDFW::create(source_field, *attr_ctx, false, std::shared_ptr()); throw_if_nullptr(fieldWriter, command); } } else if (command == command::matched_attribute_elements_filter) { - const vespalib::string& source_field = source.empty() ? field_name : source; + const std::string& source_field = source.empty() ? field_name : source; if (has_attribute_manager()) { auto attr_ctx = getEnvironment().getAttributeManager()->createContext(); if (attr_ctx->getAttribute(source_field) != nullptr) { @@ -143,7 +143,7 @@ DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& fie throw_if_nullptr(fieldWriter, command); } } else if (command == command::matched_elements_filter) { - const vespalib::string& source_field = source.empty() ? field_name : source; + const std::string& source_field = source.empty() ? field_name : source; if (has_attribute_manager()) { auto attr_ctx = getEnvironment().getAttributeManager()->createContext(); fieldWriter = MatchedElementsFilterDFW::create(source_field,*attr_ctx, matching_elems_fields); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h index d98f689fa3fb..817c6f77e4dd 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h @@ -20,15 +20,15 @@ class DocsumFieldWriterFactory : public IDocsumFieldWriterFactory const IDocsumEnvironment& _env; const IQueryTermFilterFactory& _query_term_filter_factory; protected: - static void throw_missing_source(const vespalib::string& command); + static void throw_missing_source(const std::string& command); const IDocsumEnvironment& getEnvironment() const noexcept { return _env; } bool has_attribute_manager() const noexcept; public: DocsumFieldWriterFactory(bool use_v8_geo_positions, const IDocsumEnvironment& env, const IQueryTermFilterFactory& query_term_filter_factory); ~DocsumFieldWriterFactory() override; - std::unique_ptr create_docsum_field_writer(const vespalib::string& field_name, - const vespalib::string& command, - const vespalib::string& source, + std::unique_ptr create_docsum_field_writer(const std::string& field_name, + const std::string& command, + const std::string& source, std::shared_ptr matching_elems_fields) override; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.cpp index 63b71929d63b..6410e02f3ed8 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.cpp @@ -18,7 +18,7 @@ DocsumStoreDocument::DocsumStoreDocument(std::unique_ptr doc DocsumStoreDocument::~DocsumStoreDocument() = default; DocsumStoreFieldValue -DocsumStoreDocument::get_field_value(const vespalib::string& field_name) const +DocsumStoreDocument::get_field_value(const std::string& field_name) const { if (_document) { try { @@ -37,7 +37,7 @@ DocsumStoreDocument::get_field_value(const vespalib::string& field_name) const } void -DocsumStoreDocument::insert_summary_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const +DocsumStoreDocument::insert_summary_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const { auto field_value = get_field_value(field_name); if (field_value) { @@ -46,7 +46,7 @@ DocsumStoreDocument::insert_summary_field(const vespalib::string& field_name, ve } void -DocsumStoreDocument::insert_juniper_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const +DocsumStoreDocument::insert_juniper_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const { auto field_value = get_field_value(field_name); if (field_value) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.h b/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.h index 3d8ca8abcc13..ff782e991bf0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_store_document.h @@ -17,9 +17,9 @@ class DocsumStoreDocument : public IDocsumStoreDocument public: explicit DocsumStoreDocument(std::unique_ptr document); ~DocsumStoreDocument() override; - DocsumStoreFieldValue get_field_value(const vespalib::string& field_name) const override; - void insert_summary_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const override; - void insert_juniper_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const override; + DocsumStoreFieldValue get_field_value(const std::string& field_name) const override; + void insert_summary_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const override; + void insert_juniper_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const override; void insert_document_id(vespalib::slime::Inserter& inserter) const override; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp index 9bc4b9b278d8..2213619aeaa4 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp @@ -31,7 +31,7 @@ GetDocsumsState::DynTeaserState::~DynTeaserState() = default; std::unique_ptr& GetDocsumsState::DynTeaserState::get_query(std::string_view field) { - return _queries[vespalib::string(field)]; + return _queries[std::string(field)]; } GetDocsumsState::GetDocsumsState(GetDocsumsStateCallback &callback) @@ -86,8 +86,8 @@ GetDocsumsState::parse_locations() search::SimpleQueryStackDumpIterator iterator(stackdump); while (iterator.next()) { if (iterator.getType() == search::ParseItem::ITEM_GEO_LOCATION_TERM) { - vespalib::string view = iterator.index_as_string(); - vespalib::string term(iterator.getTerm()); + std::string view = iterator.index_as_string(); + std::string term(iterator.getTerm()); GeoLocationParser parser; if (parser.parseNoField(term)) { auto attr_name = PositionDataType::getZCurveFieldName(view); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.h b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.h index e386e847e597..ed205d9dabf8 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.h @@ -58,7 +58,7 @@ class GetDocsumsState GetDocsumsStateCallback &_callback; class DynTeaserState { - vespalib::hash_map> _queries; // juniper query representations + vespalib::hash_map> _queries; // juniper query representations public: DynTeaserState(); ~DynTeaserState(); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.cpp index 88ebe6497664..f62e9bdb4a70 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.cpp @@ -20,7 +20,7 @@ namespace search::docsummary { DynamicDocsumWriter::ResolveClassInfo DynamicDocsumWriter::resolveClassInfo(std::string_view class_name, - const vespalib::hash_set& fields) const + const vespalib::hash_set& fields) const { DynamicDocsumWriter::ResolveClassInfo result; auto id = _resultConfig->lookupResultClassId(class_name); @@ -28,7 +28,7 @@ DynamicDocsumWriter::resolveClassInfo(std::string_view class_name, const auto* res_class = (id != ResultConfig::noClassID()) ? _resultConfig->lookupResultClass(id) : nullptr; if (res_class == nullptr) { Issue::report("Illegal docsum class requested: %s, using empty docsum for documents", - vespalib::string(class_name).c_str()); + std::string(class_name).c_str()); } else { result.all_fields_generated = res_class->all_fields_generated(fields); } @@ -107,7 +107,7 @@ DynamicDocsumWriter::initState(const IAttributeManager & attrMan, GetDocsumsStat for (size_t i(0); i < num_entries; i++) { const DocsumFieldWriter *fw = result_class->getEntry(i)->writer(); if (fw) { - const vespalib::string & attributeName = fw->getAttributeName(); + const std::string & attributeName = fw->getAttributeName(); if (!attributeName.empty()) { state._attributes[i] = state._attrCtx->getAttribute(attributeName); } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.h b/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.h index d0625d29e55c..0f1d6288dc66 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumwriter.h @@ -7,7 +7,7 @@ #include "juniperproperties.h" #include "resultclass.h" #include "resultconfig.h" -#include +#include namespace search { class IAttributeManager; } @@ -38,7 +38,7 @@ class IDocsumWriter virtual void insertDocsum(const ResolveClassInfo & rci, uint32_t docid, GetDocsumsState& state, IDocsumStore &docinfos, Inserter & target) = 0; virtual ResolveClassInfo resolveClassInfo(std::string_view class_name, - const vespalib::hash_set& fields) const = 0; + const vespalib::hash_set& fields) const = 0; }; //-------------------------------------------------------------------------- @@ -61,7 +61,7 @@ class DynamicDocsumWriter : public IDocsumWriter IDocsumStore &docinfos, Inserter & inserter) override; ResolveClassInfo resolveClassInfo(std::string_view class_name, - const vespalib::hash_set& fields) const override; + const vespalib::hash_set& fields) const override; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.h index 511fbd407ca5..efb88d24abc7 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.h @@ -32,7 +32,7 @@ class DynamicTeaserDFW : public DocsumFieldWriter vespalib::slime::Inserter& inserter) const; private: const juniper::Juniper *_juniper; - vespalib::string _input_field_name; + std::string _input_field_name; std::unique_ptr _juniperConfig; std::shared_ptr _query_term_filter; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.cpp index 1a6b4ed69d86..54e65cfdd7ea 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.cpp @@ -21,7 +21,7 @@ using attribute::IAttributeVector; using attribute::IAttributeContext; using vespalib::Issue; -GeoPositionDFW::GeoPositionDFW(const vespalib::string & attrName, bool useV8geoPositions) : +GeoPositionDFW::GeoPositionDFW(const std::string & attrName, bool useV8geoPositions) : AttrDFW(attrName), _useV8geoPositions(useV8geoPositions) { } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.h index eeffdeacee2b..9f1ede17374e 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/geoposdfw.h @@ -15,7 +15,7 @@ class GeoPositionDFW : public AttrDFW bool _useV8geoPositions; public: using UP = std::unique_ptr; - GeoPositionDFW(const vespalib::string & attrName, bool useV8geoPositions); + GeoPositionDFW(const std::string & attrName, bool useV8geoPositions); void insertField(uint32_t docid, GetDocsumsState& state, vespalib::slime::Inserter &target) const override; static UP create(const char *attribute_name, const IAttributeManager *attribute_manager, bool useV8geoPositions); }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h index dcf0f656bc05..c3730d2f96b3 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h @@ -11,12 +11,12 @@ namespace search::docsummary { class GetDocsumArgs { private: - using FieldSet = vespalib::hash_set; - vespalib::string _resultClassName; + using FieldSet = vespalib::hash_set; + std::string _resultClassName; bool _dumpFeatures; bool _locations_possible; std::vector _stackDump; - vespalib::string _location; + std::string _location; vespalib::duration _timeout; fef::Properties _highlightTerms; FieldSet _fields; @@ -32,12 +32,12 @@ class GetDocsumArgs void setStackDump(uint32_t stackDumpLen, const char *stackDump); void locations_possible(bool value) { _locations_possible = value; } bool locations_possible() const { return _locations_possible; } - const vespalib::string &getLocation() const { return _location; } - void setLocation(const vespalib::string & location) { _location = location; } + const std::string &getLocation() const { return _location; } + void setLocation(const std::string & location) { _location = location; } void setTimeout(vespalib::duration timeout) { _timeout = timeout; } vespalib::duration getTimeout() const { return _timeout; } - const vespalib::string & getResultClassName() const { return _resultClassName; } + const std::string & getResultClassName() const { return _resultClassName; } std::string_view getStackDump() const { return {_stackDump.data(), _stackDump.size()}; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h b/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h index 98aea1f5dcf0..51b59860c40f 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace search { class MatchingElementsFields; } @@ -21,9 +21,9 @@ class IDocsumFieldWriterFactory /** * Implementations can throw vespalib::IllegalArgumentException if setup of field writer fails. */ - virtual std::unique_ptr create_docsum_field_writer(const vespalib::string& field_name, - const vespalib::string& command, - const vespalib::string& source, + virtual std::unique_ptr create_docsum_field_writer(const std::string& field_name, + const std::string& command, + const std::string& source, std::shared_ptr matching_elems_fields) = 0; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_store_document.h b/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_store_document.h index a229e98bb4b1..f4b3d48b86db 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_store_document.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_docsum_store_document.h @@ -3,7 +3,7 @@ #pragma once #include "docsum_store_field_value.h" -#include +#include namespace vespalib::slime { struct Inserter; } @@ -21,9 +21,9 @@ class IDocsumStoreDocument { public: virtual ~IDocsumStoreDocument() = default; - virtual DocsumStoreFieldValue get_field_value(const vespalib::string& field_name) const = 0; - virtual void insert_summary_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter = nullptr) const = 0; - virtual void insert_juniper_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const = 0; + virtual DocsumStoreFieldValue get_field_value(const std::string& field_name) const = 0; + virtual void insert_summary_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter = nullptr) const = 0; + virtual void insert_juniper_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const = 0; virtual void insert_document_id(vespalib::slime::Inserter& inserter) const = 0; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_juniper_converter.h b/searchsummary/src/vespa/searchsummary/docsummary/i_juniper_converter.h index eabec05aff3c..515b997c93e0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_juniper_converter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_juniper_converter.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace document { class StringFieldValue; } namespace vespalib::slime { struct Inserter; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter.h b/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter.h index 68333ece7a3c..b11ef4b42c1f 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::docsummary { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter_factory.h b/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter_factory.h index 74eea39f78d1..49dec1aeef71 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter_factory.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_query_term_filter_factory.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::docsummary { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/i_string_field_converter.h b/searchsummary/src/vespa/searchsummary/docsummary/i_string_field_converter.h index 805b5cf3508c..b3962e6a1fee 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/i_string_field_converter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/i_string_field_converter.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace document { class StringFieldValue; } namespace vespalib::slime { struct Inserter; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniper_dfw_explicit_item_data.h b/searchsummary/src/vespa/searchsummary/docsummary/juniper_dfw_explicit_item_data.h index c2acf1dcdd56..770eba93b635 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniper_dfw_explicit_item_data.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniper_dfw_explicit_item_data.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace search::docsummary { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniper_query_adapter.h b/searchsummary/src/vespa/searchsummary/docsummary/juniper_query_adapter.h index 5a752e7366fc..3947f57bfbf0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniper_query_adapter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniper_query_adapter.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace search { class SimpleQueryStackDumpIterator; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp index 45af63c8c2df..5c291a10f410 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp @@ -64,9 +64,9 @@ JuniperProperties::configure(const JuniperrcConfig &cfg) _properties["juniper.stem.max_extend"] = make_string("%d", cfg.stemMaxExtend); for (const auto & override : cfg.override) { - const vespalib::string keyDynsum = make_string("%s.dynsum.", override.fieldname.c_str()); - const vespalib::string keyMatcher = make_string("%s.matcher.", override.fieldname.c_str()); - const vespalib::string keyStem = make_string("%s.stem.", override.fieldname.c_str()); + const std::string keyDynsum = make_string("%s.dynsum.", override.fieldname.c_str()); + const std::string keyMatcher = make_string("%s.matcher.", override.fieldname.c_str()); + const std::string keyStem = make_string("%s.stem.", override.fieldname.c_str()); _properties[keyDynsum + "fallback"] = override.prefix ? "prefix" : "none"; _properties[keyDynsum + "length"] = make_string("%d", override.length); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h index b4e8a68c5fc0..e7b856d22125 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace vespa::config::search::summary::internal { class InternalJuniperrcType; @@ -12,7 +12,7 @@ namespace search::docsummary { class JuniperProperties : public IJuniperProperties { private: - std::map _properties; + std::map _properties; /** * Resets the property map to all default values. This is used for the empty constructor and also called before diff --git a/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.cpp index 5c6ea0942e44..948d220114a8 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.cpp @@ -64,7 +64,7 @@ LocationAttrDFW::getAllLocations(GetDocsumsState& state) const LocationAttrDFW::AllLocations::AllLocations() = default; LocationAttrDFW::AllLocations::~AllLocations() = default; -AbsDistanceDFW::AbsDistanceDFW(const vespalib::string & attrName) +AbsDistanceDFW::AbsDistanceDFW(const std::string & attrName) : LocationAttrDFW(attrName) { } @@ -107,7 +107,7 @@ AbsDistanceDFW::insertField(uint32_t docid, GetDocsumsState& state, vespalib::sl //-------------------------------------------------------------------------- -PositionsDFW::PositionsDFW(const vespalib::string & attrName, bool useV8geoPositions) : +PositionsDFW::PositionsDFW(const std::string & attrName, bool useV8geoPositions) : AttrDFW(attrName), _useV8geoPositions(useV8geoPositions) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.h index 9e4be09b0a14..941ca7d9a10a 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/positionsdfw.h @@ -13,7 +13,7 @@ class LocationAttrDFW : public AttrDFW public: using GeoLoc = search::common::GeoLocation; - explicit LocationAttrDFW(const vespalib::string & attrName) + explicit LocationAttrDFW(const std::string & attrName) : AttrDFW(attrName) {} @@ -40,7 +40,7 @@ class AbsDistanceDFW : public LocationAttrDFW uint64_t findMinDistance(uint32_t docid, GetDocsumsState& state, const std::vector &locations) const; public: - explicit AbsDistanceDFW(const vespalib::string & attrName); + explicit AbsDistanceDFW(const std::string & attrName); bool isGenerated() const override { return true; } void insertField(uint32_t docid, GetDocsumsState& state, @@ -58,7 +58,7 @@ class PositionsDFW : public AttrDFW bool _useV8geoPositions; public: using UP = std::unique_ptr; - PositionsDFW(const vespalib::string & attrName, bool useV8geoPositions); + PositionsDFW(const std::string & attrName, bool useV8geoPositions); bool isGenerated() const override { return true; } void insertField(uint32_t docid, GetDocsumsState& state, vespalib::slime::Inserter &target) const override; static UP create(const char *attribute_name, const IAttributeManager *index_man, bool useV8geoPositions); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter.h b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter.h index 5c6d5146ece5..4e55ed6bb383 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter.h @@ -13,7 +13,7 @@ namespace search::docsummary { */ class QueryTermFilter : public IQueryTermFilter { - using StringSet = vespalib::hash_set; + using StringSet = vespalib::hash_set; StringSet _views; public: QueryTermFilter(StringSet views); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.cpp b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.cpp index fb1c5c8dcfe9..bd78d5f171b7 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.cpp @@ -27,8 +27,8 @@ QueryTermFilterFactory::~QueryTermFilterFactory() = default; std::shared_ptr QueryTermFilterFactory::make(std::string_view input_field) const { - vespalib::hash_set views; - views.insert(vespalib::string(input_field)); + vespalib::hash_set views; + views.insert(std::string(input_field)); auto itr = _view_map.find(input_field); if (itr != _view_map.end()) { for (auto& index : itr->second) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.h b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.h index 3798f139d367..3d72377e514d 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/query_term_filter_factory.h @@ -16,7 +16,7 @@ namespace search::docsummary { */ class QueryTermFilterFactory : public IQueryTermFilterFactory { - vespalib::hash_map> _view_map; + vespalib::hash_map> _view_map; public: QueryTermFilterFactory(const search::index::Schema& schema); ~QueryTermFilterFactory() override; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.cpp b/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.cpp index 871385cf9b32..d3b0595002ec 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.cpp @@ -5,7 +5,7 @@ namespace search::docsummary { -ResConfigEntry::ResConfigEntry(const vespalib::string& name_in) noexcept +ResConfigEntry::ResConfigEntry(const std::string& name_in) noexcept : _name(name_in), _writer(), _generated(false) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.h b/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.h index d4f49a41c7cc..34f2784b4be0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/res_config_entry.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace search::docsummary { @@ -14,15 +14,15 @@ class DocsumFieldWriter; **/ class ResConfigEntry { private: - vespalib::string _name; + std::string _name; std::unique_ptr _writer; bool _generated; public: - ResConfigEntry(const vespalib::string& name_in) noexcept; + ResConfigEntry(const std::string& name_in) noexcept; ~ResConfigEntry(); ResConfigEntry(ResConfigEntry&&) noexcept; void set_writer(std::unique_ptr writer); - const vespalib::string& name() const { return _name; } + const std::string& name() const { return _name; } DocsumFieldWriter* writer() const { return _writer.get(); } bool is_generated() const { return _generated; } }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp index 5085806c54ce..c0926d5202e4 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp @@ -54,7 +54,7 @@ ResultClass::addConfigEntry(const char *name) } bool -ResultClass::all_fields_generated(const vespalib::hash_set& fields) const +ResultClass::all_fields_generated(const vespalib::hash_set& fields) const { if (_dynInfo._generateCnt == getNumEntries()) { return true; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h index 992c44f0ed2b..81d4d4fbecd0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h @@ -5,7 +5,7 @@ #include "res_config_entry.h" #include #include -#include +#include namespace search::docsummary { @@ -36,10 +36,10 @@ class ResultClass }; private: - using NameIdMap = vespalib::hash_map; + using NameIdMap = vespalib::hash_map; using Configs = std::vector; - vespalib::string _name; // name of this class + std::string _name; // name of this class Configs _entries; // config entries for this result class NameIdMap _nameMap; // fieldname -> entry index DynamicInfo _dynInfo; // fields overridden and generated @@ -118,7 +118,7 @@ class ResultClass * * If the given fields set is empty, check all fields defined in this result class. */ - bool all_fields_generated(const vespalib::hash_set& fields) const; + bool all_fields_generated(const vespalib::hash_set& fields) const; void set_omit_summary_features(bool value) { _omit_summary_features = value; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp index 067db1947f9e..a9f7fb937603 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp @@ -128,8 +128,8 @@ ResultConfig::readConfig(const SummaryConfig &cfg, const char *configId, IDocsum auto matching_elems_fields = std::make_shared(); for (const auto & field : cfg_class.fields) { const char *fieldname = field.name.c_str(); - vespalib::string command = field.command; - vespalib::string source_name = field.source; + std::string command = field.command; + std::string source_name = field.source; LOG(debug, "Reconfiguring class '%s' field '%s'", cfg_class.name.c_str(), fieldname); std::unique_ptr docsum_field_writer; if (!command.empty()) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h index 80fc46b118ad..6c68f02df3a3 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h @@ -29,7 +29,7 @@ class ResultClass; class ResultConfig { private: - using NameMap = vespalib::hash_map; + using NameMap = vespalib::hash_map; using IdMap = vespalib::hash_map>; uint32_t _defaultSummaryId; IdMap _classLookup; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp index 8ee9938b2603..19797dfec5a6 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler.cpp @@ -338,7 +338,7 @@ SlimeFiller::visit(const ReferenceFieldValue& value) { _inserter.insertString(Memory(value.hasValidDocumentId() ? value.getDocumentId().toString() - : vespalib::string())); + : std::string())); } void diff --git a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.cpp index b60e59e9b878..fe1c2ea0ddfb 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.cpp @@ -60,7 +60,7 @@ SlimeFillerFilter::add(std::string_view field_path) std::string_view field_name; std::string_view remaining_path; auto dot_pos = field_path.find('.'); - if (dot_pos != vespalib::string::npos) { + if (dot_pos != std::string::npos) { field_name = field_path.substr(0, dot_pos); remaining_path = field_path.substr(dot_pos + 1); } else { @@ -76,7 +76,7 @@ SlimeFillerFilter::add(std::string_view field_path) } } } else { - auto insres = _filter.insert(std::make_pair(vespalib::string(field_name), std::unique_ptr())); + auto insres = _filter.insert(std::make_pair(std::string(field_name), std::unique_ptr())); assert(insres.second); if (!remaining_path.empty()) { insres.first->second = std::make_unique(); @@ -91,7 +91,7 @@ SlimeFillerFilter::add_remaining(std::unique_ptr& filter, std { if (filter) { auto dot_pos = field_path.find('.'); - if (dot_pos != vespalib::string::npos) { + if (dot_pos != std::string::npos) { auto remaining_path = field_path.substr(dot_pos + 1); if (!remaining_path.empty()) { filter->add(remaining_path); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.h b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.h index 2d38e2fb4274..fcc20a5c39a0 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/slime_filler_filter.h @@ -2,9 +2,9 @@ #pragma once -#include #include #include +#include namespace search::docsummary { @@ -30,7 +30,7 @@ class SlimeFillerFilter { }; private: - vespalib::hash_map> _filter; + vespalib::hash_map> _filter; Iterator check_field(std::string_view field_name) const; public: diff --git a/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.cpp b/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.cpp index c5e0a098069e..9c28a489f448 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.cpp @@ -15,7 +15,7 @@ using vespalib::Issue; namespace search::docsummary { -StructFieldsResolver::StructFieldsResolver(const vespalib::string& field_name, const IAttributeContext& attr_ctx, +StructFieldsResolver::StructFieldsResolver(const std::string& field_name, const IAttributeContext& attr_ctx, bool require_all_struct_fields_as_attribute) : _field_name(field_name), _map_key_attribute(), @@ -29,12 +29,12 @@ StructFieldsResolver::StructFieldsResolver(const vespalib::string& field_name, c { std::vector attrs; attr_ctx.getAttributeList(attrs); - vespalib::string prefix = field_name + "."; + std::string prefix = field_name + "."; _map_key_attribute = prefix + "key"; - vespalib::string map_value_attribute_name = prefix + "value"; - vespalib::string value_prefix = prefix + "value."; + std::string map_value_attribute_name = prefix + "value"; + std::string value_prefix = prefix + "value."; for (const auto attr : attrs) { - vespalib::string name = attr->getName(); + std::string name = attr->getName(); if (name.substr(0, prefix.size()) != prefix) { continue; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.h b/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.h index e73f37604b67..cdbf38bdbefa 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/struct_fields_resolver.h @@ -2,7 +2,7 @@ #pragma once -#include +#include #include namespace search { @@ -18,9 +18,9 @@ namespace search::docsummary { */ class StructFieldsResolver { private: - using StringVector = std::vector; - vespalib::string _field_name; - vespalib::string _map_key_attribute; + using StringVector = std::vector; + std::string _field_name; + std::string _map_key_attribute; StringVector _map_value_fields; StringVector _map_value_attributes; StringVector _array_fields; @@ -30,7 +30,7 @@ class StructFieldsResolver { bool _error; public: - StructFieldsResolver(const vespalib::string& field_name, const search::attribute::IAttributeContext& attr_ctx, + StructFieldsResolver(const std::string& field_name, const search::attribute::IAttributeContext& attr_ctx, bool require_all_struct_fields_as_attributes); ~StructFieldsResolver(); bool is_map_of_scalar() const { return (_has_map_key && @@ -39,7 +39,7 @@ class StructFieldsResolver { _map_value_fields.empty()); } bool is_map_of_struct() const { return !_map_value_fields.empty(); } - const vespalib::string& get_map_key_attribute() const { return _map_key_attribute; } + const std::string& get_map_key_attribute() const { return _map_key_attribute; } const StringVector& get_map_value_fields() const { return _map_value_fields; } const StringVector& get_map_value_attributes() const { return _map_value_attributes; } const StringVector& get_array_fields() const { return _array_fields; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.cpp index c469d37d0058..5e8e6e8447b9 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.cpp @@ -31,28 +31,28 @@ class StructMapAttributeFieldWriterState : public DocsumFieldWriterState AttributeFieldWriter* _keyWriter; // AttributeFieldWriter instances are owned by stash passed to constructor std::vector _valueWriters; - const vespalib::string& _field_name; + const std::string& _field_name; const MatchingElements* const _matching_elements; public: - StructMapAttributeFieldWriterState(const vespalib::string &keyAttributeName, - const std::vector &valueFieldNames, - const std::vector &valueAttributeNames, + StructMapAttributeFieldWriterState(const std::string &keyAttributeName, + const std::vector &valueFieldNames, + const std::vector &valueAttributeNames, IAttributeContext &context, vespalib::Stash& stash, - const vespalib::string &field_name, + const std::string &field_name, const MatchingElements* matching_elements); ~StructMapAttributeFieldWriterState() override; void insert_element(uint32_t element_index, Cursor &array); void insertField(uint32_t docId, vespalib::slime::Inserter &target) override; }; -StructMapAttributeFieldWriterState::StructMapAttributeFieldWriterState(const vespalib::string &keyAttributeName, - const std::vector &valueFieldNames, - const std::vector &valueAttributeNames, +StructMapAttributeFieldWriterState::StructMapAttributeFieldWriterState(const std::string &keyAttributeName, + const std::vector &valueFieldNames, + const std::vector &valueAttributeNames, IAttributeContext &context, vespalib::Stash& stash, - const vespalib::string& field_name, + const std::string& field_name, const MatchingElements *matching_elements) : DocsumFieldWriterState(), _keyWriter(nullptr), @@ -126,7 +126,7 @@ StructMapAttributeFieldWriterState::insertField(uint32_t docId, vespalib::slime: } -StructMapAttributeCombinerDFW::StructMapAttributeCombinerDFW(const vespalib::string &fieldName, +StructMapAttributeCombinerDFW::StructMapAttributeCombinerDFW(const std::string &fieldName, const StructFieldsResolver& fields_resolver, bool filter_elements, std::shared_ptr matching_elems_fields) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.h index 8cb6079f94e0..902c1560e4c4 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/struct_map_attribute_combiner_dfw.h @@ -17,13 +17,13 @@ class StructFieldsResolver; */ class StructMapAttributeCombinerDFW : public AttributeCombinerDFW { - vespalib::string _keyAttributeName; - std::vector _valueFields; - std::vector _valueAttributeNames; + std::string _keyAttributeName; + std::vector _valueFields; + std::vector _valueAttributeNames; DocsumFieldWriterState* allocFieldWriterState(search::attribute::IAttributeContext &context, vespalib::Stash& stash, const MatchingElements* matching_elements) const override; public: - StructMapAttributeCombinerDFW(const vespalib::string &fieldName, + StructMapAttributeCombinerDFW(const std::string &fieldName, const StructFieldsResolver& fields_resolver, bool filter_elements, std::shared_ptr matching_elems_fields); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.cpp index 0741e5cc3520..280835839c4d 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.cpp @@ -9,7 +9,7 @@ using search::memoryindex::FieldInverter; namespace search::docsummary { -TokensDFW::TokensDFW(const vespalib::string& input_field_name) +TokensDFW::TokensDFW(const std::string& input_field_name) : DocsumFieldWriter(), _input_field_name(input_field_name), _token_extractor(_input_field_name, FieldInverter::max_word_len) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.h b/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.h index e9f91ab683ae..99e2d1174d6f 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/tokens_dfw.h @@ -15,11 +15,11 @@ namespace search::docsummary { class TokensDFW : public DocsumFieldWriter { private: - vespalib::string _input_field_name; + std::string _input_field_name; linguistics::TokenExtractor _token_extractor; public: - explicit TokensDFW(const vespalib::string& input_field_name); + explicit TokensDFW(const std::string& input_field_name); ~TokensDFW() override; bool isGenerated() const override; void insertField(uint32_t docid, const IDocsumStoreDocument* doc, GetDocsumsState& state, vespalib::slime::Inserter& target) const override; diff --git a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp index 4d73420b523b..5c23ff3129f5 100644 --- a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp +++ b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.cpp @@ -18,7 +18,7 @@ namespace search::docsummary::test { template void -MockAttributeManager::build_attribute(const vespalib::string& name, BasicType type, +MockAttributeManager::build_attribute(const std::string& name, BasicType type, CollectionType col_type, const std::vector>& values, std::optional uncased) @@ -57,16 +57,16 @@ MockAttributeManager::MockAttributeManager() MockAttributeManager::~MockAttributeManager() = default; void -MockAttributeManager::build_string_attribute(const vespalib::string& name, - const std::vector>& values, +MockAttributeManager::build_string_attribute(const std::string& name, + const std::vector>& values, CollectionType col_type, std::optional uncased) { - build_attribute(name, BasicType::Type::STRING, col_type, values, uncased); + build_attribute(name, BasicType::Type::STRING, col_type, values, uncased); } void -MockAttributeManager::build_float_attribute(const vespalib::string& name, +MockAttributeManager::build_float_attribute(const std::string& name, const std::vector>& values, CollectionType col_type) { @@ -74,7 +74,7 @@ MockAttributeManager::build_float_attribute(const vespalib::string& name, } void -MockAttributeManager::build_int_attribute(const vespalib::string& name, BasicType type, +MockAttributeManager::build_int_attribute(const std::string& name, BasicType type, const std::vector>& values, CollectionType col_type) { @@ -82,7 +82,7 @@ MockAttributeManager::build_int_attribute(const vespalib::string& name, BasicTyp } void -MockAttributeManager::build_raw_attribute(const vespalib::string& name, +MockAttributeManager::build_raw_attribute(const std::string& name, const std::vector>>& values) { build_attribute>(name, BasicType::Type::RAW, CollectionType::SINGLE, values, std::nullopt); diff --git a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.h b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.h index ae1050258262..132cbb83faac 100644 --- a/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.h +++ b/searchsummary/src/vespa/searchsummary/test/mock_attribute_manager.h @@ -14,7 +14,7 @@ class MockAttributeManager { AttributeManager _mgr; template - void build_attribute(const vespalib::string& name, search::attribute::BasicType type, + void build_attribute(const std::string& name, search::attribute::BasicType type, search::attribute::CollectionType col_type, const std::vector>& values, std::optional uncased); @@ -24,17 +24,17 @@ class MockAttributeManager { ~MockAttributeManager(); AttributeManager& mgr() { return _mgr; } - void build_string_attribute(const vespalib::string& name, - const std::vector>& values, + void build_string_attribute(const std::string& name, + const std::vector>& values, search::attribute::CollectionType col_type = search::attribute::CollectionType::ARRAY, std::optional uncased = std::nullopt); - void build_float_attribute(const vespalib::string& name, + void build_float_attribute(const std::string& name, const std::vector>& values, search::attribute::CollectionType col_type = search::attribute::CollectionType::ARRAY); - void build_int_attribute(const vespalib::string& name, search::attribute::BasicType type, + void build_int_attribute(const std::string& name, search::attribute::BasicType type, const std::vector>& values, search::attribute::CollectionType col_type = search::attribute::CollectionType::ARRAY); - void build_raw_attribute(const vespalib::string& name, + void build_raw_attribute(const std::string& name, const std::vector>>& values); }; diff --git a/searchsummary/src/vespa/searchsummary/test/mock_state_callback.h b/searchsummary/src/vespa/searchsummary/test/mock_state_callback.h index 6d21e6d02620..a958f5a51362 100644 --- a/searchsummary/src/vespa/searchsummary/test/mock_state_callback.h +++ b/searchsummary/src/vespa/searchsummary/test/mock_state_callback.h @@ -22,7 +22,7 @@ class MockStateCallback : public GetDocsumsStateCallback { return std::make_unique(_matching_elems); } - void add_matching_elements(uint32_t docid, const vespalib::string& field_name, + void add_matching_elements(uint32_t docid, const std::string& field_name, const std::vector& elements) { _matching_elems.add_matching_elements(docid, field_name, elements); } diff --git a/searchsummary/src/vespa/searchsummary/test/slime_value.h b/searchsummary/src/vespa/searchsummary/test/slime_value.h index b2105ba0e044..5507d89a7eb4 100644 --- a/searchsummary/src/vespa/searchsummary/test/slime_value.h +++ b/searchsummary/src/vespa/searchsummary/test/slime_value.h @@ -13,7 +13,7 @@ namespace search::docsummary::test { struct SlimeValue { vespalib::Slime slime; - SlimeValue(const vespalib::string& json_input) + SlimeValue(const std::string& json_input) : slime() { size_t used = vespalib::slime::JsonFormat::decode(json_input, slime); diff --git a/slobrok/src/apps/slobrok/slobrok.cpp b/slobrok/src/apps/slobrok/slobrok.cpp index 699d5128216e..8530d945d182 100644 --- a/slobrok/src/apps/slobrok/slobrok.cpp +++ b/slobrok/src/apps/slobrok/slobrok.cpp @@ -50,7 +50,7 @@ int App::main(int argc, char **argv) { uint32_t portnum = 2773; - vespalib::string cfgId; + std::string cfgId; int c; while ((c = getopt(argc, argv, "c:s:p:N")) != -1) { diff --git a/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp b/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp index 5fa441d8d8de..754b2f59df42 100644 --- a/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp +++ b/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp @@ -12,7 +12,7 @@ using namespace slobrok; using vespalib::make_string_short::fmt; struct MapCall { - vespalib::string name; + std::string name; ServiceMapping mapping; ServiceMapping old; static MapCall add(const ServiceMapping &m) { return {"add", m, {"",""}}; } @@ -28,7 +28,7 @@ struct MapCall { MapCall::~MapCall() = default; struct MonitorCall { - vespalib::string name; + std::string name; ServiceMapping mapping; bool hurry; static MonitorCall start(const ServiceMapping &m, bool h) { return {"start", m, h}; } diff --git a/slobrok/src/tests/rpc_mapping_monitor/rpc_mapping_monitor_test.cpp b/slobrok/src/tests/rpc_mapping_monitor/rpc_mapping_monitor_test.cpp index 5a61dd8263ae..45079110709f 100644 --- a/slobrok/src/tests/rpc_mapping_monitor/rpc_mapping_monitor_test.cpp +++ b/slobrok/src/tests/rpc_mapping_monitor/rpc_mapping_monitor_test.cpp @@ -16,7 +16,7 @@ using vespalib::make_string_short::fmt; // simple rpc server implementing the required slobrok call-back API struct Server : FRT_Invokable { fnet::frt::StandaloneFRT frt; - std::vector names; + std::vector names; size_t inject_fail_cnt; FNET_Connection *last_conn; void set_last_conn(FNET_Connection *conn) { @@ -40,7 +40,7 @@ struct Server : FRT_Invokable { REQUIRE(frt.supervisor().Listen(0)); } ~Server() { set_last_conn(nullptr); } - vespalib::string spec() const { return fmt("tcp/%d", frt.supervisor().GetListenPort()); } + std::string spec() const { return fmt("tcp/%d", frt.supervisor().GetListenPort()); } FNET_Transport &transport() { return *frt.supervisor().GetTransport(); } void rpc_listNamesServed(FRT_RPCRequest *req) { set_last_conn(req->GetConnection()); diff --git a/slobrok/src/tests/service_map_history/service_map_history_test.cpp b/slobrok/src/tests/service_map_history/service_map_history_test.cpp index eb8f0b916e80..07c23a309720 100644 --- a/slobrok/src/tests/service_map_history/service_map_history_test.cpp +++ b/slobrok/src/tests/service_map_history/service_map_history_test.cpp @@ -9,7 +9,7 @@ using namespace vespalib; using namespace slobrok; using vespalib::make_string_short::fmt; -using Map = std::map; +using Map = std::map; struct Dumper : ServiceMapHistory::DiffCompletionHandler { std::unique_ptr got = {}; @@ -36,7 +36,7 @@ Map dump(ServiceMapHistory &history) { } -vespalib::string lookup(ServiceMapHistory &history, const vespalib::string &name) { +std::string lookup(ServiceMapHistory &history, const std::string &name) { auto map = dump(history); auto iter = map.find(name); if (iter == map.end()) { diff --git a/slobrok/src/tests/service_map_mirror/service_map_mirror_test.cpp b/slobrok/src/tests/service_map_mirror/service_map_mirror_test.cpp index 06b7bbbdf1fa..df5df9ab48d4 100644 --- a/slobrok/src/tests/service_map_mirror/service_map_mirror_test.cpp +++ b/slobrok/src/tests/service_map_mirror/service_map_mirror_test.cpp @@ -10,7 +10,7 @@ using namespace vespalib; using namespace slobrok; using vespalib::make_string_short::fmt; -using Map = std::map; +using Map = std::map; Map dump(const ServiceMapMirror &mirror) { Map result; @@ -23,7 +23,7 @@ Map dump(const ServiceMapMirror &mirror) { void addTo(ServiceMapMirror &target, const ServiceMapping &mapping) { auto cur = target.currentGeneration(); - std::vector removes = {}; + std::vector removes = {}; ServiceMappingList updates = { mapping }; auto nxt = cur; nxt.add(); @@ -33,7 +33,7 @@ void addTo(ServiceMapMirror &target, const ServiceMapping &mapping) { void removeFrom(ServiceMapMirror &target, const ServiceMapping &mapping) { auto cur = target.currentGeneration(); - std::vector removes = { mapping.name }; + std::vector removes = { mapping.name }; ServiceMappingList updates = { }; auto nxt = cur; nxt.add(); @@ -94,7 +94,7 @@ TEST(ServiceMapMirrorTest, full_inspection) { EXPECT_EQ(map.size(), 1983ul); auto cur = mirror.currentGeneration(); - std::vector removes = { + std::vector removes = { "key/123/name", "key/1983/name", "key/234/name", diff --git a/slobrok/src/vespa/slobrok/imirrorapi.h b/slobrok/src/vespa/slobrok/imirrorapi.h index b20166aeb542..36d15d8db35f 100644 --- a/slobrok/src/vespa/slobrok/imirrorapi.h +++ b/slobrok/src/vespa/slobrok/imirrorapi.h @@ -1,7 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include +#include #include namespace slobrok::api { diff --git a/slobrok/src/vespa/slobrok/sbmirror.h b/slobrok/src/vespa/slobrok/sbmirror.h index 1ce4d979563c..57a7079c38fc 100644 --- a/slobrok/src/vespa/slobrok/sbmirror.h +++ b/slobrok/src/vespa/slobrok/sbmirror.h @@ -71,7 +71,7 @@ class MirrorAPI : public FNET_Task, bool ready() const override; private: - using SpecMap = vespalib::hash_map; + using SpecMap = vespalib::hash_map; /** from FNET_Task, polls slobrok **/ void PerformTask() override; diff --git a/slobrok/src/vespa/slobrok/sbregister.cpp b/slobrok/src/vespa/slobrok/sbregister.cpp index 567b9e73522c..a9e79d0bc23a 100644 --- a/slobrok/src/vespa/slobrok/sbregister.cpp +++ b/slobrok/src/vespa/slobrok/sbregister.cpp @@ -15,10 +15,10 @@ using vespalib::NetworkSetupFailureException; namespace { -vespalib::string +std::string createSpec(FRT_Supervisor &orb) { - vespalib::string spec; + std::string spec; if (orb.GetListenPort() != 0) { vespalib::asciistream str; str << "tcp/"; @@ -32,7 +32,7 @@ createSpec(FRT_Supervisor &orb) void -discard(std::vector &vec, std::string_view val) +discard(std::vector &vec, std::string_view val) { uint32_t i = 0; uint32_t size = vec.size(); @@ -170,7 +170,7 @@ RegisterAPI::handleReconnect() { if (_configurator->poll() && _target != 0) { if (! _slobrokSpecs.contains(_currSlobrok)) { - vespalib::string cps = _slobrokSpecs.logString(); + std::string cps = _slobrokSpecs.logString(); LOG(warning, "[RPC @ %s] location broker %s removed, will disconnect and use one of: %s", createSpec(_orb).c_str(), _currSlobrok.c_str(), cps.c_str()); _target->internal_subref(); @@ -197,7 +197,7 @@ RegisterAPI::handleReconnect() double delay = _backOff.get(); Schedule(delay); const char * const msgfmt = "[RPC @ %s] no location brokers available, retrying: %s (in %.1f seconds)"; - vespalib::string cps = _slobrokSpecs.logString(); + std::string cps = _slobrokSpecs.logString(); if (_backOff.shouldWarn()) { LOG(warning, msgfmt, createSpec(_orb).c_str(), cps.c_str(), delay); } else { @@ -214,7 +214,7 @@ RegisterAPI::handlePending() { bool unreg = false; bool reg = false; - vespalib::string name; + std::string name; { std::lock_guard guard(_lock); // pop off the todo stack, unregister has priority diff --git a/slobrok/src/vespa/slobrok/sbregister.h b/slobrok/src/vespa/slobrok/sbregister.h index 8b290da5bd26..9a361ffca004 100644 --- a/slobrok/src/vespa/slobrok/sbregister.h +++ b/slobrok/src/vespa/slobrok/sbregister.h @@ -91,12 +91,12 @@ class RegisterAPI : public FNET_Task, std::atomic _busy; SlobrokList _slobrokSpecs; Configurator::UP _configurator; - vespalib::string _currSlobrok; + std::string _currSlobrok; uint32_t _idx; BackOff _backOff; - std::vector _names; // registered service names - std::vector _pending; // pending service name registrations - std::vector _unreg; // pending service name unregistrations + std::vector _names; // registered service names + std::vector _pending; // pending service name registrations + std::vector _unreg; // pending service name unregistrations FRT_Target *_target; FRT_RPCRequest *_req; }; diff --git a/slobrok/src/vespa/slobrok/server/exchange_manager.cpp b/slobrok/src/vespa/slobrok/server/exchange_manager.cpp index 25a1bddb4ae5..e7d0af03b7f0 100644 --- a/slobrok/src/vespa/slobrok/server/exchange_manager.cpp +++ b/slobrok/src/vespa/slobrok/server/exchange_manager.cpp @@ -87,11 +87,11 @@ ExchangeManager::lookupPartner(const std::string & name) const { return (found == _partners.end()) ? nullptr : found->second.get(); } -vespalib::string +std::string ExchangeManager::diffLists(const ServiceMappingList &lhs, const ServiceMappingList &rhs) { using namespace vespalib; - vespalib::string result; + std::string result; auto visitor = overload { [&result](visit_ranges_first, const auto &m) { @@ -116,7 +116,7 @@ ExchangeManager::healthCheck() auto remoteList = partner->remoteMap().allMappings(); // 0 is expected (when remote is down) if (remoteList.size() != 0) { - vespalib::string diff = diffLists(newWorldList, remoteList); + std::string diff = diffLists(newWorldList, remoteList); if (! diff.empty()) { LOG(warning, "Peer slobrok at %s may have problems, differences from consensus map: %s", partner->getName().c_str(), diff.c_str()); diff --git a/slobrok/src/vespa/slobrok/server/exchange_manager.h b/slobrok/src/vespa/slobrok/server/exchange_manager.h index 43f205901adc..a11c8553871f 100644 --- a/slobrok/src/vespa/slobrok/server/exchange_manager.h +++ b/slobrok/src/vespa/slobrok/server/exchange_manager.h @@ -3,11 +3,11 @@ #include "ok_state.h" #include "remote_slobrok.h" +#include #include #include #include -#include namespace slobrok { @@ -76,7 +76,7 @@ class ExchangeManager SBEnv &_env; vespalib::steady_time _lastFullConsensusTime; - vespalib::string diffLists(const ServiceMappingList &lhs, const ServiceMappingList &rhs); + std::string diffLists(const ServiceMappingList &lhs, const ServiceMappingList &rhs); public: ExchangeManager(const ExchangeManager &) = delete; diff --git a/slobrok/src/vespa/slobrok/server/local_rpc_monitor_map.h b/slobrok/src/vespa/slobrok/server/local_rpc_monitor_map.h index 18081f8d1ce0..bd1b2b993573 100644 --- a/slobrok/src/vespa/slobrok/server/local_rpc_monitor_map.h +++ b/slobrok/src/vespa/slobrok/server/local_rpc_monitor_map.h @@ -68,7 +68,7 @@ class LocalRpcMonitorMap : public MapListener, bool up; bool localOnly; std::unique_ptr inflight; - vespalib::string spec; + std::string spec; PerService(bool up_in, bool local_only, std::unique_ptr inflight_in, std::string_view spec_in) : up(up_in), localOnly(local_only), inflight(std::move(inflight_in)), spec(spec_in) {} @@ -89,7 +89,7 @@ class LocalRpcMonitorMap : public MapListener, return {false, false, {}, mapping.spec}; } - using Map = std::map; + using Map = std::map; Map _map; ProxyMapSource _dispatcher; diff --git a/slobrok/src/vespa/slobrok/server/map_diff.h b/slobrok/src/vespa/slobrok/server/map_diff.h index 57dde5cc1f4d..98eda98f6b8b 100644 --- a/slobrok/src/vespa/slobrok/server/map_diff.h +++ b/slobrok/src/vespa/slobrok/server/map_diff.h @@ -14,7 +14,7 @@ namespace slobrok { struct MapDiff { /** construct incremental diff */ MapDiff(const vespalib::GenCnt &from, - std::vector remove, + std::vector remove, ServiceMappingList update, const vespalib::GenCnt &to) : fromGen(from), @@ -39,7 +39,7 @@ struct MapDiff { vespalib::GenCnt fromGen; // names to remove (empty if is_full_dump): - std::vector removed; + std::vector removed; // name->spec pairs to add or update: ServiceMappingList updated; diff --git a/slobrok/src/vespa/slobrok/server/metrics_producer.cpp b/slobrok/src/vespa/slobrok/server/metrics_producer.cpp index 02fa895c887a..03731f8de5f8 100644 --- a/slobrok/src/vespa/slobrok/server/metrics_producer.cpp +++ b/slobrok/src/vespa/slobrok/server/metrics_producer.cpp @@ -52,7 +52,7 @@ class MetricSnapshot MetricSnapshot(system_clock::time_point prevTime, system_clock::time_point currTime); void addCount(const char *name, const char *desc, uint32_t count); - vespalib::string asString() const { + std::string asString() const { return _data.toString(); } }; @@ -84,7 +84,7 @@ MetricSnapshot::addCount(const char *name, const char *desc, uint32_t count) inner.setDouble("rate", count / _snapLen); } -vespalib::string +std::string make_json_snapshot(const RPCHooks::Metrics &prev, const RPCHooks::Metrics &curr, system_clock::time_point prevTime, system_clock::time_point currTime) { @@ -127,7 +127,7 @@ void emit_prometheus_gauge(vespalib::asciistream &out, std::string_view name, out << name << ' ' << value << ' ' << ms_since_epoch(now).count() << '\n'; } -vespalib::string +std::string make_prometheus_snapshot(const RPCHooks::Metrics &curr, system_clock::time_point now) { vespalib::asciistream out; @@ -164,14 +164,14 @@ MetricsProducer::MetricsProducer(const RPCHooks &hooks, FNET_Transport &transpor MetricsProducer::~MetricsProducer() = default; -vespalib::string -MetricsProducer::getMetrics(const vespalib::string &consumer, ExpositionFormat format) +std::string +MetricsProducer::getMetrics(const std::string &consumer, ExpositionFormat format) { return _producer.getMetrics(consumer, format); } -vespalib::string -MetricsProducer::getTotalMetrics(const vespalib::string &, ExpositionFormat format) +std::string +MetricsProducer::getTotalMetrics(const std::string &, ExpositionFormat format) { const auto now = system_clock::now(); RPCHooks::Metrics current = _rpcHooks.getMetrics(); diff --git a/slobrok/src/vespa/slobrok/server/metrics_producer.h b/slobrok/src/vespa/slobrok/server/metrics_producer.h index 0a9dd589a15c..30bc08d63075 100644 --- a/slobrok/src/vespa/slobrok/server/metrics_producer.h +++ b/slobrok/src/vespa/slobrok/server/metrics_producer.h @@ -21,8 +21,8 @@ class MetricsProducer : public vespalib::MetricsProducer std::unique_ptr _snapshotter; public: - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override; - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override; + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override; + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override; void snapshot(); diff --git a/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp b/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp index 93ab0a9011c4..8feefddb15b9 100644 --- a/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp +++ b/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp @@ -75,7 +75,7 @@ void RemoteSlobrok::handleFetchResult() { FRT_StringValue *s = answer[3]._string_array._pt; uint32_t diff_to = answer[4]._intval32; - std::vector removed; + std::vector removed; for (uint32_t idx = 0; idx < numRemove; ++idx) { removed.emplace_back(r[idx]._str); } diff --git a/slobrok/src/vespa/slobrok/server/sbenv.cpp b/slobrok/src/vespa/slobrok/server/sbenv.cpp index 254a03aa9790..cc41b9dd0cfc 100644 --- a/slobrok/src/vespa/slobrok/server/sbenv.cpp +++ b/slobrok/src/vespa/slobrok/server/sbenv.cpp @@ -148,7 +148,7 @@ SBEnv::resume() namespace { -vespalib::string +std::string toString(const std::vector & v) { vespalib::asciistream os; os << "[" << '\n'; @@ -242,7 +242,7 @@ SBEnv::addPeer(const std::string &name, const std::string &spec) return OkState(0, "already configured with peer"); } } - vespalib::string peers = toString(_partnerList); + std::string peers = toString(_partnerList); LOG(warning, "got addPeer with non-configured peer %s, check config consistency. configured peers = %s", spec.c_str(), peers.c_str()); _partnerList.push_back(spec); diff --git a/slobrok/src/vespa/slobrok/server/service_map_history.cpp b/slobrok/src/vespa/slobrok/server/service_map_history.cpp index 848920a350bd..ea25acba867b 100644 --- a/slobrok/src/vespa/slobrok/server/service_map_history.cpp +++ b/slobrok/src/vespa/slobrok/server/service_map_history.cpp @@ -15,7 +15,7 @@ ServiceMapHistory::UpdateLog::UpdateLog() ServiceMapHistory::UpdateLog::~UpdateLog() = default; -void ServiceMapHistory::UpdateLog::add(const vespalib::string &name) { +void ServiceMapHistory::UpdateLog::add(const std::string &name) { currentGeneration.add(); updates.push(name); while (updates.size() > keep_items) { @@ -28,9 +28,9 @@ bool ServiceMapHistory::UpdateLog::isInRange(const Generation &gen) const { return gen.inRangeInclusive(startGeneration, currentGeneration); } -std::vector +std::vector ServiceMapHistory::UpdateLog::updatedSince(const Generation &gen) const { - std::vector result; + std::vector result; uint32_t skip = startGeneration.distance(gen); uint32_t last = startGeneration.distance(currentGeneration); for (uint32_t idx = skip; idx < last; ++idx) { @@ -99,10 +99,10 @@ void ServiceMapHistory::add(const ServiceMapping &mapping) { MapDiff ServiceMapHistory::makeDiffFrom(const Generation &fromGen) const { if (_log.isInRange(fromGen)) { - std::vector removes; + std::vector removes; ServiceMappingList updates; auto changes = _log.updatedSince(fromGen); - for (const vespalib::string & name : changes) { + for (const std::string & name : changes) { if (_map.contains(name)) { updates.emplace_back(name, _map.at(name)); } else { diff --git a/slobrok/src/vespa/slobrok/server/service_map_history.h b/slobrok/src/vespa/slobrok/server/service_map_history.h index 8fbccba33ea0..6630d3c3479b 100644 --- a/slobrok/src/vespa/slobrok/server/service_map_history.h +++ b/slobrok/src/vespa/slobrok/server/service_map_history.h @@ -2,13 +2,13 @@ #pragma once -#include #include #include -#include #include "map_listener.h" #include "service_mapping.h" #include "map_diff.h" +#include +#include namespace slobrok { @@ -40,14 +40,14 @@ class ServiceMapHistory : public MapListener static constexpr uint32_t keep_items = 1000; Generation startGeneration; Generation currentGeneration; - vespalib::ArrayQueue updates; + vespalib::ArrayQueue updates; UpdateLog(); ~UpdateLog(); - void add(const vespalib::string &name); + void add(const std::string &name); bool isInRange(const Generation &gen) const; - std::vector updatedSince(const Generation &gen) const; + std::vector updatedSince(const Generation &gen) const; }; - using Map = std::map; + using Map = std::map; using Waiter = std::pair; using WaitList = std::vector; diff --git a/slobrok/src/vespa/slobrok/server/service_map_mirror.h b/slobrok/src/vespa/slobrok/server/service_map_mirror.h index edd04bb5d57c..798fe6b1890c 100644 --- a/slobrok/src/vespa/slobrok/server/service_map_mirror.h +++ b/slobrok/src/vespa/slobrok/server/service_map_mirror.h @@ -37,7 +37,7 @@ class ServiceMapMirror : public MapSource void registerListener(MapListener &listener) override; void unregisterListener(MapListener &listener) override; - using Map = std::map; + using Map = std::map; Map _map; Generation _currGen; std::set _listeners; diff --git a/slobrok/src/vespa/slobrok/server/service_mapping.h b/slobrok/src/vespa/slobrok/server/service_mapping.h index e6ee07512f24..8f11b1917600 100644 --- a/slobrok/src/vespa/slobrok/server/service_mapping.h +++ b/slobrok/src/vespa/slobrok/server/service_mapping.h @@ -2,15 +2,15 @@ #pragma once -#include +#include #include namespace slobrok { struct ServiceMapping { - vespalib::string name; - vespalib::string spec; - ServiceMapping(const vespalib::string & name_, const vespalib::string & spec_) noexcept : name(name_), spec(spec_) { } + std::string name; + std::string spec; + ServiceMapping(const std::string & name_, const std::string & spec_) noexcept : name(name_), spec(spec_) { } ServiceMapping(const ServiceMapping& rhs) noexcept; ~ServiceMapping(); ServiceMapping& operator=(const ServiceMapping& rhs); diff --git a/slobrok/src/vespa/slobrok/server/union_service_map.cpp b/slobrok/src/vespa/slobrok/server/union_service_map.cpp index 0ce2a402084c..1fcb11938ea3 100644 --- a/slobrok/src/vespa/slobrok/server/union_service_map.cpp +++ b/slobrok/src/vespa/slobrok/server/union_service_map.cpp @@ -21,7 +21,7 @@ ServiceMappingList UnionServiceMap::currentConsensus() const { } bool UnionServiceMap::wouldConflict(const ServiceMapping &mapping) const { - const vespalib::string &key = mapping.name; + const std::string &key = mapping.name; auto iter = _mappings.find(key); if (iter == _mappings.end()) { return false; @@ -35,7 +35,7 @@ bool UnionServiceMap::wouldConflict(const ServiceMapping &mapping) const { void UnionServiceMap::add(const ServiceMapping &mapping) { - const vespalib::string &key = mapping.name; + const std::string &key = mapping.name; auto iter = _mappings.find(key); if (iter == _mappings.end()) { _mappings[key].emplace_back(mapping.spec, 1u); @@ -62,7 +62,7 @@ void UnionServiceMap::add(const ServiceMapping &mapping) void UnionServiceMap::remove(const ServiceMapping &mapping) { - const vespalib::string &key = mapping.name; + const std::string &key = mapping.name; auto iter = _mappings.find(key); if (iter == _mappings.end()) { LOG(error, "Broken invariant: did not find %s in mappings", key.c_str()); diff --git a/slobrok/src/vespa/slobrok/server/union_service_map.h b/slobrok/src/vespa/slobrok/server/union_service_map.h index 050a87ec02a0..5bf25aba2540 100644 --- a/slobrok/src/vespa/slobrok/server/union_service_map.h +++ b/slobrok/src/vespa/slobrok/server/union_service_map.h @@ -18,9 +18,9 @@ class UnionServiceMap : public ProxyMapSource { private: struct CountedSpec { - vespalib::string spec; + std::string spec; size_t count; - CountedSpec(const vespalib::string &spec_in, + CountedSpec(const std::string &spec_in, size_t count_in) noexcept : spec(spec_in), count(count_in) @@ -28,7 +28,7 @@ class UnionServiceMap : public ProxyMapSource } }; using Mappings = std::vector; - std::map _mappings; + std::map _mappings; public: UnionServiceMap(); diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp index dc560cf58cd3..e2ea002481fd 100644 --- a/storage/src/tests/bucketdb/bucketmanagertest.cpp +++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp @@ -670,7 +670,7 @@ class ConcurrentOperationFixture { static std::unique_ptr default_grouped_distribution() { return std::make_unique( - lib::Distribution::ConfigWrapper(lib::GlobalBucketSpaceDistributionConverter::string_to_config(vespalib::string( + lib::Distribution::ConfigWrapper(lib::GlobalBucketSpaceDistributionConverter::string_to_config(std::string( R"(redundancy 2 group[3] group[0].name "invalid" diff --git a/storage/src/tests/common/dummystoragelink.h b/storage/src/tests/common/dummystoragelink.h index 4cf9874562d6..e5d4dc1ae3c8 100644 --- a/storage/src/tests/common/dummystoragelink.h +++ b/storage/src/tests/common/dummystoragelink.h @@ -5,10 +5,10 @@ #include #include #include -#include -#include #include #include +#include +#include namespace storage { diff --git a/storage/src/tests/common/message_sender_stub.cpp b/storage/src/tests/common/message_sender_stub.cpp index 30b862420b82..fcb591db10b0 100644 --- a/storage/src/tests/common/message_sender_stub.cpp +++ b/storage/src/tests/common/message_sender_stub.cpp @@ -3,9 +3,9 @@ #include "message_sender_stub.h" #include #include -#include #include #include +#include namespace storage { diff --git a/storage/src/tests/common/storage_config_set.cpp b/storage/src/tests/common/storage_config_set.cpp index ed10e1138671..e964ac34ac24 100644 --- a/storage/src/tests/common/storage_config_set.cpp +++ b/storage/src/tests/common/storage_config_set.cpp @@ -26,7 +26,7 @@ namespace storage { -StorageConfigSet::StorageConfigSet(vespalib::string config_id_str, bool is_storage_node) +StorageConfigSet::StorageConfigSet(std::string config_id_str, bool is_storage_node) : _document_type_config(std::make_unique()), _slobroks_config(std::make_unique()), _messagebus_config(std::make_unique()), @@ -111,7 +111,7 @@ void StorageConfigSet::init_default_configs(bool is_storage_node) { _visitor_config->maxconcurrentvisitorsVariable = 0; } -void StorageConfigSet::add_bucket_space_mapping(vespalib::string doc_type, vespalib::string bucket_space_name) { +void StorageConfigSet::add_bucket_space_mapping(std::string doc_type, std::string bucket_space_name) { BucketspacesConfigBuilder::Documenttype type; type.name = std::move(doc_type); type.bucketspace = std::move(bucket_space_name); @@ -132,7 +132,7 @@ void StorageConfigSet::add_distribution_config(uint16_t nodes_in_top_level_group _distribution_config->redundancy = 2; } -void StorageConfigSet::add_metric_consumer(vespalib::string name, const std::vector& added_metrics) { +void StorageConfigSet::add_metric_consumer(std::string name, const std::vector& added_metrics) { MetricsmanagerConfigBuilder::Consumer consumer; consumer.name = std::move(name); consumer.addedmetrics.assign(added_metrics.begin(), added_metrics.end()); diff --git a/storage/src/tests/common/storage_config_set.h b/storage/src/tests/common/storage_config_set.h index 66cdeaf527f6..fc3d1ad3bca0 100644 --- a/storage/src/tests/common/storage_config_set.h +++ b/storage/src/tests/common/storage_config_set.h @@ -70,18 +70,18 @@ class StorageConfigSet { std::unique_ptr _visitor_config; std::unique_ptr _visitor_dispatcher_config; - vespalib::string _config_id_str; + std::string _config_id_str; config::ConfigSet _config_set; std::shared_ptr _config_ctx; config::ConfigUri _config_uri; public: - StorageConfigSet(vespalib::string config_id_str, bool is_storage_node); + StorageConfigSet(std::string config_id_str, bool is_storage_node); ~StorageConfigSet(); void init_default_configs(bool is_storage_node); - void add_bucket_space_mapping(vespalib::string doc_type, vespalib::string bucket_space_name); - void add_metric_consumer(vespalib::string name, const std::vector& added_metrics); + void add_bucket_space_mapping(std::string doc_type, std::string bucket_space_name); + void add_metric_consumer(std::string name, const std::vector& added_metrics); void add_distribution_config(uint16_t nodes_in_top_level_group); void set_slobrok_config_port(int slobrok_port); void set_node_index(uint16_t node_index); diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index b2b82a46850e..4fd87d300a2b 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -36,7 +36,7 @@ TestStorageApp::TestStorageApp(StorageComponentRegisterImpl::UP compReg, _initialized(false) { // Use config to adjust values - vespalib::string clusterName = "mycluster"; + std::string clusterName = "mycluster"; uint32_t redundancy = 2; uint32_t nodeCount = 10; auto serverConfig = config::ConfigGetter::getConfig(config_uri.getConfigId(), config_uri.getContext()); diff --git a/storage/src/tests/common/teststorageapp.h b/storage/src/tests/common/teststorageapp.h index c423761a9a24..3aa186439edf 100644 --- a/storage/src/tests/common/teststorageapp.h +++ b/storage/src/tests/common/teststorageapp.h @@ -50,7 +50,7 @@ class TestStorageApp protected: document::TestDocMan _docMan; TestNodeStateUpdater _nodeStateUpdater; - vespalib::string _configId; + std::string _configId; NodeIdentity _node_identity; std::atomic _initialized; diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp index 3dfc91a78489..d86036af4126 100644 --- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp +++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp @@ -22,9 +22,9 @@ using BucketSpacesStats = BucketSpacesStatsProvider::BucketSpacesStats; using namespace ::testing; struct DistributorHostInfoReporterTest : Test { - static void verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const vespalib::string& bucketSpaceName, + static void verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const std::string& bucketSpaceName, size_t bucketsTotal, size_t bucketsPending); - static void verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const vespalib::string& bucketSpaceName); + static void verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const std::string& bucketSpaceName); }; using ms = std::chrono::milliseconds; @@ -77,7 +77,7 @@ getMinReplica(const vespalib::Slime& root, uint16_t nodeIndex) } const vespalib::slime::Inspector& -getBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const vespalib::string& bucketSpaceName) +getBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const std::string& bucketSpaceName) { const auto& bucketSpaces = getNode(root, nodeIndex)["bucket-spaces"]; for (size_t i = 0; i < bucketSpaces.entries(); ++i) { @@ -93,7 +93,7 @@ getBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, const vespa void DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, - const vespalib::string& bucketSpaceName, + const std::string& bucketSpaceName, size_t bucketsTotal, size_t bucketsPending) { @@ -106,7 +106,7 @@ DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& r void DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& root, uint16_t nodeIndex, - const vespalib::string& bucketSpaceName) + const std::string& bucketSpaceName) { const auto &stats = getBucketSpaceStats(root, nodeIndex, bucketSpaceName); EXPECT_FALSE(stats["buckets"].valid()); @@ -218,7 +218,7 @@ TEST_F(DistributorHostInfoReporterTest, bucket_spaces_stats_are_reported) { verifyBucketSpaceStats(root, 3, "global"); FAIL() << "No exception thrown"; } catch (const std::runtime_error& ex) { - EXPECT_EQ("No bucket space found with name global", vespalib::string(ex.what())); + EXPECT_EQ("No bucket space found with name global", std::string(ex.what())); } } diff --git a/storage/src/tests/distributor/distributor_message_sender_stub.cpp b/storage/src/tests/distributor/distributor_message_sender_stub.cpp index 98b693ae9929..60a158837eaa 100644 --- a/storage/src/tests/distributor/distributor_message_sender_stub.cpp +++ b/storage/src/tests/distributor/distributor_message_sender_stub.cpp @@ -3,9 +3,9 @@ #include "distributor_message_sender_stub.h" #include #include -#include #include #include +#include namespace storage { diff --git a/storage/src/tests/distributor/distributor_message_sender_stub.h b/storage/src/tests/distributor/distributor_message_sender_stub.h index d4fdf2501058..15533dc7aaf8 100644 --- a/storage/src/tests/distributor/distributor_message_sender_stub.h +++ b/storage/src/tests/distributor/distributor_message_sender_stub.h @@ -2,11 +2,11 @@ #pragma once +#include "dummy_cluster_context.h" #include #include #include #include -#include "dummy_cluster_context.h" namespace storage { diff --git a/storage/src/tests/distributor/distributor_stripe_test.cpp b/storage/src/tests/distributor/distributor_stripe_test.cpp index ee1e05154bba..1a8552d3d359 100644 --- a/storage/src/tests/distributor/distributor_stripe_test.cpp +++ b/storage/src/tests/distributor/distributor_stripe_test.cpp @@ -115,7 +115,7 @@ struct DistributorStripeTest : Test, DistributorStripeTestUtil { return retVal; } - static void assertBucketSpaceStats(size_t expBucketPending, size_t expBucketTotal, uint16_t node, const vespalib::string& bucketSpace, + static void assertBucketSpaceStats(size_t expBucketPending, size_t expBucketTotal, uint16_t node, const std::string& bucketSpace, const BucketSpacesStatsProvider::PerNodeBucketSpacesStats& stats); SimpleMaintenanceScanner::PendingMaintenanceStats stripe_maintenance_stats() { @@ -178,7 +178,7 @@ struct DistributorStripeTest : Test, DistributorStripeTestUtil { void set_up_and_start_get_op_with_stale_reads_enabled(bool enabled); - void simulate_cluster_state_transition(const vespalib::string& state_str, bool clear_pending); + void simulate_cluster_state_transition(const std::string& state_str, bool clear_pending); static std::shared_ptr make_remove_reply_with_bucket_remap(api::StorageCommand& originator_cmd); // TODO dedupe @@ -204,7 +204,7 @@ DistributorStripeTest::DistributorStripeTest() DistributorStripeTest::~DistributorStripeTest() = default; void -DistributorStripeTest::simulate_cluster_state_transition(const vespalib::string& state_str, bool clear_pending) +DistributorStripeTest::simulate_cluster_state_transition(const std::string& state_str, bool clear_pending) { simulate_set_pending_cluster_state(state_str); if (clear_pending) { @@ -507,7 +507,7 @@ TEST_F(DistributorStripeTest, merge_stats_are_accumulated_during_database_iterat void DistributorStripeTest::assertBucketSpaceStats(size_t expBucketPending, size_t expBucketTotal, uint16_t node, - const vespalib::string& bucketSpace, + const std::string& bucketSpace, const BucketSpacesStatsProvider::PerNodeBucketSpacesStats& stats) { auto nodeItr = stats.find(node); diff --git a/storage/src/tests/distributor/distributor_stripe_test_util.cpp b/storage/src/tests/distributor/distributor_stripe_test_util.cpp index b87d3301f92c..85b872467178 100644 --- a/storage/src/tests/distributor/distributor_stripe_test_util.cpp +++ b/storage/src/tests/distributor/distributor_stripe_test_util.cpp @@ -142,7 +142,7 @@ DistributorStripeTestUtil::configure_stripe(const ConfigBuilder& builder) } void -DistributorStripeTestUtil::receive_set_system_state_command(const vespalib::string& state_str) +DistributorStripeTestUtil::receive_set_system_state_command(const std::string& state_str) { auto state_cmd = std::make_shared(lib::ClusterState(state_str)); _stripe->handleMessage(state_cmd); // TODO move semantics @@ -155,7 +155,7 @@ DistributorStripeTestUtil::handle_top_level_message(const std::shared_ptr& msg); - void simulate_set_pending_cluster_state(const vespalib::string& state_str); + void simulate_set_pending_cluster_state(const std::string& state_str); void clear_pending_cluster_state_bundle(); template diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp index 5677e5e66282..b7cd11949dec 100644 --- a/storage/src/tests/distributor/externaloperationhandlertest.cpp +++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp @@ -36,12 +36,12 @@ struct ExternalOperationHandlerTest : Test, DistributorStripeTestUtil { document::BucketId findOwned1stNotOwned2ndInStates(std::string_view state1, std::string_view state2); std::shared_ptr makeGetCommandForUser(uint64_t id) const; - std::shared_ptr makeGetCommand(const vespalib::string& id) const; - std::shared_ptr makeUpdateCommand(const vespalib::string& doc_type, const vespalib::string& id) const; + std::shared_ptr makeGetCommand(const std::string& id) const; + std::shared_ptr makeUpdateCommand(const std::string& doc_type, const std::string& id) const; std::shared_ptr makeUpdateCommand() const; std::shared_ptr makeUpdateCommandForUser(uint64_t id) const; - std::shared_ptr makePutCommand(const vespalib::string& doc_type, const vespalib::string& id) const; - std::shared_ptr makeRemoveCommand(const vespalib::string& id) const; + std::shared_ptr makePutCommand(const std::string& doc_type, const std::string& id) const; + std::shared_ptr makeRemoveCommand(const std::string& id) const; void verify_busy_bounced_due_to_no_active_state(std::shared_ptr cmd); @@ -68,7 +68,7 @@ struct ExternalOperationHandlerTest : Test, DistributorStripeTestUtil { void set_up_distributor_with_feed_blocked_state(); - const vespalib::string _dummy_id{"id:foo:testdoctype1::bar"}; + const std::string _dummy_id{"id:foo:testdoctype1::bar"}; // Returns an arbitrary bucket not owned in the pending state document::BucketId set_up_pending_cluster_state_transition(bool read_only_enabled); @@ -79,7 +79,7 @@ struct ExternalOperationHandlerTest : Test, DistributorStripeTestUtil { void assert_second_command_rejected_due_to_concurrent_mutation( std::shared_ptr cmd1, std::shared_ptr cmd2, - const vespalib::string& expected_id_in_message); + const std::string& expected_id_in_message); void assert_second_command_not_rejected_due_to_concurrent_mutation( std::shared_ptr cmd1, std::shared_ptr cmd2); @@ -161,7 +161,7 @@ ExternalOperationHandlerTest::findOwned1stNotOwned2ndInStates( } std::shared_ptr -ExternalOperationHandlerTest::makeGetCommand(const vespalib::string& id) const { +ExternalOperationHandlerTest::makeGetCommand(const std::string& id) const { return std::make_shared(makeDocumentBucket(document::BucketId(0)), DocumentId(id), document::AllFields::NAME); } @@ -172,8 +172,8 @@ ExternalOperationHandlerTest::makeGetCommandForUser(uint64_t id) const { } std::shared_ptr ExternalOperationHandlerTest::makeUpdateCommand( - const vespalib::string& doc_type, - const vespalib::string& id) const { + const std::string& doc_type, + const std::string& id) const { auto update = std::make_shared( _testDocMan.getTypeRepo(), *_testDocMan.getTypeRepo().getDocumentType(doc_type), @@ -193,14 +193,14 @@ ExternalOperationHandlerTest::makeUpdateCommandForUser(uint64_t id) const { } std::shared_ptr ExternalOperationHandlerTest::makePutCommand( - const vespalib::string& doc_type, - const vespalib::string& id) const { + const std::string& doc_type, + const std::string& id) const { auto doc = _testDocMan.createDocument(doc_type, id); return std::make_shared( makeDocumentBucket(document::BucketId(0)), std::move(doc), api::Timestamp(0)); } -std::shared_ptr ExternalOperationHandlerTest::makeRemoveCommand(const vespalib::string& id) const { +std::shared_ptr ExternalOperationHandlerTest::makeRemoveCommand(const std::string& id) const { return std::make_shared(makeDocumentBucket(document::BucketId(0)), DocumentId(id), api::Timestamp(0)); } @@ -386,7 +386,7 @@ void ExternalOperationHandlerTest::start_operation_verify_rejected( void ExternalOperationHandlerTest::assert_second_command_rejected_due_to_concurrent_mutation( std::shared_ptr cmd1, std::shared_ptr cmd2, - const vespalib::string& expected_id_in_message) { + const std::string& expected_id_in_message) { set_up_distributor_for_sequencing_test(); // Must hold ref to started operation, or sequencing handle will be released. @@ -597,7 +597,7 @@ struct OperationHandlerSequencingTest : ExternalOperationHandlerTest { set_up_distributor_for_sequencing_test(); } - static documentapi::TestAndSetCondition bucket_lock_bypass_tas_condition(const vespalib::string& token) { + static documentapi::TestAndSetCondition bucket_lock_bypass_tas_condition(const std::string& token) { return documentapi::TestAndSetCondition( vespalib::make_string("%s=%s", reindexing_bucket_lock_bypass_prefix(), token.c_str())); } diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index 19752e2db9eb..2c2383a98cf8 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -21,7 +21,7 @@ using namespace ::testing; namespace storage::distributor { namespace { -vespalib::string _g_storage("storage"); +std::string _g_storage("storage"); } struct MergeOperationTest : Test, DistributorStripeTestUtil { diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp index 29b2464cafaf..2b7450f23258 100644 --- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp +++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp @@ -55,7 +55,7 @@ class RequestBuilder { api::StorageMessageAddress makeStorageAddress(uint16_t node) { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); return {&_storage, lib::NodeType::STORAGE, node}; } diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp index f048472f3a9b..3e3823e4cd09 100644 --- a/storage/src/tests/distributor/putoperationtest.cpp +++ b/storage/src/tests/distributor/putoperationtest.cpp @@ -19,7 +19,7 @@ using config::ConfigGetter; using config::FileSpec; -using vespalib::string; +using std::string; using namespace document; using namespace std::literals::string_literals; using document::test::makeDocumentBucket; diff --git a/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp b/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp index d4b8c0605af4..e760a96e559c 100644 --- a/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp +++ b/storage/src/tests/distributor/read_for_write_visitor_operation_test.cpp @@ -31,15 +31,15 @@ Bucket default_bucket(BucketId id) { } api::StorageMessageAddress make_storage_address(uint16_t node) { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); return {&_storage, lib::NodeType::STORAGE, node}; } struct MockUuidGenerator : UuidGenerator { - vespalib::string _uuid; + std::string _uuid; MockUuidGenerator() : _uuid("a-very-random-id") {} - vespalib::string generate_uuid() const override { + std::string generate_uuid() const override { return _uuid; } }; diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp index ba77f9b3abe7..273c68b00419 100644 --- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp +++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp @@ -98,7 +98,7 @@ namespace { std::string sortLines(const std::string& source) { vespalib::StringTokenizer st(source,"\n",""); - std::vector lines; + std::vector lines; lines.reserve(st.size()); for (const auto & token : st) { lines.emplace_back(token); diff --git a/storage/src/tests/distributor/statusreporterdelegatetest.cpp b/storage/src/tests/distributor/statusreporterdelegatetest.cpp index c70ab533af6b..7a25bc9d62cf 100644 --- a/storage/src/tests/distributor/statusreporterdelegatetest.cpp +++ b/storage/src/tests/distributor/statusreporterdelegatetest.cpp @@ -29,7 +29,7 @@ class MockStatusReporter : public framework::StatusReporter MockStatusReporter() : framework::StatusReporter("foo", "Bar") {} - vespalib::string getReportContentType( + std::string getReportContentType( const framework::HttpUrlPath&) const override { return "foo/bar"; diff --git a/storage/src/tests/distributor/top_level_bucket_db_updater_test.cpp b/storage/src/tests/distributor/top_level_bucket_db_updater_test.cpp index 262427209660..34c4f18cd875 100644 --- a/storage/src/tests/distributor/top_level_bucket_db_updater_test.cpp +++ b/storage/src/tests/distributor/top_level_bucket_db_updater_test.cpp @@ -189,7 +189,7 @@ class TopLevelBucketDBUpdaterTest : public Test, sort_sent_messages_by_index(_sender, size_before_state); } - void set_cluster_state(const vespalib::string& state_str) { + void set_cluster_state(const std::string& state_str) { set_cluster_state(lib::ClusterState(state_str)); } @@ -220,7 +220,7 @@ class TopLevelBucketDBUpdaterTest : public Test, } static api::StorageMessageAddress storage_address(uint16_t node) { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); return api::StorageMessageAddress(&_storage, lib::NodeType::STORAGE, node); } @@ -290,7 +290,7 @@ class TopLevelBucketDBUpdaterTest : public Test, void initialize_nodes_and_buckets(uint32_t num_storage_nodes, uint32_t num_buckets) { ASSERT_NO_FATAL_FAILURE(set_storage_nodes(num_storage_nodes)); - vespalib::string state(vespalib::make_string("distributor:1 storage:%d", num_storage_nodes)); + std::string state(vespalib::make_string("distributor:1 storage:%d", num_storage_nodes)); lib::ClusterState new_state(state); for (uint32_t i = 0; i < message_count(num_storage_nodes); ++i) { diff --git a/storage/src/tests/distributor/top_level_distributor_test_util.cpp b/storage/src/tests/distributor/top_level_distributor_test_util.cpp index c4c4501a85df..1b32cfe251d4 100644 --- a/storage/src/tests/distributor/top_level_distributor_test_util.cpp +++ b/storage/src/tests/distributor/top_level_distributor_test_util.cpp @@ -102,7 +102,7 @@ TopLevelDistributorTestUtil::stripe_index_of_bucket(const document::Bucket& buck } void -TopLevelDistributorTestUtil::receive_set_system_state_command(const vespalib::string& state_str) +TopLevelDistributorTestUtil::receive_set_system_state_command(const std::string& state_str) { auto state_cmd = std::make_shared(lib::ClusterState(state_str)); handle_top_level_message(state_cmd); // TODO move semantics diff --git a/storage/src/tests/distributor/top_level_distributor_test_util.h b/storage/src/tests/distributor/top_level_distributor_test_util.h index b4fd0ccec12a..574e28b12e99 100644 --- a/storage/src/tests/distributor/top_level_distributor_test_util.h +++ b/storage/src/tests/distributor/top_level_distributor_test_util.h @@ -131,7 +131,7 @@ class TopLevelDistributorTestUtil : private DoneInitializeHandler // Invokes full cluster state transition pipeline rather than directly applying // the state and just pretending everything has been completed. - void receive_set_system_state_command(const vespalib::string& state_str); + void receive_set_system_state_command(const std::string& state_str); bool handle_top_level_message(const std::shared_ptr& msg); void trigger_distribution_change(std::shared_ptr distr); diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp index d8a1affde583..9a638322d8c7 100644 --- a/storage/src/tests/distributor/updateoperationtest.cpp +++ b/storage/src/tests/distributor/updateoperationtest.cpp @@ -16,7 +16,7 @@ using config::ConfigGetter; using config::FileSpec; -using vespalib::string; +using std::string; using document::test::makeDocumentBucket; using namespace document; using namespace storage::api; diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp index cf07303fd248..bef3cab0738f 100644 --- a/storage/src/tests/distributor/visitoroperationtest.cpp +++ b/storage/src/tests/distributor/visitoroperationtest.cpp @@ -156,14 +156,14 @@ VisitorOperationTest::doStandardVisitTest(const std::string& clusterState) addNodesToBucketDB(id, "0=1/1/1/t"); // Send create visitor - vespalib::string instanceId("testParameterForwarding"); - vespalib::string libraryName("dumpvisitor"); - vespalib::string docSelection(""); + std::string instanceId("testParameterForwarding"); + std::string libraryName("dumpvisitor"); + std::string docSelection(""); auto msg = std::make_shared( makeBucketSpace(), libraryName, instanceId, docSelection); - vespalib::string controlDestination("controldestination"); + std::string controlDestination("controldestination"); msg->setControlDestination(controlDestination); - vespalib::string dataDestination("datadestination"); + std::string dataDestination("datadestination"); msg->setDataDestination(dataDestination); msg->setMaximumPendingReplyCount(VisitorOperationTest::MAX_PENDING); msg->setMaxBucketsPerVisitor(8); @@ -218,9 +218,9 @@ TEST_F(VisitorOperationTest, shutdown) { addNodesToBucketDB(id, "0=1/1/1/t"); // Send create visitor - vespalib::string instanceId("testShutdown"); - vespalib::string libraryName("dumpvisitor"); - vespalib::string docSelection(""); + std::string instanceId("testShutdown"); + std::string libraryName("dumpvisitor"); + std::string docSelection(""); auto msg = std::make_shared( makeBucketSpace(), libraryName, instanceId, docSelection); msg->addBucketToBeVisited(id); diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index 72886d2c29df..021f09fef5fd 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.cpp @@ -17,17 +17,17 @@ using namespace ::testing; -vespalib::string fetch(int port, const vespalib::string &path) { +std::string fetch(int port, const std::string &path) { auto crypto = vespalib::CryptoEngine::get_default(); auto socket = vespalib::SocketSpec::from_port(port).client_address().connect(); assert(socket.valid()); auto conn = vespalib::SyncCryptoSocket::create_client(*crypto, std::move(socket), vespalib::SocketSpec::from_host_port("localhost", port)); - vespalib::string http_req = vespalib::make_string("GET %s HTTP/1.1\r\n" + std::string http_req = vespalib::make_string("GET %s HTTP/1.1\r\n" "Host: localhost:%d\r\n" "\r\n", path.c_str(), port); assert(conn->write(http_req.data(), http_req.size()) == ssize_t(http_req.size())); char buf[1024]; - vespalib::string result; + std::string result; ssize_t res = conn->read(buf, sizeof(buf)); while (res > 0) { result.append(std::string_view(buf, res)); @@ -72,7 +72,7 @@ namespace { XmlStatusReporter(const std::string& id, const std::string& name) : framework::XmlStatusReporter(id, name) {} - vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream& xos, + std::string reportXmlStatus(vespalib::xml::XmlOutputStream& xos, const framework::HttpUrlPath&) const override { xos << vespalib::xml::XmlTag("mytag") diff --git a/storage/src/tests/persistence/apply_bucket_diff_state_test.cpp b/storage/src/tests/persistence/apply_bucket_diff_state_test.cpp index 77aa680c40b9..443b7429c158 100644 --- a/storage/src/tests/persistence/apply_bucket_diff_state_test.cpp +++ b/storage/src/tests/persistence/apply_bucket_diff_state_test.cpp @@ -33,7 +33,7 @@ document::Bucket dummy_document_bucket(makeDocumentBucket(document::BucketId(0, class DummyMergeBucketInfoSyncer : public MergeBucketInfoSyncer { uint32_t& _sync_count; - vespalib::string _fail; + std::string _fail; public: DummyMergeBucketInfoSyncer(uint32_t& sync_count) : MergeBucketInfoSyncer(), @@ -50,7 +50,7 @@ class DummyMergeBucketInfoSyncer : public MergeBucketInfoSyncer } } void schedule_delayed_delete(std::unique_ptr) const override { } - void set_fail(vespalib::string fail) { _fail = std::move(fail); } + void set_fail(std::string fail) { _fail = std::move(fail); } }; DummyMergeBucketInfoSyncer::~DummyMergeBucketInfoSyncer() = default; @@ -221,7 +221,7 @@ TEST_F(ApplyBucketDiffStateTest, explicit_sync_bucket_info_works) TEST_F(ApplyBucketDiffStateTest, failed_sync_bucket_info_is_detected) { - vespalib::string fail("sync bucket failed"); + std::string fail("sync bucket failed"); syncer.set_fail(fail); state->mark_stale_bucket_info(); check_failure(fail); diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp index 6c7b09c4736c..2c931a594d8d 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.cpp +++ b/storage/src/tests/persistence/common/filestortestfixture.cpp @@ -82,7 +82,7 @@ FileStorTestFixture::TestFileStorComponents::TestFileStorComponents( top.open(); } -vespalib::string _storage("storage"); +std::string _storage("storage"); api::StorageMessageAddress FileStorTestFixture::makeSelfAddress() { diff --git a/storage/src/tests/persistence/filestorage/feed_operation_batching_test.cpp b/storage/src/tests/persistence/filestorage/feed_operation_batching_test.cpp index 1e4f581b7799..fed93b5ff0dd 100644 --- a/storage/src/tests/persistence/filestorage/feed_operation_batching_test.cpp +++ b/storage/src/tests/persistence/filestorage/feed_operation_batching_test.cpp @@ -48,7 +48,7 @@ struct FeedOperationBatchingTest : FileStorTestFixture { FileStorTestFixture::TearDown(); } - [[nodiscard]] static vespalib::string id_str_of(uint32_t bucket_idx, uint32_t doc_idx) { + [[nodiscard]] static std::string id_str_of(uint32_t bucket_idx, uint32_t doc_idx) { return vespalib::make_string("id:foo:testdoctype1:n=%u:%u", bucket_idx, doc_idx); } diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index bdc3f17e576a..d427304ebb33 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -71,8 +71,8 @@ namespace storage { namespace { -vespalib::string _cluster("cluster"); -vespalib::string _storage("storage"); +std::string _cluster("cluster"); +std::string _storage("storage"); api::StorageMessageAddress _storage2(&_storage, lib::NodeType::STORAGE, 2); api::StorageMessageAddress _storage3(&_storage, lib::NodeType::STORAGE, 3); api::StorageMessageAddress _cluster1(&_cluster, lib::NodeType::STORAGE, 1); diff --git a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp index 38acc4a18b83..691384f1f279 100644 --- a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp @@ -50,7 +50,7 @@ assertIsNotifyCommandWithActiveBucket(api::StorageMessage& msg) auto& cmd = dynamic_cast(msg); ASSERT_TRUE(cmd.getBucketInfo().isActive()); ASSERT_EQ( - vespalib::string("StorageMessageAddress(Storage protocol, " + std::string("StorageMessageAddress(Storage protocol, " "cluster storage, nodetype distributor, index 0)"), cmd.getAddress()->toString()); } diff --git a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp index 758fb7861cab..a6e116d2eb26 100644 --- a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp +++ b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp @@ -32,7 +32,7 @@ namespace { api::StorageMessageAddress makeAddress() { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); return api::StorageMessageAddress(&_storage, lib::NodeType::STORAGE, 0); } diff --git a/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp b/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp index 1d722f72ff91..c4f7d1f0a49b 100644 --- a/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp +++ b/storage/src/tests/persistence/filestorage/service_layer_host_info_reporter_test.cpp @@ -17,20 +17,20 @@ using spi::ResourceUsage; namespace { double -get_usage_element(const vespalib::Slime& root, const vespalib::string& label) +get_usage_element(const vespalib::Slime& root, const std::string& label) { return root.get()["content-node"]["resource-usage"][label]["usage"].asDouble(); } AttributeResourceUsage -get_attribute_usage_element(const vespalib::Slime& root, const vespalib::string& label) +get_attribute_usage_element(const vespalib::Slime& root, const std::string& label) { double usage = get_usage_element(root, label); auto name = root.get()["content-node"]["resource-usage"][label]["name"].asString(); return AttributeResourceUsage(usage, name.make_string()); } -const vespalib::string attr_name("doctype.subdb.attr.enum-store"); +const std::string attr_name("doctype.subdb.attr.enum-store"); } diff --git a/storage/src/tests/persistence/processalltest.cpp b/storage/src/tests/persistence/processalltest.cpp index 3068769211ff..3b1e79fe5554 100644 --- a/storage/src/tests/persistence/processalltest.cpp +++ b/storage/src/tests/persistence/processalltest.cpp @@ -226,7 +226,7 @@ TEST_F(ProcessAllHandlerTest, bucket_stat_request_returns_document_metadata_matc auto& reply = dynamic_cast(tracker->getReply()); EXPECT_EQ(api::ReturnCode::OK, reply.getResult().getResult()); - vespalib::string expected = + std::string expected = "Persistence bucket BucketId(0x4000000000000004)\n" " Timestamp: 100, Doc(id:mail:testdoctype1:n=4:3619.html), gid(0x0400000092bb8d298934253a), size: 163\n" " Timestamp: 102, Doc(id:mail:testdoctype1:n=4:62608.html), gid(0x04000000ce878d2488413bc4), size: 141\n" @@ -260,7 +260,7 @@ TEST_F(ProcessAllHandlerTest, stat_bucket_request_can_returned_removed_entries) auto& reply = dynamic_cast(tracker->getReply()); EXPECT_EQ(api::ReturnCode::OK, reply.getResult().getResult()); - vespalib::string expected = + std::string expected = "Persistence bucket BucketId(0x4000000000000004)\n" " Timestamp: 100, Doc(id:mail:testdoctype1:n=4:3619.html), gid(0x0400000092bb8d298934253a), size: 163\n" " Timestamp: 101, Doc(id:mail:testdoctype1:n=4:33113.html), gid(0x04000000b121a632741db368), size: 89\n" @@ -306,7 +306,7 @@ TEST_F(ProcessAllHandlerTest, bucket_stat_request_can_return_all_put_entries_in_ auto& reply = dynamic_cast(tracker->getReply()); EXPECT_EQ(api::ReturnCode::OK, reply.getResult().getResult()); - vespalib::string expected = + std::string expected = "Persistence bucket BucketId(0x4000000000000004)\n" " Timestamp: 100, Doc(id:mail:testdoctype1:n=4:3619.html), gid(0x0400000092bb8d298934253a), size: 163\n" " Timestamp: 101, Doc(id:mail:testdoctype1:n=4:33113.html), gid(0x04000000b121a632741db368), size: 89\n" diff --git a/storage/src/tests/persistence/provider_error_wrapper_test.cpp b/storage/src/tests/persistence/provider_error_wrapper_test.cpp index 7ecc9dac30e8..8164eed0be80 100644 --- a/storage/src/tests/persistence/provider_error_wrapper_test.cpp +++ b/storage/src/tests/persistence/provider_error_wrapper_test.cpp @@ -25,8 +25,8 @@ struct MockErrorListener : ProviderErrorListener { _resource_exhaustion_error = message; } - vespalib::string _fatal_error; - vespalib::string _resource_exhaustion_error; + std::string _fatal_error; + std::string _resource_exhaustion_error; bool _seen_fatal_error{false}; bool _seen_resource_exhaustion_error{false}; }; @@ -75,7 +75,7 @@ TEST_F(ProviderErrorWrapperTest, fatal_error_invokes_listener) { EXPECT_FALSE(listener->_seen_resource_exhaustion_error); EXPECT_TRUE(listener->_seen_fatal_error); - EXPECT_EQ(vespalib::string("eject! eject!"), listener->_fatal_error); + EXPECT_EQ(std::string("eject! eject!"), listener->_fatal_error); } TEST_F(ProviderErrorWrapperTest, resource_exhaustion_error_invokes_listener) { @@ -89,7 +89,7 @@ TEST_F(ProviderErrorWrapperTest, resource_exhaustion_error_invokes_listener) { EXPECT_FALSE(listener->_seen_fatal_error); EXPECT_TRUE(listener->_seen_resource_exhaustion_error); - EXPECT_EQ(vespalib::string("out of juice"), listener->_resource_exhaustion_error); + EXPECT_EQ(std::string("out of juice"), listener->_resource_exhaustion_error); } TEST_F(ProviderErrorWrapperTest, listener_not_invoked_on_success) { diff --git a/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp b/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp index 6f0e38529864..35774b867167 100644 --- a/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp +++ b/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp @@ -44,7 +44,7 @@ using document::RemoveFieldPathUpdate; using document::test::makeDocumentBucket; using document::test::makeBucketSpace; using storage::lib::ClusterState; -using vespalib::string; +using std::string; namespace vespalib { @@ -123,9 +123,9 @@ namespace { } TEST_F(StorageProtocolTest, testAddress50) { - vespalib::string cluster("foo"); + std::string cluster("foo"); StorageMessageAddress address(&cluster, lib::NodeType::STORAGE, 3); - EXPECT_EQ(vespalib::string("storage/cluster.foo/storage/3/default"), + EXPECT_EQ(std::string("storage/cluster.foo/storage/3/default"), address.to_mbus_route().toString()); } @@ -320,7 +320,7 @@ TEST_P(StorageProtocolTest, get) { EXPECT_EQ(_bucket, cmd2->getBucket()); EXPECT_EQ(_testDocId, cmd2->getDocumentId()); EXPECT_EQ(Timestamp(123), cmd2->getBeforeTimestamp()); - EXPECT_EQ(vespalib::string("foo,bar,vekterli"), cmd2->getFieldSet()); + EXPECT_EQ(std::string("foo,bar,vekterli"), cmd2->getFieldSet()); auto reply = std::make_shared(*cmd2, _testDoc, 100); set_dummy_bucket_info_reply_fields(*reply); @@ -722,11 +722,11 @@ namespace { ApplyBucketDiffCommand::Entry dummy_apply_entry() { ApplyBucketDiffCommand::Entry e; e._docName = "my cool id"; - vespalib::string header_data = "fancy header"; + std::string header_data = "fancy header"; e._headerBlob.resize(header_data.size()); memcpy(&e._headerBlob[0], header_data.data(), header_data.size()); - vespalib::string body_data = "fancier body!"; + std::string body_data = "fancier body!"; e._bodyBlob.resize(body_data.size()); memcpy(&e._bodyBlob[0], body_data.data(), body_data.size()); @@ -893,7 +893,7 @@ TEST_P(StorageProtocolTest, serialized_size_is_used_to_set_approx_size_of_storag TEST_P(StorageProtocolTest, track_memory_footprint_for_some_messages) { constexpr size_t msg_baseline = 80u; constexpr size_t reply_baseline = 96; - constexpr size_t doc_reply_baseline = reply_baseline + sizeof(vespalib::string); + constexpr size_t doc_reply_baseline = reply_baseline + sizeof(std::string); EXPECT_EQ(sizeof(StorageMessage), msg_baseline); EXPECT_EQ(sizeof(StorageReply), reply_baseline); @@ -905,15 +905,15 @@ TEST_P(StorageProtocolTest, track_memory_footprint_for_some_messages) { EXPECT_EQ(sizeof(PutReply), doc_reply_baseline + 136); EXPECT_EQ(sizeof(UpdateReply), doc_reply_baseline + 120); EXPECT_EQ(sizeof(RemoveReply), doc_reply_baseline + 112); - EXPECT_EQ(sizeof(GetReply), doc_reply_baseline + 136 + sizeof(vespalib::string)); + EXPECT_EQ(sizeof(GetReply), doc_reply_baseline + 136 + sizeof(std::string)); EXPECT_EQ(sizeof(StorageCommand), msg_baseline + 16); EXPECT_EQ(sizeof(BucketCommand), sizeof(StorageCommand) + 24); EXPECT_EQ(sizeof(BucketInfoCommand), sizeof(BucketCommand)); - EXPECT_EQ(sizeof(TestAndSetCommand), sizeof(BucketInfoCommand) + sizeof(vespalib::string)); + EXPECT_EQ(sizeof(TestAndSetCommand), sizeof(BucketInfoCommand) + sizeof(std::string)); EXPECT_EQ(sizeof(PutCommand), sizeof(TestAndSetCommand) + 40); EXPECT_EQ(sizeof(UpdateCommand), sizeof(TestAndSetCommand) + 40); - EXPECT_EQ(sizeof(RemoveCommand), sizeof(TestAndSetCommand) + 48 + sizeof(vespalib::string)); - EXPECT_EQ(sizeof(GetCommand), sizeof(BucketInfoCommand) + sizeof(TestAndSetCondition) + 56 + 2 * sizeof(vespalib::string)); + EXPECT_EQ(sizeof(RemoveCommand), sizeof(TestAndSetCommand) + 48 + sizeof(std::string)); + EXPECT_EQ(sizeof(GetCommand), sizeof(BucketInfoCommand) + sizeof(TestAndSetCondition) + 56 + 2 * sizeof(std::string)); } } // storage::api diff --git a/storage/src/tests/storageapi/messageapi/storage_message_address_test.cpp b/storage/src/tests/storageapi/messageapi/storage_message_address_test.cpp index 0c2a3abb4673..643dfc07eaa0 100644 --- a/storage/src/tests/storageapi/messageapi/storage_message_address_test.cpp +++ b/storage/src/tests/storageapi/messageapi/storage_message_address_test.cpp @@ -9,7 +9,7 @@ namespace storage::api { namespace { -size_t hash_of(const vespalib::string & cluster, const lib::NodeType& type, uint16_t index) { +size_t hash_of(const std::string & cluster, const lib::NodeType& type, uint16_t index) { return StorageMessageAddress(&cluster, type, index).internal_storage_hash(); } diff --git a/storage/src/tests/storageframework/thread/tickingthreadtest.cpp b/storage/src/tests/storageframework/thread/tickingthreadtest.cpp index 104bd23a39c9..1742b57a35e3 100644 --- a/storage/src/tests/storageframework/thread/tickingthreadtest.cpp +++ b/storage/src/tests/storageframework/thread/tickingthreadtest.cpp @@ -206,7 +206,7 @@ namespace { RealClock clock; void printTaskInfo(const std::string& task, const char* action) { - vespalib::string msg = vespalib::make_string( + std::string msg = vespalib::make_string( "%" PRIu64 ": %s %s\n", vespalib::count_us(clock.getSystemTime().time_since_epoch()), task.c_str(), diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index 11742dd658f4..db8eb4e629d9 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -243,7 +243,7 @@ TEST_F(BouncerTest, internal_operations_are_not_rejected) { namespace { std::shared_ptr -makeClusterStateBundle(const vespalib::string &baselineState, const std::map &derivedStates) +makeClusterStateBundle(const std::string &baselineState, const std::map &derivedStates) { lib::ClusterStateBundle::BucketSpaceStateMapping derivedBucketSpaceStates; for (const auto &entry : derivedStates) { diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp index 7de9d7ca0114..e627fcbe4525 100644 --- a/storage/src/tests/storageserver/communicationmanagertest.cpp +++ b/storage/src/tests/storageserver/communicationmanagertest.cpp @@ -26,7 +26,7 @@ using namespace ::testing; namespace storage { -vespalib::string _storage("storage"); +std::string _storage("storage"); using CommunicationManagerConfig = vespa::config::content::core::StorCommunicationmanagerConfig; diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp index 365b9efeff04..69b1518a7461 100644 --- a/storage/src/tests/storageserver/documentapiconvertertest.cpp +++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp @@ -39,7 +39,7 @@ namespace storage { const DocumentId defaultDocId("id:test:text/html::0"); const BucketSpace defaultBucketSpace(5); -const vespalib::string defaultSpaceName("myspace"); +const std::string defaultSpaceName("myspace"); const Bucket defaultBucket(defaultBucketSpace, BucketId(0)); const TestAndSetCondition my_condition("my condition"); @@ -50,13 +50,13 @@ struct MockBucketResolver : public BucketResolver { } return Bucket(BucketSpace(0), BucketId(0)); } - virtual BucketSpace bucketSpaceFromName(const vespalib::string &bucketSpace) const override { + virtual BucketSpace bucketSpaceFromName(const std::string &bucketSpace) const override { if (bucketSpace == defaultSpaceName) { return defaultBucketSpace; } return BucketSpace(0); } - virtual vespalib::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const override { + virtual std::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const override { if (bucketSpace == defaultBucketSpace) { return defaultSpaceName; } diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp index bc1c7f607066..89973917cf3d 100644 --- a/storage/src/tests/storageserver/mergethrottlertest.cpp +++ b/storage/src/tests/storageserver/mergethrottlertest.cpp @@ -35,7 +35,7 @@ namespace { using StorServerConfig = vespa::config::content::core::StorServerConfig; using StorServerConfigBuilder = vespa::config::content::core::StorServerConfigBuilder; -vespalib::string _storage("storage"); +std::string _storage("storage"); std::unique_ptr default_server_config() { auto config = StorageConfigSet::make_storage_node_config(); @@ -446,7 +446,7 @@ TEST_F(MergeThrottlerTest, chain) { const MergeBucketReply& mbr = dynamic_cast(*unwind); EXPECT_EQ(ReturnCode::OK, mbr.getResult().getResult()); - EXPECT_EQ(vespalib::string("Great success! :D-|-<"), mbr.getResult().getMessage()); + EXPECT_EQ(std::string("Great success! :D-|-<"), mbr.getResult().getMessage()); EXPECT_EQ(bucket, mbr.getBucket()); } while (std::next_permutation(indices, indices + _storageNodeCount)); diff --git a/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp b/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp index dcdc53aae8c6..bf442d6aa562 100644 --- a/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp +++ b/storage/src/tests/storageserver/rpc/caching_rpc_target_resolver_test.cpp @@ -13,12 +13,12 @@ using storage::lib::NodeType; class MockMirror : public IMirrorAPI { public: - using Mappings = std::map; + using Mappings = std::map; Mappings mappings; uint32_t gen; MockMirror() : mappings(), gen(1) {} SpecList lookup(std::string_view pattern) const override { - auto itr = mappings.find(vespalib::string(pattern)); + auto itr = mappings.find(std::string(pattern)); if (itr != mappings.end()) { return itr->second; } @@ -36,7 +36,7 @@ class MockRpcTarget : public RpcTarget { MockRpcTarget(bool& valid) : _valid(valid) {} FRT_Target* get() noexcept override { return nullptr; } bool is_valid() const noexcept override { return _valid; } - const vespalib::string& spec() const noexcept override { abort(); } + const std::string& spec() const noexcept override { abort(); } }; class MockTargetFactory : public RpcTargetFactory { @@ -44,12 +44,12 @@ class MockTargetFactory : public RpcTargetFactory { mutable bool valid_target; MockTargetFactory() : valid_target(true) {} - std::unique_ptr make_target([[maybe_unused]] const vespalib::string& connection_spec) const override { + std::unique_ptr make_target([[maybe_unused]] const std::string& connection_spec) const override { return std::make_unique(valid_target); } }; -vespalib::string _my_cluster("my_cluster"); +std::string _my_cluster("my_cluster"); class CachingRpcTargetResolverTest : public ::testing::Test { public: @@ -58,8 +58,8 @@ class CachingRpcTargetResolverTest : public ::testing::Test { CachingRpcTargetResolver resolver; StorageMessageAddress address_0; StorageMessageAddress address_1; - vespalib::string spec_0; - vespalib::string spec_1; + std::string spec_0; + std::string spec_1; uint64_t bucket_id_0; uint64_t bucket_id_1; uint64_t bucket_id_2; @@ -78,10 +78,10 @@ class CachingRpcTargetResolverTest : public ::testing::Test { { add_mapping(address_0, spec_0); } - void add_mapping(const StorageMessageAddress& address, const vespalib::string& connection_spec) { + void add_mapping(const StorageMessageAddress& address, const std::string& connection_spec) { mirror.mappings[to_slobrok_id(address)] = {{to_slobrok_id(address), connection_spec}}; } - static vespalib::string to_slobrok_id(const storage::api::StorageMessageAddress& address) { + static std::string to_slobrok_id(const storage::api::StorageMessageAddress& address) { return CachingRpcTargetResolver::address_to_slobrok_id(address); } std::shared_ptr resolve_rpc_target(const StorageMessageAddress& address) { diff --git a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp index ca348b06c1c6..769d3ff5c815 100644 --- a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp +++ b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp @@ -129,7 +129,7 @@ std::shared_ptr state_of(std::string_view state) { return std::make_shared(state); } -vespalib::string make_compressable_state_string() { +std::string make_compressable_state_string() { vespalib::asciistream ss; for (int i = 0; i < 99; ++i) { ss << " ." << i << ".s:d"; diff --git a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp index 5852e27f78d3..03a1007b7130 100644 --- a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp +++ b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp @@ -91,11 +91,11 @@ LockingMockOperationDispatcher::LockingMockOperationDispatcher() = default; LockingMockOperationDispatcher::~LockingMockOperationDispatcher() = default; api::StorageMessageAddress make_address(uint16_t node_index, bool is_distributor) { - static vespalib::string _coolcluster("coolcluster"); + static std::string _coolcluster("coolcluster"); return {&_coolcluster, (is_distributor ? lib::NodeType::DISTRIBUTOR : lib::NodeType::STORAGE), node_index}; } -vespalib::string to_slobrok_id(const api::StorageMessageAddress& address) { +std::string to_slobrok_id(const api::StorageMessageAddress& address) { // TODO factor out slobrok ID generation code to be independent of resolver? return CachingRpcTargetResolver::address_to_slobrok_id(address); } @@ -108,7 +108,7 @@ class RpcNode { std::unique_ptr _codec_provider; std::unique_ptr _shared_rpc_resources; api::StorageMessageAddress _node_address; - vespalib::string _slobrok_id; + std::string _slobrok_id; public: RpcNode(uint16_t node_index, bool is_distributor, const mbus::Slobrok& slobrok) : _config(StorageConfigSet::make_node_config(!is_distributor)), @@ -195,7 +195,7 @@ class StorageApiNode : public RpcNode { void send_raw_request_and_expect_error(StorageApiNode& node, FRT_RPCRequest* req, - const vespalib::string& expected_msg) { + const std::string& expected_msg) { auto spec = vespalib::make_string("tcp/localhost:%d", node.shared_rpc_resources().listen_port()); auto* target = _shared_rpc_resources->supervisor().GetTarget(spec.c_str()); target->InvokeSync(req, 60.0); diff --git a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp index d72227000261..f37dc2839517 100644 --- a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp +++ b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp @@ -29,9 +29,9 @@ class TestShutdownListener } bool shutdown_requested() const { return !_reason.empty(); } - const vespalib::string& reason() const { return _reason; } + const std::string& reason() const { return _reason; } private: - vespalib::string _reason; + std::string _reason; }; struct Fixture { diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp index c7f6ef0c5c03..8c1ce48bf167 100644 --- a/storage/src/tests/storageserver/statemanagertest.cpp +++ b/storage/src/tests/storageserver/statemanagertest.cpp @@ -75,7 +75,7 @@ struct StateManagerTest : Test, NodeStateReporter { void extract_cluster_state_version_from_host_info(uint32_t& version_out); - static vespalib::string to_string(const lib::Distribution::DistributionConfig& cfg) { + static std::string to_string(const lib::Distribution::DistributionConfig& cfg) { return lib::Distribution(cfg).serialized(); } }; diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index 29d3daf9b860..606b272d2b0a 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -126,8 +126,8 @@ vespalib::Slime slime; \ #define ASSERT_NODE_STATUS(jsonData, code, message) \ { \ PARSE_JSON(jsonData); \ - ASSERT_EQ(vespalib::string(code), slime.get()["status"]["code"].asString().make_string()); \ - ASSERT_EQ(vespalib::string(message), slime.get()["status"]["message"].asString().make_string()); \ + ASSERT_EQ(std::string(code), slime.get()["status"]["code"].asString().make_string()); \ + ASSERT_EQ(std::string(message), slime.get()["status"]["message"].asString().make_string()); \ } #define ASSERT_METRIC_GET_PUT(jsonData, expGetCount, expPutCount) \ @@ -137,7 +137,7 @@ vespalib::Slime slime; \ double putCount = -1; \ size_t metricCount = slime.get()["metrics"]["values"].children(); \ for (size_t j=0; j #include -using vespalib::string; +using std::string; using document::test::makeBucketSpace; using namespace ::testing; @@ -28,7 +28,7 @@ std::shared_ptr getCommand( return cmd; } -const vespalib::string & +const std::string & getCommandString(const std::shared_ptr& cmd) { return cmd->getDocumentSelection(); diff --git a/storage/src/tests/visiting/memory_bounded_trace_test.cpp b/storage/src/tests/visiting/memory_bounded_trace_test.cpp index fc05c30f04e2..400bbb475756 100644 --- a/storage/src/tests/visiting/memory_bounded_trace_test.cpp +++ b/storage/src/tests/visiting/memory_bounded_trace_test.cpp @@ -86,7 +86,7 @@ TEST(MemoryBoundedTraceTest, moved_tree_includes_stats_node_when_nodes_omitted) trace.moveTraceTo(target); EXPECT_EQ(1, target.getNumChildren()); EXPECT_EQ(2, target.getChild(0).getNumChildren()); - vespalib::string expected("Trace too large; omitted 1 subsequent trace " + std::string expected("Trace too large; omitted 1 subsequent trace " "trees containing a total of 9 bytes"); EXPECT_EQ(expected, target.getChild(0).getChild(1).getNote()); } diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index 82aa2d2e6b17..6efc2a2658d3 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -41,7 +41,7 @@ namespace { using msg_ptr_vector = std::vector; [[nodiscard]] const api::StorageMessageAddress& storage_address() { - static vespalib::string storage("storage"); + static std::string storage("storage"); static api::StorageMessageAddress address(&storage, lib::NodeType::STORAGE, 0); return address; } diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 028b09b1a910..d98c05f4be31 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -444,7 +444,7 @@ VisitorTest::fetchSingleCommand(DummyStorageLink& link, std::shared_ptr& msg_ std::shared_ptr VisitorTest::makeCreateVisitor(const VisitorOptions& options) { - static vespalib::string _storage("storage"); + static std::string _storage("storage"); api::StorageMessageAddress address(&_storage, lib::NodeType::STORAGE, 0); auto cmd = std::make_shared( makeBucketSpace(), options.visitorType, "testvis", ""); diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp index 44b9283145f5..fc5381f103c7 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp @@ -342,7 +342,7 @@ void BucketManager::run(framework::ThreadHandle& thread) } } -vespalib::string +std::string BucketManager::getReportContentType(const framework::HttpUrlPath& path) const { bool showAll = path.hasAttribute("showall"); diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index 35ccab843a96..bb3805458db9 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -106,7 +106,7 @@ class BucketManager : public StorageLink, void run(framework::ThreadHandle&) override; // Status::Reporter implementation - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; /** Event saying node is up and running. We can start to build cache. */ diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp index d2b019cc50d8..b6510d000b3a 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp @@ -28,7 +28,7 @@ ContentBucketDbMetrics::ContentBucketDbMetrics(metrics::MetricSet* owner) ContentBucketDbMetrics::~ContentBucketDbMetrics() = default; -BucketSpaceMetrics::BucketSpaceMetrics(const vespalib::string& space_name, metrics::MetricSet* owner) +BucketSpaceMetrics::BucketSpaceMetrics(const std::string& space_name, metrics::MetricSet* owner) : metrics::MetricSet("bucket_space", {{"bucketSpace", space_name}}, "", owner), buckets_total("buckets_total", {}, "Total number buckets present in the bucket space (ready + not ready)", this), entries("entries", {}, "Number of entries (documents + tombstones) stored in the bucket space", this), diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h index cab3a397c544..034b5e6bedb8 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h @@ -41,7 +41,7 @@ struct BucketSpaceMetrics : metrics::MetricSet { metrics::LongValueMetric ready_buckets; ContentBucketDbMetrics bucket_db_metrics; - BucketSpaceMetrics(const vespalib::string& space_name, metrics::MetricSet* owner); + BucketSpaceMetrics(const std::string& space_name, metrics::MetricSet* owner); ~BucketSpaceMetrics() override; }; diff --git a/storage/src/vespa/storage/common/bucket_resolver.h b/storage/src/vespa/storage/common/bucket_resolver.h index 8096f218bdc1..cfb064ae7920 100644 --- a/storage/src/vespa/storage/common/bucket_resolver.h +++ b/storage/src/vespa/storage/common/bucket_resolver.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include namespace document { class DocumentId; } @@ -14,8 +14,8 @@ namespace storage { struct BucketResolver { virtual ~BucketResolver() = default; virtual document::Bucket bucketFromId(const document::DocumentId &documentId) const = 0; - virtual document::BucketSpace bucketSpaceFromName(const vespalib::string &bucketSpace) const = 0; - virtual vespalib::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const = 0; + virtual document::BucketSpace bucketSpaceFromName(const std::string &bucketSpace) const = 0; + virtual std::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const = 0; }; } diff --git a/storage/src/vespa/storage/common/cluster_context.h b/storage/src/vespa/storage/common/cluster_context.h index 379c40cb0e37..dbad48d3ac65 100644 --- a/storage/src/vespa/storage/common/cluster_context.h +++ b/storage/src/vespa/storage/common/cluster_context.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace storage { @@ -20,10 +20,10 @@ struct ClusterContext { // lifetime of all the components that may ask for it. // This API is for the benefit of StorageMessageAddress // which wants to contain the pointer returned here. - virtual const vespalib::string * cluster_name_ptr() const noexcept = 0; + virtual const std::string * cluster_name_ptr() const noexcept = 0; // convenience method - const vespalib::string &cluster_name() const noexcept { + const std::string &cluster_name() const noexcept { return *cluster_name_ptr(); } }; @@ -32,12 +32,12 @@ struct ClusterContext { * Simple ClusterContext with an exposed string. **/ struct SimpleClusterContext : ClusterContext { - vespalib::string my_cluster_name; - const vespalib::string * cluster_name_ptr() const noexcept override { + std::string my_cluster_name; + const std::string * cluster_name_ptr() const noexcept override { return &my_cluster_name; } SimpleClusterContext() : my_cluster_name("") {} - explicit SimpleClusterContext(const vespalib::string& value) + explicit SimpleClusterContext(const std::string& value) : my_cluster_name(value) {} ~SimpleClusterContext() override = default; diff --git a/storage/src/vespa/storage/common/node_identity.h b/storage/src/vespa/storage/common/node_identity.h index 789bb41c8585..1b65702dfa9f 100644 --- a/storage/src/vespa/storage/common/node_identity.h +++ b/storage/src/vespa/storage/common/node_identity.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include namespace storage { @@ -12,7 +12,7 @@ namespace storage { */ class NodeIdentity { private: - vespalib::string _cluster_name; + std::string _cluster_name; const lib::NodeType& _node_type; uint16_t _node_index; @@ -20,7 +20,7 @@ class NodeIdentity { NodeIdentity(std::string_view cluster_name_in, const lib::NodeType& node_type_in, uint16_t node_index_in); - const vespalib::string& cluster_name() const { return _cluster_name; } + const std::string& cluster_name() const { return _cluster_name; } const lib::NodeType& node_type() const { return _node_type; } uint16_t node_index() const { return _node_index; } }; diff --git a/storage/src/vespa/storage/common/nodestateupdater.h b/storage/src/vespa/storage/common/nodestateupdater.h index d06731639fa4..f2bffc5c71dc 100644 --- a/storage/src/vespa/storage/common/nodestateupdater.h +++ b/storage/src/vespa/storage/common/nodestateupdater.h @@ -23,9 +23,9 @@ */ #pragma once -#include #include #include "vespa/vespalib/util/jsonstream.h" +#include namespace metrics { class JsonWriter; } namespace storage { diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.cpp b/storage/src/vespa/storage/common/statusmetricconsumer.cpp index 7d26276473b3..a9de3a0d3c7b 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.cpp +++ b/storage/src/vespa/storage/common/statusmetricconsumer.cpp @@ -29,7 +29,7 @@ StatusMetricConsumer::StatusMetricConsumer(StorageComponentRegister& compReg, me StatusMetricConsumer::~StatusMetricConsumer() = default; -vespalib::string +std::string StatusMetricConsumer::getReportContentType(const framework::HttpUrlPath& path) const { if (!path.hasAttribute("format")) { diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.h b/storage/src/vespa/storage/common/statusmetricconsumer.h index a59d9cfaa950..fc4d9d8bb980 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.h +++ b/storage/src/vespa/storage/common/statusmetricconsumer.h @@ -29,7 +29,7 @@ class StatusMetricConsumer : public framework::StatusReporter, CapabilitySet required_capabilities() const noexcept override { return CapabilitySet::of({ Capability::content_metrics_api() }); } - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream& out, const framework::HttpUrlPath&) const override; private: metrics::MetricManager& _manager; diff --git a/storage/src/vespa/storage/common/storagecomponent.cpp b/storage/src/vespa/storage/common/storagecomponent.cpp index 7c48aa4f4e06..dfed11f3954f 100644 --- a/storage/src/vespa/storage/common/storagecomponent.cpp +++ b/storage/src/vespa/storage/common/storagecomponent.cpp @@ -94,7 +94,7 @@ StorageComponent::getStateUpdater() const return *_nodeStateUpdater; } -vespalib::string +std::string StorageComponent::getIdentity() const { vespalib::asciistream name; diff --git a/storage/src/vespa/storage/common/storagecomponent.h b/storage/src/vespa/storage/common/storagecomponent.h index 0d61734a392d..ac070223d583 100644 --- a/storage/src/vespa/storage/common/storagecomponent.h +++ b/storage/src/vespa/storage/common/storagecomponent.h @@ -88,7 +88,7 @@ class StorageComponent : public framework::Component uint16_t getIndex() const { return _index; } lib::Node getNode() const { return lib::Node(*_nodeType, _index); } - vespalib::string getIdentity() const; + std::string getIdentity() const; std::shared_ptr getTypeRepo() const; const document::BucketIdFactory& getBucketIdFactory() const { return _bucketIdFactory; } diff --git a/storage/src/vespa/storage/distributor/activecopy.cpp b/storage/src/vespa/storage/distributor/activecopy.cpp index bc9750465a2b..085a05192156 100644 --- a/storage/src/vespa/storage/distributor/activecopy.cpp +++ b/storage/src/vespa/storage/distributor/activecopy.cpp @@ -26,7 +26,7 @@ namespace storage::distributor { using IndexList = lib::Distribution::IndexList; -vespalib::string +std::string ActiveCopy::getReason() const { vespalib::asciistream ost; if (_ready && (_doc_count > 0) && valid_ideal()) { diff --git a/storage/src/vespa/storage/distributor/activecopy.h b/storage/src/vespa/storage/distributor/activecopy.h index 19340cfcfd33..f669ace57bd5 100644 --- a/storage/src/vespa/storage/distributor/activecopy.h +++ b/storage/src/vespa/storage/distributor/activecopy.h @@ -32,7 +32,7 @@ class ActiveCopy { _active(copy.active()) { } - vespalib::string getReason() const; + std::string getReason() const; friend std::ostream& operator<<(std::ostream& out, const ActiveCopy& e); static ActiveList calculate(const Node2Index & idealState, const lib::Distribution&, diff --git a/storage/src/vespa/storage/distributor/bucket_spaces_stats_provider.h b/storage/src/vespa/storage/distributor/bucket_spaces_stats_provider.h index 232973732d9d..c769d47875f9 100644 --- a/storage/src/vespa/storage/distributor/bucket_spaces_stats_provider.h +++ b/storage/src/vespa/storage/distributor/bucket_spaces_stats_provider.h @@ -1,9 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include #include +#include #include namespace storage::distributor { @@ -55,7 +56,7 @@ std::ostream& operator<<(std::ostream& out, const BucketSpaceStats& stats); class BucketSpacesStatsProvider { public: // Mapping from bucket space name to statistics for that bucket space. - using BucketSpacesStats = std::map; + using BucketSpacesStats = std::map; // Mapping from content node index to statistics for all bucket spaces on that node. using PerNodeBucketSpacesStats = std::unordered_map; diff --git a/storage/src/vespa/storage/distributor/clusterinformation.h b/storage/src/vespa/storage/distributor/clusterinformation.h index 6c3edba94367..af23d058bc12 100644 --- a/storage/src/vespa/storage/distributor/clusterinformation.h +++ b/storage/src/vespa/storage/distributor/clusterinformation.h @@ -2,10 +2,10 @@ #pragma once #include -#include #include -#include #include +#include +#include namespace storage::lib { class ClusterStateBundle; } diff --git a/storage/src/vespa/storage/distributor/crypto_uuid_generator.cpp b/storage/src/vespa/storage/distributor/crypto_uuid_generator.cpp index e437554de8d9..ac89782d3d6c 100644 --- a/storage/src/vespa/storage/distributor/crypto_uuid_generator.cpp +++ b/storage/src/vespa/storage/distributor/crypto_uuid_generator.cpp @@ -5,11 +5,11 @@ namespace storage::distributor { -vespalib::string CryptoUuidGenerator::generate_uuid() const { +std::string CryptoUuidGenerator::generate_uuid() const { unsigned char rand_buf[16]; vespalib::crypto::random_buffer(rand_buf, sizeof(rand_buf)); const char hex[16+1] = "0123456789abcdef"; - vespalib::string ret(sizeof(rand_buf) * 2, '\0'); + std::string ret(sizeof(rand_buf) * 2, '\0'); for (size_t i = 0; i < sizeof(rand_buf); ++i) { ret[i*2 + 0] = hex[rand_buf[i] >> 4]; ret[i*2 + 1] = hex[rand_buf[i] & 0x0f]; diff --git a/storage/src/vespa/storage/distributor/crypto_uuid_generator.h b/storage/src/vespa/storage/distributor/crypto_uuid_generator.h index 0fd1dac36212..d330f9c0f9df 100644 --- a/storage/src/vespa/storage/distributor/crypto_uuid_generator.h +++ b/storage/src/vespa/storage/distributor/crypto_uuid_generator.h @@ -12,7 +12,7 @@ namespace storage::distributor { class CryptoUuidGenerator : public UuidGenerator { public: ~CryptoUuidGenerator() override = default; - vespalib::string generate_uuid() const override; + std::string generate_uuid() const override; }; } diff --git a/storage/src/vespa/storage/distributor/distributor_component.h b/storage/src/vespa/storage/distributor/distributor_component.h index 5202bd554c13..4580619cee7e 100644 --- a/storage/src/vespa/storage/distributor/distributor_component.h +++ b/storage/src/vespa/storage/distributor/distributor_component.h @@ -36,7 +36,7 @@ class DistributorComponent : public storage::DistributorComponent, // TODO STRIPE: Unify implementation of this interface between DistributorComponent and DistributorStripeComponent? // Implements DistributorNodeContext const framework::Clock& clock() const noexcept override { return getClock(); } - const vespalib::string* cluster_name_ptr() const noexcept override { return cluster_context().cluster_name_ptr(); } + const std::string* cluster_name_ptr() const noexcept override { return cluster_context().cluster_name_ptr(); } const document::BucketIdFactory& bucket_id_factory() const noexcept override { return getBucketIdFactory(); } uint16_t node_index() const noexcept override { return getIndex(); } api::StorageMessageAddress node_address(uint16_t node_index) const noexcept override; diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.cpp b/storage/src/vespa/storage/distributor/distributor_stripe.cpp index 2b3fb4bda60c..c88e196ec7fd 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe.cpp @@ -708,7 +708,7 @@ toBucketSpacesStats(const NodeMaintenanceStatsTracker &maintenanceStats) { PerNodeBucketSpacesStats result; for (const auto &entry : maintenanceStats.perNodeStats()) { - const vespalib::string & bucketSpace(document::FixedBucketSpaces::to_string(entry.first.bucketSpace())); + const std::string & bucketSpace(document::FixedBucketSpaces::to_string(entry.first.bucketSpace())); result[entry.first.node()][bucketSpace] = toBucketSpaceStats(entry.second); } return result; diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp index a7dcb58699e4..dc0ea2480f10 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp @@ -241,7 +241,7 @@ DistributorStripeComponent::node_supported_features_repo() const noexcept } std::unique_ptr -DistributorStripeComponent::parse_selection(const vespalib::string& selection) const +DistributorStripeComponent::parse_selection(const std::string& selection) const { document::select::Parser parser(*getTypeRepo()->documentTypeRepo, getBucketIdFactory()); return parser.parse(selection); diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.h b/storage/src/vespa/storage/distributor/distributor_stripe_component.h index 22aefe8dc94d..5016da28d639 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_component.h +++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.h @@ -52,7 +52,7 @@ class DistributorStripeComponent : public storage::DistributorComponent, // Implements DistributorNodeContext const framework::Clock& clock() const noexcept override { return getClock(); } - const vespalib::string * cluster_name_ptr() const noexcept override { return cluster_context().cluster_name_ptr(); } + const std::string * cluster_name_ptr() const noexcept override { return cluster_context().cluster_name_ptr(); } const document::BucketIdFactory& bucket_id_factory() const noexcept override { return getBucketIdFactory(); } uint16_t node_index() const noexcept override { return getIndex(); } @@ -151,7 +151,7 @@ class DistributorStripeComponent : public storage::DistributorComponent, const NodeSupportedFeaturesRepo& node_supported_features_repo() const noexcept override; // Implements DocumentSelectionParser - std::unique_ptr parse_selection(const vespalib::string& selection) const override; + std::unique_ptr parse_selection(const std::string& selection) const override; private: DistributorStripeInterface& _distributor; diff --git a/storage/src/vespa/storage/distributor/distributormessagesender.h b/storage/src/vespa/storage/distributor/distributormessagesender.h index 44f61896933c..d511b2effe19 100644 --- a/storage/src/vespa/storage/distributor/distributormessagesender.h +++ b/storage/src/vespa/storage/distributor/distributormessagesender.h @@ -3,7 +3,7 @@ #include #include -#include +#include namespace storage::lib { class NodeType; } namespace storage::distributor { diff --git a/storage/src/vespa/storage/distributor/distributormetricsset.cpp b/storage/src/vespa/storage/distributor/distributormetricsset.cpp index d808569f363a..4ed8cf2e5025 100644 --- a/storage/src/vespa/storage/distributor/distributormetricsset.cpp +++ b/storage/src/vespa/storage/distributor/distributormetricsset.cpp @@ -6,7 +6,7 @@ namespace storage::distributor { using metrics::MetricSet; -BucketDbMetrics::BucketDbMetrics(const vespalib::string& db_type, metrics::MetricSet* owner) +BucketDbMetrics::BucketDbMetrics(const std::string& db_type, metrics::MetricSet* owner) : metrics::MetricSet("bucket_db", {{"bucket_db_type", db_type}}, "", owner), memory_usage(this) {} diff --git a/storage/src/vespa/storage/distributor/distributormetricsset.h b/storage/src/vespa/storage/distributor/distributormetricsset.h index c3e157fb8270..3ad1a25e4913 100644 --- a/storage/src/vespa/storage/distributor/distributormetricsset.h +++ b/storage/src/vespa/storage/distributor/distributormetricsset.h @@ -11,7 +11,7 @@ namespace vespalib { class MemoryUsage; } namespace storage::distributor { struct BucketDbMetrics : metrics::MetricSet { - BucketDbMetrics(const vespalib::string& db_type, metrics::MetricSet* owner); + BucketDbMetrics(const std::string& db_type, metrics::MetricSet* owner); ~BucketDbMetrics() override; metrics::MemoryUsageMetrics memory_usage; diff --git a/storage/src/vespa/storage/distributor/document_selection_parser.h b/storage/src/vespa/storage/distributor/document_selection_parser.h index 09bd8be00234..f27cd061cf05 100644 --- a/storage/src/vespa/storage/distributor/document_selection_parser.h +++ b/storage/src/vespa/storage/distributor/document_selection_parser.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace document::select { class Node; } @@ -15,7 +15,7 @@ namespace storage::distributor { class DocumentSelectionParser { public: virtual ~DocumentSelectionParser() = default; - virtual std::unique_ptr parse_selection(const vespalib::string& str) const = 0; + virtual std::unique_ptr parse_selection(const std::string& str) const = 0; }; } diff --git a/storage/src/vespa/storage/distributor/messagetracker.h b/storage/src/vespa/storage/distributor/messagetracker.h index 46765f0081f1..dccf4923af80 100644 --- a/storage/src/vespa/storage/distributor/messagetracker.h +++ b/storage/src/vespa/storage/distributor/messagetracker.h @@ -3,8 +3,8 @@ #include #include -#include #include +#include namespace storage::api { class BucketCommand; diff --git a/storage/src/vespa/storage/distributor/operation_sequencer.cpp b/storage/src/vespa/storage/distributor/operation_sequencer.cpp index b64fcbac4083..044d33c43d17 100644 --- a/storage/src/vespa/storage/distributor/operation_sequencer.cpp +++ b/storage/src/vespa/storage/distributor/operation_sequencer.cpp @@ -40,7 +40,7 @@ SequencingHandle OperationSequencer::try_acquire(document::BucketSpace bucket_sp } SequencingHandle OperationSequencer::try_acquire(const document::Bucket& bucket, - const vespalib::string& token) { + const std::string& token) { const auto inserted = _active_buckets.insert(std::make_pair(bucket, token)); if (inserted.second) { return SequencingHandle(*this, bucket); diff --git a/storage/src/vespa/storage/distributor/operation_sequencer.h b/storage/src/vespa/storage/distributor/operation_sequencer.h index 194a083d7fe0..643a4df2bb62 100644 --- a/storage/src/vespa/storage/distributor/operation_sequencer.h +++ b/storage/src/vespa/storage/distributor/operation_sequencer.h @@ -28,7 +28,7 @@ class SequencingHandle { public: struct BlockedByPendingOperation {}; struct BlockedByLockedBucket { - vespalib::string lock_token; + std::string lock_token; BlockedByLockedBucket() = default; explicit BlockedByLockedBucket(std::string_view token) : lock_token(token) {} @@ -132,7 +132,7 @@ class SequencingHandle { */ class OperationSequencer { using GidSet = vespalib::hash_set; - using BucketLocks = vespalib::hash_map; + using BucketLocks = vespalib::hash_map; GidSet _active_gids; BucketLocks _active_buckets; @@ -147,7 +147,7 @@ class OperationSequencer { // any bucket that may contain `id`. SequencingHandle try_acquire(document::BucketSpace bucket_space, const document::DocumentId& id); - SequencingHandle try_acquire(const document::Bucket& bucket, const vespalib::string& token); + SequencingHandle try_acquire(const document::Bucket& bucket, const std::string& token); bool is_blocked(const document::Bucket&) const noexcept; private: diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp index a92896279b0c..104a2954d538 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp index 7c567e15a77a..c12500d5aedd 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include LOG_SETUP(".distributor.operations.external.remove"); diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp index 738a5c6e13a0..effef1075486 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp @@ -727,7 +727,7 @@ TwoPhaseUpdateOperation::on_cancel(DistributorStripeMessageSender& sender, const } } -vespalib::string TwoPhaseUpdateOperation::update_doc_id() const { +std::string TwoPhaseUpdateOperation::update_doc_id() const { assert(_updateCmd.get() != nullptr); return _updateCmd->getDocumentId().toString(); } diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h index 5c9a3a030bcf..8b7d509a59d3 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h @@ -136,7 +136,7 @@ class TwoPhaseUpdateOperation : public SequencedOperation [[nodiscard]] bool replica_set_unchanged_after_get_operation() const; void restart_with_fast_path_due_to_consistent_get_timestamps(DistributorStripeMessageSender& sender); // Precondition: reply has not yet been sent. - [[nodiscard]] vespalib::string update_doc_id() const; + [[nodiscard]] std::string update_doc_id() const; using ReplicaState = std::vector>; diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp index 5b8422e6a86f..c7b27883e34b 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp @@ -38,7 +38,7 @@ VisitorOperation::BucketInfo::print(vespalib::asciistream & out) const VisitorOperation::BucketInfo::~BucketInfo() = default; -vespalib::string +std::string VisitorOperation::BucketInfo::toString() const { vespalib::asciistream ost; @@ -185,7 +185,7 @@ VisitorOperation::markOperationAsFailedDueToNodeError( result.getResult(), vespalib::make_string("[from content node %u] %s", fromFailingNodeIndex, - vespalib::string(result.getMessage()).c_str())); + std::string(result.getMessage()).c_str())); } void @@ -252,7 +252,7 @@ VisitorOperation::verifyDistributorsAreAvailable() { const lib::ClusterState& clusterState = _bucketSpace.getClusterState(); if (clusterState.getNodeCount(lib::NodeType::DISTRIBUTOR) == 0) { - vespalib::string err(vespalib::make_string( + std::string err(vespalib::make_string( "No distributors available when processing visitor '%s'", _msg->getInstanceId().c_str())); LOG(debug, "%s", err.c_str()); @@ -318,7 +318,7 @@ VisitorOperation::verifyOperationContainsBuckets() { size_t bucketCount = _msg->getBuckets().size(); if (bucketCount == 0) { - vespalib::string errorMsg = vespalib::make_string( + std::string errorMsg = vespalib::make_string( "No buckets in CreateVisitorCommand for visitor '%s'", _msg->getInstanceId().c_str()); throw VisitorVerificationException(api::ReturnCode::ILLEGAL_PARAMETERS, errorMsg); @@ -330,7 +330,7 @@ VisitorOperation::verifyOperationHasSuperbucketAndProgress() { size_t bucketCount = _msg->getBuckets().size(); if (bucketCount != 2) { - vespalib::string errorMsg = vespalib::make_string( + std::string errorMsg = vespalib::make_string( "CreateVisitorCommand does not contain 2 buckets for visitor '%s'", _msg->getInstanceId().c_str()); throw VisitorVerificationException(api::ReturnCode::ILLEGAL_PARAMETERS, errorMsg); @@ -813,7 +813,7 @@ VisitorOperation::sendStorageVisitor(uint16_t node, os << _msg->getInstanceId() << '-' << _node_ctx.node_index() << '-' << cmd->getMsgId(); - vespalib::string storageInstanceId(os.view()); + std::string storageInstanceId(os.view()); cmd->setInstanceId(storageInstanceId); cmd->setAddress(api::StorageMessageAddress::create(_node_ctx.cluster_name_ptr(), lib::NodeType::STORAGE, node)); cmd->setMaximumPendingReplyCount(pending); @@ -914,7 +914,7 @@ VisitorOperation::assign_bucket_lock_handle(SequencingHandle handle) } void -VisitorOperation::assign_put_lock_access_token(const vespalib::string& token) +VisitorOperation::assign_put_lock_access_token(const std::string& token) { _put_lock_token = token; } diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h index 2916e2ea9632..4c4211a51a05 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h @@ -62,7 +62,7 @@ class VisitorOperation : public Operation [[nodiscard]] bool is_read_for_write() const noexcept { return _is_read_for_write; } [[nodiscard]] std::optional first_bucket_to_visit() const; void assign_bucket_lock_handle(SequencingHandle handle); - void assign_put_lock_access_token(const vespalib::string& token); + void assign_put_lock_access_token(const std::string& token); private: struct BucketInfo { @@ -75,7 +75,7 @@ class VisitorOperation : public Operation ~BucketInfo(); void print(vespalib::asciistream & out) const; - vespalib::string toString() const; + std::string toString() const; }; using VisitBucketMap = std::map; @@ -182,7 +182,7 @@ class VisitorOperation : public Operation mbus::TraceNode trace; framework::MilliSecTimer _operationTimer; SequencingHandle _bucket_lock; - vespalib::string _put_lock_token; + std::string _put_lock_token; bool _sentReply; bool _verified_and_expanded; bool _is_read_for_write; diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp index 0a916d208adb..8e5e671e0129 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp @@ -74,7 +74,7 @@ RemoveBucketOperation::onReceiveInternal(const std::shared_ptrgetResult().getMessage()).c_str(), + std::string(rep->getResult().getMessage()).c_str(), rep->getBucketInfo().toString().c_str()); _manager->operation_context().update_bucket_database( diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp index 647812f2bde4..4542da6bf83e 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp @@ -104,7 +104,7 @@ SplitOperation::onReceive(DistributorStripeMessageSender&, const api::StorageRep { _manager->operation_context().recheck_bucket_info(node, getBucket()); LOGBP(debug, "Split failed for %s: bucket not found. Storage and distributor bucket databases might be out of sync: %s", - getBucketId().toString().c_str(), vespalib::string(rep.getResult().getMessage()).c_str()); + getBucketId().toString().c_str(), std::string(rep.getResult().getMessage()).c_str()); _ok = false; } else if (rep.getResult().isBusy()) { LOG(debug, "Split failed for %s, node was busy. Will retry later", getBucketId().toString().c_str()); diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index 657dc0eec7b0..47316d23caf8 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -189,7 +189,7 @@ void PendingClusterState::requestNode(BucketSpaceAndNode bucketSpaceAndNode) { const auto &distribution = _bucket_space_states.get(bucketSpaceAndNode.bucketSpace).get_distribution(); - vespalib::string distributionHash = distribution.getNodeGraph().getDistributionConfigHash(); + std::string distributionHash = distribution.getNodeGraph().getDistributionConfigHash(); LOG(debug, "Requesting bucket info for bucket space %" PRIu64 " node %d with cluster state '%s' and distribution hash '%s'", diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp index 0a221138f57e..d70cdac4d6d9 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp @@ -35,7 +35,7 @@ PendingMessageTracker::MessageEntry::MessageEntry(TimePoint timeStamp_, uint32_t nodeIdx(nodeIdx_) { } -vespalib::string +std::string PendingMessageTracker::MessageEntry::toHtml() const { vespalib::asciistream ss; ss << "
  • Node " << nodeIdx << ": " @@ -306,7 +306,7 @@ PendingMessageTracker::getStatusPerBucket(std::ostream& out) const { std::lock_guard guard(_lock); const auto& msgs = boost::multi_index::get(_messages); - using BucketMap = std::map>; + using BucketMap = std::map>; BucketMap perBucketMsgs; for (const auto& msg : msgs) { perBucketMsgs[msg.bucket].emplace_back(msg.toHtml()); diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.h b/storage/src/vespa/storage/distributor/pendingmessagetracker.h index d5f42f245456..97f1c419168e 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.h +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.h @@ -142,7 +142,7 @@ class PendingMessageTracker : public framework::HtmlStatusReporter { MessageEntry(TimePoint timeStamp, uint32_t msgType, uint32_t priority, uint64_t msgId, document::Bucket bucket, uint16_t nodeIdx) noexcept; - [[nodiscard]] vespalib::string toHtml() const; + [[nodiscard]] std::string toHtml() const; }; struct MessageIdKey : boost::multi_index::member {}; diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp index 1cdd846b544b..bade3afe8a68 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.cpp +++ b/storage/src/vespa/storage/distributor/statecheckers.cpp @@ -461,7 +461,7 @@ SplitInconsistentStateChecker::getHighestUsedBits(const std::vector& entries) { vespalib::asciistream reason; diff --git a/storage/src/vespa/storage/distributor/statecheckers.h b/storage/src/vespa/storage/distributor/statecheckers.h index b27f9c6cf454..9d3f5e8e9cdb 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.h +++ b/storage/src/vespa/storage/distributor/statecheckers.h @@ -68,7 +68,7 @@ class SplitInconsistentStateChecker : public StateChecker private: static bool isLeastSplitBucket(const document::BucketId& bucket,const std::vector& entries); static uint32_t getHighestUsedBits(const std::vector& entries); - static vespalib::string getReason(const document::BucketId& bucketId, const std::vector& entries); + static std::string getReason(const document::BucketId& bucketId, const std::vector& entries); }; class ActiveList; diff --git a/storage/src/vespa/storage/distributor/statusreporterdelegate.cpp b/storage/src/vespa/storage/distributor/statusreporterdelegate.cpp index 0575574804c1..db0fb4949140 100644 --- a/storage/src/vespa/storage/distributor/statusreporterdelegate.cpp +++ b/storage/src/vespa/storage/distributor/statusreporterdelegate.cpp @@ -17,7 +17,7 @@ StatusReporterDelegate::StatusReporterDelegate( StatusReporterDelegate::~StatusReporterDelegate() = default; -vespalib::string +std::string StatusReporterDelegate::getReportContentType(const framework::HttpUrlPath& path) const { // Implementation must be data race free. diff --git a/storage/src/vespa/storage/distributor/statusreporterdelegate.h b/storage/src/vespa/storage/distributor/statusreporterdelegate.h index 50a9c8d02671..894c4c7542a3 100644 --- a/storage/src/vespa/storage/distributor/statusreporterdelegate.h +++ b/storage/src/vespa/storage/distributor/statusreporterdelegate.h @@ -20,7 +20,7 @@ class StatusReporterDelegate ~StatusReporterDelegate() override; void registerStatusPage(); - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; diff --git a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp index e8c92b7e61a0..1e3eafa1b6d2 100644 --- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp +++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp @@ -579,7 +579,7 @@ void StripeBucketDBUpdater::simulate_cluster_state_bundle_activation(const lib:: _distributor_interface.enableClusterStateBundle(activated_state); } -vespalib::string +std::string StripeBucketDBUpdater::getReportContentType(const framework::HttpUrlPath&) const { return "text/xml"; @@ -587,9 +587,9 @@ StripeBucketDBUpdater::getReportContentType(const framework::HttpUrlPath&) const namespace { -const vespalib::string ALL = "all"; -const vespalib::string BUCKETDB = "bucketdb"; -const vespalib::string BUCKETDB_UPDATER = "Bucket Database Updater"; +const std::string ALL = "all"; +const std::string BUCKETDB = "bucketdb"; +const std::string BUCKETDB_UPDATER = "Bucket Database Updater"; } @@ -625,7 +625,7 @@ StripeBucketDBUpdater::reportStatus(std::ostream& out, return true; } -vespalib::string +std::string StripeBucketDBUpdater::reportXmlStatus(vespalib::xml::XmlOutputStream& xos, const framework::HttpUrlPath&) const { diff --git a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h index f3b276cd7d43..fa69b325e781 100644 --- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h +++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.h @@ -52,8 +52,8 @@ class StripeBucketDBUpdater final void resendDelayedMessages(); [[nodiscard]] bool cancel_message_by_id(uint64_t msg_id); - vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const framework::HttpUrlPath&) const; - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const framework::HttpUrlPath&) const; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; // Functions used for state reporting when a StripeAccessGuard is held. diff --git a/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.cpp b/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.cpp index 761514b580fa..d80c844cddf1 100644 --- a/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.cpp +++ b/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.cpp @@ -475,7 +475,7 @@ TopLevelBucketDBUpdater::add_current_state_to_cluster_state_history() } } -vespalib::string +std::string TopLevelBucketDBUpdater::getReportContentType(const framework::HttpUrlPath&) const { return "text/xml"; @@ -483,8 +483,8 @@ TopLevelBucketDBUpdater::getReportContentType(const framework::HttpUrlPath&) con namespace { -const vespalib::string BUCKETDB = "bucketdb"; -const vespalib::string BUCKETDB_UPDATER = "Bucket Database Updater"; +const std::string BUCKETDB = "bucketdb"; +const std::string BUCKETDB_UPDATER = "Bucket Database Updater"; } @@ -505,7 +505,7 @@ TopLevelBucketDBUpdater::reportStatus(std::ostream& out, return true; } -vespalib::string +std::string TopLevelBucketDBUpdater::report_xml_status(vespalib::xml::XmlOutputStream& xos, const framework::HttpUrlPath&) const { diff --git a/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.h b/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.h index ef3838f5785e..988f9c5c8df5 100644 --- a/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.h +++ b/storage/src/vespa/storage/distributor/top_level_bucket_db_updater.h @@ -56,7 +56,7 @@ class TopLevelBucketDBUpdater : public framework::StatusReporter, bool onActivateClusterStateVersion(const std::shared_ptr& cmd) override; bool onRequestBucketInfoReply(const std::shared_ptr & repl) override; - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; void resend_delayed_messages(); @@ -64,7 +64,7 @@ class TopLevelBucketDBUpdater : public framework::StatusReporter, void bootstrap_distribution_config(std::shared_ptr); void propagate_distribution_config(const lib::BucketSpaceDistributionConfigs& configs); - vespalib::string report_xml_status(vespalib::xml::XmlOutputStream& xos, const framework::HttpUrlPath&) const; + std::string report_xml_status(vespalib::xml::XmlOutputStream& xos, const framework::HttpUrlPath&) const; void print(std::ostream& out, bool verbose, const std::string& indent) const; diff --git a/storage/src/vespa/storage/distributor/top_level_distributor.cpp b/storage/src/vespa/storage/distributor/top_level_distributor.cpp index 738dfb2c00e1..c6d55cc9e61b 100644 --- a/storage/src/vespa/storage/distributor/top_level_distributor.cpp +++ b/storage/src/vespa/storage/distributor/top_level_distributor.cpp @@ -604,7 +604,7 @@ TopLevelDistributor::work_was_done() const noexcept return !_tickResult.waitWanted(); } -vespalib::string +std::string TopLevelDistributor::getReportContentType(const framework::HttpUrlPath& path) const { if (path.hasAttribute("page")) { diff --git a/storage/src/vespa/storage/distributor/top_level_distributor.h b/storage/src/vespa/storage/distributor/top_level_distributor.h index 2c9d5057339b..5541d6dd6117 100644 --- a/storage/src/vespa/storage/distributor/top_level_distributor.h +++ b/storage/src/vespa/storage/distributor/top_level_distributor.h @@ -107,7 +107,7 @@ class TopLevelDistributor final void revert_distribution_source_of_truth_to_node_internal_config() override; // StatusReporter implementation - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; bool handleStatusRequest(const DelegatedStatusRequest& request) const override; diff --git a/storage/src/vespa/storage/distributor/uuid_generator.h b/storage/src/vespa/storage/distributor/uuid_generator.h index afe8de04da07..80e8cabd73fa 100644 --- a/storage/src/vespa/storage/distributor/uuid_generator.h +++ b/storage/src/vespa/storage/distributor/uuid_generator.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace storage::distributor { @@ -13,7 +13,7 @@ class UuidGenerator { public: virtual ~UuidGenerator() = default; // Returns a string that is guaranteed ASCII-only - virtual vespalib::string generate_uuid() const = 0; + virtual std::string generate_uuid() const = 0; }; } diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index 93f0db39f971..ab31b37bceb7 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -23,7 +23,7 @@ class StorageComponentRegisterImpl std::mutex _componentLock; std::vector _components; - vespalib::string _clusterName; + std::string _clusterName; const lib::NodeType* _nodeType; uint16_t _index; std::shared_ptr _docTypeRepo; diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index f89d6188b883..9df5fbd866bc 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -180,7 +180,7 @@ StatusWebServer::invoke_reporter(const framework::StatusReporter& reporter, void StatusWebServer::handlePage(const framework::HttpUrlPath& urlpath, vespalib::Portal::GetRequest request) { - vespalib::string link(urlpath.getPath()); + std::string link(urlpath.getPath()); // We allow a fixed path prefix that aliases down to whatever is provided after the prefix. std::string_view optional_status_path_prefix = "/contentnode-status/v1/"; diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index d92bd37ae341..de280808bc2c 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -55,9 +55,9 @@ class StatusWebServer : private config::IFetcherCallback; - vespalib::string _url; - vespalib::string _serverSpec; - std::unique_ptr _result; + std::string _url; + std::string _serverSpec; + std::unique_ptr _result; HttpRequest(std::string_view url, std::string_view serverSpec) : _url(url), diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp index e381b6999a5c..557312e625db 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp @@ -69,10 +69,10 @@ DeadLockDetector::enableShutdown(bool enable) namespace { struct VisitorWrapper : public framework::ThreadVisitor { - std::map& _states; + std::map& _states; DeadLockDetector::ThreadVisitor& _visitor; - VisitorWrapper(std::map& s, + VisitorWrapper(std::map& s, DeadLockDetector::ThreadVisitor& visitor) : _states(s), _visitor(visitor) @@ -119,7 +119,7 @@ DeadLockDetector::isAboveWarnThreshold(vespalib::steady_time time, return (tick._lastTick + tp.getMaxCycleTime() + slack / 4 < time); } -vespalib::string +std::string DeadLockDetector::getBucketLockInfo() const { vespalib::asciistream ost; @@ -175,7 +175,7 @@ namespace { void DeadLockDetector::handleDeadlock(vespalib::steady_time currentTime, const framework::Thread& deadlocked_thread, - const vespalib::string& id, + const std::string& id, const framework::ThreadProperties&, const framework::ThreadTickData& tick, bool warnOnly) @@ -199,12 +199,12 @@ DeadLockDetector::handleDeadlock(vespalib::steady_time currentTime, } if (warnOnly) { if (warning_enabled) { - LOGBT(warning, "deadlockw-" + id, "%s", vespalib::string(error.view()).c_str()); + LOGBT(warning, "deadlockw-" + id, "%s", std::string(error.view()).c_str()); } return; } else { if (shutdown_enabled || warning_enabled) { - LOGBT(error, "deadlock-" + id, "%s", vespalib::string(error.view()).c_str()); + LOGBT(error, "deadlock-" + id, "%s", std::string(error.view()).c_str()); } } if (shutdown_enabled) { @@ -258,7 +258,7 @@ namespace { : _table(table), _time(time) {} template - vespalib::string toS(const T& val) { + std::string toS(const T& val) { vespalib::asciistream ost; ost << val; return ost.str(); diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h index 5d78bfb3969a..8be12e23cbb4 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h @@ -68,7 +68,7 @@ struct DeadLockDetector : private framework::Runnable, const framework::ThreadTickData& tick) const; void handleDeadlock(vespalib::steady_time currentTime, const framework::Thread& deadlocked_thread, - const vespalib::string& id, + const std::string& id, const framework::ThreadProperties& tp, const framework::ThreadTickData& tick, bool warnOnly); @@ -83,7 +83,7 @@ struct DeadLockDetector : private framework::Runnable, private: AppKiller::UP _killer; - mutable std::map _states; + mutable std::map _states; mutable std::mutex _lock; std::condition_variable _cond; std::atomic _enableWarning; @@ -97,7 +97,7 @@ struct DeadLockDetector : private framework::Runnable, void run(framework::ThreadHandle&) override; void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override; - vespalib::string getBucketLockInfo() const; + std::string getBucketLockInfo() const; }; } diff --git a/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h b/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h index e1515fa8b1bf..f654c8a3a452 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h @@ -4,10 +4,10 @@ #include #include +#include #include #include #include -#include namespace storage { diff --git a/storage/src/vespa/storage/persistence/apply_bucket_diff_state.cpp b/storage/src/vespa/storage/persistence/apply_bucket_diff_state.cpp index a90079d40b24..962d94e4d931 100644 --- a/storage/src/vespa/storage/persistence/apply_bucket_diff_state.cpp +++ b/storage/src/vespa/storage/persistence/apply_bucket_diff_state.cpp @@ -107,10 +107,10 @@ ApplyBucketDiffState::sync_bucket_info() } } -std::future +std::future ApplyBucketDiffState::get_future() { - _promise = std::promise(); + _promise = std::promise(); return _promise.value().get_future(); } diff --git a/storage/src/vespa/storage/persistence/apply_bucket_diff_state.h b/storage/src/vespa/storage/persistence/apply_bucket_diff_state.h index b806ce80a3a9..8d6aae1eebcc 100644 --- a/storage/src/vespa/storage/persistence/apply_bucket_diff_state.h +++ b/storage/src/vespa/storage/persistence/apply_bucket_diff_state.h @@ -31,10 +31,10 @@ class ApplyBucketDiffState { MergeHandlerMetrics& _merge_handler_metrics; framework::MilliSecTimer _start_time; spi::Bucket _bucket; - vespalib::string _fail_message; + std::string _fail_message; std::atomic_flag _failed_flag; bool _stale_bucket_info; - std::optional> _promise; + std::optional> _promise; std::unique_ptr _tracker; std::shared_ptr _delayed_reply; MessageSender* _sender; @@ -52,7 +52,7 @@ class ApplyBucketDiffState { void check(); void mark_stale_bucket_info(); void sync_bucket_info(); - std::future get_future(); + std::future get_future(); void set_delayed_reply(std::unique_ptr&& tracker, std::shared_ptr&& delayed_reply); void set_delayed_reply(std::unique_ptr&& tracker, MessageSender& sender, FileStorThreadMetrics::Op* op_metrics, const framework::MilliSecTimer& op_start_time, std::shared_ptr&& delayed_reply); void set_tracker(std::unique_ptr&& tracker); diff --git a/storage/src/vespa/storage/persistence/asynchandler.cpp b/storage/src/vespa/storage/persistence/asynchandler.cpp index 8ce4fd4d7423..aca7283fa1f1 100644 --- a/storage/src/vespa/storage/persistence/asynchandler.cpp +++ b/storage/src/vespa/storage/persistence/asynchandler.cpp @@ -284,7 +284,7 @@ AsyncHandler::handle_delete_bucket_throttling(api::DeleteBucketCommand& cmd, Mes for (auto& meta : meta_entries) { auto token = throttler.blocking_acquire_one(); remove_by_gid_metric->count.inc(); - std::vector to_remove = {{vespalib::string(meta->getDocumentType()), meta->getGid(), meta->getTimestamp()}}; + std::vector to_remove = {{std::string(meta->getDocumentType()), meta->getGid(), meta->getTimestamp()}}; auto task = makeResultTask([bucket = cmd.getBucket(), token = std::move(token), invoke_delete_on_zero_refs, remove_by_gid_metric, op_timer = framework::MilliSecTimer(_env._component.getClock())] @@ -297,7 +297,7 @@ AsyncHandler::handle_delete_bucket_throttling(api::DeleteBucketCommand& cmd, Mes // Nothing else clever to do here. Throttle token and deleteBucket dispatch refs dropped implicitly. }); LOG(spam, "%s: about to invoke removeByGidAsync(%s, %s, %" PRIu64 ")", cmd.getBucket().toString().c_str(), - vespalib::string(meta->getDocumentType()).c_str(), meta->getGid().toString().c_str(), meta->getTimestamp().getValue()); + std::string(meta->getDocumentType()).c_str(), meta->getGid().toString().c_str(), meta->getTimestamp().getValue()); _spi.removeByGidAsync(spi_bucket, std::move(to_remove), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); } // Actual bucket deletion happens when all remove ops have ACKed and dropped their refs to the destructor-invoked diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp b/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp index 74d1dfcd0bd7..eb5233c35902 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp @@ -124,7 +124,7 @@ MergeStatus::print(std::ostream& out, bool verbose, } void -MergeStatus::set_delayed_error(std::future&& delayed_error_in) +MergeStatus::set_delayed_error(std::future&& delayed_error_in) { delayed_error = std::move(delayed_error_in); } @@ -136,7 +136,7 @@ MergeStatus::check_delayed_error(api::ReturnCode &return_code) // Wait for pending writes to local node to complete and check error auto& future_error = delayed_error.value(); future_error.wait(); - vespalib::string fail_message = future_error.get(); + std::string fail_message = future_error.get(); delayed_error.reset(); if (!fail_message.empty()) { return_code = api::ReturnCode(api::ReturnCode::INTERNAL_FAILURE, std::move(fail_message)); diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h index 180859ac201e..405d9ee9bfdd 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h @@ -28,7 +28,7 @@ class MergeStatus : public document::Printable { std::shared_ptr pendingApplyDiff; vespalib::duration timeout; framework::MilliSecTimer startTime; - std::optional> delayed_error; + std::optional> delayed_error; spi::Context context; MergeStatus(const framework::Clock&, api::StorageMessage::Priority, uint32_t traceLevel); @@ -44,7 +44,7 @@ class MergeStatus : public document::Printable { bool removeFromDiff(const std::vector& part, uint16_t hasMask, const std::vector &nodes); void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool isFirstNode() const { return static_cast(reply); } - void set_delayed_error(std::future&& delayed_error_in); + void set_delayed_error(std::future&& delayed_error_in); void check_delayed_error(api::ReturnCode &return_code); }; diff --git a/storage/src/vespa/storage/persistence/filestorage/service_layer_host_info_reporter.cpp b/storage/src/vespa/storage/persistence/filestorage/service_layer_host_info_reporter.cpp index 4f0384dfcb02..79d898980622 100644 --- a/storage/src/vespa/storage/persistence/filestorage/service_layer_host_info_reporter.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/service_layer_host_info_reporter.cpp @@ -16,18 +16,18 @@ using End = vespalib::JsonStream::End; namespace { -const vespalib::string memory_label("memory"); -const vespalib::string disk_label("disk"); -const vespalib::string attribute_address_space_label("attribute-address-space"); +const std::string memory_label("memory"); +const std::string disk_label("disk"); +const std::string attribute_address_space_label("attribute-address-space"); -void write_usage(vespalib::JsonStream& output, const vespalib::string &label, double value) +void write_usage(vespalib::JsonStream& output, const std::string &label, double value) { output << label << Object(); output << "usage" << value; output << End(); } -void write_attribute_usage(vespalib::JsonStream& output, const vespalib::string &label, const spi::AttributeResourceUsage &usage) +void write_attribute_usage(vespalib::JsonStream& output, const std::string &label, const spi::AttributeResourceUsage &usage) { output << label << Object(); output << "usage" << usage.get_usage(); @@ -74,7 +74,7 @@ ServiceLayerHostInfoReporter::set_noise_level(double level) namespace { -vespalib::string +std::string to_string(const spi::ResourceUsage& usage) { std::ostringstream oss; diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index 0b365d135408..a514b9ff3161 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -319,7 +319,7 @@ namespace { return value; } - api::StorageMessageAddress createAddress(const vespalib::string * clusterName, uint16_t node) { + api::StorageMessageAddress createAddress(const std::string * clusterName, uint16_t node) { return api::StorageMessageAddress::create(clusterName, lib::NodeType::STORAGE, node); } diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp index c92e165f22bb..873cfc829056 100644 --- a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp +++ b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp @@ -13,7 +13,7 @@ LOG_SETUP(".persistence.simplemessagehandler"); using vespalib::make_string_short::fmt; -using to_str = vespalib::string; +using to_str = std::string; namespace storage { diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.h b/storage/src/vespa/storage/persistence/splitbitdetector.h index 994b808fb9db..90ff14246470 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.h +++ b/storage/src/vespa/storage/persistence/splitbitdetector.h @@ -37,7 +37,7 @@ struct SplitBitDetector ResultType _result; document::BucketId _target1; document::BucketId _target2; - vespalib::string _reason; + std::string _reason; bool _singleTarget; public: @@ -51,7 +51,7 @@ struct SplitBitDetector bool success() const { return (_result == OK); } bool failed() const { return (_result == ERROR); } bool empty() const { return (_result == EMPTY); } - const vespalib::string& getReason() const { return _reason; } + const std::string& getReason() const { return _reason; } const document::BucketId& getTarget1() const { return _target1; } const document::BucketId& getTarget2() const { return _target2; } diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index c6844f84d578..2c91aec48c5a 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -50,7 +50,7 @@ CommunicationManager::receiveStorageReply(const std::shared_ptr msg) _messageBusSession->reply(std::move(reply)); return; } - const vespalib::string & protocolName = msg->getProtocol(); + const std::string & protocolName = msg->getProtocol(); if (protocolName == documentapi::DocumentProtocol::NAME) { std::unique_ptr docMsgPtr(static_cast(msg.release())); @@ -127,7 +127,7 @@ CommunicationManager::handleReply(std::unique_ptr reply) if (message) { std::unique_ptr convertedReply; - const vespalib::string& protocolName = message->getProtocol(); + const std::string& protocolName = message->getProtocol(); if (protocolName == documentapi::DocumentProtocol::NAME) { convertedReply = static_cast(*message).createReply(); } else { @@ -146,7 +146,7 @@ CommunicationManager::handleReply(std::unique_ptr reply) } if (reply->getContext().value.UINT64 != FORWARDED_MESSAGE) { - const vespalib::string& protocolName = reply->getProtocol(); + const std::string& protocolName = reply->getProtocol(); if (protocolName == documentapi::DocumentProtocol::NAME) { std::shared_ptr originalCommand; @@ -178,7 +178,7 @@ CommunicationManager::handleReply(std::unique_ptr reply) void CommunicationManager::fail_with_unresolvable_bucket_space( std::unique_ptr msg, - const vespalib::string& error_message) + const std::string& error_message) { LOG(debug, "Could not map DocumentAPI message to internal bucket: %s", error_message.c_str()); MBUS_TRACE(msg->getTrace(), 6, "Communication manager: Failing message as its document type has no known bucket space mapping"); @@ -196,10 +196,10 @@ struct PlaceHolderBucketResolver : public BucketResolver { [[nodiscard]] document::Bucket bucketFromId(const document::DocumentId &) const override { return {FixedBucketSpaces::default_space(), document::BucketId(0)}; } - [[nodiscard]] document::BucketSpace bucketSpaceFromName(const vespalib::string &) const override { + [[nodiscard]] document::BucketSpace bucketSpaceFromName(const std::string &) const override { return FixedBucketSpaces::default_space(); } - [[nodiscard]] vespalib::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const override { + [[nodiscard]] std::string nameFromBucketSpace(const document::BucketSpace &bucketSpace) const override { assert(bucketSpace == FixedBucketSpaces::default_space()); return FixedBucketSpaces::to_string(bucketSpace); } @@ -626,7 +626,7 @@ CommunicationManager::sendDirectRPCReply(RPCRequestWrapper& request, // due to a higher version having been previously received. auto& state_reply = dynamic_cast(*reply); if (state_reply.getResult().getResult() == api::ReturnCode::REJECTED) { - vespalib::string err_msg(state_reply.getResult().getMessage()); // ReturnCode message is string_view + std::string err_msg(state_reply.getResult().getMessage()); // ReturnCode message is string_view request.returnError(FRTE_RPC_METHOD_FAILED, err_msg.c_str()); return; } @@ -664,7 +664,7 @@ CommunicationManager::sendMessageBusReply(StorageTransportContext& context, // Create an MBus reply and transfer state to it. if (reply->getResult().getResult() == api::ReturnCode::WRONG_DISTRIBUTION) { - replyUP = std::make_unique(vespalib::string(reply->getResult().getMessage())); + replyUP = std::make_unique(std::string(reply->getResult().getMessage())); replyUP->swapState(*context._docAPIMsg); replyUP->setTrace(reply->steal_trace()); replyUP->addError(mbus::Error(documentapi::DocumentProtocol::ERROR_WRONG_DISTRIBUTION, diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 7a910336b13c..b88c8a769633 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -91,7 +91,7 @@ class CommunicationManager final void configureMessageBusLimits(const CommunicationManagerConfig& cfg); void receiveStorageReply(const std::shared_ptr&); void fail_with_unresolvable_bucket_space(std::unique_ptr msg, - const vespalib::string& error_message); + const std::string& error_message); void serializeNodeState(const api::GetNodeStateReply& gns, std::ostream& os, bool includeDescription) const; diff --git a/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.cpp b/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.cpp index 55e69109ba41..4fd52bf57dcd 100644 --- a/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.cpp +++ b/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace document; @@ -29,11 +30,11 @@ ConfigurableBucketResolver::bucketFromId(const DocumentId& id) const { + id.getDocType() + "' in id: '" + id.toString() + "'", VESPA_STRLOC); } -BucketSpace ConfigurableBucketResolver::bucketSpaceFromName(const vespalib::string& name) const { +BucketSpace ConfigurableBucketResolver::bucketSpaceFromName(const std::string& name) const { return FixedBucketSpaces::from_string(name); } -vespalib::string ConfigurableBucketResolver::nameFromBucketSpace(const BucketSpace& space) const { +std::string ConfigurableBucketResolver::nameFromBucketSpace(const BucketSpace& space) const { return FixedBucketSpaces::to_string(space); } @@ -48,4 +49,4 @@ std::shared_ptr ConfigurableBucketResolver::from_con } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, document::BucketSpace); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, document::BucketSpace); diff --git a/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.h b/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.h index e1249900fc34..b7239e3ceadd 100644 --- a/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.h +++ b/storage/src/vespa/storage/storageserver/configurable_bucket_resolver.h @@ -18,15 +18,15 @@ namespace storage { */ class ConfigurableBucketResolver : public BucketResolver { public: - using BucketSpaceMapping = vespalib::hash_map; + using BucketSpaceMapping = vespalib::hash_map; const BucketSpaceMapping _type_to_space; public: explicit ConfigurableBucketResolver(BucketSpaceMapping type_to_space) noexcept; ~ConfigurableBucketResolver() override; document::Bucket bucketFromId(const document::DocumentId&) const override; - document::BucketSpace bucketSpaceFromName(const vespalib::string& name) const override; - vespalib::string nameFromBucketSpace(const document::BucketSpace& space) const override; + document::BucketSpace bucketSpaceFromName(const std::string& name) const override; + std::string nameFromBucketSpace(const document::BucketSpace& space) const override; static std::shared_ptr from_config( const vespa::config::content::core::BucketspacesConfig& config); diff --git a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp index cabfc1036651..c0b1a82cc03b 100644 --- a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp +++ b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp @@ -242,7 +242,7 @@ DocumentApiConverter::toDocumentAPI(api::StorageCommand& fromMsg) for (uint32_t i = 0; i < from.getCompletedBucketsList().size(); ++i) { to->getFinishedBuckets().push_back(from.getCompletedBucketsList()[i].bucketId); } - to->setErrorMessage(vespalib::string(from.getErrorCode().getMessage())); + to->setErrorMessage(std::string(from.getErrorCode().getMessage())); toMsg = std::move(to); break; } diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index 6d682f42ea94..0ca282380523 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -828,7 +828,7 @@ MergeThrottler::handleMessageUp( if (mergeReply.getResult().getResult() != api::ReturnCode::OK) { LOG(debug, "Merging failed for %s (%s)", mergeReply.toString().c_str(), - vespalib::string(mergeReply.getResult().getMessage()).c_str()); + std::string(mergeReply.getResult().getMessage()).c_str()); } processMergeReply(msg, true, msgGuard); diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.h b/storage/src/vespa/storage/storageserver/priorityconverter.h index 48c7424433b8..3279c99a02d0 100644 --- a/storage/src/vespa/storage/storageserver/priorityconverter.h +++ b/storage/src/vespa/storage/storageserver/priorityconverter.h @@ -4,6 +4,7 @@ #include #include +#include #include namespace storage { diff --git a/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.cpp b/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.cpp index 71ab22b6abf0..f9bd484bec99 100644 --- a/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.cpp @@ -25,7 +25,7 @@ CachingRpcTargetResolver::CachingRpcTargetResolver(const slobrok::api::IMirrorAP CachingRpcTargetResolver::~CachingRpcTargetResolver() = default; -vespalib::string +std::string CachingRpcTargetResolver::address_to_slobrok_id(const api::StorageMessageAddress& address) { vespalib::asciistream as; as << "storage/cluster." << address.getCluster() @@ -51,7 +51,7 @@ CachingRpcTargetResolver::lookup_target(const api::StorageMessageAddress& addres std::shared_ptr CachingRpcTargetResolver::consider_update_target_pool(const api::StorageMessageAddress& address, uint64_t bucket_id, - const vespalib::string& connection_spec, + const std::string& connection_spec, uint32_t curr_slobrok_gen, [[maybe_unused]] const UniqueLock& targets_lock) { // If address has the same spec as the existing target pool, just reuse it. @@ -73,7 +73,7 @@ CachingRpcTargetResolver::consider_update_target_pool(const api::StorageMessageA std::shared_ptr CachingRpcTargetResolver::insert_new_target_mapping(const api::StorageMessageAddress& address, uint64_t bucket_id, - const vespalib::string& connection_spec, + const std::string& connection_spec, uint32_t curr_slobrok_gen, [[maybe_unused]] const UniqueLock& targets_lock) { RpcTargetPool::RpcTargetVector targets; diff --git a/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.h b/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.h index 18d7f790269a..c3333547e1d6 100644 --- a/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.h +++ b/storage/src/vespa/storage/storageserver/rpc/caching_rpc_target_resolver.h @@ -41,13 +41,13 @@ class CachingRpcTargetResolver { uint32_t curr_slobrok_gen); std::shared_ptr consider_update_target_pool(const api::StorageMessageAddress& address, uint64_t bucket_id, - const vespalib::string& connection_spec, + const std::string& connection_spec, uint32_t curr_slobrok_gen, const UniqueLock& targets_lock); std::shared_ptr insert_new_target_mapping(const api::StorageMessageAddress& address, uint64_t bucket_id, - const vespalib::string& connection_spec, + const std::string& connection_spec, uint32_t curr_slobrok_gen, const UniqueLock& targets_lock); @@ -57,7 +57,7 @@ class CachingRpcTargetResolver { size_t num_targets_per_node); ~CachingRpcTargetResolver(); - static vespalib::string address_to_slobrok_id(const api::StorageMessageAddress& address); + static std::string address_to_slobrok_id(const api::StorageMessageAddress& address); std::shared_ptr resolve_rpc_target(const api::StorageMessageAddress& address, uint64_t bucket_id); diff --git a/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp b/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp index 3b53c0c95844..009d5d48252b 100644 --- a/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp @@ -99,7 +99,7 @@ void ClusterControllerApiRpcService::RPC_getNodeState2(FRT_RPCRequest* req) { return; } - vespalib::string expected(req->GetParams()->GetValue(0)._string._str, + std::string expected(req->GetParams()->GetValue(0)._string._str, req->GetParams()->GetValue(0)._string._len); auto cmd = std::make_shared(expected != "unknown" @@ -120,7 +120,7 @@ void ClusterControllerApiRpcService::RPC_setSystemState2(FRT_RPCRequest* req) { req->SetError(RPCRequestWrapper::ERR_NODE_SHUTTING_DOWN, "Node shutting down"); return; } - vespalib::string systemStateStr(req->GetParams()->GetValue(0)._string._str, + std::string systemStateStr(req->GetParams()->GetValue(0)._string._str, req->GetParams()->GetValue(0)._string._len); lib::ClusterState systemState(systemStateStr); diff --git a/storage/src/vespa/storage/storageserver/rpc/rpc_target.h b/storage/src/vespa/storage/storageserver/rpc/rpc_target.h index 502d35d206aa..3cee4ec76349 100644 --- a/storage/src/vespa/storage/storageserver/rpc/rpc_target.h +++ b/storage/src/vespa/storage/storageserver/rpc/rpc_target.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include class FRT_Target; @@ -15,7 +15,7 @@ class RpcTarget { virtual ~RpcTarget() = default; virtual FRT_Target* get() noexcept = 0; virtual bool is_valid() const noexcept = 0; - virtual const vespalib::string& spec() const noexcept = 0; + virtual const std::string& spec() const noexcept = 0; }; } diff --git a/storage/src/vespa/storage/storageserver/rpc/rpc_target_factory.h b/storage/src/vespa/storage/storageserver/rpc/rpc_target_factory.h index a6ff0d48ef64..249ba41ddb3c 100644 --- a/storage/src/vespa/storage/storageserver/rpc/rpc_target_factory.h +++ b/storage/src/vespa/storage/storageserver/rpc/rpc_target_factory.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace storage::rpc { @@ -14,7 +14,7 @@ class RpcTarget; class RpcTargetFactory { public: virtual ~RpcTargetFactory() = default; - virtual std::unique_ptr make_target(const vespalib::string& connection_spec) const = 0; + virtual std::unique_ptr make_target(const std::string& connection_spec) const = 0; }; } diff --git a/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.cpp b/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.cpp index 8566de4597a6..5bf7fd9bdb96 100644 --- a/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.cpp @@ -5,7 +5,7 @@ namespace storage::rpc { -RpcTargetPool::RpcTargetPool(RpcTargetVector&& targets, const vespalib::string& spec, uint32_t slobrok_gen) +RpcTargetPool::RpcTargetPool(RpcTargetVector&& targets, const std::string& spec, uint32_t slobrok_gen) : _targets(std::move(targets)), _spec(spec), _slobrok_gen(slobrok_gen) diff --git a/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.h b/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.h index 3be9598b7c8d..50f02794bf4d 100644 --- a/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.h +++ b/storage/src/vespa/storage/storageserver/rpc/rpc_target_pool.h @@ -2,10 +2,10 @@ #pragma once -#include #include -#include #include +#include +#include namespace storage::rpc { @@ -24,12 +24,12 @@ class RpcTargetPool { private: RpcTargetVector _targets; - const vespalib::string _spec; + const std::string _spec; uint32_t _slobrok_gen; public: - RpcTargetPool(RpcTargetVector&& targets, const vespalib::string& spec, uint32_t slobrok_gen); - const vespalib::string& spec() const { return _spec; } + RpcTargetPool(RpcTargetVector&& targets, const std::string& spec, uint32_t slobrok_gen); + const std::string& spec() const { return _spec; } uint32_t slobrok_gen() const { return _slobrok_gen; } void update_slobrok_gen(uint32_t curr_slobrok_gen) { _slobrok_gen = curr_slobrok_gen; } std::shared_ptr get_target(uint64_t bucket_id) const; diff --git a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp index 166b03770253..83346e79ee6e 100644 --- a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp @@ -27,10 +27,10 @@ namespace { class RpcTargetImpl : public RpcTarget { private: FRT_Target* _target; - vespalib::string _spec; + std::string _spec; public: - RpcTargetImpl(FRT_Target* target, const vespalib::string& spec) + RpcTargetImpl(FRT_Target* target, const std::string& spec) : _target(target), _spec(spec) {} @@ -39,7 +39,7 @@ class RpcTargetImpl : public RpcTarget { } FRT_Target* get() noexcept override { return _target; } bool is_valid() const noexcept override { return _target->IsValid(); } - const vespalib::string& spec() const noexcept override { return _spec; } + const std::string& spec() const noexcept override { return _spec; } }; } @@ -52,7 +52,7 @@ class SharedRpcResources::RpcTargetFactoryImpl : public RpcTargetFactory { RpcTargetFactoryImpl(FRT_Supervisor& orb) : _orb(orb) {} - std::unique_ptr make_target(const vespalib::string& connection_spec) const override { + std::unique_ptr make_target(const std::string& connection_spec) const override { auto* raw_target = _orb.GetTarget(connection_spec.c_str()); if (raw_target) { return std::make_unique(raw_target, connection_spec); @@ -86,7 +86,7 @@ SharedRpcResources::~SharedRpcResources() { void SharedRpcResources::start_server_and_register_slobrok(std::string_view my_handle) { LOG(debug, "Starting main RPC supervisor on port %d with slobrok handle '%s'", - _rpc_server_port, vespalib::string(my_handle).c_str()); + _rpc_server_port, std::string(my_handle).c_str()); if (!_orb->Listen(_rpc_server_port)) { throw IllegalStateException(fmt("Failed to listen to RPC port %d", _rpc_server_port), VESPA_STRLOC); } diff --git a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.h b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.h index a99a93abd68f..0a5b53b345c4 100644 --- a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.h +++ b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.h @@ -3,8 +3,8 @@ #include "rpc_target_factory.h" #include -#include #include +#include class FNET_Transport; class FRT_Supervisor; @@ -23,8 +23,8 @@ class SharedRpcResources { std::unique_ptr _slobrok_register; std::unique_ptr _slobrok_mirror; std::unique_ptr _target_factory; - vespalib::string _hostname; - vespalib::string _handle; + std::string _hostname; + std::string _handle; int _rpc_server_port; bool _shutdown; public: @@ -48,8 +48,8 @@ class SharedRpcResources { [[nodiscard]] int listen_port() const noexcept; // Only valid if server has been started // Hostname of host node is running on. - [[nodiscard]] const vespalib::string& hostname() const noexcept { return _hostname; } - [[nodiscard]] const vespalib::string handle() const noexcept { return _handle; } + [[nodiscard]] const std::string& hostname() const noexcept { return _hostname; } + [[nodiscard]] const std::string handle() const noexcept { return _handle; } const RpcTargetFactory& target_factory() const; private: diff --git a/storage/src/vespa/storage/storageserver/rpc/slime_cluster_state_bundle_codec.cpp b/storage/src/vespa/storage/storageserver/rpc/slime_cluster_state_bundle_codec.cpp index dda58d808fe1..9475afb85c22 100644 --- a/storage/src/vespa/storage/storageserver/rpc/slime_cluster_state_bundle_codec.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/slime_cluster_state_bundle_codec.cpp @@ -49,7 +49,7 @@ class OutputBuf : public vespalib::Output { OutputBuf::~OutputBuf() = default; -vespalib::string serialize_state(const lib::ClusterState& state) { +std::string serialize_state(const lib::ClusterState& state) { vespalib::asciistream as; state.serialize(as); return as.str(); diff --git a/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.cpp b/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.cpp index 4a6fa058c567..bb6df1f54e4f 100644 --- a/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.cpp @@ -228,7 +228,7 @@ void StorageApiRpcService::send_rpc_v1_request(std::shared_ptrmakeReply(); reply->setResult(make_no_address_for_service_error(*cmd->getAddress())); if (reply->getTrace().shouldTrace(TraceLevel::ERROR)) { - reply->getTrace().trace(TraceLevel::ERROR, vespalib::string(reply->getResult().getMessage())); + reply->getTrace().trace(TraceLevel::ERROR, std::string(reply->getResult().getMessage())); } // Always dispatch async for synchronously generated replies, or we risk nuking the // stack if the reply receiver keeps resending synchronously as well. @@ -336,7 +336,7 @@ void StorageApiRpcService::create_and_dispatch_error_reply(api::StorageCommand& cmd.getAddress()->toString().c_str(), error.toString().c_str()); error_reply->getTrace().swap(cmd.getTrace()); if (error_reply->getTrace().shouldTrace(TraceLevel::ERROR)) { - error_reply->getTrace().trace(TraceLevel::ERROR, vespalib::string(error.getMessage())); + error_reply->getTrace().trace(TraceLevel::ERROR, std::string(error.getMessage())); } error_reply->setResult(std::move(error)); _message_dispatcher.dispatch_sync(std::move(error_reply)); diff --git a/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.h b/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.h index cfab705928fe..97d624287643 100644 --- a/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.h +++ b/storage/src/vespa/storage/storageserver/rpc/storage_api_rpc_service.h @@ -5,10 +5,10 @@ #include #include #include -#include #include #include #include +#include class FRT_RPCRequest; class FRT_Target; diff --git a/storage/src/vespa/storage/storageserver/service_layer_error_listener.cpp b/storage/src/vespa/storage/storageserver/service_layer_error_listener.cpp index 484e70267afe..53bfcdcf30fa 100644 --- a/storage/src/vespa/storage/storageserver/service_layer_error_listener.cpp +++ b/storage/src/vespa/storage/storageserver/service_layer_error_listener.cpp @@ -15,21 +15,21 @@ void ServiceLayerErrorListener::on_fatal_error(std::string_view message) { LOG(info, "Received FATAL_ERROR from persistence provider, " "shutting down node: %s", - vespalib::string(message).c_str()); + std::string(message).c_str()); _component.requestShutdown(message); // Thread safe } else { LOG(debug, "Received FATAL_ERROR from persistence provider: %s. " "Node has already been instructed to shut down so " "not doing anything now.", - vespalib::string(message).c_str()); + std::string(message).c_str()); } } void ServiceLayerErrorListener::on_resource_exhaustion_error(std::string_view message) { LOG(debug, "SPI reports resource exhaustion ('%s'). " "Applying back-pressure to merge throttler", - vespalib::string(message).c_str()); + std::string(message).c_str()); _merge_throttler.apply_timed_backpressure(); // Thread safe } diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index 6e476caa909b..859d28f39416 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -346,7 +346,7 @@ StateManager::enableNextClusterState() namespace { using BucketSpaceToTransitionString = std::unordered_map; void @@ -387,7 +387,7 @@ calculateDerivedClusterStateTransitions(const ClusterStateBundle& currentState, return result; } -vespalib::string +std::string transitionsToString(const BucketSpaceToTransitionString& transitions) { if (transitions.empty()) { diff --git a/storage/src/vespa/storage/storageserver/statereporter.cpp b/storage/src/vespa/storage/storageserver/statereporter.cpp index 93b60cad71da..afa800bf563d 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.cpp +++ b/storage/src/vespa/storage/storageserver/statereporter.cpp @@ -34,7 +34,7 @@ StateReporter::StateReporter( StateReporter::~StateReporter() = default; -vespalib::string +std::string StateReporter::getReportContentType( const framework::HttpUrlPath& /*path*/) const { @@ -43,10 +43,10 @@ StateReporter::getReportContentType( namespace { -std::map +std::map getParams(const framework::HttpUrlPath &path) { - std::map params = path.getAttributes(); + std::map params = path.getAttributes(); if (params.find("consumer") == params.end()) { params.insert(std::make_pair("consumer", "statereporter")); } @@ -67,15 +67,15 @@ StateReporter::reportStatus(std::ostream& out, auto status = _stateApi.get(path.getServerSpec(), path.getPath(), getParams(path), dummy_ctx); if (status.failed()) { LOG(debug, "State API reporting for path '%s' failed with status HTTP %d: %s", - path.getPath().c_str(), status.status_code(), vespalib::string(status.status_message()).c_str()); + path.getPath().c_str(), status.status_code(), std::string(status.status_message()).c_str()); return false; } out << status.payload(); return true; } -vespalib::string -StateReporter::getMetrics(const vespalib::string &consumer, ExpositionFormat format) +std::string +StateReporter::getMetrics(const std::string &consumer, ExpositionFormat format) { metrics::MetricLockGuard guard(_manager.getMetricLock()); auto periods = _manager.getSnapshotPeriods(guard); @@ -113,8 +113,8 @@ StateReporter::getMetrics(const vespalib::string &consumer, ExpositionFormat for return out.str(); } -vespalib::string -StateReporter::getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) +std::string +StateReporter::getTotalMetrics(const std::string &consumer, ExpositionFormat format) { return _metricsAdapter.getTotalMetrics(consumer, format); } diff --git a/storage/src/vespa/storage/storageserver/statereporter.h b/storage/src/vespa/storage/storageserver/statereporter.h index c6fb570ae04e..a6910d7cb566 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.h +++ b/storage/src/vespa/storage/storageserver/statereporter.h @@ -36,7 +36,7 @@ class StateReporter : public framework::StatusReporter, const std::string& name = "status"); ~StateReporter() override; - vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + std::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream& out, const framework::HttpUrlPath& path) const override; // Since we forward to the state API handlers, we require a union of the capabilities @@ -57,8 +57,8 @@ class StateReporter : public framework::StatusReporter, ApplicationGenerationFetcher& _generationFetcher; std::string _name; - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override; - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override; + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override; + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override; Health getHealth() const override; void getComponentConfig(Consumer &consumer) override; }; diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index be5279281296..d2acde6ca7cd 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -36,12 +36,12 @@ namespace { using vespalib::getLastErrorString; void -writePidFile(const vespalib::string& pidfile) +writePidFile(const std::string& pidfile) { ssize_t rv = -1; - vespalib::string mypid = vespalib::make_string("%d\n", getpid()); + std::string mypid = vespalib::make_string("%d\n", getpid()); size_t lastSlash = pidfile.rfind('/'); - if (lastSlash != vespalib::string::npos) { + if (lastSlash != std::string::npos) { std::filesystem::create_directories(std::filesystem::path(pidfile.substr(0, lastSlash))); } int fd = open(pidfile.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -56,7 +56,7 @@ writePidFile(const vespalib::string& pidfile) } void -removePidFile(const vespalib::string& pidfile) +removePidFile(const std::string& pidfile) { if (unlink(pidfile.c_str()) != 0) { LOG(warning, "Failed to delete pidfile '%s': %s", diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index da57b4c671fc..030b3163edca 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -119,9 +119,9 @@ class StorageNode : private framework::MetricUpdateHook, StorageNodeContext& _context; ApplicationGenerationFetcher& _generationFetcher; - vespalib::string _rootFolder; + std::string _rootFolder; std::atomic _attemptedStopped; - vespalib::string _pidFile; + std::string _pidFile; // First components that doesn't depend on others std::unique_ptr _statusWebServer; diff --git a/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.cpp b/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.cpp index 7a9bfe860b61..1615c8a6bd16 100644 --- a/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.cpp +++ b/storage/src/vespa/storage/storageserver/tls_statistics_metrics_wrapper.cpp @@ -5,7 +5,7 @@ namespace storage { TlsStatisticsMetricsWrapper::EndpointMetrics::EndpointMetrics(std::string_view type, metrics::MetricSet* owner) - : metrics::MetricSet(vespalib::string(type), {}, "Endpoint type metrics", owner), + : metrics::MetricSet(std::string(type), {}, "Endpoint type metrics", owner), tls_connections_established("tls-connections-established", {}, "Number of secure mTLS connections established", this), insecure_connections_established("insecure-connections-established", {}, diff --git a/storage/src/vespa/storage/visiting/countvisitor.cpp b/storage/src/vespa/storage/visiting/countvisitor.cpp index 6637e7392bde..3ce10020adf0 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.cpp +++ b/storage/src/vespa/storage/visiting/countvisitor.cpp @@ -35,7 +35,7 @@ CountVisitor::handleDocuments(const document::BucketId& /*bucketId*/, hitCounter.addHit(doc->getId(), 0); if (_doNamespace) { - _namespaceCount[vespalib::string(idString.getNamespace())]++; + _namespaceCount[std::string(idString.getNamespace())]++; } if (_doUser && idString.hasNumber()) { @@ -43,7 +43,7 @@ CountVisitor::handleDocuments(const document::BucketId& /*bucketId*/, } if (_doGroup && idString.hasGroup()) { - _groupCount[vespalib::string(idString.getGroup())]++; + _groupCount[std::string(idString.getGroup())]++; } if (_doScheme) { diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h index e934b63f1373..833eae3d2755 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.h +++ b/storage/src/vespa/storage/visiting/countvisitor.h @@ -29,14 +29,14 @@ class CountVisitor : public Visitor { std::map _schemeCount; bool _doNamespace; - using NamespaceCountMap = std::map; + using NamespaceCountMap = std::map; NamespaceCountMap _namespaceCount; bool _doUser; std::map _userCount; bool _doGroup; - using GroupCountMap = std::map; + using GroupCountMap = std::map; GroupCountMap _groupCount; }; diff --git a/storage/src/vespa/storage/visiting/reindexing_visitor.cpp b/storage/src/vespa/storage/visiting/reindexing_visitor.cpp index c9bde68be3fa..3d4e8839e92f 100644 --- a/storage/src/vespa/storage/visiting/reindexing_visitor.cpp +++ b/storage/src/vespa/storage/visiting/reindexing_visitor.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include LOG_SETUP(".visitor.instance.reindexing_visitor"); @@ -45,8 +46,8 @@ bool ReindexingVisitor::remap_docapi_message_error_code(api::ReturnCode& in_out_ return Visitor::remap_docapi_message_error_code(in_out_code); } -vespalib::string ReindexingVisitor::make_lock_access_token() const { - vespalib::string prefix = reindexing_bucket_lock_bypass_prefix(); +std::string ReindexingVisitor::make_lock_access_token() const { + std::string prefix = reindexing_bucket_lock_bypass_prefix(); std::string_view passed_token = visitor_parameters().get( reindexing_bucket_lock_visitor_parameter_key(), std::string_view("")); diff --git a/storage/src/vespa/storage/visiting/reindexing_visitor.h b/storage/src/vespa/storage/visiting/reindexing_visitor.h index e455a8db6a40..aded262aa499 100644 --- a/storage/src/vespa/storage/visiting/reindexing_visitor.h +++ b/storage/src/vespa/storage/visiting/reindexing_visitor.h @@ -22,7 +22,7 @@ class ReindexingVisitor : public Visitor { private: void handleDocuments(const document::BucketId&, DocEntryList&, HitCounter&) override; bool remap_docapi_message_error_code(api::ReturnCode& in_out_code) override; - vespalib::string make_lock_access_token() const; + std::string make_lock_access_token() const; }; struct ReindexingVisitorFactory : public VisitorFactory { diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp index f98450071591..d3cd6a917eea 100644 --- a/storage/src/vespa/storage/visiting/visitor.cpp +++ b/storage/src/vespa/storage/visiting/visitor.cpp @@ -557,7 +557,7 @@ Visitor::attach(std::shared_ptr initiatingCmd, } bool -Visitor::addBoundedTrace(uint32_t level, const vespalib::string &message) { +Visitor::addBoundedTrace(uint32_t level, const std::string &message) { mbus::Trace tempTrace; tempTrace.trace(level, message); return _trace.add(std::move(tempTrace)); diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index bb7ee9ce97d9..db05916877cd 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -325,7 +325,7 @@ class Visitor * * Returns true iff message was added to internal trace tree. */ - bool addBoundedTrace(uint32_t level, const vespalib::string& message); + bool addBoundedTrace(uint32_t level, const std::string& message); [[nodiscard]] const vdslib::Parameters& visitor_parameters() const noexcept; diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp index 2f50b5fe3901..495bc87da1fa 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.cpp +++ b/storage/src/vespa/storage/visiting/visitorthread.cpp @@ -64,7 +64,7 @@ VisitorThread::Event::Event(api::VisitorId visitor, mbus::Reply::UP reply) } namespace { - vespalib::string getThreadName(uint32_t i) { + std::string getThreadName(uint32_t i) { vespalib::asciistream name; name << "Visitor thread " << i; return name.str(); @@ -338,7 +338,7 @@ VisitorThread::createVisitor(std::string_view libName, const vdslib::Parameters& params, vespalib::asciistream & error) { - vespalib::string str(libName); + std::string str(libName); std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return std::tolower(c); }); auto it = _visitorFactories.find(str); diff --git a/storage/src/vespa/storageapi/buckets/bucketinfo.cpp b/storage/src/vespa/storageapi/buckets/bucketinfo.cpp index 46e7a8683711..0a46670d4830 100644 --- a/storage/src/vespa/storageapi/buckets/bucketinfo.cpp +++ b/storage/src/vespa/storageapi/buckets/bucketinfo.cpp @@ -84,7 +84,7 @@ BucketInfo::operator==(const BucketInfo& info) const noexcept } // TODO: add ready/active to printing -vespalib::string +std::string BucketInfo::toString() const { vespalib::asciistream out; diff --git a/storage/src/vespa/storageapi/buckets/bucketinfo.h b/storage/src/vespa/storageapi/buckets/bucketinfo.h index 4b7847ef9619..46008d80acf5 100644 --- a/storage/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storage/src/vespa/storageapi/buckets/bucketinfo.h @@ -14,7 +14,7 @@ #pragma once #include -#include +#include namespace vespalib::xml { class XmlOutputStream; } namespace storage::api { @@ -75,7 +75,7 @@ class BucketInfo bool empty() const noexcept { return _metaCount == 0 && _usedFileSize == 0 && _checksum == 0; } - vespalib::string toString() const; + std::string toString() const; void printXml(vespalib::xml::XmlOutputStream&) const; }; diff --git a/storage/src/vespa/storageapi/message/bucket.cpp b/storage/src/vespa/storageapi/message/bucket.cpp index 38067494f50b..3a2d7ef2019d 100644 --- a/storage/src/vespa/storageapi/message/bucket.cpp +++ b/storage/src/vespa/storageapi/message/bucket.cpp @@ -624,7 +624,7 @@ SetBucketStateCommand::print(std::ostream& out, } } -vespalib::string +std::string SetBucketStateCommand::getSummary() const { vespalib::asciistream stream; diff --git a/storage/src/vespa/storageapi/message/bucket.h b/storage/src/vespa/storageapi/message/bucket.h index b34ce6247558..a31f3774d1fd 100644 --- a/storage/src/vespa/storageapi/message/bucket.h +++ b/storage/src/vespa/storageapi/message/bucket.h @@ -268,7 +268,7 @@ class ApplyBucketDiffCommand : public BucketInfoCommand { using Node = MergeBucketCommand::Node; struct Entry : public document::Printable { GetBucketDiffCommand::Entry _entry; - vespalib::string _docName; + std::string _docName; std::vector _headerBlob; // TODO: In theory the body blob could be removed now as all is in one blob // That will enable simplification of code in document. @@ -349,7 +349,7 @@ class RequestBucketInfoCommand : public StorageCommand { std::vector _buckets; std::unique_ptr _state; uint16_t _distributor; - vespalib::string _distributionHash; + std::string _distributionHash; public: RequestBucketInfoCommand(document::BucketSpace bucketSpace, @@ -370,7 +370,7 @@ class RequestBucketInfoCommand : public StorageCommand { uint16_t getDistributor() const { return _distributor; } const lib::ClusterState& getSystemState() const { return *_state; } - const vespalib::string& getDistributionHash() const { return _distributionHash; } + const std::string& getDistributionHash() const { return _distributionHash; } document::BucketSpace getBucketSpace() const { return _bucketSpace; } document::Bucket getBucket() const override; document::BucketId super_bucket_id() const; @@ -486,7 +486,7 @@ class SetBucketStateCommand : public MaintenanceCommand static BUCKET_STATE toState(bool active) noexcept { return active ? ACTIVE : INACTIVE; } DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState); private: - vespalib::string getSummary() const override; + std::string getSummary() const override; BUCKET_STATE _state; }; diff --git a/storage/src/vespa/storageapi/message/persistence.cpp b/storage/src/vespa/storageapi/message/persistence.cpp index aaf3cf291c31..129b0dbff1e2 100644 --- a/storage/src/vespa/storageapi/message/persistence.cpp +++ b/storage/src/vespa/storageapi/message/persistence.cpp @@ -46,7 +46,7 @@ PutCommand::getDocumentType() const { return &_doc->getType(); } -vespalib::string +std::string PutCommand::getSummary() const { vespalib::asciistream stream; @@ -134,7 +134,7 @@ UpdateCommand::getDocumentId() const { return _update->getId(); } -vespalib::string +std::string UpdateCommand::getSummary() const { vespalib::asciistream stream; stream << "Update(BucketId(0x" << vespalib::hex << getBucketId().getId() << "), " @@ -205,7 +205,7 @@ GetCommand::GetCommand(const document::Bucket &bucket, const document::DocumentI GetCommand::~GetCommand() = default; -vespalib::string +std::string GetCommand::getSummary() const { vespalib::asciistream stream; @@ -273,7 +273,7 @@ RemoveCommand::RemoveCommand(const document::Bucket &bucket, const document::Doc RemoveCommand::~RemoveCommand() = default; -vespalib::string +std::string RemoveCommand::getSummary() const { vespalib::asciistream stream; stream << "Remove(BucketId(0x" << vespalib::hex << getBucketId().getId() << "), " diff --git a/storage/src/vespa/storageapi/message/persistence.h b/storage/src/vespa/storageapi/message/persistence.h index 7df3cf2edcbf..6d440831e1f1 100644 --- a/storage/src/vespa/storageapi/message/persistence.h +++ b/storage/src/vespa/storageapi/message/persistence.h @@ -70,7 +70,7 @@ class PutCommand : public TestAndSetCommand { void set_create_if_non_existent(bool value) noexcept { _create_if_non_existent = value; } bool get_create_if_non_existent() const noexcept { return _create_if_non_existent; } - vespalib::string getSummary() const override; + std::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(PutCommand, onPut); @@ -143,7 +143,7 @@ class UpdateCommand : public TestAndSetCommand { [[nodiscard]] bool create_if_missing() const; const document::DocumentType * getDocumentType() const override; - vespalib::string getSummary() const override; + std::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -201,7 +201,7 @@ class UpdateReply : public BucketInfoReply { class GetCommand : public BucketInfoCommand { document::DocumentId _docId; Timestamp _beforeTimestamp; - vespalib::string _fieldSet; + std::string _fieldSet; TestAndSetCondition _condition; InternalReadConsistency _internal_read_consistency; public: @@ -211,7 +211,7 @@ class GetCommand : public BucketInfoCommand { void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } - const vespalib::string& getFieldSet() const { return _fieldSet; } + const std::string& getFieldSet() const { return _fieldSet; } void setFieldSet(std::string_view fieldSet) { _fieldSet = fieldSet; } [[nodiscard]] bool has_condition() const noexcept { return _condition.isPresent(); } [[nodiscard]] const TestAndSetCondition& condition() const noexcept { return _condition; } @@ -223,7 +223,7 @@ class GetCommand : public BucketInfoCommand { _internal_read_consistency = consistency; } - vespalib::string getSummary() const override; + std::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; api::LockingRequirements lockingRequirements() const noexcept override { @@ -241,7 +241,7 @@ class GetCommand : public BucketInfoCommand { */ class GetReply : public BucketInfoReply { document::DocumentId _docId; // In case of not found, we want id still - vespalib::string _fieldSet; + std::string _fieldSet; DocumentSP _doc; // Null pointer if not found Timestamp _beforeTimestamp; Timestamp _lastModifiedTime; @@ -260,7 +260,7 @@ class GetReply : public BucketInfoReply { const DocumentSP& getDocument() const { return _doc; } const document::DocumentId& getDocumentId() const { return _docId; } - const vespalib::string& getFieldSet() const { return _fieldSet; } + const std::string& getFieldSet() const { return _fieldSet; } Timestamp getLastModifiedTimestamp() const noexcept { return _lastModifiedTime; } Timestamp getBeforeTimestamp() const noexcept { return _beforeTimestamp; } @@ -291,7 +291,7 @@ class RemoveCommand : public TestAndSetCommand { void setTimestamp(Timestamp ts) { _timestamp = ts; } const document::DocumentId& getDocumentId() const override { return _docId; } Timestamp getTimestamp() const { return _timestamp; } - vespalib::string getSummary() const override; + std::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(RemoveCommand, onRemove) }; diff --git a/storage/src/vespa/storageapi/message/removelocation.h b/storage/src/vespa/storageapi/message/removelocation.h index 64e5bb0db632..aa887081ca22 100644 --- a/storage/src/vespa/storageapi/message/removelocation.h +++ b/storage/src/vespa/storageapi/message/removelocation.h @@ -15,7 +15,7 @@ class RemoveLocationCommand : public BucketInfoCommand ~RemoveLocationCommand() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - const vespalib::string& getDocumentSelection() const { return _documentSelection; } + const std::string& getDocumentSelection() const { return _documentSelection; } // TODO move to factory pattern instead to disallow creating illegal combinations void set_only_enumerate_docs(bool only_enumerate) noexcept { _only_enumerate_docs = only_enumerate; @@ -36,7 +36,7 @@ class RemoveLocationCommand : public BucketInfoCommand DECLARE_STORAGECOMMAND(RemoveLocationCommand, onRemoveLocation); private: // TODO make variant? Only one of the two may be used - vespalib::string _documentSelection; + std::string _documentSelection; std::vector _explicit_remove_set; bool _only_enumerate_docs; }; diff --git a/storage/src/vespa/storageapi/message/stat.cpp b/storage/src/vespa/storageapi/message/stat.cpp index 62ad41f178dd..7f33fe4ef7c3 100644 --- a/storage/src/vespa/storageapi/message/stat.cpp +++ b/storage/src/vespa/storageapi/message/stat.cpp @@ -47,9 +47,9 @@ StatBucketReply::print(std::ostream& out, bool verbose, out << ", result: " << _results << ") : "; BucketReply::print(out, verbose, indent); } else { - vespalib::string::size_type pos = _results.find('\n'); - vespalib::string overview; - if (pos != vespalib::string::npos) { + std::string::size_type pos = _results.find('\n'); + std::string overview; + if (pos != std::string::npos) { overview = _results.substr(0, pos) + " ..."; } else { overview = _results; diff --git a/storage/src/vespa/storageapi/message/stat.h b/storage/src/vespa/storageapi/message/stat.h index fcda1ce2be35..83ee2449c0c7 100644 --- a/storage/src/vespa/storageapi/message/stat.h +++ b/storage/src/vespa/storageapi/message/stat.h @@ -17,22 +17,22 @@ namespace storage::api { */ class StatBucketCommand : public BucketCommand { private: - vespalib::string _docSelection; + std::string _docSelection; public: StatBucketCommand(const document::Bucket &bucket, std::string_view documentSelection); ~StatBucketCommand() override; - const vespalib::string& getDocumentSelection() const { return _docSelection; } + const std::string& getDocumentSelection() const { return _docSelection; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(StatBucketCommand, onStatBucket); }; class StatBucketReply : public BucketReply { - vespalib::string _results; + std::string _results; public: explicit StatBucketReply(const StatBucketCommand&, std::string_view results = ""); - const vespalib::string& getResults() const noexcept { return _results; } + const std::string& getResults() const noexcept { return _results; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(StatBucketReply, onStatBucketReply) }; @@ -58,7 +58,7 @@ class GetBucketListReply : public BucketReply { public: struct BucketInfo { document::BucketId _bucket; - vespalib::string _bucketInformation; + std::string _bucketInformation; BucketInfo(const document::BucketId& id, std::string_view bucketInformation) noexcept diff --git a/storage/src/vespa/storageapi/message/visitor.h b/storage/src/vespa/storageapi/message/visitor.h index 0ad1582efd01..0544391b6ff0 100644 --- a/storage/src/vespa/storageapi/message/visitor.h +++ b/storage/src/vespa/storageapi/message/visitor.h @@ -25,23 +25,23 @@ namespace storage::api { class CreateVisitorCommand : public StorageCommand { private: document::BucketSpace _bucketSpace; - vespalib::string _libName; // Name of visitor library to use, ie. DumpVisitor.so + std::string _libName; // Name of visitor library to use, ie. DumpVisitor.so vdslib::Parameters _params; - vespalib::string _controlDestination; - vespalib::string _dataDestination; + std::string _controlDestination; + std::string _dataDestination; - vespalib::string _docSelection; + std::string _docSelection; std::vector _buckets; Timestamp _fromTime; Timestamp _toTime; uint32_t _visitorCmdId; - vespalib::string _instanceId; + std::string _instanceId; VisitorId _visitorId; // Set on storage node bool _visitRemoves; - vespalib::string _fieldSet; + std::string _fieldSet; bool _visitInconsistentBuckets; duration _queueTimeout; @@ -80,11 +80,11 @@ class CreateVisitorCommand : public StorageCommand { document::BucketSpace getBucketSpace() const { return _bucketSpace; } document::Bucket getBucket() const override; document::BucketId super_bucket_id() const; - const vespalib::string & getLibraryName() const { return _libName; } - const vespalib::string & getInstanceId() const { return _instanceId; } - const vespalib::string & getControlDestination() const { return _controlDestination; } - const vespalib::string & getDataDestination() const { return _dataDestination; } - const vespalib::string & getDocumentSelection() const { return _docSelection; } + const std::string & getLibraryName() const { return _libName; } + const std::string & getInstanceId() const { return _instanceId; } + const std::string & getControlDestination() const { return _controlDestination; } + const std::string & getDataDestination() const { return _dataDestination; } + const std::string & getDocumentSelection() const { return _docSelection; } const vdslib::Parameters& getParameters() const { return _params; } vdslib::Parameters& getParameters() { return _params; } uint32_t getMaximumPendingReplyCount() const { return _maxPendingReplyCount; } @@ -93,7 +93,7 @@ class CreateVisitorCommand : public StorageCommand { Timestamp getToTime() const { return _toTime; } std::vector& getBuckets() { return _buckets; } bool visitRemoves() const { return _visitRemoves; } - const vespalib::string& getFieldSet() const { return _fieldSet; } + const std::string& getFieldSet() const { return _fieldSet; } bool visitInconsistentBuckets() const { return _visitInconsistentBuckets; } duration getQueueTimeout() const { return _queueTimeout; } @@ -144,12 +144,12 @@ class CreateVisitorReply : public StorageReply { */ class DestroyVisitorCommand : public StorageCommand { private: - vespalib::string _instanceId; + std::string _instanceId; public: explicit DestroyVisitorCommand(std::string_view instanceId); - const vespalib::string & getInstanceId() const { return _instanceId; } + const std::string & getInstanceId() const { return _instanceId; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; diff --git a/storage/src/vespa/storageapi/messageapi/maintenancecommand.h b/storage/src/vespa/storageapi/messageapi/maintenancecommand.h index 7c634fb9c407..f00020f054bf 100644 --- a/storage/src/vespa/storageapi/messageapi/maintenancecommand.h +++ b/storage/src/vespa/storageapi/messageapi/maintenancecommand.h @@ -17,10 +17,10 @@ class MaintenanceCommand : public BucketInfoCommand MaintenanceCommand & operator = (MaintenanceCommand &&) noexcept = delete; ~MaintenanceCommand() override; - const vespalib::string& getReason() const { return _reason; }; + const std::string& getReason() const { return _reason; }; void setReason(std::string_view reason) { _reason = reason; }; protected: - vespalib::string _reason; + std::string _reason; }; } diff --git a/storage/src/vespa/storageapi/messageapi/returncode.cpp b/storage/src/vespa/storageapi/messageapi/returncode.cpp index 0556b4232f94..37f741854ee3 100644 --- a/storage/src/vespa/storageapi/messageapi/returncode.cpp +++ b/storage/src/vespa/storageapi/messageapi/returncode.cpp @@ -12,7 +12,7 @@ ReturnCode::ReturnCode(Result result, std::string_view msg) _message() { if ( ! msg.empty()) { - _message = std::make_unique(msg); + _message = std::make_unique(msg); } } @@ -21,7 +21,7 @@ ReturnCode::ReturnCode(const ReturnCode & rhs) _message() { if (rhs._message) { - _message = std::make_unique(*rhs._message); + _message = std::make_unique(*rhs._message); } } @@ -30,14 +30,14 @@ ReturnCode::operator = (const ReturnCode & rhs) { return operator=(ReturnCode(rhs)); } -vespalib::string +std::string ReturnCode::getResultString(Result result) { return documentapi::DocumentProtocol::getErrorName(result); } -vespalib::string +std::string ReturnCode::toString() const { - vespalib::string ret = "ReturnCode("; + std::string ret = "ReturnCode("; ret += getResultString(_result); if ( _message && ! _message->empty()) { ret += ", "; diff --git a/storage/src/vespa/storageapi/messageapi/returncode.h b/storage/src/vespa/storageapi/messageapi/returncode.h index 18d6c012cdd4..172858610a5c 100644 --- a/storage/src/vespa/storageapi/messageapi/returncode.h +++ b/storage/src/vespa/storageapi/messageapi/returncode.h @@ -59,7 +59,7 @@ class ReturnCode { private: Result _result; - std::unique_ptr _message; + std::unique_ptr _message; public: ReturnCode() : _result(OK), @@ -83,7 +83,7 @@ class ReturnCode { * Translate from status code to human-readable string * @param result Status code returned from getResult() */ - static vespalib::string getResultString(Result result); + static std::string getResultString(Result result); bool failed() const { return (_result != OK); } bool success() const { return (_result == OK); } @@ -105,7 +105,7 @@ class ReturnCode { bool isShutdownRelated() const; bool isBucketDisappearance() const; bool isNonCriticalForIntegrityChecker() const; - vespalib::string toString() const; + std::string toString() const; }; std::ostream & operator << (std::ostream & os, const ReturnCode & returnCode); diff --git a/storage/src/vespa/storageapi/messageapi/storagemessage.cpp b/storage/src/vespa/storageapi/messageapi/storagemessage.cpp index 57a7b6537d5e..b5110a4d29b7 100644 --- a/storage/src/vespa/storageapi/messageapi/storagemessage.cpp +++ b/storage/src/vespa/storageapi/messageapi/storagemessage.cpp @@ -17,7 +17,7 @@ std::atomic _g_lastMsgId(1000); } -static const vespalib::string STORAGEADDRESS_PREFIX = "storage/cluster."; +static const std::string STORAGEADDRESS_PREFIX = "storage/cluster."; const char* StorageMessage::getPriorityString(Priority p) { @@ -138,7 +138,7 @@ std::ostream & operator << (std::ostream & os, const StorageMessageAddress & add namespace { -vespalib::string +std::string createAddress(std::string_view cluster, const lib::NodeType &type, uint16_t index) { vespalib::asciistream os; os << STORAGEADDRESS_PREFIX << cluster << '/' << type.toString() << '/' << index << "/default"; @@ -152,7 +152,7 @@ calculate_node_hash(const lib::NodeType &type, uint16_t index) { return uint32_t(hash & 0xffffffffl) ^ uint32_t(hash >> 32); } -vespalib::string Empty; +std::string Empty; } @@ -165,11 +165,11 @@ StorageMessageAddress::StorageMessageAddress() noexcept _index(0) {} -StorageMessageAddress::StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept +StorageMessageAddress::StorageMessageAddress(const std::string * cluster, const lib::NodeType& type, uint16_t index) noexcept : StorageMessageAddress(cluster, type, index, Protocol::STORAGE) { } -StorageMessageAddress::StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, +StorageMessageAddress::StorageMessageAddress(const std::string * cluster, const lib::NodeType& type, uint16_t index, Protocol protocol) noexcept : _cluster(cluster), _precomputed_storage_hash(calculate_node_hash(type, index)), @@ -201,7 +201,7 @@ StorageMessageAddress::operator==(const StorageMessageAddress& other) const noex return true; } -vespalib::string +std::string StorageMessageAddress::toString() const { vespalib::asciistream os; @@ -258,7 +258,7 @@ StorageMessage::StorageMessage(const StorageMessage& other, Id internal_id, Id o StorageMessage::~StorageMessage() = default; -vespalib::string +std::string StorageMessage::getSummary() const { return toString(); } diff --git a/storage/src/vespa/storageapi/messageapi/storagemessage.h b/storage/src/vespa/storageapi/messageapi/storagemessage.h index 326a4ff0f04c..c365cdd5657e 100644 --- a/storage/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storage/src/vespa/storageapi/messageapi/storagemessage.h @@ -147,7 +147,7 @@ class MessageType : public vespalib::Printable { private: static std::map _codes; - const vespalib::string _name; + const std::string _name; Id _id; MessageType *_reply; const MessageType *_replyOf; @@ -228,7 +228,7 @@ class MessageType : public vespalib::Printable { ~MessageType(); Id getId() const noexcept { return _id; } static Id getMaxId() noexcept { return MESSAGETYPE_MAX_ID; } - const vespalib::string& getName() const noexcept { return _name; } + const std::string& getName() const noexcept { return _name; } bool isReply() const noexcept { return (_replyOf != 0); } /** Only valid to call on replies. */ const MessageType& getCommandType() const noexcept { return *_replyOf; } @@ -251,7 +251,7 @@ class StorageMessageAddress { enum class Protocol : uint8_t { STORAGE, DOCUMENT }; private: - const vespalib::string *_cluster; + const std::string *_cluster; // Used for internal VDS addresses only uint32_t _precomputed_storage_hash; lib::NodeType::Type _type; @@ -260,8 +260,8 @@ class StorageMessageAddress { public: StorageMessageAddress() noexcept; // Only to be used when transient default ctor semantics are needed by containers - StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept; - StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index, Protocol protocol) noexcept; + StorageMessageAddress(const std::string * cluster, const lib::NodeType& type, uint16_t index) noexcept; + StorageMessageAddress(const std::string * cluster, const lib::NodeType& type, uint16_t index, Protocol protocol) noexcept; ~StorageMessageAddress(); void setProtocol(Protocol p) noexcept { _protocol = p; } @@ -270,7 +270,7 @@ class StorageMessageAddress { Protocol getProtocol() const noexcept { return _protocol; } uint16_t getIndex() const noexcept { return _index; } lib::NodeType::Type getNodeType() const noexcept { return _type; } - const vespalib::string& getCluster() const noexcept { return *_cluster; } + const std::string& getCluster() const noexcept { return *_cluster; } // Returns precomputed hash over pair. Other fields not included. [[nodiscard]] uint32_t internal_storage_hash() const noexcept { @@ -278,12 +278,12 @@ class StorageMessageAddress { } bool operator==(const StorageMessageAddress& other) const noexcept; - vespalib::string toString() const; + std::string toString() const; friend std::ostream & operator << (std::ostream & os, const StorageMessageAddress & addr); - static StorageMessageAddress create(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept { + static StorageMessageAddress create(const std::string * cluster, const lib::NodeType& type, uint16_t index) noexcept { return api::StorageMessageAddress(cluster, type, index); } - static StorageMessageAddress createDocApi(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept { + static StorageMessageAddress createDocApi(const std::string * cluster, const lib::NodeType& type, uint16_t index) noexcept { return api::StorageMessageAddress(cluster, type, index, Protocol::DOCUMENT); } private: @@ -437,7 +437,7 @@ class StorageMessage : public vespalib::Printable /** * Cheap version of tostring(). */ - virtual vespalib::string getSummary() const; + virtual std::string getSummary() const; virtual document::Bucket getBucket() const { return getDummyBucket(); } document::BucketId getBucketId() const noexcept { return getBucket().getBucketId(); } diff --git a/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp b/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp index 740b776f7e9c..49200482e203 100644 --- a/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp +++ b/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp @@ -81,7 +81,7 @@ ThreadImpl::join() } } -vespalib::string +std::string ThreadImpl::get_live_thread_stack_trace() const { auto native_handle = const_cast(_thread).native_handle(); diff --git a/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h b/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h index 51bf46f55851..b07136e46d6c 100644 --- a/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h +++ b/storage/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h @@ -61,7 +61,7 @@ class ThreadImpl final : public Thread void interrupt() override; void join() override; - vespalib::string get_live_thread_stack_trace() const override; + std::string get_live_thread_stack_trace() const override; void registerTick(CycleType, vespalib::steady_time) override; void registerTick(CycleType cycleType) override; diff --git a/storage/src/vespa/storageframework/generic/component/component.h b/storage/src/vespa/storageframework/generic/component/component.h index 99dff7dfe435..1cf3abcffc92 100644 --- a/storage/src/vespa/storageframework/generic/component/component.h +++ b/storage/src/vespa/storageframework/generic/component/component.h @@ -81,7 +81,7 @@ class Thread; class Component : private ManagedComponent { ComponentRegister* _componentRegister; - vespalib::string _name; + std::string _name; const StatusReporter* _status; metrics::Metric* _metric; ThreadPool* _threadPool; @@ -127,7 +127,7 @@ class Component : private ManagedComponent void registerMetricUpdateHook(MetricUpdateHook&, vespalib::system_time::duration period); /** Get the name of the component. Must be a unique name. */ - [[nodiscard]] const vespalib::string& getName() const override { return _name; } + [[nodiscard]] const std::string& getName() const override { return _name; } /** * Get the thread pool for this application. Note that this call will fail diff --git a/storage/src/vespa/storageframework/generic/component/componentregister.h b/storage/src/vespa/storageframework/generic/component/componentregister.h index 84ebd6049a1a..9ba7633881a7 100644 --- a/storage/src/vespa/storageframework/generic/component/componentregister.h +++ b/storage/src/vespa/storageframework/generic/component/componentregister.h @@ -11,7 +11,7 @@ */ #pragma once -#include +#include namespace storage::framework { diff --git a/storage/src/vespa/storageframework/generic/component/managedcomponent.h b/storage/src/vespa/storageframework/generic/component/managedcomponent.h index c512d399d4b9..df77004c85a0 100644 --- a/storage/src/vespa/storageframework/generic/component/managedcomponent.h +++ b/storage/src/vespa/storageframework/generic/component/managedcomponent.h @@ -12,7 +12,7 @@ */ #pragma once -#include +#include namespace metrics { class Metric; @@ -29,7 +29,7 @@ struct Clock; struct ManagedComponent { virtual ~ManagedComponent() = default; - [[nodiscard]] virtual const vespalib::string& getName() const = 0; + [[nodiscard]] virtual const std::string& getName() const = 0; virtual metrics::Metric* getMetric() = 0; virtual const StatusReporter* getStatusReporter() = 0; diff --git a/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp index 8fadf3887686..486154e68145 100644 --- a/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp +++ b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.cpp @@ -28,7 +28,7 @@ HtmlStatusReporter::reportHtmlFooter(std::ostream& out, const HttpUrlPath&) cons out << "\n\n"; } -vespalib::string +std::string HtmlStatusReporter::getReportContentType(const HttpUrlPath&) const { return "text/html"; diff --git a/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.h b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.h index 5541feb8abe2..b5c2b4e139d7 100644 --- a/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.h +++ b/storage/src/vespa/storageframework/generic/status/htmlstatusreporter.h @@ -44,7 +44,7 @@ struct HtmlStatusReporter : public StatusReporter { virtual void reportHtmlFooter(std::ostream&, const HttpUrlPath&) const; // Implementation of StatusReporter interface - vespalib::string getReportContentType(const HttpUrlPath&) const override; + std::string getReportContentType(const HttpUrlPath&) const override; bool reportStatus(std::ostream&, const HttpUrlPath&) const override; }; diff --git a/storage/src/vespa/storageframework/generic/status/httpurlpath.cpp b/storage/src/vespa/storageframework/generic/status/httpurlpath.cpp index 4bade6d00474..2eb36718fa58 100644 --- a/storage/src/vespa/storageframework/generic/status/httpurlpath.cpp +++ b/storage/src/vespa/storageframework/generic/status/httpurlpath.cpp @@ -5,7 +5,7 @@ namespace storage::framework { -HttpUrlPath::HttpUrlPath(const vespalib::string& urlpath) +HttpUrlPath::HttpUrlPath(const std::string& urlpath) : _path(), _attributes(), _serverSpec() @@ -13,8 +13,8 @@ HttpUrlPath::HttpUrlPath(const vespalib::string& urlpath) init(urlpath); } -HttpUrlPath::HttpUrlPath(const vespalib::string& urlpath, - const vespalib::string& serverSpec) +HttpUrlPath::HttpUrlPath(const std::string& urlpath, + const std::string& serverSpec) : _path(), _attributes(), _serverSpec(serverSpec) @@ -22,9 +22,9 @@ HttpUrlPath::HttpUrlPath(const vespalib::string& urlpath, init(urlpath); } -HttpUrlPath::HttpUrlPath(vespalib::string path, - std::map attributes, - vespalib::string serverSpec) +HttpUrlPath::HttpUrlPath(std::string path, + std::map attributes, + std::string serverSpec) : _path(std::move(path)), _attributes(std::move(attributes)), _serverSpec(std::move(serverSpec)) @@ -34,19 +34,19 @@ HttpUrlPath::HttpUrlPath(vespalib::string path, HttpUrlPath::~HttpUrlPath() {} void -HttpUrlPath::init(const vespalib::string &urlpath) +HttpUrlPath::init(const std::string &urlpath) { - vespalib::string::size_type pos = urlpath.find('?'); - if (pos == vespalib::string::npos) { + std::string::size_type pos = urlpath.find('?'); + if (pos == std::string::npos) { _path = urlpath; } else { _path = urlpath.substr(0, pos); - vespalib::string sub(urlpath.substr(pos+1)); + std::string sub(urlpath.substr(pos+1)); vespalib::StringTokenizer tokenizer(sub, "&", ""); for (uint32_t i=0, n=tokenizer.size(); isecond); diff --git a/storage/src/vespa/storageframework/generic/status/httpurlpath.h b/storage/src/vespa/storageframework/generic/status/httpurlpath.h index 952d71e85b3f..3a160463e97b 100644 --- a/storage/src/vespa/storageframework/generic/status/httpurlpath.h +++ b/storage/src/vespa/storageframework/generic/status/httpurlpath.h @@ -7,49 +7,49 @@ #pragma once #include -#include #include #include +#include namespace storage::framework { class HttpUrlPath : public vespalib::Printable { - vespalib::string _path; - std::map _attributes; - vespalib::string _serverSpec; // "host:port" + std::string _path; + std::map _attributes; + std::string _serverSpec; // "host:port" - void init(const vespalib::string &urlpath); + void init(const std::string &urlpath); public: - HttpUrlPath(const vespalib::string& urlpath); - HttpUrlPath(const vespalib::string& urlpath, const vespalib::string& serverSpec); - HttpUrlPath(vespalib::string path, - std::map attributes, - vespalib::string serverSpec); + HttpUrlPath(const std::string& urlpath); + HttpUrlPath(const std::string& urlpath, const std::string& serverSpec); + HttpUrlPath(std::string path, + std::map attributes, + std::string serverSpec); ~HttpUrlPath(); - const vespalib::string& getPath() const { return _path; } - const std::map& getAttributes() const + const std::string& getPath() const { return _path; } + const std::map& getAttributes() const { return _attributes; } - bool hasAttribute(const vespalib::string& id) const; - vespalib::string getAttribute(const vespalib::string& id, - const vespalib::string& defaultValue = "") const; + bool hasAttribute(const std::string& id) const; + std::string getAttribute(const std::string& id, + const std::string& defaultValue = "") const; - const vespalib::string& getServerSpec() const { + const std::string& getServerSpec() const { return _serverSpec; } template - T get(const vespalib::string& id, const T& defaultValue = T()) const; + T get(const std::string& id, const T& defaultValue = T()) const; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; template -T HttpUrlPath::get(const vespalib::string& id, const T& defaultValue) const +T HttpUrlPath::get(const std::string& id, const T& defaultValue) const { - std::map::const_iterator it = _attributes.find(id); + std::map::const_iterator it = _attributes.find(id); if (it == _attributes.end()) return defaultValue; T val; std::istringstream ist(it->second); diff --git a/storage/src/vespa/storageframework/generic/status/statusreporter.h b/storage/src/vespa/storageframework/generic/status/statusreporter.h index 7ffbc0a4b3b2..02c56657ebdb 100644 --- a/storage/src/vespa/storageframework/generic/status/statusreporter.h +++ b/storage/src/vespa/storageframework/generic/status/statusreporter.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace storage::framework { @@ -33,12 +33,12 @@ struct StatusReporter { * ^[A-Za-z0-9_]+$. It is used to identify the status page in contexts where * special characters are not wanted, such as in an URL. */ - const vespalib::string& getId() const { return _id; } + const std::string& getId() const { return _id; } /** * Get the descriptive name of the status reported. This string should be * able to contain anything. */ - const vespalib::string& getName() const { return _name; } + const std::string& getName() const { return _name; } virtual bool isValidStatusRequest() const { return true; } @@ -56,7 +56,7 @@ struct StatusReporter { * Called to get content type. * An empty string indicates page not found. */ - virtual vespalib::string getReportContentType(const HttpUrlPath&) const = 0; + virtual std::string getReportContentType(const HttpUrlPath&) const = 0; /** * Called to get the actual content to return in the status request. @@ -66,8 +66,8 @@ struct StatusReporter { virtual bool reportStatus(std::ostream&, const HttpUrlPath&) const = 0; private: - vespalib::string _id; - vespalib::string _name; + std::string _id; + std::string _name; }; diff --git a/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.cpp b/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.cpp index 51a033b3caf6..cdc0518eb8eb 100644 --- a/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.cpp +++ b/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.cpp @@ -35,7 +35,7 @@ XmlStatusReporter::finalizeXmlReport(vespalib::XmlOutputStream& xos, assert(xos.isFinalized()); } -vespalib::string +std::string XmlStatusReporter::getReportContentType(const HttpUrlPath&) const { return "application/xml"; diff --git a/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.h b/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.h index 4ceb6c390507..5377379820b4 100644 --- a/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.h +++ b/storage/src/vespa/storageframework/generic/status/xmlstatusreporter.h @@ -32,14 +32,14 @@ struct XmlStatusReporter : public StatusReporter { /** * @return Empty string if ok, otherwise indicate a failure condition. */ - virtual vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, + virtual std::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const HttpUrlPath&) const = 0; virtual void finalizeXmlReport(vespalib::xml::XmlOutputStream&, const HttpUrlPath&) const; // Implementation of status reporter interface - vespalib::string getReportContentType(const HttpUrlPath&) const override; + std::string getReportContentType(const HttpUrlPath&) const override; bool reportStatus(std::ostream&, const HttpUrlPath&) const override; }; @@ -67,7 +67,7 @@ class PartlyXmlStatusReporter : public XmlStatusReporter { } vespalib::XmlOutputStream& getStream() { return _xos; } - vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const HttpUrlPath&) const override { return ""; } + std::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const HttpUrlPath&) const override { return ""; } template PartlyXmlStatusReporter& operator<<(const T& v) { diff --git a/storage/src/vespa/storageframework/generic/thread/thread.h b/storage/src/vespa/storageframework/generic/thread/thread.h index b0efb42aa448..10a17e9abf42 100644 --- a/storage/src/vespa/storageframework/generic/thread/thread.h +++ b/storage/src/vespa/storageframework/generic/thread/thread.h @@ -27,7 +27,7 @@ struct ThreadTickData { }; class Thread : public ThreadHandle { - vespalib::string _id; + std::string _id; public: using UP = std::unique_ptr; @@ -35,7 +35,7 @@ class Thread : public ThreadHandle { explicit Thread(std::string_view id) : _id(id) {} ~Thread() override = default; - [[nodiscard]] virtual const vespalib::string& getId() const { return _id; } + [[nodiscard]] virtual const std::string& getId() const { return _id; } /** Check whether thread have been interrupted or not. */ [[nodiscard]] bool interrupted() const override = 0; @@ -57,7 +57,7 @@ class Thread : public ThreadHandle { virtual ThreadTickData getTickData() const = 0; virtual const ThreadProperties& getProperties() const = 0; - virtual vespalib::string get_live_thread_stack_trace() const = 0; + virtual std::string get_live_thread_stack_trace() const = 0; /** * Utility function to interrupt and join a thread, possibly broadcasting diff --git a/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp b/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp index ea41a5b7fce4..9fce0957f65a 100644 --- a/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp +++ b/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp @@ -109,7 +109,7 @@ class TickingThreadRunner final : public Runnable { }; class TickingThreadPoolImpl final : public TickingThreadPool { - const vespalib::string _name; + const std::string _name; const vespalib::duration _waitTime; const vespalib::duration _maxProcessTime; const uint32_t _ticksBeforeWait; @@ -187,8 +187,8 @@ class TickingThreadPoolImpl final : public TickingThreadPool { } } - vespalib::string getStatus() override { - vespalib::string result(_tickers.size(), ' '); + std::string getStatus() override { + std::string result(_tickers.size(), ' '); for (uint32_t i=0, n=_tickers.size(); igetState(); } diff --git a/storage/src/vespa/storageframework/generic/thread/tickingthread.h b/storage/src/vespa/storageframework/generic/thread/tickingthread.h index b08bc126aba1..c9435231e633 100644 --- a/storage/src/vespa/storageframework/generic/thread/tickingthread.h +++ b/storage/src/vespa/storageframework/generic/thread/tickingthread.h @@ -18,9 +18,9 @@ */ #pragma once -#include #include -#include +#include +#include namespace storage::framework { @@ -93,7 +93,7 @@ struct TickingThreadPool : public ThreadLock { /** Start all the threads added. */ virtual void start(ThreadPool& pool) = 0; virtual void stop() = 0; - virtual vespalib::string getStatus() = 0; + virtual std::string getStatus() = 0; }; } diff --git a/streamingvisitors/src/tests/document/document_test.cpp b/streamingvisitors/src/tests/document/document_test.cpp index 7de4e6628aa3..55724532553d 100644 --- a/streamingvisitors/src/tests/document/document_test.cpp +++ b/streamingvisitors/src/tests/document/document_test.cpp @@ -97,7 +97,7 @@ TEST(DocumentTest, string_field_id_t_map) t.add("b"); t.add("a"); os << t; - EXPECT_EQ(vespalib::string("a = 1\nb = 0\n"), os.view()); + EXPECT_EQ(std::string("a = 1\nb = 0\n"), os.view()); } } diff --git a/streamingvisitors/src/tests/matching_elements_filler/matching_elements_filler_test.cpp b/streamingvisitors/src/tests/matching_elements_filler/matching_elements_filler_test.cpp index 28adb9669dea..f7e886a7624c 100644 --- a/streamingvisitors/src/tests/matching_elements_filler/matching_elements_filler_test.cpp +++ b/streamingvisitors/src/tests/matching_elements_filler/matching_elements_filler_test.cpp @@ -65,27 +65,27 @@ StructDataType make_elem_type(const Field& name_field, const Field& weight_field } struct BoundTerm { - vespalib::string _bound_term; - BoundTerm(vespalib::string bound_term) + std::string _bound_term; + BoundTerm(std::string bound_term) : _bound_term(std::move(bound_term)) { } BoundTerm(const char* bound_term) - : BoundTerm(vespalib::string(bound_term)) + : BoundTerm(std::string(bound_term)) { } - vespalib::string index() const { + std::string index() const { auto pos = _bound_term.find(':'); - return _bound_term.substr(0, pos != vespalib::string::npos ? pos : 0); + return _bound_term.substr(0, pos != std::string::npos ? pos : 0); } - vespalib::string term() const { + std::string term() const { auto pos = _bound_term.find(':'); - return _bound_term.substr(pos != vespalib::string::npos ? (pos + 1) : 0); + return _bound_term.substr(pos != std::string::npos ? (pos + 1) : 0); } }; Query make_query(std::unique_ptr root) { - vespalib::string stack_dump = StackDumpCreator::create(*root); + std::string stack_dump = StackDumpCreator::create(*root); QueryNodeResultFactory empty; Query query(empty, stack_dump); return query; @@ -102,14 +102,14 @@ struct MyQueryBuilder : public search::query::QueryBuilder make_elem(const vespalib::string& name, int weight) const; + std::unique_ptr make_elem(const std::string& name, int weight) const; std::unique_ptr make_elem_array(std::vector> values) const; std::unique_ptr make_elem_map(std::map> values) const; std::unique_ptr make_str_int_map(std::map values) const; - FieldPath make_field_path(vespalib::string path) const; + FieldPath make_field_path(std::string path) const; std::unique_ptr make_test_doc() const; }; @@ -163,7 +163,7 @@ MyDocType::MyDocType() MyDocType::~MyDocType() = default; std::unique_ptr -MyDocType::make_elem(const vespalib::string& name, int weight) const +MyDocType::make_elem(const std::string& name, int weight) const { auto ret = std::make_unique(_elem_type); ret->setValue(_name_field, StringFieldValue(name)); @@ -202,7 +202,7 @@ MyDocType::make_str_int_map(std::map values) const } FieldPath -MyDocType::make_field_path(vespalib::string path) const +MyDocType::make_field_path(std::string path) const { FieldPath ret; _document_type.buildFieldPath(ret, path); @@ -286,9 +286,9 @@ class MatchingElementsFillerTest : public ::testing::Test { MatchingElementsFillerTest(); ~MatchingElementsFillerTest(); void fill_matching_elements(Query &&query); - void assert_elements(uint32_t doc_lid, const vespalib::string& field, const ElementVector& exp_elements); - void assert_same_element(const vespalib::string& field, const vespalib::string& term1, const vespalib::string& term2, const ElementVector& exp_elements); - void assert_same_element_single(const vespalib::string& field, const vespalib::string& term, const ElementVector& exp_elements); + void assert_elements(uint32_t doc_lid, const std::string& field, const ElementVector& exp_elements); + void assert_same_element(const std::string& field, const std::string& term1, const std::string& term2, const ElementVector& exp_elements); + void assert_same_element_single(const std::string& field, const std::string& term, const ElementVector& exp_elements); }; MatchingElementsFillerTest::MatchingElementsFillerTest() @@ -326,21 +326,21 @@ MatchingElementsFillerTest::fill_matching_elements(Query &&query) } void -MatchingElementsFillerTest::assert_elements(uint32_t doc_lid, const vespalib::string& field, const ElementVector& exp_elements) +MatchingElementsFillerTest::assert_elements(uint32_t doc_lid, const std::string& field, const ElementVector& exp_elements) { auto act_elements = _matching_elements->get_matching_elements(doc_lid, field); EXPECT_EQ(exp_elements, act_elements); } void -MatchingElementsFillerTest::assert_same_element(const vespalib::string& field, const vespalib::string& term1, const vespalib::string& term2, const ElementVector& exp_elements) +MatchingElementsFillerTest::assert_same_element(const std::string& field, const std::string& term1, const std::string& term2, const ElementVector& exp_elements) { fill_matching_elements(make_same_element(field, term1, term2)); assert_elements(1, field, exp_elements); } void -MatchingElementsFillerTest::assert_same_element_single(const vespalib::string& field, const vespalib::string& term, const ElementVector& exp_elements) +MatchingElementsFillerTest::assert_same_element_single(const std::string& field, const std::string& term, const ElementVector& exp_elements) { fill_matching_elements(make_same_element_single(field + "." + term)); assert_elements(1, field, exp_elements); diff --git a/streamingvisitors/src/tests/nearest_neighbor_field_searcher/nearest_neighbor_field_searcher_test.cpp b/streamingvisitors/src/tests/nearest_neighbor_field_searcher/nearest_neighbor_field_searcher_test.cpp index fd49603be291..eafc5fe6a5a7 100644 --- a/streamingvisitors/src/tests/nearest_neighbor_field_searcher/nearest_neighbor_field_searcher_test.cpp +++ b/streamingvisitors/src/tests/nearest_neighbor_field_searcher/nearest_neighbor_field_searcher_test.cpp @@ -32,7 +32,7 @@ using document::TensorFieldValue; struct MockQuery { std::vector> nodes; QueryTermList term_list; - MockQuery& add(const vespalib::string& query_tensor_name, + MockQuery& add(const std::string& query_tensor_name, uint32_t target_hits, double distance_threshold) { std::unique_ptr base; @@ -74,8 +74,8 @@ class NearestNeighborSearcherTest : public testing::Test { env.field_paths->resize(field_id + 1); (*env.field_paths)[field_id].push_back(std::make_unique(data_type, "my_tensor_field")); } - void set_query_tensor(const vespalib::string& query_tensor_name, - const vespalib::string& spec_expr) { + void set_query_tensor(const std::string& query_tensor_name, + const std::string& spec_expr) { search::fef::indexproperties::type::QueryFeature::set(env.index_env.getProperties(), query_tensor_name, tensor_type.to_spec()); auto tensor = SimpleValue::from_spec(TensorSpec::from_expr(spec_expr)); vespalib::nbostream stream; @@ -85,14 +85,14 @@ class NearestNeighborSearcherTest : public testing::Test { void prepare() { env.prepare(searcher, query.term_list); } - void match(const vespalib::string& spec_expr) { + void match(const std::string& spec_expr) { TensorFieldValue fv(data_type); auto tensor = SimpleValue::from_spec(TensorSpec::from_expr(spec_expr)); fv = std::move(tensor); query.reset(); searcher.onValue(fv); } - void expect_match(const vespalib::string& spec_expr, double exp_square_distance, const NearestNeighborQueryNode& node) { + void expect_match(const std::string& spec_expr, double exp_square_distance, const NearestNeighborQueryNode& node) { match(spec_expr); expect_match(exp_square_distance, node); } @@ -102,7 +102,7 @@ class NearestNeighborSearcherTest : public testing::Test { EXPECT_DOUBLE_EQ(exp_square_distance, node.get_distance().value()); EXPECT_DOUBLE_EQ(exp_raw_score, node.get_raw_score().value()); } - void expect_not_match(const vespalib::string& spec_expr, const NearestNeighborQueryNode& node) { + void expect_not_match(const std::string& spec_expr, const NearestNeighborQueryNode& node) { match(spec_expr); EXPECT_FALSE(node.evaluate()); } diff --git a/streamingvisitors/src/tests/query_term_filter_factory/query_term_filter_factory_test.cpp b/streamingvisitors/src/tests/query_term_filter_factory/query_term_filter_factory_test.cpp index 163aafe1d0b2..cab679843e4d 100644 --- a/streamingvisitors/src/tests/query_term_filter_factory/query_term_filter_factory_test.cpp +++ b/streamingvisitors/src/tests/query_term_filter_factory/query_term_filter_factory_test.cpp @@ -24,7 +24,7 @@ class QueryTermFilterFactoryTest : public testing::Test { _factory = std::make_unique(_fields, _summary); } - bool check_view(const vespalib::string& view, const vespalib::string& summary_field) { + bool check_view(const std::string& view, const std::string& summary_field) { if (!_factory) { make_factory(); } @@ -32,7 +32,7 @@ class QueryTermFilterFactoryTest : public testing::Test { return query_term_filter->use_view(view); } - void add_summary_field(const vespalib::string& summary_field_name, const std::vector& field_names) + void add_summary_field(const std::string& summary_field_name, const std::vector& field_names) { VsmsummaryConfigBuilder::Fieldmap field_map; field_map.summary = summary_field_name; @@ -44,7 +44,7 @@ class QueryTermFilterFactoryTest : public testing::Test { _summary.fieldmap.emplace_back(field_map); _factory.reset(); } - void add_index(const vespalib::string& index_name, const std::vector& field_names) + void add_index(const std::string& index_name, const std::vector& field_names) { if (_fields.documenttype.empty()) { _fields.documenttype.resize(1); diff --git a/streamingvisitors/src/tests/querywrapper/querywrapper_test.cpp b/streamingvisitors/src/tests/querywrapper/querywrapper_test.cpp index 6deb0d4cda46..c86018929d62 100644 --- a/streamingvisitors/src/tests/querywrapper/querywrapper_test.cpp +++ b/streamingvisitors/src/tests/querywrapper/querywrapper_test.cpp @@ -30,7 +30,7 @@ TEST(QueryWrapperTest, test_query_wrapper) builder.addStringTerm("e", "", 0, Weight(0)); } Node::UP node = builder.build(); - vespalib::string stackDump = StackDumpCreator::create(*node); + std::string stackDump = StackDumpCreator::create(*node); Query q(empty, stackDump); QueryWrapper wrap(q); QueryWrapper::TermList & tl = wrap.getTermList(); diff --git a/streamingvisitors/src/tests/searcher/searcher_test.cpp b/streamingvisitors/src/tests/searcher/searcher_test.cpp index 93e6db2a5ed4..64468b0a9cd1 100644 --- a/streamingvisitors/src/tests/searcher/searcher_test.cpp +++ b/streamingvisitors/src/tests/searcher/searcher_test.cpp @@ -1187,7 +1187,7 @@ TEST("element lengths") EXPECT_EQUAL(2u, hl[2].element_length()); } -vespalib::string NormalizationInput = "test That Somehing happens with during NårmØlization"; +std::string NormalizationInput = "test That Somehing happens with during NårmØlization"; void verifyNormalization(Normalizing normalizing, size_t expected_len, const char * expected) { diff --git a/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp b/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp index dd5400e10b84..d16050de8e30 100644 --- a/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp +++ b/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp @@ -27,11 +27,11 @@ using namespace storage; namespace streaming { -vespalib::string get_doc_id(int id) { +std::string get_doc_id(int id) { return "id:test:test::" + std::to_string(id); } -vespalib::string src_cfg(std::string_view prefix, std::string_view suffix) { +std::string src_cfg(std::string_view prefix, std::string_view suffix) { return prefix + TEST_PATH("cfg") + suffix; } @@ -51,11 +51,11 @@ struct MyDocument { using DocumentVector = std::vector; struct MyHit { - vespalib::string doc_id; + std::string doc_id; double rank; MyHit(int id, double rank_in) noexcept : doc_id(get_doc_id(id)), rank(rank_in) {} MyHit(int id) noexcept : doc_id(get_doc_id(id)), rank(0.0) {} - MyHit(const vespalib::string& doc_id_in, double rank_in) noexcept : doc_id(doc_id_in), rank(rank_in) {} + MyHit(const std::string& doc_id_in, double rank_in) noexcept : doc_id(doc_id_in), rank(rank_in) {} bool operator==(const MyHit& rhs) const { return (doc_id == rhs.doc_id) && (rank == rhs.rank); @@ -83,25 +83,25 @@ class RequestBuilder { summary_class("default"); summary_count(10); } - RequestBuilder& set_param(const vespalib::string& key, const vespalib::string& value) { + RequestBuilder& set_param(const std::string& key, const std::string& value) { _params.set(key, value); return *this; } - RequestBuilder& search_cluster(const vespalib::string& value) { return set_param("searchcluster", value); } - RequestBuilder& rank_profile(const vespalib::string& value) { return set_param("rankprofile", value); } - RequestBuilder& summary_class(const vespalib::string& value) { return set_param("summaryclass", value); } + RequestBuilder& search_cluster(const std::string& value) { return set_param("searchcluster", value); } + RequestBuilder& rank_profile(const std::string& value) { return set_param("rankprofile", value); } + RequestBuilder& summary_class(const std::string& value) { return set_param("summaryclass", value); } RequestBuilder& summary_count(uint32_t value) { return set_param("summarycount", std::to_string(value)); } - RequestBuilder& string_term(const vespalib::string& term, const vespalib::string& field) { + RequestBuilder& string_term(const std::string& term, const std::string& field) { _builder.addStringTerm(term, field, _term_id++, Weight(100)); return *this; } - RequestBuilder& number_term(const vespalib::string& term, const vespalib::string& field) { + RequestBuilder& number_term(const std::string& term, const std::string& field) { _builder.addNumberTerm(term, field, _term_id++, Weight(100)); return *this; } vdslib::Parameters build() { auto node = _builder.build(); - vespalib::string query_stack_dump = StackDumpCreator::create(*node); + std::string query_stack_dump = StackDumpCreator::create(*node); _params.set("query", query_stack_dump); return _params; } @@ -199,7 +199,7 @@ to_hit_vector(vdslib::SearchResult& res) double rank; for (size_t i = 0; i < res.getHitCount(); ++i) { res.getHit(i, doc_id, rank); - result.emplace_back(vespalib::string(doc_id), rank); + result.emplace_back(std::string(doc_id), rank); } return result; } @@ -213,7 +213,7 @@ to_hit_vector(vdslib::DocumentSummary& sum) size_t sz; for (size_t i = 0; i < sum.getSummaryCount(); ++i) { sum.getSummary(i, doc_id, buf, sz); - result.emplace_back(vespalib::string(doc_id), 0.0); + result.emplace_back(std::string(doc_id), 0.0); } return result; } @@ -233,7 +233,7 @@ expect_summary(const HitVector& exp_summary, documentapi::QueryResultMessage& re } void -expect_match_features(const std::vector& exp_names, +expect_match_features(const std::vector& exp_names, const std::vector& exp_values, documentapi::QueryResultMessage& res) { diff --git a/streamingvisitors/src/tests/tokens_converter/tokens_converter_test.cpp b/streamingvisitors/src/tests/tokens_converter/tokens_converter_test.cpp index 1d9c953519da..c2c8a75dbad0 100644 --- a/streamingvisitors/src/tests/tokens_converter/tokens_converter_test.cpp +++ b/streamingvisitors/src/tests/tokens_converter/tokens_converter_test.cpp @@ -17,7 +17,7 @@ using vsm::TokensConverter; namespace { -vespalib::string +std::string slime_to_string(const Slime& slime) { SimpleBuffer buf; @@ -33,7 +33,7 @@ class TokensConverterTest : public testing::Test TokensConverterTest(); ~TokensConverterTest() override; ; - vespalib::string convert(const StringFieldValue& fv, bool exact_match, Normalizing normalize_mode); + std::string convert(const StringFieldValue& fv, bool exact_match, Normalizing normalize_mode); }; TokensConverterTest::TokensConverterTest() @@ -43,7 +43,7 @@ TokensConverterTest::TokensConverterTest() TokensConverterTest::~TokensConverterTest() = default; -vespalib::string +std::string TokensConverterTest::convert(const StringFieldValue& fv, bool exact_match, Normalizing normalize_mode) { TokensConverter converter(exact_match, normalize_mode); @@ -55,7 +55,7 @@ TokensConverterTest::convert(const StringFieldValue& fv, bool exact_match, Norma TEST_F(TokensConverterTest, convert_empty_string) { - vespalib::string exp(R"([])"); + std::string exp(R"([])"); StringFieldValue plain_string(""); EXPECT_EQ(exp, convert(plain_string, false, Normalizing::NONE)); EXPECT_EQ(exp, convert(plain_string, true, Normalizing::NONE)); @@ -63,8 +63,8 @@ TEST_F(TokensConverterTest, convert_empty_string) TEST_F(TokensConverterTest, convert_exact_match) { - vespalib::string exp_none(R"([".Foo Bar Baz."])"); - vespalib::string exp_lowercase(R"([".foo bar baz."])"); + std::string exp_none(R"([".Foo Bar Baz."])"); + std::string exp_lowercase(R"([".foo bar baz."])"); StringFieldValue plain_string(".Foo Bar Baz."); EXPECT_EQ(exp_none, convert(plain_string, true, Normalizing::NONE)); EXPECT_EQ(exp_lowercase, convert(plain_string, true, Normalizing::LOWERCASE)); @@ -72,8 +72,8 @@ TEST_F(TokensConverterTest, convert_exact_match) TEST_F(TokensConverterTest, convert_tokenized_string) { - vespalib::string exp_none(R"(["Foo","Bar"])"); - vespalib::string exp_lowercase(R"(["foo","bar"])"); + std::string exp_none(R"(["Foo","Bar"])"); + std::string exp_lowercase(R"(["foo","bar"])"); StringFieldValue value(".Foo Bar."); EXPECT_EQ(exp_none, convert(value, false, Normalizing::NONE)); EXPECT_EQ(exp_lowercase, convert(value, false, Normalizing::LOWERCASE)); @@ -81,8 +81,8 @@ TEST_F(TokensConverterTest, convert_tokenized_string) TEST_F(TokensConverterTest, convert_with_folding) { - vespalib::string exp_exact_match_folded(R"(["moerk vaarkveld"])"); - vespalib::string exp_tokenized_folded(R"(["moerk","vaarkveld"])"); + std::string exp_exact_match_folded(R"(["moerk vaarkveld"])"); + std::string exp_tokenized_folded(R"(["moerk","vaarkveld"])"); StringFieldValue value("Mørk vårkveld"); EXPECT_EQ(exp_exact_match_folded, convert(value, true, Normalizing::LOWERCASE_AND_FOLD)); EXPECT_EQ(exp_tokenized_folded, convert(value, false, Normalizing::LOWERCASE_AND_FOLD)); diff --git a/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.cpp b/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.cpp index f547921c4c15..e1d1ff85df8e 100644 --- a/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.cpp @@ -26,7 +26,7 @@ AttributeAccessRecorder::getAttribute(std::string_view name) const { auto ret = _ctx->getAttribute(name); if (ret != nullptr) { - _accessed_attributes.insert(vespalib::string(name)); + _accessed_attributes.insert(std::string(name)); } return ret; } @@ -36,7 +36,7 @@ AttributeAccessRecorder::getAttributeStableEnum(std::string_view name) const { auto ret = _ctx->getAttributeStableEnum(name); if (ret != nullptr) { - _accessed_attributes.insert(vespalib::string(name)); + _accessed_attributes.insert(std::string(name)); } return ret; } @@ -53,10 +53,10 @@ AttributeAccessRecorder::releaseEnumGuards() _ctx->releaseEnumGuards(); } -std::vector +std::vector AttributeAccessRecorder::get_accessed_attributes() const { - std::vector result; + std::vector result; result.reserve(_accessed_attributes.size()); for (auto& attr : _accessed_attributes) { result.emplace_back(attr); diff --git a/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.h b/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.h index d90e82f0258d..b777706bd8c0 100644 --- a/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.h +++ b/streamingvisitors/src/vespa/searchvisitor/attribute_access_recorder.h @@ -14,7 +14,7 @@ namespace streaming { class AttributeAccessRecorder : public search::attribute::IAttributeContext { std::unique_ptr _ctx; - mutable vespalib::hash_set _accessed_attributes; + mutable vespalib::hash_set _accessed_attributes; public: AttributeAccessRecorder(std::unique_ptr ctx); @@ -24,7 +24,7 @@ class AttributeAccessRecorder : public search::attribute::IAttributeContext const search::attribute::IAttributeVector * getAttributeStableEnum(std::string_view name) const override; void getAttributeList(std::vector& list) const override; void releaseEnumGuards() override; - std::vector get_accessed_attributes() const; + std::vector get_accessed_attributes() const; }; } diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp index 143d9ad6e395..a27bc6c8566b 100644 --- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp @@ -149,7 +149,7 @@ HitCollector::fillSearchResult(vdslib::SearchResult & searchResult, FeatureValue { for (uint32_t lid : bestLids()) { const Hit & hit = _hits[lid]; - vespalib::string documentId(hit.getDocument().docDoc().getId().toString()); + std::string documentId(hit.getDocument().docDoc().getId().toString()); search::DocumentIdT docId = hit.getDocId(); SearchResult::RankType rank = hit.getRankScore(); diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h index 2f82e79fa521..00ef25c8a369 100644 --- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h +++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h @@ -7,9 +7,9 @@ #include #include #include -#include #include #include +#include namespace search::fef { class FeatureResolver; } @@ -41,7 +41,7 @@ class HitCollector : public vsm::IDocSumCache const vsm::StorageDocument & getDocument() const noexcept { return *_document; } const std::vector &getMatchData() const noexcept { return _matchData; } search::feature_t getRankScore() const noexcept { return _score; } - const vespalib::string & getSortBlob() const noexcept { return _sortBlob; } + const std::string & getSortBlob() const noexcept { return _sortBlob; } bool operator < (const Hit & b) const noexcept { return getDocId() < b.getDocId(); } int cmpDocId(const Hit & b) const noexcept { return getDocId() - b.getDocId(); } int cmpRank(const Hit & b) const noexcept { @@ -64,7 +64,7 @@ class HitCollector : public vsm::IDocSumCache double _score; vsm::StorageDocument::SP _document; std::vector _matchData; - vespalib::string _sortBlob; + std::string _sortBlob; }; using HitVector = std::vector; using Lids = std::vector; diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp index 5a2b7e87ae2c..99a28e912341 100644 --- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp @@ -24,7 +24,7 @@ IndexEnvironment::IndexEnvironment(IndexEnvironment &&) noexcept = default; IndexEnvironment::~IndexEnvironment() = default; bool -IndexEnvironment::addField(const vespalib::string& name, +IndexEnvironment::addField(const std::string& name, bool isAttribute, search::fef::FieldInfo::DataType data_type) { @@ -50,11 +50,11 @@ IndexEnvironment::addField(const vespalib::string& name, void IndexEnvironment::add_virtual_fields() { - vespalib::hash_set vfields; + vespalib::hash_set vfields; for (auto& field : _fields) { - vespalib::string name(field.name()); + std::string name(field.name()); auto pos = name.rfind('.'); - while (pos != vespalib::string::npos) { + while (pos != std::string::npos) { name = name.substr(0, pos); if (_fieldNames.contains(name)) { break; @@ -88,19 +88,19 @@ IndexEnvironment::set_ranking_assets_repo(std::shared_ptrgetConstant(name); } -vespalib::string -IndexEnvironment::getRankingExpression(const vespalib::string& name) const +std::string +IndexEnvironment::getRankingExpression(const std::string& name) const { return _ranking_assets_repo->getExpression(name); } const search::fef::OnnxModel* -IndexEnvironment::getOnnxModel(const vespalib::string& name) const +IndexEnvironment::getOnnxModel(const std::string& name) const { return _ranking_assets_repo->getOnnxModel(name); } diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h index fdf5d7d870e2..f01bd0393cd7 100644 --- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include namespace search::fef { struct IRankingAssetsRepo; } @@ -23,7 +23,7 @@ namespace streaming { class IndexEnvironment : public search::fef::IIndexEnvironment { private: - using StringInt32Map = vespalib::hash_map; + using StringInt32Map = vespalib::hash_map; const search::fef::ITableManager * _tableManager; search::fef::Properties _properties; std::vector _fields; @@ -68,13 +68,13 @@ class IndexEnvironment : public search::fef::IIndexEnvironment _motivation = motivation; } - vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string& name) const override; + vespalib::eval::ConstantValue::UP getConstantValue(const std::string& name) const override; - vespalib::string getRankingExpression(const vespalib::string& name) const override; + std::string getRankingExpression(const std::string& name) const override; - const search::fef::OnnxModel *getOnnxModel(const vespalib::string& name) const override; + const search::fef::OnnxModel *getOnnxModel(const std::string& name) const override; - bool addField(const vespalib::string& name, + bool addField(const std::string& name, bool isAttribute, search::fef::FieldInfo::DataType data_type); diff --git a/streamingvisitors/src/vespa/searchvisitor/matching_elements_filler.cpp b/streamingvisitors/src/vespa/searchvisitor/matching_elements_filler.cpp index 3cd571381895..8035dd62d994 100644 --- a/streamingvisitors/src/vespa/searchvisitor/matching_elements_filler.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/matching_elements_filler.cpp @@ -33,15 +33,15 @@ namespace { struct SubFieldTerm { - vespalib::string _field_name; + std::string _field_name; const QueryTerm* _term; public: - SubFieldTerm(vespalib::string field_name, const QueryTerm* term) noexcept + SubFieldTerm(std::string field_name, const QueryTerm* term) noexcept : _field_name(std::move(field_name)), _term(term) { } - const vespalib::string& get_field_name() const { return _field_name; } + const std::string& get_field_name() const { return _field_name; } const QueryTerm& get_term() const { return *_term; } }; @@ -55,7 +55,7 @@ class Matcher void select_multiterm_children(const MatchingElementsFields& fields, const MultiTerm& multi_term); void select_query_nodes(const MatchingElementsFields& fields, const QueryNode& query_node); - void add_matching_elements(const vespalib::string& field_name, uint32_t doc_lid, const HitList& hit_list, MatchingElements& matching_elements); + void add_matching_elements(const std::string& field_name, uint32_t doc_lid, const HitList& hit_list, MatchingElements& matching_elements); void find_matching_elements(const SameElementQueryNode& same_element, uint32_t doc_lid, MatchingElements& matching_elements); void find_matching_elements(const SubFieldTerm& sub_field_term, uint32_t doc_lid, MatchingElements& matching_elements); public: @@ -82,7 +82,7 @@ Matcher::~Matcher() = default; void Matcher::select_multiterm_children(const MatchingElementsFields& fields, const MultiTerm& multi_term) { - const vespalib::string* field = nullptr; + const std::string* field = nullptr; auto &multi_term_index = multi_term.getIndex(); if (fields.has_struct_field(multi_term_index)) { field = &fields.get_enclosing_field(multi_term_index); @@ -125,7 +125,7 @@ Matcher::select_query_nodes(const MatchingElementsFields& fields, const QueryNod } void -Matcher::add_matching_elements(const vespalib::string& field_name, uint32_t doc_lid, const HitList& hit_list, MatchingElements& matching_elements) +Matcher::add_matching_elements(const std::string& field_name, uint32_t doc_lid, const HitList& hit_list, MatchingElements& matching_elements) { _elements.clear(); for (auto& hit : hit_list) { diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp index 800d401494a2..055af602b179 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp @@ -12,7 +12,7 @@ using search::IAttributeManager; using search::common::GeoLocationParser; using search::common::GeoLocationSpec; using search::fef::Properties; -using vespalib::string; +using std::string; namespace streaming { @@ -54,7 +54,7 @@ QueryEnvironment::QueryEnvironment(const string & location_str, QueryEnvironment::~QueryEnvironment() {} -void QueryEnvironment::addGeoLocation(const vespalib::string &field, const vespalib::string &location_str) { +void QueryEnvironment::addGeoLocation(const std::string &field, const std::string &location_str) { GeoLocationParser locationParser; if (! locationParser.parseNoField(location_str)) { LOG(warning, "Location parse error (location: '%s'): %s. Location ignored.", diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h index 734394c86adb..6db53bbf4c04 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h @@ -27,13 +27,13 @@ class QueryEnvironment : public search::fef::IQueryEnvironment public: using UP = std::unique_ptr; - QueryEnvironment(const vespalib::string & location, + QueryEnvironment(const std::string & location, const IndexEnvironment & indexEnv, const search::fef::Properties & properties, const search::IAttributeManager * attrMgr); ~QueryEnvironment() override; - void addGeoLocation(const vespalib::string &field, const vespalib::string &location); + void addGeoLocation(const std::string &field, const std::string &location); const search::fef::Properties & getProperties() const override { return _properties; } uint32_t getNumTerms() const override { return _queryTerms.size(); } @@ -46,11 +46,11 @@ class QueryEnvironment : public search::fef::IQueryEnvironment GeoLocationSpecPtrs getAllLocations() const override; const search::attribute::IAttributeContext & getAttributeContext() const override { return *_attrCtx; } - double get_average_field_length(const vespalib::string &) const override { return 100.0; } + double get_average_field_length(const std::string &) const override { return 100.0; } const search::fef::IIndexEnvironment & getIndexEnvironment() const override { return _indexEnv; } void addTerm(const search::fef::ITermData *term) { _queryTerms.push_back(term); } - std::vector get_accessed_attributes() const { return _attrCtx->get_accessed_attributes(); } + std::vector get_accessed_attributes() const { return _attrCtx->get_accessed_attributes(); } }; } // namespace streaming diff --git a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp index c1ca5daf1cbe..035f10d9f1f5 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp @@ -37,8 +37,8 @@ RankManager::Snapshot::addProperties(const vespa::config::search::RankProfilesCo _properties.back().first = curr.name; Properties & p = _properties.back().second; for (uint32_t j = 0; j < curr.fef.property.size(); ++j) { - p.add(vespalib::string(curr.fef.property[j].name.c_str()), - vespalib::string(curr.fef.property[j].value.c_str())); + p.add(std::string(curr.fef.property[j].name.c_str()), + std::string(curr.fef.property[j].value.c_str())); } } } @@ -178,11 +178,11 @@ RankManager::Snapshot::initRankSetup(const BlueprintFactory & factory) LOG(debug, "Number of index environments and rank setups: %u", (uint32_t)_indexEnv.size()); LOG_ASSERT(_properties.size() == _rankSetup.size()); for (uint32_t i = 0; i < _properties.size(); ++i) { - vespalib::string number = fmt("%u", i); + std::string number = fmt("%u", i); _rpmap[number] = i; } for (uint32_t i = 0; i < _properties.size(); ++i) { - const vespalib::string &name = _properties[i].first; + const std::string &name = _properties[i].first; _rpmap[name] = i; } return true; @@ -239,7 +239,7 @@ RankManager::configureRankProfiles(const RankProfilesConfig & cfg, std::shared_p _snapshot.set(snapshot.release()); _snapshot.latch(); // switch to the new config object } else { - vespalib::string msg = "(re-)configuration of rank manager failed"; + std::string msg = "(re-)configuration of rank manager failed"; LOG(error, "%s", msg.c_str()); throw vespalib::Exception(msg, VESPA_STRLOC); } diff --git a/streamingvisitors/src/vespa/searchvisitor/rankmanager.h b/streamingvisitors/src/vespa/searchvisitor/rankmanager.h index 52d44420ebc3..4f9c0385bada 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankmanager.h +++ b/streamingvisitors/src/vespa/searchvisitor/rankmanager.h @@ -45,9 +45,9 @@ class RankManager **/ class Snapshot { private: - using NamedPropertySet = std::pair; - using ViewMap = vespalib::hash_map; - using Map = vespalib::hash_map; + using NamedPropertySet = std::pair; + using ViewMap = vespalib::hash_map; + using Map = vespalib::hash_map; IndexEnvPrototype _protoEnv; std::vector _properties; // property set per rank profile std::vector _indexEnv; // index environment per rank profile @@ -61,7 +61,7 @@ class RankManager void build_field_mappings(const vsm::VsmfieldsHandle& fields); bool initRankSetup(const search::fef::BlueprintFactory & factory); bool setup(const RankManager & manager); - int getIndex(const vespalib::string & key) const { + int getIndex(const std::string & key) const { auto found = _rpmap.find(key); return (found != _rpmap.end()) ? found->second : 0; } @@ -71,16 +71,16 @@ class RankManager ~Snapshot(); const std::vector & getProperties() const { return _properties; } bool setup(const RankManager & manager, const vespa::config::search::RankProfilesConfig & cfg, std::shared_ptr ranking_assets_repo); - const search::fef::RankSetup & getRankSetup(const vespalib::string &rankProfile) const { + const search::fef::RankSetup & getRankSetup(const std::string &rankProfile) const { return *(_rankSetup[getIndex(rankProfile)]); } - const IndexEnvironment & getIndexEnvironment(const vespalib::string &rankProfile) const { + const IndexEnvironment & getIndexEnvironment(const std::string &rankProfile) const { return _indexEnv[getIndex(rankProfile)]; } const IndexEnvironment& get_proto_index_environment() const { return _protoEnv.current(); } - const View *getView(const vespalib::string & index, bool is_same_element) const { + const View *getView(const std::string & index, bool is_same_element) const { auto& views = is_same_element ? _same_element_views : _views; auto itr = views.find(index); if (itr != views.end()) { diff --git a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp index 72c1ca608149..e46cf9e663b4 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.cpp @@ -38,8 +38,8 @@ namespace streaming { namespace { -vespalib::string -getIndexName(const vespalib::string & indexName, const vespalib::string & expandedIndexName) +std::string +getIndexName(const std::string & indexName, const std::string & expandedIndexName) { if (indexName == expandedIndexName) { return indexName; @@ -61,7 +61,7 @@ RankProcessor::resolve_fields_from_children(QueryTermData& qtd, const MultiTerm& { vespalib::hash_set field_ids; for (auto& subterm : mt.get_terms()) { - vespalib::string expandedIndexName = vsm::FieldSearchSpecMap::stripNonFields(subterm->index()); + std::string expandedIndexName = vsm::FieldSearchSpecMap::stripNonFields(subterm->index()); const RankManager::View *view = _rankManagerSnapshot->getView(expandedIndexName, false); if (view != nullptr) { for (auto field_id : *view) { @@ -86,7 +86,7 @@ RankProcessor::resolve_fields_from_children(QueryTermData& qtd, const MultiTerm& void RankProcessor::resolve_fields_from_term(QueryTermData& qtd, const search::streaming::QueryTerm& term) { - vespalib::string expandedIndexName = vsm::FieldSearchSpecMap::stripNonFields(term.index()); + std::string expandedIndexName = vsm::FieldSearchSpecMap::stripNonFields(term.index()); const RankManager::View *view = _rankManagerSnapshot->getView(expandedIndexName, term.is_same_element_query_node()); if (view != nullptr) { for (auto field_id : *view) { @@ -110,8 +110,8 @@ RankProcessor::initQueryEnvironment() if (!term->isRanked()) continue; if (term->isGeoLoc()) { - const vespalib::string & fieldName = term->index(); - const vespalib::string & locStr = term->getTermString(); + const std::string & fieldName = term->index(); + const std::string & locStr = term->getTermString(); _queryEnv.addGeoLocation(fieldName, locStr); } QueryTermData & qtd = dynamic_cast(term->getQueryItem()); @@ -174,9 +174,9 @@ RankProcessor::init(bool forRanking, size_t wantedHitCount, bool use_sort_blob) } RankProcessor::RankProcessor(std::shared_ptr snapshot, - const vespalib::string &rankProfile, + const std::string &rankProfile, Query & query, - const vespalib::string & location, + const std::string & location, const Properties & queryProperties, const Properties & featureOverrides, const search::IAttributeManager * attrMgr) : diff --git a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h index 9cb3e49fc324..592cbb7714eb 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h +++ b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h @@ -64,9 +64,9 @@ class RankProcessor using UP = std::unique_ptr; RankProcessor(std::shared_ptr snapshot, - const vespalib::string &rankProfile, + const std::string &rankProfile, search::streaming::Query & query, - const vespalib::string & location, + const std::string & location, const search::fef::Properties & queryProperties, const search::fef::Properties & featureOverrides, const search::IAttributeManager * attrMgr); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp index fdaa05ab0051..2bb28bc2035b 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp @@ -29,7 +29,7 @@ namespace streaming { __thread SearchEnvironment::EnvMap * SearchEnvironment::_localEnvMap = nullptr; -SearchEnvironment::Env::Env(const config::ConfigUri& configUri, const Fast_NormalizeWordFolder& wf, FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec) +SearchEnvironment::Env::Env(const config::ConfigUri& configUri, const Fast_NormalizeWordFolder& wf, FNET_Transport* transport, const std::string& file_distributor_connection_spec) : _configId(configUri.getConfigId()), _configurer(std::make_unique(createKeySet(configUri.getConfigId()), configUri.getContext()), this), _vsmAdapter(std::make_unique(_configId, wf)), @@ -50,7 +50,7 @@ SearchEnvironment::Env::Env(const config::ConfigUri& configUri, const Fast_Norma } config::ConfigKeySet -SearchEnvironment::Env::createKeySet(const vespalib::string & configId) +SearchEnvironment::Env::createKeySet(const std::string & configId) { config::ConfigKeySet set; set.add()), @@ -124,7 +124,7 @@ SearchEnvironment::~SearchEnvironment() } SearchEnvironment::Env & -SearchEnvironment::getEnv(const vespalib::string & config_id) +SearchEnvironment::getEnv(const std::string & config_id) { config::ConfigUri configUri(_configUri.createWithNewId(config_id)); if (_localEnvMap == nullptr) { @@ -156,7 +156,7 @@ SearchEnvironment::clear_thread_local_env_map() } std::shared_ptr -SearchEnvironment::get_snapshot(const vespalib::string& config_id) +SearchEnvironment::get_snapshot(const std::string& config_id) { return getEnv(config_id).get_snapshot(); } diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h index 4cdc38a286b4..6d219f6014dc 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h @@ -35,18 +35,18 @@ class SearchEnvironment : public storage::VisitorEnvironment class Env : public config::SimpleConfigurable { public: using SP = std::shared_ptr; - Env(const config::ConfigUri& configUri, const Fast_NormalizeWordFolder& wf, FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec); + Env(const config::ConfigUri& configUri, const Fast_NormalizeWordFolder& wf, FNET_Transport* transport, const std::string& file_distributor_connection_spec); ~Env() override; void configure(const config::ConfigSnapshot & snapshot) override; - static config::ConfigKeySet createKeySet(const vespalib::string & configId); + static config::ConfigKeySet createKeySet(const std::string & configId); std::shared_ptr get_snapshot(); private: template void configure_ranking_asset(std::shared_ptr &ranking_asset, const config::ConfigSnapshot& snapshot, search::fef::RankingAssetsBuilder& builder); - const vespalib::string _configId; + const std::string _configId; config::SimpleConfigurer _configurer; std::unique_ptr _vsmAdapter; std::unique_ptr _rankManager; @@ -60,9 +60,9 @@ class SearchEnvironment : public storage::VisitorEnvironment std::shared_ptr _ranking_expressions; std::shared_ptr _ranking_assets_repo; FNET_Transport* const _transport; - const vespalib::string _file_distributor_connection_spec; + const std::string _file_distributor_connection_spec; }; - using EnvMap = vespalib::hash_map; + using EnvMap = vespalib::hash_map; using EnvMapUP = std::unique_ptr; using ThreadLocals = std::vector; @@ -73,14 +73,14 @@ class SearchEnvironment : public storage::VisitorEnvironment std::unique_ptr _wordFolder; config::ConfigUri _configUri; FNET_Transport* const _transport; - vespalib::string _file_distributor_connection_spec; + std::string _file_distributor_connection_spec; - Env & getEnv(const vespalib::string & config_id); + Env & getEnv(const std::string & config_id); public: - SearchEnvironment(const config::ConfigUri & configUri, FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec); + SearchEnvironment(const config::ConfigUri & configUri, FNET_Transport* transport, const std::string& file_distributor_connection_spec); ~SearchEnvironment(); - std::shared_ptr get_snapshot(const vespalib::string& config_id); + std::shared_ptr get_snapshot(const std::string& config_id); std::optional get_oldest_config_generation(); // Should only be used by unit tests to simulate that the calling thread is finished. void clear_thread_local_env_map(); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 364524bbb4ea..10dcf74baba5 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,7 @@ using vsm::DocsumFilter; using vsm::FieldPath; using vsm::StorageDocument; using vsm::StringFieldIdTMap; -using vespalib::string; +using std::string; namespace { @@ -84,7 +85,7 @@ get_search_environment_snapshot(VisitorEnvironment& v_env, const Parameters& par if ( !search_cluster.empty()) { auto schema = extract_schema(params); return schema.empty() - ? env.get_snapshot(vespalib::string(search_cluster)) + ? env.get_snapshot(std::string(search_cluster)) : env.get_snapshot(search_cluster + "/" + schema); } return {}; @@ -115,7 +116,7 @@ enum queryflags { AttributeVector::SP -createMultiValueAttribute(const vespalib::string & name, const document::FieldValue & fv, bool arrayType) +createMultiValueAttribute(const std::string & name, const document::FieldValue & fv, bool arrayType) { const DataType * ndt = fv.getDataType(); const document::CollectionDataType * cdt = ndt->cast_collection(); @@ -156,7 +157,7 @@ get_tensor_type(const document::FieldValue& fv) } AttributeVector::SP -createAttribute(const vespalib::string & name, const document::FieldValue & fv, search::attribute::DistanceMetric dm) +createAttribute(const std::string & name, const document::FieldValue & fv, search::attribute::DistanceMetric dm) { LOG(debug, "Create single value attribute '%s' with value type '%s'", name.c_str(), fv.className()); if (fv.isA(document::FieldValue::Type::BOOL) || fv.isA(document::FieldValue::Type::BYTE) || @@ -216,7 +217,7 @@ SearchVisitor::SummaryGenerator::get_streaming_docsums_state(std::string_view su if (itr != _docsum_states.end()) { return *itr->second; } - vespalib::hash_set fields; + vespalib::hash_set fields; for (const auto& field: _summaryFields) { fields.insert(field); } @@ -238,7 +239,7 @@ SearchVisitor::SummaryGenerator::get_streaming_docsums_state(std::string_view su } ds._args.highlightTerms(_highlight_terms); _docsumWriter->initState(_attr_manager, ds, state->get_resolve_class_info()); - auto insres = _docsum_states.insert(std::make_pair(vespalib::string(summary_class), std::move(state))); + auto insres = _docsum_states.insert(std::make_pair(std::string(summary_class), std::move(state))); return *insres.first->second; } @@ -392,20 +393,20 @@ SearchVisitor::init(const Parameters & params) _attrMan.add(_rankAttributeBacking); Parameters::ValueRef valueRef; if ( params.lookup("summaryclass", valueRef) ) { - _summaryClass = vespalib::string(valueRef.data(), valueRef.size()); + _summaryClass = std::string(valueRef.data(), valueRef.size()); LOG(debug, "Received summary class: %s", _summaryClass.c_str()); } if ( params.lookup("summary-fields", valueRef) ) { vespalib::StringTokenizer fieldTokenizer(valueRef, " "); for (const auto & field : fieldTokenizer) { _summaryGenerator.add_summary_field(field); - LOG(debug, "Received field: %s", vespalib::string(field).c_str()); + LOG(debug, "Received field: %s", std::string(field).c_str()); } } size_t wantedSummaryCount(10); if (params.lookup("summarycount", valueRef) ) { - vespalib::string tmp(valueRef.data(), valueRef.size()); + std::string tmp(valueRef.data(), valueRef.size()); wantedSummaryCount = strtoul(tmp.c_str(), nullptr, 0); LOG(debug, "Received summary count: %ld", wantedSummaryCount); } @@ -422,7 +423,7 @@ SearchVisitor::init(const Parameters & params) // TODO, optional could also include check for if grouping needs rank valueRef = "unranked"; } - vespalib::string tmp(valueRef.data(), valueRef.size()); + std::string tmp(valueRef.data(), valueRef.size()); _rankController.setRankProfile(tmp); LOG(debug, "Received rank profile: %s", _rankController.getRankProfile().c_str()); } @@ -467,7 +468,7 @@ SearchVisitor::init(const Parameters & params) i, j, string(prop.key(j)).c_str(), string(prop.value(j)).c_str()); std::string_view index = prop.key(j); std::string_view term = prop.value(j); - vespalib::string norm_term = QueryNormalization::optional_fold(term, search::TermType::WORD, normalizing_mode(index)); + std::string norm_term = QueryNormalization::optional_fold(term, search::TermType::WORD, normalizing_mode(index)); _summaryGenerator.highlightTerms().add(index, norm_term); } } @@ -477,9 +478,9 @@ SearchVisitor::init(const Parameters & params) LOG(debug, "No rank properties received"); } - vespalib::string location; + std::string location; if (params.lookup("location", valueRef)) { - location = vespalib::string(valueRef.data(), valueRef.size()); + location = std::string(valueRef.data(), valueRef.size()); LOG(debug, "Location = '%s'", location.c_str()); _summaryGenerator.set_location(location); } @@ -489,7 +490,7 @@ SearchVisitor::init(const Parameters & params) if ( hasSortSpec ) { search::uca::UcaConverterFactory ucaFactory; - _sortSpec = search::common::SortSpec(vespalib::string(sortRef.data(), sortRef.size()), ucaFactory); + _sortSpec = search::common::SortSpec(std::string(sortRef.data(), sortRef.size()), ucaFactory); LOG(debug, "Received sort specification: '%s'", _sortSpec.getSpec().c_str()); } @@ -559,7 +560,7 @@ SearchVisitor::init(const Parameters & params) VISITOR_TRACE(6, "Completed lazy VSM adapter initialization"); } -SearchVisitorFactory::SearchVisitorFactory(const config::ConfigUri & configUri, FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec) +SearchVisitorFactory::SearchVisitorFactory(const config::ConfigUri & configUri, FNET_Transport* transport, const std::string& file_distributor_connection_spec) : VisitorFactory(), _configUri(configUri), _env(std::make_shared(_configUri, transport, file_distributor_connection_spec)) @@ -655,7 +656,7 @@ SearchVisitor::RankController::processAccessedAttributes(const QueryEnvironment { auto attributes = queryEnv.get_accessed_attributes(); auto& indexEnv = queryEnv.getIndexEnvironment(); - for (const vespalib::string & name : attributes) { + for (const std::string & name : attributes) { LOG(debug, "Process attribute access hint (%s): '%s'", rank ? "rank" : "dump", name.c_str()); const search::fef::FieldInfo * fieldInfo = indexEnv.getFieldByName(name); if (fieldInfo != nullptr) { @@ -698,7 +699,7 @@ SearchVisitor::RankController::~RankController() = default; void SearchVisitor::RankController::setupRankProcessors(Query & query, - const vespalib::string & location, + const std::string & location, size_t wantedHitCount, bool use_sort_blob, const search::IAttributeManager & attrMan, std::vector & attributeFields) @@ -834,18 +835,18 @@ SearchVisitor::SyntheticFieldsController::onDocument(StorageDocument &) void SearchVisitor::SyntheticFieldsController::onDocumentMatch(StorageDocument & document, - const vespalib::string & documentId) + const std::string & documentId) { document.setField(_documentIdFId, std::make_unique(documentId)); } -std::vector +std::vector SearchVisitor::registerAdditionalFields(const std::vector & docsumSpec) { - std::vector fieldList; + std::vector fieldList; for (const vsm::DocsumTools::FieldSpec & spec : docsumSpec) { fieldList.push_back(spec.getOutputName()); - const std::vector & inputNames = spec.getInputNames(); + const std::vector & inputNames = spec.getInputNames(); for (const auto & name : inputNames) { fieldList.push_back(name); if (PositionDataType::isZCurveFieldName(name)) { @@ -941,7 +942,7 @@ SearchVisitor::setupAttributeVectors() } void SearchVisitor::setupAttributeVector(const FieldPath &fieldPath) { - vespalib::string attrName(fieldPath.front().getName()); + std::string attrName(fieldPath.front().getName()); for (auto ft(fieldPath.begin() + 1), fmt(fieldPath.end()); ft != fmt; ft++) { attrName.append("."); attrName.append((*ft)->getName()); @@ -1122,7 +1123,7 @@ SearchVisitor::handleDocument(StorageDocument::SP documentSP) group(document.docDoc(), 0, true); if (match(document)) { RankProcessor & rp = *_rankController.getRankProcessor(); - vespalib::string documentId(document.docDoc().getId().getScheme().toString()); + std::string documentId(document.docDoc().getId().getScheme().toString()); LOG(debug, "Matched document with id '%s'", documentId.c_str()); document.setDocId(rp.getDocId()); fillAttributeVectors(documentId, document); @@ -1180,7 +1181,7 @@ SearchVisitor::match(const StorageDocument & doc) } void -SearchVisitor::fillAttributeVectors(const vespalib::string & documentId, const StorageDocument & document) +SearchVisitor::fillAttributeVectors(const std::string & documentId, const StorageDocument & document) { for (const AttrInfo & finfo : _attributeFields) { const AttributeGuard &finfoGuard(*finfo._attr); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h index 74a5a25867a7..9fd0f51f59d1 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h @@ -126,7 +126,7 @@ class SearchVisitor : public storage::Visitor, **/ class RankController { private: - vespalib::string _rankProfile; + std::string _rankProfile; std::shared_ptr _rankManagerSnapshot; std::optional _rank_score_drop_limit; bool _hasRanking; @@ -150,8 +150,8 @@ class SearchVisitor : public storage::Visitor, RankController(); ~RankController(); bool valid() const { return bool(_rankProcessor); } - void setRankProfile(const vespalib::string &rankProfile) { _rankProfile = rankProfile; } - const vespalib::string &getRankProfile() const { return _rankProfile; } + void setRankProfile(const std::string &rankProfile) { _rankProfile = rankProfile; } + const std::string &getRankProfile() const { return _rankProfile; } void setRankManagerSnapshot(const std::shared_ptr& snapshot) { _rankManagerSnapshot = snapshot; } search::fef::Properties & getQueryProperties() { return _queryProperties; } search::fef::Properties & getFeatureOverrides() { return _featureOverrides; } @@ -169,7 +169,7 @@ class SearchVisitor : public storage::Visitor, * @param attributeFields the list of attribute vectors needed. **/ void setupRankProcessors(search::streaming::Query & query, - const vespalib::string & location, + const std::string & location, size_t wantedHitCount, bool use_sort_blob, const search::IAttributeManager & attrMan, std::vector & attributeFields); @@ -248,7 +248,7 @@ class SearchVisitor : public storage::Visitor, * @param documentId the document id of the matched document. **/ void onDocumentMatch(vsm::StorageDocument & document, - const vespalib::string & documentId); + const std::string & documentId); }; /** @@ -259,7 +259,7 @@ class SearchVisitor : public storage::Visitor, * @param docsumSpec config with the field names used by the docsum setup. * @param fieldList list of field names that are built. **/ - static std::vector registerAdditionalFields(const std::vector & docsumSpec); + static std::vector registerAdditionalFields(const std::vector & docsumSpec); /** * Setup the field searchers used when matching the query with the stream of documents. @@ -349,7 +349,7 @@ class SearchVisitor : public storage::Visitor, * * @param documentId the document id of the matched document. **/ - void fillAttributeVectors(const vespalib::string & documentId, const vsm::StorageDocument & document); + void fillAttributeVectors(const std::string & documentId, const vsm::StorageDocument & document); /** * Fill the sort buffer based on the attribute vectors needed for sorting. @@ -421,20 +421,20 @@ class SearchVisitor : public storage::Visitor, void setDocsumWriter(IDocsumWriter & docsumWriter) { _docsumWriter = & docsumWriter; } vespalib::ConstBufferRef fillSummary(search::AttributeVector::DocId lid, std::string_view summaryClass) override; void set_dump_features(bool dump_features) { _dump_features = dump_features; } - void set_location(vespalib::string location) { _location = std::move(location); } + void set_location(std::string location) { _location = std::move(location); } void set_stack_dump(std::vector stack_dump) { _stack_dump = std::move(stack_dump); } void add_summary_field(std::string_view field) { _summaryFields.emplace_back(field); } search::fef::Properties & highlightTerms() { return _highlight_terms;} private: StreamingDocsumsState& get_streaming_docsums_state(std::string_view summary_class); vsm::GetDocsumsStateCallback _callback; - vespalib::hash_map> _docsum_states; - std::vector _summaryFields; + vespalib::hash_map> _docsum_states; + std::vector _summaryFields; std::unique_ptr _docsumFilter; search::docsummary::IDocsumWriter * _docsumWriter; vespalib::SmartBuffer _buf; std::optional _dump_features; - std::optional _location; + std::optional _location; std::optional> _stack_dump; search::fef::Properties _highlight_terms; const search::IAttributeManager& _attr_manager; @@ -471,7 +471,7 @@ class SearchVisitor : public storage::Visitor, vsm::DocumentTypeMapping _docTypeMapping; vsm::FieldSearchSpecMap _fieldSearchSpecMap; vsm::SnippetModifierManager _snippetModifierManager; - vespalib::string _summaryClass; + std::string _summaryClass; search::AttributeManager _attrMan; search::attribute::IAttributeContext::UP _attrCtx; SummaryGenerator _summaryGenerator; @@ -503,7 +503,7 @@ class SearchVisitorFactory : public storage::VisitorFactory { storage::Visitor* makeVisitor(storage::StorageComponent&, storage::VisitorEnvironment&env, const vdslib::Parameters& params) override; public: - explicit SearchVisitorFactory(const config::ConfigUri & configUri, FNET_Transport* transport, const vespalib::string& file_distributor_connection_spec); + explicit SearchVisitorFactory(const config::ConfigUri & configUri, FNET_Transport* transport, const std::string& file_distributor_connection_spec); ~SearchVisitorFactory() override; std::optional get_oldest_config_generation() const; }; diff --git a/streamingvisitors/src/vespa/vsm/common/document.cpp b/streamingvisitors/src/vespa/vsm/common/document.cpp index 61b206bc919f..61f22a0f0725 100644 --- a/streamingvisitors/src/vespa/vsm/common/document.cpp +++ b/streamingvisitors/src/vespa/vsm/common/document.cpp @@ -23,7 +23,7 @@ vespalib::asciistream & operator << (vespalib::asciistream & os, const FieldRef vespalib::asciistream & operator << (vespalib::asciistream & os, const StringFieldIdTMap & f) { - std::map ordered(f._map.begin(), f._map.end()); + std::map ordered(f._map.begin(), f._map.end()); for (const auto& elem : ordered) { os << elem.first << " = " << elem.second << '\n'; } @@ -35,12 +35,12 @@ StringFieldIdTMap::StringFieldIdTMap() : { } -void StringFieldIdTMap::add(const vespalib::string & s, FieldIdT fieldId) +void StringFieldIdTMap::add(const std::string & s, FieldIdT fieldId) { _map[s] = fieldId; } -void StringFieldIdTMap::add(const vespalib::string & s) +void StringFieldIdTMap::add(const std::string & s) { if (_map.find(s) == _map.end()) { FieldIdT fieldId = _map.size(); @@ -48,7 +48,7 @@ void StringFieldIdTMap::add(const vespalib::string & s) } } -FieldIdT StringFieldIdTMap::fieldNo(const vespalib::string & fName) const +FieldIdT StringFieldIdTMap::fieldNo(const std::string & fName) const { auto found = _map.find(fName); FieldIdT fNo((found != _map.end()) ? found->second : npos); @@ -70,5 +70,5 @@ Document::~Document() = default; } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, vsm::FieldIdTList); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, vsm::IndexFieldMapT); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, vsm::FieldIdTList); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, vsm::IndexFieldMapT); diff --git a/streamingvisitors/src/vespa/vsm/common/document.h b/streamingvisitors/src/vespa/vsm/common/document.h index 045cdd7ff717..fd8f382842d0 100644 --- a/streamingvisitors/src/vespa/vsm/common/document.h +++ b/streamingvisitors/src/vespa/vsm/common/document.h @@ -17,20 +17,20 @@ using FieldIdT = uint32_t; /// A type to represent a list of FieldIds. using FieldIdTList = std::vector; /// A type to represent all the fields contained in all the indexs. -using IndexFieldMapT = vespalib::hash_map; +using IndexFieldMapT = vespalib::hash_map; /// A type to represent all the fields contained in all the indexs in an all the document types. -using DocumentTypeIndexFieldMapT = vespalib::hash_map; +using DocumentTypeIndexFieldMapT = vespalib::hash_map; /// A type to represent a map from fieldname to fieldid. -using StringFieldIdTMapT = std::map>; +using StringFieldIdTMapT = std::map>; class StringFieldIdTMap { public: enum { npos=0xFFFFFFFF }; StringFieldIdTMap(); - FieldIdT fieldNo(const vespalib::string & fName) const; - void add(const vespalib::string & s); - void add(const vespalib::string & s, FieldIdT fNo); + FieldIdT fieldNo(const std::string & fName) const; + void add(const std::string & s); + void add(const std::string & s, FieldIdT fNo); const StringFieldIdTMapT & map() const { return _map; } size_t highestFieldNo() const; friend vespalib::asciistream & operator << (vespalib::asciistream & os, const StringFieldIdTMap & f); diff --git a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.cpp b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.cpp index de07b252efc6..2853f0fb7e63 100644 --- a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.cpp +++ b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.cpp @@ -21,16 +21,16 @@ DocumentTypeMapping::~DocumentTypeMapping() { } namespace { -vespalib::string getDocTypeId(const document::DocumentType & docType) +std::string getDocTypeId(const document::DocumentType & docType) { - vespalib::string typeId(docType.getName()); + std::string typeId(docType.getName()); typeId += "0"; // Hardcoded version (version not supported) return typeId; } } -void DocumentTypeMapping::init(const vespalib::string & defaultDocumentType, +void DocumentTypeMapping::init(const std::string & defaultDocumentType, const StringFieldIdTMapT & fieldList, const document::DocumentTypeRepo &repo) { @@ -58,7 +58,7 @@ bool DocumentTypeMapping::prepareBaseDoc(SharedFieldPathMap & map) const void DocumentTypeMapping::buildFieldMap( const document::DocumentType *docTypePtr, - const StringFieldIdTMapT & fieldList, const vespalib::string & typeId) + const StringFieldIdTMapT & fieldList, const std::string & typeId) { LOG(debug, "buildFieldMap: docType = '%s', fieldList.size = '%zd', typeId = '%s'", docTypePtr->getName().c_str(), fieldList.size(), typeId.c_str()); @@ -74,7 +74,7 @@ void DocumentTypeMapping::buildFieldMap( size_t validCount(0); for (const auto& elem : fieldList) { - vespalib::string fname = elem.first; + std::string fname = elem.first; LOG(debug, "Handling %s -> %d", fname.c_str(), elem.second); try { if ((elem.first[0] != '[') && (elem.first != "summaryfeatures") && (elem.first != "rankfeatures") && (elem.first != "ranklog") && (elem.first != "sddocname") && (elem.first != "documentid")) { diff --git a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h index d5bb6a08f9f1..b3a70c287f13 100644 --- a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h +++ b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h @@ -23,12 +23,12 @@ class DocumentTypeMapping /** * Builds a field info map for all registered document types. **/ - void init(const vespalib::string & defaultDocumentType, + void init(const std::string & defaultDocumentType, const StringFieldIdTMapT & fieldList, const document::DocumentTypeRepo &repo); const document::DocumentType & getCurrentDocumentType() const; - const vespalib::string & getDefaultDocumentTypeName() const + const std::string & getDefaultDocumentTypeName() const { return _defaultDocumentTypeName; } const document::DocumentType *getDefaultDocumentType() const { return _defaultDocumentType; } @@ -41,11 +41,11 @@ class DocumentTypeMapping **/ void buildFieldMap(const document::DocumentType *docType, const StringFieldIdTMapT & fieldList, - const vespalib::string & typeId); - using FieldPathMapMapT = vespalib::hash_map; + const std::string & typeId); + using FieldPathMapMapT = vespalib::hash_map; using DocumentTypeUsage = std::multimap; FieldPathMapMapT _fieldMap; - vespalib::string _defaultDocumentTypeName; + std::string _defaultDocumentTypeName; const document::DocumentType *_defaultDocumentType; DocumentTypeUsage _documentTypeFreq; }; diff --git a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp index 38e12a3054d9..a621c87745f1 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp @@ -228,7 +228,7 @@ FieldIdTSearcherMap::prepare(const DocumentTypeIndexFieldMapT& difm, const Share { QueryTermList qtl; query.getLeaves(qtl); - vespalib::string tmp; + std::string tmp; for (auto& searcher : *this) { QueryTermList onlyInIndex; vespalib::hash_set seen; diff --git a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.cpp index bbeb3be986f8..220a2c272923 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.cpp @@ -36,7 +36,7 @@ void GeoPosFieldSearcher::prepare(search::streaming::QueryTermList& qtl, _geoPosTerm.clear(); FieldSearcher::prepare(qtl, buf, field_paths, query_env); for (auto qt : qtl) { - const vespalib::string & str = qt->getTermString(); + const std::string & str = qt->getTermString(); GeoLocationParser parser; bool valid = parser.parseNoField(str); if (! valid) { diff --git a/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.cpp index ef57d14d9ceb..163ad78a34c8 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.cpp @@ -145,7 +145,7 @@ NearestNeighborFieldSearcher::distance_metric_from_string(std::string_view value { // Valid string values must match the definition of DistanceMetric in // config-model/src/main/java/com/yahoo/schema/document/Attribute.java - vespalib::string v(value); + std::string v(value); std::transform(v.begin(), v.end(), v.begin(), [](unsigned char c) { return std::tolower(c); }); try { diff --git a/streamingvisitors/src/vespa/vsm/searcher/tokenizereader.cpp b/streamingvisitors/src/vespa/vsm/searcher/tokenizereader.cpp index 5988bdd912f1..d50bb8c66d86 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/tokenizereader.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/tokenizereader.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "tokenizereader.h" +#include namespace vsm { diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp index eddbf41eafdf..3b6851e1fdc1 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp @@ -26,9 +26,9 @@ namespace vsm { namespace { -void populate_fields(MatchingElementsFields& fields, VsmfieldsConfig& fields_config, const vespalib::string& field_name) +void populate_fields(MatchingElementsFields& fields, VsmfieldsConfig& fields_config, const std::string& field_name) { - vespalib::string prefix = field_name + "."; + std::string prefix = field_name + "."; for (const auto& spec : fields_config.fieldspec) { if (spec.name.substr(0, prefix.size()) == prefix) { fields.add_mapping(field_name, spec.name); @@ -44,7 +44,7 @@ bool is_exact_match(std::string_view arg1) { } std::unique_ptr -make_tokens_dfw(const vespalib::string& source, VsmfieldsConfig& fields_config) +make_tokens_dfw(const std::string& source, VsmfieldsConfig& fields_config) { bool exact_match = false; Normalizing normalize_mode = Normalizing::LOWERCASE; @@ -67,9 +67,9 @@ DocsumFieldWriterFactory::DocsumFieldWriterFactory(bool use_v8_geo_positions, co DocsumFieldWriterFactory::~DocsumFieldWriterFactory() = default; std::unique_ptr -DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& field_name, - const vespalib::string& command, - const vespalib::string& source, +DocsumFieldWriterFactory::create_docsum_field_writer(const std::string& field_name, + const std::string& command, + const std::string& source, std::shared_ptr matching_elems_fields) { std::unique_ptr fieldWriter; @@ -86,7 +86,7 @@ DocsumFieldWriterFactory::create_docsum_field_writer(const vespalib::string& fie } else if (command == command::geo_position) { } else if ((command == command::matched_attribute_elements_filter) || (command == command::matched_elements_filter)) { - vespalib::string source_field = source.empty() ? field_name : source; + std::string source_field = source.empty() ? field_name : source; populate_fields(*matching_elems_fields, _vsm_fields_config, source_field); fieldWriter = MatchedElementsFilterDFW::create(source_field, matching_elems_fields); } else if ((command == command::tokens) || diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h index 68fcfd6e8ebe..f6cedc6cb123 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h +++ b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h @@ -19,9 +19,9 @@ class DocsumFieldWriterFactory : public search::docsummary::DocsumFieldWriterFac DocsumFieldWriterFactory(bool use_v8_geo_positions, const search::docsummary::IDocsumEnvironment& env, const search::docsummary::IQueryTermFilterFactory& query_term_filter_factory, const vespa::config::search::vsm::VsmfieldsConfig& vsm_fields_config); ~DocsumFieldWriterFactory() override; std::unique_ptr - create_docsum_field_writer(const vespalib::string& field_name, - const vespalib::string& command, - const vespalib::string& source, + create_docsum_field_writer(const std::string& field_name, + const std::string& command, + const std::string& source, std::shared_ptr matching_elems_fields) override; }; diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp b/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp index 03abbcb7eb21..a51423dc2f3e 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/docsumfilter.cpp @@ -70,7 +70,7 @@ prepareFieldSpec(DocsumFieldSpec & spec, const DocsumTools::FieldSpec & toolsSpe const FieldMap & fieldMap, const FieldPathMapT & fieldPathMap) { { // setup output field - const vespalib::string & name = toolsSpec.getOutputName(); + const std::string & name = toolsSpec.getOutputName(); LOG(debug, "prepareFieldSpec: output field name '%s'", name.c_str()); FieldIdT field = fieldMap.fieldNo(name); if (field != FieldMap::npos) { @@ -178,9 +178,9 @@ class DocsumStoreVsmDocument : public IDocsumStoreDocument public: DocsumStoreVsmDocument(DocsumFilter& docsum_filter, const Document& vsm_document); ~DocsumStoreVsmDocument() override; - DocsumStoreFieldValue get_field_value(const vespalib::string& field_name) const override; - void insert_summary_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const override; - void insert_juniper_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const override; + DocsumStoreFieldValue get_field_value(const std::string& field_name) const override; + void insert_summary_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const override; + void insert_juniper_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const override; void insert_document_id(vespalib::slime::Inserter& inserter) const override; }; @@ -195,7 +195,7 @@ DocsumStoreVsmDocument::DocsumStoreVsmDocument(DocsumFilter& docsum_filter, cons DocsumStoreVsmDocument::~DocsumStoreVsmDocument() = default; DocsumStoreFieldValue -DocsumStoreVsmDocument::get_field_value(const vespalib::string& field_name) const +DocsumStoreVsmDocument::get_field_value(const std::string& field_name) const { if (_document != nullptr) { auto entry_idx = _result_class.getIndexFromName(field_name.c_str()); @@ -219,7 +219,7 @@ DocsumStoreVsmDocument::get_field_value(const vespalib::string& field_name) cons } void -DocsumStoreVsmDocument::insert_summary_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const +DocsumStoreVsmDocument::insert_summary_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IStringFieldConverter* converter) const { if (_document != nullptr) { auto entry_idx = _result_class.getIndexFromName(field_name.c_str()); @@ -243,7 +243,7 @@ DocsumStoreVsmDocument::insert_summary_field(const vespalib::string& field_name, } void -DocsumStoreVsmDocument::insert_juniper_field(const vespalib::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const +DocsumStoreVsmDocument::insert_juniper_field(const std::string& field_name, vespalib::slime::Inserter& inserter, IJuniperConverter& converter) const { auto field_value = get_field_value(field_name); if (field_value) { diff --git a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp index 0b45b73c1df1..b7454a65be8f 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp @@ -60,7 +60,7 @@ FieldSearchSpec::~FieldSearchSpec() = default; FieldSearchSpec::FieldSearchSpec(FieldSearchSpec&& rhs) noexcept = default; FieldSearchSpec& FieldSearchSpec::operator=(FieldSearchSpec&& rhs) noexcept = default; -FieldSearchSpec::FieldSearchSpec(const FieldIdT & fid, const vespalib::string & fname, Searchmethod searchDef, +FieldSearchSpec::FieldSearchSpec(const FieldIdT & fid, const std::string & fname, Searchmethod searchDef, Normalizing normalize_mode, std::string_view arg1_in, size_t maxLength_in) : _id(fid), _name(fname), @@ -179,30 +179,30 @@ namespace { const std::regex G_array("\\[[0-9]+\\]"); } -vespalib::string +std::string FieldSearchSpecMap::stripNonFields(std::string_view rawIndex) { - if ((rawIndex.find('[') != vespalib::string::npos) || (rawIndex.find('{') != vespalib::string::npos)) { + if ((rawIndex.find('[') != std::string::npos) || (rawIndex.find('{') != std::string::npos)) { std::string index = std::regex_replace(std::string(rawIndex), G_map1, G_value); index = std::regex_replace(index, G_map2, G_value); index = std::regex_replace(index, G_array, G_empty); return index; } - return vespalib::string(rawIndex); + return std::string(rawIndex); } void FieldSearchSpecMap::addFieldsFromIndex(std::string_view rawIndex, StringFieldIdTMap & fieldIdMap) const { for (const auto & dtm : documentTypeMap()) { const IndexFieldMapT & fim = dtm.second; - vespalib::string index(stripNonFields(rawIndex)); + std::string index(stripNonFields(rawIndex)); auto fIt = fim.find(index); if (fIt != fim.end()) { for(FieldIdT fid : fIt->second) { const FieldSearchSpec & spec = specMap().find(fid)->second; LOG(debug, "buildFieldsInQuery = rawIndex='%s', index='%s'", std::string(rawIndex).c_str(), index.c_str()); if ((rawIndex != index) && (spec.name().find(index) == 0)) { - vespalib::string modIndex(rawIndex); + std::string modIndex(rawIndex); modIndex.append(spec.name().substr(index.size())); // Note: Multiple raw index names might map to the same field id fieldIdMap.add(modIndex, spec.id()); @@ -237,7 +237,7 @@ FieldSearchSpecMap::buildFieldsInQuery(const Query & query) const } void -FieldSearchSpecMap::buildFromConfig(const std::vector & otherFieldsNeeded) +FieldSearchSpecMap::buildFromConfig(const std::vector & otherFieldsNeeded) { for (const auto & i : otherFieldsNeeded) { _nameIdMap.add(i); @@ -356,7 +356,7 @@ FieldSearchSpecMap::buildSearcherMap(const StringFieldIdTMapT & fieldsInQuery, F } search::attribute::DistanceMetric -FieldSearchSpecMap::get_distance_metric(const vespalib::string& name) const +FieldSearchSpecMap::get_distance_metric(const std::string& name) const { auto dm = search::attribute::DistanceMetric::Euclidean; auto fid = _nameIdMap.fieldNo(name); diff --git a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h index b8cccdc77bd9..c2dedeed2657 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h +++ b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h @@ -15,18 +15,18 @@ class FieldSearchSpec using Searchmethod = VsmfieldsConfig::Fieldspec::Searchmethod; using Normalizing = search::Normalizing; FieldSearchSpec(); - FieldSearchSpec(const FieldIdT & id, const vespalib::string & name, Searchmethod searchMethod, + FieldSearchSpec(const FieldIdT & id, const std::string & name, Searchmethod searchMethod, Normalizing normalize_mode, std::string_view arg1, size_t maxLength); ~FieldSearchSpec(); FieldSearchSpec(FieldSearchSpec&& rhs) noexcept; FieldSearchSpec& operator=(FieldSearchSpec&& rhs) noexcept; const FieldSearcher & searcher() const noexcept { return *_searcher; } - const vespalib::string & name() const noexcept { return _name; } + const std::string & name() const noexcept { return _name; } FieldIdT id() const noexcept { return _id; } bool valid() const noexcept { return static_cast(_searcher); } size_t maxLength() const noexcept { return _maxLength; } Normalizing normalize_mode() const noexcept { return _normalize_mode; } - const vespalib::string& arg1() const noexcept { return _arg1; } + const std::string& arg1() const noexcept { return _arg1; } bool uses_nearest_neighbor_search_method() const noexcept { return _searchMethod == Searchmethod::NEAREST_NEIGHBOR; } @@ -47,12 +47,12 @@ class FieldSearchSpec void propagate_settings_to_searcher(); FieldIdT _id; - vespalib::string _name; + std::string _name; size_t _maxLength; FieldSearcherContainer _searcher; Searchmethod _searchMethod; Normalizing _normalize_mode; - vespalib::string _arg1; + std::string _arg1; bool _reconfigured; }; @@ -74,7 +74,7 @@ class FieldSearchSpecMap /** * Iterates over the given field name vector adding extra elements to the mapping from field name to field id. **/ - void buildFromConfig(const std::vector & otherFieldsNeeded); + void buildFromConfig(const std::vector & otherFieldsNeeded); /** * Reconfigures some of the field searchers based on information in the given query. @@ -99,8 +99,8 @@ class FieldSearchSpecMap const StringFieldIdTMap & nameIdMap() const { return _nameIdMap; } friend vespalib::asciistream & operator <<(vespalib::asciistream & os, const FieldSearchSpecMap & f); - static vespalib::string stripNonFields(std::string_view rawIndex); - search::attribute::DistanceMetric get_distance_metric(const vespalib::string& name) const; + static std::string stripNonFields(std::string_view rawIndex); + search::attribute::DistanceMetric get_distance_metric(const std::string& name) const; static search::Normalizing convert_normalize_mode(VsmfieldsConfig::Fieldspec::Normalize normalize_mode); private: diff --git a/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.cpp b/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.cpp index fd0e7a74f239..fbf67cb45296 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.cpp @@ -25,16 +25,16 @@ FlattenDocsumWriter::onPrimitive(uint32_t, const Content & c) } else if (fv.isNumeric() || fv.isA(document::FieldValue::Type::BOOL)) { - vespalib::string value = fv.getAsString(); + std::string value = fv.getAsString(); _output.put(value.data(), value.size()); } else { - vespalib::string value = fv.toString(); + std::string value = fv.toString(); _output.put(value.data(), value.size()); } _useSeparator = true; } -FlattenDocsumWriter::FlattenDocsumWriter(const vespalib::string & separator) : +FlattenDocsumWriter::FlattenDocsumWriter(const std::string & separator) : _output(32), _separator(separator), _useSeparator(false) diff --git a/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.h b/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.h index f6eb29f9f7ec..69731d3b60a9 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.h +++ b/streamingvisitors/src/vespa/vsm/vsm/flattendocsumwriter.h @@ -14,16 +14,16 @@ namespace vsm { class FlattenDocsumWriter : public document::fieldvalue::IteratorHandler { private: CharBuffer _output; - vespalib::string _separator; + std::string _separator; bool _useSeparator; void considerSeparator(); void onPrimitive(uint32_t, const Content & c) override; public: - FlattenDocsumWriter(const vespalib::string & separator = " "); + FlattenDocsumWriter(const std::string & separator = " "); ~FlattenDocsumWriter(); - void setSeparator(const vespalib::string & separator) { _separator = separator; } + void setSeparator(const std::string & separator) { _separator = separator; } const CharBuffer & getResult() const { return _output; } void clear() { _output.reset(); diff --git a/streamingvisitors/src/vespa/vsm/vsm/query_term_filter_factory.h b/streamingvisitors/src/vespa/vsm/vsm/query_term_filter_factory.h index ff68c8b598e2..c975d8399062 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/query_term_filter_factory.h +++ b/streamingvisitors/src/vespa/vsm/vsm/query_term_filter_factory.h @@ -22,8 +22,8 @@ class QueryTermFilterFactory : public search::docsummary::IQueryTermFilterFactor using VsmfieldsConfig = vespa::config::search::vsm::VsmfieldsConfig; using VsmsummaryConfig = vespa::config::search::vsm::VsmsummaryConfig; private: - using StringSet = vespalib::hash_set; - using StringSetMap = vespalib::hash_map; + using StringSet = vespalib::hash_set; + using StringSetMap = vespalib::hash_map; StringSetMap _view_map; // document field -> views StringSetMap _field_map; // vsm summary field -> document fields void populate_view_map(VsmfieldsConfig& vsm_fields_config); diff --git a/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp b/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp index 2b356b03c392..3b3e836cb59f 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp @@ -83,7 +83,7 @@ SnippetModifier::modify(const FieldValue & fv, const document::FieldPath & path) { reset(); fv.iterateNested(path, *this); - return FieldValue::UP(new StringFieldValue(vespalib::string(_valueBuf->getBuffer(), _valueBuf->getPos()))); + return FieldValue::UP(new StringFieldValue(std::string(_valueBuf->getBuffer(), _valueBuf->getPos()))); } diff --git a/streamingvisitors/src/vespa/vsm/vsm/tokens_converter.cpp b/streamingvisitors/src/vespa/vsm/vsm/tokens_converter.cpp index 3534b7513563..fdb586e7c3c9 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/tokens_converter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/tokens_converter.cpp @@ -34,7 +34,7 @@ TokensConverter::convert(const StringFieldValue &input, Inserter& inserter) Cursor& a = inserter.insertArray(); ArrayInserter ai(a); vespalib::Array buf(_text.size() + 1, 0); - vespalib::string scratch; + std::string scratch; TokenizeReader reader(reinterpret_cast (_text.data()), _text.size(), buf.data()); for (;;) { auto len = _exact_match ? reader.tokenize_exact_match(_normalize_mode) : reader.tokenize(_normalize_mode); diff --git a/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.cpp b/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.cpp index 7861c13a1795..8d3d18351b99 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.cpp @@ -9,7 +9,7 @@ using search::docsummary::GetDocsumsState; namespace vsm { -TokensDFW::TokensDFW(const vespalib::string& input_field_name, bool exact_match, search::Normalizing normalize_mode) +TokensDFW::TokensDFW(const std::string& input_field_name, bool exact_match, search::Normalizing normalize_mode) : DocsumFieldWriter(), _input_field_name(input_field_name), _exact_match(exact_match), diff --git a/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.h b/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.h index 4199630a94d1..bebb9d109449 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.h +++ b/streamingvisitors/src/vespa/vsm/vsm/tokens_dfw.h @@ -15,12 +15,12 @@ namespace vsm { class TokensDFW : public search::docsummary::DocsumFieldWriter { private: - vespalib::string _input_field_name; + std::string _input_field_name; bool _exact_match; search::Normalizing _normalize_mode; public: - explicit TokensDFW(const vespalib::string& input_field_name, bool exact_match, search::Normalizing normalize_mode); + explicit TokensDFW(const std::string& input_field_name, bool exact_match, search::Normalizing normalize_mode); ~TokensDFW() override; bool isGenerated() const override; void insertField(uint32_t docid, const search::docsummary::IDocsumStoreDocument* doc, search::docsummary::GetDocsumsState& state, vespalib::slime::Inserter& target) const override; diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp index e17ca40e5f18..9004881c4af9 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp @@ -167,13 +167,13 @@ VSMAdapter::configure(const VSMConfigSnapshot & snapshot) } } -VSMConfigSnapshot::VSMConfigSnapshot(const vespalib::string & configId, const config::ConfigSnapshot & snapshot) +VSMConfigSnapshot::VSMConfigSnapshot(const std::string & configId, const config::ConfigSnapshot & snapshot) : _configId(configId), _snapshot(std::make_unique(snapshot)) { } VSMConfigSnapshot::~VSMConfigSnapshot() = default; -VSMAdapter::VSMAdapter(const vespalib::string & configId, const Fast_WordFolder& wordFolder) +VSMAdapter::VSMAdapter(const std::string & configId, const Fast_WordFolder& wordFolder) : _configId(configId), _wordFolder(wordFolder), _fieldsCfg(), diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h index a135f1d9fa22..855c6e246fa3 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h @@ -48,17 +48,17 @@ class DocsumTools : public IDocsumEnvironment public: class FieldSpec { private: - vespalib::string _outputName; - std::vector _inputNames; + std::string _outputName; + std::vector _inputNames; VsmsummaryConfig::Fieldmap::Command _command; public: FieldSpec() noexcept; ~FieldSpec(); - const vespalib::string & getOutputName() const { return _outputName; } - void setOutputName(const vespalib::string & name) { _outputName = name; } - const std::vector & getInputNames() const { return _inputNames; } - std::vector & getInputNames() { return _inputNames; } + const std::string & getOutputName() const { return _outputName; } + void setOutputName(const std::string & name) { _outputName = name; } + const std::vector & getInputNames() const { return _inputNames; } + std::vector & getInputNames() { return _inputNames; } VsmsummaryConfig::Fieldmap::Command getCommand() const { return _command; } void setCommand(VsmsummaryConfig::Fieldmap::Command command) { _command = command; } }; @@ -91,10 +91,10 @@ using DocsumToolsPtr = std::shared_ptr; class VSMConfigSnapshot { private: - const vespalib::string _configId; + const std::string _configId; std::unique_ptr _snapshot; public: - VSMConfigSnapshot(const vespalib::string & configId, const config::ConfigSnapshot & snapshot); + VSMConfigSnapshot(const std::string & configId, const config::ConfigSnapshot & snapshot); ~VSMConfigSnapshot(); template std::unique_ptr getConfig() const; @@ -103,14 +103,14 @@ class VSMConfigSnapshot { class VSMAdapter { public: - VSMAdapter(const vespalib::string& configId, const Fast_WordFolder& wordFolder); + VSMAdapter(const std::string& configId, const Fast_WordFolder& wordFolder); virtual ~VSMAdapter(); VsmfieldsHandle getFieldsConfig() const { return _fieldsCfg.get(); } DocsumToolsPtr getDocsumTools() const { return _docsumTools.get(); } void configure(const VSMConfigSnapshot & snapshot); private: - const vespalib::string _configId; + const std::string _configId; const Fast_WordFolder& _wordFolder; vespalib::PtrHolder _fieldsCfg; vespalib::PtrHolder _docsumTools; diff --git a/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp b/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp index dd687ec7c31e..bf83203fb6d9 100644 --- a/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp +++ b/vbench/src/tests/app_dumpurl/app_dumpurl_test.cpp @@ -31,7 +31,7 @@ void readUntil(Input &input, SimpleBuffer &buffer, const string &end) { } TEST("dumpurl usage") { - vespalib::string out; + std::string out; EXPECT_FALSE(Process::run("../../apps/dumpurl/vbench_dumpurl_app", out)); fprintf(stderr, "%s\n", out.c_str()); } @@ -47,7 +47,7 @@ TEST_MT_F("run dumpurl", 2, ServerSocket()) { out.write("\r\n"); out.write("data"); } else { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run(strfmt("../../apps/dumpurl/vbench_dumpurl_app localhost %d /foo", f1.port()).c_str(), out)); fprintf(stderr, "%s\n", out.c_str()); diff --git a/vbench/src/tests/app_vbench/app_vbench_test.cpp b/vbench/src/tests/app_vbench/app_vbench_test.cpp index 7353784fb96a..17c6c4226ae6 100644 --- a/vbench/src/tests/app_vbench/app_vbench_test.cpp +++ b/vbench/src/tests/app_vbench/app_vbench_test.cpp @@ -22,7 +22,7 @@ auto null_crypto = std::make_shared(); auto tls_opts = vespalib::test::make_tls_options_for_testing(); auto tls_crypto = std::make_shared(tls_opts); -void write_file(const vespalib::string &file_name, const vespalib::string &content) { +void write_file(const std::string &file_name, const std::string &content) { int fd = creat(file_name.c_str(), 0600); ASSERT_TRUE(fd >= 0); ssize_t res = write(fd, content.data(), content.size()); @@ -32,7 +32,7 @@ void write_file(const vespalib::string &file_name, const vespalib::string &conte } TEST("vbench usage") { - vespalib::string out; + std::string out; EXPECT_FALSE(Process::run("../../apps/vbench/vbench_app", out)); fprintf(stderr, "%s\n", out.c_str()); } @@ -69,13 +69,13 @@ struct Servers { TEST_MT_F("run vbench", 2, Servers()) { if (thread_id == 0) { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.cfg.template > vbench.cfg", f1.portal->listen_port()).c_str())); EXPECT_TRUE(Process::run("../../apps/vbench/vbench_app run vbench.cfg 2> vbench.out", out)); fprintf(stderr, "null crypto: %s\n", out.c_str()); EXPECT_GREATER(f1.my_get.cnt, 10u); } else { - vespalib::string tls_out; + std::string tls_out; EXPECT_TRUE(Process::run(strfmt("sed 's/_LOCAL_PORT_/%d/' vbench.tls.cfg.template > vbench.tls.cfg", f1.tls_portal->listen_port()).c_str())); EXPECT_TRUE(Process::run("../../apps/vbench/vbench_app run vbench.tls.cfg 2> vbench.tls.out", tls_out)); fprintf(stderr, "tls crypto: %s\n", tls_out.c_str()); diff --git a/vbench/src/vbench/core/string.h b/vbench/src/vbench/core/string.h index 8b8ed6f6f5b8..a25a8fccce94 100644 --- a/vbench/src/vbench/core/string.h +++ b/vbench/src/vbench/core/string.h @@ -2,24 +2,12 @@ #pragma once -#define USE_VESPA_STRING 1 - -#if USE_VESPA_STRING -#include -#else #include -#endif - #include namespace vbench { -// define which string class to use -#if USE_VESPA_STRING -using string = vespalib::string; -#else using string = std::string; -#endif extern string strfmt(const char *fmt, ...) __attribute__ ((format (printf,1,2))); diff --git a/vdslib/src/tests/container/searchresulttest.cpp b/vdslib/src/tests/container/searchresulttest.cpp index 86b3a5956579..c93966a68bd2 100644 --- a/vdslib/src/tests/container/searchresulttest.cpp +++ b/vdslib/src/tests/container/searchresulttest.cpp @@ -9,7 +9,7 @@ using vespalib::FeatureValues; using FeatureValue = vespalib::FeatureSet::Value; -using ConvertedValue = std::variant; +using ConvertedValue = std::variant; namespace vdslib { @@ -60,14 +60,14 @@ void populate(SearchResult& sr, FeatureValues& mf) sr.set_match_features(FeatureValues(mf)); } -void check_match_features(SearchResult& sr, const vespalib::string& label, bool sort_remap) +void check_match_features(SearchResult& sr, const std::string& label, bool sort_remap) { SCOPED_TRACE(label); EXPECT_EQ((std::vector{1.0, "Hi"}), convert(sr.get_match_feature_values(sort_remap ? 1 : 0))); EXPECT_EQ((std::vector{12.0, "There"}), convert(sr.get_match_feature_values(sort_remap ? 0 : 1))); } -void check_match_features(const std::vector & buf, const vespalib::string& label, bool sort_remap) +void check_match_features(const std::vector & buf, const std::string& label, bool sort_remap) { SearchResult sr; deserialize(sr, buf); diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index 4ac5e744f43e..7036bca8af4b 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -174,11 +174,11 @@ struct ExpectedResult { ~ExpectedResult() { } document::BucketId bucket; IdealNodeList nodes; - vespalib::string failure; + std::string failure; }; void -verifyJavaDistribution(const vespalib::string& name, const ClusterState& state, const Distribution& distribution, +verifyJavaDistribution(const std::string& name, const ClusterState& state, const Distribution& distribution, const NodeType& nodeType, uint16_t redundancy, uint16_t nodeCount, std::string_view upStates, const std::vector results) { @@ -200,9 +200,9 @@ verifyJavaDistribution(const vespalib::string& name, const ClusterState& state, }// */ EXPECT_EQ(results[i].nodes.toString(), nodes.toString()) << testId; if (results[i].nodes.size() > 0) { - EXPECT_EQ(vespalib::string("NONE"), results[i].failure) << testId; + EXPECT_EQ(std::string("NONE"), results[i].failure) << testId; } else { - EXPECT_EQ(vespalib::string("NO_DISTRIBUTORS_AVAILABLE"), results[i].failure) << testId; + EXPECT_EQ(std::string("NO_DISTRIBUTORS_AVAILABLE"), results[i].failure) << testId; } } catch (vespalib::Exception& e) { EXPECT_EQ(results[i].failure, e.getMessage()) << testId; @@ -228,12 +228,12 @@ TEST_F(DistributionTest, test_verify_java_distributions_2) vespalib::DirectoryList files(vespalib::listDirectory(source_testdata())); for (uint32_t i=0, n=files.size(); i results; for (uint32_t j=0, m=c["result"].entries(); jgetName()); } for (uint32_t i = 3; i < 6; ++i) { - EXPECT_EQ(vespalib::string("rack1"), + EXPECT_EQ(std::string("rack1"), distr.getNodeGraph().getGroupForNode(i)->getName()); } diff --git a/vdslib/src/tests/distribution/global_bucket_space_distribution_converter_test.cpp b/vdslib/src/tests/distribution/global_bucket_space_distribution_converter_test.cpp index 7d79d3bd5b4a..f4d3169513c2 100644 --- a/vdslib/src/tests/distribution/global_bucket_space_distribution_converter_test.cpp +++ b/vdslib/src/tests/distribution/global_bucket_space_distribution_converter_test.cpp @@ -14,13 +14,13 @@ using DistributionConfig = vespa::config::content::StorDistributionConfig; namespace { -vespalib::string default_to_global_config(const vespalib::string& default_config) { +std::string default_to_global_config(const std::string& default_config) { auto default_cfg = GlobalBucketSpaceDistributionConverter::string_to_config(default_config); auto as_global = GlobalBucketSpaceDistributionConverter::convert_to_global(*default_cfg); return GlobalBucketSpaceDistributionConverter::config_to_string(*as_global); } -vespalib::string default_flat_config( +std::string default_flat_config( R"(redundancy 1 group[1] group[0].name "invalid" @@ -32,7 +32,7 @@ group[0].nodes[1].index 1 group[0].nodes[2].index 2 )"); -vespalib::string expected_flat_global_config( +std::string expected_flat_global_config( R"(redundancy 3 initial_redundancy 0 ensure_primary_persisted true @@ -58,7 +58,7 @@ TEST(GlobalBucketSpaceDistributionConverterTest, can_transform_flat_cluster_conf TEST(GlobalBucketSpaceDistributionConverterTest, can_transform_single_level_multi_group_config) { - vespalib::string default_config( + std::string default_config( R"(redundancy 2 group[3] group[0].name "invalid" @@ -85,7 +85,7 @@ group[2].nodes[2].index 5 // Most crucial parts of the transformed config is the root redundancy // and the new partition config. We test _all_ config fields here so that // we catch anything we miss transferring state of. - vespalib::string expected_global_config( + std::string expected_global_config( R"(redundancy 6 initial_redundancy 0 ensure_primary_persisted true @@ -120,7 +120,7 @@ group[2].nodes[2].retired false } TEST(GlobalBucketSpaceDistributionConverterTest, can_transform_multi_level_multi_group_config) { - vespalib::string default_config( + std::string default_config( R"(redundancy 2 group[5] group[0].name "invalid" @@ -154,7 +154,7 @@ group[6].nodes[0].index 3 )"); // Note: leaf groups do not have a partition spec, only inner groups. - vespalib::string expected_global_config( + std::string expected_global_config( R"(redundancy 4 initial_redundancy 0 ensure_primary_persisted true @@ -204,7 +204,7 @@ group[6].nodes[0].retired false // setups will not produce the expected replica distribution. // TODO Consider disallowing entirely when using global docs. TEST(GlobalBucketSpaceDistributionConverterTest, can_transform_heterogenous_multi_group_config) { - vespalib::string default_config( + std::string default_config( R"(redundancy 2 ready_copies 2 group[3] @@ -223,7 +223,7 @@ group[2].nodes[1] group[2].nodes[1].index 2 )"); - vespalib::string expected_global_config( + std::string expected_global_config( R"(redundancy 3 initial_redundancy 0 ensure_primary_persisted true @@ -259,7 +259,7 @@ TEST(GlobalBucketSpaceDistributionConverterTest, can_transform_concrete_distribu } TEST(GlobalBucketSpaceDistributionConverterTest, config_retired_state_is_propagated) { - vespalib::string default_config( + std::string default_config( R"(redundancy 1 group[1] group[0].name "invalid" @@ -285,7 +285,7 @@ group[0].nodes[2].retired true } TEST(GlobalBucketSpaceDistributionConverterTest, group_capacities_are_propagated) { - vespalib::string default_config( + std::string default_config( R"(redundancy 2 group[3] group[0].name "invalid" @@ -314,7 +314,7 @@ group[2].nodes[0].index 1 } TEST(GlobalBucketSpaceDistributionConverterTest, global_distribution_has_same_owner_distributors_as_default) { - vespalib::string default_config( + std::string default_config( R"(redundancy 2 ready_copies 2 group[3] diff --git a/vdslib/src/tests/distribution/grouptest.cpp b/vdslib/src/tests/distribution/grouptest.cpp index 8e140376461d..9a04489acd45 100644 --- a/vdslib/src/tests/distribution/grouptest.cpp +++ b/vdslib/src/tests/distribution/grouptest.cpp @@ -31,7 +31,7 @@ TEST(GroupTest, test_config_hash) rootGroup.addSubGroup(createLeafGroup(6, "ror", 1.2, "3,10,11")); rootGroup.addSubGroup(createLeafGroup(15, "ing", 1.0, "13,15")); - vespalib::string expected = "(12d1|*(4c1.5;1;4;6;8)(6c1.2;3;10;11)(15;13;15))"; + std::string expected = "(12d1|*(4c1.5;1;4;6;8)(6c1.2;3;10;11)(15;13;15))"; EXPECT_EQ(expected, rootGroup.getDistributionConfigHash()); } @@ -46,7 +46,7 @@ TEST(GroupTest, config_hash_uses_original_input_ordering) rootGroup.addSubGroup(createLeafGroup(2, "fluffy", 1.0, "5,2,7,6")); rootGroup.addSubGroup(createLeafGroup(3, "bunny", 1.0, "15,10,12,11")); - vespalib::string expected = "(1d1|*(2;5;2;7;6)(3;15;10;12;11))"; + std::string expected = "(1d1|*(2;5;2;7;6)(3;15;10;12;11))"; EXPECT_EQ(expected, rootGroup.getDistributionConfigHash()); } @@ -63,7 +63,7 @@ TEST(GroupTest, config_hash_subgroups_are_ordered_by_group_index) rootGroup.addSubGroup(createLeafGroup(3, "bunny", 1.0, "15,10,12,11")); rootGroup.addSubGroup(createLeafGroup(4, "kitten", 1.0, "3,4,8")); - vespalib::string expected = "(1d1|*(3;15;10;12;11)(4;3;4;8)(5;5;2;7;6))"; + std::string expected = "(1d1|*(3;15;10;12;11)(4;3;4;8)(5;5;2;7;6))"; EXPECT_EQ(expected, rootGroup.getDistributionConfigHash()); } diff --git a/vdslib/src/tests/state/cluster_state_bundle_test.cpp b/vdslib/src/tests/state/cluster_state_bundle_test.cpp index 7e5e832b186b..22314cb4cb04 100644 --- a/vdslib/src/tests/state/cluster_state_bundle_test.cpp +++ b/vdslib/src/tests/state/cluster_state_bundle_test.cpp @@ -36,7 +36,7 @@ TEST(ClusterStateBundleTest, baseline_state_is_returned_if_bucket_space_is_not_f } ClusterStateBundle -makeBundle(const vespalib::string &baselineState, const std::map &derivedStates, +makeBundle(const std::string &baselineState, const std::map &derivedStates, bool deferred_activation = false) { ClusterStateBundle::BucketSpaceStateMapping derivedBucketSpaceStates; diff --git a/vdslib/src/tests/state/clusterstatetest.cpp b/vdslib/src/tests/state/clusterstatetest.cpp index e3f98e99d2be..86dddadb4dd4 100644 --- a/vdslib/src/tests/state/clusterstatetest.cpp +++ b/vdslib/src/tests/state/clusterstatetest.cpp @@ -8,7 +8,7 @@ #include #include -using vespalib::string; +using std::string; using ::testing::ContainsRegex; namespace storage::lib { @@ -22,8 +22,8 @@ namespace storage::lib { + state->toString(true) + " in " + std::string(typestr) \ + " format: " + std::string(e.what())); \ } \ - EXPECT_EQ(vespalib::string(typestr) + " \"" + vespalib::string(result) + "\"", \ - vespalib::string(typestr) + " \"" + ost.view() + "\"") << state->toString(true); \ + EXPECT_EQ(std::string(typestr) + " \"" + std::string(result) + "\"", \ + std::string(typestr) + " \"" + ost.view() + "\"") << state->toString(true); \ } #define VERIFY2(serialized, result) { \ diff --git a/vdslib/src/tests/state/nodestatetest.cpp b/vdslib/src/tests/state/nodestatetest.cpp index 8713ce427572..b03ae8774787 100644 --- a/vdslib/src/tests/state/nodestatetest.cpp +++ b/vdslib/src/tests/state/nodestatetest.cpp @@ -63,19 +63,19 @@ TEST(NodeStateTest, test_exponential) TEST(NodeStateTest, state_instances_provide_descriptive_names) { - EXPECT_EQ(vespalib::string("Unknown"), + EXPECT_EQ(std::string("Unknown"), State::UNKNOWN.getName()); - EXPECT_EQ(vespalib::string("Maintenance"), + EXPECT_EQ(std::string("Maintenance"), State::MAINTENANCE.getName()); - EXPECT_EQ(vespalib::string("Down"), + EXPECT_EQ(std::string("Down"), State::DOWN.getName()); - EXPECT_EQ(vespalib::string("Stopping"), + EXPECT_EQ(std::string("Stopping"), State::STOPPING.getName()); - EXPECT_EQ(vespalib::string("Initializing"), + EXPECT_EQ(std::string("Initializing"), State::INITIALIZING.getName()); - EXPECT_EQ(vespalib::string("Retired"), + EXPECT_EQ(std::string("Retired"), State::RETIRED.getName()); - EXPECT_EQ(vespalib::string("Up"), + EXPECT_EQ(std::string("Up"), State::UP.getName()); } diff --git a/vdslib/src/vespa/vdslib/container/parameters.cpp b/vdslib/src/vespa/vdslib/container/parameters.cpp index d2d719ed4167..32a7bd3ce5d3 100644 --- a/vdslib/src/vespa/vdslib/container/parameters.cpp +++ b/vdslib/src/vespa/vdslib/container/parameters.cpp @@ -57,7 +57,7 @@ void Parameters::deserialize(document::ByteBuffer& buffer) for (int i=0; i(v), sz) { } + explicit Value(std::string_view s) noexcept : std::string(s) { } + explicit Value(const std::string & s) noexcept : std::string(s) { } + Value(const void *v, size_t sz) noexcept : std::string(static_cast(v), sz) { } size_t length() const noexcept { return size() - 1; } }; using ValueRef = std::string_view; - using ParametersMap = vespalib::hash_map; + using ParametersMap = vespalib::hash_map; private: ParametersMap _parameters; @@ -59,7 +59,7 @@ class Parameters : public vespalib::xml::XmlSerializable { unsigned int size() const { return _parameters.size(); } bool lookup(KeyT id, ValueRef & v) const; void set(KeyT id, const void * v, size_t sz) { - _parameters[vespalib::string(id)] = Value(v, sz); + _parameters[std::string(id)] = Value(v, sz); } void print(std::ostream& out, bool verbose, const std::string& indent) const; @@ -71,7 +71,7 @@ class Parameters : public vespalib::xml::XmlSerializable { ParametersMap::const_iterator end() const { return _parameters.end(); } /// Convenience from earlier use. void set(KeyT id, std::string_view value) { - _parameters[vespalib::string(id)] = Value(value.data(), value.size()); + _parameters[std::string(id)] = Value(value.data(), value.size()); } void set(KeyT id, int32_t value); void set(KeyT id, int64_t value); @@ -92,7 +92,7 @@ class Parameters : public vespalib::xml::XmlSerializable { template T get(KeyT id, T def) const; - vespalib::string toString() const; + std::string toString() const; }; } // vdslib diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp index 9dbb5341764f..14656c975660 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp +++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp @@ -104,7 +104,7 @@ Distribution::Distribution(const vespa::config::content::StorDistributionConfig configure(config); } -Distribution::Distribution(const vespalib::string& serialized) +Distribution::Distribution(const std::string& serialized) : _distributionBitMasks(getDistributionBitMasks()), _nodeGraph(), _node2Group(), diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.h b/vdslib/src/vespa/vdslib/distribution/distribution.h index 33ec0addf501..76e2b7b33af9 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.h +++ b/vdslib/src/vespa/vdslib/distribution/distribution.h @@ -41,7 +41,7 @@ class Distribution : public document::Printable { uint16_t _readyCopies; bool _activePerGroup; bool _ensurePrimaryPersisted; - vespalib::string _serialized; + std::string _serialized; struct ResultGroup { const Group* _group; @@ -101,12 +101,12 @@ class Distribution : public document::Printable { Distribution(const Distribution&); explicit Distribution(const ConfigWrapper & cfg); explicit Distribution(const DistributionConfig & cfg); - explicit Distribution(const vespalib::string& serialized); + explicit Distribution(const std::string& serialized); ~Distribution() override; Distribution& operator=(const Distribution&) = delete; - [[nodiscard]] const vespalib::string& serialized() const noexcept { return _serialized; } + [[nodiscard]] const std::string& serialized() const noexcept { return _serialized; } [[nodiscard]] const Group& getNodeGraph() const noexcept { return *_nodeGraph; } [[nodiscard]] uint16_t getRedundancy() const noexcept { return _redundancy; } diff --git a/vdslib/src/vespa/vdslib/distribution/distribution_config_util.h b/vdslib/src/vespa/vdslib/distribution/distribution_config_util.h index ca8c7f6e47cc..97503f7ca08c 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution_config_util.h +++ b/vdslib/src/vespa/vdslib/distribution/distribution_config_util.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include #include namespace storage::lib { diff --git a/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.cpp b/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.cpp index ae9f97fd7b43..b46ef9a19141 100644 --- a/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.cpp +++ b/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.cpp @@ -28,7 +28,7 @@ void set_distribution_invariant_config_fields(DistributionConfigBuilder& builder builder.initialRedundancy = 0; } -const Group& find_non_root_group_by_index(const vespalib::string& index, const Group& root) { +const Group& find_non_root_group_by_index(const std::string& index, const Group& root) { auto path = lib::DistributionConfigUtil::getGroupPath(index); auto* node = &root; for (auto idx : path) { @@ -39,7 +39,7 @@ const Group& find_non_root_group_by_index(const vespalib::string& index, const G return *node; } -vespalib::string sub_groups_to_partition_spec(const Group& parent) { +std::string sub_groups_to_partition_spec(const Group& parent) { if (parent.sub_groups.empty()) { return "*"; } @@ -165,13 +165,13 @@ GlobalBucketSpaceDistributionConverter::convert_to_global(const lib::Distributio } std::unique_ptr -GlobalBucketSpaceDistributionConverter::string_to_config(const vespalib::string& cfg) { +GlobalBucketSpaceDistributionConverter::string_to_config(const std::string& cfg) { vespalib::asciistream iss(cfg); config::AsciiConfigReader reader(iss); return reader.read(); } -vespalib::string GlobalBucketSpaceDistributionConverter::config_to_string(const DistributionConfig& cfg) { +std::string GlobalBucketSpaceDistributionConverter::config_to_string(const DistributionConfig& cfg) { vespalib::asciistream ost; config::AsciiConfigWriter writer(ost); writer.write(cfg); diff --git a/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.h b/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.h index e0df5fab554f..dd96054e1be2 100644 --- a/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.h +++ b/vdslib/src/vespa/vdslib/distribution/global_bucket_space_distribution_converter.h @@ -14,8 +14,8 @@ struct GlobalBucketSpaceDistributionConverter { static std::shared_ptr convert_to_global(const lib::Distribution&); // Helper functions which may be of use outside this class - static std::unique_ptr string_to_config(const vespalib::string&); - static vespalib::string config_to_string(const DistributionConfig&); + static std::unique_ptr string_to_config(const std::string&); + static std::string config_to_string(const DistributionConfig&); }; } diff --git a/vdslib/src/vespa/vdslib/distribution/group.cpp b/vdslib/src/vespa/vdslib/distribution/group.cpp index dfc0ecff4a60..4dab817bffcc 100644 --- a/vdslib/src/vespa/vdslib/distribution/group.cpp +++ b/vdslib/src/vespa/vdslib/distribution/group.cpp @@ -189,7 +189,7 @@ Group::getConfigHash(vespalib::asciistream& out) const out << ')'; } -vespalib::string +std::string Group::getDistributionConfigHash() const { vespalib::asciistream ost; getConfigHash(ost); diff --git a/vdslib/src/vespa/vdslib/distribution/group.h b/vdslib/src/vespa/vdslib/distribution/group.h index b37bbfd5202d..262f679fef81 100644 --- a/vdslib/src/vespa/vdslib/distribution/group.h +++ b/vdslib/src/vespa/vdslib/distribution/group.h @@ -29,7 +29,7 @@ class Group : public document::Printable using Distribution = RedundancyGroupDistribution ; private: - vespalib::string _name; + std::string _name; uint16_t _index; uint32_t _distributionHash; Distribution _distributionSpec; @@ -60,7 +60,7 @@ class Group : public document::Printable void print(std::ostream& out, bool verbose, const std::string& indent) const override; vespalib::Double getCapacity() const noexcept { return _capacity; } - const vespalib::string & getName() const noexcept { return _name; } + const std::string & getName() const noexcept { return _name; } uint16_t getIndex() const noexcept { return _index; } std::map& getSubGroups() { return _subGroups; } const std::map& getSubGroups() const noexcept { return _subGroups; } @@ -92,7 +92,7 @@ class Group : public document::Printable * that is critical for distribution. Use to match up two different group * instances in order to verify if they would generate the same distribution */ - vespalib::string getDistributionConfigHash() const; + std::string getDistributionConfigHash() const; }; } diff --git a/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.cpp b/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.cpp index da5cac2d9211..fc299e4cfa74 100644 --- a/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.cpp +++ b/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.cpp @@ -1,8 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "redundancygroupdistribution.h" -#include +#include #include +#include #include #include #include @@ -29,7 +30,7 @@ namespace { firstAsterisk = i; continue; } - uint32_t number = atoi(vespalib::string(st[i]).c_str()); + uint32_t number = atoi(std::string(st[i]).c_str()); if (number <= 0 || number >= 256) { throw vespalib::IllegalArgumentException( "Illegal distribution spec \"" + serialized + "\". " diff --git a/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.h b/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.h index 0fa47c5cae83..649476e4e56d 100644 --- a/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.h +++ b/vdslib/src/vespa/vdslib/distribution/redundancygroupdistribution.h @@ -8,8 +8,9 @@ #pragma once #include +#include +#include #include -#include namespace storage::lib { diff --git a/vdslib/src/vespa/vdslib/state/cluster_state_bundle.cpp b/vdslib/src/vespa/vdslib/state/cluster_state_bundle.cpp index 536de9c895e1..d9d28556c029 100644 --- a/vdslib/src/vespa/vdslib/state/cluster_state_bundle.cpp +++ b/vdslib/src/vespa/vdslib/state/cluster_state_bundle.cpp @@ -9,7 +9,7 @@ namespace storage::lib { ClusterStateBundle::FeedBlock::FeedBlock(bool block_feed_in_cluster_in, - const vespalib::string& description_in) + const std::string& description_in) : _block_feed_in_cluster(block_feed_in_cluster_in), _description(description_in) { diff --git a/vdslib/src/vespa/vdslib/state/cluster_state_bundle.h b/vdslib/src/vespa/vdslib/state/cluster_state_bundle.h index e6763a689d81..0e25b4919044 100644 --- a/vdslib/src/vespa/vdslib/state/cluster_state_bundle.h +++ b/vdslib/src/vespa/vdslib/state/cluster_state_bundle.h @@ -30,13 +30,13 @@ class ClusterStateBundle { class FeedBlock { private: bool _block_feed_in_cluster; - vespalib::string _description; + std::string _description; public: FeedBlock(bool block_feed_in_cluster_in, - const vespalib::string& description_in); + const std::string& description_in); [[nodiscard]] bool block_feed_in_cluster() const noexcept { return _block_feed_in_cluster; } - [[nodiscard]] const vespalib::string& description() const noexcept { return _description; } + [[nodiscard]] const std::string& description() const noexcept { return _description; } bool operator==(const FeedBlock& rhs) const noexcept; bool operator!=(const FeedBlock& rhs) const noexcept { return !operator==(rhs); } }; diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.cpp b/vdslib/src/vespa/vdslib/state/clusterstate.cpp index ac7500028c97..aa1e0ac93910 100644 --- a/vdslib/src/vespa/vdslib/state/clusterstate.cpp +++ b/vdslib/src/vespa/vdslib/state/clusterstate.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -71,14 +72,14 @@ ClusterState::ClusterState(std::string_view serialized) vespalib::StringTokenizer st(serialized, " \t\f\r\n"); st.removeEmptyTokens(); NodeData nodeData; - vespalib::string lastAbsolutePath; + std::string lastAbsolutePath; for (const auto & token : st) { - vespalib::string::size_type index = token.find(':'); - if (index == vespalib::string::npos) { + std::string::size_type index = token.find(':'); + if (index == std::string::npos) { throw IllegalArgumentException("Token " + token + " does not contain ':': " + serialized, VESPA_STRLOC); } - vespalib::string key(token.substr(0, index)); + std::string key(token.substr(0, index)); std::string_view value = token.substr(index + 1); if (!key.empty() && key[0] == '.') { if (lastAbsolutePath.empty()) { @@ -92,7 +93,7 @@ ClusterState::ClusterState(std::string_view serialized) if (key.empty() || ! parse(key, value, nodeData) ) { LOG(debug, "Unknown key %s in systemstate. Ignoring it, assuming it's " "a new feature from a newer version than ourself: %s", - vespalib::string(key).c_str(), vespalib::string(serialized).c_str()); + std::string(key).c_str(), std::string(serialized).c_str()); } } nodeData.addTo(_nodeStates, _nodeCount); @@ -140,8 +141,8 @@ ClusterState::parse(std::string_view key, std::string_view value, NodeData & nod bool ClusterState::parseSorD(std::string_view key, std::string_view value, NodeData & nodeData) { const NodeType* nodeType = nullptr; - vespalib::string::size_type dot = key.find('.'); - std::string_view type(dot == vespalib::string::npos + std::string::size_type dot = key.find('.'); + std::string_view type(dot == std::string::npos ? key : key.substr(0, dot)); if (type == "storage") { nodeType = &NodeType::STORAGE; @@ -149,7 +150,7 @@ ClusterState::parseSorD(std::string_view key, std::string_view value, NodeData & nodeType = &NodeType::DISTRIBUTOR; } if (nodeType == nullptr) return false; - if (dot == vespalib::string::npos) { // Entry that set node counts + if (dot == std::string::npos) { // Entry that set node counts uint16_t nodeCount = atoi(value.data()); if (nodeCount > _nodeCount[*nodeType] ) { @@ -157,8 +158,8 @@ ClusterState::parseSorD(std::string_view key, std::string_view value, NodeData & } return true; } - vespalib::string::size_type dot2 = key.find('.', dot + 1); - Node node(*nodeType, (dot2 == vespalib::string::npos) + std::string::size_type dot2 = key.find('.', dot + 1); + Node node(*nodeType, (dot2 == std::string::npos) ? atoi(key.substr(dot + 1).data()) : atoi(key.substr(dot + 1, dot2 - dot - 1).data())); @@ -170,7 +171,7 @@ ClusterState::parseSorD(std::string_view key, std::string_view value, NodeData & if (nodeData.node != node) { nodeData.addTo(_nodeStates, _nodeCount); } - if (dot2 == vespalib::string::npos) { + if (dot2 == std::string::npos) { return false; // No default key for nodes. } else { nodeData.ost << " " << key.substr(dot2 + 1) << ':' << value; diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.h b/vdslib/src/vespa/vdslib/state/clusterstate.h index 851828da4c26..db37227b16e4 100644 --- a/vdslib/src/vespa/vdslib/state/clusterstate.h +++ b/vdslib/src/vespa/vdslib/state/clusterstate.h @@ -78,7 +78,7 @@ class ClusterState : public document::Printable { NodeCounts _nodeCount; const State* _clusterState; NodeMap _nodeStates; - vespalib::string _description; + std::string _description; uint16_t _distributionBits; }; diff --git a/vdslib/src/vespa/vdslib/state/nodestate.cpp b/vdslib/src/vespa/vdslib/state/nodestate.cpp index 8cb6e3b62c61..06a7a297b634 100644 --- a/vdslib/src/vespa/vdslib/state/nodestate.cpp +++ b/vdslib/src/vespa/vdslib/state/nodestate.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -121,7 +122,7 @@ NodeState::NodeState(std::string_view serialized, const NodeType* type) } LOG(debug, "Unknown key %s in nodestate. Ignoring it, assuming it's a " "new feature from a newer version than ourself: %s", - std::string(key).c_str(), vespalib::string(serialized).c_str()); + std::string(key).c_str(), std::string(serialized).c_str()); } } diff --git a/vdslib/src/vespa/vdslib/state/nodestate.h b/vdslib/src/vespa/vdslib/state/nodestate.h index cf7c4f039ca4..5c0c0af22d38 100644 --- a/vdslib/src/vespa/vdslib/state/nodestate.h +++ b/vdslib/src/vespa/vdslib/state/nodestate.h @@ -21,7 +21,7 @@ class NodeState : public document::Printable { const NodeType* _type; const State* _state; - vespalib::string _description; + std::string _description; vespalib::Double _capacity; vespalib::Double _initProgress; uint32_t _minUsedBits; @@ -58,7 +58,7 @@ class NodeState : public document::Printable [[nodiscard]] vespalib::Double getCapacity() const { return _capacity; } [[nodiscard]] uint32_t getMinUsedBits() const { return _minUsedBits; } [[nodiscard]] vespalib::Double getInitProgress() const { return _initProgress; } - [[nodiscard]] const vespalib::string& getDescription() const { return _description; } + [[nodiscard]] const std::string& getDescription() const { return _description; } [[nodiscard]] uint64_t getStartTimestamp() const { return _startTimestamp; } void setState(const State& state); diff --git a/vdslib/src/vespa/vdslib/state/nodetype.cpp b/vdslib/src/vespa/vdslib/state/nodetype.cpp index 920baec2561e..be67c8f6c87a 100644 --- a/vdslib/src/vespa/vdslib/state/nodetype.cpp +++ b/vdslib/src/vespa/vdslib/state/nodetype.cpp @@ -1,8 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "nodetype.h" -#include #include +#include +#include #include #include diff --git a/vdslib/src/vespa/vdslib/state/nodetype.h b/vdslib/src/vespa/vdslib/state/nodetype.h index 5875d1121158..147eea0c078a 100644 --- a/vdslib/src/vespa/vdslib/state/nodetype.h +++ b/vdslib/src/vespa/vdslib/state/nodetype.h @@ -9,7 +9,8 @@ */ #pragma once -#include +#include +#include namespace vespalib { class asciistream; @@ -30,12 +31,12 @@ class NodeType { /** Throws vespalib::IllegalArgumentException if invalid state given. */ static const NodeType& get(std::string_view serialized); static const NodeType& get(Type type) noexcept; - const vespalib::string& serialize() const noexcept { return _name; } + const std::string& serialize() const noexcept { return _name; } Type getType() const noexcept { return _type; } operator uint16_t() const noexcept { return static_cast(_type); } - const vespalib::string & toString() const noexcept { return _name; } + const std::string & toString() const noexcept { return _name; } bool operator==(const NodeType& other) const noexcept { return (&other == this); } bool operator!=(const NodeType& other) const noexcept { return (&other != this); } @@ -44,7 +45,7 @@ class NodeType { } private: Type _type; - vespalib::string _name; + std::string _name; NodeType(std::string_view name, Type type) noexcept; }; diff --git a/vdslib/src/vespa/vdslib/state/state.cpp b/vdslib/src/vespa/vdslib/state/state.cpp index 6b9ed5c52811..e9f5ce923a6e 100644 --- a/vdslib/src/vespa/vdslib/state/state.cpp +++ b/vdslib/src/vespa/vdslib/state/state.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include +#include #include #include diff --git a/vdslib/src/vespa/vdslib/state/state.h b/vdslib/src/vespa/vdslib/state/state.h index 20f59c3bfa6a..94138f0cd29b 100644 --- a/vdslib/src/vespa/vdslib/state/state.h +++ b/vdslib/src/vespa/vdslib/state/state.h @@ -11,14 +11,14 @@ #include "nodetype.h" #include -#include +#include #include namespace storage::lib { class State : public vespalib::Printable { - vespalib::string _name; - vespalib::string _serialized; + std::string _name; + std::string _serialized; uint8_t _rankValue; std::vector _validReportedNodeState; std::vector _validWantedNodeState; @@ -45,7 +45,7 @@ class State : public vespalib::Printable { /** Throws vespalib::IllegalArgumentException if invalid state given. */ static const State& get(std::string_view serialized); - const vespalib::string& serialize() const { return _serialized; } + const std::string& serialize() const { return _serialized; } bool validReportedNodeState(const NodeType& node) const { return _validReportedNodeState[node]; } bool validWantedNodeState(const NodeType& node) const { return _validWantedNodeState[node]; } @@ -62,7 +62,7 @@ class State : public vespalib::Printable { * * Example: State::RETIRED.getName() -> "Retired" */ - const vespalib::string& getName() const noexcept { + const std::string& getName() const noexcept { return _name; } diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/params.h b/vespaclient/src/vespa/vespaclient/vesparoute/params.h index ff51d5e73c5d..4d3e26b495e0 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/params.h +++ b/vespaclient/src/vespa/vespaclient/vesparoute/params.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include #include #include -#include namespace vesparoute { diff --git a/vespalib/src/apps/vespa-detect-hostname/detect_hostname.cpp b/vespalib/src/apps/vespa-detect-hostname/detect_hostname.cpp index 978c66533527..e90c3e029b39 100644 --- a/vespalib/src/apps/vespa-detect-hostname/detect_hostname.cpp +++ b/vespalib/src/apps/vespa-detect-hostname/detect_hostname.cpp @@ -2,35 +2,35 @@ #include #include -#include #include #include #include +#include using vespalib::SocketAddress; -std::set make_ip_set() { - std::set result; +std::set make_ip_set() { + std::set result; for (const auto &addr: SocketAddress::get_interfaces()) { result.insert(addr.ip_address()); } return result; } -vespalib::string get_hostname() { +std::string get_hostname() { std::vector result(4_Ki, '\0'); gethostname(&result[0], 4000); return SocketAddress::normalize(&result[0]); } -bool check(const vespalib::string &name, const std::set &ip_set, vespalib::string &error_msg) { +bool check(const std::string &name, const std::set &ip_set, std::string &error_msg) { auto addr_list = SocketAddress::resolve(80, name.c_str()); if (addr_list.empty()) { error_msg = vespalib::make_string("hostname '%s' could not be resolved", name.c_str()); return false; } for (const SocketAddress &addr: addr_list) { - vespalib::string ip_addr = addr.ip_address(); + std::string ip_addr = addr.ip_address(); if (ip_set.count(ip_addr) == 0) { error_msg = vespalib::make_string("hostname '%s' resolves to ip address not owned by this host (%s)", name.c_str(), ip_addr.c_str()); @@ -42,10 +42,10 @@ bool check(const vespalib::string &name, const std::set &ip_se int main(int, char **) { auto my_ip_set = make_ip_set(); - vespalib::string my_hostname = get_hostname(); - vespalib::string my_hostname_error; - vespalib::string localhost = "localhost"; - vespalib::string localhost_error; + std::string my_hostname = get_hostname(); + std::string my_hostname_error; + std::string localhost = "localhost"; + std::string localhost_error; if (check(my_hostname, my_ip_set, my_hostname_error)) { fprintf(stdout, "%s\n", my_hostname.c_str()); } else if (check(localhost, my_ip_set, localhost_error)) { diff --git a/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp b/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp index 5c6b977b2aac..8c6b2b230ab9 100644 --- a/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp +++ b/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -11,11 +10,12 @@ #include #include #include +#include #include using vespalib::make_string_short::fmt; -constexpr auto npos = vespalib::string::npos; +constexpr auto npos = std::string::npos; //----------------------------------------------------------------------------- @@ -34,7 +34,7 @@ class Hasher { uint64_t get() const { return XXH3_64bits_digest(_state); } }; -uint64_t get_hash(const std::vector &list) { +uint64_t get_hash(const std::vector &list) { static Hasher hasher; hasher.reset(); for (const auto &item: list) { @@ -47,13 +47,13 @@ uint64_t get_hash(const std::vector &list) { class SymbolHist { private: - std::map _hist; + std::map _hist; public: - void add(const vespalib::string &value, size_t weight) { + void add(const std::string &value, size_t weight) { _hist[value] += weight; } void dump(FILE *dst) { - std::vector> entries; + std::vector> entries; for (const auto &entry: _hist) { entries.push_back(entry); } @@ -80,7 +80,7 @@ class SymbolHist { //----------------------------------------------------------------------------- -vespalib::string get_symbol_from_frame(const vespalib::string &frame) { +std::string get_symbol_from_frame(const std::string &frame) { auto pos1 = frame.find("#"); pos1 = frame.find(" ", pos1); auto pos2 = frame.rfind(" /"); @@ -93,14 +93,14 @@ vespalib::string get_symbol_from_frame(const vespalib::string &frame) { return frame.substr(pos1+1, pos2-pos1-1); } -void strip_after(vespalib::string &str, const vespalib::string &delimiter) { +void strip_after(std::string &str, const std::string &delimiter) { auto pos = str.find(delimiter); if (pos != npos) { str = str.substr(0, pos); } } -void replace_first(vespalib::string &str, const vespalib::string &old_str, const vespalib::string &new_str) { +void replace_first(std::string &str, const std::string &old_str, const std::string &new_str) { auto pos = str.find(old_str); if (pos != npos) { str.replace(pos, old_str.size(), new_str); @@ -109,18 +109,18 @@ void replace_first(vespalib::string &str, const vespalib::string &old_str, const class StackTrace { private: - vespalib::string _heading; - std::vector _frames; + std::string _heading; + std::vector _frames; uint64_t _hash; bool _is_read; bool _is_write; public: - StackTrace(const vespalib::string &heading) noexcept; + StackTrace(const std::string &heading) noexcept; StackTrace(const StackTrace &); StackTrace(StackTrace &&) noexcept; StackTrace & operator=(StackTrace &&) noexcept; ~StackTrace(); - void add_frame(const vespalib::string &frame) { + void add_frame(const std::string &frame) { _frames.push_back(frame); } void done() { @@ -141,8 +141,8 @@ class StackTrace { hist.add(get_symbol_from_frame(frame), weight); } } - const vespalib::string &heading() const { return _heading; } - void dump(FILE *dst, const vespalib::string &info) const { + const std::string &heading() const { return _heading; } + void dump(FILE *dst, const std::string &info) const { fprintf(dst, "%s %s\n", _heading.c_str(), info.c_str()); for (const auto &frame: _frames) { fprintf(dst, "%s\n", frame.c_str()); @@ -151,7 +151,7 @@ class StackTrace { } }; -StackTrace::StackTrace(const vespalib::string &heading) noexcept +StackTrace::StackTrace(const std::string &heading) noexcept : _heading(heading), _frames(), _hash(), _is_read(false), _is_write(false) {} StackTrace::StackTrace(const StackTrace &) = default; @@ -160,7 +160,7 @@ StackTrace & StackTrace::operator=(StackTrace &&) noexcept = default; StackTrace::~StackTrace() = default; std::vector -extract_traces(const std::vector &lines, size_t cutoff) { +extract_traces(const std::vector &lines, size_t cutoff) { std::vector result; for (size_t i = 1; (i < lines.size()) && (result.size() < cutoff); ++i) { auto pos = lines[i].find("#0 "); @@ -186,7 +186,7 @@ extract_traces(const std::vector &lines, size_t cutoff) { enum class ReportType { UNKNOWN, RACE }; -ReportType detect_report_type(const std::vector &lines) { +ReportType detect_report_type(const std::vector &lines) { for (const auto &line: lines) { if (line.starts_with("WARNING: ThreadSanitizer: data race")) { return ReportType::RACE; @@ -197,7 +197,7 @@ ReportType detect_report_type(const std::vector &lines) { //----------------------------------------------------------------------------- -bool is_delimiter(const vespalib::string &line) { +bool is_delimiter(const std::string &line) { // TSAN delimiter is 18=, look for at least 16= return (line.find("================") < line.size()); } @@ -211,7 +211,7 @@ void dump_delimiter(FILE *dst) { struct Report { using UP = std::unique_ptr; using SP = std::shared_ptr; - virtual std::vector make_keys() const = 0; + virtual std::vector make_keys() const = 0; virtual void merge(const Report &report) = 0; virtual size_t count() const = 0; virtual void dump(FILE *dst) const = 0; @@ -222,15 +222,15 @@ size_t raw_reports = 0; class RawReport : public Report { private: - std::vector _lines; + std::vector _lines; size_t _count; public: - RawReport(const std::vector &lines) + RawReport(const std::vector &lines) : _lines(lines), _count(1) { ++raw_reports; } - std::vector make_keys() const override { + std::vector make_keys() const override { return {fmt("raw:%" PRIu64, get_hash(_lines))}; } void merge(const Report &) override { ++_count; } @@ -285,8 +285,8 @@ class RaceReport : public Report { } } - std::vector make_keys() const override { - std::vector result; + std::vector make_keys() const override { + std::vector result; for (const auto &node: _nodes) { result.push_back(fmt("race:%" PRIu64, node.trace.hash())); } @@ -325,7 +325,7 @@ class RaceReport : public Report { //----------------------------------------------------------------------------- -using ReportMap = std::map; +using ReportMap = std::map; using MapPos = ReportMap::const_iterator; size_t total_reports = 0; @@ -361,7 +361,7 @@ void handle_report(std::unique_ptr report) { } } -void make_report(const std::vector &lines) { +void make_report(const std::vector &lines) { auto type = detect_report_type(lines); if (type == ReportType::RACE) { auto traces = extract_traces(lines, 2); @@ -378,9 +378,9 @@ void make_report(const std::vector &lines) { return handle_report(std::make_unique(lines)); } -void handle_line(const vespalib::string &line) { +void handle_line(const std::string &line) { static bool inside = false; - static std::vector lines; + static std::vector lines; if (is_delimiter(line)) { inside = !inside; if (!inside && !lines.empty()) { @@ -395,7 +395,7 @@ void handle_line(const vespalib::string &line) { void read_input() { char buf[64_Ki]; bool eof = false; - vespalib::string line; + std::string line; while (!eof) { ssize_t res = read(STDIN_FILENO, buf, sizeof(buf)); if (res < 0) { @@ -443,7 +443,7 @@ int main(int, char **) { try { read_input(); write_output(); - } catch (vespalib::string &err) { + } catch (std::string &err) { fprintf(stderr, "%s\n", err.c_str()); return 1; } diff --git a/vespalib/src/apps/vespa-validate-hostname/validate_hostname.cpp b/vespalib/src/apps/vespa-validate-hostname/validate_hostname.cpp index 37d9b8a349fe..7d96fe0f6a64 100644 --- a/vespalib/src/apps/vespa-validate-hostname/validate_hostname.cpp +++ b/vespalib/src/apps/vespa-validate-hostname/validate_hostname.cpp @@ -2,21 +2,21 @@ #include #include -#include #include +#include using vespalib::SocketAddress; -std::set make_ip_set() { - std::set result; +std::set make_ip_set() { + std::set result; for (const auto &addr: SocketAddress::get_interfaces()) { result.insert(addr.ip_address()); } return result; } -vespalib::string normalize(const vespalib::string &hostname) { - vespalib::string canon_name = SocketAddress::normalize(hostname); +std::string normalize(const std::string &hostname) { + std::string canon_name = SocketAddress::normalize(hostname); if (canon_name != hostname) { fprintf(stderr, "warning: hostname validation: '%s' is not same as canonical hostname '%s'\n", hostname.c_str(), canon_name.c_str()); @@ -35,7 +35,7 @@ int main(int argc, char **argv) { } bool valid = true; auto my_ip_set = make_ip_set(); - vespalib::string hostname = normalize(argv[1]); + std::string hostname = normalize(argv[1]); auto addr_list = SocketAddress::resolve(80, hostname.c_str()); if (addr_list.empty()) { valid = false; @@ -43,7 +43,7 @@ int main(int argc, char **argv) { hostname.c_str()); } for (const SocketAddress &addr: addr_list) { - vespalib::string ip_addr = addr.ip_address(); + std::string ip_addr = addr.ip_address(); if (my_ip_set.count(ip_addr) == 0) { valid = false; fprintf(stderr, "FATAL: hostname validation failed: '%s' resolves to ip address not owned by this host (%s)\n", diff --git a/vespalib/src/tests/array/array_test.cpp b/vespalib/src/tests/array/array_test.cpp index 4fd051672bba..f0f3dc1930f0 100644 --- a/vespalib/src/tests/array/array_test.cpp +++ b/vespalib/src/tests/array/array_test.cpp @@ -1,14 +1,14 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include #include #include #include -#include #include +#include +#include using namespace vespalib; @@ -107,12 +107,12 @@ testArray(const T & a, const T & b) TEST("test basic array functionality") { testArray(7, 9); - testArray("7", "9"); - const char * longS1 = "more than 48 bytes bytes that are needed to avoid the small string optimisation in vespalib::string"; - const char * longS2 = "even more more than 48 bytes bytes that are needed to avoid the small string optimisation in vespalib::string"; - EXPECT_TRUE(strlen(longS1) > sizeof(vespalib::string)); - EXPECT_TRUE(strlen(longS2) > sizeof(vespalib::string)); - testArray(longS1, longS2); + testArray("7", "9"); + const char * longS1 = "more than 48 bytes bytes that are needed to avoid the small string optimisation in std::string"; + const char * longS2 = "even more more than 48 bytes bytes that are needed to avoid the small string optimisation in std::string"; + EXPECT_TRUE(strlen(longS1) > sizeof(std::string)); + EXPECT_TRUE(strlen(longS2) > sizeof(std::string)); + testArray(longS1, longS2); Array a(2); a[0] = 8; a[1] = 13; diff --git a/vespalib/src/tests/benchmark/testbase.cpp b/vespalib/src/tests/benchmark/testbase.cpp index 269da79f109f..5e5dbe4bdd21 100644 --- a/vespalib/src/tests/benchmark/testbase.cpp +++ b/vespalib/src/tests/benchmark/testbase.cpp @@ -270,7 +270,7 @@ size_t CreateVespalibString::onRun() strcpy(text, text1); strcat(text, text2); for (size_t i=0; i < 1000; i++) { - string s(text); + std::string s(text); sum += s.size(); } return sum; diff --git a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp index 9f8460eb527f..73692d3eb75e 100644 --- a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp +++ b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp @@ -42,7 +42,7 @@ namespace { constexpr uint32_t value_offset = 1000000000; bool smoke_test = false; -const vespalib::string smoke_test_option = "--smoke-test"; +const std::string smoke_test_option = "--smoke-test"; class RealIntStore { using StoreType = vespalib::datastore::DataStore; diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp index c8aa7feb1231..57a42ed99b09 100644 --- a/vespalib/src/tests/btree/btree_test.cpp +++ b/vespalib/src/tests/btree/btree_test.cpp @@ -1,6 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -19,6 +18,7 @@ #include #include #include +#include #include LOG_SETUP("btree_test"); diff --git a/vespalib/src/tests/btree/btreeaggregation_test.cpp b/vespalib/src/tests/btree/btreeaggregation_test.cpp index 34c1ca767728..29b355f81e48 100644 --- a/vespalib/src/tests/btree/btreeaggregation_test.cpp +++ b/vespalib/src/tests/btree/btreeaggregation_test.cpp @@ -226,11 +226,11 @@ class BTreeAggregationTest : public ::testing::Test { template bool - assertAggregated(const MockTree &m, const Tree &t, const vespalib::string& label); + assertAggregated(const MockTree &m, const Tree &t, const std::string& label); template bool - assertAggregated(const MockTree &m, const TreeStore &s, EntryRef ref, const vespalib::string& label); + assertAggregated(const MockTree &m, const TreeStore &s, EntryRef ref, const std::string& label); void buildSubTree(const std::vector &sub, @@ -255,7 +255,7 @@ BTreeAggregationTest::assertTree(const std::string &exp, const Tree &t) template bool -BTreeAggregationTest::assertAggregated(const MockTree &m, const Tree &t, const vespalib::string& label) +BTreeAggregationTest::assertAggregated(const MockTree &m, const Tree &t, const std::string& label) { SCOPED_TRACE(label); const MinMaxAggregated &ta(t.getAggregated()); @@ -277,7 +277,7 @@ BTreeAggregationTest::assertAggregated(const MockTree &m, const Tree &t, const v template bool -BTreeAggregationTest::assertAggregated(const MockTree &m, const TreeStore &s, EntryRef ref, const vespalib::string& label) +BTreeAggregationTest::assertAggregated(const MockTree &m, const TreeStore &s, EntryRef ref, const std::string& label) { SCOPED_TRACE(label); typename TreeStore::Iterator i(s.begin(ref)); diff --git a/vespalib/src/tests/compression/compression_test.cpp b/vespalib/src/tests/compression/compression_test.cpp index 3d8aeb02a81e..ffacbf393958 100644 --- a/vespalib/src/tests/compression/compression_test.cpp +++ b/vespalib/src/tests/compression/compression_test.cpp @@ -2,10 +2,10 @@ #include #include -#include #include #include #include +#include #include LOG_SETUP("compression_test"); @@ -13,7 +13,7 @@ LOG_SETUP("compression_test"); using namespace vespalib; using namespace vespalib::compression; -static vespalib::string _G_compressableText("AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEE" +static std::string _G_compressableText("AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEE" "AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEE" "AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEE" "AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEE" @@ -48,7 +48,7 @@ TEST("require that no compression/decompression works") { EXPECT_EQUAL(CompressionConfig::Type::NONE, compress.type()); EXPECT_EQUAL(1072u, compress.size()); Decompress decompress(compress.type(), _G_compressableText.size(), compress.data(), compress.size()); - EXPECT_EQUAL(_G_compressableText, vespalib::string(decompress.data(), decompress.size())); + EXPECT_EQUAL(_G_compressableText, std::string(decompress.data(), decompress.size())); } TEST("require that lz4 compression/decompression works") { @@ -57,7 +57,7 @@ TEST("require that lz4 compression/decompression works") { EXPECT_EQUAL(CompressionConfig::Type::LZ4, compress.type()); EXPECT_EQUAL(66u, compress.size()); Decompress decompress(compress.type(), _G_compressableText.size(), compress.data(), compress.size()); - EXPECT_EQUAL(_G_compressableText, vespalib::string(decompress.data(), decompress.size())); + EXPECT_EQUAL(_G_compressableText, std::string(decompress.data(), decompress.size())); } TEST("requiret that zstd compression/decompression works") { @@ -66,7 +66,7 @@ TEST("requiret that zstd compression/decompression works") { EXPECT_EQUAL(CompressionConfig::Type::ZSTD, compress.type()); EXPECT_EQUAL(64u, compress.size()); Decompress decompress(compress.type(), _G_compressableText.size(), compress.data(), compress.size()); - EXPECT_EQUAL(_G_compressableText, vespalib::string(decompress.data(), decompress.size())); + EXPECT_EQUAL(_G_compressableText, std::string(decompress.data(), decompress.size())); } TEST("require that CompressionConfig is Atomic") { diff --git a/vespalib/src/tests/coro/async_io/async_io_test.cpp b/vespalib/src/tests/coro/async_io/async_io_test.cpp index bb8d6a253356..3b559b7e6d41 100644 --- a/vespalib/src/tests/coro/async_io/async_io_test.cpp +++ b/vespalib/src/tests/coro/async_io/async_io_test.cpp @@ -21,7 +21,7 @@ using namespace vespalib; using namespace vespalib::coro; using namespace vespalib::test; -vespalib::string impl_spec(AsyncIo &async) { +std::string impl_spec(AsyncIo &async) { switch (async.get_impl_tag()) { case AsyncIo::ImplTag::EPOLL: return "epoll"; case AsyncIo::ImplTag::URING: return "uring"; @@ -71,7 +71,7 @@ TEST(AsyncIoTest, shutdown_with_self_exiting_coroutine) { f2.wait(); } -Lazy write_msg(AsyncCryptoSocket &socket, const vespalib::string &msg) { +Lazy write_msg(AsyncCryptoSocket &socket, const std::string &msg) { size_t written = 0; while (written < msg.size()) { size_t write_size = (msg.size() - written); @@ -84,9 +84,9 @@ Lazy write_msg(AsyncCryptoSocket &socket, const vespalib::string &msg) { co_return written; } -Lazy read_msg(AsyncCryptoSocket &socket, size_t wanted_bytes) { +Lazy read_msg(AsyncCryptoSocket &socket, size_t wanted_bytes) { char tmp[64]; - vespalib::string result; + std::string result; while (result.size() < wanted_bytes) { size_t read_size = std::min(sizeof(tmp), wanted_bytes - result.size()); ssize_t read_result = co_await socket.read(tmp, read_size); @@ -99,17 +99,17 @@ Lazy read_msg(AsyncCryptoSocket &socket, size_t wanted_bytes) } Work verify_socket_io(AsyncCryptoSocket &socket, bool is_server) { - vespalib::string server_message = "hello, this is the server speaking"; - vespalib::string client_message = "please pick up, I need to talk to you"; + std::string server_message = "hello, this is the server speaking"; + std::string client_message = "please pick up, I need to talk to you"; if (is_server) { - vespalib::string read = co_await read_msg(socket, client_message.size()); + std::string read = co_await read_msg(socket, client_message.size()); EXPECT_EQ(client_message, read); size_t written = co_await write_msg(socket, server_message); EXPECT_EQ(written, ssize_t(server_message.size())); } else { size_t written = co_await write_msg(socket, client_message); EXPECT_EQ(written, ssize_t(client_message.size())); - vespalib::string read = co_await read_msg(socket, server_message.size()); + std::string read = co_await read_msg(socket, server_message.size()); EXPECT_EQ(server_message, read); } co_return Done{}; diff --git a/vespalib/src/tests/cpu_usage/cpu_usage_test.cpp b/vespalib/src/tests/cpu_usage/cpu_usage_test.cpp index 176959851275..94045ae7aa97 100644 --- a/vespalib/src/tests/cpu_usage/cpu_usage_test.cpp +++ b/vespalib/src/tests/cpu_usage/cpu_usage_test.cpp @@ -120,7 +120,7 @@ TEST("measure total cpu usage overhead") { //----------------------------------------------------------------------------- -void verify_category(CpuUsage::Category cat, size_t idx, const vespalib::string &name) { +void verify_category(CpuUsage::Category cat, size_t idx, const std::string &name) { switch (cat) { // make sure we known all categories case CpuUsage::Category::SETUP: case CpuUsage::Category::READ: @@ -402,7 +402,7 @@ void do_sample_cpu_usage(const EndTime &end_time) { while (!end_time()) { std::this_thread::sleep_for(verbose ? 1s : 10ms); auto util = cpu.get_util(); - vespalib::string body; + std::string body; for (size_t i = 0; i < util.size(); ++i) { if (!body.empty()) { body.append(", "); diff --git a/vespalib/src/tests/data/input_reader/input_reader_test.cpp b/vespalib/src/tests/data/input_reader/input_reader_test.cpp index a93de9fb3988..ee0914c0109d 100644 --- a/vespalib/src/tests/data/input_reader/input_reader_test.cpp +++ b/vespalib/src/tests/data/input_reader/input_reader_test.cpp @@ -39,7 +39,7 @@ TEST("input reader smoke test") { EXPECT_EQUAL(src.read(), '\0'); EXPECT_EQUAL(src.obtain(), 0u); EXPECT_EQUAL(src.get_offset(), strlen(data)); - EXPECT_EQUAL(src.get_error_message(), vespalib::string("input underflow")); + EXPECT_EQUAL(src.get_error_message(), std::string("input underflow")); } } @@ -68,7 +68,7 @@ TEST("require that input can be explicitly failed with custom message") { EXPECT_EQUAL(src.read(5), Memory()); EXPECT_EQUAL(src.obtain(), 0u); src.fail("ignored"); - EXPECT_EQUAL(src.get_error_message(), vespalib::string("custom")); + EXPECT_EQUAL(src.get_error_message(), std::string("custom")); EXPECT_EQUAL(src.get_offset(), 5u); } } @@ -81,7 +81,7 @@ TEST("require that reading a byte sequence crossing the end of input fails") { InputReader src(input); EXPECT_EQUAL(src.read(15), Memory()); EXPECT_TRUE(src.failed()); - EXPECT_EQUAL(src.get_error_message(), vespalib::string("input underflow")); + EXPECT_EQUAL(src.get_error_message(), std::string("input underflow")); EXPECT_EQUAL(src.get_offset(), 10u); } } @@ -107,7 +107,7 @@ TEST("expect that obtain does not set failure state on input reader") { EXPECT_TRUE(src.failed()); EXPECT_EQUAL(src.read(), 0); } - EXPECT_EQUAL(src.get_error_message(), vespalib::string("input underflow")); + EXPECT_EQUAL(src.get_error_message(), std::string("input underflow")); EXPECT_EQUAL(src.obtain(), 0u); } } diff --git a/vespalib/src/tests/data/lz4_encode_decode/lz4_encode_decode_test.cpp b/vespalib/src/tests/data/lz4_encode_decode/lz4_encode_decode_test.cpp index e1e8a4bde820..b4543ba8133d 100644 --- a/vespalib/src/tests/data/lz4_encode_decode/lz4_encode_decode_test.cpp +++ b/vespalib/src/tests/data/lz4_encode_decode/lz4_encode_decode_test.cpp @@ -38,7 +38,7 @@ TEST("require that lz4 encode-decode works") { Lz4InputDecoder input_decoder(chunked_input, 10); transfer(input_decoder, decoded); EXPECT_TRUE(!input_decoder.failed()); - EXPECT_EQUAL(input_decoder.reason(), vespalib::string()); + EXPECT_EQUAL(input_decoder.reason(), std::string()); } EXPECT_NOT_EQUAL(data.get(), encoded.get()); EXPECT_EQUAL(data.get(), decoded.get()); diff --git a/vespalib/src/tests/data/output_writer/output_writer_test.cpp b/vespalib/src/tests/data/output_writer/output_writer_test.cpp index 2fcc77c929f2..1df9971f292d 100644 --- a/vespalib/src/tests/data/output_writer/output_writer_test.cpp +++ b/vespalib/src/tests/data/output_writer/output_writer_test.cpp @@ -17,7 +17,7 @@ TEST("output writer smoke test") { dst.write('\n'); dst.printf("%d + %d = %d\n", 2, 2, 4); } - vespalib::string expect = "abc\n" + std::string expect = "abc\n" "foo bar\n" "2 + 2 = 4\n"; EXPECT_EQUAL(Memory(expect), buffer.get()); @@ -36,7 +36,7 @@ TEST("require that reserve/commit works as expected") { dst.commit(1); dst.reserve(10); } - vespalib::string expect = "abc\n"; + std::string expect = "abc\n"; EXPECT_EQUAL(Memory(expect), buffer.get()); } diff --git a/vespalib/src/tests/data/simple_buffer/simple_buffer_test.cpp b/vespalib/src/tests/data/simple_buffer/simple_buffer_test.cpp index 3ad92b40d58a..e7f8b1a7d8bb 100644 --- a/vespalib/src/tests/data/simple_buffer/simple_buffer_test.cpp +++ b/vespalib/src/tests/data/simple_buffer/simple_buffer_test.cpp @@ -4,11 +4,11 @@ using namespace vespalib; -void checkMemory(const string &expect, const Memory &mem) { +void checkMemory(const std::string &expect, const Memory &mem) { EXPECT_EQUAL(expect, mem.make_stringview()); } -void checkBuffer(const string &expect, const SimpleBuffer &buf) { +void checkBuffer(const std::string &expect, const SimpleBuffer &buf) { TEST_DO(checkMemory(expect, buf.get())); } diff --git a/vespalib/src/tests/data/smart_buffer/smart_buffer_test.cpp b/vespalib/src/tests/data/smart_buffer/smart_buffer_test.cpp index 78381a5e52e0..471855825245 100644 --- a/vespalib/src/tests/data/smart_buffer/smart_buffer_test.cpp +++ b/vespalib/src/tests/data/smart_buffer/smart_buffer_test.cpp @@ -4,15 +4,15 @@ using namespace vespalib; -void checkMemory(const vespalib::string &expect, const Memory &mem) { - EXPECT_EQUAL(expect, vespalib::string(mem.data, mem.size)); +void checkMemory(const std::string &expect, const Memory &mem) { + EXPECT_EQUAL(expect, std::string(mem.data, mem.size)); } -void checkBuffer(const vespalib::string &expect, SmartBuffer &buf) { +void checkBuffer(const std::string &expect, SmartBuffer &buf) { TEST_DO(checkMemory(expect, buf.obtain())); } -void write_buf(const vespalib::string &str, SmartBuffer &buf) { +void write_buf(const std::string &str, SmartBuffer &buf) { WritableMemory mem = buf.reserve(str.size()); for (size_t i = 0; i < str.size(); ++i) { mem.data[i] = str.data()[i]; diff --git a/vespalib/src/tests/directio/directio.cpp b/vespalib/src/tests/directio/directio.cpp index 7362c33c7b62..41362ec702b7 100644 --- a/vespalib/src/tests/directio/directio.cpp +++ b/vespalib/src/tests/directio/directio.cpp @@ -1,10 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include #include +#include using namespace vespalib; @@ -14,7 +14,7 @@ TEST("that DirectIOException propagates the correct information.") { EXPECT_EQUAL(10u, e.getLength()); EXPECT_EQUAL(3u, e.getOffset()); EXPECT_EQUAL(msg, e.getBuffer()); - EXPECT_EQUAL(0u, string(e.what()).find("DirectIO failed for file 'file.a' buffer=")); + EXPECT_EQUAL(0u, std::string(e.what()).find("DirectIO failed for file 'file.a' buffer=")); EXPECT_EQUAL("file.a", e.getFileName()); } diff --git a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp index ef88c8e94c38..43834cb5e098 100644 --- a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp +++ b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp @@ -1,11 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include +#include #include -#include #include -#include +#include +#include using namespace vespalib; using vespalib::hwaccelerated::IAccelerated; @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) size_t numValues(1000); size_t numQueries(1000000); size_t stride(1); - string type("full"); + std::string type("full"); if ( argc > 1) { type = argv[1]; } diff --git a/vespalib/src/tests/exception_classes/caught_uncaught.cpp b/vespalib/src/tests/exception_classes/caught_uncaught.cpp index 3911aea58c16..b6bb64f390f5 100644 --- a/vespalib/src/tests/exception_classes/caught_uncaught.cpp +++ b/vespalib/src/tests/exception_classes/caught_uncaught.cpp @@ -1,5 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include +#include using namespace vespalib; diff --git a/vespalib/src/tests/execution_profiler/execution_profiler_test.cpp b/vespalib/src/tests/execution_profiler/execution_profiler_test.cpp index dd7ba04b2817..b62413e308ff 100644 --- a/vespalib/src/tests/execution_profiler/execution_profiler_test.cpp +++ b/vespalib/src/tests/execution_profiler/execution_profiler_test.cpp @@ -59,7 +59,7 @@ bool find_path(const Inspector &self, PathPos pos, PathPos end, bool first = fal return false; } -bool find_path(const Slime &slime, const std::vector> &path) { +bool find_path(const Slime &slime, const std::vector> &path) { return find_path(slime.get(), path.begin(), path.end(), true); } @@ -196,7 +196,7 @@ TEST(ExecutionProfilerTest, with_name_mapping) { fox(profiler); } Slime slime; - profiler.report(slime.setObject(), [](const vespalib::string &name)noexcept->vespalib::string { + profiler.report(slime.setObject(), [](const std::string &name)noexcept->std::string { if ((name == "foo") || (name == "bar")) { return "magic"; } diff --git a/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp b/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp index 751f4356e5ab..dcf18bacf15d 100644 --- a/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp +++ b/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp @@ -109,13 +109,13 @@ TEST_F("require that task limit can be decreased", Fixture(3, 3)) f.blockedExecuteAndWaitUntilFinished(); } -vespalib::string get_worker_stack_trace(BlockingThreadStackExecutor &executor) { +std::string get_worker_stack_trace(BlockingThreadStackExecutor &executor) { struct StackTraceTask : public Executor::Task { - vespalib::string &trace; - explicit StackTraceTask(vespalib::string &t) : trace(t) {} + std::string &trace; + explicit StackTraceTask(std::string &t) : trace(t) {} void run() override { trace = getStackTrace(0); } }; - vespalib::string trace; + std::string trace; executor.execute(std::make_unique(trace)); executor.sync(); return trace; @@ -124,15 +124,15 @@ vespalib::string get_worker_stack_trace(BlockingThreadStackExecutor &executor) { VESPA_THREAD_STACK_TAG(my_stack_tag); TEST_F("require that executor has appropriate default thread stack tag", BlockingThreadStackExecutor(1, 10)) { - vespalib::string trace = get_worker_stack_trace(f1); - if (!EXPECT_TRUE(trace.find("unnamed_blocking_executor") != vespalib::string::npos)) { + std::string trace = get_worker_stack_trace(f1); + if (!EXPECT_TRUE(trace.find("unnamed_blocking_executor") != std::string::npos)) { fprintf(stderr, "%s\n", trace.c_str()); } } TEST_F("require that executor thread stack tag can be set", BlockingThreadStackExecutor(1, 10, my_stack_tag)) { - vespalib::string trace = get_worker_stack_trace(f1); - if (!EXPECT_TRUE(trace.find("my_stack_tag") != vespalib::string::npos)) { + std::string trace = get_worker_stack_trace(f1); + if (!EXPECT_TRUE(trace.find("my_stack_tag") != std::string::npos)) { fprintf(stderr, "%s\n", trace.c_str()); } } diff --git a/vespalib/src/tests/executor/threadstackexecutor_test.cpp b/vespalib/src/tests/executor/threadstackexecutor_test.cpp index 743c90d0217a..509c43d2d5b4 100644 --- a/vespalib/src/tests/executor/threadstackexecutor_test.cpp +++ b/vespalib/src/tests/executor/threadstackexecutor_test.cpp @@ -161,13 +161,13 @@ TEST_MT_F("require that threads can wait for a specific task count", 7, WaitStat } } -vespalib::string get_worker_stack_trace(ThreadStackExecutor &executor) { +std::string get_worker_stack_trace(ThreadStackExecutor &executor) { struct StackTraceTask : public Executor::Task { - vespalib::string &trace; - explicit StackTraceTask(vespalib::string &t) : trace(t) {} + std::string &trace; + explicit StackTraceTask(std::string &t) : trace(t) {} void run() override { trace = getStackTrace(0); } }; - vespalib::string trace; + std::string trace; executor.execute(std::make_unique(trace)); executor.sync(); return trace; @@ -176,15 +176,15 @@ vespalib::string get_worker_stack_trace(ThreadStackExecutor &executor) { VESPA_THREAD_STACK_TAG(my_stack_tag); TEST_F("require that executor has appropriate default thread stack tag", ThreadStackExecutor(1)) { - vespalib::string trace = get_worker_stack_trace(f1); - if (!EXPECT_TRUE(trace.find("unnamed_nonblocking_executor") != vespalib::string::npos)) { + std::string trace = get_worker_stack_trace(f1); + if (!EXPECT_TRUE(trace.find("unnamed_nonblocking_executor") != std::string::npos)) { fprintf(stderr, "%s\n", trace.c_str()); } } TEST_F("require that executor thread stack tag can be set", ThreadStackExecutor(1, my_stack_tag)) { - vespalib::string trace = get_worker_stack_trace(f1); - if (!EXPECT_TRUE(trace.find("my_stack_tag") != vespalib::string::npos)) { + std::string trace = get_worker_stack_trace(f1); + if (!EXPECT_TRUE(trace.find("my_stack_tag") != std::string::npos)) { fprintf(stderr, "%s\n", trace.c_str()); } } diff --git a/vespalib/src/tests/fileheader/fileheader_test.cpp b/vespalib/src/tests/fileheader/fileheader_test.cpp index db2c7f7c65d1..a28ee848bce4 100644 --- a/vespalib/src/tests/fileheader/fileheader_test.cpp +++ b/vespalib/src/tests/fileheader/fileheader_test.cpp @@ -11,7 +11,7 @@ using namespace vespalib; namespace { -vespalib::string fileheader_tmp("fileheader.tmp"); +std::string fileheader_tmp("fileheader.tmp"); } diff --git a/vespalib/src/tests/io/fileutil/fileutiltest.cpp b/vespalib/src/tests/io/fileutil/fileutiltest.cpp index 5ecb6ba842b1..5d08ecbfc260 100644 --- a/vespalib/src/tests/io/fileutil/fileutiltest.cpp +++ b/vespalib/src/tests/io/fileutil/fileutiltest.cpp @@ -14,13 +14,13 @@ namespace vespalib { namespace { -bool fileExists(const vespalib::string& name) { +bool fileExists(const std::string& name) { return std::filesystem::exists(std::filesystem::path(name)); } } -vespalib::string normalizeOpenError(const vespalib::string str) +std::string normalizeOpenError(const std::string str) { std::regex modeex(" mode=[0-7]+"); std::regex uidex(" uid=[0-9]+"); @@ -169,14 +169,14 @@ TEST("require that we can read all data written to file") std::filesystem::remove(std::filesystem::path("myfile")); File fileForWriting("myfile"); fileForWriting.open(File::CREATE); - vespalib::string text = "This is some text. "; + std::string text = "This is some text. "; fileForWriting.write(text.data(), text.size(), 0); fileForWriting.close(); // Read contents of file, and verify it's identical. File file("myfile"); file.open(File::READONLY); - vespalib::string content = file.readAll(); + std::string content = file.readAll(); file.close(); ASSERT_EQUAL(content, text); @@ -194,7 +194,7 @@ TEST("require that we can read all data written to file") file.close(); ASSERT_EQUAL(offset, static_cast(content.size())); - vespalib::string chunk; + std::string chunk; for (offset = 0; offset < 10000; offset += text.size()) { chunk.assign(content.data() + offset, text.size()); ASSERT_EQUAL(text, chunk); @@ -219,15 +219,15 @@ TEST("require that vespalib::getOpenErrorString works") foo.open(File::CREATE); foo.close(); } - vespalib::string err1 = getOpenErrorString(1, "mydir/foo"); - vespalib::string normErr1 = normalizeOpenError(err1); - vespalib::string expErr1 = "error=x fileStat[name=mydir/foo mode=x uid=x gid=x size=x mtime=x] dirStat[name=mydir mode=x uid=x gid=x size=x mtime=x]"; + std::string err1 = getOpenErrorString(1, "mydir/foo"); + std::string normErr1 = normalizeOpenError(err1); + std::string expErr1 = "error=x fileStat[name=mydir/foo mode=x uid=x gid=x size=x mtime=x] dirStat[name=mydir mode=x uid=x gid=x size=x mtime=x]"; std::cerr << "getOpenErrorString(1, \"mydir/foo\") is " << err1 << ", normalized to " << normErr1 << std::endl; EXPECT_EQUAL(expErr1, normErr1); - vespalib::string err2 = getOpenErrorString(1, "notFound"); - vespalib::string normErr2 = normalizeOpenError(err2); - vespalib::string expErr2 = "error=x fileStat[name=notFound errno=x] dirStat[name=. mode=x uid=x gid=x size=x mtime=x]"; + std::string err2 = getOpenErrorString(1, "notFound"); + std::string normErr2 = normalizeOpenError(err2); + std::string expErr2 = "error=x fileStat[name=notFound errno=x] dirStat[name=. mode=x uid=x gid=x size=x mtime=x]"; std::cerr << "getOpenErrorString(1, \"notFound\") is " << err2 << ", normalized to " << normErr2 << std::endl; EXPECT_EQUAL(expErr2, normErr2); diff --git a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp index 90f26ff2cf34..826e4cd97f7e 100644 --- a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp +++ b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp @@ -4,8 +4,8 @@ using namespace vespalib; -bool runPrint(const vespalib::string &cmd) { - vespalib::string out; +bool runPrint(const std::string &cmd) { + std::string out; bool res = Process::run(cmd, out); fprintf(stderr, "%s", out.c_str()); return res; @@ -15,7 +15,7 @@ TEST("make fixture macros") { EXPECT_FALSE(runPrint("../../apps/make_fixture_macros/vespalib_make_fixture_macros_app")); EXPECT_TRUE(runPrint("../../apps/make_fixture_macros/vespalib_make_fixture_macros_app 9 > macros.tmp")); - vespalib::string diffCmd("diff -u "); + std::string diffCmd("diff -u "); diffCmd += TEST_PATH("../../vespa/vespalib/testkit/generated_fixture_macros.h macros.tmp"); EXPECT_TRUE(runPrint(diffCmd.c_str())); } diff --git a/vespalib/src/tests/memory/memory_test.cpp b/vespalib/src/tests/memory/memory_test.cpp index 59d1cbe059de..bbc3d9234148 100644 --- a/vespalib/src/tests/memory/memory_test.cpp +++ b/vespalib/src/tests/memory/memory_test.cpp @@ -128,28 +128,28 @@ TEST("require that VESPA_NELEMS works as expected") { } TEST("require that memcpy_safe works as expected") { - vespalib::string a("abcdefgh"); - vespalib::string b("01234567"); + std::string a("abcdefgh"); + std::string b("01234567"); memcpy_safe(&b[0], &a[0], 4); memcpy_safe(nullptr, &a[0], 0); memcpy_safe(&b[0], nullptr, 0); memcpy_safe(nullptr, nullptr, 0); - EXPECT_EQUAL(vespalib::string("abcdefgh"), a); - EXPECT_EQUAL(vespalib::string("abcd4567"), b); + EXPECT_EQUAL(std::string("abcdefgh"), a); + EXPECT_EQUAL(std::string("abcd4567"), b); } TEST("require that memmove_safe works as expected") { - vespalib::string str("0123456789"); + std::string str("0123456789"); memmove_safe(&str[2], &str[0], 5); memmove_safe(nullptr, &str[0], 0); memmove_safe(&str[0], nullptr, 0); memmove_safe(nullptr, nullptr, 0); - EXPECT_EQUAL(vespalib::string("0101234789"), str); + EXPECT_EQUAL(std::string("0101234789"), str); } TEST("require that memcmp_safe works as expected") { - vespalib::string a("ab"); - vespalib::string b("ac"); + std::string a("ab"); + std::string b("ac"); EXPECT_EQUAL(memcmp_safe(&a[0], &b[0], 0), 0); EXPECT_EQUAL(memcmp_safe(nullptr, &b[0], 0), 0); EXPECT_EQUAL(memcmp_safe(&a[0], nullptr, 0), 0); diff --git a/vespalib/src/tests/metrics/simple_metrics_test.cpp b/vespalib/src/tests/metrics/simple_metrics_test.cpp index a5b22b6726d4..0ab573d8f10f 100644 --- a/vespalib/src/tests/metrics/simple_metrics_test.cpp +++ b/vespalib/src/tests/metrics/simple_metrics_test.cpp @@ -71,7 +71,7 @@ TEST("require that simple metrics gauge merge works") EXPECT_EQUAL(a.lastValue, 1.0); } -bool compare_json(const vespalib::string &a, const vespalib::string &b) +bool compare_json(const std::string &a, const std::string &b) { using vespalib::Memory; using vespalib::slime::JsonFormat; @@ -91,9 +91,9 @@ fprintf(stderr, "compares unequal:\n[A]\n%s\n[B]\n%s\n", a.c_str(), b.c_str()); return slimeA == slimeB; } -void check_json(const vespalib::string &actual) +void check_json(const std::string &actual) { - vespalib::string expect = "{" + std::string expect = "{" " snapshot: { from: 1, to: 4 }," " values: [ { name: 'foo'," " values: { count: 17, rate: 4.85714 }" @@ -117,8 +117,8 @@ void check_json(const vespalib::string &actual) EXPECT_TRUE(compare_json(expect, actual)); } -void check_prometheus(const vespalib::string &actual) { - vespalib::string expect = R"(foo 17 4500 +void check_prometheus(const std::string &actual) { + std::string expect = R"(foo 17 4500 foo{chain="default",documenttype="music",thread="0"} 4 4500 bar_count 4 4500 bar_count{chain="vespa",documenttype="blogpost",thread="1"} 1 4500 diff --git a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp index 66ddb946755d..6b849c944883 100644 --- a/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp +++ b/vespalib/src/tests/net/async_resolver/async_resolver_test.cpp @@ -36,7 +36,7 @@ struct BlockingHostResolver : public AsyncResolver::HostResolver { Gate barrier; BlockingHostResolver(size_t num_callers) noexcept : callers(num_callers), barrier() {} - vespalib::string ip_address(const vespalib::string &) override { + std::string ip_address(const std::string &) override { callers.countDown(); barrier.await(); return "127.0.0.7"; @@ -47,19 +47,19 @@ struct BlockingHostResolver : public AsyncResolver::HostResolver { struct MyHostResolver : public AsyncResolver::HostResolver { std::mutex ip_lock; - std::map ip_map; - std::map ip_cnt; + std::map ip_map; + std::map ip_cnt; MyHostResolver() : ip_lock(), ip_map(), ip_cnt() {} - vespalib::string ip_address(const vespalib::string &host) override { + std::string ip_address(const std::string &host) override { std::lock_guard guard(ip_lock); ++ip_cnt[host]; return ip_map[host]; } - void set_ip_addr(const vespalib::string &host, const vespalib::string &ip_addr) { + void set_ip_addr(const std::string &host, const std::string &ip_addr) { std::lock_guard guard(ip_lock); ip_map[host] = ip_addr; } - size_t get_cnt(const vespalib::string &host) { + size_t get_cnt(const std::string &host) { std::lock_guard guard(ip_lock); return ip_cnt[host]; } @@ -77,10 +77,10 @@ struct ResolveFixture { std::shared_ptr clock; std::shared_ptr host_resolver; AsyncResolver::SP async_resolver; - void set_ip_addr(const vespalib::string &host, const vespalib::string &ip) { + void set_ip_addr(const std::string &host, const std::string &ip) { host_resolver->set_ip_addr(host, ip); } - size_t get_cnt(const vespalib::string &host) { return host_resolver->get_cnt(host); } + size_t get_cnt(const std::string &host) { return host_resolver->get_cnt(host); } size_t get_total_cnt() { return host_resolver->get_total_cnt(); } void set_now(double s) { clock->set_now(MyClock::seconds(s)); } ResolveFixture(size_t max_cache_size = 10000) @@ -102,7 +102,7 @@ struct ResolveFixture { set_ip_addr("d", "127.0.4.1"); set_ip_addr("e", "127.0.5.1"); } - vespalib::string resolve(const vespalib::string &spec) { + std::string resolve(const std::string &spec) { SocketAddress result; auto handler = std::make_shared(result); async_resolver->resolve_async(spec, handler); @@ -136,13 +136,13 @@ TEST("require that shared async resolver is shared") { } TEST("require that shared async resolver can resolve connect spec") { - vespalib::string spec("tcp/localhost:123"); + std::string spec("tcp/localhost:123"); SocketAddress result; auto resolver = AsyncResolver::get_shared(); auto handler = std::make_shared(result); resolver->resolve_async(spec, handler); resolver->wait_for_pending_resolves(); - vespalib::string resolved = result.spec(); + std::string resolved = result.spec(); fprintf(stderr, "resolver(spec:%s) -> '%s'\n", spec.c_str(), resolved.c_str()); EXPECT_TRUE(handler->done); EXPECT_NOT_EQUAL(resolved, spec); @@ -162,7 +162,7 @@ TEST("require that steady clock is steady clock") { } TEST("require that simple host resolver can resolve host name") { - vespalib::string host_name("localhost"); + std::string host_name("localhost"); AsyncResolver::SimpleHostResolver resolver; auto resolved = resolver.ip_address(host_name); fprintf(stderr, "resolver(host_name:%s) -> '%s'\n", host_name.c_str(), resolved.c_str()); diff --git a/vespalib/src/tests/net/crypto_socket/crypto_socket_test.cpp b/vespalib/src/tests/net/crypto_socket/crypto_socket_test.cpp index 8c3907791255..71a1a2cbed32 100644 --- a/vespalib/src/tests/net/crypto_socket/crypto_socket_test.cpp +++ b/vespalib/src/tests/net/crypto_socket/crypto_socket_test.cpp @@ -87,7 +87,7 @@ void half_close(CryptoSocket &socket) { //----------------------------------------------------------------------------- -vespalib::string read_bytes(CryptoSocket &socket, SmartBuffer &read_buffer, size_t wanted_bytes) { +std::string read_bytes(CryptoSocket &socket, SmartBuffer &read_buffer, size_t wanted_bytes) { SingleFdSelector selector(socket.get_fd()); while (read_buffer.obtain().size < wanted_bytes) { ASSERT_TRUE(selector.wait_readable()); @@ -95,7 +95,7 @@ vespalib::string read_bytes(CryptoSocket &socket, SmartBuffer &read_buffer, size drain(socket, read_buffer); } auto data = read_buffer.obtain(); - vespalib::string message(data.data, wanted_bytes); + std::string message(data.data, wanted_bytes); read_buffer.evict(message.size()); return message; } @@ -118,7 +118,7 @@ void read_EOF(CryptoSocket &socket, SmartBuffer &read_buffer) { //----------------------------------------------------------------------------- -void write_bytes(CryptoSocket &socket, const vespalib::string &message) { +void write_bytes(CryptoSocket &socket, const std::string &message) { SmartBuffer write_buffer(message.size()); SingleFdSelector selector(socket.get_fd()); auto data = write_buffer.reserve(message.size()); @@ -163,15 +163,15 @@ void verify_graceful_shutdown(CryptoSocket &socket, SmartBuffer &read_buffer, bo //----------------------------------------------------------------------------- void verify_socket_io(CryptoSocket &socket, SmartBuffer &read_buffer, bool is_server) { - vespalib::string client_message = "please pick up, I need to talk to you"; - vespalib::string server_message = "hello, this is the server speaking"; + std::string client_message = "please pick up, I need to talk to you"; + std::string server_message = "hello, this is the server speaking"; if(is_server) { - vespalib::string read = read_bytes(socket, read_buffer, client_message.size()); + std::string read = read_bytes(socket, read_buffer, client_message.size()); write_bytes(socket, server_message); EXPECT_EQUAL(client_message, read); } else { write_bytes(socket, client_message); - vespalib::string read = read_bytes(socket, read_buffer, server_message.size()); + std::string read = read_bytes(socket, read_buffer, server_message.size()); EXPECT_EQUAL(server_message, read); } } diff --git a/vespalib/src/tests/net/selector/selector_test.cpp b/vespalib/src/tests/net/selector/selector_test.cpp index 27220d3f5e84..d1861a129e92 100644 --- a/vespalib/src/tests/net/selector/selector_test.cpp +++ b/vespalib/src/tests/net/selector/selector_test.cpp @@ -219,7 +219,7 @@ TEST_MT_FFF("require that single fd selector can wait for read events while hand std::this_thread::sleep_for(std::chrono::milliseconds(20)); f2.wakeup(); TEST_BARRIER(); // #1 - vespalib::string msg("test"); + std::string msg("test"); std::this_thread::sleep_for(std::chrono::milliseconds(20)); ASSERT_EQUAL(f1.b.write(msg.data(), msg.size()), ssize_t(msg.size())); TEST_BARRIER(); // #2 diff --git a/vespalib/src/tests/net/send_fd/send_fd_test.cpp b/vespalib/src/tests/net/send_fd/send_fd_test.cpp index 8dc1235ff766..42ee5fd63304 100644 --- a/vespalib/src/tests/net/send_fd/send_fd_test.cpp +++ b/vespalib/src/tests/net/send_fd/send_fd_test.cpp @@ -21,9 +21,9 @@ using namespace vespalib; using vespalib::test::Nexus; -vespalib::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { +std::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { char tmp[64]; - vespalib::string result; + std::string result; while (result.size() < wanted_bytes) { size_t read_size = std::min(sizeof(tmp), wanted_bytes - result.size()); ssize_t read_result = socket.read(tmp, read_size); @@ -36,17 +36,17 @@ vespalib::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { } void verify_socket_io(bool is_server, SocketHandle &socket) { - vespalib::string server_message = "hello, this is the server speaking"; - vespalib::string client_message = "please pick up, I need to talk to you"; + std::string server_message = "hello, this is the server speaking"; + std::string client_message = "please pick up, I need to talk to you"; if(is_server) { ssize_t written = socket.write(server_message.data(), server_message.size()); EXPECT_EQ(written, ssize_t(server_message.size())); - vespalib::string read = read_bytes(socket, client_message.size()); + std::string read = read_bytes(socket, client_message.size()); EXPECT_EQ(client_message, read); } else { ssize_t written = socket.write(client_message.data(), client_message.size()); EXPECT_EQ(written, ssize_t(client_message.size())); - vespalib::string read = read_bytes(socket, server_message.size()); + std::string read = read_bytes(socket, server_message.size()); EXPECT_EQ(server_message, read); } } diff --git a/vespalib/src/tests/net/socket/socket_client.cpp b/vespalib/src/tests/net/socket/socket_client.cpp index 258e24f12b88..79296f04a348 100644 --- a/vespalib/src/tests/net/socket/socket_client.cpp +++ b/vespalib/src/tests/net/socket/socket_client.cpp @@ -6,8 +6,8 @@ using namespace vespalib; -vespalib::string read_msg(SocketHandle &socket) { - vespalib::string msg; +std::string read_msg(SocketHandle &socket) { + std::string msg; for (;;) { char c; ssize_t ret = socket.read(&c, 1); @@ -23,7 +23,7 @@ vespalib::string read_msg(SocketHandle &socket) { } void -write_msg(SocketHandle &socket, const vespalib::string &msg) { +write_msg(SocketHandle &socket, const std::string &msg) { for (const char & c : msg) { ssize_t ret = socket.write(&c, 1); if (ret != 1) { @@ -38,7 +38,7 @@ int main(int argc, char **argv) { fprintf(stderr, "usage: %s \n", argv[0]); return 1; } - vespalib::string host(argv[1]); + std::string host(argv[1]); int port = atoi(argv[2]); fprintf(stderr, "running socket test client at host %s\n", HostName::get().c_str()); fprintf(stderr, "trying to connect to host %s at port %d\n", host.c_str(), port); diff --git a/vespalib/src/tests/net/socket/socket_server.cpp b/vespalib/src/tests/net/socket/socket_server.cpp index c8e5bf677d12..5f6ce9216c48 100644 --- a/vespalib/src/tests/net/socket/socket_server.cpp +++ b/vespalib/src/tests/net/socket/socket_server.cpp @@ -10,8 +10,8 @@ using namespace vespalib; -vespalib::string read_msg(SocketHandle &socket) { - vespalib::string msg; +std::string read_msg(SocketHandle &socket) { + std::string msg; for (;;) { char c; ssize_t ret = socket.read(&c, 1); @@ -26,7 +26,7 @@ vespalib::string read_msg(SocketHandle &socket) { } } -void write_msg(SocketHandle &socket, const vespalib::string &msg) { +void write_msg(SocketHandle &socket, const std::string &msg) { for (const char & c : msg) { ssize_t ret = socket.write(&c, 1); if (ret != 1) { diff --git a/vespalib/src/tests/net/socket/socket_test.cpp b/vespalib/src/tests/net/socket/socket_test.cpp index 64f337c03f6c..530fdc259f73 100644 --- a/vespalib/src/tests/net/socket/socket_test.cpp +++ b/vespalib/src/tests/net/socket/socket_test.cpp @@ -66,7 +66,7 @@ SocketTest::my_inet() } } -bool is_socket(const vespalib::string &path) { +bool is_socket(const std::string &path) { struct stat info; if (path.empty() || (lstat(path.c_str(), &info) != 0)) { return false; @@ -74,7 +74,7 @@ bool is_socket(const vespalib::string &path) { return S_ISSOCK(info.st_mode); } -bool is_file(const vespalib::string &path) { +bool is_file(const std::string &path) { struct stat info; if (path.empty() || (lstat(path.c_str(), &info) != 0)) { return false; @@ -82,11 +82,11 @@ bool is_file(const vespalib::string &path) { return S_ISREG(info.st_mode); } -void remove_file(const vespalib::string &path) { +void remove_file(const std::string &path) { unlink(path.c_str()); } -void replace_file(const vespalib::string &path, const vespalib::string &data) { +void replace_file(const std::string &path, const std::string &data) { remove_file(path); int fd = creat(path.c_str(), 0600); ASSERT_NE(fd, -1); @@ -94,8 +94,8 @@ void replace_file(const vespalib::string &path, const vespalib::string &data) { close(fd); } -vespalib::string get_meta(const SocketAddress &addr) { - vespalib::string meta; +std::string get_meta(const SocketAddress &addr) { + std::string meta; if (addr.is_ipv4()) { meta = "ipv4"; } else if (addr.is_ipv6()) { @@ -114,9 +114,9 @@ vespalib::string get_meta(const SocketAddress &addr) { return meta; } -vespalib::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { +std::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { char tmp[64]; - vespalib::string result; + std::string result; while (result.size() < wanted_bytes) { size_t read_size = std::min(sizeof(tmp), wanted_bytes - result.size()); ssize_t read_result = socket.read(tmp, read_size); @@ -129,17 +129,17 @@ vespalib::string read_bytes(SocketHandle &socket, size_t wanted_bytes) { } void verify_socket_io(bool is_server, SocketHandle &socket) { - vespalib::string server_message = "hello, this is the server speaking"; - vespalib::string client_message = "please pick up, I need to talk to you"; + std::string server_message = "hello, this is the server speaking"; + std::string client_message = "please pick up, I need to talk to you"; if(is_server) { ssize_t written = socket.write(server_message.data(), server_message.size()); EXPECT_EQ(written, ssize_t(server_message.size())); - vespalib::string read = read_bytes(socket, client_message.size()); + std::string read = read_bytes(socket, client_message.size()); EXPECT_EQ(client_message, read); } else { ssize_t written = socket.write(client_message.data(), client_message.size()); EXPECT_EQ(written, ssize_t(client_message.size())); - vespalib::string read = read_bytes(socket, server_message.size()); + std::string read = read_bytes(socket, server_message.size()); EXPECT_EQ(server_message, read); } } @@ -196,7 +196,7 @@ TEST_F(SocketTest, ipc_address_with_path) EXPECT_TRUE(!addr.is_abstract()); EXPECT_TRUE(!addr.is_wildcard()); EXPECT_EQ(addr.port(), -1); - EXPECT_EQ(vespalib::string("my_socket"), addr.path()); + EXPECT_EQ(std::string("my_socket"), addr.path()); EXPECT_TRUE(addr.name().empty()); fprintf(stderr, "from_path(my_socket)\n"); fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); @@ -212,7 +212,7 @@ TEST_F(SocketTest, ipc_address_with_name) EXPECT_TRUE(!addr.is_wildcard()); EXPECT_EQ(addr.port(), -1); EXPECT_TRUE(addr.path().empty()); - EXPECT_EQ(vespalib::string("my_socket"), addr.name()); + EXPECT_EQ(std::string("my_socket"), addr.name()); fprintf(stderr, "from_path(my_socket)\n"); fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); } @@ -350,7 +350,7 @@ TEST_F(SocketTest, require_that_basic_unix_domain_socket_io_works_with_name) TEST_F(SocketTest, require_that_two_server_sockets_cannot_have_the_same_abstract_unix_domain_socket_name) { - vespalib::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); + std::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); ServerSocket server1(spec); ServerSocket server2(spec); EXPECT_TRUE(server1.valid()); @@ -359,7 +359,7 @@ TEST_F(SocketTest, require_that_two_server_sockets_cannot_have_the_same_abstract TEST_F(SocketTest, require_that_abstract_socket_names_are_freed_when_the_server_socket_is_destructed) { - vespalib::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); + std::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); ServerSocket server1(spec); EXPECT_TRUE(server1.valid()); server1 = ServerSocket(); @@ -369,7 +369,7 @@ TEST_F(SocketTest, require_that_abstract_socket_names_are_freed_when_the_server_ TEST_F(SocketTest, require_that_abstract_sockets_do_not_have_socket_files) { - vespalib::string name = make_string("my_socket-%d", int(getpid())); + std::string name = make_string("my_socket-%d", int(getpid())); ServerSocket server(SocketSpec::from_name(name)); EXPECT_TRUE(server.valid()); EXPECT_TRUE(!is_socket(name)); diff --git a/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp b/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp index 59e34d8f9263..d7a47a8c10ec 100644 --- a/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp +++ b/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp @@ -5,8 +5,8 @@ using namespace vespalib; void verify(const SocketSpec &spec, bool valid, - const vespalib::string &path, const vespalib::string &name, - const vespalib::string &host, const vespalib::string &host_with_fallback, + const std::string &path, const std::string &name, + const std::string &host, const std::string &host_with_fallback, int port) { EXPECT_EQUAL(spec.valid(), valid); @@ -17,15 +17,15 @@ void verify(const SocketSpec &spec, bool valid, EXPECT_EQUAL(spec.port(), port); } -void verify_path(const SocketSpec &spec, const vespalib::string &path) { +void verify_path(const SocketSpec &spec, const std::string &path) { TEST_DO(verify(spec, true, path, "", "", "", -1)); } -void verify_name(const SocketSpec &spec, const vespalib::string &name) { +void verify_name(const SocketSpec &spec, const std::string &name) { TEST_DO(verify(spec, true, "", name, "", "", -1)); } -void verify_host_port(const SocketSpec &spec, const vespalib::string &host, int port) { +void verify_host_port(const SocketSpec &spec, const std::string &host, int port) { TEST_DO(verify(spec, true, "", "", host, host, port)); } @@ -37,12 +37,12 @@ void verify_invalid(const SocketSpec &spec) { TEST_DO(verify(spec, false, "", "", "", "", -1)); } -void verify_spec(const vespalib::string &str, const vespalib::string &expect) { - vespalib::string actual = SocketSpec(str).spec(); +void verify_spec(const std::string &str, const std::string &expect) { + std::string actual = SocketSpec(str).spec(); EXPECT_EQUAL(actual, expect); } -void verify_spec(const vespalib::string &str) { +void verify_spec(const std::string &str) { TEST_DO(verify_spec(str, str)); } diff --git a/vespalib/src/tests/net/sync_crypto_socket/sync_crypto_socket_test.cpp b/vespalib/src/tests/net/sync_crypto_socket/sync_crypto_socket_test.cpp index 29951dc74e39..d2934ac252a4 100644 --- a/vespalib/src/tests/net/sync_crypto_socket/sync_crypto_socket_test.cpp +++ b/vespalib/src/tests/net/sync_crypto_socket/sync_crypto_socket_test.cpp @@ -33,7 +33,7 @@ struct SocketPair { //----------------------------------------------------------------------------- -vespalib::string read_bytes(SyncCryptoSocket &socket, size_t wanted_bytes) { +std::string read_bytes(SyncCryptoSocket &socket, size_t wanted_bytes) { SmartBuffer read_buffer(wanted_bytes); while (read_buffer.obtain().size < wanted_bytes) { auto chunk = read_buffer.reserve(wanted_bytes - read_buffer.obtain().size); @@ -42,7 +42,7 @@ vespalib::string read_bytes(SyncCryptoSocket &socket, size_t wanted_bytes) { read_buffer.commit(res); } auto data = read_buffer.obtain(); - return vespalib::string(data.data, wanted_bytes); + return std::string(data.data, wanted_bytes); } void read_EOF(SyncCryptoSocket &socket) { @@ -53,7 +53,7 @@ void read_EOF(SyncCryptoSocket &socket) { //----------------------------------------------------------------------------- -void write_bytes(SyncCryptoSocket &socket, const vespalib::string &message) { +void write_bytes(SyncCryptoSocket &socket, const std::string &message) { auto res = socket.write(message.data(), message.size()); ASSERT_EQUAL(size_t(res), message.size()); } @@ -81,15 +81,15 @@ void verify_graceful_shutdown(SyncCryptoSocket &socket, bool is_server) { //----------------------------------------------------------------------------- void verify_socket_io(SyncCryptoSocket &socket, bool is_server) { - vespalib::string client_message = "please pick up, I need to talk to you"; - vespalib::string server_message = "hello, this is the server speaking"; + std::string client_message = "please pick up, I need to talk to you"; + std::string server_message = "hello, this is the server speaking"; if(is_server) { - vespalib::string read = read_bytes(socket, client_message.size()); + std::string read = read_bytes(socket, client_message.size()); write_bytes(socket, server_message); EXPECT_EQUAL(client_message, read); } else { write_bytes(socket, client_message); - vespalib::string read = read_bytes(socket, server_message.size()); + std::string read = read_bytes(socket, server_message.size()); EXPECT_EQUAL(server_message, read); } } diff --git a/vespalib/src/tests/net/tls/auto_reloading_tls_crypto_engine/auto_reloading_tls_crypto_engine_test.cpp b/vespalib/src/tests/net/tls/auto_reloading_tls_crypto_engine/auto_reloading_tls_crypto_engine_test.cpp index 937891fb1e40..00f744530f74 100644 --- a/vespalib/src/tests/net/tls/auto_reloading_tls_crypto_engine/auto_reloading_tls_crypto_engine_test.cpp +++ b/vespalib/src/tests/net/tls/auto_reloading_tls_crypto_engine/auto_reloading_tls_crypto_engine_test.cpp @@ -143,7 +143,7 @@ struct Fixture { } } - vespalib::string current_cert_chain() const { + std::string current_cert_chain() const { return engine->acquire_current_engine()->tls_context()->transport_security_options().cert_chain_pem(); } diff --git a/vespalib/src/tests/net/tls/direct_buffer_bio/direct_buffer_bio_test.cpp b/vespalib/src/tests/net/tls/direct_buffer_bio/direct_buffer_bio_test.cpp index b87db151e82f..14c2d1f6be48 100644 --- a/vespalib/src/tests/net/tls/direct_buffer_bio/direct_buffer_bio_test.cpp +++ b/vespalib/src/tests/net/tls/direct_buffer_bio/direct_buffer_bio_test.cpp @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include #include +#include using namespace vespalib; using namespace vespalib::crypto; @@ -11,7 +11,7 @@ using namespace vespalib::net::tls::impl; struct Fixture { BioPtr mutable_bio; BioPtr const_bio; - vespalib::string tmp_buf; + std::string tmp_buf; Fixture() : mutable_bio(new_mutable_direct_buffer_bio()), @@ -28,7 +28,7 @@ TEST_F("BIOs without associated buffers return zero pending", Fixture) { } TEST_F("Const BIO has initial pending equal to size of associated buffer", Fixture) { - vespalib::string to_read = "I sure love me some data"; + std::string to_read = "I sure love me some data"; ConstBufferViewGuard g(*f.const_bio, &to_read[0], to_read.size()); EXPECT_EQUAL(static_cast(to_read.size()), BIO_pending(f.const_bio.get())); } @@ -40,7 +40,7 @@ TEST_F("Mutable BIO has initial pending of 0 with associated buffer (pending == TEST_F("Mutable BIO_write writes to associated buffer", Fixture) { MutableBufferViewGuard g(*f.mutable_bio, &f.tmp_buf[0], f.tmp_buf.size()); - vespalib::string to_write = "hello world!"; + std::string to_write = "hello world!"; int ret = ::BIO_write(f.mutable_bio.get(), to_write.data(), static_cast(to_write.size())); EXPECT_EQUAL(static_cast(to_write.size()), ret); EXPECT_EQUAL(to_write, std::string_view(f.tmp_buf.data(), to_write.size())); @@ -49,7 +49,7 @@ TEST_F("Mutable BIO_write writes to associated buffer", Fixture) { TEST_F("Mutable BIO_write moves write cursor per invocation", Fixture) { MutableBufferViewGuard g(*f.mutable_bio, &f.tmp_buf[0], f.tmp_buf.size()); - vespalib::string to_write = "hello world!"; + std::string to_write = "hello world!"; int ret = ::BIO_write(f.mutable_bio.get(), to_write.data(), 3); // 'hel' ASSERT_EQUAL(3, ret); @@ -65,7 +65,7 @@ TEST_F("Mutable BIO_write moves write cursor per invocation", Fixture) { } TEST_F("Const BIO_read reads from associated buffer", Fixture) { - vespalib::string to_read = "look at this fancy data!"; + std::string to_read = "look at this fancy data!"; ConstBufferViewGuard g(*f.const_bio, &to_read[0], to_read.size()); int ret = ::BIO_read(f.const_bio.get(), &f.tmp_buf[0], static_cast(f.tmp_buf.size())); @@ -76,7 +76,7 @@ TEST_F("Const BIO_read reads from associated buffer", Fixture) { } TEST_F("Const BIO_read moves read cursor per invocation", Fixture) { - vespalib::string to_read = "look at this fancy data!"; + std::string to_read = "look at this fancy data!"; ConstBufferViewGuard g(*f.const_bio, &to_read[0], to_read.size()); EXPECT_EQUAL(24, BIO_pending(f.const_bio.get())); @@ -108,8 +108,8 @@ TEST_F("Can invoke BIO_(set|get)_close", Fixture) { } TEST_F("BIO_write on const BIO returns failure", Fixture) { - vespalib::string data = "safe and cozy data :3"; - vespalib::string to_read = data; + std::string data = "safe and cozy data :3"; + std::string to_read = data; ConstBufferViewGuard g(*f.const_bio, &to_read[0], to_read.size()); int ret = ::BIO_write(f.const_bio.get(), "unsafe", 6); @@ -121,7 +121,7 @@ TEST_F("BIO_write on const BIO returns failure", Fixture) { TEST_F("BIO_read on mutable BIO returns failure", Fixture) { MutableBufferViewGuard g(*f.mutable_bio, &f.tmp_buf[0], f.tmp_buf.size()); - vespalib::string dummy_buf; + std::string dummy_buf; dummy_buf.reserve(128); int ret = ::BIO_read(f.mutable_bio.get(), &dummy_buf[0], static_cast(dummy_buf.size())); EXPECT_EQUAL(-1, ret); diff --git a/vespalib/src/tests/net/tls/openssl_impl/openssl_impl_test.cpp b/vespalib/src/tests/net/tls/openssl_impl/openssl_impl_test.cpp index 585339e7b577..b7ae96d65880 100644 --- a/vespalib/src/tests/net/tls/openssl_impl/openssl_impl_test.cpp +++ b/vespalib/src/tests/net/tls/openssl_impl/openssl_impl_test.cpp @@ -135,7 +135,7 @@ struct Fixture { return enc_res; } - static DecodeResult do_decode(CryptoCodec& codec, Input& buffer, vespalib::string& out, + static DecodeResult do_decode(CryptoCodec& codec, Input& buffer, std::string& out, size_t max_bytes_produced, size_t max_bytes_consumed) { auto in = buffer.obtain(); out.resize(max_bytes_produced); @@ -158,14 +158,14 @@ struct Fixture { return res; } - DecodeResult client_decode(vespalib::string& out, size_t max_bytes_produced, + DecodeResult client_decode(std::string& out, size_t max_bytes_produced, size_t max_bytes_consumed = UINT64_MAX) { auto res = do_decode(*client, server_to_client, out, max_bytes_produced, max_bytes_consumed); print_decode_result("client", res); return res; } - DecodeResult server_decode(vespalib::string& out, size_t max_bytes_produced, + DecodeResult server_decode(std::string& out, size_t max_bytes_produced, size_t max_bytes_consumed = UINT64_MAX) { auto res = do_decode(*server, client_to_server, out, max_bytes_produced, max_bytes_consumed); print_decode_result("server", res); @@ -173,13 +173,13 @@ struct Fixture { } DecodeResult client_decode_ignore_plaintext_output() { - vespalib::string dummy_decoded; + std::string dummy_decoded; constexpr size_t dummy_max_decoded = 100; return client_decode(dummy_decoded, dummy_max_decoded); } DecodeResult server_decode_ignore_plaintext_output() { - vespalib::string dummy_decoded; + std::string dummy_decoded; constexpr size_t dummy_max_decoded = 100; return server_decode(dummy_decoded, dummy_max_decoded); } @@ -264,16 +264,16 @@ TEST_F("server handshake() returns NeedsPeerData with empty input", Fixture) { TEST_F("clients and servers can send single data frame after handshake (not full duplex)", Fixture) { ASSERT_TRUE(f.handshake()); - vespalib::string client_plaintext = "Hellooo world! :D"; - vespalib::string server_plaintext = "Goodbye moon~ :3"; + std::string client_plaintext = "Hellooo world! :D"; + std::string server_plaintext = "Goodbye moon~ :3"; ASSERT_FALSE(f.client_encode(client_plaintext).failed); - vespalib::string server_plaintext_out; + std::string server_plaintext_out; ASSERT_TRUE(f.server_decode(server_plaintext_out, 256).frame_decoded_ok()); EXPECT_EQUAL(client_plaintext, server_plaintext_out); ASSERT_FALSE(f.server_encode(server_plaintext).failed); - vespalib::string client_plaintext_out; + std::string client_plaintext_out; ASSERT_TRUE(f.client_decode(client_plaintext_out, 256).frame_decoded_ok()); EXPECT_EQUAL(server_plaintext, client_plaintext_out); } @@ -281,14 +281,14 @@ TEST_F("clients and servers can send single data frame after handshake (not full TEST_F("clients and servers can send single data frame after handshake (full duplex)", Fixture) { ASSERT_TRUE(f.handshake()); - vespalib::string client_plaintext = "Greetings globe! :D"; - vespalib::string server_plaintext = "Sayonara luna~ :3"; + std::string client_plaintext = "Greetings globe! :D"; + std::string server_plaintext = "Sayonara luna~ :3"; ASSERT_FALSE(f.client_encode(client_plaintext).failed); ASSERT_FALSE(f.server_encode(server_plaintext).failed); - vespalib::string client_plaintext_out; - vespalib::string server_plaintext_out; + std::string client_plaintext_out; + std::string server_plaintext_out; ASSERT_TRUE(f.server_decode(server_plaintext_out, 256).frame_decoded_ok()); EXPECT_EQUAL(client_plaintext, server_plaintext_out); ASSERT_TRUE(f.client_decode(client_plaintext_out, 256).frame_decoded_ok()); @@ -298,10 +298,10 @@ TEST_F("clients and servers can send single data frame after handshake (full dup TEST_F("short ciphertext read on decode() returns NeedsMorePeerData", Fixture) { ASSERT_TRUE(f.handshake()); - vespalib::string client_plaintext = "very secret foo"; + std::string client_plaintext = "very secret foo"; ASSERT_FALSE(f.client_encode(client_plaintext).failed); - vespalib::string server_plaintext_out; + std::string server_plaintext_out; auto dec_res = f.server_decode(server_plaintext_out, 256, 10); EXPECT_FALSE(dec_res.failed()); // Short read is not a failure mode EXPECT_TRUE(dec_res.state == DecodeResult::State::NeedsMorePeerData); @@ -310,7 +310,7 @@ TEST_F("short ciphertext read on decode() returns NeedsMorePeerData", Fixture) { TEST_F("Encodes larger than max frame size are split up", Fixture) { ASSERT_TRUE(f.handshake()); constexpr auto frame_size = impl::OpenSslCryptoCodecImpl::MaximumFramePlaintextSize; - vespalib::string client_plaintext(frame_size + 50, 'X'); + std::string client_plaintext(frame_size + 50, 'X'); auto enc_res = f.client_encode(client_plaintext); ASSERT_FALSE(enc_res.failed); @@ -322,12 +322,12 @@ TEST_F("Encodes larger than max frame size are split up", Fixture) { ASSERT_EQUAL(50u, enc_res.bytes_consumed); // Over on the server side, we expect to decode 2 matching frames - vespalib::string server_plaintext_out; + std::string server_plaintext_out; auto dec_res = f.server_decode(server_plaintext_out, frame_size); ASSERT_TRUE(dec_res.frame_decoded_ok()); EXPECT_EQUAL(frame_size, dec_res.bytes_produced); - vespalib::string remainder_out; + std::string remainder_out; dec_res = f.server_decode(remainder_out, frame_size); ASSERT_TRUE(dec_res.frame_decoded_ok()); EXPECT_EQUAL(50u, dec_res.bytes_produced); @@ -455,8 +455,8 @@ struct CertFixture : Fixture { {} ~CertFixture(); - static X509Certificate::SubjectInfo make_subject_info(const std::vector& common_names, - const std::vector& sans) { + static X509Certificate::SubjectInfo make_subject_info(const std::vector& common_names, + const std::vector& sans) { auto dn = X509Certificate::DistinguishedName() .country("US").state("CA").locality("Sunnyvale") .organization("Wile E. Coyote, Ltd.") @@ -471,8 +471,8 @@ struct CertFixture : Fixture { return subject; } - CertKeyWrapper create_ca_issued_peer_cert(const std::vector& common_names, - const std::vector& sans) const { + CertKeyWrapper create_ca_issued_peer_cert(const std::vector& common_names, + const std::vector& sans) const { auto subject = make_subject_info(common_names, sans); auto key = PrivateKey::generate_p256_ec_key(); auto params = X509Certificate::Params::issued_by(std::move(subject), key, root_ca.cert, root_ca.key); @@ -480,8 +480,8 @@ struct CertFixture : Fixture { return {std::move(cert), std::move(key)}; } - CertKeyWrapper create_self_signed_peer_cert(const std::vector& common_names, - const std::vector& sans) const { + CertKeyWrapper create_self_signed_peer_cert(const std::vector& common_names, + const std::vector& sans) const { auto subject = make_subject_info(common_names, sans); auto key = PrivateKey::generate_p256_ec_key(); auto params = X509Certificate::Params::self_signed(std::move(subject), key); diff --git a/vespalib/src/tests/net/tls/policy_checking_certificate_verifier/policy_checking_certificate_verifier_test.cpp b/vespalib/src/tests/net/tls/policy_checking_certificate_verifier/policy_checking_certificate_verifier_test.cpp index 7070e4136e59..f517d7ebac2c 100644 --- a/vespalib/src/tests/net/tls/policy_checking_certificate_verifier/policy_checking_certificate_verifier_test.cpp +++ b/vespalib/src/tests/net/tls/policy_checking_certificate_verifier/policy_checking_certificate_verifier_test.cpp @@ -98,20 +98,20 @@ TEST("special extended regex characters are ignored") { } // TODO CN + SANs -PeerCredentials creds_with_sans(std::vector dns_sans, std::vector uri_sans) { +PeerCredentials creds_with_sans(std::vector dns_sans, std::vector uri_sans) { PeerCredentials creds; creds.dns_sans = std::move(dns_sans); creds.uri_sans = std::move(uri_sans); return creds; } -PeerCredentials creds_with_dns_sans(std::vector dns_sans) { +PeerCredentials creds_with_dns_sans(std::vector dns_sans) { PeerCredentials creds; creds.dns_sans = std::move(dns_sans); return creds; } -PeerCredentials creds_with_uri_sans(std::vector uri_sans) { +PeerCredentials creds_with_uri_sans(std::vector uri_sans) { PeerCredentials creds; creds.uri_sans = std::move(uri_sans); return creds; diff --git a/vespalib/src/tests/net/tls/transport_options/transport_options_reading_test.cpp b/vespalib/src/tests/net/tls/transport_options/transport_options_reading_test.cpp index ea4996076850..a8d919daa301 100644 --- a/vespalib/src/tests/net/tls/transport_options/transport_options_reading_test.cpp +++ b/vespalib/src/tests/net/tls/transport_options/transport_options_reading_test.cpp @@ -203,11 +203,11 @@ TEST_F(TransportSecurityOptionsTest, missing_file_referenced_by_field_throws_exc testing::ThrowsMessage(testing::HasSubstr("File 'missing_privkey.txt' referenced by TLS config does not exist"))); } -vespalib::string json_with_policies(const vespalib::string& policies) { +std::string json_with_policies(const std::string& policies) { return ConfigWriter().authorized_peers(std::string("[") + policies + "]").write(); } -TransportSecurityOptions parse_policies(const vespalib::string& policies) +TransportSecurityOptions parse_policies(const std::string& policies) { return *read_options_from_json_string(json_with_policies(policies)); } diff --git a/vespalib/src/tests/objects/identifiable/identifiable_test.cpp b/vespalib/src/tests/objects/identifiable/identifiable_test.cpp index 6296c7c59226..9555fb6f2354 100644 --- a/vespalib/src/tests/objects/identifiable/identifiable_test.cpp +++ b/vespalib/src/tests/objects/identifiable/identifiable_test.cpp @@ -133,7 +133,7 @@ TEST_F(IdentifiableTest, test_nbo_serializer) testSerializer(static_cast(156)); testSerializer(static_cast(156)); testSerializer(static_cast(156)); - testSerializer(vespalib::string("abcdefgh")); + testSerializer(std::string("abcdefgh")); } TEST_F(IdentifiableTest, test_nbo_stream) @@ -151,7 +151,7 @@ TEST_F(IdentifiableTest, test_nbo_stream) testStream(static_cast(156)); testStream(static_cast(156)); testStream(std::string("abcdefgh")); - testStream(vespalib::string("abcdefgh")); + testStream(std::string("abcdefgh")); { nbostream s(4); EXPECT_EQ(4u, s.capacity()); diff --git a/vespalib/src/tests/objects/identifiable/namedobject.h b/vespalib/src/tests/objects/identifiable/namedobject.h index a1fe7c7ba3da..e354a52b089e 100644 --- a/vespalib/src/tests/objects/identifiable/namedobject.h +++ b/vespalib/src/tests/objects/identifiable/namedobject.h @@ -13,10 +13,10 @@ class NamedObject : public Identifiable DECLARE_IDENTIFIABLE_NS(vespalib, NamedObject); DECLARE_NBO_SERIALIZE; NamedObject() : _name() { } - NamedObject(const string & name) : _name(name) { } - const string & getName() const { return _name; } + NamedObject(const std::string & name) : _name(name) { } + const std::string & getName() const { return _name; } private: - string _name; + std::string _name; }; } diff --git a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp index b8b12d508a21..7117d06881ee 100644 --- a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp +++ b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp @@ -210,9 +210,9 @@ TEST_F("Test serializing std::string", Fixture) f.assertSerialize(exp, val); } -TEST_F("Test serializing vespalib::string", Fixture) +TEST_F("Test serializing std::string", Fixture) { - vespalib::string val("Hello"); + std::string val("Hello"); ExpBuffer exp({ 0x00, 0x00, 0x00, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f }); f.assertSerialize(exp, val); } @@ -264,7 +264,7 @@ TEST_F("Test writeSmallString", Fixture) f._stream.writeSmallString("Hello"); ExpBuffer exp({ 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f }); EXPECT_EQUAL(exp, f._stream); - vespalib::string checkString; + std::string checkString; f._stream.readSmallString(checkString); EXPECT_EQUAL("Hello", checkString); EXPECT_EQUAL(0u, f._stream.size()); diff --git a/vespalib/src/tests/objects/objectdump/objectdump.cpp b/vespalib/src/tests/objects/objectdump/objectdump.cpp index e5497d73e694..a7598fc9dadf 100644 --- a/vespalib/src/tests/objects/objectdump/objectdump.cpp +++ b/vespalib/src/tests/objects/objectdump/objectdump.cpp @@ -40,7 +40,7 @@ struct Bar : public Base uint64_t _uint64; float _float; double _double; - vespalib::string _string; + std::string _string; Bar() noexcept : _bool(true), _int8(-1), _uint8(1), _int16(-2), _uint16(2), _int32(-4), _uint32(4), _int64(-8), _uint64(8), _float(2.5), _double(2.75), _string("bla bla") {} diff --git a/vespalib/src/tests/overload/overload_test.cpp b/vespalib/src/tests/overload/overload_test.cpp index 4de0ee05bb6c..1ed538947916 100644 --- a/vespalib/src/tests/overload/overload_test.cpp +++ b/vespalib/src/tests/overload/overload_test.cpp @@ -2,8 +2,8 @@ #include #include -#include #include +#include using namespace vespalib; diff --git a/vespalib/src/tests/portal/http_request/http_request_test.cpp b/vespalib/src/tests/portal/http_request/http_request_test.cpp index e53f462690ae..86db9a44f943 100644 --- a/vespalib/src/tests/portal/http_request/http_request_test.cpp +++ b/vespalib/src/tests/portal/http_request/http_request_test.cpp @@ -7,7 +7,7 @@ using namespace vespalib; using namespace vespalib::portal; -vespalib::string simple_req("GET /my/path HTTP/1.1\r\n" +std::string simple_req("GET /my/path HTTP/1.1\r\n" "Host: my.host.com:80\r\n" "CustomHeader: CustomValue\r\n" "\r\n123456789"); @@ -24,14 +24,14 @@ void verify_simple_req(const HttpRequest &req) { EXPECT_EQUAL(req.get_header("non-existing-header"), ""); } -HttpRequest make_request(const vespalib::string &req) { +HttpRequest make_request(const std::string &req) { HttpRequest result; ASSERT_EQUAL(result.handle_data(req.data(), req.size()), req.size()); ASSERT_TRUE(result.valid()); return result; } -void verify_invalid_request(const vespalib::string &req) { +void verify_invalid_request(const std::string &req) { HttpRequest result; EXPECT_EQUAL(result.handle_data(req.data(), req.size()), req.size()); EXPECT_TRUE(!result.need_more_data()); @@ -131,16 +131,16 @@ TEST("require that uri parameters can be parsed") { } TEST("require that byte values in uri segments (path, key, value) are dequoted as expected") { - vespalib::string str = "0123456789aBcDeF"; + std::string str = "0123456789aBcDeF"; for (size_t a = 0; a < 16; ++a) { for (size_t b = 0; b < 16; ++b) { - vespalib::string expect = " foo "; + std::string expect = " foo "; expect.push_back((a * 16) + b); expect.push_back((a * 16) + b); expect.append(" bar "); - vespalib::string input = vespalib::make_string("+foo+%%%c%c%%%c%c+bar+", + std::string input = vespalib::make_string("+foo+%%%c%c%%%c%c+bar+", str[a], str[b], str[a], str[b]); - vespalib::string uri = vespalib::make_string("%s?%s=%s&extra=yes", + std::string uri = vespalib::make_string("%s?%s=%s&extra=yes", input.c_str(), input.c_str(), input.c_str()); auto req = make_request(vespalib::make_string("GET %s HTTP/1.1\r\n\r\n", uri.c_str())); diff --git a/vespalib/src/tests/portal/portal_test.cpp b/vespalib/src/tests/portal/portal_test.cpp index 7657f5a65d9c..9c9b07002777 100644 --- a/vespalib/src/tests/portal/portal_test.cpp +++ b/vespalib/src/tests/portal/portal_test.cpp @@ -19,17 +19,17 @@ using namespace vespalib::test; //----------------------------------------------------------------------------- -vespalib::string do_http(int port, CryptoEngine::SP crypto, const vespalib::string &method, const vespalib::string &uri, bool send_host = true) { +std::string do_http(int port, CryptoEngine::SP crypto, const std::string &method, const std::string &uri, bool send_host = true) { auto socket = SocketSpec::from_port(port).client_address().connect(); ASSERT_TRUE(socket.valid()); auto conn = SyncCryptoSocket::create_client(*crypto, std::move(socket), make_local_spec()); - vespalib::string http_req = vespalib::make_string("%s %s HTTP/1.1\r\n" + std::string http_req = vespalib::make_string("%s %s HTTP/1.1\r\n" "My-Header: my value\r\n" "%s" "\r\n", method.c_str(), uri.c_str(), send_host ? "Host: HOST:42\r\n" : ""); ASSERT_EQUAL(conn->write(http_req.data(), http_req.size()), ssize_t(http_req.size())); char buf[1024]; - vespalib::string result; + std::string result; ssize_t res = conn->read(buf, sizeof(buf)); while (res > 0) { result.append(std::string_view(buf, res)); @@ -39,13 +39,13 @@ vespalib::string do_http(int port, CryptoEngine::SP crypto, const vespalib::stri return result; } -vespalib::string fetch(int port, CryptoEngine::SP crypto, const vespalib::string &path, bool send_host = true) { +std::string fetch(int port, CryptoEngine::SP crypto, const std::string &path, bool send_host = true) { return do_http(port, std::move(crypto), "GET", path, send_host); } //----------------------------------------------------------------------------- -vespalib::string make_expected_response(const vespalib::string &content_type, const vespalib::string &content) { +std::string make_expected_response(const std::string &content_type, const std::string &content) { return vespalib::make_string("HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: %s\r\n" @@ -60,7 +60,7 @@ vespalib::string make_expected_response(const vespalib::string &content_type, co "%s", content_type.c_str(), content.size(), content.c_str()); } -vespalib::string make_expected_error(int code, const vespalib::string &message) { +std::string make_expected_error(int code, const std::string &message) { return vespalib::make_string("HTTP/1.1 %d %s\r\n" "Connection: close\r\n" "\r\n", code, message.c_str()); @@ -69,7 +69,7 @@ vespalib::string make_expected_error(int code, const vespalib::string &message) //----------------------------------------------------------------------------- struct Encryption { - vespalib::string name; + std::string name; CryptoEngine::SP engine; ~Encryption(); }; @@ -109,9 +109,9 @@ TEST("require that portal can listen to auto-selected port") { } TEST("require that simple GET works with various encryption strategies") { - vespalib::string path = "/test"; - vespalib::string type = "application/json"; - vespalib::string content = "[1,2,3]"; + std::string path = "/test"; + std::string type = "application/json"; + std::string content = "[1,2,3]"; MyGetHandler handler([&](Portal::GetRequest request) { EXPECT_EQUAL(request.get_uri(), path); @@ -176,7 +176,7 @@ TEST("require that methods other than GET return not implemented error") { auto expect_other = make_expected_error(501, "Not Implemented"); for (const auto &method: {"OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"}) { auto result = do_http(portal->listen_port(), null_crypto(), method, "/test"); - if (vespalib::string("GET") == method) { + if (std::string("GET") == method) { EXPECT_EQUAL(result, expect_get); } else { EXPECT_EQUAL(result, expect_other); @@ -185,7 +185,7 @@ TEST("require that methods other than GET return not implemented error") { } TEST("require that GET handler can return HTTP error") { - vespalib::string path = "/test"; + std::string path = "/test"; auto portal = Portal::create(null_crypto(), 0); auto expect = make_expected_error(123, "My Error"); MyGetHandler handler([](Portal::GetRequest request) @@ -198,7 +198,7 @@ TEST("require that GET handler can return HTTP error") { } TEST("require that get requests dropped on the floor returns HTTP error") { - vespalib::string path = "/test"; + std::string path = "/test"; auto portal = Portal::create(null_crypto(), 0); auto expect = make_expected_error(500, "Internal Server Error"); MyGetHandler handler([](Portal::GetRequest) noexcept {}); @@ -265,14 +265,14 @@ TEST("require that connection errors do not block shutdown by leaking resources" { // send partial request then close connection auto socket = SocketSpec::from_port(portal->listen_port()).client_address().connect(); auto conn = SyncCryptoSocket::create_client(*crypto.engine, std::move(socket), make_local_spec()); - vespalib::string req = "GET /test HTTP/1.1\r\n" + std::string req = "GET /test HTTP/1.1\r\n" "Host: local"; ASSERT_EQUAL(conn->write(req.data(), req.size()), ssize_t(req.size())); } { // send request then close without reading response auto socket = SocketSpec::from_port(portal->listen_port()).client_address().connect(); auto conn = SyncCryptoSocket::create_client(*crypto.engine, std::move(socket), make_local_spec()); - vespalib::string req = "GET /test HTTP/1.1\r\n" + std::string req = "GET /test HTTP/1.1\r\n" "Host: localhost\r\n" "\r\n"; ASSERT_EQUAL(conn->write(req.data(), req.size()), ssize_t(req.size())); diff --git a/vespalib/src/tests/process/process_test.cpp b/vespalib/src/tests/process/process_test.cpp index e0a1eefe7c5f..b1318cc7f634 100644 --- a/vespalib/src/tests/process/process_test.cpp +++ b/vespalib/src/tests/process/process_test.cpp @@ -26,25 +26,25 @@ TEST(ProcessTest, simple_run_ignore_output_failure) { //----------------------------------------------------------------------------- TEST(ProcessTest, simple_run) { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run("/bin/echo -n foo", out)); EXPECT_EQ(out, "foo"); } TEST(ProcessTest, simple_run_failure) { - vespalib::string out; + std::string out; EXPECT_FALSE(Process::run("/bin/echo -n foo; false", out)); EXPECT_EQ(out, "foo"); } TEST(ProcessTest, simple_run_strip_single_line_trailing_newline) { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run("echo foo", out)); EXPECT_EQ(out, "foo"); } TEST(ProcessTest, simple_run_dont_strip_multi_line_output) { - vespalib::string out; + std::string out; EXPECT_TRUE(Process::run("perl -e 'print \"foo\\n\\n\"'", out)); EXPECT_EQ(out, "foo\n\n"); } @@ -66,13 +66,13 @@ TEST(ProcessTest, proc_kill) { //----------------------------------------------------------------------------- -vespalib::string line1 = "this is a line"; -vespalib::string line2 = "this is also a line"; -vespalib::string line3 = "this is last line"; +std::string line1 = "this is a line"; +std::string line2 = "this is also a line"; +std::string line3 = "this is last line"; TEST(ProcessTest, read_line) { Process proc("cat"); - for (const vespalib::string &line: {std::cref(line1), std::cref(line2), std::cref(line3)}) { + for (const std::string &line: {std::cref(line1), std::cref(line2), std::cref(line3)}) { auto mem = proc.reserve(line.size() + 1); memcpy(mem.data, line.data(), line.size()); mem.data[line.size()] = '\n'; @@ -118,13 +118,13 @@ Slime read_slime(Input &input) { return slime; } -vespalib::string to_json(const Slime &slime) { +std::string to_json(const Slime &slime) { SimpleBuffer buf; JsonFormat::encode(slime, buf, true); return buf.get().make_string(); } -Slime from_json(const vespalib::string &json) { +Slime from_json(const std::string &json) { Slime slime; EXPECT_TRUE(JsonFormat::decode(json, slime)); return slime; diff --git a/vespalib/src/tests/random/friendfinder.cpp b/vespalib/src/tests/random/friendfinder.cpp index 5350ffe6ca28..d44e215cd4cf 100644 --- a/vespalib/src/tests/random/friendfinder.cpp +++ b/vespalib/src/tests/random/friendfinder.cpp @@ -29,7 +29,7 @@ int main(int argc, char **argv) uint32_t person = 0; while (!feof(stdin)) { ++person; - std::vector friends; + std::vector friends; int32_t want = (uint32_t)std::exp(rnd.nextNormal(logmean, lstddev)); if (want < 17) want = (uint32_t)(std::exp(logmean)+0.99); if (want < 1) want = 1; @@ -41,7 +41,7 @@ int main(int argc, char **argv) break; } if (rnd.nextUint32() % 42 == 17) { - vespalib::string s(line); + std::string s(line); vespalib::chomp(s); friends.push_back(s); --want; diff --git a/vespalib/src/tests/rw_spin_lock/rw_spin_lock_test.cpp b/vespalib/src/tests/rw_spin_lock/rw_spin_lock_test.cpp index b93114960192..4c7225a45a69 100644 --- a/vespalib/src/tests/rw_spin_lock/rw_spin_lock_test.cpp +++ b/vespalib/src/tests/rw_spin_lock/rw_spin_lock_test.cpp @@ -225,10 +225,10 @@ double measure_ns(auto &work) { struct BenchmarkResult { double cost_ns; BenchmarkResult(double cost_ns_in) : cost_ns(cost_ns_in) {} - void report(vespalib::string desc) { + void report(std::string desc) { fprintf(stderr, "%s: cost_ns: %g\n", desc.c_str(), cost_ns); } - void report(vespalib::string name, vespalib::string desc) { + void report(std::string name, std::string desc) { report(name + "(" + desc + ")"); } }; diff --git a/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp b/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp index 230bdbc87a65..b5e1bffc6716 100644 --- a/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp +++ b/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp @@ -155,7 +155,7 @@ int detectSerializeFailure(Fixture &f, std::string_view altComponentId, int tryL return tryCnt; } -vespalib::string makeAltComponentId(Fixture &f) +std::string makeAltComponentId(Fixture &f) { int tryCnt = 0; char altComponentId[20]; @@ -182,7 +182,7 @@ TEST_F("require that task with different string component ids are not serialized TEST_F("require that task with different string component ids mapping to the same executor id are serialized", Fixture) { - vespalib::string altComponentId = makeAltComponentId(f); + std::string altComponentId = makeAltComponentId(f); LOG(info, "second string component id is \"%s\"", altComponentId.c_str()); int tryCnt = detectSerializeFailure(f, altComponentId, 100); EXPECT_TRUE(tryCnt == 100); diff --git a/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp index 7943371c6b08..8f2980322229 100644 --- a/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp +++ b/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp @@ -181,7 +181,7 @@ detectSerializeFailure(Fixture &f, std::string_view altComponentId, int tryLimit return tryCnt; } -vespalib::string +std::string makeAltComponentId(Fixture &f) { int tryCnt = 0; @@ -209,7 +209,7 @@ TEST_F("require that task with different string component ids are not serialized TEST_F("require that task with different string component ids mapping to the same executor id are serialized", Fixture) { - vespalib::string altComponentId = makeAltComponentId(f); + std::string altComponentId = makeAltComponentId(f); LOG(info, "second string component id is \"%s\"", altComponentId.c_str()); int tryCnt = detectSerializeFailure(f, altComponentId, 100); EXPECT_TRUE(tryCnt == 100); diff --git a/vespalib/src/tests/sha1/sha1_test.cpp b/vespalib/src/tests/sha1/sha1_test.cpp index cfb807006df3..74899c5e265b 100644 --- a/vespalib/src/tests/sha1/sha1_test.cpp +++ b/vespalib/src/tests/sha1/sha1_test.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include using namespace vespalib; @@ -15,9 +15,9 @@ struct Digest { buf[i] = ((rand() >> 12) & 0xff); } } - vespalib::string as_string() const { + std::string as_string() const { const char *sym = "0123456789ABCDEF"; - vespalib::string res; + std::string res; for (size_t i = 0; i < 20; ++i) { res += sym[(buf[i] >> 4) & 0xf]; res += sym[buf[i] & 0xf]; diff --git a/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp b/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp index 59db073b8068..28cc7d7f7fe0 100644 --- a/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp +++ b/vespalib/src/tests/shared_string_repo/shared_string_repo_test.cpp @@ -31,8 +31,8 @@ bool will_reclaim() { //----------------------------------------------------------------------------- -std::vector make_strings(size_t cnt) { - std::vector strings; +std::vector make_strings(size_t cnt) { + std::vector strings; strings.reserve(cnt); for (size_t i = 0; i < cnt; ++i) { strings.push_back(fmt("str_%zu", i)); @@ -40,8 +40,8 @@ std::vector make_strings(size_t cnt) { return strings; } -std::vector make_direct_strings(size_t cnt) { - std::vector strings; +std::vector make_direct_strings(size_t cnt) { + std::vector strings; strings.reserve(cnt); for (size_t i = 0; i < cnt; ++i) { strings.push_back(fmt("%zu", (i % 100000))); @@ -49,12 +49,12 @@ std::vector make_direct_strings(size_t cnt) { return strings; } -std::vector copy_strings(const std::vector &strings) { +std::vector copy_strings(const std::vector &strings) { return strings; } -std::vector> copy_and_hash(const std::vector &strings) { - std::vector> result; +std::vector> copy_and_hash(const std::vector &strings) { + std::vector> result; result.reserve(strings.size()); for (const auto &str: strings) { result.emplace_back(str, XXH3_64bits(str.data(), str.size())); @@ -62,8 +62,8 @@ std::vector> copy_and_hash(const std::vect return result; } -std::vector local_enum(const std::vector &strings) { - hash_map map(strings.size() * 2); +std::vector local_enum(const std::vector &strings) { + hash_map map(strings.size() * 2); std::vector result; result.reserve(strings.size()); for (const auto &str: strings) { @@ -72,7 +72,7 @@ std::vector local_enum(const std::vector &strings) { return result; } -std::vector resolve_strings(const std::vector &strings) { +std::vector resolve_strings(const std::vector &strings) { std::vector handles; handles.reserve(strings.size()); for (const auto & string : strings) { @@ -81,8 +81,8 @@ std::vector resolve_strings(const std::vector &strings return handles; } -std::vector get_strings(const std::vector &handles) { - std::vector strings; +std::vector get_strings(const std::vector &handles) { + std::vector strings; strings.reserve(handles.size()); for (const auto & handle : handles) { strings.push_back(handle.as_string()); @@ -90,7 +90,7 @@ std::vector get_strings(const std::vector &handles) { return strings; } -std::unique_ptr make_strong_handles(const std::vector &strings) { +std::unique_ptr make_strong_handles(const std::vector &strings) { auto result = std::make_unique(); result->reserve(strings.size()); for (const auto &str: strings) { @@ -133,10 +133,10 @@ void verify_equal(const std::vector &a, const std::vector &b) { struct Fixture { Avg avg; Vote vote; - std::vector work; - std::vector direct_work; + std::vector work; + std::vector direct_work; steady_time start_time; - std::map time_ms; + std::map time_ms; explicit Fixture(size_t num_threads) : avg(num_threads), vote(num_threads), work(make_strings(work_size)), direct_work(make_direct_strings(work_size)), start_time(steady_clock::now()) {} ~Fixture() { @@ -151,7 +151,7 @@ struct Fixture { return to_s(steady_clock::now() - start_time) < budget; } template - void measure_task(const vespalib::string &tag, bool is_master, F &&task) { + void measure_task(const std::string &tag, bool is_master, F &&task) { auto before = steady_clock::now(); task(); double ms_cost = to_s(steady_clock::now() - before) * 1000.0; @@ -166,15 +166,15 @@ struct Fixture { } void benchmark(bool is_master) { for (bool once_more = true; vote(once_more); once_more = has_budget()) { - std::vector copy_strings_result; - std::vector> copy_and_hash_result; + std::vector copy_strings_result; + std::vector> copy_and_hash_result; std::vector local_enum_result; std::vector resolve_result; std::vector resolve_direct_result; std::vector copy_handles_result; std::vector resolve_again_result; - std::vector get_result; - std::vector get_direct_result; + std::vector get_result; + std::vector get_direct_result; std::unique_ptr strong; std::unique_ptr strong_copy; std::unique_ptr weak; @@ -341,12 +341,12 @@ TEST("require that basic handle usage works") { EXPECT_EQUAL(empty.id().value(), 0u); EXPECT_TRUE(empty.id() == string_id()); EXPECT_TRUE(empty2.id() == string_id()); - EXPECT_EQUAL(empty.as_string(), vespalib::string("")); - EXPECT_EQUAL(empty2.as_string(), vespalib::string("")); - EXPECT_EQUAL(foo.as_string(), vespalib::string("foo")); - EXPECT_EQUAL(bar.as_string(), vespalib::string("bar")); - EXPECT_EQUAL(foo2.as_string(), vespalib::string("foo")); - EXPECT_EQUAL(bar2.as_string(), vespalib::string("bar")); + EXPECT_EQUAL(empty.as_string(), std::string("")); + EXPECT_EQUAL(empty2.as_string(), std::string("")); + EXPECT_EQUAL(foo.as_string(), std::string("foo")); + EXPECT_EQUAL(bar.as_string(), std::string("bar")); + EXPECT_EQUAL(foo2.as_string(), std::string("foo")); + EXPECT_EQUAL(bar2.as_string(), std::string("bar")); } TEST("require that handles can be copied") { @@ -359,7 +359,7 @@ TEST("require that handles can be copied") { EXPECT_EQUAL(active_enums(), before + 1); EXPECT_TRUE(a.id() == b.id()); EXPECT_TRUE(b.id() == c.id()); - EXPECT_EQUAL(c.as_string(), vespalib::string("copied")); + EXPECT_EQUAL(c.as_string(), std::string("copied")); } TEST("require that handles can be moved") { @@ -372,7 +372,7 @@ TEST("require that handles can be moved") { EXPECT_EQUAL(active_enums(), before + 1); EXPECT_TRUE(a.id() == string_id()); EXPECT_TRUE(b.id() == string_id()); - EXPECT_EQUAL(c.as_string(), vespalib::string("moved")); + EXPECT_EQUAL(c.as_string(), std::string("moved")); } TEST("require that handle/string can be obtained from string_id") { @@ -381,7 +381,7 @@ TEST("require that handle/string can be obtained from string_id") { EXPECT_EQUAL(active_enums(), before + 1); Handle b = Handle::handle_from_id(a.id()); EXPECT_EQUAL(active_enums(), before + 1); - EXPECT_EQUAL(Handle::string_from_id(b.id()), vespalib::string("str")); + EXPECT_EQUAL(Handle::string_from_id(b.id()), std::string("str")); } void verifySelfAssignment(Handle & a, const Handle &b) { @@ -391,12 +391,12 @@ void verifySelfAssignment(Handle & a, const Handle &b) { TEST("require that handle can be self-assigned") { Handle a("foo"); verifySelfAssignment(a, a); - EXPECT_EQUAL(a.as_string(), vespalib::string("foo")); + EXPECT_EQUAL(a.as_string(), std::string("foo")); } //----------------------------------------------------------------------------- -void verify_direct(const vespalib::string &str, size_t value) { +void verify_direct(const std::string &str, size_t value) { size_t before = active_enums(); Handle handle(str); EXPECT_EQUAL(handle.id().hash(), value + 1); @@ -405,7 +405,7 @@ void verify_direct(const vespalib::string &str, size_t value) { EXPECT_EQUAL(handle.as_string(), str); } -void verify_not_direct(const vespalib::string &str) { +void verify_not_direct(const std::string &str) { size_t before = active_enums(); Handle handle(str); EXPECT_EQUAL(handle.id().hash(), handle.id().value()); @@ -462,7 +462,7 @@ TEST("require that basic multi-handle usage works") { //----------------------------------------------------------------------------- -void verify_same_enum(int64_t num, const vespalib::string &str) { +void verify_same_enum(int64_t num, const std::string &str) { Handle n = Handle::handle_from_number(num); Handle s(str); EXPECT_EQUAL(n.id().value(), s.id().value()); diff --git a/vespalib/src/tests/signalhandler/my_shared_library.cpp b/vespalib/src/tests/signalhandler/my_shared_library.cpp index 33260e652ec4..6a7e16651ff1 100644 --- a/vespalib/src/tests/signalhandler/my_shared_library.cpp +++ b/vespalib/src/tests/signalhandler/my_shared_library.cpp @@ -17,6 +17,6 @@ void my_cool_function(vespalib::CountDownLatch& arrival_latch, vespalib::CountDo asm(""); // Dear GCC; really, really don't inline this function. It's clobberin' time! } -vespalib::string my_totally_tubular_and_groovy_function() { +std::string my_totally_tubular_and_groovy_function() { return vespalib::SignalHandler::get_cross_thread_stack_trace(pthread_self()); } diff --git a/vespalib/src/tests/signalhandler/my_shared_library.h b/vespalib/src/tests/signalhandler/my_shared_library.h index 35c573c4df28..88b604881f09 100644 --- a/vespalib/src/tests/signalhandler/my_shared_library.h +++ b/vespalib/src/tests/signalhandler/my_shared_library.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include +#include void my_cool_function(vespalib::CountDownLatch&, vespalib::CountDownLatch&) __attribute__((noinline)); -vespalib::string my_totally_tubular_and_groovy_function() __attribute__((noinline)); +std::string my_totally_tubular_and_groovy_function() __attribute__((noinline)); diff --git a/vespalib/src/tests/slime/are_equal/slime_are_equal_test.cpp b/vespalib/src/tests/slime/are_equal/slime_are_equal_test.cpp index 075095247756..5f3be0d196a0 100644 --- a/vespalib/src/tests/slime/are_equal/slime_are_equal_test.cpp +++ b/vespalib/src/tests/slime/are_equal/slime_are_equal_test.cpp @@ -24,7 +24,7 @@ Slime parse(const std::string &json) { } const Inspector &full_obj() { - static vespalib::string str = + static std::string str = "{" " a: 'foo'," " b: 'bar'," @@ -36,7 +36,7 @@ const Inspector &full_obj() { } const Inspector &subset_obj() { - static vespalib::string str = + static std::string str = "{" " a: 'foo'," " c: 'baz'," @@ -47,7 +47,7 @@ const Inspector &subset_obj() { } const Inspector &wildcard_obj() { - static vespalib::string str = + static std::string str = "{" " a: 'foo'," " b: null," @@ -72,7 +72,7 @@ Slime add_data_and_nix(Slime slime) { } const Inspector &leaf_cmp_obj() { - static vespalib::string str = + static std::string str = "{" " ref: [ true, 7, 2.0, 'foo']," "same: [ true, 7, 2.0, 'foo']," @@ -83,9 +83,9 @@ const Inspector &leaf_cmp_obj() { return slime.get(); } -vespalib::string path_to_str(const Path &path) { +std::string path_to_str(const Path &path) { size_t cnt = 0; - vespalib::string str("["); + std::string str("["); for (const auto &item: path) { if (cnt++ > 0) { str.append(","); @@ -98,7 +98,7 @@ vespalib::string path_to_str(const Path &path) { return str; } -vespalib::string to_str(const Inspector &value) { +std::string to_str(const Inspector &value) { if (!value.valid()) { return ""; } diff --git a/vespalib/src/tests/slime/slime_binary_format_test.cpp b/vespalib/src/tests/slime/slime_binary_format_test.cpp index 31fa60378777..ebf084028420 100644 --- a/vespalib/src/tests/slime/slime_binary_format_test.cpp +++ b/vespalib/src/tests/slime/slime_binary_format_test.cpp @@ -632,7 +632,7 @@ TEST("testOptionalDecodeOrder") { EXPECT_TRUE(!c[5].valid()); // not ARRAY } -Slime from_json(const vespalib::string &json) { +Slime from_json(const std::string &json) { Slime slime; EXPECT_TRUE(vespalib::slime::JsonFormat::decode(json, slime) > 0); return slime; diff --git a/vespalib/src/tests/slime/slime_json_format_test.cpp b/vespalib/src/tests/slime/slime_json_format_test.cpp index 7ec7ca42f581..3eb3bd0662a9 100644 --- a/vespalib/src/tests/slime/slime_json_format_test.cpp +++ b/vespalib/src/tests/slime/slime_json_format_test.cpp @@ -406,7 +406,7 @@ TEST_F("decode bytes not null-terminated", Slime) { } TEST("require that multiple adjacent values can be decoded from a single input") { - vespalib::string data("true{}false[]null\"foo\"'bar'1.5null"); + std::string data("true{}false[]null\"foo\"'bar'1.5null"); MemoryInput input(data); EXPECT_EQUAL(std::string("true"), normalize(input)); EXPECT_EQUAL(std::string("{}"), normalize(input)); diff --git a/vespalib/src/tests/state_server/state_server_test.cpp b/vespalib/src/tests/state_server/state_server_test.cpp index 5c27f585d8d4..1c68f555a7c1 100644 --- a/vespalib/src/tests/state_server/state_server_test.cpp +++ b/vespalib/src/tests/state_server/state_server_test.cpp @@ -19,53 +19,53 @@ using namespace vespalib; //----------------------------------------------------------------------------- -vespalib::string root_path = "/state/v1/"; -vespalib::string short_root_path = "/state/v1"; -vespalib::string metrics_path = "/state/v1/metrics"; -vespalib::string health_path = "/state/v1/health"; -vespalib::string config_path = "/state/v1/config"; +std::string root_path = "/state/v1/"; +std::string short_root_path = "/state/v1"; +std::string metrics_path = "/state/v1/metrics"; +std::string health_path = "/state/v1/health"; +std::string config_path = "/state/v1/config"; -vespalib::string total_metrics_path = "/metrics/total"; +std::string total_metrics_path = "/metrics/total"; -vespalib::string unknown_path = "/this/path/is/not/known"; -vespalib::string unknown_state_path = "/state/v1/this/path/is/not/known"; -vespalib::string my_path = "/my/path"; +std::string unknown_path = "/this/path/is/not/known"; +std::string unknown_state_path = "/state/v1/this/path/is/not/known"; +std::string my_path = "/my/path"; -vespalib::string host_tag = "HOST"; -std::map empty_params; +std::string host_tag = "HOST"; +std::map empty_params; //----------------------------------------------------------------------------- -vespalib::string run_cmd(const vespalib::string &cmd) { - vespalib::string out; +std::string run_cmd(const std::string &cmd) { + std::string out; ASSERT_TRUE(Process::run(cmd.c_str(), out)); return out; } -vespalib::string getPage(int port, const vespalib::string &path, const vespalib::string &extra_params = "") { +std::string getPage(int port, const std::string &path, const std::string &extra_params = "") { return run_cmd(make_string("curl -s %s 'http://localhost:%d%s'", extra_params.c_str(), port, path.c_str())); } -vespalib::string getFull(int port, const vespalib::string &path) { return getPage(port, path, "-D -"); } +std::string getFull(int port, const std::string &path) { return getPage(port, path, "-D -"); } -std::pair +std::pair get_body_and_content_type(const JsonGetHandler &handler, - const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms) + const std::string &host, + const std::string &path, + const std::map ¶ms) { net::ConnectionAuthContext dummy_ctx(net::tls::PeerCredentials(), net::tls::CapabilitySet::all()); auto res = handler.get(host, path, params, dummy_ctx); if (res.ok()) { - return {vespalib::string(res.payload()), vespalib::string(res.content_type())}; + return {std::string(res.payload()), std::string(res.content_type())}; } return {}; } -vespalib::string get_json(const JsonGetHandler &handler, - const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms) +std::string get_json(const JsonGetHandler &handler, + const std::string &host, + const std::string &path, + const std::map ¶ms) { return get_body_and_content_type(handler, host, path, params).first; } @@ -73,10 +73,10 @@ vespalib::string get_json(const JsonGetHandler &handler, //----------------------------------------------------------------------------- struct DummyHandler : JsonGetHandler { - vespalib::string result; - DummyHandler(const vespalib::string &result_in) : result(result_in) {} - Response get(const vespalib::string &, const vespalib::string &, - const std::map &, + std::string result; + DummyHandler(const std::string &result_in) : result(result_in) {} + Response get(const std::string &, const std::string &, + const std::map &, const net::ConnectionAuthContext &) const override { if (!result.empty()) { @@ -108,7 +108,7 @@ TEST_FF("require that handler can return a 404 response", DummyHandler(""), Http TEST_FF("require that non-empty known url returns expected headers", DummyHandler("[123]"), HttpServer(0)) { auto token = f2.repo().bind(my_path, f1); - vespalib::string expect("HTTP/1.1 200 OK\r\n" + std::string expect("HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: application/json\r\n" "Content-Length: 5\r\n" @@ -143,8 +143,8 @@ TEST_FFFF("require that handler is selected based on longest matching url prefix struct EchoHost : JsonGetHandler { ~EchoHost() override; - Response get(const vespalib::string &host, const vespalib::string &, - const std::map &, + Response get(const std::string &host, const std::string &, + const std::map &, const net::ConnectionAuthContext &) const override { return Response::make_ok_with_json("[\"" + host + "\"]"); @@ -156,9 +156,9 @@ EchoHost::~EchoHost() = default; TEST_FF("require that host is passed correctly", EchoHost(), HttpServer(0)) { auto token = f2.repo().bind(my_path, f1); EXPECT_EQUAL(make_string("%s:%d", HostName::get().c_str(), f2.port()), f2.host()); - vespalib::string default_result = make_string("[\"%s\"]", f2.host().c_str()); - vespalib::string localhost_result = make_string("[\"%s:%d\"]", "localhost", f2.port()); - vespalib::string silly_result = "[\"sillyserver\"]"; + std::string default_result = make_string("[\"%s\"]", f2.host().c_str()); + std::string localhost_result = make_string("[\"%s:%d\"]", "localhost", f2.port()); + std::string silly_result = "[\"sillyserver\"]"; EXPECT_EQUAL(localhost_result, run_cmd(make_string("curl -s http://localhost:%d/my/path", f2.port()))); EXPECT_EQUAL(silly_result, run_cmd(make_string("curl -s http://localhost:%d/my/path -H \"Host: sillyserver\"", f2.port()))); EXPECT_EQUAL(default_result, run_cmd(make_string("curl -s http://localhost:%d/my/path -H \"Host:\"", f2.port()))); @@ -166,12 +166,12 @@ TEST_FF("require that host is passed correctly", EchoHost(), HttpServer(0)) { struct SamplingHandler : JsonGetHandler { mutable std::mutex my_lock; - mutable vespalib::string my_host; - mutable vespalib::string my_path; - mutable std::map my_params; + mutable std::string my_host; + mutable std::string my_path; + mutable std::map my_params; ~SamplingHandler() override; - Response get(const vespalib::string &host, const vespalib::string &path, - const std::map ¶ms, + Response get(const std::string &host, const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &) const override { { @@ -230,12 +230,12 @@ TEST_FFFF("require that the state server exposes the state api handler repo", StateServer(0, f1, f2, f3)) { int port = f4.getListenPort(); - vespalib::string page1 = getPage(port, root_path); + std::string page1 = getPage(port, root_path); auto token = f4.repo().add_root_resource("state/v1/custom"); - vespalib::string page2 = getPage(port, root_path); + std::string page2 = getPage(port, root_path); EXPECT_NOT_EQUAL(page1, page2); token.reset(); - vespalib::string page3 = getPage(port, root_path); + std::string page3 = getPage(port, root_path); EXPECT_EQUAL(page3, page1); } @@ -248,7 +248,7 @@ TEST_FFFF("require that json handlers can be removed from repo", auto token1 = f4.bind("/foo", f1); auto token2 = f4.bind("/foo/bar", f2); auto token3 = f4.bind("/foo/bar/baz", f3); - std::map params; + std::map params; EXPECT_EQUAL("[1]", get_json(f4, "", "/foo", params)); EXPECT_EQUAL("[2]", get_json(f4, "", "/foo/bar", params)); EXPECT_EQUAL("[3]", get_json(f4, "", "/foo/bar/baz", params)); @@ -264,7 +264,7 @@ TEST_FFFF("require that json handlers can be shadowed", { auto token1 = f4.bind("/foo", f1); auto token2 = f4.bind("/foo/bar", f2); - std::map params; + std::map params; EXPECT_EQUAL("[1]", get_json(f4, "", "/foo", params)); EXPECT_EQUAL("[2]", get_json(f4, "", "/foo/bar", params)); auto token3 = f4.bind("/foo/bar", f3); @@ -275,15 +275,15 @@ TEST_FFFF("require that json handlers can be shadowed", TEST_F("require that root resources can be tracked", JsonHandlerRepo()) { - EXPECT_TRUE(std::vector({}) == f1.get_root_resources()); + EXPECT_TRUE(std::vector({}) == f1.get_root_resources()); auto token1 = f1.add_root_resource("/health"); - EXPECT_TRUE(std::vector({"/health"}) == f1.get_root_resources()); + EXPECT_TRUE(std::vector({"/health"}) == f1.get_root_resources()); auto token2 = f1.add_root_resource("/config"); - EXPECT_TRUE(std::vector({"/health", "/config"}) == f1.get_root_resources()); + EXPECT_TRUE(std::vector({"/health", "/config"}) == f1.get_root_resources()); auto token3 = f1.add_root_resource("/custom/foo"); - EXPECT_TRUE(std::vector({"/health", "/config", "/custom/foo"}) == f1.get_root_resources()); + EXPECT_TRUE(std::vector({"/health", "/config", "/custom/foo"}) == f1.get_root_resources()); token2.reset(); - EXPECT_TRUE(std::vector({"/health", "/custom/foo"}) == f1.get_root_resources()); + EXPECT_TRUE(std::vector({"/health", "/custom/foo"}) == f1.get_root_resources()); } //----------------------------------------------------------------------------- @@ -416,16 +416,16 @@ struct EchoConsumer : MetricsProducer { abort(); } - static vespalib::string stringify_params(const vespalib::string &consumer, ExpositionFormat format) { + static std::string stringify_params(const std::string &consumer, ExpositionFormat format) { // Not semantically meaningful output if format == Prometheus, but doesn't really matter here. return vespalib::make_string(R"(["%s", "%s"])", to_string(format), consumer.c_str()); } ~EchoConsumer() override; - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override { + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override { return stringify_params(consumer, format); } - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override { + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override { return stringify_params(consumer, format); } }; @@ -453,7 +453,7 @@ TEST_FFFF("require that metrics consumer is passed correctly", SimpleHealthProducer(), EchoConsumer(), SimpleComponentConfigProducer(), StateApi(f1, f2, f3)) { - std::map my_params; + std::map my_params; my_params["consumer"] = "ME"; EXPECT_EQUAL(R"({"status":{"code":"up"},"metrics":["JSON", "ME"]})", get_json(f4, host_tag, metrics_path, my_params)); EXPECT_EQUAL(R"(["JSON", "ME"])", get_json(f4, host_tag, total_metrics_path, my_params)); @@ -461,7 +461,7 @@ TEST_FFFF("require that metrics consumer is passed correctly", EXPECT_EQUAL(R"(["Prometheus", "ME"])", get_json(f4, host_tag, total_metrics_path, my_params)); } -void check_json(const vespalib::string &expect_json, const vespalib::string &actual_json) { +void check_json(const std::string &expect_json, const std::string &actual_json) { Slime expect_slime; Slime actual_slime; EXPECT_TRUE(slime::JsonFormat::decode(expect_json, expect_slime) > 0); @@ -470,7 +470,7 @@ void check_json(const vespalib::string &expect_json, const vespalib::string &act } TEST("require that generic state can be explored") { - vespalib::string json_model = + std::string json_model = "{" " foo: 'bar'," " cnt: 123," @@ -492,7 +492,7 @@ TEST("require that generic state can be explored") { " }" " }" "}"; - vespalib::string json_root = + std::string json_root = "{" " full: true," " foo: 'bar'," @@ -514,7 +514,7 @@ TEST("require that generic state can be explored") { " }" " }" "}"; - vespalib::string json_engine = + std::string json_engine = "{" " full: true," " up: 'yes'," @@ -524,13 +524,13 @@ TEST("require that generic state can be explored") { " url: 'http://HOST/state/v1/engine/stats'" " }" "}"; - vespalib::string json_engine_stats = + std::string json_engine_stats = "{" " full: true," " latency: 5," " qps: 100" "}"; - vespalib::string json_list = + std::string json_list = "{" " one: {" " size: {" @@ -543,15 +543,15 @@ TEST("require that generic state can be explored") { " url: 'http://HOST/state/v1/list/two'" " }" "}"; - vespalib::string json_list_one = + std::string json_list_one = "{" " size: {" " value: 1," " url: 'http://HOST/state/v1/list/one/size'" " }" "}"; - vespalib::string json_list_one_size = "{ full: true, value: 1 }"; - vespalib::string json_list_two = "{ full: true, size: 2 }"; + std::string json_list_one_size = "{ full: true, value: 1 }"; + std::string json_list_two = "{ full: true, size: 2 }"; //------------------------------------------------------------------------- Slime slime_state; EXPECT_TRUE(slime::JsonFormat::decode(json_model, slime_state) > 0); diff --git a/vespalib/src/tests/stllike/asciistream_test.cpp b/vespalib/src/tests/stllike/asciistream_test.cpp index 048e6ab3feef..0cff589937e1 100644 --- a/vespalib/src/tests/stllike/asciistream_test.cpp +++ b/vespalib/src/tests/stllike/asciistream_test.cpp @@ -15,12 +15,12 @@ namespace { template void -verifyBothWays(T value, const char * expected, const vespalib::string& label) +verifyBothWays(T value, const char * expected, const std::string& label) { SCOPED_TRACE(label); asciistream os; os << value; - EXPECT_EQ(os.view(), string(expected)); + EXPECT_EQ(os.view(), std::string(expected)); EXPECT_EQ(os.size(), strlen(expected)); { T v; @@ -41,14 +41,14 @@ verifyBothWays(T value, const char * expected, const vespalib::string& label) template void -verify(T first, T second, const char * firstResult, const char * secondResult, char delim, const vespalib::string& label) +verify(T first, T second, const char * firstResult, const char * secondResult, char delim, const std::string& label) { SCOPED_TRACE(label); asciistream os; std::ostringstream ss; os << first; ss << first; - EXPECT_EQ(os.view(), string(firstResult)); + EXPECT_EQ(os.view(), std::string(firstResult)); EXPECT_EQ(os.size(), strlen(firstResult)); EXPECT_EQ(ss.str().size(), strlen(firstResult)); EXPECT_EQ(strcmp(ss.str().c_str(), firstResult), 0); @@ -310,7 +310,7 @@ TEST(AsciistreamTest, test_string) { std::string ss("a"); - vespalib::string vs("a"); + std::string vs("a"); { std::ostringstream oss; oss << ss << vs; @@ -355,7 +355,7 @@ TEST(AsciistreamTest, test_create_from_file) is = asciistream::createFromFile(TEST_PATH("test.txt")); EXPECT_FALSE(is.eof()); EXPECT_EQ(12u, is.size()); - string s; + std::string s; is >> s; EXPECT_EQ("line1", s); is >> s; @@ -376,7 +376,7 @@ TEST(AsciistreamTest, test_write_then_read) asciistream ios; ios << "3 words"; int n(0); - string v; + std::string v; ios >> n >> v; EXPECT_EQ(3, n); EXPECT_EQ("words", v); @@ -386,7 +386,7 @@ TEST(AsciistreamTest, test_write_then_read) TEST(AsciistreamTest, test_get_line) { asciistream is = asciistream("line 1\nline 2\nline 3"); - string s; + std::string s; getline(is, s); EXPECT_EQ("line 1", s); getline(is, s); @@ -557,8 +557,7 @@ TEST(AsciistreamTest, test_ascii_stream) verify(789, -1, "789", "789 4294967295", ' ', "uint32_t"); verify(789789789789789l, -1, "789789789789789", "789789789789789 18446744073709551615", ' ', "uint64_t"); - verifyBothWays("7.89", "7.89", "vespalib::string"); - verifyBothWays("7.89", "7.89", "stsd::string"); + verifyBothWays("7.89", "7.89", "std::string"); verifyBothWays(7.89, "7.89", "float"); verifyBothWays(7.89, "7.89", "double"); verifyBothWays(true, "1", "bool"); diff --git a/vespalib/src/tests/stllike/cache_test.cpp b/vespalib/src/tests/stllike/cache_test.cpp index e6d63d13bd4e..a3fe1c477683 100644 --- a/vespalib/src/tests/stllike/cache_test.cpp +++ b/vespalib/src/tests/stllike/cache_test.cpp @@ -61,7 +61,7 @@ TEST("testCacheSize") TEST("testCacheSizeDeep") { B m; - cache< CacheParam, size > > cache(m, -1); + cache< CacheParam, size > > cache(m, -1); cache.write(1, "15 bytes string"); EXPECT_EQUAL(95u, cache.sizeBytes()); cache.write(1, "10 bytes s"); @@ -72,7 +72,7 @@ TEST("testCacheSizeDeep") TEST("testCacheEntriesHonoured") { B m; - cache< CacheParam, size > > cache(m, -1); + cache< CacheParam, size > > cache(m, -1); cache.maxElements(1); cache.write(1, "15 bytes string"); EXPECT_EQUAL(1u, cache.size()); @@ -86,7 +86,7 @@ TEST("testCacheEntriesHonoured") { TEST("testCacheMaxSizeHonoured") { B m; - cache< CacheParam, size > > cache(m, 200); + cache< CacheParam, size > > cache(m, 200); cache.write(1, "15 bytes string"); EXPECT_EQUAL(1u, cache.size()); EXPECT_EQUAL(95u, cache.sizeBytes()); @@ -103,7 +103,7 @@ TEST("testCacheMaxSizeHonoured") { TEST("testThatMultipleRemoveOnOverflowIsFine") { B m; - cache< CacheParam, size > > cache(m, 2000); + cache< CacheParam, size > > cache(m, 2000); for (size_t j(0); j < 5; j++) { for (size_t i(0); cache.size() == i; i++) { @@ -113,13 +113,13 @@ TEST("testThatMultipleRemoveOnOverflowIsFine") { EXPECT_EQUAL(25u, cache.size()); EXPECT_EQUAL(2025u, cache.sizeBytes()); EXPECT_FALSE( cache.hasKey(0) ); - string ls("long string aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + std::string ls("long string aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - string vls=ls+ls+ls+ls+ls+ls; + std::string vls=ls+ls+ls+ls+ls+ls; cache.write(53+5, ls); EXPECT_EQUAL(25u, cache.size()); EXPECT_EQUAL(2498u, cache.sizeBytes()); diff --git a/vespalib/src/tests/stllike/hashtable_test.cpp b/vespalib/src/tests/stllike/hashtable_test.cpp index 1ee8b36e9ed0..70d022dc3c5f 100644 --- a/vespalib/src/tests/stllike/hashtable_test.cpp +++ b/vespalib/src/tests/stllike/hashtable_test.cpp @@ -85,7 +85,7 @@ TEST("require that getModuloStl always return a larger number in 32 bit integer } TEST("require that you can insert duplicates") { - using Pair = std::pair; + using Pair = std::pair; using Map = hashtable, std::equal_to<>, Select1st>; Map m(1); diff --git a/vespalib/src/tests/stllike/lrucache.cpp b/vespalib/src/tests/stllike/lrucache.cpp index 9f81b29394e7..f6aa77719281 100644 --- a/vespalib/src/tests/stllike/lrucache.cpp +++ b/vespalib/src/tests/stllike/lrucache.cpp @@ -1,13 +1,13 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include +#include using namespace vespalib; TEST("testCache") { - lrucache_map< LruParam > cache(7); + lrucache_map< LruParam > cache(7); // Verfify start conditions. EXPECT_TRUE(cache.size() == 0); cache.insert(1, "First inserted string"); @@ -134,7 +134,7 @@ TEST("testCacheErase") { } TEST("testCacheIterator") { - using Cache = lrucache_map< LruParam >; + using Cache = lrucache_map< LruParam >; Cache cache(3); cache.insert(1, "first"); cache.insert(2, "second"); @@ -170,7 +170,7 @@ TEST("testCacheIterator") { } TEST("testCacheIteratorErase") { - using Cache = lrucache_map< LruParam >; + using Cache = lrucache_map< LruParam >; Cache cache(3); cache.insert(1, "first"); cache.insert(8, "second"); diff --git a/vespalib/src/tests/stllike/string_test.cpp b/vespalib/src/tests/stllike/string_test.cpp index 8e81f008ba5b..2ac818adc38f 100644 --- a/vespalib/src/tests/stllike/string_test.cpp +++ b/vespalib/src/tests/stllike/string_test.cpp @@ -2,6 +2,7 @@ #include #include +#include #include using string = vespalib::vespa_string; @@ -163,7 +164,7 @@ TEST("testString") { TEST_FLUSH(); std::string::size_type exp = std::string::npos; - std::string::size_type act = vespalib::string::npos; + std::string::size_type act = std::string::npos; EXPECT_EQUAL(exp, act); std::string::size_type idx = a.find('a'); EXPECT_EQUAL(0u, idx); @@ -174,7 +175,7 @@ TEST("testString") { EXPECT_EQUAL(1u, a.find('b', 1)); EXPECT_EQUAL(std::string::npos, a.find('b', 2)); // causes warning: - EXPECT_TRUE(vespalib::string::npos == idx); + EXPECT_TRUE(std::string::npos == idx); EXPECT_EQUAL(6u, c.size()); EXPECT_TRUE(strcmp("dfajsg", c.c_str()) == 0); @@ -351,8 +352,8 @@ TEST("require that vespalib::resize works") { EXPECT_EQUAL("abcdeXXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", s); } -TEST("require that you can format a number into a vespalib::string easily") { - vespalib::string str = vespalib::stringify(0); +TEST("require that you can format a number into a std::string easily") { + std::string str = vespalib::stringify(0); EXPECT_EQUAL(str, "0"); EXPECT_EQUAL(vespalib::stringify(1), "1"); EXPECT_EQUAL(vespalib::stringify(123), "123"); @@ -363,7 +364,7 @@ TEST("require that you can format a number into a vespalib::string easily") { using vespalib::contains; TEST("require that contains works") { - vespalib::string s("require that contains works"); + std::string s("require that contains works"); EXPECT_TRUE(contains(s, "require")); EXPECT_TRUE(contains(s, "require that contains work")); EXPECT_TRUE(contains(s, "require that contains works")); @@ -373,7 +374,7 @@ TEST("require that contains works") { } TEST("require that starts_with works") { - vespalib::string s("require that starts_with works"); + std::string s("require that starts_with works"); EXPECT_TRUE(s.starts_with("require")); EXPECT_TRUE(s.starts_with("require that starts_with work")); EXPECT_TRUE(s.starts_with("require that starts_with works")); @@ -382,7 +383,7 @@ TEST("require that starts_with works") { } TEST("require that ends_with works") { - vespalib::string s("require that ends_with works"); + std::string s("require that ends_with works"); EXPECT_FALSE(s.ends_with("require")); EXPECT_TRUE(s.ends_with("works")); EXPECT_TRUE(s.ends_with("equire that ends_with works")); @@ -392,7 +393,7 @@ TEST("require that ends_with works") { } TEST("test that small_string::pop_back works") { - vespalib::string s("string"); + std::string s("string"); EXPECT_EQUAL(s.size(), 6u); s.pop_back(); EXPECT_EQUAL(s.size(), 5u); @@ -405,9 +406,9 @@ TEST("test that small_string::pop_back works") { TEST("test that operator<() works with std::string_view versus string") { std::string_view sra("a"); - vespalib::string sa("a"); + std::string sa("a"); std::string_view srb("b"); - vespalib::string sb("b"); + std::string sb("b"); EXPECT_FALSE(sra < sra); EXPECT_FALSE(sra < sa); EXPECT_TRUE(sra < srb); @@ -432,7 +433,7 @@ TEST("test that empty_string is shared and empty") { } TEST("starts_with has expected semantics for small_string") { - vespalib::string a("foobar"); + std::string a("foobar"); EXPECT_TRUE(a.starts_with("")); EXPECT_TRUE(a.starts_with("foo")); EXPECT_TRUE(a.starts_with("foobar")); @@ -441,7 +442,7 @@ TEST("starts_with has expected semantics for small_string") { } TEST("starts_with has expected semantics for std::string_view") { - vespalib::string a("foobar"); + std::string a("foobar"); std::string_view ar(a); EXPECT_TRUE(ar.starts_with("")); EXPECT_TRUE(ar.starts_with("foo")); @@ -451,7 +452,7 @@ TEST("starts_with has expected semantics for std::string_view") { } TEST("test allowed nullptr construction - legal, but not legitimate use.") { - EXPECT_TRUE(vespalib::string(nullptr, 0).empty()); + EXPECT_TRUE(std::string(nullptr, 0).empty()); EXPECT_TRUE(std::string(nullptr, 0).empty()); EXPECT_TRUE(std::string_view(nullptr, 0).empty()); } diff --git a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp index be29874b9fbc..6debcef46f7c 100644 --- a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp +++ b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/vespalib/src/tests/stringfmt/fmt.cpp b/vespalib/src/tests/stringfmt/fmt.cpp index a89b2c06d420..cef349439785 100644 --- a/vespalib/src/tests/stringfmt/fmt.cpp +++ b/vespalib/src/tests/stringfmt/fmt.cpp @@ -15,7 +15,7 @@ TEST("test that make_string formats as one can expect.") std::string foo = make_string("%d/%x", i, j); std::string bar = make_string("%d/%x", i, j).c_str(); - vespalib::string tst("7/666"); + std::string tst("7/666"); EXPECT_TRUE(tst == foo); EXPECT_TRUE(tst == bar); @@ -41,7 +41,7 @@ TEST("test that make_string formats as one can expect.") } TEST("require that short form make string can be used") { - EXPECT_EQUAL(fmt("format: %d", 123), vespalib::string("format: 123")); + EXPECT_EQUAL(fmt("format: %d", 123), std::string("format: 123")); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/vespalib/src/tests/testapp-debug/debugtest.cpp b/vespalib/src/tests/testapp-debug/debugtest.cpp index c6fc131ea10e..370c59937641 100644 --- a/vespalib/src/tests/testapp-debug/debugtest.cpp +++ b/vespalib/src/tests/testapp-debug/debugtest.cpp @@ -5,25 +5,25 @@ using namespace vespalib; void testDebug() { TEST_DEBUG("lhs.out", "rhs.out"); - EXPECT_EQUAL(string("a\n" - "b\n" - "c\n"), + EXPECT_EQUAL(std::string("a\n" + "b\n" + "c\n"), - string("a\n" - "b\n" - "c\n" - "d\n")); - EXPECT_EQUAL(string("a\n" - "d\n" - "b\n" - "c\n"), + std::string("a\n" + "b\n" + "c\n" + "d\n")); + EXPECT_EQUAL(std::string("a\n" + "d\n" + "b\n" + "c\n"), - string("a\n" - "b\n" - "c\n" - "d\n")); + std::string("a\n" + "b\n" + "c\n" + "d\n")); EXPECT_EQUAL(1, 2); - EXPECT_EQUAL(string("foo"), string("bar")); + EXPECT_EQUAL(std::string("foo"), std::string("bar")); } TEST_MAIN() { diff --git a/vespalib/src/tests/text/stringtokenizer/stringtokenizer_test.cpp b/vespalib/src/tests/text/stringtokenizer/stringtokenizer_test.cpp index 75415f7093b2..54a1bbd27eaa 100644 --- a/vespalib/src/tests/text/stringtokenizer/stringtokenizer_test.cpp +++ b/vespalib/src/tests/text/stringtokenizer/stringtokenizer_test.cpp @@ -9,9 +9,9 @@ using namespace vespalib; TEST("stringtokenizer_test") { { - string s("This,is ,a,,list ,\tof,,sepa rated\n, \rtokens,"); + std::string s("This,is ,a,,list ,\tof,,sepa rated\n, \rtokens,"); StringTokenizer tokenizer(s); - std::vector result; + std::vector result; result.push_back("This"); result.push_back("is"); result.push_back("a"); @@ -27,16 +27,16 @@ TEST("stringtokenizer_test") { static_cast(tokenizer.size())); for (unsigned int i=0; i sorted(tokenizer.begin(), tokenizer.end()); + std::set sorted(tokenizer.begin(), tokenizer.end()); EXPECT_EQUAL(static_cast(8u), sorted.size()); tokenizer.removeEmptyTokens(); EXPECT_EQUAL(7u, tokenizer.size()); } { - string s("\tAnother list with some \ntokens, and stuff."); + std::string s("\tAnother list with some \ntokens, and stuff."); StringTokenizer tokenizer(s, " \t\n", ",."); - std::vector result; + std::vector result; result.push_back(""); result.push_back("Another"); result.push_back("list"); @@ -51,14 +51,14 @@ TEST("stringtokenizer_test") { static_cast(tokenizer.size())); for (unsigned int i=0; i sorted(tokenizer.begin(), tokenizer.end()); + std::set sorted(tokenizer.begin(), tokenizer.end()); EXPECT_EQUAL(static_cast(8u), sorted.size()); tokenizer.removeEmptyTokens(); EXPECT_EQUAL(7u, tokenizer.size()); } { - string s(" "); + std::string s(" "); StringTokenizer tokenizer(s); EXPECT_EQUAL(0u, tokenizer.size()); } diff --git a/vespalib/src/tests/text/utf8/make_url.cpp b/vespalib/src/tests/text/utf8/make_url.cpp index 4a5b8b7b1fd9..7c871596e35f 100644 --- a/vespalib/src/tests/text/utf8/make_url.cpp +++ b/vespalib/src/tests/text/utf8/make_url.cpp @@ -3,7 +3,7 @@ void printCodepoint(unsigned long codepoint) { - vespalib::string data; + std::string data; vespalib::Utf8Writer w(data); w.putChar(codepoint); printf("URL encoding of codepoint U+%04lX entity &#%lu; string value '%s' is:\n", diff --git a/vespalib/src/tests/text/utf8/utf8_test.cpp b/vespalib/src/tests/text/utf8/utf8_test.cpp index c3888986943b..55fe291f9d94 100644 --- a/vespalib/src/tests/text/utf8/utf8_test.cpp +++ b/vespalib/src/tests/text/utf8/utf8_test.cpp @@ -17,7 +17,7 @@ using namespace vespalib; TEST("utf8_test") { for (uint32_t h = 0; h < 0x1100; h++) { - vespalib::string data; + std::string data; if (h >= 0xD8 && h < 0xE0) continue; @@ -57,7 +57,7 @@ TEST("utf8_test") { ASSERT_TRUE(fd > 0); auto buf = std::make_unique(5510); ASSERT_TRUE(::read(fd, buf.get(), 5510) == 5509); - vespalib::string data(buf.get(), 5509); + std::string data(buf.get(), 5509); Utf8Reader r(data); uint32_t i = 32; uint32_t j = 3; diff --git a/vespalib/src/tests/trace/trace.cpp b/vespalib/src/tests/trace/trace.cpp index 5dce0e5cc6ba..5aff4ab4ec8b 100644 --- a/vespalib/src/tests/trace/trace.cpp +++ b/vespalib/src/tests/trace/trace.cpp @@ -24,7 +24,7 @@ TEST("testEncodeDecode") EXPECT_TRUE(TraceNode::decode("").isEmpty()); EXPECT_TRUE(!TraceNode::decode("([note])").isEmpty()); - string str = + std::string str = "([[17/Jun/2009:09:02:30 +0200\\] Message (type 1) received at 'dst' for session 'session'.]" "[[17/Jun/2009:09:02:30 +0200\\] [APP_TRANSIENT_ERROR @ localhost\\]: err1]" "[[17/Jun/2009:09:02:30 +0200\\] Sending reply (version 4.2) from 'dst'.])"; @@ -263,8 +263,8 @@ TEST("testTraceDump") for (int i = 0; i < 10; ++i) { big.addChild(TraceNode(b1)); } - string normal = big.toString(); - string full = big.toString(100000); + std::string normal = big.toString(); + std::string full = big.toString(100000); EXPECT_GREATER(normal.size(), 30000u); EXPECT_LESS(normal.size(), 32000u); EXPECT_GREATER(full.size(), 50000u); @@ -277,17 +277,17 @@ TEST("testTraceDump") s2.addChild("test"); s1.addChild(s2); s1.addChild(s2); - EXPECT_EQUAL(vespalib::string("...\n"), s1.toString(0)); - EXPECT_EQUAL(vespalib::string("\n...\n"), s1.toString(1)); - EXPECT_EQUAL(vespalib::string("\n" // 8 8 + EXPECT_EQUAL(std::string("...\n"), s1.toString(0)); + EXPECT_EQUAL(std::string("\n...\n"), s1.toString(1)); + EXPECT_EQUAL(std::string("\n" // 8 8 " \n" // 12 20 " test\n" // 13 33 "...\n"), s1.toString(33)); - EXPECT_EQUAL(vespalib::string("\n" // 8 8 + EXPECT_EQUAL(std::string("\n" // 8 8 " test\n" // 9 17 " test\n" // 9 26 "...\n"), s2.toString(26)); - EXPECT_EQUAL(vespalib::string("\n" // 8 8 + EXPECT_EQUAL(std::string("\n" // 8 8 " test\n" // 9 17 " test\n" // 9 26 "\n"), s2.toString(27)); @@ -297,7 +297,7 @@ TEST("testTraceDump") struct EncoderVisitor : public TraceVisitor { - vespalib::string str; + std::string str; void entering(const TraceNode & traceNode) override { (void) traceNode; str += "("; diff --git a/vespalib/src/tests/tutorial/make_tutorial.cpp b/vespalib/src/tests/tutorial/make_tutorial.cpp index ff48fd5920d3..c01c66458796 100644 --- a/vespalib/src/tests/tutorial/make_tutorial.cpp +++ b/vespalib/src/tests/tutorial/make_tutorial.cpp @@ -10,48 +10,48 @@ using namespace vespalib; -vespalib::string readFile(const vespalib::string &filename) { +std::string readFile(const std::string &filename) { TEST_STATE(filename.c_str()); MappedFileInput file(filename); ASSERT_TRUE(file.valid()); Memory data = file.get(); - return vespalib::string(data.data, data.size); + return std::string(data.data, data.size); } -vespalib::string runCommand(const vespalib::string &cmd) { - vespalib::string out; +std::string runCommand(const std::string &cmd) { + std::string out; ASSERT_TRUE(Process::run(cmd, out)); return out; } -void insertExample(const vespalib::string &name, const vespalib::string &src_dir) { - vespalib::string str = runCommand(make_string("%s/make_example.sh %s", src_dir.c_str(), +void insertExample(const std::string &name, const std::string &src_dir) { + std::string str = runCommand(make_string("%s/make_example.sh %s", src_dir.c_str(), name.c_str())); fprintf(stdout, "%s", str.c_str()); } -void insertSource(const vespalib::string &name, const vespalib::string &src_dir) { - vespalib::string str = runCommand(make_string("%s/make_source.sh %s", src_dir.c_str(), +void insertSource(const std::string &name, const std::string &src_dir) { + std::string str = runCommand(make_string("%s/make_source.sh %s", src_dir.c_str(), name.c_str())); fprintf(stdout, "%s", str.c_str()); } -void insertFile(const vespalib::string &name, const vespalib::string &src_dir) { - vespalib::string str = readFile(src_dir + "/" + name); +void insertFile(const std::string &name, const std::string &src_dir) { + std::string str = readFile(src_dir + "/" + name); fprintf(stdout, "%s", str.c_str()); } TEST_MAIN() { - vespalib::string pre("[insert:"); - vespalib::string example("example:"); - vespalib::string source("source:"); - vespalib::string file("file:"); - vespalib::string post("]\n"); + std::string pre("[insert:"); + std::string example("example:"); + std::string source("source:"); + std::string file("file:"); + std::string post("]\n"); size_t pos = 0; size_t end = 0; size_t cursor = 0; - vespalib::string input = readFile(TEST_PATH("tutorial_source.html")); + std::string input = readFile(TEST_PATH("tutorial_source.html")); while ((pos = input.find(pre, cursor)) < input.size() && (end = input.find(post, pos)) < input.size()) { @@ -59,15 +59,15 @@ TEST_MAIN() { pos += pre.size(); if (input.find(example, pos) == pos) { pos += example.size(); - insertExample(vespalib::string((input.data() + pos), (end - pos)), TEST_PATH("")); + insertExample(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else if (input.find(source, pos) == pos) { pos += source.size(); - insertSource(vespalib::string((input.data() + pos), (end - pos)), TEST_PATH("")); + insertSource(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else if (input.find(file, pos) == pos) { pos += file.size(); - insertFile(vespalib::string((input.data() + pos), (end - pos)), TEST_PATH("")); + insertFile(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else { - vespalib::string str((input.data() + pos), (end - pos)); + std::string str((input.data() + pos), (end - pos)); TEST_FATAL(make_string("invalid directive >%s<", str.c_str()).c_str()); } cursor = end + post.size(); diff --git a/vespalib/src/tests/util/cgroup_resource_limits_test.cpp b/vespalib/src/tests/util/cgroup_resource_limits_test.cpp index 2528c56d2115..8ade4af7f420 100644 --- a/vespalib/src/tests/util/cgroup_resource_limits_test.cpp +++ b/vespalib/src/tests/util/cgroup_resource_limits_test.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp index 785b7e1bb46c..fe90b1136207 100644 --- a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp +++ b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp @@ -19,7 +19,7 @@ using vespalib::ThreadStackExecutor; namespace { bool smoke_test = false; -const vespalib::string smoke_test_option = "--smoke-test"; +const std::string smoke_test_option = "--smoke-test"; } diff --git a/vespalib/src/tests/util/issue_test.cpp b/vespalib/src/tests/util/issue_test.cpp index f2a3622156c4..19df24e2d2f2 100644 --- a/vespalib/src/tests/util/issue_test.cpp +++ b/vespalib/src/tests/util/issue_test.cpp @@ -6,19 +6,19 @@ using namespace vespalib; struct MyHandler : Issue::Handler { - std::vector list; + std::vector list; void handle(const Issue &issue) override { list.push_back(issue.message()); } }; struct MyException : std::exception { - vespalib::string my_what; - MyException(vespalib::string what_in) : my_what(what_in) {} + std::string my_what; + MyException(std::string what_in) : my_what(what_in) {} const char *what() const noexcept override { return my_what.c_str(); } }; -std::vector make_list(std::vector list) { +std::vector make_list(std::vector list) { return list; } @@ -74,7 +74,7 @@ TEST(IssueTest, handler_can_be_bound_multiple_times) { TEST(IssueTest, alternative_report_functions) { MyHandler my_handler; auto capture = Issue::listen(my_handler); - Issue::report(vespalib::string("str")); + Issue::report(std::string("str")); Issue::report("fmt_%s_%d", "msg", 7); try { throw MyException("exception"); diff --git a/vespalib/src/tests/util/md5/md5_test.cpp b/vespalib/src/tests/util/md5/md5_test.cpp index a1b0c1ce3118..13685cc1333a 100644 --- a/vespalib/src/tests/util/md5/md5_test.cpp +++ b/vespalib/src/tests/util/md5/md5_test.cpp @@ -1,12 +1,12 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include -#include #include +#include namespace vespalib { -string md5_hash_of(std::string_view buffer) { +std::string md5_hash_of(std::string_view buffer) { unsigned char hash_out[16]; // Always 128 bits. fastc_md5sum(buffer.data(), buffer.size(), hash_out); asciistream os; @@ -22,7 +22,7 @@ TEST("MD5 output matches NIST test vectors") { EXPECT_EQUAL("900150983cd24fb0d6963f7d28e17f72", md5_hash_of("abc")); EXPECT_EQUAL("8215ef0796a20bcaaae116d3876c664a", md5_hash_of("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")); - EXPECT_EQUAL("7707d6ae4e027c70eea2a935c2296f21", md5_hash_of(string(1'000'000, 'a'))); + EXPECT_EQUAL("7707d6ae4e027c70eea2a935c2296f21", md5_hash_of(std::string(1'000'000, 'a'))); } // https://en.wikipedia.org/wiki/MD5#MD5_hashes diff --git a/vespalib/src/tests/util/mmap_file_allocator_factory_test.cpp b/vespalib/src/tests/util/mmap_file_allocator_factory_test.cpp index 394ecd2df274..3a505141824d 100644 --- a/vespalib/src/tests/util/mmap_file_allocator_factory_test.cpp +++ b/vespalib/src/tests/util/mmap_file_allocator_factory_test.cpp @@ -12,7 +12,7 @@ using vespalib::alloc::MmapFileAllocatorFactory; namespace { -vespalib::string basedir("mmap-file-allocator-factory-dir"); +std::string basedir("mmap-file-allocator-factory-dir"); bool is_mmap_file_allocator(const MemoryAllocator *allocator) { @@ -35,8 +35,8 @@ TEST(MmapFileAllocatorFactoryTest, nonempty_dir_gives_allocator) auto allocator1 = MmapFileAllocatorFactory::instance().make_memory_allocator("bar"); EXPECT_TRUE(is_mmap_file_allocator(allocator0.get())); EXPECT_TRUE(is_mmap_file_allocator(allocator1.get())); - vespalib::string allocator0_dir(basedir + "/0.foo"); - vespalib::string allocator1_dir(basedir + "/1.bar"); + std::string allocator0_dir(basedir + "/0.foo"); + std::string allocator1_dir(basedir + "/1.bar"); EXPECT_TRUE(std::filesystem::is_directory(std::filesystem::path(allocator0_dir))); EXPECT_TRUE(std::filesystem::is_directory(std::filesystem::path(allocator1_dir))); allocator0.reset(); diff --git a/vespalib/src/tests/util/mmap_file_allocator_test.cpp b/vespalib/src/tests/util/mmap_file_allocator_test.cpp index e986c9766433..77f4942caf2a 100644 --- a/vespalib/src/tests/util/mmap_file_allocator_test.cpp +++ b/vespalib/src/tests/util/mmap_file_allocator_test.cpp @@ -10,9 +10,9 @@ using vespalib::alloc::PtrAndSize; namespace { -vespalib::string basedir("mmap-file-allocator-dir"); -vespalib::string hello("hello"); -vespalib::string world("world"); +std::string basedir("mmap-file-allocator-dir"); +std::string hello("hello"); +std::string world("world"); struct MyAlloc { diff --git a/vespalib/src/tests/util/static_string_test.cpp b/vespalib/src/tests/util/static_string_test.cpp index e5d9356e4dcd..4f60a58f1b2e 100644 --- a/vespalib/src/tests/util/static_string_test.cpp +++ b/vespalib/src/tests/util/static_string_test.cpp @@ -8,7 +8,7 @@ using namespace vespalib::literals; TEST(StaticStringViewTest, simple_usage) { auto value = "foo bar"_ssv; - vespalib::string expect("foo bar"); + std::string expect("foo bar"); std::string expect_std("foo bar"); static_assert(std::same_as); auto a_ref = value.ref(); diff --git a/vespalib/src/tests/visit_ranges/visit_ranges_test.cpp b/vespalib/src/tests/visit_ranges/visit_ranges_test.cpp index 1be418780e6b..5535ae1a7060 100644 --- a/vespalib/src/tests/visit_ranges/visit_ranges_test.cpp +++ b/vespalib/src/tests/visit_ranges/visit_ranges_test.cpp @@ -3,8 +3,8 @@ #include #include #include -#include #include +#include using namespace vespalib; diff --git a/vespalib/src/vespa/vespalib/btree/btree.h b/vespalib/src/vespa/vespalib/btree/btree.h index 224b1899f699..c3cd8b945248 100644 --- a/vespalib/src/vespa/vespalib/btree/btree.h +++ b/vespalib/src/vespa/vespalib/btree/btree.h @@ -73,7 +73,7 @@ class BTree Iterator begin() const { return _tree.begin(_alloc); } FrozenView getFrozenView() const { return _tree.getFrozenView(_alloc); } size_t size() const { return _tree.size(_alloc); } - vespalib::string toString() const { return _tree.toString(_alloc); } + std::string toString() const { return _tree.toString(_alloc); } bool isValid(CompareT comp = CompareT()) const { return _tree.isValid(_alloc, comp); } bool isValidFrozen(CompareT comp = CompareT()) const { return _tree.isValidFrozen(_alloc, comp); } size_t bitSize() const { return _tree.bitSize(_alloc); } diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h index 02d6d7f69693..ef6c045c0ee5 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h +++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h @@ -4,10 +4,10 @@ #include "btreenode.h" #include "btreenodestore.h" -#include #include #include #include +#include #include namespace vespalib::btree { @@ -158,8 +158,8 @@ class BTreeNodeAllocator vespalib::MemoryUsage getMemoryUsage() const noexcept; - vespalib::string toString(BTreeNode::Ref ref) const; - vespalib::string toString(const BTreeNode * node) const; + std::string toString(BTreeNode::Ref ref) const; + std::string toString(const BTreeNode * node) const; bool getCompacting(EntryRef ref) noexcept { return _nodeStore.getCompacting(ref); } diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp index 0de5fa83728e..fc3c6139cbc1 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp +++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp @@ -373,7 +373,7 @@ getMemoryUsage() const noexcept template -vespalib::string +std::string BTreeNodeAllocator:: toString(BTreeNode::Ref ref) const { @@ -388,7 +388,7 @@ toString(BTreeNode::Ref ref) const template -vespalib::string +std::string BTreeNodeAllocator:: toString(const BTreeNode * node) const { diff --git a/vespalib/src/vespa/vespalib/btree/btreeroot.h b/vespalib/src/vespa/vespalib/btree/btreeroot.h index b9decedbb248..26c968da5a09 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeroot.h +++ b/vespalib/src/vespa/vespalib/btree/btreeroot.h @@ -49,7 +49,7 @@ class BTreeRootT : public BTreeRootBase -vespalib::string +std::string BTreeRootT:: toString(BTreeNode::Ref node, const NodeAllocatorType &allocator) const @@ -267,7 +267,7 @@ frozenSize(const NodeAllocatorType &allocator) const template -vespalib::string +std::string BTreeRootT:: toString(const NodeAllocatorType &allocator) const { diff --git a/vespalib/src/vespa/vespalib/component/version.h b/vespalib/src/vespa/vespalib/component/version.h index 78dd01819af7..1eef9ab408d6 100644 --- a/vespalib/src/vespa/vespalib/component/version.h +++ b/vespalib/src/vespa/vespalib/component/version.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { @@ -27,7 +27,7 @@ namespace vespalib { class Version { public: - using string = vespalib::string; + using string = std::string; private: int _major; int _minor; diff --git a/vespalib/src/vespa/vespalib/component/vtag.cpp b/vespalib/src/vespa/vespalib/component/vtag.cpp index 553d3ced18a0..97081c7cb7f0 100644 --- a/vespalib/src/vespa/vespalib/component/vtag.cpp +++ b/vespalib/src/vespa/vespalib/component/vtag.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "vtag.h" #include +#include #ifndef V_TAG #define V_TAG "NOTAG" diff --git a/vespalib/src/vespa/vespalib/coro/async_io.h b/vespalib/src/vespa/vespalib/coro/async_io.h index bc4f63fce322..e00a84d49780 100644 --- a/vespalib/src/vespa/vespalib/coro/async_io.h +++ b/vespalib/src/vespa/vespalib/coro/async_io.h @@ -4,10 +4,10 @@ #include "lazy.h" -#include -#include #include #include +#include +#include namespace vespalib::coro { diff --git a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.cpp b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.cpp index c3f4cc6bedaf..59d2857e6955 100644 --- a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.cpp +++ b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.cpp @@ -42,10 +42,10 @@ struct X509ExtensionDeleter { using X509ExtensionPtr = std::unique_ptr<::X509_EXTENSION, X509ExtensionDeleter>; -vespalib::string bio_to_string(BIO& bio) { +std::string bio_to_string(BIO& bio) { int written = BIO_pending(&bio); assert(written >= 0); - vespalib::string pem_str(written, '\0'); + std::string pem_str(written, '\0'); if (::BIO_read(&bio, &pem_str[0], written) != written) { throw CryptoException("BIO_read did not copy all PEM data"); } @@ -62,7 +62,7 @@ BioPtr new_memory_bio() { } // anonymous namespace -vespalib::string +std::string PrivateKeyImpl::private_to_pem() const { BioPtr bio = new_memory_bio(); // TODO this API is const-broken even on 1.1.1, revisit in the future... @@ -205,7 +205,7 @@ assign_subject_distinguished_name(::X509_NAME& name, const X509Certificate::Dist // and who knows what terrible things it might do to it (we must also ensure null // termination of the string). void -add_v3_ext(::X509& subject, ::X509& issuer, int nid, vespalib::string value) { +add_v3_ext(::X509& subject, ::X509& issuer, int nid, std::string value) { // We are now reaching a point where the API we need to use is not properly documented. // This functionality is inferred from https://opensource.apple.com/source/OpenSSL/OpenSSL-22/openssl/demos/x509/mkcert.c ::X509V3_CTX ctx; @@ -226,10 +226,10 @@ add_v3_ext(::X509& subject, ::X509& issuer, int nid, vespalib::string value) { void add_any_subject_alternate_names(::X509& subject, ::X509& issuer, - const std::vector& sans) { + const std::vector& sans) { // There can only be 1 SAN entry in a valid cert, but it can have multiple // logical entries separated by commas in a single string. - vespalib::string san_csv; + std::string san_csv; for (auto& san : sans) { if (!san_csv.empty()) { san_csv += ','; @@ -300,7 +300,7 @@ X509CertificateImpl::generate_openssl_x509_from(Params params) { return std::make_shared(std::move(cert)); } -vespalib::string +std::string X509CertificateImpl::to_pem() const { BioPtr bio = new_memory_bio(); // TODO this API is const-broken, revisit in the future... diff --git a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h index 200540a1d7fb..0e454c7f5d25 100644 --- a/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h +++ b/vespalib/src/vespa/vespalib/crypto/openssl_crypto_impl.h @@ -21,7 +21,7 @@ class PrivateKeyImpl : public PrivateKey { const ::EVP_PKEY* native_key() const noexcept { return _pkey.get(); } Type type() const noexcept override { return _type; } - vespalib::string private_to_pem() const override; + std::string private_to_pem() const override; static std::shared_ptr generate_openssl_p256_ec_key(); }; @@ -35,7 +35,7 @@ class X509CertificateImpl : public X509Certificate { ::X509* native_cert() noexcept { return _cert.get(); } const ::X509* native_cert() const noexcept { return _cert.get(); } - vespalib::string to_pem() const override; + std::string to_pem() const override; // Generates an X509 certificate using a SHA-256 digest static std::shared_ptr generate_openssl_x509_from(Params params); diff --git a/vespalib/src/vespa/vespalib/crypto/private_key.h b/vespalib/src/vespa/vespalib/crypto/private_key.h index 6502f905e921..bec62d02bb06 100644 --- a/vespalib/src/vespa/vespalib/crypto/private_key.h +++ b/vespalib/src/vespa/vespalib/crypto/private_key.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include namespace vespalib::crypto { @@ -24,7 +24,7 @@ class PrivateKey { virtual Type type() const noexcept = 0; // TODO should have a wrapper for this that takes care to securely erase // string memory on destruction. - virtual vespalib::string private_to_pem() const = 0; + virtual std::string private_to_pem() const = 0; static std::shared_ptr generate_p256_ec_key(); protected: diff --git a/vespalib/src/vespa/vespalib/crypto/x509_certificate.h b/vespalib/src/vespa/vespalib/crypto/x509_certificate.h index abb13dcd385f..f6e1512ddfb7 100644 --- a/vespalib/src/vespa/vespalib/crypto/x509_certificate.h +++ b/vespalib/src/vespa/vespalib/crypto/x509_certificate.h @@ -2,9 +2,9 @@ #pragma once #include "private_key.h" -#include #include #include +#include #include namespace vespalib::crypto { @@ -26,17 +26,17 @@ class X509Certificate { public: virtual ~X509Certificate() = default; - virtual vespalib::string to_pem() const = 0; + virtual std::string to_pem() const = 0; struct DistinguishedName { - vespalib::string _country; // "C" - vespalib::string _state; // "ST" - vespalib::string _locality; // "L" - vespalib::string _organization; // "O" - vespalib::string _organizational_unit; // "OU" + std::string _country; // "C" + std::string _state; // "ST" + std::string _locality; // "L" + std::string _organization; // "O" + std::string _organizational_unit; // "OU" // Should only be 1 entry in normal certs, but X509 supports more and // we want to be able to test this edge case. - std::vector _common_names; // "CN" + std::vector _common_names; // "CN" DistinguishedName() noexcept; DistinguishedName(const DistinguishedName&); @@ -62,7 +62,7 @@ class X509Certificate { struct SubjectInfo { DistinguishedName dn; - std::vector subject_alt_names; + std::vector subject_alt_names; SubjectInfo() noexcept; explicit SubjectInfo(DistinguishedName dn_) noexcept; @@ -72,7 +72,7 @@ class X509Certificate { SubjectInfo & operator=(SubjectInfo &&) noexcept; ~SubjectInfo(); - SubjectInfo& add_subject_alt_name(vespalib::string san) { + SubjectInfo& add_subject_alt_name(std::string san) { subject_alt_names.emplace_back(std::move(san)); return *this; } diff --git a/vespalib/src/vespa/vespalib/data/fileheader.cpp b/vespalib/src/vespa/vespalib/data/fileheader.cpp index a989264868c2..ba0fb0f6a42f 100644 --- a/vespalib/src/vespa/vespalib/data/fileheader.cpp +++ b/vespalib/src/vespa/vespalib/data/fileheader.cpp @@ -28,7 +28,7 @@ GenericHeader::Tag::Tag() _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, float val) +GenericHeader::Tag::Tag(const std::string &name, float val) : _type(TYPE_FLOAT), _name(name), _fVal(val), @@ -36,7 +36,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, float val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, double val) +GenericHeader::Tag::Tag(const std::string &name, double val) : _type(TYPE_FLOAT), _name(name), _fVal(val), @@ -44,7 +44,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, double val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, int8_t val) +GenericHeader::Tag::Tag(const std::string &name, int8_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -52,7 +52,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, int8_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, uint8_t val) +GenericHeader::Tag::Tag(const std::string &name, uint8_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -60,7 +60,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, uint8_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, int16_t val) +GenericHeader::Tag::Tag(const std::string &name, int16_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -68,7 +68,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, int16_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, uint16_t val) +GenericHeader::Tag::Tag(const std::string &name, uint16_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -76,7 +76,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, uint16_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, int32_t val) +GenericHeader::Tag::Tag(const std::string &name, int32_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -84,7 +84,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, int32_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, uint32_t val) +GenericHeader::Tag::Tag(const std::string &name, uint32_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -92,7 +92,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, uint32_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, int64_t val) +GenericHeader::Tag::Tag(const std::string &name, int64_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -100,7 +100,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, int64_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, uint64_t val) +GenericHeader::Tag::Tag(const std::string &name, uint64_t val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -108,7 +108,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, uint64_t val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, bool val) +GenericHeader::Tag::Tag(const std::string &name, bool val) : _type(TYPE_INTEGER), _name(name), _fVal(0), @@ -116,7 +116,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, bool val) _sVal() { } -GenericHeader::Tag::Tag(const vespalib::string &name, const char *val) +GenericHeader::Tag::Tag(const std::string &name, const char *val) : _type(TYPE_STRING), _name(name), _fVal(0), @@ -124,7 +124,7 @@ GenericHeader::Tag::Tag(const vespalib::string &name, const char *val) _sVal(val) { } -GenericHeader::Tag::Tag(const vespalib::string &name, const vespalib::string &val) +GenericHeader::Tag::Tag(const std::string &name, const std::string &val) : _type(TYPE_STRING), _name(name), _fVal(0), @@ -154,7 +154,7 @@ size_t GenericHeader::Tag::read(DataBuffer &buf) { char *pos = buf.getData(); - vespalib::string name(pos); + std::string name(pos); buf.moveDataToDead(name.size() + 1); uint8_t type = buf.readInt8(); switch (type) { @@ -165,7 +165,7 @@ GenericHeader::Tag::read(DataBuffer &buf) _iVal = buf.readInt64(); break; case TYPE_STRING: - _sVal = vespalib::string(buf.getData()); + _sVal = std::string(buf.getData()); buf.moveDataToDead(_sVal.size() + 1); break; default: @@ -256,7 +256,7 @@ GenericHeader::getTag(size_t idx) const } const GenericHeader::Tag & -GenericHeader::getTag(const vespalib::string &key) const +GenericHeader::getTag(const std::string &key) const { auto it = _tags.find(key); if (it == _tags.end()) { @@ -266,7 +266,7 @@ GenericHeader::getTag(const vespalib::string &key) const } bool -GenericHeader::hasTag(const vespalib::string &key) const +GenericHeader::hasTag(const std::string &key) const { return _tags.find(key) != _tags.end(); } @@ -274,7 +274,7 @@ GenericHeader::hasTag(const vespalib::string &key) const bool GenericHeader::putTag(const GenericHeader::Tag &tag) { - const vespalib::string &key = tag.getName(); + const std::string &key = tag.getName(); auto it = _tags.find(key); if (it != _tags.end()) { it->second = tag; @@ -284,7 +284,7 @@ GenericHeader::putTag(const GenericHeader::Tag &tag) return true; } bool -GenericHeader::removeTag(const vespalib::string &key) +GenericHeader::removeTag(const std::string &key) { auto it = _tags.find(key); if (it == _tags.end()) { diff --git a/vespalib/src/vespa/vespalib/data/fileheader.h b/vespalib/src/vespa/vespalib/data/fileheader.h index 2f2e69f5fae4..a71d22215404 100644 --- a/vespalib/src/vespa/vespalib/data/fileheader.h +++ b/vespalib/src/vespa/vespalib/data/fileheader.h @@ -2,6 +2,7 @@ #pragma once #include +#include #include class FastOS_FileInterface; @@ -42,28 +43,28 @@ class GenericHeader { private: Type _type; - vespalib::string _name; + std::string _name; double _fVal; int64_t _iVal; - vespalib::string _sVal; + std::string _sVal; public: Tag(); Tag(const Tag &); Tag & operator=(const Tag &); - Tag(const vespalib::string &name, float val); - Tag(const vespalib::string &name, double val); - Tag(const vespalib::string &name, int8_t val); - Tag(const vespalib::string &name, uint8_t val); - Tag(const vespalib::string &name, int16_t val); - Tag(const vespalib::string &name, uint16_t val); - Tag(const vespalib::string &name, int32_t val); - Tag(const vespalib::string &name, uint32_t val); - Tag(const vespalib::string &name, int64_t val); - Tag(const vespalib::string &name, uint64_t val); - Tag(const vespalib::string &name, bool val); - Tag(const vespalib::string &name, const char *val); - Tag(const vespalib::string &name, const vespalib::string &val); + Tag(const std::string &name, float val); + Tag(const std::string &name, double val); + Tag(const std::string &name, int8_t val); + Tag(const std::string &name, uint8_t val); + Tag(const std::string &name, int16_t val); + Tag(const std::string &name, uint16_t val); + Tag(const std::string &name, int32_t val); + Tag(const std::string &name, uint32_t val); + Tag(const std::string &name, int64_t val); + Tag(const std::string &name, uint64_t val); + Tag(const std::string &name, bool val); + Tag(const std::string &name, const char *val); + Tag(const std::string &name, const std::string &val); ~Tag(); size_t read(DataBuffer &buf); @@ -72,11 +73,11 @@ class GenericHeader { bool isEmpty() const { return _type == TYPE_EMPTY; } Type getType() const { return _type; } - const vespalib::string &getName() const { return _name; } + const std::string &getName() const { return _name; } double asFloat() const { return _fVal; } int64_t asInteger() const { return _iVal; } - const vespalib::string &asString() const { return _sVal; } + const std::string &asString() const { return _sVal; } bool asBool() const { return _iVal != 0; } }; @@ -140,7 +141,7 @@ class GenericHeader { private: static const Tag EMPTY; - using TagMap = std::map; + using TagMap = std::map; TagMap _tags; public: @@ -171,7 +172,7 @@ class GenericHeader { * @param key The name of the tag to return. * @return A reference to the named tag. */ - const Tag &getTag(const vespalib::string &key) const; + const Tag &getTag(const std::string &key) const; /** * Returns whether or not there exists a tag with the given name. @@ -179,7 +180,7 @@ class GenericHeader { * @param key The name of the tag to look for. * @return True if the named tag exists. */ - bool hasTag(const vespalib::string &key) const; + bool hasTag(const std::string &key) const; /** * Adds the given tag to this header. If a tag already exists with the given name, this method replaces @@ -196,7 +197,7 @@ class GenericHeader { * @param key The name of the tag to remove. * @return True if a tag was removed. */ - bool removeTag(const vespalib::string &key); + bool removeTag(const std::string &key); /** * Returns whether or not this header contains any data. The current implementation only checks for tags, diff --git a/vespalib/src/vespa/vespalib/data/input_reader.cpp b/vespalib/src/vespa/vespalib/data/input_reader.cpp index a22801168721..b0c2a1476c37 100644 --- a/vespalib/src/vespa/vespalib/data/input_reader.cpp +++ b/vespalib/src/vespa/vespalib/data/input_reader.cpp @@ -50,7 +50,7 @@ InputReader::~InputReader() } void -InputReader::fail(const vespalib::string &msg) { +InputReader::fail(const std::string &msg) { if (!failed()) { _error = msg; _input.evict(_pos); diff --git a/vespalib/src/vespa/vespalib/data/input_reader.h b/vespalib/src/vespa/vespalib/data/input_reader.h index 481040d5763e..b32ccd157af2 100644 --- a/vespalib/src/vespa/vespalib/data/input_reader.h +++ b/vespalib/src/vespa/vespalib/data/input_reader.h @@ -3,7 +3,7 @@ #pragma once #include "memory.h" -#include +#include #include namespace vespalib { @@ -24,7 +24,7 @@ class InputReader size_t _pos; size_t _bytes_evicted; bool _eof; - vespalib::string _error; + std::string _error; std::vector _space; const char *data() const { return (_data.data + _pos); } @@ -40,10 +40,10 @@ class InputReader ~InputReader(); bool failed() const { return !_error.empty(); } - const vespalib::string &get_error_message() const { return _error; } + const std::string &get_error_message() const { return _error; } size_t get_offset() const { return (_bytes_evicted + _pos); } - void fail(const vespalib::string &msg); + void fail(const std::string &msg); /** * Make sure we have more input data available. diff --git a/vespalib/src/vespa/vespalib/data/lz4_input_decoder.h b/vespalib/src/vespa/vespalib/data/lz4_input_decoder.h index 114813a2845f..0e807550a2da 100644 --- a/vespalib/src/vespa/vespalib/data/lz4_input_decoder.h +++ b/vespalib/src/vespa/vespalib/data/lz4_input_decoder.h @@ -21,7 +21,7 @@ class Lz4InputDecoder : public Input size_t _pos; bool _eof; bool _failed; - vespalib::string _reason; + std::string _reason; LZ4F_dctx_s *_ctx; void fail(const char *reason); @@ -32,7 +32,7 @@ class Lz4InputDecoder : public Input Memory obtain() override; Input &evict(size_t bytes) override; bool failed() const { return _failed; } - const vespalib::string &reason() const { return _reason; } + const std::string &reason() const { return _reason; } }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/data/memory.cpp b/vespalib/src/vespa/vespalib/data/memory.cpp index fe9d3e97638d..7084fcb05f1c 100644 --- a/vespalib/src/vespa/vespalib/data/memory.cpp +++ b/vespalib/src/vespa/vespalib/data/memory.cpp @@ -5,10 +5,10 @@ namespace vespalib { -vespalib::string +std::string Memory::make_string() const { - return vespalib::string(data, size); + return std::string(data, size); } std::ostream & diff --git a/vespalib/src/vespa/vespalib/data/memory.h b/vespalib/src/vespa/vespalib/data/memory.h index 4b3bb7672d36..3f0bac7e9f21 100644 --- a/vespalib/src/vespa/vespalib/data/memory.h +++ b/vespalib/src/vespa/vespalib/data/memory.h @@ -2,8 +2,9 @@ #pragma once -#include +#include #include +#include namespace vespalib { @@ -18,11 +19,11 @@ struct Memory Memory() noexcept : data(nullptr), size(0) {} Memory(const char *d, size_t s) noexcept : data(d), size(s) {} Memory(const char *str) noexcept : data(str), size(strlen(str)) {} - Memory(const vespalib::string &str) noexcept + Memory(const std::string &str) noexcept : data(str.data()), size(str.size()) {} Memory(std::string_view str_ref) noexcept : data(str_ref.data()), size(str_ref.size()) {} - vespalib::string make_string() const; + std::string make_string() const; std::string_view make_stringview() const noexcept { return {data, size}; } bool operator == (const Memory &rhs) const noexcept { if (size != rhs.size) { diff --git a/vespalib/src/vespa/vespalib/data/slime/inspector.h b/vespalib/src/vespa/vespalib/data/slime/inspector.h index a683a9fe3e87..c5bf23631e7a 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inspector.h +++ b/vespalib/src/vespa/vespalib/data/slime/inspector.h @@ -31,7 +31,7 @@ struct Inspector { virtual void traverse(ObjectSymbolTraverser &ot) const = 0; virtual void traverse(ObjectTraverser &ot) const = 0; - virtual vespalib::string toString() const = 0; + virtual std::string toString() const = 0; virtual Inspector &operator[](size_t idx) const = 0; virtual Inspector &operator[](Symbol sym) const = 0; diff --git a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp index a5c7d31a046f..924e9dd25a70 100644 --- a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp @@ -202,8 +202,8 @@ JsonEncoder::field(const Memory &symbol_name, const Inspector &inspecto struct JsonDecoder { InputReader ∈ char c; - vespalib::string key; - vespalib::string value; + std::string key; + std::string value; JsonDecoder(InputReader &reader) : in(reader), c(in.read()), key(), value() {} @@ -241,7 +241,7 @@ struct JsonDecoder { uint32_t readHexValue(uint32_t len); uint32_t dequoteUtf16(); - void readString(vespalib::string &str); + void readString(std::string &str); void readKey(); void decodeString(Inserter &inserter); void decodeObject(Inserter &inserter); @@ -307,7 +307,7 @@ JsonDecoder::dequoteUtf16() return codepoint; } -void writeUtf8(uint32_t codepoint, vespalib::string &str, uint32_t mask = 0xffffff80) { +void writeUtf8(uint32_t codepoint, std::string &str, uint32_t mask = 0xffffff80) { if ((codepoint & mask) == 0) { str.push_back((mask << 1) | codepoint); } else { @@ -317,7 +317,7 @@ void writeUtf8(uint32_t codepoint, vespalib::string &str, uint32_t mask = 0xffff } void -JsonDecoder::readString(vespalib::string &str) +JsonDecoder::readString(std::string &str) { str.clear(); char quote = c; @@ -425,7 +425,7 @@ JsonDecoder::decodeArray(Inserter &inserter) } void JsonDecoder::decodeData(Inserter &inserter) { - vespalib::string data; + std::string data; value.clear(); for (;;) { next(); @@ -449,7 +449,7 @@ void JsonDecoder::decodeData(Inserter &inserter) { } } -static int insertNumber(Inserter &inserter, bool isLong, const vespalib::string &value, char **endp); +static int insertNumber(Inserter &inserter, bool isLong, const std::string &value, char **endp); void JsonDecoder::decodeNumber(Inserter &inserter) @@ -482,7 +482,7 @@ JsonDecoder::decodeNumber(Inserter &inserter) } int -insertNumber(Inserter &inserter, bool isLong, const vespalib::string & value, char **endp) +insertNumber(Inserter &inserter, bool isLong, const std::string & value, char **endp) { int errorCode = 0; errno = 0; diff --git a/vespalib/src/vespa/vespalib/data/slime/slime.h b/vespalib/src/vespa/vespalib/data/slime/slime.h index dd4fc82d29c5..3aebc9b07fc9 100644 --- a/vespalib/src/vespa/vespalib/data/slime/slime.h +++ b/vespalib/src/vespa/vespalib/data/slime/slime.h @@ -146,7 +146,7 @@ class Slime return *_root.wrap(*_names, symbol); } - vespalib::string toString() const { return get().toString(); } + std::string toString() const { return get().toString(); } }; bool operator == (const Slime & a, const Slime & b) noexcept; diff --git a/vespalib/src/vespa/vespalib/data/slime/value.cpp b/vespalib/src/vespa/vespalib/data/slime/value.cpp index 62226be04693..5a79874f2784 100644 --- a/vespalib/src/vespa/vespalib/data/slime/value.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/value.cpp @@ -72,7 +72,7 @@ void Value::traverse(ObjectTraverser &) const {} // generate string representation -vespalib::string +std::string Value::toString() const { SimpleBuffer buf; diff --git a/vespalib/src/vespa/vespalib/data/slime/value.h b/vespalib/src/vespa/vespalib/data/slime/value.h index 9d583568c41d..872273e82d64 100644 --- a/vespalib/src/vespa/vespalib/data/slime/value.h +++ b/vespalib/src/vespa/vespalib/data/slime/value.h @@ -44,7 +44,7 @@ class Value : public Cursor void traverse(ObjectSymbolTraverser &ot) const override; void traverse(ObjectTraverser &ot) const override; - vespalib::string toString() const override; + std::string toString() const override; Cursor &operator[](size_t idx) const override; Cursor &operator[](Symbol sym) const override; diff --git a/vespalib/src/vespa/vespalib/encoding/base64.h b/vespalib/src/vespa/vespalib/encoding/base64.h index 2aaff0ef44b7..e204a14505f2 100644 --- a/vespalib/src/vespa/vespalib/encoding/base64.h +++ b/vespalib/src/vespa/vespalib/encoding/base64.h @@ -10,8 +10,8 @@ #pragma once -#include #include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp index fbfa50aa57f6..d6dd18926009 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.cpp @@ -78,8 +78,8 @@ bool vespalib::FuzzyMatcher::isMatch(std::string_view target) const { _max_edit_distance, _is_prefix).has_value(); } -vespalib::string vespalib::FuzzyMatcher::getPrefix() const { - vespalib::string prefix; +std::string vespalib::FuzzyMatcher::getPrefix() const { + std::string prefix; Utf8Writer writer(prefix); for (const uint32_t& code: _folded_term_codepoints_prefix) { writer.putChar(code); diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h index eb6fe038c534..38953488c535 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matcher.h @@ -1,8 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include +#include #include namespace vespalib { @@ -39,7 +40,7 @@ class FuzzyMatcher { ~FuzzyMatcher(); [[nodiscard]] bool isMatch(std::string_view target) const; - [[nodiscard]] vespalib::string getPrefix() const; + [[nodiscard]] std::string getPrefix() const; static std::span get_prefix(const std::vector& termCodepoints, uint32_t prefixLength); static std::span get_suffix(const std::vector& termCodepoints, uint32_t prefixLength); diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.cpp b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.cpp index 9188397898e1..12ee0773c90e 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.cpp +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.cpp @@ -6,14 +6,14 @@ namespace vespalib { namespace { -const vespalib::string brute_force = "brute_force"; -const vespalib::string dfa_implicit = "dfa_implicit"; -const vespalib::string dfa_explicit = "dfa_explicit"; -const vespalib::string dfa_table = "dfa_table"; +const std::string brute_force = "brute_force"; +const std::string dfa_implicit = "dfa_implicit"; +const std::string dfa_explicit = "dfa_explicit"; +const std::string dfa_table = "dfa_table"; } -vespalib::string +std::string to_string(FuzzyMatchingAlgorithm algo) { switch (algo) { @@ -31,7 +31,7 @@ to_string(FuzzyMatchingAlgorithm algo) } FuzzyMatchingAlgorithm -fuzzy_matching_algorithm_from_string(const vespalib::string& algo, +fuzzy_matching_algorithm_from_string(const std::string& algo, FuzzyMatchingAlgorithm default_algo) { if (algo == brute_force) { diff --git a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.h b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.h index 7ab23dd880d6..853699a25580 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.h +++ b/vespalib/src/vespa/vespalib/fuzzy/fuzzy_matching_algorithm.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace vespalib { @@ -17,9 +17,9 @@ enum class FuzzyMatchingAlgorithm { DfaTable }; -vespalib::string to_string(FuzzyMatchingAlgorithm algo); +std::string to_string(FuzzyMatchingAlgorithm algo); -FuzzyMatchingAlgorithm fuzzy_matching_algorithm_from_string(const vespalib::string& algo, +FuzzyMatchingAlgorithm fuzzy_matching_algorithm_from_string(const std::string& algo, FuzzyMatchingAlgorithm default_algo); std::ostream& operator<<(std::ostream& out, FuzzyMatchingAlgorithm algo); diff --git a/vespalib/src/vespa/vespalib/fuzzy/table_dfa.hpp b/vespalib/src/vespa/vespalib/fuzzy/table_dfa.hpp index 721cfe296d22..5a1a014e6f31 100644 --- a/vespalib/src/vespa/vespalib/fuzzy/table_dfa.hpp +++ b/vespalib/src/vespa/vespalib/fuzzy/table_dfa.hpp @@ -71,7 +71,7 @@ struct Position { } } } - vespalib::string to_string() const { return fmt("%u#%u", index, edits); } + std::string to_string() const { return fmt("%u#%u", index, edits); } }; // A State is a collection of different Positions that do not subsume @@ -153,8 +153,8 @@ struct State { } return result; } - vespalib::string to_string() const { - vespalib::string result = "{"; + std::string to_string() const { + std::string result = "{"; for (size_t i = 0; i < list.size(); ++i) { if (i > 0) { result.append(","); @@ -275,8 +275,8 @@ std::unique_ptr> make_tfa() { } template -vespalib::string format_vector(const std::vector &vector, bool compact = false) { - vespalib::string str = compact ? "" : "["; +std::string format_vector(const std::vector &vector, bool compact = false) { + std::string str = compact ? "" : "["; for (size_t i = 0; i < vector.size(); ++i) { if (i > 0 && !compact) { str.append(","); diff --git a/vespalib/src/vespa/vespalib/gtest/gtest.h b/vespalib/src/vespa/vespalib/gtest/gtest.h index c32b9ecfe9da..86b30bd81f62 100644 --- a/vespalib/src/vespa/vespalib/gtest/gtest.h +++ b/vespalib/src/vespa/vespalib/gtest/gtest.h @@ -7,8 +7,8 @@ #include namespace vespalib { -// Tell google test how to print vespalib::string values: -static inline void PrintTo(const vespalib::string & value, std::ostream * os) { +// Tell google test how to print std::string values: +static inline void PrintTo(const std::string & value, std::ostream * os) { *os << value; } } diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp index 691e054ea053..d218142a99ca 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.cpp +++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp @@ -36,7 +36,7 @@ processStat(struct stat& filestats, bool result, std::string_view path) { throw IoException(ost.view(), IoException::getErrorType(errno), VESPA_STRLOC); } LOG(debug, "stat(%s): Existed? %s, Plain file? %s, Directory? %s, Size: %" PRIu64, - string(path).c_str(), + std::string(path).c_str(), resval.get() ? "true" : "false", resval.get() && resval->_plainfile ? "true" : "false", resval.get() && resval->_directory ? "true" : "false", @@ -44,7 +44,7 @@ processStat(struct stat& filestats, bool result, std::string_view path) { return resval; } -string +std::string safeStrerror(int errnum) { return getErrorString(errnum); @@ -63,15 +63,15 @@ File::~File() } namespace { -int openAndCreateDirsIfMissing(const string & filename, int flags, bool createDirsIfMissing) +int openAndCreateDirsIfMissing(const std::string & filename, int flags, bool createDirsIfMissing) { int fd = ::open(filename.c_str(), flags, 0644); if (fd < 0 && errno == ENOENT && ((flags & O_CREAT) != 0) && createDirsIfMissing) { auto pos = filename.rfind('/'); - if (pos != string::npos) { - string path(filename.substr(0, pos)); + if (pos != std::string::npos) { + std::string path(filename.substr(0, pos)); fs::create_directories(fs::path(path)); LOG(spam, "open(%s, %d): Retrying open after creating parent directories.", filename.c_str(), flags); fd = ::open(filename.c_str(), flags, 0644); @@ -194,10 +194,10 @@ File::read(void *buf, size_t bufsize, off_t offset) const return bufsize - remaining; } -vespalib::string +std::string File::readAll() const { - vespalib::string content; + std::string content; // Limit ourselves to 4K on the stack. If this becomes a problem we should // allocate on the heap. @@ -216,7 +216,7 @@ File::readAll() const } } -vespalib::string +std::string File::readAll(std::string_view path) { File file(path); @@ -276,20 +276,22 @@ File::unlink() } DirectoryList -listDirectory(const string & path) +listDirectory(const std::string & path) { DIR* dir = ::opendir(path.c_str()); struct dirent* entry; DirectoryList result; - if (dir) while ((entry = readdir(dir))) { - string name(reinterpret_cast(&entry->d_name)); - assert(!name.empty()); - if (name[0] == '.' && (name.size() == 1 - || (name.size() == 2 && name[1] == '.'))) - { - continue; // Ignore '.' and '..' files + if (dir) { + while ((entry = readdir(dir))) { + std::string name(reinterpret_cast(&entry->d_name)); + assert(!name.empty()); + if (name[0] == '.' && (name.size() == 1 + || (name.size() == 2 && name[1] == '.'))) + { + continue; // Ignore '.' and '..' files + } + result.push_back(name); } - result.push_back(name); } else { throw IoException("Failed to list directory '" + path + "'", IoException::getErrorType(errno), VESPA_STRLOC); @@ -298,15 +300,15 @@ listDirectory(const string & path) return result; } -string dirname(std::string_view name) +std::string dirname(std::string_view name) { size_t found = name.rfind('/'); - if (found == string::npos) { - return string("."); + if (found == std::string::npos) { + return std::string("."); } else if (found == 0) { - return string("/"); + return std::string("/"); } else { - return string(name.substr(0, found)); + return std::string(name.substr(0, found)); } } @@ -336,11 +338,11 @@ void addStat(asciistream &os, std::string_view name_view) } -string +std::string getOpenErrorString(const int osError, std::string_view filename) { asciistream os; - string dirName(dirname(filename)); + std::string dirName(dirname(filename)); os << "error=" << osError << "(\"" << getErrorString(osError) << "\") fileStat"; addStat(os, filename); os << " dirStat"; diff --git a/vespalib/src/vespa/vespalib/io/fileutil.h b/vespalib/src/vespa/vespalib/io/fileutil.h index a2735698cc0b..a32d9ccc2e8f 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.h +++ b/vespalib/src/vespa/vespalib/io/fileutil.h @@ -27,11 +27,11 @@ #pragma once +#include #include #include +#include #include -#include -#include namespace vespalib { @@ -58,7 +58,7 @@ struct FileInfo { class File { private: int _fd; - string _filename; + std::string _filename; void sync(); /** @@ -81,7 +81,7 @@ class File { /** Closes the file if not instructed to do otherwise. */ ~File(); - const string& getFilename() const { return _filename; } + const std::string& getFilename() const { return _filename; } void open(int flags, bool autoCreateDirectories = false); @@ -143,7 +143,7 @@ class File { * @throw IoException If we failed to read from file. * @return The content of the file. */ - string readAll() const; + std::string readAll() const; /** * Read a file into a string. @@ -154,7 +154,7 @@ class File { * @throw IoException If we failed to read from file. * @return The content of the file. */ - static string readAll(std::string_view path); + static std::string readAll(std::string_view path); /** * Sync file or directory. @@ -173,9 +173,9 @@ class File { /** * List the contents of the given directory. */ -using DirectoryList = std::vector; -extern DirectoryList listDirectory(const string & path); -string dirname(std::string_view name); -string getOpenErrorString(const int osError, std::string_view name); +using DirectoryList = std::vector; +extern DirectoryList listDirectory(const std::string & path); +std::string dirname(std::string_view name); +std::string getOpenErrorString(const int osError, std::string_view name); } // vespalib diff --git a/vespalib/src/vespa/vespalib/io/mapped_file_input.cpp b/vespalib/src/vespa/vespalib/io/mapped_file_input.cpp index 3ec08c449743..4fe8b33ce7ec 100644 --- a/vespalib/src/vespa/vespalib/io/mapped_file_input.cpp +++ b/vespalib/src/vespa/vespalib/io/mapped_file_input.cpp @@ -8,7 +8,7 @@ namespace vespalib { -MappedFileInput::MappedFileInput(const vespalib::string &file_name) +MappedFileInput::MappedFileInput(const std::string &file_name) : _fd(open(file_name.c_str(), O_RDONLY)), _data((char *)MAP_FAILED), _size(0), diff --git a/vespalib/src/vespa/vespalib/io/mapped_file_input.h b/vespalib/src/vespa/vespalib/io/mapped_file_input.h index b65f9646bd5c..59214da2a96a 100644 --- a/vespalib/src/vespa/vespalib/io/mapped_file_input.h +++ b/vespalib/src/vespa/vespalib/io/mapped_file_input.h @@ -17,7 +17,7 @@ class MappedFileInput : public Input size_t _size; size_t _used; public: - MappedFileInput(const vespalib::string &file_name); + MappedFileInput(const std::string &file_name); ~MappedFileInput(); bool valid() const; Memory get() const { return Memory(_data, _size); } diff --git a/vespalib/src/vespa/vespalib/metrics/dimension.cpp b/vespalib/src/vespa/vespalib/metrics/dimension.cpp index 4e7130e0170e..073d96268a5e 100644 --- a/vespalib/src/vespa/vespalib/metrics/dimension.cpp +++ b/vespalib/src/vespa/vespalib/metrics/dimension.cpp @@ -5,12 +5,12 @@ namespace vespalib::metrics { Dimension -Dimension::from_name(const vespalib::string& name) +Dimension::from_name(const std::string& name) { return NameRepo::instance.dimension(name); } -const vespalib::string& +const std::string& Dimension::as_name() const { return NameRepo::instance.dimensionName(*this); diff --git a/vespalib/src/vespa/vespalib/metrics/dimension.h b/vespalib/src/vespa/vespalib/metrics/dimension.h index 27ed652be51b..15a5d6fa6a95 100644 --- a/vespalib/src/vespa/vespalib/metrics/dimension.h +++ b/vespalib/src/vespa/vespalib/metrics/dimension.h @@ -1,12 +1,12 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include "handle.h" +#include namespace vespalib::metrics { -using DimensionName = vespalib::string; +using DimensionName = std::string; struct DimensionTag {}; @@ -16,8 +16,8 @@ struct DimensionTag {}; struct Dimension : Handle { explicit Dimension(size_t id) : Handle(id) {} - static Dimension from_name(const vespalib::string& name); - const vespalib::string& as_name() const; + static Dimension from_name(const std::string& name); + const std::string& as_name() const; }; } // namespace vespalib::metrics diff --git a/vespalib/src/vespa/vespalib/metrics/dummy_metrics_manager.h b/vespalib/src/vespa/vespalib/metrics/dummy_metrics_manager.h index 2e0d917b478e..17143eb8946b 100644 --- a/vespalib/src/vespa/vespalib/metrics/dummy_metrics_manager.h +++ b/vespalib/src/vespa/vespalib/metrics/dummy_metrics_manager.h @@ -1,14 +1,14 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include #include "name_collection.h" #include "current_samples.h" #include "snapshots.h" #include "metrics_manager.h" #include "clock.h" +#include +#include +#include namespace vespalib::metrics { @@ -28,17 +28,17 @@ class DummyMetricsManager : public MetricsManager return std::shared_ptr(new DummyMetricsManager()); } - Counter counter(const vespalib::string &, const vespalib::string &) override { + Counter counter(const std::string &, const std::string &) override { return Counter(shared_from_this(), MetricId(0)); } - Gauge gauge(const vespalib::string &, const vespalib::string &) override { + Gauge gauge(const std::string &, const std::string &) override { return Gauge(shared_from_this(), MetricId(0)); } - Dimension dimension(const vespalib::string &) override { + Dimension dimension(const std::string &) override { return Dimension(0); } - Label label(const vespalib::string &) override { + Label label(const std::string &) override { return Label(0); } PointBuilder pointBuilder(Point) override { diff --git a/vespalib/src/vespa/vespalib/metrics/json_formatter.h b/vespalib/src/vespa/vespalib/metrics/json_formatter.h index ceb3b5d97fe6..cc997037ebfb 100644 --- a/vespalib/src/vespa/vespalib/metrics/json_formatter.h +++ b/vespalib/src/vespa/vespalib/metrics/json_formatter.h @@ -3,8 +3,8 @@ #pragma once #include "snapshots.h" -#include #include +#include namespace vespalib::metrics { @@ -27,7 +27,7 @@ class JsonFormatter public: explicit JsonFormatter(const Snapshot &snapshot); - [[nodiscard]] vespalib::string asString() const { + [[nodiscard]] std::string asString() const { return _data.toString(); } }; diff --git a/vespalib/src/vespa/vespalib/metrics/label.cpp b/vespalib/src/vespa/vespalib/metrics/label.cpp index 682190bc4270..cd3504be8eb4 100644 --- a/vespalib/src/vespa/vespalib/metrics/label.cpp +++ b/vespalib/src/vespa/vespalib/metrics/label.cpp @@ -5,12 +5,12 @@ namespace vespalib::metrics { Label -Label::from_value(const vespalib::string& value) +Label::from_value(const std::string& value) { return NameRepo::instance.label(value); } -const vespalib::string& +const std::string& Label::as_value() const { return NameRepo::instance.labelValue(*this); diff --git a/vespalib/src/vespa/vespalib/metrics/label.h b/vespalib/src/vespa/vespalib/metrics/label.h index b36db7c6916f..0b95b0ec37ef 100644 --- a/vespalib/src/vespa/vespalib/metrics/label.h +++ b/vespalib/src/vespa/vespalib/metrics/label.h @@ -1,12 +1,12 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include "handle.h" +#include namespace vespalib::metrics { -using LabelValue = vespalib::string; +using LabelValue = std::string; struct LabelTag {}; @@ -16,8 +16,8 @@ struct LabelTag {}; struct Label : Handle { explicit Label(size_t id) : Handle(id) {} - static Label from_value(const vespalib::string& value); - const vespalib::string& as_value() const; + static Label from_value(const std::string& value); + const std::string& as_value() const; }; } // namespace vespalib::metrics diff --git a/vespalib/src/vespa/vespalib/metrics/metric_id.cpp b/vespalib/src/vespa/vespalib/metrics/metric_id.cpp index a8551c028cfd..ca27c13f9d3d 100644 --- a/vespalib/src/vespa/vespalib/metrics/metric_id.cpp +++ b/vespalib/src/vespa/vespalib/metrics/metric_id.cpp @@ -5,12 +5,12 @@ namespace vespalib::metrics { MetricId -MetricId::from_name(const vespalib::string& name) +MetricId::from_name(const std::string& name) { return NameRepo::instance.metric(name); } -const vespalib::string& +const std::string& MetricId::as_name() const { return NameRepo::instance.metricName(*this); diff --git a/vespalib/src/vespa/vespalib/metrics/metric_id.h b/vespalib/src/vespa/vespalib/metrics/metric_id.h index fe5194fc4941..7b58a50806dc 100644 --- a/vespalib/src/vespa/vespalib/metrics/metric_id.h +++ b/vespalib/src/vespa/vespalib/metrics/metric_id.h @@ -2,7 +2,7 @@ #pragma once #include "handle.h" -#include +#include namespace vespalib::metrics { @@ -14,8 +14,8 @@ struct MetricIdTag {}; struct MetricId : Handle { explicit MetricId(size_t id) : Handle(id) {} - static MetricId from_name(const vespalib::string& name); - const vespalib::string& as_name() const; + static MetricId from_name(const std::string& name); + const std::string& as_name() const; }; } // namespace vespalib::metrics diff --git a/vespalib/src/vespa/vespalib/metrics/metric_types.cpp b/vespalib/src/vespa/vespalib/metrics/metric_types.cpp index 22798d28e484..a7e43ac6031b 100644 --- a/vespalib/src/vespa/vespalib/metrics/metric_types.cpp +++ b/vespalib/src/vespa/vespalib/metrics/metric_types.cpp @@ -17,7 +17,7 @@ const char* MetricTypes::_typeNames[] = { }; void -MetricTypes::check(size_t id, const vespalib::string &name, MetricType ty) +MetricTypes::check(size_t id, const std::string &name, MetricType ty) { std::lock_guard guard(_lock); if (id < _seen.size()) { diff --git a/vespalib/src/vespa/vespalib/metrics/metric_types.h b/vespalib/src/vespa/vespalib/metrics/metric_types.h index 68bc9caaa0a3..fb8d96425f5b 100644 --- a/vespalib/src/vespa/vespalib/metrics/metric_types.h +++ b/vespalib/src/vespa/vespalib/metrics/metric_types.h @@ -2,8 +2,8 @@ #pragma once #include +#include #include -#include namespace vespalib { namespace metrics { @@ -20,7 +20,7 @@ class MetricTypes { INT_HISTOGRAM }; - void check(size_t id, const vespalib::string& name, MetricType ty); + void check(size_t id, const std::string& name, MetricType ty); MetricTypes() = default; ~MetricTypes() {} diff --git a/vespalib/src/vespa/vespalib/metrics/metrics_manager.h b/vespalib/src/vespa/vespalib/metrics/metrics_manager.h index 7587739ed6a0..8580dab18cb4 100644 --- a/vespalib/src/vespa/vespalib/metrics/metrics_manager.h +++ b/vespalib/src/vespa/vespalib/metrics/metrics_manager.h @@ -1,9 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include #include "counter.h" #include "gauge.h" #include "current_samples.h" @@ -12,6 +9,9 @@ #include "point_builder.h" #include "dimension.h" #include "label.h" +#include +#include +#include namespace vespalib::metrics { @@ -29,25 +29,25 @@ class MetricsManager * Get or create a counter metric. * @param name the name of the metric. **/ - virtual Counter counter(const vespalib::string &name, const vespalib::string &description) = 0; + virtual Counter counter(const std::string &name, const std::string &description) = 0; /** * Get or create a gauge metric. * @param name the name of the metric. **/ - virtual Gauge gauge(const vespalib::string &name, const vespalib::string &description) = 0; + virtual Gauge gauge(const std::string &name, const std::string &description) = 0; /** * Get or create a dimension for labeling metrics. * @param name the name of the dimension. **/ - virtual Dimension dimension(const vespalib::string &name) = 0; // get or create + virtual Dimension dimension(const std::string &name) = 0; // get or create /** * Get or create a label. * @param value the label value. **/ - virtual Label label(const vespalib::string &value) = 0; // get or create + virtual Label label(const std::string &value) = 0; // get or create /** * Create a PointBuilder for labeling metrics. diff --git a/vespalib/src/vespa/vespalib/metrics/name_collection.cpp b/vespalib/src/vespa/vespalib/metrics/name_collection.cpp index cf7b2ed480bb..1d74f50b8dd5 100644 --- a/vespalib/src/vespa/vespalib/metrics/name_collection.cpp +++ b/vespalib/src/vespa/vespalib/metrics/name_collection.cpp @@ -18,7 +18,7 @@ NameCollection::NameCollection() NameCollection::~NameCollection() = default; -const vespalib::string & +const std::string & NameCollection::lookup(size_t id) const { Guard guard(_lock); diff --git a/vespalib/src/vespa/vespalib/metrics/name_collection.h b/vespalib/src/vespa/vespalib/metrics/name_collection.h index faa8a88eae6b..7b1e51b7ef41 100644 --- a/vespalib/src/vespa/vespalib/metrics/name_collection.h +++ b/vespalib/src/vespa/vespalib/metrics/name_collection.h @@ -1,22 +1,22 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include +#include #include -#include namespace vespalib::metrics { // internal class NameCollection { private: - using Map = std::map; + using Map = std::map; mutable std::mutex _lock; Map _names; std::vector _names_by_id; public: - const vespalib::string &lookup(size_t id) const; + const std::string &lookup(size_t id) const; size_t resolve(std::string_view name); size_t size() const; diff --git a/vespalib/src/vespa/vespalib/metrics/name_repo.cpp b/vespalib/src/vespa/vespalib/metrics/name_repo.cpp index c8200d048ddc..0ac40d2a8c8b 100644 --- a/vespalib/src/vespa/vespalib/metrics/name_repo.cpp +++ b/vespalib/src/vespa/vespalib/metrics/name_repo.cpp @@ -8,7 +8,7 @@ namespace vespalib { namespace metrics { MetricId -NameRepo::metric(const vespalib::string &name) +NameRepo::metric(const std::string &name) { size_t id = _metricNames.resolve(name); LOG(debug, "metric name %s -> %zu", name.c_str(), id); @@ -16,7 +16,7 @@ NameRepo::metric(const vespalib::string &name) } Dimension -NameRepo::dimension(const vespalib::string &name) +NameRepo::dimension(const std::string &name) { size_t id = _dimensionNames.resolve(name); LOG(debug, "dimension name %s -> %zu", name.c_str(), id); @@ -24,26 +24,26 @@ NameRepo::dimension(const vespalib::string &name) } Label -NameRepo::label(const vespalib::string &value) +NameRepo::label(const std::string &value) { size_t id = _labelValues.resolve(value); LOG(debug, "label value %s -> %zu", value.c_str(), id); return Label(id); } -const vespalib::string& +const std::string& NameRepo::metricName(MetricId metric) const { return _metricNames.lookup(metric.id()); } -const vespalib::string& +const std::string& NameRepo::dimensionName(Dimension dim) const { return _dimensionNames.lookup(dim.id()); } -const vespalib::string& +const std::string& NameRepo::labelValue(Label l) const { return _labelValues.lookup(l.id()); diff --git a/vespalib/src/vespa/vespalib/metrics/name_repo.h b/vespalib/src/vespa/vespalib/metrics/name_repo.h index 86d99ab2cbd2..60d74335f0a4 100644 --- a/vespalib/src/vespa/vespalib/metrics/name_repo.h +++ b/vespalib/src/vespa/vespalib/metrics/name_repo.h @@ -1,7 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include "dimension.h" #include "label.h" #include "metric_id.h" @@ -9,6 +8,7 @@ #include "name_collection.h" #include "point_map_collection.h" +#include namespace vespalib::metrics { @@ -27,13 +27,13 @@ class NameRepo ~NameRepo() = default; public: - MetricId metric(const vespalib::string &name); - Dimension dimension(const vespalib::string &name); - Label label(const vespalib::string &value); + MetricId metric(const std::string &name); + Dimension dimension(const std::string &name); + Label label(const std::string &value); - const vespalib::string& metricName(MetricId metric) const; - const vespalib::string& dimensionName(Dimension dim) const; - const vespalib::string& labelValue(Label l) const; + const std::string& metricName(MetricId metric) const; + const std::string& dimensionName(Dimension dim) const; + const std::string& labelValue(Label l) const; const PointMap& pointMap(Point from) const; Point pointFrom(PointMap map); diff --git a/vespalib/src/vespa/vespalib/metrics/point_builder.h b/vespalib/src/vespa/vespalib/metrics/point_builder.h index ad3e23bbbf17..51a2a3b86863 100644 --- a/vespalib/src/vespa/vespalib/metrics/point_builder.h +++ b/vespalib/src/vespa/vespalib/metrics/point_builder.h @@ -1,11 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include - #include "point.h" #include "point_map.h" +#include +#include namespace vespalib { namespace metrics { diff --git a/vespalib/src/vespa/vespalib/metrics/producer.cpp b/vespalib/src/vespa/vespalib/metrics/producer.cpp index 6f00bb23d486..cee3b3e77063 100644 --- a/vespalib/src/vespa/vespalib/metrics/producer.cpp +++ b/vespalib/src/vespa/vespalib/metrics/producer.cpp @@ -15,7 +15,7 @@ Producer::~Producer() = default; namespace { -vespalib::string +std::string format_snapshot(const Snapshot &snapshot, MetricsProducer::ExpositionFormat format) { switch (format) { @@ -29,15 +29,15 @@ format_snapshot(const Snapshot &snapshot, MetricsProducer::ExpositionFormat form } -vespalib::string -Producer::getMetrics(const vespalib::string &, ExpositionFormat format) +std::string +Producer::getMetrics(const std::string &, ExpositionFormat format) { Snapshot snap = _manager->snapshot(); return format_snapshot(snap, format); } -vespalib::string -Producer::getTotalMetrics(const vespalib::string &, ExpositionFormat format) +std::string +Producer::getTotalMetrics(const std::string &, ExpositionFormat format) { Snapshot snap = _manager->totalSnapshot(); return format_snapshot(snap, format); diff --git a/vespalib/src/vespa/vespalib/metrics/producer.h b/vespalib/src/vespa/vespalib/metrics/producer.h index 95730258f86a..50efb12200c0 100644 --- a/vespalib/src/vespa/vespalib/metrics/producer.h +++ b/vespalib/src/vespa/vespalib/metrics/producer.h @@ -17,8 +17,8 @@ class Producer : public vespalib::MetricsProducer { public: explicit Producer(std::shared_ptr m); ~Producer() override; - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override; - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override; + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override; + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override; }; } diff --git a/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.cpp b/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.cpp index 2de3ea7d442d..851547384485 100644 --- a/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.cpp +++ b/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.cpp @@ -148,7 +148,7 @@ PrometheusFormatter::emit_gauges(vespalib::asciistream& out) const { } } -vespalib::string +std::string PrometheusFormatter::as_text_formatted() const { asciistream out; emit_counters(out); diff --git a/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.h b/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.h index 57664ed0586e..35cc860463e2 100644 --- a/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.h +++ b/vespalib/src/vespa/vespalib/metrics/prometheus_formatter.h @@ -2,7 +2,6 @@ #pragma once #include "snapshots.h" -#include #include namespace vespalib { class asciistream; } @@ -24,7 +23,7 @@ class PrometheusFormatter { explicit PrometheusFormatter(const Snapshot& snapshot); ~PrometheusFormatter(); - [[nodiscard]] vespalib::string as_text_formatted() const; + [[nodiscard]] std::string as_text_formatted() const; private: enum SubMetric { Count, Sum, Min, Max }; constexpr static uint32_t NumSubMetrics = 4; // Must match the enum cardinality of SubMetric diff --git a/vespalib/src/vespa/vespalib/metrics/simple_metrics.h b/vespalib/src/vespa/vespalib/metrics/simple_metrics.h index f047051af988..9b6708283a8d 100644 --- a/vespalib/src/vespa/vespalib/metrics/simple_metrics.h +++ b/vespalib/src/vespa/vespalib/metrics/simple_metrics.h @@ -1,11 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include - #include "clock.h" #include "counter.h" #include "dimension.h" @@ -19,3 +14,7 @@ #include "producer.h" #include "simple_metrics_manager.h" #include "snapshots.h" +#include +#include +#include +#include diff --git a/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.cpp b/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.cpp index 8c792dc96e3b..039f2b5d05bf 100644 --- a/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.cpp +++ b/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.cpp @@ -50,7 +50,7 @@ SimpleMetricsManager::createForTest(const SimpleManagerConfig &config, } Counter -SimpleMetricsManager::counter(const vespalib::string &name, const vespalib::string &) +SimpleMetricsManager::counter(const std::string &name, const std::string &) { MetricId mi = MetricId::from_name(name); _metricTypes.check(mi.id(), name, MetricTypes::MetricType::COUNTER); @@ -59,7 +59,7 @@ SimpleMetricsManager::counter(const vespalib::string &name, const vespalib::stri } Gauge -SimpleMetricsManager::gauge(const vespalib::string &name, const vespalib::string &) +SimpleMetricsManager::gauge(const std::string &name, const std::string &) { MetricId mi = MetricId::from_name(name); _metricTypes.check(mi.id(), name, MetricTypes::MetricType::GAUGE); @@ -124,7 +124,7 @@ SimpleMetricsManager::snapshotFrom(const Bucket &bucket) MetricId mi = entry.idx.first; Point p = entry.idx.second; size_t pi = p.id(); - const vespalib::string &name = mi.as_name(); + const std::string &name = mi.as_name(); CounterSnapshot val(name, snap.points()[pi], entry); snap.add(val); } @@ -132,7 +132,7 @@ SimpleMetricsManager::snapshotFrom(const Bucket &bucket) MetricId mi = entry.idx.first; Point p = entry.idx.second; size_t pi = p.id(); - const vespalib::string &name = mi.as_name(); + const std::string &name = mi.as_name(); GaugeSnapshot val(name, snap.points()[pi], entry); snap.add(val); } @@ -173,7 +173,7 @@ SimpleMetricsManager::collectCurrentSamples(TimeStamp prev, } Dimension -SimpleMetricsManager::dimension(const vespalib::string &name) +SimpleMetricsManager::dimension(const std::string &name) { Dimension dim = Dimension::from_name(name); LOG(debug, "dimension name %s -> %zu", name.c_str(), dim.id()); @@ -181,7 +181,7 @@ SimpleMetricsManager::dimension(const vespalib::string &name) } Label -SimpleMetricsManager::label(const vespalib::string &value) +SimpleMetricsManager::label(const std::string &value) { Label l = Label::from_value(value); LOG(debug, "label value %s -> %zu", value.c_str(), l.id()); diff --git a/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.h b/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.h index 587c66a3cc5e..67ee7e400250 100644 --- a/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.h +++ b/vespalib/src/vespa/vespalib/metrics/simple_metrics_manager.h @@ -1,17 +1,17 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include -#include #include "current_samples.h" #include "snapshots.h" #include "metrics_manager.h" #include "metric_types.h" #include "clock.h" #include "bucket.h" +#include +#include +#include +#include +#include namespace vespalib { namespace metrics { @@ -65,10 +65,10 @@ class SimpleMetricsManager : public MetricsManager static std::shared_ptr create(const SimpleManagerConfig &config); static std::shared_ptr createForTest(const SimpleManagerConfig &config, Tick::UP tick_supplier); - Counter counter(const vespalib::string &name, const vespalib::string &description) override; - Gauge gauge(const vespalib::string &name, const vespalib::string &description) override; - Dimension dimension(const vespalib::string &name) override; - Label label(const vespalib::string &value) override; + Counter counter(const std::string &name, const std::string &description) override; + Gauge gauge(const std::string &name, const std::string &description) override; + Dimension dimension(const std::string &name) override; + Label label(const std::string &value) override; PointBuilder pointBuilder(Point from) override; Point pointFrom(PointMap map) override; Snapshot snapshot() override; diff --git a/vespalib/src/vespa/vespalib/metrics/snapshots.h b/vespalib/src/vespa/vespalib/metrics/snapshots.h index df690abeef2d..076479d363a4 100644 --- a/vespalib/src/vespa/vespalib/metrics/snapshots.h +++ b/vespalib/src/vespa/vespalib/metrics/snapshots.h @@ -1,22 +1,22 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include "counter_aggregator.h" #include "gauge_aggregator.h" +#include +#include namespace vespalib::metrics { class DimensionBinding { private: - const vespalib::string _dimensionName; - const vespalib::string _labelValue; + const std::string _dimensionName; + const std::string _labelValue; public: - const vespalib::string &dimensionName() const { return _dimensionName; } - const vespalib::string &labelValue() const { return _labelValue; } - DimensionBinding(const vespalib::string &a, - const vespalib::string &v) noexcept + const std::string &dimensionName() const { return _dimensionName; } + const std::string &labelValue() const { return _labelValue; } + DimensionBinding(const std::string &a, + const std::string &v) noexcept : _dimensionName(a), _labelValue(v) {} ~DimensionBinding() {} @@ -28,22 +28,22 @@ struct PointSnapshot { class CounterSnapshot { private: - const vespalib::string _name; + const std::string _name; const PointSnapshot &_point; const size_t _count; public: - CounterSnapshot(const vespalib::string &n, const PointSnapshot &p, const CounterAggregator &c) + CounterSnapshot(const std::string &n, const PointSnapshot &p, const CounterAggregator &c) : _name(n), _point(p), _count(c.count) {} ~CounterSnapshot() {} - const vespalib::string &name() const { return _name; } + const std::string &name() const { return _name; } const PointSnapshot &point() const { return _point; } size_t count() const { return _count; } }; class GaugeSnapshot { private: - const vespalib::string _name; + const std::string _name; const PointSnapshot &_point; const size_t _observedCount; const double _averageValue; @@ -52,7 +52,7 @@ class GaugeSnapshot { const double _maxValue; const double _lastValue; public: - GaugeSnapshot(const vespalib::string &n, const PointSnapshot &p, const GaugeAggregator &c) + GaugeSnapshot(const std::string &n, const PointSnapshot &p, const GaugeAggregator &c) : _name(n), _point(p), _observedCount(c.observedCount), @@ -63,7 +63,7 @@ class GaugeSnapshot { _lastValue(c.lastValue) {} ~GaugeSnapshot() {} - const vespalib::string &name() const { return _name; } + const std::string &name() const { return _name; } const PointSnapshot &point() const { return _point; } size_t observedCount() const { return _observedCount; } double averageValue() const { return _averageValue; } diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.cpp b/vespalib/src/vespa/vespalib/net/async_resolver.cpp index befb3bd641d6..e33e5d4f959b 100644 --- a/vespalib/src/vespa/vespalib/net/async_resolver.cpp +++ b/vespalib/src/vespa/vespalib/net/async_resolver.cpp @@ -22,8 +22,8 @@ AsyncResolver::SteadyClock::now() //----------------------------------------------------------------------------- -vespalib::string -AsyncResolver::SimpleHostResolver::ip_address(const vespalib::string &host_name) +std::string +AsyncResolver::SimpleHostResolver::ip_address(const std::string &host_name) { return SocketAddress::select_remote(80, host_name.c_str()).ip_address(); } @@ -42,11 +42,11 @@ AsyncResolver::Params::Params() //----------------------------------------------------------------------------- -vespalib::string -AsyncResolver::LoggingHostResolver::ip_address(const vespalib::string &host_name) +std::string +AsyncResolver::LoggingHostResolver::ip_address(const std::string &host_name) { auto before = _clock->now(); - vespalib::string ip_address = _resolver->ip_address(host_name); + std::string ip_address = _resolver->ip_address(host_name); seconds resolve_time = (_clock->now() - before); if (resolve_time >= _max_resolve_time) { LOG(warning, "slow resolve time: '%s' -> '%s' (%g s)", @@ -73,7 +73,7 @@ AsyncResolver::CachingHostResolver::should_evict_oldest_entry(const std::lock_gu } bool -AsyncResolver::CachingHostResolver::lookup(const vespalib::string &host_name, vespalib::string &ip_address) +AsyncResolver::CachingHostResolver::lookup(const std::string &host_name, std::string &ip_address) { auto now = _clock->now(); std::lock_guard guard(_lock); @@ -91,7 +91,7 @@ AsyncResolver::CachingHostResolver::lookup(const vespalib::string &host_name, ve } void -AsyncResolver::CachingHostResolver::store(const vespalib::string &host_name, const vespalib::string &ip_address) +AsyncResolver::CachingHostResolver::store(const std::string &host_name, const std::string &ip_address) { auto end_time = _clock->now() + std::chrono::duration_cast(_max_result_age); std::lock_guard guard(_lock); @@ -113,10 +113,10 @@ AsyncResolver::CachingHostResolver::CachingHostResolver(Clock::SP clock, HostRes { } -vespalib::string -AsyncResolver::CachingHostResolver::ip_address(const vespalib::string &host_name) +std::string +AsyncResolver::CachingHostResolver::ip_address(const std::string &host_name) { - vespalib::string ip_address; + std::string ip_address; if (lookup(host_name, ip_address)) { return ip_address; } @@ -163,7 +163,7 @@ AsyncResolver::wait_for_pending_resolves() { } void -AsyncResolver::resolve_async(const vespalib::string &spec, ResultHandler::WP result_handler) +AsyncResolver::resolve_async(const std::string &spec, ResultHandler::WP result_handler) { auto task = std::make_unique(spec, *_resolver, std::move(result_handler)); auto rejected = _executor->execute(std::move(task)); diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.h b/vespalib/src/vespa/vespalib/net/async_resolver.h index e19eedcd0a53..5c83c61339fc 100644 --- a/vespalib/src/vespa/vespalib/net/async_resolver.h +++ b/vespalib/src/vespa/vespalib/net/async_resolver.h @@ -44,7 +44,7 @@ class AsyncResolver }; struct HostResolver { - virtual vespalib::string ip_address(const vespalib::string &host_name) = 0; + virtual std::string ip_address(const std::string &host_name) = 0; virtual ~HostResolver() {} using SP = std::shared_ptr; }; @@ -54,7 +54,7 @@ class AsyncResolver }; struct SimpleHostResolver : public HostResolver { - vespalib::string ip_address(const vespalib::string &host_name) override; + std::string ip_address(const std::string &host_name) override; }; struct Params { @@ -77,18 +77,18 @@ class AsyncResolver public: LoggingHostResolver(Clock::SP clock, HostResolver::SP resolver, seconds max_resolve_time) noexcept : _clock(std::move(clock)), _resolver(std::move(resolver)), _max_resolve_time(max_resolve_time) {} - vespalib::string ip_address(const vespalib::string &host_name) override; + std::string ip_address(const std::string &host_name) override; }; class CachingHostResolver : public HostResolver { private: struct Entry { - vespalib::string ip_address; + std::string ip_address; time_point end_time; - Entry(const vespalib::string &ip, time_point end) + Entry(const std::string &ip, time_point end) : ip_address(ip), end_time(end) {} }; - using Map = std::map; + using Map = std::map; using Itr = Map::iterator; Clock::SP _clock; HostResolver::SP _resolver; @@ -99,20 +99,20 @@ class AsyncResolver ArrayQueue _queue; bool should_evict_oldest_entry(const std::lock_guard &guard, time_point now); - bool lookup(const vespalib::string &host_name, vespalib::string &ip_address); - void resolve(const vespalib::string &host_name, vespalib::string &ip_address); - void store(const vespalib::string &host_name, const vespalib::string &ip_address); + bool lookup(const std::string &host_name, std::string &ip_address); + void resolve(const std::string &host_name, std::string &ip_address); + void store(const std::string &host_name, const std::string &ip_address); public: CachingHostResolver(Clock::SP clock, HostResolver::SP resolver, size_t max_cache_size, seconds max_result_age) noexcept; - vespalib::string ip_address(const vespalib::string &host_name) override; + std::string ip_address(const std::string &host_name) override; }; struct ResolveTask : public Executor::Task { - vespalib::string spec; + std::string spec; HostResolver &resolver; ResultHandler::WP weak_handler; - ResolveTask(const vespalib::string &spec_in, HostResolver &resolver_in, ResultHandler::WP weak_handler_in) + ResolveTask(const std::string &spec_in, HostResolver &resolver_in, ResultHandler::WP weak_handler_in) : spec(spec_in), resolver(resolver_in), weak_handler(std::move(weak_handler_in)) {} void run() override; }; @@ -125,7 +125,7 @@ class AsyncResolver AsyncResolver(HostResolver::SP resolver, size_t num_threads); public: ~AsyncResolver(); - void resolve_async(const vespalib::string &spec, ResultHandler::WP result_handler); + void resolve_async(const std::string &spec, ResultHandler::WP result_handler); void wait_for_pending_resolves(); static AsyncResolver::SP create(Params params); static AsyncResolver::SP get_shared(); diff --git a/vespalib/src/vespa/vespalib/net/crypto_engine.cpp b/vespalib/src/vespa/vespalib/net/crypto_engine.cpp index 35cb2e86485c..af6f44e5c52c 100644 --- a/vespalib/src/vespa/vespalib/net/crypto_engine.cpp +++ b/vespalib/src/vespa/vespalib/net/crypto_engine.cpp @@ -6,8 +6,8 @@ #include #include #include -#include #include +#include #include LOG_SETUP(".vespalib.net.crypto_engine"); @@ -41,7 +41,7 @@ using net::tls::AuthorizationMode; AuthorizationMode authorization_mode_from_env() { const char* env = getenv("VESPA_TLS_INSECURE_AUTHORIZATION_MODE"); - vespalib::string mode = env ? env : ""; + std::string mode = env ? env : ""; if (mode == "enforce") { return AuthorizationMode::Enforce; } else if (mode == "log_only") { @@ -58,7 +58,7 @@ authorization_mode_from_env() { CryptoEngine::SP create_default_crypto_engine() { const char *env = getenv("VESPA_TLS_CONFIG_FILE"); - vespalib::string cfg_file = env ? env : ""; + std::string cfg_file = env ? env : ""; if (cfg_file.empty()) { return std::make_shared(); } @@ -66,7 +66,7 @@ create_default_crypto_engine() { LOG(debug, "Using TLS crypto engine with config file '%s'", cfg_file.c_str()); auto tls = std::make_shared(cfg_file, mode); env = getenv("VESPA_TLS_INSECURE_MIXED_MODE"); - vespalib::string mixed_mode = env ? env : ""; + std::string mixed_mode = env ? env : ""; if (mixed_mode == "plaintext_client_mixed_server") { LOG(debug, "TLS insecure mixed-mode activated: plaintext client, mixed server"); return std::make_shared(std::move(tls), false); diff --git a/vespalib/src/vespa/vespalib/net/http/component_config_producer.h b/vespalib/src/vespa/vespalib/net/http/component_config_producer.h index fd0e5b433475..d43db37529d7 100644 --- a/vespalib/src/vespa/vespalib/net/http/component_config_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/component_config_producer.h @@ -2,17 +2,17 @@ #pragma once -#include +#include namespace vespalib { struct ComponentConfigProducer { struct Config { - vespalib::string name; + std::string name; size_t gen; - vespalib::string msg; - Config(const vespalib::string &n, size_t g) : name(n), gen(g), msg() {} - Config(const vespalib::string &n, size_t g, const vespalib::string &m) + std::string msg; + Config(const std::string &n, size_t g) : name(n), gen(g), msg() {} + Config(const std::string &n, size_t g, const std::string &m) : name(n), gen(g), msg(m) {} ~Config(); }; diff --git a/vespalib/src/vespa/vespalib/net/http/generic_state_handler.cpp b/vespalib/src/vespa/vespalib/net/http/generic_state_handler.cpp index 4a0a949485ec..1989047d697a 100644 --- a/vespalib/src/vespa/vespalib/net/http/generic_state_handler.cpp +++ b/vespalib/src/vespa/vespalib/net/http/generic_state_handler.cpp @@ -11,9 +11,9 @@ namespace { // escape a path component in the URL // (needed to avoid java.net.URI throwing an exception) -vespalib::string url_escape(const vespalib::string &item) { +std::string url_escape(const std::string &item) { static const char hexdigits[] = "0123456789ABCDEF"; - vespalib::string r; + std::string r; r.reserve(item.size()); for (const char c : item) { if ( ('a' <= c && c <= 'z') @@ -34,15 +34,15 @@ vespalib::string url_escape(const vespalib::string &item) { class Url { private: - vespalib::string _url; - void append(const vespalib::string &item) { + std::string _url; + void append(const std::string &item) { if (*_url.rbegin() != '/') { _url += '/'; } _url.append(url_escape(item)); } public: - Url(const vespalib::string &host, const std::vector &items) + Url(const std::string &host, const std::vector &items) : _url("http://") { _url.append(host); @@ -51,17 +51,17 @@ class Url { append(item); } } - Url(const Url &parent, const vespalib::string &item) + Url(const Url &parent, const std::string &item) : _url(parent._url) { append(item); } - const vespalib::string &get() const { return _url; } + const std::string &get() const { return _url; } }; -std::vector split_path(const vespalib::string &path) { - vespalib::string tmp; - std::vector items; +std::vector split_path(const std::string &path) { + std::string tmp; + std::vector items; for (size_t i = 0; (i < path.size()) && (path[i] != '?'); ++i) { if (path[i] == '/') { if (!tmp.empty()) { @@ -78,7 +78,7 @@ std::vector split_path(const vespalib::string &path) { return items; } -bool is_prefix(const std::vector &root, const std::vector &full) { +bool is_prefix(const std::vector &root, const std::vector &full) { if (root.size() > full.size()) { return false; } @@ -104,8 +104,8 @@ Slime child_state(const StateExplorer &state, const Url &url) { } void inject_children(const StateExplorer &state, const Url &url, slime::Cursor &self) { - std::vector children_names = state.get_children_names(); - for (const vespalib::string &child_name: children_names) { + std::vector children_names = state.get_children_names(); + for (const std::string &child_name: children_names) { std::unique_ptr child = state.get_child(child_name); if (child) { Slime fragment = child_state(*child, Url(url, child_name)); @@ -114,7 +114,7 @@ void inject_children(const StateExplorer &state, const Url &url, slime::Cursor & } } -vespalib::string render(const StateExplorer &state, const Url &url) { +std::string render(const StateExplorer &state, const Url &url) { Slime top; state.get_state(slime::SlimeInserter(top), true); if (top.get().type().getId() == slime::NIX::ID) { @@ -126,8 +126,8 @@ vespalib::string render(const StateExplorer &state, const Url &url) { return buf.get().make_string(); } -JsonGetHandler::Response explore(const StateExplorer &state, const vespalib::string &host, - const std::vector &items, size_t pos) { +JsonGetHandler::Response explore(const StateExplorer &state, const std::string &host, + const std::vector &items, size_t pos) { if (pos == items.size()) { return JsonGetHandler::Response::make_ok_with_json(render(state, Url(host, items))); } @@ -140,19 +140,19 @@ JsonGetHandler::Response explore(const StateExplorer &state, const vespalib::str } // namespace vespalib:: -GenericStateHandler::GenericStateHandler(const vespalib::string &root_path, const StateExplorer &state) +GenericStateHandler::GenericStateHandler(const std::string &root_path, const StateExplorer &state) : _root(split_path(root_path)), _state(state) { } JsonGetHandler::Response -GenericStateHandler::get(const vespalib::string &host, - const vespalib::string &path, - const std::map &, +GenericStateHandler::get(const std::string &host, + const std::string &path, + const std::map &, const net::ConnectionAuthContext &) const { - std::vector items = split_path(path); + std::vector items = split_path(path); if (!is_prefix(_root, items)) { return Response::make_not_found(); } diff --git a/vespalib/src/vespa/vespalib/net/http/generic_state_handler.h b/vespalib/src/vespa/vespalib/net/http/generic_state_handler.h index e602d79eb6a7..2866a3751175 100644 --- a/vespalib/src/vespa/vespalib/net/http/generic_state_handler.h +++ b/vespalib/src/vespa/vespalib/net/http/generic_state_handler.h @@ -4,9 +4,9 @@ #include "json_get_handler.h" #include "state_explorer.h" -#include -#include #include +#include +#include namespace vespalib { @@ -18,14 +18,14 @@ namespace vespalib { class GenericStateHandler : public JsonGetHandler { private: - std::vector _root; + std::vector _root; const StateExplorer &_state; public: - GenericStateHandler(const vespalib::string &root_path, const StateExplorer &state); - Response get(const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms, + GenericStateHandler(const std::string &root_path, const StateExplorer &state); + Response get(const std::string &host, + const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const override; }; diff --git a/vespalib/src/vespa/vespalib/net/http/health_producer.h b/vespalib/src/vespa/vespalib/net/http/health_producer.h index 9074ae409d72..22493aad1cb8 100644 --- a/vespalib/src/vespa/vespalib/net/http/health_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/health_producer.h @@ -2,15 +2,15 @@ #pragma once -#include +#include namespace vespalib { struct HealthProducer { struct Health { bool ok; - vespalib::string msg; - Health(bool o, const vespalib::string &m) : ok(o), msg(m) {} + std::string msg; + Health(bool o, const std::string &m) : ok(o), msg(m) {} }; virtual Health getHealth() const = 0; virtual ~HealthProducer() {} diff --git a/vespalib/src/vespa/vespalib/net/http/http_server.h b/vespalib/src/vespa/vespalib/net/http/http_server.h index 82229db5379e..ed9dfacacb43 100644 --- a/vespalib/src/vespa/vespalib/net/http/http_server.h +++ b/vespalib/src/vespa/vespalib/net/http/http_server.h @@ -27,7 +27,7 @@ class HttpServer : public Portal::GetHandler using UP = std::unique_ptr; HttpServer(int port_in); ~HttpServer(); - const vespalib::string &host() const { return _server->my_host(); } + const std::string &host() const { return _server->my_host(); } JsonHandlerRepo &repo() { return _handler_repo; } int port() const { return _server->listen_port(); } }; diff --git a/vespalib/src/vespa/vespalib/net/http/json_get_handler.cpp b/vespalib/src/vespa/vespalib/net/http/json_get_handler.cpp index 7f04235f7810..b8ae31a01f4b 100644 --- a/vespalib/src/vespa/vespalib/net/http/json_get_handler.cpp +++ b/vespalib/src/vespa/vespalib/net/http/json_get_handler.cpp @@ -5,8 +5,8 @@ namespace vespalib { JsonGetHandler::Response::Response(int status_code, - vespalib::string status_or_payload, - vespalib::string content_type_override) + std::string status_or_payload, + std::string content_type_override) : _status_code(status_code), _status_or_payload(std::move(status_or_payload)), _content_type_override(std::move(content_type_override)) @@ -26,19 +26,19 @@ JsonGetHandler::Response::Response(Response&&) noexcept = default; JsonGetHandler::Response& JsonGetHandler::Response::operator=(Response&&) noexcept = default; JsonGetHandler::Response -JsonGetHandler::Response::make_ok_with_json(vespalib::string json) +JsonGetHandler::Response::make_ok_with_json(std::string json) { return {200, std::move(json), {}}; } JsonGetHandler::Response -JsonGetHandler::Response::make_ok_with_content_type(vespalib::string payload, vespalib::string content_type) +JsonGetHandler::Response::make_ok_with_content_type(std::string payload, std::string content_type) { return {200, std::move(payload), std::move(content_type)}; } JsonGetHandler::Response -JsonGetHandler::Response::make_failure(int status_code, vespalib::string status_message) +JsonGetHandler::Response::make_failure(int status_code, std::string status_message) { return {status_code, std::move(status_message), {}}; } diff --git a/vespalib/src/vespa/vespalib/net/http/json_get_handler.h b/vespalib/src/vespa/vespalib/net/http/json_get_handler.h index 179fb8d5e37f..0711602ea251 100644 --- a/vespalib/src/vespa/vespalib/net/http/json_get_handler.h +++ b/vespalib/src/vespa/vespalib/net/http/json_get_handler.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace vespalib::net { class ConnectionAuthContext; } @@ -12,12 +12,12 @@ namespace vespalib { struct JsonGetHandler { class Response { int _status_code; - vespalib::string _status_or_payload; - vespalib::string _content_type_override; + std::string _status_or_payload; + std::string _content_type_override; Response(int status_code, - vespalib::string status_or_payload, - vespalib::string content_type_override); + std::string status_or_payload, + std::string content_type_override); public: Response(); // By default, 500 Internal Server Error ~Response(); @@ -51,15 +51,15 @@ struct JsonGetHandler { } } - [[nodiscard]] static Response make_ok_with_json(vespalib::string json); - [[nodiscard]] static Response make_ok_with_content_type(vespalib::string payload, vespalib::string content_type); - [[nodiscard]] static Response make_failure(int status_code, vespalib::string status_message); + [[nodiscard]] static Response make_ok_with_json(std::string json); + [[nodiscard]] static Response make_ok_with_content_type(std::string payload, std::string content_type); + [[nodiscard]] static Response make_failure(int status_code, std::string status_message); [[nodiscard]] static Response make_not_found(); }; - virtual Response get(const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms, + virtual Response get(const std::string &host, + const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const = 0; virtual ~JsonGetHandler() = default; }; diff --git a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.cpp b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.cpp index 5c7ad85c4252..42bf32e7f526 100644 --- a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.cpp +++ b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.cpp @@ -63,11 +63,11 @@ JsonHandlerRepo::add_root_resource(std::string_view path) return std::make_unique(_state, _state->add_root_resource(path)); } -std::vector +std::vector JsonHandlerRepo::get_root_resources() const { std::lock_guard guard(_state->lock); - std::vector result; + std::vector result; for (const Resource &resource: _state->root_resources) { result.push_back(resource.path); } @@ -75,9 +75,9 @@ JsonHandlerRepo::get_root_resources() const } JsonGetHandler::Response -JsonHandlerRepo::get(const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms, +JsonHandlerRepo::get(const std::string &host, + const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const { std::lock_guard guard(_state->lock); diff --git a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h index c099be922136..c22c1bb021ed 100644 --- a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h +++ b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h @@ -31,7 +31,7 @@ class JsonHandlerRepo : public JsonGetHandler private: struct Hook { size_t seq; - vespalib::string path_prefix; + std::string path_prefix; const JsonGetHandler *handler; Hook(size_t seq_in, std::string_view prefix_in, @@ -47,7 +47,7 @@ class JsonHandlerRepo : public JsonGetHandler struct Resource { size_t seq; - vespalib::string path; + std::string path; Resource(size_t seq_in, std::string_view path_in) noexcept : seq(seq_in), path(path_in) {} }; @@ -82,9 +82,9 @@ class JsonHandlerRepo : public JsonGetHandler ~JsonHandlerRepo() override; Token::UP bind(std::string_view path_prefix, const JsonGetHandler &get_handler); Token::UP add_root_resource(std::string_view path); - [[nodiscard]] std::vector get_root_resources() const; - [[nodiscard]] Response get(const vespalib::string &host, const vespalib::string &path, - const std::map ¶ms, + [[nodiscard]] std::vector get_root_resources() const; + [[nodiscard]] Response get(const std::string &host, const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const override; }; diff --git a/vespalib/src/vespa/vespalib/net/http/metrics_producer.h b/vespalib/src/vespa/vespalib/net/http/metrics_producer.h index 0ffb1773456f..dc48a77aa619 100644 --- a/vespalib/src/vespa/vespalib/net/http/metrics_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/metrics_producer.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { @@ -12,8 +12,8 @@ struct MetricsProducer { Prometheus }; - virtual vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) = 0; - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) = 0; + virtual std::string getMetrics(const std::string &consumer, ExpositionFormat format) = 0; + virtual std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) = 0; virtual ~MetricsProducer() = default; }; diff --git a/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.cpp b/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.cpp index 2cd62f1850ca..6dadc39b5373 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.cpp +++ b/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.cpp @@ -20,7 +20,7 @@ SimpleComponentConfigProducer::addConfig(const Config &config) } void -SimpleComponentConfigProducer::removeConfig(const vespalib::string &name) +SimpleComponentConfigProducer::removeConfig(const std::string &name) { std::lock_guard guard(_lock); _state.erase(name); diff --git a/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.h b/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.h index 51df73d9a544..9ba738e85d1c 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/simple_component_config_producer.h @@ -12,13 +12,13 @@ class SimpleComponentConfigProducer : public ComponentConfigProducer { private: std::mutex _lock; - std::map _state; + std::map _state; public: SimpleComponentConfigProducer(); ~SimpleComponentConfigProducer() override; void addConfig(const Config &config); - void removeConfig(const vespalib::string &name); + void removeConfig(const std::string &name); void getComponentConfig(Consumer &consumer) override; }; diff --git a/vespalib/src/vespa/vespalib/net/http/simple_health_producer.cpp b/vespalib/src/vespa/vespalib/net/http/simple_health_producer.cpp index 3c35d1b1657e..6bcc201158fd 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_health_producer.cpp +++ b/vespalib/src/vespa/vespalib/net/http/simple_health_producer.cpp @@ -60,7 +60,7 @@ SimpleHealthProducer::setOk() } void -SimpleHealthProducer::setFailed(const vespalib::string &msg) +SimpleHealthProducer::setFailed(const std::string &msg) { std::lock_guard guard(_lock); _health = Health(false, msg); diff --git a/vespalib/src/vespa/vespalib/net/http/simple_health_producer.h b/vespalib/src/vespa/vespalib/net/http/simple_health_producer.h index 3d6f7b5092f8..dee5417b0207 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_health_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/simple_health_producer.h @@ -17,7 +17,7 @@ class SimpleHealthProducer : public HealthProducer SimpleHealthProducer(); ~SimpleHealthProducer() override; void setOk(); - void setFailed(const vespalib::string &msg); + void setFailed(const std::string &msg); Health getHealth() const override; }; diff --git a/vespalib/src/vespa/vespalib/net/http/simple_metric_snapshot.h b/vespalib/src/vespa/vespalib/net/http/simple_metric_snapshot.h index 18c075b40a7a..c0eec81b07cd 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_metric_snapshot.h +++ b/vespalib/src/vespa/vespalib/net/http/simple_metric_snapshot.h @@ -2,8 +2,8 @@ #pragma once -#include #include +#include namespace vespalib { @@ -20,7 +20,7 @@ class SimpleMetricSnapshot void addCount(const char *name, const char *desc, uint32_t count); void addGauge(const char *name, const char *desc, long gauge); - vespalib::string asString() const { + std::string asString() const { return _data.toString(); } }; diff --git a/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.cpp b/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.cpp index 52836589ce33..f3b777c9c370 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.cpp +++ b/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.cpp @@ -14,28 +14,28 @@ SimpleMetricsProducer::SimpleMetricsProducer() SimpleMetricsProducer::~SimpleMetricsProducer() = default; void -SimpleMetricsProducer::setMetrics(const vespalib::string &metrics, ExpositionFormat format) +SimpleMetricsProducer::setMetrics(const std::string &metrics, ExpositionFormat format) { std::lock_guard guard(_lock); _metrics[format] = metrics; } -vespalib::string -SimpleMetricsProducer::getMetrics(const vespalib::string &, ExpositionFormat format) +std::string +SimpleMetricsProducer::getMetrics(const std::string &, ExpositionFormat format) { std::lock_guard guard(_lock); return _metrics[format]; // May implicitly create entry, but that's fine here. } void -SimpleMetricsProducer::setTotalMetrics(const vespalib::string &metrics, ExpositionFormat format) +SimpleMetricsProducer::setTotalMetrics(const std::string &metrics, ExpositionFormat format) { std::lock_guard guard(_lock); _total_metrics[format] = metrics; } -vespalib::string -SimpleMetricsProducer::getTotalMetrics(const vespalib::string &, ExpositionFormat format) +std::string +SimpleMetricsProducer::getTotalMetrics(const std::string &, ExpositionFormat format) { std::lock_guard guard(_lock); return _total_metrics[format]; diff --git a/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.h b/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.h index 670e8d494c26..aa4cd65c9174 100644 --- a/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.h +++ b/vespalib/src/vespa/vespalib/net/http/simple_metrics_producer.h @@ -12,16 +12,16 @@ class SimpleMetricsProducer : public MetricsProducer { private: std::mutex _lock; - std::map _metrics; - std::map _total_metrics; + std::map _metrics; + std::map _total_metrics; public: SimpleMetricsProducer(); ~SimpleMetricsProducer() override; - void setMetrics(const vespalib::string &metrics, ExpositionFormat format); - vespalib::string getMetrics(const vespalib::string &consumer, ExpositionFormat format) override; - void setTotalMetrics(const vespalib::string &metrics, ExpositionFormat format); - vespalib::string getTotalMetrics(const vespalib::string &consumer, ExpositionFormat format) override; + void setMetrics(const std::string &metrics, ExpositionFormat format); + std::string getMetrics(const std::string &consumer, ExpositionFormat format) override; + void setTotalMetrics(const std::string &metrics, ExpositionFormat format); + std::string getTotalMetrics(const std::string &consumer, ExpositionFormat format) override; }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/http/slime_explorer.cpp b/vespalib/src/vespa/vespalib/net/http/slime_explorer.cpp index 17ba76a742b7..e21460f29a80 100644 --- a/vespalib/src/vespa/vespalib/net/http/slime_explorer.cpp +++ b/vespalib/src/vespa/vespalib/net/http/slime_explorer.cpp @@ -17,7 +17,7 @@ struct SelfState : slime::ObjectTraverser { }; struct ChildrenNames : slime::ObjectTraverser { - std::vector result; + std::vector result; void field(const Memory &key, const slime::Inspector &value) override { if (value.type().getId() == slime::OBJECT::ID) { result.push_back(key.make_string()); @@ -40,7 +40,7 @@ SlimeExplorer::get_state(const slime::Inserter &inserter, bool full) const } } -std::vector +std::vector SlimeExplorer::get_children_names() const { ChildrenNames names; diff --git a/vespalib/src/vespa/vespalib/net/http/slime_explorer.h b/vespalib/src/vespa/vespalib/net/http/slime_explorer.h index 32444fea51cf..bd7e79737a5e 100644 --- a/vespalib/src/vespa/vespalib/net/http/slime_explorer.h +++ b/vespalib/src/vespa/vespalib/net/http/slime_explorer.h @@ -3,10 +3,10 @@ #pragma once #include "state_explorer.h" -#include #include -#include #include +#include +#include namespace vespalib { @@ -23,7 +23,7 @@ class SlimeExplorer : public StateExplorer public: SlimeExplorer(const slime::Inspector &self) : _self(self) {} virtual void get_state(const slime::Inserter &inserter, bool full) const override; - virtual std::vector get_children_names() const override; + virtual std::vector get_children_names() const override; virtual std::unique_ptr get_child(std::string_view name) const override; }; diff --git a/vespalib/src/vespa/vespalib/net/http/state_api.cpp b/vespalib/src/vespa/vespalib/net/http/state_api.cpp index f51fcc9a0347..a68c4bdaac0d 100644 --- a/vespalib/src/vespa/vespalib/net/http/state_api.cpp +++ b/vespalib/src/vespa/vespalib/net/http/state_api.cpp @@ -58,25 +58,25 @@ void build_health_status(JSONStringer &json, const HealthProducer &healthProduce json.endObject(); } -vespalib::string get_param(const std::map ¶ms, +std::string get_param(const std::map ¶ms, std::string_view param_name, std::string_view default_value) { auto maybe_value = params.find(std::string(param_name)); if (maybe_value == params.end()) { - return vespalib::string(default_value); + return std::string(default_value); } return maybe_value->second; } -void render_link(JSONStringer &json, const vespalib::string &host, const vespalib::string &path) { +void render_link(JSONStringer &json, const std::string &host, const std::string &path) { json.beginObject(); json.appendKey("url"); json.appendString("http://" + host + path); json.endObject(); } -vespalib::string respond_root(const JsonHandlerRepo &repo, const vespalib::string &host) { +std::string respond_root(const JsonHandlerRepo &repo, const std::string &host) { JSONStringer json; json.beginObject(); json.appendKey("resources"); @@ -84,7 +84,7 @@ vespalib::string respond_root(const JsonHandlerRepo &repo, const vespalib::strin for (auto path: {"/state/v1/health", "/state/v1/metrics", "/state/v1/config"}) { render_link(json, host, path); } - for (const vespalib::string &path: repo.get_root_resources()) { + for (const std::string &path: repo.get_root_resources()) { render_link(json, host, path); } json.endArray(); @@ -92,7 +92,7 @@ vespalib::string respond_root(const JsonHandlerRepo &repo, const vespalib::strin return json.str(); } -vespalib::string respond_health(const HealthProducer &healthProducer) { +std::string respond_health(const HealthProducer &healthProducer) { JSONStringer json; json.beginObject(); build_health_status(json, healthProducer); @@ -100,7 +100,7 @@ vespalib::string respond_health(const HealthProducer &healthProducer) { return json.str(); } -vespalib::string respond_json_metrics(const vespalib::string &consumer, +std::string respond_json_metrics(const std::string &consumer, const HealthProducer &healthProducer, MetricsProducer &metricsProducer) { @@ -108,7 +108,7 @@ vespalib::string respond_json_metrics(const vespalib::string &consumer, json.beginObject(); build_health_status(json, healthProducer); { // metrics - vespalib::string metrics = metricsProducer.getMetrics(consumer, MetricsProducer::ExpositionFormat::JSON); + std::string metrics = metricsProducer.getMetrics(consumer, MetricsProducer::ExpositionFormat::JSON); if (!metrics.empty()) { json.appendKey("metrics"); json.appendJSON(metrics); @@ -120,9 +120,9 @@ vespalib::string respond_json_metrics(const vespalib::string &consumer, JsonGetHandler::Response cap_check_and_respond_metrics( const net::ConnectionAuthContext &auth_ctx, - const std::map ¶ms, - const vespalib::string& default_consumer, - std::function response_fn) + const std::map ¶ms, + const std::string& default_consumer, + std::function response_fn) { if (!auth_ctx.capabilities().contains(Capability::content_metrics_api())) { return JsonGetHandler::Response::make_failure(403, "Forbidden"); @@ -134,7 +134,7 @@ JsonGetHandler::Response cap_check_and_respond_metrics( return response_fn(consumer, format); } -vespalib::string respond_config(ComponentConfigProducer &componentConfigProducer) { +std::string respond_config(ComponentConfigProducer &componentConfigProducer) { JSONStringer json; json.beginObject(); { // config @@ -156,7 +156,7 @@ vespalib::string respond_config(ComponentConfigProducer &componentConfigProducer JsonGetHandler::Response cap_checked(const net::ConnectionAuthContext &auth_ctx, CapabilitySet required_caps, - std::function fn) + std::function fn) { if (!auth_ctx.capabilities().contains_all(required_caps)) { return JsonGetHandler::Response::make_failure(403, "Forbidden"); @@ -166,7 +166,7 @@ JsonGetHandler::Response cap_checked(const net::ConnectionAuthContext &auth_ctx, JsonGetHandler::Response cap_checked(const net::ConnectionAuthContext &auth_ctx, Capability required_cap, - std::function fn) + std::function fn) { return cap_checked(auth_ctx, CapabilitySet::of({required_cap}), std::move(fn)); } @@ -178,9 +178,9 @@ constexpr const char* prometheus_content_type() noexcept { } // namespace vespalib:: JsonGetHandler::Response -StateApi::get(const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms, +StateApi::get(const std::string &host, + const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const { if (path == "/state/v1/" || path == "/state/v1") { diff --git a/vespalib/src/vespa/vespalib/net/http/state_api.h b/vespalib/src/vespa/vespalib/net/http/state_api.h index 9d4b9faf1142..0a21222723e6 100644 --- a/vespalib/src/vespa/vespalib/net/http/state_api.h +++ b/vespalib/src/vespa/vespalib/net/http/state_api.h @@ -30,9 +30,9 @@ class StateApi : public JsonGetHandler MetricsProducer &mp, ComponentConfigProducer &ccp); ~StateApi() override; - Response get(const vespalib::string &host, - const vespalib::string &path, - const std::map ¶ms, + Response get(const std::string &host, + const std::string &path, + const std::map ¶ms, const net::ConnectionAuthContext &auth_ctx) const override; JsonHandlerRepo &repo() { return _handler_repo; } }; diff --git a/vespalib/src/vespa/vespalib/net/http/state_explorer.cpp b/vespalib/src/vespa/vespalib/net/http/state_explorer.cpp index dc2934a3b35d..90608611245d 100644 --- a/vespalib/src/vespa/vespalib/net/http/state_explorer.cpp +++ b/vespalib/src/vespa/vespalib/net/http/state_explorer.cpp @@ -4,10 +4,10 @@ namespace vespalib { -std::vector +std::vector StateExplorer::get_children_names() const { - return std::vector(); + return std::vector(); } std::unique_ptr diff --git a/vespalib/src/vespa/vespalib/net/http/state_explorer.h b/vespalib/src/vespa/vespalib/net/http/state_explorer.h index f8168043ea89..efc0b4984ceb 100644 --- a/vespalib/src/vespa/vespalib/net/http/state_explorer.h +++ b/vespalib/src/vespa/vespalib/net/http/state_explorer.h @@ -2,10 +2,10 @@ #pragma once -#include #include -#include #include +#include +#include namespace vespalib { @@ -14,7 +14,7 @@ namespace vespalib { */ struct StateExplorer { virtual void get_state(const slime::Inserter &inserter, bool full) const = 0; - virtual std::vector get_children_names() const; + virtual std::vector get_children_names() const; virtual std::unique_ptr get_child(std::string_view name) const; virtual ~StateExplorer(); }; diff --git a/vespalib/src/vespa/vespalib/net/server_socket.cpp b/vespalib/src/vespa/vespalib/net/server_socket.cpp index 7f98c423bafa..d31d3f0734a0 100644 --- a/vespalib/src/vespa/vespalib/net/server_socket.cpp +++ b/vespalib/src/vespa/vespalib/net/server_socket.cpp @@ -25,7 +25,7 @@ SocketHandle adjust_blocking(SocketHandle handle, bool value) { bool is_blocked(int err) { return ((err == EWOULDBLOCK) || (err == EAGAIN)); } -bool is_socket(const vespalib::string &path) { +bool is_socket(const std::string &path) { struct stat info; if (path.empty() || (lstat(path.c_str(), &info) != 0)) { return false; @@ -61,7 +61,7 @@ ServerSocket::ServerSocket(const SocketSpec &spec) } } -ServerSocket::ServerSocket(const vespalib::string &spec) +ServerSocket::ServerSocket(const std::string &spec) : ServerSocket(SocketSpec(spec)) { } diff --git a/vespalib/src/vespa/vespalib/net/server_socket.h b/vespalib/src/vespa/vespalib/net/server_socket.h index 3dade78ddcc7..41587e54003d 100644 --- a/vespalib/src/vespa/vespalib/net/server_socket.h +++ b/vespalib/src/vespa/vespalib/net/server_socket.h @@ -14,7 +14,7 @@ class ServerSocket { private: SocketHandle _handle; - vespalib::string _path; + std::string _path; bool _blocking; std::atomic _shutdown; @@ -22,7 +22,7 @@ class ServerSocket public: ServerSocket() : _handle(), _path(), _blocking(false), _shutdown(false) {} explicit ServerSocket(const SocketSpec &spec); - explicit ServerSocket(const vespalib::string &spec); + explicit ServerSocket(const std::string &spec); explicit ServerSocket(int port); ServerSocket(ServerSocket &&rhs); ServerSocket &operator=(ServerSocket &&rhs); diff --git a/vespalib/src/vespa/vespalib/net/socket_address.cpp b/vespalib/src/vespa/vespalib/net/socket_address.cpp index b5b19fc01485..4a43573a6d5c 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_address.cpp @@ -55,10 +55,10 @@ SocketAddress::is_abstract() const return result; } -vespalib::string +std::string SocketAddress::ip_address() const { - vespalib::string result; + std::string result; if (is_ipv4()) { char buf[INET_ADDRSTRLEN]; result = inet_ntop(AF_INET, &addr_in()->sin_addr, buf, sizeof(buf)); @@ -69,7 +69,7 @@ SocketAddress::ip_address() const return result; } -vespalib::string +std::string SocketAddress::reverse_lookup() const { std::vector result(4_Ki, '\0'); @@ -77,10 +77,10 @@ SocketAddress::reverse_lookup() const return &result[0]; } -vespalib::string +std::string SocketAddress::path() const { - vespalib::string result; + std::string result; if (is_ipc() && !is_abstract()) { const char *path_limit = (reinterpret_cast(addr_un()) + _size); const char *pos = &addr_un()->sun_path[0]; @@ -93,10 +93,10 @@ SocketAddress::path() const return result; } -vespalib::string +std::string SocketAddress::name() const { - vespalib::string result; + std::string result; if (is_ipc() && is_abstract()) { const char *path_limit = (reinterpret_cast(addr_un()) + _size); const char *pos = &addr_un()->sun_path[1]; @@ -129,7 +129,7 @@ SocketAddress::port() const return -1; } -vespalib::string +std::string SocketAddress::spec() const { if (is_wildcard()) { @@ -227,7 +227,7 @@ SocketAddress::resolve(int port, const char *node) { hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = (AI_PASSIVE | AI_NUMERICSERV | AI_ADDRCONFIG); - vespalib::string service = make_string("%d", port); + std::string service = make_string("%d", port); addrinfo *list = nullptr; if (getaddrinfo(node, service.c_str(), &hints, &list) == 0) { for (const addrinfo *info = list; info != nullptr; info = info->ai_next) { @@ -253,7 +253,7 @@ SocketAddress::select_remote(int port, const char *node) } SocketAddress -SocketAddress::from_path(const vespalib::string &path) +SocketAddress::from_path(const std::string &path) { SocketAddress result; sockaddr_un &addr_un = reinterpret_cast(result._addr); @@ -266,7 +266,7 @@ SocketAddress::from_path(const vespalib::string &path) } SocketAddress -SocketAddress::from_name(const vespalib::string &name) +SocketAddress::from_name(const std::string &name) { SocketAddress result; sockaddr_un &addr_un = reinterpret_cast(result._addr); @@ -295,10 +295,10 @@ SocketAddress::get_interfaces() return result; } -vespalib::string -SocketAddress::normalize(const vespalib::string &host_name) +std::string +SocketAddress::normalize(const std::string &host_name) { - vespalib::string result = host_name; + std::string result = host_name; addrinfo hints; memset(&hints, 0, sizeof(addrinfo)); hints.ai_family = AF_UNSPEC; diff --git a/vespalib/src/vespa/vespalib/net/socket_address.h b/vespalib/src/vespa/vespalib/net/socket_address.h index a070202ef2cc..533a7e011043 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.h +++ b/vespalib/src/vespa/vespalib/net/socket_address.h @@ -2,11 +2,12 @@ #pragma once -#include #include "socket_handle.h" -#include #include +#include #include +#include +#include struct sockaddr_in; struct sockaddr_in6; @@ -44,11 +45,11 @@ class SocketAddress bool is_wildcard() const; bool is_abstract() const; int port() const; - vespalib::string ip_address() const; - vespalib::string reverse_lookup() const; - vespalib::string path() const; - vespalib::string name() const; - vespalib::string spec() const; + std::string ip_address() const; + std::string reverse_lookup() const; + std::string path() const; + std::string name() const; + std::string spec() const; SocketHandle raw_socket() const; SocketHandle connect(const std::function &tweak) const; SocketHandle connect() const { return connect([](SocketHandle&) noexcept { return true; }); } @@ -75,10 +76,10 @@ class SocketAddress } return SocketAddress(); } - static SocketAddress from_path(const vespalib::string &path); - static SocketAddress from_name(const vespalib::string &name); + static SocketAddress from_path(const std::string &path); + static SocketAddress from_name(const std::string &name); static std::vector get_interfaces(); - static vespalib::string normalize(const vespalib::string &host_name); + static std::string normalize(const std::string &host_name); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/socket_spec.cpp b/vespalib/src/vespa/vespalib/net/socket_spec.cpp index b10a44b645a2..ed7979712342 100644 --- a/vespalib/src/vespa/vespalib/net/socket_spec.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_spec.cpp @@ -7,10 +7,10 @@ namespace vespalib { namespace { -const vespalib::string tcp_prefix("tcp/"); -const vespalib::string ipc_path_prefix("ipc/file:"); -const vespalib::string ipc_name_prefix("ipc/name:"); -const vespalib::string fallback_host("localhost"); +const std::string tcp_prefix("tcp/"); +const std::string ipc_path_prefix("ipc/file:"); +const std::string ipc_name_prefix("ipc/name:"); +const std::string fallback_host("localhost"); SocketAddress make_address(const char *node, int port, bool server) { if (server) { @@ -27,7 +27,7 @@ SocketAddress make_address(int port, bool server) { } // namespace vespalib:: -const vespalib::string SocketSpec::_empty; +const std::string SocketSpec::_empty; SocketAddress SocketSpec::address(bool server) const @@ -44,7 +44,7 @@ SocketSpec::address(bool server) const const SocketSpec SocketSpec::invalid; -SocketSpec::SocketSpec(const vespalib::string &spec) +SocketSpec::SocketSpec(const std::string &spec) : SocketSpec() { if (spec.starts_with(ipc_path_prefix)) { @@ -84,7 +84,7 @@ SocketSpec::SocketSpec(const vespalib::string &spec) } } -vespalib::string +std::string SocketSpec::spec() const { switch (_type) { @@ -103,7 +103,7 @@ SocketSpec::spec() const } SocketSpec -SocketSpec::replace_host(const vespalib::string &new_host) const +SocketSpec::replace_host(const std::string &new_host) const { if ((_type == Type::HOST_PORT) && !new_host.empty()) { return from_host_port(new_host, _port); @@ -111,7 +111,7 @@ SocketSpec::replace_host(const vespalib::string &new_host) const return SocketSpec(); } -const vespalib::string & +const std::string & SocketSpec::host_with_fallback() const { return (_type == Type::PORT) ? fallback_host : host(); diff --git a/vespalib/src/vespa/vespalib/net/socket_spec.h b/vespalib/src/vespa/vespalib/net/socket_spec.h index 217196e53461..cbfa34dd5996 100644 --- a/vespalib/src/vespa/vespalib/net/socket_spec.h +++ b/vespalib/src/vespa/vespalib/net/socket_spec.h @@ -2,8 +2,8 @@ #pragma once -#include #include "socket_address.h" +#include namespace vespalib { @@ -14,37 +14,37 @@ class SocketSpec { private: enum class Type { INVALID, PATH, NAME, HOST_PORT, PORT }; - static const vespalib::string _empty; + static const std::string _empty; Type _type; - vespalib::string _node; + std::string _node; int _port; SocketSpec() : _type(Type::INVALID), _node(), _port(-1) {} - SocketSpec(Type type, const vespalib::string &node, int port) + SocketSpec(Type type, const std::string &node, int port) : _type(type), _node(node), _port(port) {} SocketAddress address(bool server) const; public: static const SocketSpec invalid; - explicit SocketSpec(const vespalib::string &spec); - vespalib::string spec() const; - SocketSpec replace_host(const vespalib::string &new_host) const; - static SocketSpec from_path(const vespalib::string &path) { + explicit SocketSpec(const std::string &spec); + std::string spec() const; + SocketSpec replace_host(const std::string &new_host) const; + static SocketSpec from_path(const std::string &path) { return SocketSpec(Type::PATH, path, -1); } - static SocketSpec from_name(const vespalib::string &name) { + static SocketSpec from_name(const std::string &name) { return SocketSpec(Type::NAME, name, -1); } - static SocketSpec from_host_port(const vespalib::string &host, int port) { + static SocketSpec from_host_port(const std::string &host, int port) { return SocketSpec(Type::HOST_PORT, host, port); } static SocketSpec from_port(int port) { return SocketSpec(Type::PORT, "", port); } bool valid() const { return (_type != Type::INVALID); } - const vespalib::string &path() const { return (_type == Type::PATH) ? _node : _empty; } - const vespalib::string &name() const { return (_type == Type::NAME) ? _node : _empty; } - const vespalib::string &host() const { return (_type == Type::HOST_PORT) ? _node : _empty; } - const vespalib::string &host_with_fallback() const; + const std::string &path() const { return (_type == Type::PATH) ? _node : _empty; } + const std::string &name() const { return (_type == Type::NAME) ? _node : _empty; } + const std::string &host() const { return (_type == Type::HOST_PORT) ? _node : _empty; } + const std::string &host_with_fallback() const; int port() const { return _port; } SocketAddress client_address() const { return address(false); } SocketAddress server_address() const { return address(true); } diff --git a/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.cpp b/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.cpp index a082ff9599e2..7244765dfde3 100644 --- a/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.cpp @@ -18,13 +18,13 @@ namespace vespalib::net::tls { namespace { -std::shared_ptr tls_engine_from_config_file(const vespalib::string& config_file_path, +std::shared_ptr tls_engine_from_config_file(const std::string& config_file_path, AuthorizationMode authz_mode) { auto tls_opts = net::tls::read_options_from_json_file(config_file_path); return std::make_shared(*tls_opts, authz_mode); } -std::shared_ptr try_create_engine_from_tls_config(const vespalib::string& config_file_path, +std::shared_ptr try_create_engine_from_tls_config(const std::string& config_file_path, AuthorizationMode authz_mode) { try { return tls_engine_from_config_file(config_file_path, authz_mode); @@ -38,7 +38,7 @@ std::shared_ptr try_create_engine_from_tls_config(const vespali } // anonymous namespace -AutoReloadingTlsCryptoEngine::AutoReloadingTlsCryptoEngine(vespalib::string config_file_path, +AutoReloadingTlsCryptoEngine::AutoReloadingTlsCryptoEngine(std::string config_file_path, AuthorizationMode mode, TimeInterval reload_interval) : _authorization_mode(mode), diff --git a/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.h b/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.h index 7aaf4a0ccbf9..928b3689f2d8 100644 --- a/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.h +++ b/vespalib/src/vespa/vespalib/net/tls/auto_reloading_tls_crypto_engine.h @@ -4,11 +4,11 @@ #include #include -#include #include #include #include +#include #include namespace vespalib::net::tls { @@ -23,7 +23,7 @@ class AutoReloadingTlsCryptoEngine : public AbstractTlsCryptoEngine { std::condition_variable _thread_cond; mutable std::mutex _engine_mutex; bool _shutdown; - const vespalib::string _config_file_path; + const std::string _config_file_path; EngineSP _current_engine; // Access must be under _engine_mutex TimeInterval _reload_interval; std::thread _reload_thread; @@ -33,7 +33,7 @@ class AutoReloadingTlsCryptoEngine : public AbstractTlsCryptoEngine { std::chrono::steady_clock::time_point make_future_reload_time_point() const noexcept; public: - explicit AutoReloadingTlsCryptoEngine(vespalib::string config_file_path, + explicit AutoReloadingTlsCryptoEngine(std::string config_file_path, AuthorizationMode mode, TimeInterval reload_interval = std::chrono::seconds(3600)); ~AutoReloadingTlsCryptoEngine() override; diff --git a/vespalib/src/vespa/vespalib/net/tls/capability.cpp b/vespalib/src/vespa/vespalib/net/tls/capability.cpp index edce336eca4e..a05271f2fc2f 100644 --- a/vespalib/src/vespa/vespalib/net/tls/capability.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/capability.cpp @@ -54,14 +54,14 @@ std::string_view Capability::name() const noexcept { return capability_names[id_as_idx()]; } -string Capability::to_string() const { +std::string Capability::to_string() const { asciistream os; os << "Capability(" << name() << ')'; return os.str(); } -std::optional Capability::find_capability(const string& cap_name) noexcept { - static const hash_map name_to_cap({ +std::optional Capability::find_capability(const std::string& cap_name) noexcept { + static const hash_map name_to_cap({ {"vespa.none", none()}, {"vespa.http.unclassified", http_unclassified()}, {"vespa.restapi.unclassified", restapi_unclassified()}, diff --git a/vespalib/src/vespa/vespalib/net/tls/capability.h b/vespalib/src/vespa/vespalib/net/tls/capability.h index 3d646b32d009..9d1291b8a294 100644 --- a/vespalib/src/vespa/vespalib/net/tls/capability.h +++ b/vespalib/src/vespa/vespalib/net/tls/capability.h @@ -1,10 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include #include #include +#include #include #include @@ -90,9 +91,9 @@ class Capability { } std::string_view name() const noexcept; - string to_string() const; + std::string to_string() const; - static std::optional find_capability(const string& cap_name) noexcept; + static std::optional find_capability(const std::string& cap_name) noexcept; // The "none" capability is a sentinel value to allow mTLS handshakes to go through // but where no access is granted to any capability-checked API. Non-capability-checked diff --git a/vespalib/src/vespa/vespalib/net/tls/capability_env_config.cpp b/vespalib/src/vespa/vespalib/net/tls/capability_env_config.cpp index 982b8c443cbd..0cecaaed45d9 100644 --- a/vespalib/src/vespa/vespalib/net/tls/capability_env_config.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/capability_env_config.cpp @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "capability_env_config.h" -#include #include +#include #include LOG_SETUP(".vespalib.net.tls.capability_env_config"); @@ -13,7 +13,7 @@ namespace { CapabilityEnforcementMode parse_enforcement_mode_from_env() noexcept { const char* env = getenv("VESPA_TLS_CAPABILITIES_ENFORCEMENT_MODE"); - vespalib::string mode = env ? env : ""; + std::string mode = env ? env : ""; if (mode == "enforce") { return CapabilityEnforcementMode::Enforce; } else if (mode == "log_only") { diff --git a/vespalib/src/vespa/vespalib/net/tls/capability_set.cpp b/vespalib/src/vespa/vespalib/net/tls/capability_set.cpp index e27176548e65..c589160e3d30 100644 --- a/vespalib/src/vespa/vespalib/net/tls/capability_set.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/capability_set.cpp @@ -8,7 +8,7 @@ namespace vespalib::net::tls { -string CapabilitySet::to_string() const { +std::string CapabilitySet::to_string() const { asciistream os; os << "CapabilitySet({"; bool emit_comma = false; @@ -25,8 +25,8 @@ string CapabilitySet::to_string() const { return os.str(); } -std::optional CapabilitySet::find_capability_set(const string& cap_set_name) noexcept { - static const hash_map name_to_cap_set({ +std::optional CapabilitySet::find_capability_set(const std::string& cap_set_name) noexcept { + static const hash_map name_to_cap_set({ {"vespa.all", all()}, {"vespa.content_node", content_node()}, {"vespa.container_node", container_node()}, @@ -39,7 +39,7 @@ std::optional CapabilitySet::find_capability_set(const string& ca return (iter != name_to_cap_set.end()) ? std::optional(iter->second) : std::nullopt; } -bool CapabilitySet::resolve_and_add(const string& set_or_cap_name) noexcept { +bool CapabilitySet::resolve_and_add(const std::string& set_or_cap_name) noexcept { if (auto cap_set = find_capability_set(set_or_cap_name)) { _capability_mask |= cap_set->_capability_mask; return true; diff --git a/vespalib/src/vespa/vespalib/net/tls/capability_set.h b/vespalib/src/vespa/vespalib/net/tls/capability_set.h index 5dcafe96b93f..dd0932196c39 100644 --- a/vespalib/src/vespa/vespalib/net/tls/capability_set.h +++ b/vespalib/src/vespa/vespalib/net/tls/capability_set.h @@ -2,12 +2,12 @@ #pragma once #include "capability.h" -#include #include #include #include #include #include +#include #include namespace vespalib { class asciistream; } @@ -42,7 +42,7 @@ class CapabilitySet { constexpr CapabilitySet() noexcept = default; constexpr ~CapabilitySet() = default; - [[nodiscard]] string to_string() const; + [[nodiscard]] std::string to_string() const; [[nodiscard]] bool operator==(const CapabilitySet& rhs) const noexcept { return (_capability_mask == rhs._capability_mask); @@ -93,9 +93,9 @@ class CapabilitySet { * capability to our own working set. Return true. * 3. Otherwise, return false. */ - [[nodiscard]] bool resolve_and_add(const string& set_or_cap_name) noexcept; + [[nodiscard]] bool resolve_and_add(const std::string& set_or_cap_name) noexcept; - [[nodiscard]] static std::optional find_capability_set(const string& cap_set_name) noexcept; + [[nodiscard]] static std::optional find_capability_set(const std::string& cap_set_name) noexcept; [[nodiscard]] static CapabilitySet of(std::initializer_list caps) noexcept { CapabilitySet set; diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.cpp b/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.cpp index e04d7070bd4c..783a0e48e463 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.cpp @@ -40,9 +40,9 @@ const char* iana_cipher_suite_to_openssl(std::string_view iana_name) { return ((iter != ciphers.end()) ? iter->second.data() : nullptr); } -std::vector modern_iana_cipher_suites() { +std::vector modern_iana_cipher_suites() { const auto& ciphers = modern_cipher_suites_iana_to_openssl(); - std::vector iana_cipher_names; + std::vector iana_cipher_names; iana_cipher_names.reserve(ciphers.size()); for (const auto& cipher : ciphers) { iana_cipher_names.emplace_back(cipher.first); diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.h b/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.h index 31efa3c31341..ba2c0cc4ccf9 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.h +++ b/vespalib/src/vespa/vespalib/net/tls/impl/iana_cipher_map.h @@ -1,8 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include - +#include #include namespace vespalib::net::tls { @@ -20,6 +19,6 @@ const char* iana_cipher_suite_to_openssl(std::string_view iana_name); * It is guaranteed that any cipher suite name returned from this function will * have a non-nullptr return value from iana_cipher_suite_to_openssl(name). */ -std::vector modern_iana_cipher_suites(); +std::vector modern_iana_cipher_suites(); } diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.cpp b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.cpp index 8acf4f8c2df6..8af4ede60c1a 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.cpp @@ -155,10 +155,10 @@ BioPtr new_tls_frame_const_memory_bio() { return bio; } -vespalib::string ssl_error_from_stack() { +std::string ssl_error_from_stack() { char buf[256]; ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - return vespalib::string(buf); + return std::string(buf); } void log_ssl_error(const char* source, const SocketAddress& peer_address, int ssl_error) { @@ -258,7 +258,7 @@ void OpenSslCryptoCodecImpl::enable_hostname_validation_if_requested() { if (_peer_spec.valid() && !_ctx->transport_security_options().disable_hostname_validation()) { auto* verify_param = SSL_get0_param(_ssl.get()); // Internal ptr, no refcount bump or alloc. We must not free. LOG_ASSERT(verify_param != nullptr); - vespalib::string host = _peer_spec.host_with_fallback(); + std::string host = _peer_spec.host_with_fallback(); if (X509_VERIFY_PARAM_set1_host(verify_param, host.c_str(), host.size()) != 1) { throw CryptoException("X509_VERIFY_PARAM_set1_host() failed"); } @@ -268,7 +268,7 @@ void OpenSslCryptoCodecImpl::enable_hostname_validation_if_requested() { void OpenSslCryptoCodecImpl::set_server_name_indication_extension() { if (_peer_spec.valid()) { - vespalib::string host = _peer_spec.host_with_fallback(); + std::string host = _peer_spec.host_with_fallback(); // OpenSSL tries to cast const char* to void* in a macro, even on 1.1.1. GCC is not overly impressed, // so to satiate OpenSSL's quirks we pre-cast away the constness. auto* host_cstr_that_trusts_openssl_not_to_mess_up = const_cast(host.c_str()); @@ -278,7 +278,7 @@ void OpenSslCryptoCodecImpl::set_server_name_indication_extension() { } } -std::optional OpenSslCryptoCodecImpl::client_provided_sni_extension() const { +std::optional OpenSslCryptoCodecImpl::client_provided_sni_extension() const { if ((_mode != Mode::Server) || (SSL_get_servername_type(_ssl.get()) != TLSEXT_NAMETYPE_host_name)) { return {}; } @@ -286,7 +286,7 @@ std::optional OpenSslCryptoCodecImpl::client_provided_sni_exte if (sni_host_raw == nullptr) { return {}; } - return vespalib::string(sni_host_raw); + return std::string(sni_host_raw); } HandshakeResult OpenSslCryptoCodecImpl::handshake(const char* from_peer, size_t from_peer_buf_size, diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.h b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.h index 8010d13668c9..f86857b63bf0 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.h +++ b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_crypto_codec_impl.h @@ -113,7 +113,7 @@ class OpenSslCryptoCodecImpl : public CryptoCodec { * returns the raw string representation of this. It only makes sense to * call this for codecs in server mode. */ - std::optional client_provided_sni_extension() const; + std::optional client_provided_sni_extension() const; // Only used by code bridging OpenSSL certificate verification callbacks and // evaluation of custom authorization rules. diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp index 203609304295..86cc2b67e344 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp @@ -117,10 +117,10 @@ bool has_pem_eof_on_stack() { && (ERR_GET_REASON(err) == PEM_R_NO_START_LINE)); } -vespalib::string ssl_error_from_stack() { +std::string ssl_error_from_stack() { char buf[256]; ::ERR_error_string_n(::ERR_get_error(), buf, sizeof(buf)); - return vespalib::string(buf); + return std::string(buf); } // Several OpenSSL functions take a magical user passphrase argument with @@ -376,7 +376,7 @@ struct GeneralNamesDeleter { }; // Returns empty string if unsupported type or bad content. -vespalib::string get_ia5_string(const ASN1_IA5STRING* ia5_str) { +std::string get_ia5_string(const ASN1_IA5STRING* ia5_str) { if ((ia5_str->type == V_ASN1_IA5STRING) && (ia5_str->data != nullptr) && (ia5_str->length > 0)) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) const char* data = reinterpret_cast(::ASN1_STRING_get0_data(ia5_str)); @@ -509,8 +509,8 @@ void OpenSslTlsContextImpl::set_ssl_ctx_self_reference() { SSL_CTX_set_app_data(_ctx.get(), this); } -void OpenSslTlsContextImpl::set_accepted_cipher_suites(const std::vector& ciphers) { - vespalib::string openssl_ciphers; +void OpenSslTlsContextImpl::set_accepted_cipher_suites(const std::vector& ciphers) { + std::string openssl_ciphers; size_t bad_ciphers = 0; for (const auto& iana_cipher : ciphers) { auto our_cipher = iana_cipher_suite_to_openssl(iana_cipher); diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.h b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.h index 71b8054be140..3b3774a028fb 100644 --- a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.h +++ b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.h @@ -6,9 +6,8 @@ #include #include #include -#include - #include +#include namespace vespalib::net::tls::impl { @@ -47,7 +46,7 @@ class OpenSslTlsContextImpl : public TlsContext { void disable_session_resumption(); void enforce_peer_certificate_verification(); void set_ssl_ctx_self_reference(); - void set_accepted_cipher_suites(const std::vector& ciphers); + void set_accepted_cipher_suites(const std::vector& ciphers); bool verify_trusted_certificate(::X509_STORE_CTX* store_ctx, OpenSslCryptoCodecImpl& codec_impl); diff --git a/vespalib/src/vespa/vespalib/net/tls/peer_credentials.cpp b/vespalib/src/vespa/vespalib/net/tls/peer_credentials.cpp index 5243b01bc112..0934bd743b1f 100644 --- a/vespalib/src/vespa/vespalib/net/tls/peer_credentials.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/peer_credentials.cpp @@ -20,7 +20,7 @@ std::ostream& operator<<(std::ostream& os, const PeerCredentials& creds) { namespace { void emit_comma_separated_string_list(asciistream& os, std::string_view title, - const std::vector& strings, bool prefix_comma) + const std::vector& strings, bool prefix_comma) { if (prefix_comma) { os << ", "; @@ -36,7 +36,7 @@ void emit_comma_separated_string_list(asciistream& os, std::string_view title, } } -vespalib::string PeerCredentials::to_string() const { +std::string PeerCredentials::to_string() const { asciistream os; os << "PeerCredentials("; bool emit_comma = false; diff --git a/vespalib/src/vespa/vespalib/net/tls/peer_credentials.h b/vespalib/src/vespa/vespalib/net/tls/peer_credentials.h index 406b9b689172..87a5f746d498 100644 --- a/vespalib/src/vespa/vespalib/net/tls/peer_credentials.h +++ b/vespalib/src/vespa/vespalib/net/tls/peer_credentials.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include #include @@ -11,11 +11,11 @@ namespace vespalib::net::tls { struct PeerCredentials { // The last occurring (i.e. "most specific") CN present in the certificate, // or the empty string if no CN is given (or if the CN is curiously empty). - vespalib::string common_name; + std::string common_name; // 0-n DNS SAN entries. Note: "DNS:" prefix is not present in strings. - std::vector dns_sans; + std::vector dns_sans; // 0-n DNS URI entries. Note: "URI:" prefix is not present in strings. - std::vector uri_sans; + std::vector uri_sans; PeerCredentials(); PeerCredentials(const PeerCredentials&); @@ -24,7 +24,7 @@ struct PeerCredentials { PeerCredentials& operator=(PeerCredentials&&) noexcept; ~PeerCredentials(); - vespalib::string to_string() const; + std::string to_string() const; }; std::ostream& operator<<(std::ostream&, const PeerCredentials&); diff --git a/vespalib/src/vespa/vespalib/net/tls/peer_policies.cpp b/vespalib/src/vespa/vespalib/net/tls/peer_policies.cpp index ab2316b95427..d71775a931ca 100644 --- a/vespalib/src/vespa/vespalib/net/tls/peer_policies.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/peer_policies.cpp @@ -84,9 +84,9 @@ class RegexHostMatchPattern : public CredentialMatchPattern { }; class ExactMatchPattern : public CredentialMatchPattern { - vespalib::string _must_match_exactly; + std::string _must_match_exactly; public: - explicit ExactMatchPattern(std::string_view str_to_match) noexcept // vespalib::string ctors marked noexcept + explicit ExactMatchPattern(std::string_view str_to_match) noexcept // std::string ctors marked noexcept : _must_match_exactly(str_to_match) { } diff --git a/vespalib/src/vespa/vespalib/net/tls/peer_policies.h b/vespalib/src/vespa/vespalib/net/tls/peer_policies.h index 9756a3283613..b7b6e066f929 100644 --- a/vespalib/src/vespa/vespalib/net/tls/peer_policies.h +++ b/vespalib/src/vespa/vespalib/net/tls/peer_policies.h @@ -2,10 +2,10 @@ #pragma once #include "capability_set.h" -#include +#include #include +#include #include -#include namespace vespalib::net::tls { @@ -25,7 +25,7 @@ class RequiredPeerCredential { }; private: Field _field = Field::SAN_DNS; - vespalib::string _original_pattern; + std::string _original_pattern; std::shared_ptr _match_pattern; public: RequiredPeerCredential() = default; @@ -48,7 +48,7 @@ class RequiredPeerCredential { } [[nodiscard]] Field field() const noexcept { return _field; } - [[nodiscard]] const vespalib::string& original_pattern() const noexcept { return _original_pattern; } + [[nodiscard]] const std::string& original_pattern() const noexcept { return _original_pattern; } }; class PeerPolicy { diff --git a/vespalib/src/vespa/vespalib/net/tls/transport_security_options.cpp b/vespalib/src/vespa/vespalib/net/tls/transport_security_options.cpp index 6ebea954c4f3..e7d2919dc2b5 100644 --- a/vespalib/src/vespa/vespalib/net/tls/transport_security_options.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/transport_security_options.cpp @@ -16,9 +16,9 @@ TransportSecurityOptions::TransportSecurityOptions(Params params) { } -TransportSecurityOptions::TransportSecurityOptions(vespalib::string ca_certs_pem, - vespalib::string cert_chain_pem, - vespalib::string private_key_pem, +TransportSecurityOptions::TransportSecurityOptions(std::string ca_certs_pem, + std::string cert_chain_pem, + std::string private_key_pem, AuthorizedPeers authorized_peers, bool disable_hostname_validation) : _ca_certs_pem(std::move(ca_certs_pem)), diff --git a/vespalib/src/vespa/vespalib/net/tls/transport_security_options.h b/vespalib/src/vespa/vespalib/net/tls/transport_security_options.h index ba08c8ebc9d8..5a7d6a7b10d6 100644 --- a/vespalib/src/vespa/vespalib/net/tls/transport_security_options.h +++ b/vespalib/src/vespa/vespalib/net/tls/transport_security_options.h @@ -9,19 +9,19 @@ namespace vespalib::net::tls { class TransportSecurityOptions { - vespalib::string _ca_certs_pem; - vespalib::string _cert_chain_pem; - vespalib::string _private_key_pem; + std::string _ca_certs_pem; + std::string _cert_chain_pem; + std::string _private_key_pem; AuthorizedPeers _authorized_peers; - std::vector _accepted_ciphers; + std::vector _accepted_ciphers; bool _disable_hostname_validation; public: struct Params { - vespalib::string _ca_certs_pem; - vespalib::string _cert_chain_pem; - vespalib::string _private_key_pem; + std::string _ca_certs_pem; + std::string _cert_chain_pem; + std::string _private_key_pem; AuthorizedPeers _authorized_peers; - std::vector _accepted_ciphers; + std::vector _accepted_ciphers; bool _disable_hostname_validation; Params(); @@ -35,7 +35,7 @@ class TransportSecurityOptions { Params& cert_chain_pem(std::string_view pem) { _cert_chain_pem = pem; return *this; } Params& private_key_pem(std::string_view pem) { _private_key_pem = pem; return *this; } Params& authorized_peers(AuthorizedPeers auth) { _authorized_peers = std::move(auth); return *this; } - Params& accepted_ciphers(std::vector ciphers) { + Params& accepted_ciphers(std::vector ciphers) { _accepted_ciphers = std::move(ciphers); return *this; } @@ -53,19 +53,19 @@ class TransportSecurityOptions { ~TransportSecurityOptions(); - const vespalib::string& ca_certs_pem() const noexcept { return _ca_certs_pem; } - const vespalib::string& cert_chain_pem() const noexcept { return _cert_chain_pem; } - const vespalib::string& private_key_pem() const noexcept { return _private_key_pem; } + const std::string& ca_certs_pem() const noexcept { return _ca_certs_pem; } + const std::string& cert_chain_pem() const noexcept { return _cert_chain_pem; } + const std::string& private_key_pem() const noexcept { return _private_key_pem; } const AuthorizedPeers& authorized_peers() const noexcept { return _authorized_peers; } TransportSecurityOptions copy_without_private_key() const; - const std::vector& accepted_ciphers() const noexcept { return _accepted_ciphers; } + const std::vector& accepted_ciphers() const noexcept { return _accepted_ciphers; } bool disable_hostname_validation() const noexcept { return _disable_hostname_validation; } private: - TransportSecurityOptions(vespalib::string ca_certs_pem, - vespalib::string cert_chain_pem, - vespalib::string private_key_pem, + TransportSecurityOptions(std::string ca_certs_pem, + std::string cert_chain_pem, + std::string private_key_pem, AuthorizedPeers authorized_peers, bool disable_hostname_validation); }; diff --git a/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.cpp b/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.cpp index 676c1073b025..9cffa188d760 100644 --- a/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.cpp @@ -39,13 +39,13 @@ using namespace slime::convenience; namespace { -void verify_referenced_file_exists(const vespalib::string& file_path) { +void verify_referenced_file_exists(const std::string& file_path) { if (!std::filesystem::exists(std::filesystem::path(file_path))) { throw IllegalArgumentException(make_string("File '%s' referenced by TLS config does not exist", file_path.c_str())); } } -vespalib::string load_file_referenced_by_field(const Inspector& cursor, const char* field) { +std::string load_file_referenced_by_field(const Inspector& cursor, const char* field) { auto file_path = cursor[field].asString().make_string(); if (file_path.empty()) { throw IllegalArgumentException(make_string("TLS config field '%s' has not been set", field)); @@ -123,11 +123,11 @@ AuthorizedPeers parse_authorized_peers(const Inspector& authorized_peers) { return AuthorizedPeers(std::move(policies)); } -std::vector parse_accepted_ciphers(const Inspector& accepted_ciphers) { +std::vector parse_accepted_ciphers(const Inspector& accepted_ciphers) { if (!accepted_ciphers.valid()) { return {}; } - std::vector ciphers; + std::vector ciphers; for (size_t i = 0; i < accepted_ciphers.children(); ++i) { ciphers.emplace_back(accepted_ciphers[i].asString().make_string()); } @@ -173,12 +173,12 @@ std::unique_ptr load_from_input(Input& input) { } // anon ns -std::unique_ptr read_options_from_json_string(const vespalib::string& json_data) { +std::unique_ptr read_options_from_json_string(const std::string& json_data) { MemoryInput file_input(json_data); return load_from_input(file_input); } -std::unique_ptr read_options_from_json_file(const vespalib::string& file_path) { +std::unique_ptr read_options_from_json_file(const std::string& file_path) { MappedFileInput file_input(file_path); if (!file_input.valid()) { throw IllegalArgumentException(make_string("TLS config file '%s' could not be read", file_path.c_str())); diff --git a/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.h b/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.h index 3f24c2f429db..f21c55f98f47 100644 --- a/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.h +++ b/vespalib/src/vespa/vespalib/net/tls/transport_security_options_reading.h @@ -13,8 +13,8 @@ namespace vespalib::net::tls { * Throws IllegalArgumentException if file is not parseable as a valid TLS config file or * if mandatory JSON fields are missing or incomplete. */ -std::unique_ptr read_options_from_json_file(const vespalib::string& file_path); +std::unique_ptr read_options_from_json_file(const std::string& file_path); // Same properties as read_options_from_json_file() -std::unique_ptr read_options_from_json_string(const vespalib::string& json_data); +std::unique_ptr read_options_from_json_string(const std::string& json_data); } diff --git a/vespalib/src/vespa/vespalib/net/tls/verification_result.cpp b/vespalib/src/vespa/vespalib/net/tls/verification_result.cpp index 3b2abc4d5b18..c5d0129a18f0 100644 --- a/vespalib/src/vespa/vespalib/net/tls/verification_result.cpp +++ b/vespalib/src/vespa/vespalib/net/tls/verification_result.cpp @@ -57,7 +57,7 @@ std::ostream& operator<<(std::ostream& os, const VerificationResult& res) { return os; } -string +std::string to_string(const VerificationResult& res) { asciistream os; os << res; diff --git a/vespalib/src/vespa/vespalib/net/tls/verification_result.h b/vespalib/src/vespa/vespalib/net/tls/verification_result.h index 7c694813e0fc..ab44c4902941 100644 --- a/vespalib/src/vespa/vespalib/net/tls/verification_result.h +++ b/vespalib/src/vespa/vespalib/net/tls/verification_result.h @@ -2,8 +2,8 @@ #pragma once #include "capability_set.h" -#include #include +#include namespace vespalib { class asciistream; } @@ -52,6 +52,6 @@ class VerificationResult { asciistream& operator<<(asciistream&, const VerificationResult&); std::ostream& operator<<(std::ostream&, const VerificationResult&); -string to_string(const VerificationResult&); +std::string to_string(const VerificationResult&); } diff --git a/vespalib/src/vespa/vespalib/objects/deserializer.h b/vespalib/src/vespa/vespalib/objects/deserializer.h index bc69bfbacfc1..81f5388c3d50 100644 --- a/vespalib/src/vespa/vespalib/objects/deserializer.h +++ b/vespalib/src/vespa/vespalib/objects/deserializer.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include +#include namespace vespalib { @@ -20,7 +20,7 @@ class Deserializer virtual Deserializer & get(uint64_t & value) = 0; virtual Deserializer & get(double & value) = 0; virtual Deserializer & get(float & value) = 0; - virtual Deserializer & get(string & value) = 0; + virtual Deserializer & get(std::string & value) = 0; virtual Deserializer & get(Identifiable & value); virtual Deserializer & get(int8_t & value); @@ -40,7 +40,7 @@ class Deserializer Deserializer & operator >> (int64_t & value) { return get(value); } Deserializer & operator >> (float & value) { return get(value); } Deserializer & operator >> (double & value) { return get(value); } - Deserializer & operator >> (string & value) { return get(value); } + Deserializer & operator >> (std::string & value) { return get(value); } template Deserializer & operator >> (std::vector & v); }; diff --git a/vespalib/src/vespa/vespalib/objects/hexdump.cpp b/vespalib/src/vespa/vespalib/objects/hexdump.cpp index 6d1216fc0097..bda11a8b756e 100644 --- a/vespalib/src/vespa/vespalib/objects/hexdump.cpp +++ b/vespalib/src/vespa/vespalib/objects/hexdump.cpp @@ -11,7 +11,7 @@ namespace { } -string +std::string HexDump::toString() const { asciistream os; os << *this; diff --git a/vespalib/src/vespa/vespalib/objects/hexdump.h b/vespalib/src/vespa/vespalib/objects/hexdump.h index e68889cd2d7d..6fa2825e1b3d 100644 --- a/vespalib/src/vespa/vespalib/objects/hexdump.h +++ b/vespalib/src/vespa/vespalib/objects/hexdump.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { @@ -14,7 +14,7 @@ class HexDump { public: HexDump(const void * buf, size_t sz) : _buf(buf), _sz(sz) { } - vespalib::string toString() const; + std::string toString() const; friend std::ostream & operator << (std::ostream & os, const HexDump & hd); friend asciistream & operator << (asciistream & os, const HexDump & hd); private: diff --git a/vespalib/src/vespa/vespalib/objects/identifiable.cpp b/vespalib/src/vespa/vespalib/objects/identifiable.cpp index d56e47635b2f..dbc20b20e3d3 100644 --- a/vespalib/src/vespa/vespalib/objects/identifiable.cpp +++ b/vespalib/src/vespa/vespalib/objects/identifiable.cpp @@ -226,13 +226,13 @@ Identifiable::create(Deserializer & is) return obj; } -string +std::string Identifiable::getNativeClassName() const { return vespalib::getClassName(*this); } -string +std::string Identifiable::asString() const { ObjectDumper dumper; diff --git a/vespalib/src/vespa/vespalib/objects/identifiable.h b/vespalib/src/vespa/vespalib/objects/identifiable.h index b012fc2ee45b..f0882ef627ee 100644 --- a/vespalib/src/vespa/vespalib/objects/identifiable.h +++ b/vespalib/src/vespa/vespalib/objects/identifiable.h @@ -195,7 +195,7 @@ class Identifiable { /** * Will produce the full demangled className */ - string getNativeClassName() const; + std::string getNativeClassName() const; /** * This returns the innermost class that you represent. Default is that that is yourself. @@ -267,7 +267,7 @@ class Identifiable { * * @return structured human-readable representation of this object **/ - string asString() const; + std::string asString() const; /** * Visit each of the members of this object. This method should be diff --git a/vespalib/src/vespa/vespalib/objects/nboserializer.cpp b/vespalib/src/vespa/vespalib/objects/nboserializer.cpp index 6b257de429c9..7270daad4801 100644 --- a/vespalib/src/vespa/vespalib/objects/nboserializer.cpp +++ b/vespalib/src/vespa/vespalib/objects/nboserializer.cpp @@ -84,7 +84,7 @@ NBOSerializer &NBOSerializer::get(float & value) { return *this; } -NBOSerializer &NBOSerializer::get(string & value) { +NBOSerializer &NBOSerializer::get(std::string & value) { _stream >> value; return *this; } diff --git a/vespalib/src/vespa/vespalib/objects/nboserializer.h b/vespalib/src/vespa/vespalib/objects/nboserializer.h index 96e8fa8a0746..77e63891bb8b 100644 --- a/vespalib/src/vespa/vespalib/objects/nboserializer.h +++ b/vespalib/src/vespa/vespalib/objects/nboserializer.h @@ -27,7 +27,7 @@ class NBOSerializer : public Serializer, public Deserializer { NBOSerializer &get(uint64_t &value) override; NBOSerializer &get(double &value) override; NBOSerializer &get(float &value) override; - NBOSerializer &get(string &value) override; + NBOSerializer &get(std::string &value) override; const char *peek() const; diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h index 8b699ffc0a58..1bc9efd49ada 100644 --- a/vespalib/src/vespa/vespalib/objects/nbostream.h +++ b/vespalib/src/vespa/vespalib/objects/nbostream.h @@ -2,10 +2,10 @@ #pragma once #include "nbo.h" -#include #include #include #include +#include #include namespace vespalib { @@ -63,8 +63,8 @@ class nbostream nbostream & operator >> (bool & v) { read1(&v); return *this; } nbostream & operator << (const char * v) { uint32_t sz(strlen(v)); (*this) << sz; write(v, sz); return *this; } nbostream & operator << (std::string_view v) { uint32_t sz(v.size()); (*this) << sz; write(v.data(), sz); return *this; } - nbostream & operator << (const vespalib::string & v) { uint32_t sz(v.size()); (*this) << sz; write(v.c_str(), sz); return *this; } - nbostream & operator >> (vespalib::string & v) { + nbostream & operator << (const std::string & v) { uint32_t sz(v.size()); (*this) << sz; write(v.c_str(), sz); return *this; } + nbostream & operator >> (std::string & v) { uint32_t sz; (*this) >> sz; if (__builtin_expect(left() >= sz, true)) { v.assign(&_rbuf[_rp], sz); @@ -174,7 +174,7 @@ class nbostream putInt1_4Bytes(value.size()); write(value.data(), value.size()); } - void readSmallString(vespalib::string &value) { + void readSmallString(std::string &value) { size_t strSize = getInt1_4Bytes(); const char *cstr = peek(); value.assign(cstr, strSize); diff --git a/vespalib/src/vespa/vespalib/objects/objectdumper.cpp b/vespalib/src/vespa/vespalib/objects/objectdumper.cpp index 6baf9b046124..6c5705cacccb 100644 --- a/vespalib/src/vespa/vespalib/objects/objectdumper.cpp +++ b/vespalib/src/vespa/vespalib/objects/objectdumper.cpp @@ -1,10 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "objectdumper.h" +#include #include namespace vespalib { -using string = vespalib::string; +using string = std::string; void ObjectDumper::addIndent() diff --git a/vespalib/src/vespa/vespalib/objects/objectdumper.h b/vespalib/src/vespa/vespalib/objects/objectdumper.h index 5e16a077d6b7..bd846ec5f59b 100644 --- a/vespalib/src/vespa/vespalib/objects/objectdumper.h +++ b/vespalib/src/vespa/vespalib/objects/objectdumper.h @@ -12,7 +12,7 @@ namespace vespalib { class ObjectDumper : public ObjectVisitor { private: - vespalib::string _str; + std::string _str; int _indent; int _currIndent; @@ -29,7 +29,7 @@ class ObjectDumper : public ObjectVisitor * * @param line the line we want to add **/ - void addLine(const vespalib::string &line); + void addLine(const std::string &line); /** * Open a subscope by increasing the current indent level @@ -58,7 +58,7 @@ class ObjectDumper : public ObjectVisitor * * @return object string representation **/ - const vespalib::string & toString() const { return _str; } + const std::string & toString() const { return _str; } void openStruct(std::string_view name, std::string_view type) override; void closeStruct() override; diff --git a/vespalib/src/vespa/vespalib/objects/objectvisitor.h b/vespalib/src/vespa/vespalib/objects/objectvisitor.h index c1af290c580b..3d4fb2457740 100644 --- a/vespalib/src/vespa/vespalib/objects/objectvisitor.h +++ b/vespalib/src/vespa/vespalib/objects/objectvisitor.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/objects/serializer.h b/vespalib/src/vespa/vespalib/objects/serializer.h index 5bacdcfbb59e..bfad1660df93 100644 --- a/vespalib/src/vespa/vespalib/objects/serializer.h +++ b/vespalib/src/vespa/vespalib/objects/serializer.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/objects/visit.h b/vespalib/src/vespa/vespalib/objects/visit.h index a9d2aa6eb755..4233b68db79e 100644 --- a/vespalib/src/vespa/vespalib/objects/visit.h +++ b/vespalib/src/vespa/vespalib/objects/visit.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { class Identifiable; diff --git a/vespalib/src/vespa/vespalib/portal/http_connection.h b/vespalib/src/vespa/vespalib/portal/http_connection.h index 2af14c07fa3e..7ec22c9f16f9 100644 --- a/vespalib/src/vespa/vespalib/portal/http_connection.h +++ b/vespalib/src/vespa/vespalib/portal/http_connection.h @@ -48,7 +48,7 @@ class HttpConnection : public Reactor::EventHandler ~HttpConnection(); void handle_event(bool read, bool write) override; State get_state() const { return _state; } - void resolve_host(const vespalib::string &my_host) { _request.resolve_host(my_host); } + void resolve_host(const std::string &my_host) { _request.resolve_host(my_host); } const HttpRequest &get_request() const { return _request; } // Precondition: handshake must have been completed const net::ConnectionAuthContext &auth_context() const noexcept { return *_auth_ctx; } diff --git a/vespalib/src/vespa/vespalib/portal/http_request.cpp b/vespalib/src/vespa/vespalib/portal/http_request.cpp index 6e488ff4539c..b931bd1ca894 100644 --- a/vespalib/src/vespa/vespalib/portal/http_request.cpp +++ b/vespalib/src/vespa/vespalib/portal/http_request.cpp @@ -10,15 +10,15 @@ namespace vespalib::portal { namespace { -void strip_cr(vespalib::string &str) { +void strip_cr(std::string &str) { if (!str.empty() && str[str.size() - 1] == '\r') { str.resize(str.size() - 1); } } -std::vector split(std::string_view str, char sep) { - vespalib::string token; - std::vector list; +std::vector split(std::string_view str, char sep) { + std::string token; + std::vector list; for (char c: str) { if (c != sep) { token.push_back(c); @@ -58,8 +58,8 @@ int decode_hex_num(std::string_view src, size_t idx) { return ((a << 4) | b); } -vespalib::string dequote(std::string_view src) { - vespalib::string dst; +std::string dequote(std::string_view src) { + std::string dst; for (size_t idx = 0; idx < src.size(); ++idx) { char c = src[idx]; if (c == '+') { @@ -91,7 +91,7 @@ HttpRequest::set_error() } void -HttpRequest::handle_request_line(const vespalib::string &line) +HttpRequest::handle_request_line(const std::string &line) { auto parts = split(line, ' '); if (parts.size() != 3) { @@ -101,14 +101,14 @@ HttpRequest::handle_request_line(const vespalib::string &line) _uri = parts[1]; _version = parts[2]; size_t query_sep = _uri.find("?"); - if (query_sep == vespalib::string::npos) { + if (query_sep == std::string::npos) { _path = dequote(_uri); } else { _path = dequote(_uri.substr(0, query_sep)); auto query = split(_uri.substr(query_sep + 1), '&'); for (const auto ¶m: query) { size_t value_sep = param.find("="); - if (value_sep == vespalib::string::npos) { + if (value_sep == std::string::npos) { _params[dequote(param)] = ""; } else { auto key = param.substr(0, value_sep); @@ -120,7 +120,7 @@ HttpRequest::handle_request_line(const vespalib::string &line) } void -HttpRequest::handle_header_line(const vespalib::string &line) +HttpRequest::handle_header_line(const std::string &line) { if (line.empty()) { return set_done(); @@ -130,7 +130,7 @@ HttpRequest::handle_header_line(const vespalib::string &line) bool continuation = (line[0] == ' ') || (line[0] == '\t'); if (!continuation) { pos = line.find(":"); - if (pos == vespalib::string::npos) { + if (pos == std::string::npos) { return set_error(); // missing header: value separator } else { _header_name.assign(line, 0, pos++); @@ -147,9 +147,9 @@ HttpRequest::handle_header_line(const vespalib::string &line) while ((pos < end) && (std::isspace(static_cast(line[end - 1])))) { --end; // strip trailing whitespace } - auto header_insert_result = _headers.insert(std::make_pair(_header_name, vespalib::string())); + auto header_insert_result = _headers.insert(std::make_pair(_header_name, std::string())); bool header_found = !header_insert_result.second; - vespalib::string &header_value = header_insert_result.first->second; + std::string &header_value = header_insert_result.first->second; if (header_found) { if (continuation) { header_value.push_back(' '); @@ -161,7 +161,7 @@ HttpRequest::handle_header_line(const vespalib::string &line) } void -HttpRequest::handle_line(const vespalib::string &line) +HttpRequest::handle_line(const std::string &line) { if (_first) { handle_request_line(line); @@ -206,7 +206,7 @@ HttpRequest::handle_data(const char *buf, size_t len) } void -HttpRequest::resolve_host(const vespalib::string &my_host) +HttpRequest::resolve_host(const std::string &my_host) { _host = get_header("host"); if (_host.empty()) { @@ -214,8 +214,8 @@ HttpRequest::resolve_host(const vespalib::string &my_host) } } -const vespalib::string & -HttpRequest::get_header(const vespalib::string &name) const +const std::string & +HttpRequest::get_header(const std::string &name) const { auto pos = _headers.find(name); if (pos == _headers.end()) { @@ -225,13 +225,13 @@ HttpRequest::get_header(const vespalib::string &name) const } bool -HttpRequest::has_param(const vespalib::string &name) const +HttpRequest::has_param(const std::string &name) const { return (_params.find(name) != _params.end()); } -const vespalib::string & -HttpRequest::get_param(const vespalib::string &name) const +const std::string & +HttpRequest::get_param(const std::string &name) const { auto pos = _params.find(name); if (pos == _params.end()) { diff --git a/vespalib/src/vespa/vespalib/portal/http_request.h b/vespalib/src/vespa/vespalib/portal/http_request.h index a8198ceb9d2d..aac72af7c2af 100644 --- a/vespalib/src/vespa/vespalib/portal/http_request.h +++ b/vespalib/src/vespa/vespalib/portal/http_request.h @@ -2,9 +2,8 @@ #pragma once -#include - #include +#include namespace vespalib::portal { @@ -12,27 +11,27 @@ class HttpRequest { private: // http stuff - vespalib::string _method; - vespalib::string _uri; - vespalib::string _path; - std::map _params; - vespalib::string _version; - std::map _headers; - vespalib::string _host; + std::string _method; + std::string _uri; + std::string _path; + std::map _params; + std::string _version; + std::map _headers; + std::string _host; // internal state - vespalib::string _empty; + std::string _empty; bool _first; bool _done; bool _error; - vespalib::string _header_name; - vespalib::string _line_buffer; + std::string _header_name; + std::string _line_buffer; void set_done(); void set_error(); - void handle_request_line(const vespalib::string &line); - void handle_header_line(const vespalib::string &line); - void handle_line(const vespalib::string &line); + void handle_request_line(const std::string &line); + void handle_header_line(const std::string &line); + void handle_line(const std::string &line); public: HttpRequest(); @@ -41,14 +40,14 @@ class HttpRequest bool need_more_data() const { return (!_error && !_done); } bool valid() const { return (!_error && _done); } bool is_get() const { return _method == "GET"; } - void resolve_host(const vespalib::string &my_host); - const vespalib::string &get_header(const vespalib::string &name) const; - const vespalib::string &get_host() const { return _host; } - const vespalib::string &get_uri() const { return _uri; } - const vespalib::string &get_path() const { return _path; } - bool has_param(const vespalib::string &name) const; - const vespalib::string &get_param(const vespalib::string &name) const; - std::map export_params() const { return _params; } + void resolve_host(const std::string &my_host); + const std::string &get_header(const std::string &name) const; + const std::string &get_host() const { return _host; } + const std::string &get_uri() const { return _uri; } + const std::string &get_path() const { return _path; } + bool has_param(const std::string &name) const; + const std::string &get_param(const std::string &name) const; + std::map export_params() const { return _params; } }; } // namespace vespalib::portal diff --git a/vespalib/src/vespa/vespalib/portal/portal.cpp b/vespalib/src/vespa/vespalib/portal/portal.cpp index 2677a53f9b06..979c09965c6e 100644 --- a/vespalib/src/vespa/vespalib/portal/portal.cpp +++ b/vespalib/src/vespa/vespalib/portal/portal.cpp @@ -28,28 +28,28 @@ Portal::Token::~Token() _portal.cancel_token(*this); } -const vespalib::string & -Portal::GetRequest::get_header(const vespalib::string &name) const +const std::string & +Portal::GetRequest::get_header(const std::string &name) const { assert(active()); return _conn->get_request().get_header(name); } -const vespalib::string & +const std::string & Portal::GetRequest::get_host() const { assert(active()); return _conn->get_request().get_host(); } -const vespalib::string & +const std::string & Portal::GetRequest::get_uri() const { assert(active()); return _conn->get_request().get_uri(); } -const vespalib::string & +const std::string & Portal::GetRequest::get_path() const { assert(active()); @@ -57,20 +57,20 @@ Portal::GetRequest::get_path() const } bool -Portal::GetRequest::has_param(const vespalib::string &name) const +Portal::GetRequest::has_param(const std::string &name) const { assert(active()); return _conn->get_request().has_param(name); } -const vespalib::string & -Portal::GetRequest::get_param(const vespalib::string &name) const +const std::string & +Portal::GetRequest::get_param(const std::string &name) const { assert(active()); return _conn->get_request().get_param(name); } -std::map +std::map Portal::GetRequest::export_params() const { assert(active()); @@ -124,7 +124,7 @@ Portal::cancel_token(Token &token) } portal::HandleGuard -Portal::lookup_get_handler(const vespalib::string &uri, GetHandler *&handler) +Portal::lookup_get_handler(const std::string &uri, GetHandler *&handler) { std::lock_guard guard(_lock); for (const auto &entry: _bind_list) { @@ -219,7 +219,7 @@ Portal::create(CryptoEngine::SP crypto, int port) } Portal::Token::UP -Portal::bind(const vespalib::string &path_prefix, GetHandler &handler) +Portal::bind(const std::string &path_prefix, GetHandler &handler) { auto token = make_token(); std::lock_guard guard(_lock); diff --git a/vespalib/src/vespa/vespalib/portal/portal.h b/vespalib/src/vespa/vespalib/portal/portal.h index 9691e2c8798c..a2f013351198 100644 --- a/vespalib/src/vespa/vespalib/portal/portal.h +++ b/vespalib/src/vespa/vespalib/portal/portal.h @@ -8,11 +8,11 @@ #include #include -#include #include #include #include +#include #include namespace vespalib { @@ -58,13 +58,13 @@ class Portal rhs._conn = nullptr; } bool active() const { return (_conn != nullptr); } - const vespalib::string &get_header(const vespalib::string &name) const; - const vespalib::string &get_host() const; - const vespalib::string &get_uri() const; - const vespalib::string &get_path() const; - bool has_param(const vespalib::string &name) const; - const vespalib::string &get_param(const vespalib::string &name) const; - std::map export_params() const; + const std::string &get_header(const std::string &name) const; + const std::string &get_host() const; + const std::string &get_uri() const; + const std::string &get_path() const; + bool has_param(const std::string &name) const; + const std::string &get_param(const std::string &name) const; + std::map export_params() const; void respond_with_content(std::string_view content_type, std::string_view content); void respond_with_error(int code, std::string_view msg); @@ -80,9 +80,9 @@ class Portal private: struct BindState { uint64_t handle; - vespalib::string prefix; + std::string prefix; GetHandler *handler; - BindState(uint64_t handle_in, vespalib::string prefix_in, GetHandler &handler_in) noexcept + BindState(uint64_t handle_in, std::string prefix_in, GetHandler &handler_in) noexcept : handle(handle_in), prefix(std::move(prefix_in)), handler(&handler_in) {} bool operator<(const BindState &rhs) const { if (prefix.size() == rhs.prefix.size()) { @@ -99,12 +99,12 @@ class Portal portal::Listener::UP _listener; std::mutex _lock; std::vector _bind_list; - vespalib::string _my_host; + std::string _my_host; Token::UP make_token(); void cancel_token(Token &token); - portal::HandleGuard lookup_get_handler(const vespalib::string &uri, GetHandler *&handler); + portal::HandleGuard lookup_get_handler(const std::string &uri, GetHandler *&handler); void evict_handle(uint64_t handle); void handle_accept(portal::HandleGuard guard, SocketHandle socket); @@ -115,8 +115,8 @@ class Portal ~Portal(); static SP create(CryptoEngine::SP crypto, int port); int listen_port() const { return _listener->listen_port(); } - const vespalib::string &my_host() const { return _my_host; } - Token::UP bind(const vespalib::string &path_prefix, GetHandler &handler); + const std::string &my_host() const { return _my_host; } + Token::UP bind(const std::string &path_prefix, GetHandler &handler); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/process/process.cpp b/vespalib/src/vespa/vespalib/process/process.cpp index 58478f6e2ca7..63fdc38b8d59 100644 --- a/vespalib/src/vespa/vespalib/process/process.cpp +++ b/vespalib/src/vespa/vespalib/process/process.cpp @@ -16,7 +16,7 @@ namespace vespalib { -Process::Process(const vespalib::string &cmd, bool capture_stderr) +Process::Process(const std::string &cmd, bool capture_stderr) : _pid(-1), _in(), _out(), @@ -105,9 +105,9 @@ Process::commit(size_t bytes) return *this; } -vespalib::string +std::string Process::read_line() { - vespalib::string line; + std::string line; for (auto mem = obtain(); (mem.size > 0); mem = obtain()) { for (size_t i = 0; i < mem.size; ++i) { if (mem.data[i] == '\n') { @@ -147,7 +147,7 @@ Process::~Process() } bool -Process::run(const vespalib::string &cmd, vespalib::string &output) +Process::run(const std::string &cmd, std::string &output) { Process proc(cmd); proc.close(); @@ -162,9 +162,9 @@ Process::run(const vespalib::string &cmd, vespalib::string &output) } bool -Process::run(const vespalib::string &cmd) +Process::run(const std::string &cmd) { - vespalib::string ignore_output; + std::string ignore_output; return run(cmd, ignore_output); } diff --git a/vespalib/src/vespa/vespalib/process/process.h b/vespalib/src/vespa/vespalib/process/process.h index abddfb352f9a..3bf5cacbd5c0 100644 --- a/vespalib/src/vespa/vespalib/process/process.h +++ b/vespalib/src/vespa/vespalib/process/process.h @@ -35,7 +35,7 @@ class Process : public Output, public Input bool _eof; public: - Process(const vespalib::string &cmd, bool capture_stderr = false); + Process(const std::string &cmd, bool capture_stderr = false); pid_t pid() const { return _pid; } bool valid() const { return (_pid > 0); } void close() { _in.reset(); } @@ -43,13 +43,13 @@ class Process : public Output, public Input Input &evict(size_t bytes) override; // Input (stdout) WritableMemory reserve(size_t bytes) override; // Output (stdin) Output &commit(size_t bytes) override; // Output (stdin) - vespalib::string read_line(); + std::string read_line(); bool eof() const { return _eof; } int join(); ~Process(); - static bool run(const vespalib::string &cmd, vespalib::string &output); - static bool run(const vespalib::string &cmd); + static bool run(const std::string &cmd, std::string &output); + static bool run(const std::string &cmd); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp index 802cf956d51b..381c7b097cb3 100644 --- a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp +++ b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "asciistream.h" +#include #include #include #include @@ -20,9 +21,9 @@ namespace vespalib { namespace { -std::vector +std::vector getPrecisions(const char type) { - std::vector result(VESPALIB_ASCIISTREAM_MAX_PRECISION + 1); + std::vector result(VESPALIB_ASCIISTREAM_MAX_PRECISION + 1); for (uint32_t i=0; i fixedPrecisions = getPrecisions('f'); -std::vector scientificPrecisions = getPrecisions('e'); -std::vector autoPrecisions = getPrecisions('g'); +std::vector fixedPrecisions = getPrecisions('f'); +std::vector scientificPrecisions = getPrecisions('e'); +std::vector autoPrecisions = getPrecisions('g'); } @@ -160,24 +161,24 @@ void throwInputError(int e, const char * t, const char * buf) { if (e == 0) { - throw IllegalArgumentException("Failed decoding a " + string(t) + " from '" + string(buf) + "'.", VESPA_STRLOC); + throw IllegalArgumentException("Failed decoding a " + std::string(t) + " from '" + std::string(buf) + "'.", VESPA_STRLOC); } else if (errno == ERANGE) { - throw IllegalArgumentException(string(t) + " value '" + string(buf) + "' is outside of range.", VESPA_STRLOC); + throw IllegalArgumentException(std::string(t) + " value '" + std::string(buf) + "' is outside of range.", VESPA_STRLOC); } else if (errno == EINVAL) { - throw IllegalArgumentException("Illegal " + string(t) + " value '" + string(buf) + "'.", VESPA_STRLOC); + throw IllegalArgumentException("Illegal " + std::string(t) + " value '" + std::string(buf) + "'.", VESPA_STRLOC); } else { - throw IllegalArgumentException("Unknown error decoding an " + string(t) + " from '" + string(buf) + "'.", VESPA_STRLOC); + throw IllegalArgumentException("Unknown error decoding an " + std::string(t) + " from '" + std::string(buf) + "'.", VESPA_STRLOC); } } void throwInputError(std::errc e, const char * t, const char * buf) { if (e == std::errc::invalid_argument) { - throw IllegalArgumentException("Illegal " + string(t) + " value '" + string(buf) + "'.", VESPA_STRLOC); + throw IllegalArgumentException("Illegal " + std::string(t) + " value '" + std::string(buf) + "'.", VESPA_STRLOC); } else if (e == std::errc::result_out_of_range) { - throw IllegalArgumentException(string(t) + " value '" + string(buf) + "' is outside of range.", VESPA_STRLOC); + throw IllegalArgumentException(std::string(t) + " value '" + std::string(buf) + "' is outside of range.", VESPA_STRLOC); } else { - throw IllegalArgumentException("Unknown error decoding an " + string(t) + " from '" + string(buf) + "'.", VESPA_STRLOC); + throw IllegalArgumentException("Unknown error decoding an " + std::string(t) + " from '" + std::string(buf) + "'.", VESPA_STRLOC); } } @@ -372,7 +373,7 @@ void asciistream::eatNonWhite() } asciistream & -asciistream::operator >> (string & v) +asciistream::operator >> (std::string & v) { eatWhite(); size_t start(_rPos); @@ -602,10 +603,10 @@ asciistream::write(const void * buf, size_t len) _rbuf = _wbuf; } -string +std::string asciistream::getline(char delim) { - string line; + std::string line; const size_t start(_rPos); const size_t end(_rbuf.size()); for (; (_rPos < end) && (_rbuf[_rPos] != delim); _rPos++); @@ -621,7 +622,7 @@ asciistream::getline(char delim) asciistream asciistream::createFromFile(std::string_view fileName) { - FastOS_File file(vespalib::string(fileName).c_str()); + FastOS_File file(std::string(fileName).c_str()); asciistream is; if (file.OpenReadOnly()) { ssize_t sz = file.getSize(); @@ -646,7 +647,7 @@ asciistream::createFromFile(std::string_view fileName) asciistream asciistream::createFromDevice(std::string_view fileName) { - FastOS_File file(vespalib::string(fileName).c_str()); + FastOS_File file(std::string(fileName).c_str()); asciistream is; if (file.OpenReadOnly()) { constexpr size_t SZ = 64_Ki; @@ -659,7 +660,7 @@ asciistream::createFromDevice(std::string_view fileName) } ssize_t -getline(asciistream & is, string & line, char delim) +getline(asciistream & is, std::string & line, char delim) { line = is.getline(delim); return line.size(); diff --git a/vespalib/src/vespa/vespalib/stllike/asciistream.h b/vespalib/src/vespa/vespalib/stllike/asciistream.h index 63105ffec483..5cadb15b5598 100644 --- a/vespalib/src/vespa/vespalib/stllike/asciistream.h +++ b/vespalib/src/vespa/vespalib/stllike/asciistream.h @@ -1,7 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include +#include +#include namespace vespalib { @@ -42,7 +44,7 @@ class asciistream asciistream & operator << (signed char v) { doFill(1); write(&v, 1); return *this; } asciistream & operator << (unsigned char v) { doFill(1); write(&v, 1); return *this; } asciistream & operator << (const char * v) { if (v != nullptr) { size_t n(strlen(v)); doFill(n); write(v, n); } return *this; } - asciistream & operator << (const string & v) { doFill(v.size()); write(v.data(), v.size()); return *this; } + asciistream & operator << (const std::string & v) { doFill(v.size()); write(v.data(), v.size()); return *this; } asciistream & operator << (std::string_view v) { doFill(v.size()); write(v.data(), v.size()); return *this; } asciistream & operator << (short v) { return *this << static_cast(v); } asciistream & operator << (unsigned short v) { return *this << static_cast(v); } @@ -65,7 +67,7 @@ class asciistream asciistream & operator >> (char & v); asciistream & operator >> (signed char & v); asciistream & operator >> (unsigned char & v); - asciistream & operator >> (string & v); + asciistream & operator >> (std::string & v); asciistream & operator >> (short & v); asciistream & operator >> (unsigned short & v); asciistream & operator >> (int & v); @@ -76,7 +78,7 @@ class asciistream asciistream & operator >> (unsigned long long & v); asciistream & operator >> (float & v); asciistream & operator >> (double & v); - vespalib::string str() const { return vespalib::string(c_str(), size()); } + std::string str() const { return std::string(c_str(), size()); } std::string_view view() const { return std::string_view(c_str(), size()); } const char * c_str() const { return _rbuf.data() + _rPos; } size_t size() const { return length() - _rPos; } @@ -150,7 +152,7 @@ class asciistream void eatWhite(); static asciistream createFromFile(std::string_view fileName); static asciistream createFromDevice(std::string_view fileName); - string getline(char delim='\n'); + std::string getline(char delim='\n'); char getFill() const noexcept { return _fill; } size_t getWidth() const noexcept { return static_cast(_width); } // match input type of setw Base getBase() const noexcept { return _base; } @@ -170,7 +172,7 @@ class asciistream void write(const void * buf, size_t len); size_t length() const { return _rbuf.size(); } size_t _rPos; - string _wbuf; + std::string _wbuf; std::string_view _rbuf; Base _base; FloatSpec _floatSpec; @@ -180,7 +182,7 @@ class asciistream uint8_t _precision; }; -ssize_t getline(asciistream & is, vespalib::string & line, char delim='\n'); +ssize_t getline(asciistream & is, std::string & line, char delim='\n'); inline asciistream::Width setw(size_t v) { return asciistream::Width(v); } inline asciistream::Fill setfill(char v) { return asciistream::Fill(v); } diff --git a/vespalib/src/vespa/vespalib/stllike/hash_fun.h b/vespalib/src/vespa/vespalib/stllike/hash_fun.h index fa2daac4da6e..b76f3283c2f6 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_fun.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_fun.h @@ -1,7 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include +#include namespace vespalib { @@ -77,14 +78,14 @@ inline size_t hashValue(const void *buf, size_t sz) noexcept { } struct hash_strings { - size_t operator() (const vespalib::string & arg) const noexcept { return hashValue(arg.data(), arg.size()); } + size_t operator() (const std::string & arg) const noexcept { return hashValue(arg.data(), arg.size()); } size_t operator() (std::string_view arg) const noexcept { return hashValue(arg.data(), arg.size()); } size_t operator() (const char * arg) const noexcept { return hashValue(arg); } }; template<> struct hash : hash_strings { }; template<> struct hash : public hash_strings { }; -template<> struct hash : hash_strings {}; +template<> struct hash : hash_strings {}; template struct size { size_t operator() (const V & arg) const noexcept { return arg.size(); } diff --git a/vespalib/src/vespa/vespalib/stllike/hash_map.cpp b/vespalib/src/vespa/vespalib/stllike/hash_map.cpp index 329e0e4efd43..c661d19183de 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_map.cpp +++ b/vespalib/src/vespa/vespalib/stllike/hash_map.cpp @@ -7,12 +7,12 @@ namespace vespalib { } -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, vespalib::string); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, int); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, unsigned int); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, unsigned long); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, unsigned long long); -VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, double); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, std::string); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, int); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, unsigned int); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, unsigned long); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, unsigned long long); +VESPALIB_HASH_MAP_INSTANTIATE(std::string, double); VESPALIB_HASH_MAP_INSTANTIATE(int64_t, int32_t); VESPALIB_HASH_MAP_INSTANTIATE(int64_t, uint32_t); VESPALIB_HASH_MAP_INSTANTIATE(int32_t, uint32_t); diff --git a/vespalib/src/vespa/vespalib/stllike/hash_set.cpp b/vespalib/src/vespa/vespalib/stllike/hash_set.cpp index 0b556a4cda6a..4133c4bdf16e 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_set.cpp +++ b/vespalib/src/vespa/vespalib/stllike/hash_set.cpp @@ -9,5 +9,5 @@ VESPALIB_HASH_SET_INSTANTIATE(int32_t); VESPALIB_HASH_SET_INSTANTIATE(uint32_t); VESPALIB_HASH_SET_INSTANTIATE(uint64_t); VESPALIB_HASH_SET_INSTANTIATE(double); -VESPALIB_HASH_SET_INSTANTIATE(vespalib::string); +VESPALIB_HASH_SET_INSTANTIATE(std::string); VESPALIB_HASH_SET_INSTANTIATE(const void *); diff --git a/vespalib/src/vespa/vespalib/stllike/replace_variable.cpp b/vespalib/src/vespa/vespalib/stllike/replace_variable.cpp index f95e78561b6c..3e1e979c3e78 100644 --- a/vespalib/src/vespa/vespalib/stllike/replace_variable.cpp +++ b/vespalib/src/vespa/vespalib/stllike/replace_variable.cpp @@ -6,10 +6,10 @@ namespace vespalib { -vespalib::string -replace_variable(const vespalib::string &input, - const vespalib::string &variable, - const vespalib::string &replacement) +std::string +replace_variable(const std::string &input, + const std::string &variable, + const std::string &replacement) { vespalib::asciistream result; bool is_in_word = false; @@ -26,7 +26,7 @@ replace_variable(const vespalib::string &input, ++last_word_size; } else { if (is_in_word) { - vespalib::string last_word = input.substr(last_word_start, last_word_size); + std::string last_word = input.substr(last_word_start, last_word_size); if (last_word == variable) { result << replacement; } else { @@ -38,7 +38,7 @@ replace_variable(const vespalib::string &input, } } if (is_in_word) { - vespalib::string last_word = input.substr(last_word_start, last_word_size); + std::string last_word = input.substr(last_word_start, last_word_size); if (last_word == variable) { result << replacement; } else { diff --git a/vespalib/src/vespa/vespalib/stllike/replace_variable.h b/vespalib/src/vespa/vespalib/stllike/replace_variable.h index e2bf0fe30d3e..6b420cb815c6 100644 --- a/vespalib/src/vespa/vespalib/stllike/replace_variable.h +++ b/vespalib/src/vespa/vespalib/stllike/replace_variable.h @@ -3,7 +3,7 @@ #include "string.h" namespace vespalib { -vespalib::string replace_variable(const vespalib::string &input, - const vespalib::string &variable, - const vespalib::string &replacement); +std::string replace_variable(const std::string &input, + const std::string &variable, + const std::string &replacement); } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/stllike/small_string.h b/vespalib/src/vespa/vespalib/stllike/small_string.h index 55f4f348bafa..7db1f5499a1e 100644 --- a/vespalib/src/vespa/vespalib/stllike/small_string.h +++ b/vespalib/src/vespa/vespalib/stllike/small_string.h @@ -1,12 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include #include #include - -#define VESPA_DLL_LOCAL __attribute__ ((visibility("hidden"))) +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/stllike/small_string.hpp b/vespalib/src/vespa/vespalib/stllike/small_string.hpp index 5be439fdccdb..1bb4c01f1693 100644 --- a/vespalib/src/vespa/vespalib/stllike/small_string.hpp +++ b/vespalib/src/vespa/vespalib/stllike/small_string.hpp @@ -1,5 +1,5 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "string.h" +#include "small_string.h" #include #include @@ -118,7 +118,7 @@ void small_string::shrink_to_fit() noexcept { } else if (isAllocated()) { // This is just a very simple variant to temporarily support std::string interface. // Will only live a very short time - *this = string(*this); + *this = small_string(*this); } } diff --git a/vespalib/src/vespa/vespalib/stllike/string.cpp b/vespalib/src/vespa/vespalib/stllike/string.cpp index c5880e35637e..f7fb41e14b48 100644 --- a/vespalib/src/vespa/vespalib/stllike/string.cpp +++ b/vespalib/src/vespa/vespalib/stllike/string.cpp @@ -35,15 +35,15 @@ template vespa_string operator + (std::string_view a, const vespa_string & b) no template vespa_string operator + (const vespa_string & a, const char * b) noexcept; template vespa_string operator + (const char * a, const vespa_string & b) noexcept; -const string &empty_string() noexcept { - static string empty; +const std::string &empty_string() noexcept { + static std::string empty; return empty; } inline namespace waiting_for_godot { -void ltrim(vespalib::string &s) noexcept; -void rtrim(vespalib::string &s) noexcept; +void ltrim(std::string &s) noexcept; +void rtrim(std::string &s) noexcept; void ltrim(std::string &s) noexcept { @@ -61,39 +61,39 @@ rtrim(std::string &s) noexcept { } void -chomp(vespalib::string & s) noexcept { +chomp(std::string & s) noexcept { ltrim(s); rtrim(s); } -vespalib::string +std::string safe_char_2_string(const char * p) { - return (p != nullptr) ? vespalib::string(p) : vespalib::string(""); + return (p != nullptr) ? std::string(p) : std::string(""); } } namespace std { -vespalib::string +std::string operator + (std::string_view a, const char * b) noexcept { - vespalib::string t(a); + std::string t(a); t += b; return t; } -vespalib::string +std::string operator + (const char * a, std::string_view b) noexcept { - vespalib::string t(a); + std::string t(a); t += b; return t; } -vespalib::string +std::string operator + (std::string_view a, std::string_view b) noexcept { - vespalib::string t(a); + std::string t(a); t += b; return t; } diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h index 159727482f2e..7cd296b14442 100644 --- a/vespalib/src/vespa/vespalib/stllike/string.h +++ b/vespalib/src/vespa/vespalib/stllike/string.h @@ -1,29 +1,26 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "small_string.h" +#include +#include #include #include #include -#define VESPA_DLL_LOCAL __attribute__ ((visibility("hidden"))) - namespace vespalib { -using string = std::string; - inline bool contains(std::string_view text, std::string_view key) noexcept { return text.find(key) != std::string_view::npos; } // returns a reference to a shared empty string -const string &empty_string() noexcept; +const std::string &empty_string() noexcept; /** * Utility function to format an unsigned integer into a new * string instance. **/ -static inline string stringify(uint64_t number) noexcept +static inline std::string stringify(uint64_t number) noexcept { char digits[64]; int numdigits = 0; @@ -31,22 +28,22 @@ static inline string stringify(uint64_t number) noexcept digits[numdigits++] = '0' + (number % 10); number /= 10; } while (number > 0); - string retval; + std::string retval; while (numdigits > 0) { retval += digits[--numdigits]; } return retval; } -void chomp(vespalib::string & s) noexcept; -vespalib::string safe_char_2_string(const char * p); +void chomp(std::string & s) noexcept; +std::string safe_char_2_string(const char * p); } // namespace vespalib namespace std { -vespalib::string operator+(std::string_view a, std::string_view b) noexcept; -vespalib::string operator+(const char *a, std::string_view b) noexcept; -vespalib::string operator+(std::string_view a, const char *b) noexcept; +std::string operator+(std::string_view a, std::string_view b) noexcept; +std::string operator+(const char *a, std::string_view b) noexcept; +std::string operator+(std::string_view a, const char *b) noexcept; } diff --git a/vespalib/src/vespa/vespalib/test/make_tls_options_for_testing.cpp b/vespalib/src/vespa/vespalib/test/make_tls_options_for_testing.cpp index 9a2548d7e992..5b3062ef7410 100644 --- a/vespalib/src/vespa/vespalib/test/make_tls_options_for_testing.cpp +++ b/vespalib/src/vespa/vespalib/test/make_tls_options_for_testing.cpp @@ -33,7 +33,7 @@ struct TransientCryptoCredentials { } static CertKeyWrapper make_host_creds(const CertKeyWrapper& root_ca_creds, - const vespalib::string& extra_san_entry) { + const std::string& extra_san_entry) { auto dn = X509Certificate::DistinguishedName() .country("US").state("CA").locality("Sunnyvale") .organization("Wile E. Coyote, Ltd.") diff --git a/vespalib/src/vespa/vespalib/test/time_tracer.cpp b/vespalib/src/vespa/vespalib/test/time_tracer.cpp index 75cfe6339f7e..2520c7e6d069 100644 --- a/vespalib/src/vespa/vespalib/test/time_tracer.cpp +++ b/vespalib/src/vespa/vespalib/test/time_tracer.cpp @@ -19,7 +19,7 @@ thread_local TimeTracer::ThreadState *TimeTracer::_thread_state = nullptr; //----------------------------------------------------------------------------- -TimeTracer::Tag::Tag(const vespalib::string &name) +TimeTracer::Tag::Tag(const std::string &name) : _id(master().get_tag_id(name)) { } @@ -34,7 +34,7 @@ TimeTracer::Record::ms_duration() const return std::chrono::duration(stop - start).count(); } -vespalib::string +std::string TimeTracer::Record::tag_name() const { return master().get_tag_name(tag_id); @@ -103,7 +103,7 @@ TimeTracer::TimeTracer() } uint32_t -TimeTracer::get_tag_id(const vespalib::string &tag_name) +TimeTracer::get_tag_id(const std::string &tag_name) { std::lock_guard guard(_lock); auto pos = _tags.find(tag_name); @@ -116,7 +116,7 @@ TimeTracer::get_tag_id(const vespalib::string &tag_name) return id; } -vespalib::string +std::string TimeTracer::get_tag_name(uint32_t tag_id) { std::lock_guard guard(_lock); diff --git a/vespalib/src/vespa/vespalib/test/time_tracer.h b/vespalib/src/vespa/vespalib/test/time_tracer.h index 62a0dd37f7dc..780436329a2d 100644 --- a/vespalib/src/vespa/vespalib/test/time_tracer.h +++ b/vespalib/src/vespa/vespalib/test/time_tracer.h @@ -2,13 +2,13 @@ #pragma once -#include #include +#include #include +#include #include -#include +#include #include -#include namespace vespalib::test { @@ -60,7 +60,7 @@ class TimeTracer private: uint32_t _id; public: - Tag(const vespalib::string &name_in); + Tag(const std::string &name_in); ~Tag(); uint32_t id() const { return _id; } }; @@ -84,7 +84,7 @@ class TimeTracer : thread_id(thread_id_in), tag_id(tag_id_in), start(start_in), stop(stop_in) {} double ms_duration() const; - vespalib::string tag_name() const; + std::string tag_name() const; }; class Extractor { @@ -158,13 +158,13 @@ class TimeTracer std::mutex _lock; std::vector _state_list; - std::map _tags; - std::vector _tag_names; + std::map _tags; + std::vector _tag_names; TimeTracer(); ~TimeTracer(); - uint32_t get_tag_id(const vespalib::string &tag_name); - vespalib::string get_tag_name(uint32_t tag_id); + uint32_t get_tag_id(const std::string &tag_name); + std::string get_tag_name(uint32_t tag_id); ThreadState *create_thread_state(); std::vector extract_impl(const Extractor &extractor); diff --git a/vespalib/src/vespa/vespalib/testkit/test_master.h b/vespalib/src/vespa/vespalib/testkit/test_master.h index 85684f9458f3..37e551f4764b 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_master.h +++ b/vespalib/src/vespa/vespalib/testkit/test_master.h @@ -2,11 +2,11 @@ #pragma once -#include -#include +#include #include #include -#include +#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/text/lowercase.cpp b/vespalib/src/vespa/vespalib/text/lowercase.cpp index c288cc09402c..8d9e2f78e985 100644 --- a/vespalib/src/vespa/vespalib/text/lowercase.cpp +++ b/vespalib/src/vespa/vespalib/text/lowercase.cpp @@ -5,10 +5,10 @@ namespace vespalib { -vespalib::string +std::string LowerCase::convert(std::string_view input) { - vespalib::string output; + std::string output; Utf8Reader r(input); Utf8Writer w(output); diff --git a/vespalib/src/vespa/vespalib/text/lowercase.h b/vespalib/src/vespa/vespalib/text/lowercase.h index 1a8328c6e85e..bb6d060eb7b2 100644 --- a/vespalib/src/vespa/vespalib/text/lowercase.h +++ b/vespalib/src/vespa/vespalib/text/lowercase.h @@ -4,7 +4,8 @@ #pragma once -#include +#include +#include #include namespace vespalib { @@ -97,7 +98,7 @@ class LowerCase * any bytes that aren't valid UTF-8 with the Unicode REPLACEMENT * CHARACTER (U+FFFD). **/ - static vespalib::string convert(std::string_view input); + static std::string convert(std::string_view input); /** * Lowercase a string in UTF-8 format while converting it to UCS-4 codepoints. diff --git a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp index 81d1278e6ee2..5719cc0e94cb 100644 --- a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp +++ b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp @@ -1,6 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "stringtokenizer.h" +#include +#include namespace { diff --git a/vespalib/src/vespa/vespalib/text/stringtokenizer.h b/vespalib/src/vespa/vespalib/text/stringtokenizer.h index 838ec698f905..30adfd7c1643 100644 --- a/vespalib/src/vespa/vespalib/text/stringtokenizer.h +++ b/vespalib/src/vespa/vespalib/text/stringtokenizer.h @@ -6,7 +6,7 @@ * * @brief String tokenizer with a C++ approach. * - * Uses vespalib::string and common C++ functions. Gives a simple interface + * Uses std::string and common C++ functions. Gives a simple interface * to a string tokenizer, not necessarily the most efficient one. * * @class vespalib::StringTokenizer @@ -14,8 +14,8 @@ #pragma once +#include #include -#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/text/utf8.cpp b/vespalib/src/vespa/vespalib/text/utf8.cpp index 59c2254d8c68..9d560a74b9ef 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.cpp +++ b/vespalib/src/vespa/vespalib/text/utf8.cpp @@ -12,7 +12,7 @@ namespace vespalib { void Utf8::throwX(const char *msg, unsigned int number) { - vespalib::string what = make_string("%s: \\x%02X", msg, number); + std::string what = make_string("%s: \\x%02X", msg, number); throw IllegalArgumentException(what); } @@ -213,7 +213,7 @@ Utf8Writer::putChar(uint32_t codepoint) return *this; } -template class Utf8Writer; +template class Utf8Writer; template T Utf8::filter_invalid_sequences(const T& input) noexcept @@ -228,6 +228,6 @@ T Utf8::filter_invalid_sequences(const T& input) noexcept return retval; } -template vespalib::string Utf8::filter_invalid_sequences(const vespalib::string&); +template std::string Utf8::filter_invalid_sequences(const std::string&); } // namespace diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h index 9293fdf737c4..160d658fc9f4 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.h +++ b/vespalib/src/vespa/vespalib/text/utf8.h @@ -3,7 +3,8 @@ #pragma once -#include +#include +#include namespace vespalib { @@ -28,7 +29,7 @@ class Utf8 }; /** - * Filter a string (std::string or vespalib::string) + * Filter a string (std::string or std::string) * and replace any invalid UTF8 sequences with the * standard replacement char U+FFFD; note that any * UTF-8 encoded surrogates are also considered invalid. @@ -335,7 +336,7 @@ class Utf8Writer : public Utf8 public: /** * construct a writer appending to the given string - * @param target a reference to a vespalib::string + * @param target a reference to a std::string * that the writer will append to. Must be writable * and must be kept alive while the writer is active. **/ diff --git a/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.cpp b/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.cpp index 0277667b11bd..404bcb137fd7 100644 --- a/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.cpp +++ b/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.cpp @@ -43,7 +43,7 @@ SlimeTraceDeserializer::hasPayload(const Inspector & inspector) return inspector[SlimeTraceSerializer::PAYLOAD].valid(); } -vespalib::string +std::string SlimeTraceDeserializer::decodePayload(const Inspector & inspector) { return inspector[SlimeTraceSerializer::PAYLOAD].asString().make_string(); diff --git a/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.h b/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.h index 14f939d75fa5..3776d6101996 100644 --- a/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.h +++ b/vespalib/src/vespa/vespalib/trace/slime_trace_deserializer.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace vespalib { @@ -24,7 +24,7 @@ class SlimeTraceDeserializer static void deserializeChildren(const slime::Inspector & inspector, TraceNode & node); static bool hasPayload(const slime::Inspector & inspector); static int64_t decodeTimestamp(const slime::Inspector & inspector); - static vespalib::string decodePayload(const slime::Inspector & inspector); + static std::string decodePayload(const slime::Inspector & inspector); const slime::Inspector & _inspector; }; diff --git a/vespalib/src/vespa/vespalib/trace/trace.cpp b/vespalib/src/vespa/vespalib/trace/trace.cpp index 6107946249e5..35710b2499f4 100644 --- a/vespalib/src/vespa/vespalib/trace/trace.cpp +++ b/vespalib/src/vespa/vespalib/trace/trace.cpp @@ -16,7 +16,7 @@ Trace::Trace(const Trace &rhs) } bool -Trace::trace(uint32_t level, const string ¬e, bool addTime) +Trace::trace(uint32_t level, const std::string ¬e, bool addTime) { if (!shouldTrace(level)) { return false; @@ -31,12 +31,12 @@ Trace::trace(uint32_t level, const string ¬e, bool addTime) return true; } -string +std::string Trace::toString(size_t limit) const { return _root ? _root->toString(limit) : ""; } -string +std::string Trace::encode() const { return isEmpty() ? "" : getRoot().encode(); } diff --git a/vespalib/src/vespa/vespalib/trace/trace.h b/vespalib/src/vespa/vespalib/trace/trace.h index 8d92e7f4687f..2638c37c431b 100644 --- a/vespalib/src/vespa/vespalib/trace/trace.h +++ b/vespalib/src/vespa/vespalib/trace/trace.h @@ -77,7 +77,7 @@ class Trace { * @return True if the note was added to the trace information, false * otherwise. */ - bool trace(uint32_t level, const string ¬e, bool addTime = true); + bool trace(uint32_t level, const std::string ¬e, bool addTime = true); void normalize() { if (_root) { @@ -101,7 +101,7 @@ class Trace { uint32_t getNumChildren() const noexcept { return _root ? _root->getNumChildren() : 0; } const TraceNode & getChild(uint32_t child) const { return getRoot().getChild(child); } - string encode() const; + std::string encode() const; /** * Returns a string representation of the contained trace tree. This is a @@ -109,7 +109,7 @@ class Trace { * * @return Readable trace string. */ - string toString(size_t limit=31337) const; + std::string toString(size_t limit=31337) const; size_t computeMemoryUsage() const { return _root ? _root->computeMemoryUsage() : 0; } diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.cpp b/vespalib/src/vespa/vespalib/trace/tracenode.cpp index 48941373b5ac..436e9831c21c 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.cpp +++ b/vespalib/src/vespa/vespalib/trace/tracenode.cpp @@ -72,7 +72,7 @@ TraceNode & TraceNode::operator =(const TraceNode &) = default; TraceNode::~TraceNode() = default; -TraceNode::TraceNode(const string ¬e, system_time timestamp) +TraceNode::TraceNode(const std::string ¬e, system_time timestamp) : _note(note), _children(), _parent(nullptr), @@ -182,13 +182,13 @@ TraceNode::normalize() } TraceNode & -TraceNode::addChild(const string ¬e) +TraceNode::addChild(const std::string ¬e) { return addChild(TraceNode(note, system_time())); } TraceNode & -TraceNode::addChild(const string ¬e, system_time timestamp) +TraceNode::addChild(const std::string ¬e, system_time timestamp) { return addChild(TraceNode(note, timestamp)); } @@ -211,10 +211,10 @@ TraceNode::addChildren(std::vector children) return *this; } -string +std::string TraceNode::toString(size_t limit) const { - string str; + std::string str; if (!writeString(str, 0, limit)) { str.append("...\n"); } @@ -222,17 +222,17 @@ TraceNode::toString(size_t limit) const } bool -TraceNode::writeString(string &dst, size_t indent, size_t limit) const +TraceNode::writeString(std::string &dst, size_t indent, size_t limit) const { if (dst.size() >= limit) { return false; } - string pre(indent, ' '); + std::string pre(indent, ' '); if (_hasNote) { dst.append(pre).append(_note).append("\n"); return true; } - string name = isStrict() ? "trace" : "fork"; + std::string name = isStrict() ? "trace" : "fork"; dst.append(pre).append("<").append(name).append(">\n"); for (const auto & child : _children) { if (!child.writeString(dst, indent + 4, limit)) { @@ -246,10 +246,10 @@ TraceNode::writeString(string &dst, size_t indent, size_t limit) const return true; } -string +std::string TraceNode::encode() const { - string ret = ""; + std::string ret = ""; if (_hasNote) { ret.append("["); for (char c : _note) { @@ -270,14 +270,14 @@ TraceNode::encode() const } TraceNode -TraceNode::decode(const string &str) +TraceNode::decode(const std::string &str) { if (str.empty()) { return TraceNode(); } TraceNode proxy; TraceNode *node = &proxy; - string note = ""; + std::string note = ""; bool inNote = false, inEscape = false; for (uint32_t i = 0, len = str.size(); i < len; ++i) { char c = str[i]; diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.h b/vespalib/src/vespa/vespalib/trace/tracenode.h index 2877bf280476..d5d52ab96a4b 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.h +++ b/vespalib/src/vespa/vespalib/trace/tracenode.h @@ -1,8 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include #include namespace vespalib { @@ -23,7 +23,7 @@ struct TraceVisitor; */ class TraceNode { private: - string _note; + std::string _note; std::vector _children; TraceNode *_parent; system_time _timestamp; @@ -41,7 +41,7 @@ class TraceNode { * @param note The note for this node. * @param timestamp The timestamp to give to node. */ - explicit TraceNode(const string ¬e, system_time timestamp); + explicit TraceNode(const std::string ¬e, system_time timestamp); /** * Create a leaf node with no note and a time stamp. @@ -149,7 +149,7 @@ class TraceNode { * * @return The note. */ - const string & getNote() const { return _note; } + const std::string & getNote() const { return _note; } /** * Returns the timestamp assigned to this node. @@ -181,7 +181,7 @@ class TraceNode { * @param note The note to assign to the child. * @return This, to allow chaining. */ - TraceNode &addChild(const string ¬e); + TraceNode &addChild(const std::string ¬e); /** * Convenience method to add a child node containing a note to this and a timestamp. @@ -190,7 +190,7 @@ class TraceNode { * @param timestamp The timestamp to give this child. * @return This, to allow chaining. */ - TraceNode &addChild(const string ¬e, system_time timestamp); + TraceNode &addChild(const std::string ¬e, system_time timestamp); /** * Adds a child node to this. @@ -215,7 +215,7 @@ class TraceNode { * @return generated string * @param limit soft cap for maximum size of generated string **/ - string toString(size_t limit = -1) const; + std::string toString(size_t limit = -1) const; /** * Writes a non-parseable, human-readable string representation of @@ -226,7 +226,7 @@ class TraceNode { * @param indent number of spaces to be used for indent * @param limit soft cap for maximum size of generated string **/ - bool writeString(string &dst, size_t indent, size_t limit) const; + bool writeString(std::string &dst, size_t indent, size_t limit) const; /** * Returns a parseable (using {@link #decode(String)}) string @@ -234,7 +234,7 @@ class TraceNode { * * @return A string representation of this tree. */ - string encode() const; + std::string encode() const; /** * Build a trace tree from the given string representation (possibly @@ -243,7 +243,7 @@ class TraceNode { * @param str The string to parse. * @return The corresponding trace tree, or an empty node if parsing failed. */ - static TraceNode decode(const string &str); + static TraceNode decode(const std::string &str); /** * Visits this TraceNode and all of its descendants in depth-first, prefix order. diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp index ba89663f4d17..a2f124c6aa96 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.cpp +++ b/vespalib/src/vespa/vespalib/util/alloc.cpp @@ -38,14 +38,14 @@ struct MMapInfo { _sz(0ul), _stackTrace() { } - MMapInfo(size_t id, size_t sz, const string & stackTrace) : + MMapInfo(size_t id, size_t sz, const std::string & stackTrace) : _id(id), _sz(sz), _stackTrace(stackTrace) { } size_t _id; size_t _sz; - string _stackTrace; + std::string _stackTrace; }; using MMapStore = std::map; MMapStore _G_HugeMappings; @@ -339,7 +339,7 @@ MMapAllocator::salloc(size_t sz, void * wantedAddress) const int flags(MAP_ANON | MAP_PRIVATE); const int prot(PROT_READ | PROT_WRITE); size_t mmapId = std::atomic_fetch_add(&_G_mmapCount, 1ul); - string stackTrace; + std::string stackTrace; if (sz >= _G_MMapLogLimit) { stackTrace = getStackTrace(1); LOG(info, "mmap %ld of size %ld from %s", mmapId, sz, stackTrace.c_str()); @@ -355,7 +355,7 @@ MMapAllocator::salloc(size_t sz, void * wantedAddress) buf = mmap(wantedAddress, sz, prot, flags, -1, 0); if (buf == MAP_FAILED) { stackTrace = getStackTrace(1); - string msg = make_string("Failed mmaping anonymous of size %ld errno(%d) from %s", sz, errno, stackTrace.c_str()); + std::string msg = make_string("Failed mmaping anonymous of size %ld errno(%d) from %s", sz, errno, stackTrace.c_str()); if (_G_SilenceCoreOnOOM) { OOMException oom(msg); oom.setPayload(std::make_unique(oom)); diff --git a/vespalib/src/vespa/vespalib/util/assert.cpp b/vespalib/src/vespa/vespalib/util/assert.cpp index 964c124761c4..1b8f51cecf85 100644 --- a/vespalib/src/vespa/vespalib/util/assert.cpp +++ b/vespalib/src/vespa/vespalib/util/assert.cpp @@ -29,10 +29,10 @@ getNumAsserts(const char *key) return _G_assertMap[key]; } -vespalib::string +std::string getAssertLogFileName(const char *key) { - vespalib::string relative = make_string("var/db/vespa/tmp/%s.%s.assert", key, Vtag::currentVersion.toString().c_str()); + std::string relative = make_string("var/db/vespa/tmp/%s.%s.assert", key, Vtag::currentVersion.toString().c_str()); return vespa::Defaults::underVespaHome(relative.c_str()); } diff --git a/vespalib/src/vespa/vespalib/util/assert.h b/vespalib/src/vespa/vespalib/util/assert.h index af3a6c39b757..6c69023336b8 100644 --- a/vespalib/src/vespa/vespalib/util/assert.h +++ b/vespalib/src/vespa/vespalib/util/assert.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib::assert { @@ -18,7 +18,7 @@ size_t getNumAsserts(const char *key); * @param key * @return */ -vespalib::string getAssertLogFileName(const char *key); +std::string getAssertLogFileName(const char *key); /** * If there is no record on file that this assert has failed, it will be recorded and aborted. diff --git a/vespalib/src/vespa/vespalib/util/backtrace.cpp b/vespalib/src/vespa/vespalib/util/backtrace.cpp index 9010c4f63aef..ea9983f2532b 100644 --- a/vespalib/src/vespa/vespalib/util/backtrace.cpp +++ b/vespalib/src/vespa/vespalib/util/backtrace.cpp @@ -2,10 +2,10 @@ #include #include -#include #include #include #include +#include namespace { @@ -20,19 +20,19 @@ namespace { * @param line A single line from backtrace_symbols * @return The demangled line or the original line if demangling fails */ -vespalib::string -demangleBacktraceLine(const vespalib::string& line) +std::string +demangleBacktraceLine(const std::string& line) { size_t symBegin = line.find_first_of('('); - if (symBegin != vespalib::string::npos) { + if (symBegin != std::string::npos) { size_t symEnd = line.find_first_of('+', symBegin); - if (symEnd != vespalib::string::npos) { - vespalib::string mangled = line.substr(symBegin + 1, symEnd - symBegin - 1); - vespalib::string demangled = vespalib::demangle(mangled.c_str()); + if (symEnd != std::string::npos) { + std::string mangled = line.substr(symBegin + 1, symEnd - symBegin - 1); + std::string demangled = vespalib::demangle(mangled.c_str()); if ( ! demangled.empty()) { // Create string matching original backtrace line format, // except with demangled function signature - vespalib::string ret(line.c_str(), symBegin + 1); + std::string ret(line.c_str(), symBegin + 1); ret.append(demangled); ret.append(line.c_str() + symEnd); return ret; @@ -50,7 +50,7 @@ vespalib::getStackTraceFrames(void** framesOut, int maxFrames) { return backtrace(framesOut, maxFrames); } -vespalib::string +std::string vespalib::getStackTrace(int ignoreTop, void* const* stack, int size) { asciistream ost; @@ -65,7 +65,7 @@ vespalib::getStackTrace(int ignoreTop, void* const* stack, int size) return ost.str(); } -vespalib::string +std::string vespalib::getStackTrace(int ignoreTop) { ignoreTop += 1; void* stack[25]; diff --git a/vespalib/src/vespa/vespalib/util/backtrace.h b/vespalib/src/vespa/vespalib/util/backtrace.h index 1a4345003d58..3077d6f85775 100644 --- a/vespalib/src/vespa/vespalib/util/backtrace.h +++ b/vespalib/src/vespa/vespalib/util/backtrace.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { @@ -12,7 +12,7 @@ namespace vespalib { * @param ignoreTop number of frames to skip from the top of the stack * @return Stacktrace complete with resolved (although still mangled) symbols */ -string getStackTrace(int ignoreTop); +std::string getStackTrace(int ignoreTop); /** * Gets a textual stack trace from an existing buffer of stack frames. @@ -23,7 +23,7 @@ string getStackTrace(int ignoreTop); * @param size number of valid frame addresses in the buffer * @return Stacktrace complete with resolved (although still mangled) symbols */ -string getStackTrace(int ignoreTop, void* const* stack, int size); +std::string getStackTrace(int ignoreTop, void* const* stack, int size); /** * Get the stack frame addresses from the current frame of execution. diff --git a/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h b/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h index df19ebe61f42..a29ad43ac61f 100644 --- a/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h +++ b/vespalib/src/vespa/vespalib/util/cgroup_resource_limits.h @@ -4,9 +4,9 @@ #include #include +#include #include #include -#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/classname.cpp b/vespalib/src/vespa/vespalib/util/classname.cpp index 6dce6b44b6a1..13e4215eb5f1 100644 --- a/vespalib/src/vespa/vespalib/util/classname.cpp +++ b/vespalib/src/vespa/vespalib/util/classname.cpp @@ -5,14 +5,14 @@ namespace vespalib { -string demangle(const char * native) { +std::string demangle(const char * native) { int status = 0; size_t size = 0; char *unmangled = abi::__cxa_demangle(native, nullptr, &size, &status); if (unmangled == nullptr) { return ""; // Demangling failed for some reason. TODO return `native` instead? } - string result(unmangled); + std::string result(unmangled); free(unmangled); return result; } diff --git a/vespalib/src/vespa/vespalib/util/classname.h b/vespalib/src/vespa/vespalib/util/classname.h index bf22457e08f4..e24d0dc70dc9 100644 --- a/vespalib/src/vespa/vespalib/util/classname.h +++ b/vespalib/src/vespa/vespalib/util/classname.h @@ -1,20 +1,20 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include namespace vespalib { -string demangle(const char * native); +std::string demangle(const char * native); template -string getClassName(const T & obj) { +std::string getClassName(const T & obj) { return demangle(typeid(obj).name()); } template -string getClassName() { +std::string getClassName() { return demangle(typeid(T).name()); } diff --git a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp index 68602b1ebd27..26c9c829b724 100644 --- a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp +++ b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp @@ -3,6 +3,7 @@ #include "cpu_usage.h" #include "require.h" #include +#include #include #include @@ -106,10 +107,10 @@ CpuUsage::ThreadTrackerImpl::sample() noexcept return sample; } -vespalib::string & +std::string & CpuUsage::name_of(Category cat) { - static std::array names = {"setup", "read", "write", "compact", "other"}; + static std::array names = {"setup", "read", "write", "compact", "other"}; return names[index_of(cat)]; } diff --git a/vespalib/src/vespa/vespalib/util/cpu_usage.h b/vespalib/src/vespa/vespalib/util/cpu_usage.h index 1310d353bd78..b423033c4005 100644 --- a/vespalib/src/vespa/vespalib/util/cpu_usage.h +++ b/vespalib/src/vespa/vespalib/util/cpu_usage.h @@ -5,12 +5,12 @@ #include "executor.h" #include "spin_lock.h" #include -#include #include +#include #include #include +#include #include -#include namespace vespalib { @@ -61,7 +61,7 @@ class CpuUsage COMPACT = 3, // usage related to internal data re-structuring OTHER = 4 // all other cpu usage not in the categories above }; - static vespalib::string &name_of(Category cat); + static std::string &name_of(Category cat); static constexpr size_t index_of(Category cat) { return static_cast(cat); } static constexpr size_t num_categories = 5; diff --git a/vespalib/src/vespa/vespalib/util/error.cpp b/vespalib/src/vespa/vespalib/util/error.cpp index 75d9720010e3..775a7c2d1438 100644 --- a/vespalib/src/vespa/vespalib/util/error.cpp +++ b/vespalib/src/vespa/vespalib/util/error.cpp @@ -5,14 +5,14 @@ namespace vespalib { -vespalib::string +std::string getErrorString(const int osError) { std::error_code ec(osError, std::system_category()); return ec.message(); } -vespalib::string +std::string getLastErrorString() { return getErrorString(errno); diff --git a/vespalib/src/vespa/vespalib/util/error.h b/vespalib/src/vespa/vespalib/util/error.h index 554379a2f71a..c151b1a383ef 100644 --- a/vespalib/src/vespa/vespalib/util/error.h +++ b/vespalib/src/vespa/vespalib/util/error.h @@ -2,12 +2,12 @@ #pragma once -#include +#include namespace vespalib { -vespalib::string getErrorString(const int osError); +std::string getErrorString(const int osError); -vespalib::string getLastErrorString(); +std::string getLastErrorString(); } diff --git a/vespalib/src/vespa/vespalib/util/exception.cpp b/vespalib/src/vespa/vespalib/util/exception.cpp index 54e87f747c01..a9447de927c1 100644 --- a/vespalib/src/vespa/vespalib/util/exception.cpp +++ b/vespalib/src/vespa/vespalib/util/exception.cpp @@ -116,10 +116,10 @@ Exception::throwSelf() const throw Exception(*this); } -string +std::string Exception::toString() const { - string str; + std::string str; str.append(getName()); str.append(": "); str.append(_msg); diff --git a/vespalib/src/vespa/vespalib/util/exception.h b/vespalib/src/vespa/vespalib/util/exception.h index de54b4a46787..c0542ec2e3e9 100644 --- a/vespalib/src/vespa/vespalib/util/exception.h +++ b/vespalib/src/vespa/vespalib/util/exception.h @@ -174,9 +174,9 @@ class Exception : public std::exception private: static const int STACK_FRAME_BUFFER_SIZE = 25; - mutable string _what; - string _msg; - string _location; + mutable std::string _what; + std::string _msg; + std::string _location; void* _stack[STACK_FRAME_BUFFER_SIZE]; int _stackframes; int _skipStack; @@ -223,13 +223,13 @@ class Exception : public std::exception const Exception *getCause() const { return _cause.get(); } /** @brief Returns the msg parameter that this Exception was constructed with */ - const string &getMessage() const { return _msg; } + const std::string &getMessage() const { return _msg; } /** @brief Returns the message string */ const char *message() const { return _msg.c_str(); } /** @brief Returns the location parameter that this Exception was constructed with */ - const string &getLocation() const { return _location; } + const std::string &getLocation() const { return _location; } /** @brief Returns the actual class name of the exception */ virtual const char *getName() const; @@ -241,7 +241,7 @@ class Exception : public std::exception virtual void throwSelf() const; /** @brief make a string describing the current object, not including cause */ - virtual string toString() const; + virtual std::string toString() const; }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/exceptions.cpp b/vespalib/src/vespa/vespalib/util/exceptions.cpp index f1277d71dfe2..6f6df2292ff6 100644 --- a/vespalib/src/vespa/vespalib/util/exceptions.cpp +++ b/vespalib/src/vespa/vespalib/util/exceptions.cpp @@ -26,7 +26,7 @@ VESPA_IMPLEMENT_EXCEPTION_SPINE(IoException); namespace { std::mutex _G_silence_mutex; -vespalib::string _G_what; +std::string _G_what; void silent_terminate() { std::lock_guard guard(_G_silence_mutex); @@ -69,13 +69,13 @@ SilenceUncaughtException::~SilenceUncaughtException() _G_what = ""; } -vespalib::string +std::string PortListenException::make_message(int port, std::string_view protocol, std::string_view msg) { return make_string("failed to listen on port %d with protocol %s%s%s", - port, vespalib::string(protocol).c_str(), msg.empty() ? "" : ": ", - vespalib::string(msg).c_str()); + port, std::string(protocol).c_str(), msg.empty() ? "" : ": ", + std::string(msg).c_str()); } PortListenException::PortListenException(int port, std::string_view protocol, @@ -126,7 +126,7 @@ IoException::IoException(IoException &&) noexcept = default; IoException & IoException::operator =(IoException &&) noexcept = default; IoException::~IoException() = default; -string +std::string IoException::createMessage(std::string_view msg, Type type) { vespalib::asciistream ost; diff --git a/vespalib/src/vespa/vespalib/util/exceptions.h b/vespalib/src/vespa/vespalib/util/exceptions.h index a0fa29a15480..28dffb44c761 100644 --- a/vespalib/src/vespa/vespalib/util/exceptions.h +++ b/vespalib/src/vespa/vespalib/util/exceptions.h @@ -78,7 +78,7 @@ class ExceptionWithPayload : public std::exception { void setPayload(Anything::UP payload) { _payload = std::move(payload); } const char * what() const noexcept override; private: - vespalib::string _msg; + std::string _msg; Anything::UP _payload; }; @@ -96,9 +96,9 @@ class PortListenException : public Exception { private: int _port; - vespalib::string _protocol; + std::string _protocol; - vespalib::string make_message(int port, std::string_view protocol, std::string_view msg); + std::string make_message(int port, std::string_view protocol, std::string_view msg); public: PortListenException(int port, std::string_view protocol, std::string_view msg = "", @@ -112,7 +112,7 @@ class PortListenException : public Exception ~PortListenException() override; VESPA_DEFINE_EXCEPTION_SPINE(PortListenException); int get_port() const { return _port; } - const vespalib::string &get_protocol() const { return _protocol; } + const std::string &get_protocol() const { return _protocol; } }; //----------------------------------------------------------------------------- @@ -138,7 +138,7 @@ class IoException : public Exception { VESPA_DEFINE_EXCEPTION_SPINE(IoException); - static string createMessage(std::string_view msg, Type type); + static std::string createMessage(std::string_view msg, Type type); Type getType() const { return _type; } diff --git a/vespalib/src/vespa/vespalib/util/execution_profiler.cpp b/vespalib/src/vespa/vespalib/util/execution_profiler.cpp index a0749d93ba55..3b647678dc3f 100644 --- a/vespalib/src/vespa/vespalib/util/execution_profiler.cpp +++ b/vespalib/src/vespa/vespalib/util/execution_profiler.cpp @@ -11,12 +11,12 @@ namespace vespalib { struct ExecutionProfiler::ReportContext { const ExecutionProfiler &profiler; const ExecutionProfiler::NameMapper &name_mapper; - vespalib::hash_map name_cache; + vespalib::hash_map name_cache; ReportContext(const ExecutionProfiler &profiler_in, const ExecutionProfiler::NameMapper &name_mapper_in, size_t num_names) : profiler(profiler_in), name_mapper(name_mapper_in), name_cache(num_names * 2) {} size_t get_max_depth() const { return profiler._max_depth; } - const vespalib::string &resolve_name(TaskId task) { + const std::string &resolve_name(TaskId task) { auto pos = name_cache.find(task); if (pos == name_cache.end()) { pos = name_cache.insert(std::make_pair(task, name_mapper(profiler.name_of(task)))).first; @@ -234,7 +234,7 @@ ExecutionProfiler::ExecutionProfiler(int32_t profile_depth) ExecutionProfiler::~ExecutionProfiler() = default; ExecutionProfiler::TaskId -ExecutionProfiler::resolve(const vespalib::string &name) +ExecutionProfiler::resolve(const std::string &name) { auto [pos, was_new] = _name_map.insert(std::make_pair(name, _names.size())); if (was_new) { diff --git a/vespalib/src/vespa/vespalib/util/execution_profiler.h b/vespalib/src/vespa/vespalib/util/execution_profiler.h index 9a0948c55710..cc6fb9d6bfe4 100644 --- a/vespalib/src/vespa/vespalib/util/execution_profiler.h +++ b/vespalib/src/vespa/vespalib/util/execution_profiler.h @@ -4,9 +4,9 @@ #include "time.h" -#include #include #include +#include namespace vespalib { @@ -32,20 +32,20 @@ class ExecutionProfiler { virtual void track_complete() = 0; virtual void report(slime::Cursor &obj, ReportContext &ctx) const = 0; }; - using NameMapper = std::function; + using NameMapper = std::function; private: size_t _level; size_t _max_depth; - std::vector _names; - vespalib::hash_map _name_map; + std::vector _names; + vespalib::hash_map _name_map; std::unique_ptr _impl; public: ExecutionProfiler(int32_t profile_depth); ~ExecutionProfiler(); - TaskId resolve(const vespalib::string &name); - const vespalib::string &name_of(TaskId task) const { return _names[task]; } + TaskId resolve(const std::string &name); + const std::string &name_of(TaskId task) const { return _names[task]; } void start(TaskId task) { if (++_level <= _max_depth) { _impl->track_start(task); @@ -57,7 +57,7 @@ class ExecutionProfiler { } } void report(slime::Cursor &obj, const NameMapper &name_mapper = - [](const vespalib::string &name) noexcept { return name; }) const; + [](const std::string &name) noexcept { return name; }) const; }; } diff --git a/vespalib/src/vespa/vespalib/util/featureset.h b/vespalib/src/vespa/vespalib/util/featureset.h index 825490cfecc7..91749f5c7f56 100644 --- a/vespalib/src/vespa/vespalib/util/featureset.h +++ b/vespalib/src/vespa/vespalib/util/featureset.h @@ -2,11 +2,11 @@ #pragma once -#include #include #include -#include #include +#include +#include namespace vespalib { @@ -49,7 +49,7 @@ class FeatureSet } }; - using string = vespalib::string; + using string = std::string; using StringVector = std::vector; private: StringVector _names; @@ -158,7 +158,7 @@ class FeatureSet // An even simpler feature container. Used to pass match features around. struct FeatureValues { using Value = FeatureSet::Value; - std::vector names; + std::vector names; std::vector values; // values.size() == names.size() * N FeatureValues() noexcept; FeatureValues(const FeatureValues& rhs); diff --git a/vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp b/vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp index 1bf69f0cf457..4dc19c98e672 100644 --- a/vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp +++ b/vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "growablebytebuffer.h" #include +#include using namespace vespalib; diff --git a/vespalib/src/vespa/vespalib/util/growablebytebuffer.h b/vespalib/src/vespa/vespalib/util/growablebytebuffer.h index e3ce2babf9e5..661d21ab17ee 100644 --- a/vespalib/src/vespa/vespalib/util/growablebytebuffer.h +++ b/vespalib/src/vespa/vespalib/util/growablebytebuffer.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/host_name.cpp b/vespalib/src/vespa/vespalib/util/host_name.cpp index 6986703ed973..89db17e01996 100644 --- a/vespalib/src/vespa/vespalib/util/host_name.cpp +++ b/vespalib/src/vespa/vespalib/util/host_name.cpp @@ -7,12 +7,12 @@ namespace vespalib { namespace { -vespalib::string make_host_name() { +std::string make_host_name() { return vespa::Defaults::vespaHostname(); } } // namespace vespalib:: -const vespalib::string HostName::_host_name = make_host_name(); +const std::string HostName::_host_name = make_host_name(); } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/host_name.h b/vespalib/src/vespa/vespalib/util/host_name.h index 40a50ef8c3bf..4bd7e3c34c12 100644 --- a/vespalib/src/vespa/vespalib/util/host_name.h +++ b/vespalib/src/vespa/vespalib/util/host_name.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { @@ -13,9 +13,9 @@ namespace vespalib { class HostName { private: - static const vespalib::string _host_name; + static const std::string _host_name; public: - static const vespalib::string &get() { return _host_name; } + static const std::string &get() { return _host_name; } }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h b/vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h index 2f69ca1be486..5aa8acdc7927 100644 --- a/vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h +++ b/vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h @@ -3,10 +3,10 @@ #include #include -#include #include -#include #include +#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/issue.cpp b/vespalib/src/vespa/vespalib/util/issue.cpp index 134672f34595..710ee749316e 100644 --- a/vespalib/src/vespa/vespalib/util/issue.cpp +++ b/vespalib/src/vespa/vespalib/util/issue.cpp @@ -31,7 +31,7 @@ Link **get_head() { } // -Issue::Issue(vespalib::string message) +Issue::Issue(std::string message) : _message(std::move(message)) { } @@ -64,7 +64,7 @@ Issue::listen(Handler &handler) } void -Issue::report(vespalib::string msg) +Issue::report(std::string msg) { report(Issue(std::move(msg))); } @@ -80,7 +80,7 @@ Issue::report(const char *format, ...) { va_list ap; va_start(ap, format); - vespalib::string msg = make_string_va(format, ap); + std::string msg = make_string_va(format, ap); va_end(ap); report(Issue(std::move(msg))); } diff --git a/vespalib/src/vespa/vespalib/util/issue.h b/vespalib/src/vespa/vespalib/util/issue.h index b0617c123eba..2c811b2422f6 100644 --- a/vespalib/src/vespa/vespalib/util/issue.h +++ b/vespalib/src/vespa/vespalib/util/issue.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { @@ -34,10 +34,10 @@ namespace vespalib { class Issue { private: - vespalib::string _message; + std::string _message; public: - Issue(vespalib::string message); - const vespalib::string &message() const { return _message; } + Issue(std::string message); + const std::string &message() const { return _message; } struct Handler { virtual void handle(const Issue &issue) = 0; virtual ~Handler() = default; @@ -61,7 +61,7 @@ class Issue }; static void report(const Issue &issue); static Binding listen(Handler &handler); - static void report(vespalib::string msg); + static void report(std::string msg); static void report(const std::exception &e); static void report(const char *format, ...) __attribute__ ((format (printf,1,2))); }; diff --git a/vespalib/src/vespa/vespalib/util/jsonexception.cpp b/vespalib/src/vespa/vespalib/util/jsonexception.cpp index 1519cda7af3a..e67287fcae1b 100644 --- a/vespalib/src/vespa/vespalib/util/jsonexception.cpp +++ b/vespalib/src/vespa/vespalib/util/jsonexception.cpp @@ -1,6 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "jsonexception.h" +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/jsonexception.h b/vespalib/src/vespa/vespalib/util/jsonexception.h index 9c375a8550b9..91498b9bee4b 100644 --- a/vespalib/src/vespa/vespalib/util/jsonexception.h +++ b/vespalib/src/vespa/vespalib/util/jsonexception.h @@ -6,7 +6,7 @@ namespace vespalib { class JsonStreamException : public Exception { - string _reason; + std::string _reason; public: JsonStreamException(std::string_view reason, std::string_view history, diff --git a/vespalib/src/vespa/vespalib/util/jsonstream.cpp b/vespalib/src/vespa/vespalib/util/jsonstream.cpp index bd947c4512f2..8f1841ab39bf 100644 --- a/vespalib/src/vespa/vespalib/util/jsonstream.cpp +++ b/vespalib/src/vespa/vespalib/util/jsonstream.cpp @@ -325,7 +325,7 @@ JsonStream::finalize() return *this; } -string +std::string JsonStream::getStateString() const { asciistream as; @@ -357,7 +357,7 @@ JsonStream::getStateString() const return as.str(); } -string +std::string JsonStream::getJsonStreamState() const { asciistream report; diff --git a/vespalib/src/vespa/vespalib/util/jsonstream.h b/vespalib/src/vespa/vespalib/util/jsonstream.h index ad7e12b03a5e..4ca9676c9d98 100644 --- a/vespalib/src/vespa/vespalib/util/jsonstream.h +++ b/vespalib/src/vespa/vespalib/util/jsonstream.h @@ -41,7 +41,7 @@ class JsonStream : public JsonStreamTypes { static const char* getStateName(const State&); struct StateEntry { State state; - string object_key; + std::string object_key; size_t array_index; StateEntry() noexcept; @@ -90,10 +90,10 @@ class JsonStream : public JsonStreamTypes { JsonStream& finalize(); - vespalib::string getJsonStreamState() const; + std::string getJsonStreamState() const; private: - string getStateString() const; + std::string getStateString() const; void fail(std::string_view error) const; }; diff --git a/vespalib/src/vespa/vespalib/util/jsonwriter.h b/vespalib/src/vespa/vespalib/util/jsonwriter.h index b00c54324472..1eca41d99307 100644 --- a/vespalib/src/vespa/vespalib/util/jsonwriter.h +++ b/vespalib/src/vespa/vespalib/util/jsonwriter.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/memoryusage.cpp b/vespalib/src/vespa/vespalib/util/memoryusage.cpp index fa0f45293586..185227723605 100644 --- a/vespalib/src/vespa/vespalib/util/memoryusage.cpp +++ b/vespalib/src/vespa/vespalib/util/memoryusage.cpp @@ -5,7 +5,7 @@ namespace vespalib { -string +std::string MemoryUsage::toString() const { vespalib::asciistream os; os << *this; diff --git a/vespalib/src/vespa/vespalib/util/memoryusage.h b/vespalib/src/vespa/vespalib/util/memoryusage.h index ffd08d4c1f76..34ca05bf418a 100644 --- a/vespalib/src/vespa/vespalib/util/memoryusage.h +++ b/vespalib/src/vespa/vespalib/util/memoryusage.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { @@ -56,7 +56,7 @@ class MemoryUsage { _deadBytes += rhs._deadBytes; _allocatedBytesOnHold += rhs._allocatedBytesOnHold; } - string toString() const; + std::string toString() const; }; class asciistream; diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp index 49b875463a7f..1e2418538a46 100644 --- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp +++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.cpp @@ -15,12 +15,12 @@ namespace fs = std::filesystem; namespace vespalib::alloc { -MmapFileAllocator::MmapFileAllocator(vespalib::string dir_name) +MmapFileAllocator::MmapFileAllocator(std::string dir_name) : MmapFileAllocator(std::move(dir_name), default_small_limit, default_premmap_size) { } -MmapFileAllocator::MmapFileAllocator(vespalib::string dir_name, uint32_t small_limit, uint32_t premmap_size) +MmapFileAllocator::MmapFileAllocator(std::string dir_name, uint32_t small_limit, uint32_t premmap_size) : _dir_name(std::move(dir_name)), _small_limit(small_limit), _premmap_size(premmap_size), diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.h b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.h index ee310af9cff9..af108b8946c5 100644 --- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator.h +++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator.h @@ -6,9 +6,9 @@ #include "file_area_freelist.h" #include #include -#include #include #include +#include namespace vespalib::alloc { @@ -31,7 +31,7 @@ class MmapFileAllocator : public MemoryAllocator { { } }; using Allocations = hash_map; - const vespalib::string _dir_name; + const std::string _dir_name; const uint32_t _small_limit; const uint32_t _premmap_size; mutable File _file; @@ -51,8 +51,8 @@ class MmapFileAllocator : public MemoryAllocator { public: static constexpr uint32_t default_small_limit = 128_Ki; static constexpr uint32_t default_premmap_size = 1_Mi; - explicit MmapFileAllocator(vespalib::string dir_name); - MmapFileAllocator(vespalib::string dir_name, uint32_t small_limit, uint32_t premmap_size); + explicit MmapFileAllocator(std::string dir_name); + MmapFileAllocator(std::string dir_name, uint32_t small_limit, uint32_t premmap_size); ~MmapFileAllocator() override; PtrAndSize alloc(size_t sz) const override; void free(PtrAndSize alloc) const noexcept override; diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp index 2c99eabfdc3f..4cf861e46e85 100644 --- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp +++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp @@ -16,7 +16,7 @@ MmapFileAllocatorFactory::MmapFileAllocatorFactory() MmapFileAllocatorFactory::~MmapFileAllocatorFactory() = default; void -MmapFileAllocatorFactory::setup(const vespalib::string& dir_name) +MmapFileAllocatorFactory::setup(const std::string& dir_name) { _dir_name = dir_name; _generation = 0; @@ -26,7 +26,7 @@ MmapFileAllocatorFactory::setup(const vespalib::string& dir_name) } std::unique_ptr -MmapFileAllocatorFactory::make_memory_allocator(const vespalib::string& name) +MmapFileAllocatorFactory::make_memory_allocator(const std::string& name) { if (_dir_name.empty()) { return {}; diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.h b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.h index ed97ee5c2d29..71ac2e873a54 100644 --- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.h +++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.h @@ -2,9 +2,9 @@ #pragma once -#include -#include #include +#include +#include namespace vespalib::alloc { @@ -14,7 +14,7 @@ class MemoryAllocator; * Class for creating an mmap file allocator on demand. */ class MmapFileAllocatorFactory { - vespalib::string _dir_name; + std::string _dir_name; std::atomic _generation; MmapFileAllocatorFactory(); @@ -22,8 +22,8 @@ class MmapFileAllocatorFactory { MmapFileAllocatorFactory(const MmapFileAllocatorFactory &) = delete; MmapFileAllocatorFactory& operator=(const MmapFileAllocatorFactory &) = delete; public: - void setup(const vespalib::string &dir_name); - std::unique_ptr make_memory_allocator(const vespalib::string& name); + void setup(const std::string &dir_name); + std::unique_ptr make_memory_allocator(const std::string& name); static MmapFileAllocatorFactory& instance(); }; diff --git a/vespalib/src/vespa/vespalib/util/normalize_class_name.cpp b/vespalib/src/vespa/vespalib/util/normalize_class_name.cpp index f0ae498a1a9d..41c2d33f0067 100644 --- a/vespalib/src/vespa/vespalib/util/normalize_class_name.cpp +++ b/vespalib/src/vespa/vespalib/util/normalize_class_name.cpp @@ -7,11 +7,11 @@ namespace vespalib { namespace { void -normalize_class_name_helper(vespalib::string& class_name, const vespalib::string& old, const vespalib::string& replacement) +normalize_class_name_helper(std::string& class_name, const std::string& old, const std::string& replacement) { for (;;) { auto pos = class_name.find(old); - if (pos == vespalib::string::npos) { + if (pos == std::string::npos) { break; } class_name.replace(pos, old.size(), replacement); @@ -20,8 +20,8 @@ normalize_class_name_helper(vespalib::string& class_name, const vespalib::string } -vespalib::string -normalize_class_name(vespalib::string class_name) +std::string +normalize_class_name(std::string class_name) { normalize_class_name_helper(class_name, "long long", "long"); normalize_class_name_helper(class_name, ">>", "> >"); diff --git a/vespalib/src/vespa/vespalib/util/normalize_class_name.h b/vespalib/src/vespa/vespalib/util/normalize_class_name.h index 597243bd0914..4c008377ec33 100644 --- a/vespalib/src/vespa/vespalib/util/normalize_class_name.h +++ b/vespalib/src/vespa/vespalib/util/normalize_class_name.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { @@ -10,6 +10,6 @@ namespace vespalib { * Normalize a demangled class name to compensate for different demangling * with g++ / libstdc++ / binutils and clang++ / libc++ / llvm toolchains. */ -vespalib::string normalize_class_name(vespalib::string class_name); +std::string normalize_class_name(std::string class_name); } diff --git a/vespalib/src/vespa/vespalib/util/printable.cpp b/vespalib/src/vespa/vespalib/util/printable.cpp index 4b3ce8b11e38..1ae1e5e1bdf7 100644 --- a/vespalib/src/vespa/vespalib/util/printable.cpp +++ b/vespalib/src/vespa/vespalib/util/printable.cpp @@ -13,7 +13,7 @@ std::string Printable::toString(bool verbose, const std::string& indent) const return o.str(); } -vespalib::string +std::string AsciiPrintable::PrintProperties::indent(uint32_t extraLevels) const { vespalib::asciistream as; @@ -33,7 +33,7 @@ AsciiPrintable::print(std::ostream& out, bool verbose, out << as.view(); } -vespalib::string +std::string AsciiPrintable::toString(const PrintProperties& p) const { vespalib::asciistream as; diff --git a/vespalib/src/vespa/vespalib/util/printable.h b/vespalib/src/vespa/vespalib/util/printable.h index ed3da18619a6..df5bdf68e9f6 100644 --- a/vespalib/src/vespa/vespalib/util/printable.h +++ b/vespalib/src/vespa/vespalib/util/printable.h @@ -30,7 +30,8 @@ #pragma once -#include +#include +#include #include namespace vespalib { @@ -100,7 +101,7 @@ class AsciiPrintable : public Printable { class PrintProperties { PrintMode _mode; - vespalib::string _indent; + std::string _indent; public: PrintProperties(PrintMode mode = NORMAL, std::string_view indent_ = "") @@ -109,14 +110,14 @@ class AsciiPrintable : public Printable { PrintProperties indentedCopy() const { return PrintProperties(_mode, _indent + " "); } bool verbose() const { return (_mode == VERBOSE); } - const vespalib::string& indent() const { return _indent; } - vespalib::string indent(uint32_t extraLevels) const; + const std::string& indent() const { return _indent; } + std::string indent(uint32_t extraLevels) const; }; void print(std::ostream& out, bool verbose, const std::string& indent) const override; virtual void print(vespalib::asciistream&, const PrintProperties& = PrintProperties()) const = 0; - vespalib::string toString(const PrintProperties& = PrintProperties()) const; + std::string toString(const PrintProperties& = PrintProperties()) const; }; std::ostream& operator<<(std::ostream& out, const Printable& p); diff --git a/vespalib/src/vespa/vespalib/util/process_memory_stats.cpp b/vespalib/src/vespa/vespalib/util/process_memory_stats.cpp index b16eb8166855..8981802bfbc1 100644 --- a/vespalib/src/vespa/vespalib/util/process_memory_stats.cpp +++ b/vespalib/src/vespa/vespalib/util/process_memory_stats.cpp @@ -97,7 +97,7 @@ ProcessMemoryStats::createStatsFromSmaps() bool anonymous = true; uint64_t lineVal = 0; while (!smaps.eof()) { - string backedLine = smaps.getline(); + std::string backedLine = smaps.getline(); std::string_view line(backedLine); if (isRange(line)) { ret._mappings_count += 1; @@ -171,7 +171,7 @@ ProcessMemoryStats::similarTo(const ProcessMemoryStats &rhs, double epsilon) con (_mappings_count == rhs._mappings_count); } -vespalib::string +std::string ProcessMemoryStats::toString() const { vespalib::asciistream stream; diff --git a/vespalib/src/vespa/vespalib/util/process_memory_stats.h b/vespalib/src/vespa/vespalib/util/process_memory_stats.h index a951e5775fac..bf59e0d5d0c3 100644 --- a/vespalib/src/vespa/vespalib/util/process_memory_stats.h +++ b/vespalib/src/vespa/vespalib/util/process_memory_stats.h @@ -2,7 +2,8 @@ #pragma once -#include +#include +#include namespace vespalib { @@ -35,7 +36,7 @@ class ProcessMemoryStats uint64_t getAnonymousRss() const { return _anonymous_rss; } uint64_t getMappingsCount() const { return _mappings_count; } bool similarTo(const ProcessMemoryStats &rhs, double epsilon) const; - vespalib::string toString() const; + std::string toString() const; bool operator < (const ProcessMemoryStats & rhs) const { return _anonymous_rss < rhs._anonymous_rss; } /** for unit tests only */ diff --git a/vespalib/src/vespa/vespalib/util/regexp.cpp b/vespalib/src/vespa/vespalib/util/regexp.cpp index 0ad00374f073..2cfa46cac59c 100644 --- a/vespalib/src/vespa/vespalib/util/regexp.cpp +++ b/vespalib/src/vespa/vespalib/util/regexp.cpp @@ -24,11 +24,11 @@ bool maybe_none(char c) { (c == '?')); } -const vespalib::string special("^|()[]{}.*?+\\$"); +const std::string special("^|()[]{}.*?+\\$"); bool is_special(char c) { return special.find(c) != special.npos; } -vespalib::string escape(std::string_view str) { - vespalib::string result; +std::string escape(std::string_view str) { + std::string result; for (char c: str) { if (is_special(c)) { result.push_back('\\'); @@ -40,10 +40,10 @@ vespalib::string escape(std::string_view str) { } // namespace vespalib:: -vespalib::string +std::string RegexpUtil::get_prefix(std::string_view re) { - vespalib::string prefix; + std::string prefix; if ((re.size() > 0) && (re.data()[0] == '^') && !has_option(re)) { const char *end = re.data() + re.size(); const char *pos = re.data() + 1; @@ -57,13 +57,13 @@ RegexpUtil::get_prefix(std::string_view re) return prefix; } -vespalib::string +std::string RegexpUtil::make_from_suffix(std::string_view suffix) { return escape(suffix) + "$"; } -vespalib::string +std::string RegexpUtil::make_from_substring(std::string_view substring) { return escape(substring); diff --git a/vespalib/src/vespa/vespalib/util/regexp.h b/vespalib/src/vespa/vespalib/util/regexp.h index 6c4eb3026ddc..a2428595eeaf 100644 --- a/vespalib/src/vespa/vespalib/util/regexp.h +++ b/vespalib/src/vespa/vespalib/util/regexp.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include namespace vespalib { @@ -21,7 +21,7 @@ class RegexpUtil * @param re Regular expression. * @return prefix that must be present in matching strings **/ - static vespalib::string get_prefix(std::string_view re); + static std::string get_prefix(std::string_view re); /** * Make a regexp matching strings with the given suffix. @@ -29,7 +29,7 @@ class RegexpUtil * @param suffix the suffix * @return the regexp **/ - static vespalib::string make_from_suffix(std::string_view suffix); + static std::string make_from_suffix(std::string_view suffix); /** * Make a regexp matching strings with the given substring. @@ -37,7 +37,7 @@ class RegexpUtil * @param substring the substring * @return the regexp **/ - static vespalib::string make_from_substring(std::string_view substring); + static std::string make_from_substring(std::string_view substring); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/require.h b/vespalib/src/vespa/vespalib/util/require.h index c6009bb34f6b..310eed96358d 100644 --- a/vespalib/src/vespa/vespalib/util/require.h +++ b/vespalib/src/vespa/vespalib/util/require.h @@ -5,6 +5,7 @@ #include "macro.h" #include "approx.h" #include "classname.h" +#include #include #include #include diff --git a/vespalib/src/vespa/vespalib/util/rusage.cpp b/vespalib/src/vespa/vespalib/util/rusage.cpp index b0245a4e8142..ec787239b3fd 100644 --- a/vespalib/src/vespa/vespalib/util/rusage.cpp +++ b/vespalib/src/vespa/vespalib/util/rusage.cpp @@ -64,10 +64,10 @@ RUsage::createChildren(vespalib::steady_time since) return r; } -vespalib::string +std::string RUsage::toString() { - vespalib::string s; + std::string s; if (_time != duration::zero()) s += make_string("duration = %1.6f\n", vespalib::to_s(_time)); if (from_timeval(ru_utime) > duration::zero()) s += make_string("user time = %1.6f\n", to_s(from_timeval(ru_utime))); if (from_timeval(ru_stime) > duration::zero()) s += make_string("system time = %1.6f\n", to_s(from_timeval(ru_stime))); diff --git a/vespalib/src/vespa/vespalib/util/rusage.h b/vespalib/src/vespa/vespalib/util/rusage.h index 32f257e7dbd3..aa6fd7c25f16 100644 --- a/vespalib/src/vespa/vespalib/util/rusage.h +++ b/vespalib/src/vespa/vespalib/util/rusage.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include +#include namespace vespalib { @@ -26,7 +26,7 @@ class RUsage : private rusage { /** * Will create an RUsage and initialize member with RUSAGE_CHILDREN **/ - vespalib::string toString(); + std::string toString(); RUsage & operator -= (const RUsage & rhs); private: vespalib::duration _time; diff --git a/vespalib/src/vespa/vespalib/util/shared_string_repo.cpp b/vespalib/src/vespa/vespalib/util/shared_string_repo.cpp index 2176859427ae..71e2cfc0ba53 100644 --- a/vespalib/src/vespa/vespalib/util/shared_string_repo.cpp +++ b/vespalib/src/vespa/vespalib/util/shared_string_repo.cpp @@ -61,7 +61,7 @@ SharedStringRepo::Partition::Partition() SharedStringRepo::Partition::Entry::Entry(Entry &&) noexcept = default; SharedStringRepo::Partition::Entry::~Entry() = default; -vespalib::string +std::string SharedStringRepo::Partition::Entry::as_string() const { assert(!is_free()); return _str; @@ -94,7 +94,7 @@ SharedStringRepo::Partition::resolve(const AltKey &alt_key) { } } -vespalib::string +std::string SharedStringRepo::Partition::as_string(uint32_t idx) const { std::lock_guard guard(_lock); return _entries[idx].as_string(); @@ -124,7 +124,7 @@ SharedStringRepo::Partition::find_leaked_entries(size_t my_idx) const if (!_entries[i].is_free()) { size_t id = (((i << PART_BITS) | my_idx) + 1); LOG(warning, "leaked string id: %zu (part: %zu/%d, string: '%s')\n", - id, my_idx, NUM_PARTS, vespalib::string(_entries[i].view()).c_str()); + id, my_idx, NUM_PARTS, std::string(_entries[i].view()).c_str()); } } } @@ -215,7 +215,7 @@ try_make_direct_id(std::string_view str) noexcept { } } -vespalib::string +std::string string_from_direct_id(uint32_t id) { if (id == 0) { return {}; @@ -242,7 +242,7 @@ SharedStringRepo::resolve(std::string_view str) { } } -vespalib::string +std::string SharedStringRepo::as_string(string_id id) { if (id._id >= ID_BIAS) { uint32_t part = (id._id - ID_BIAS) & PART_MASK; diff --git a/vespalib/src/vespa/vespalib/util/shared_string_repo.h b/vespalib/src/vespa/vespalib/util/shared_string_repo.h index a11141dc558a..efdd2ce3e098 100644 --- a/vespalib/src/vespa/vespalib/util/shared_string_repo.h +++ b/vespalib/src/vespa/vespalib/util/shared_string_repo.h @@ -5,7 +5,7 @@ #include "memoryusage.h" #include "string_id.h" #include "spin_lock.h" -#include +#include #include #include #include @@ -87,7 +87,7 @@ class SharedStringRepo { _str.clear(); _str.shrink_to_fit(); } - [[nodiscard]] VESPA_DLL_LOCAL vespalib::string as_string() const; + [[nodiscard]] VESPA_DLL_LOCAL std::string as_string() const; VESPA_DLL_LOCAL void add_ref(); VESPA_DLL_LOCAL bool sub_ref(); }; @@ -123,7 +123,7 @@ class SharedStringRepo { VESPA_DLL_LOCAL void find_leaked_entries(size_t my_idx) const; VESPA_DLL_LOCAL Stats stats() const; VESPA_DLL_LOCAL uint32_t resolve(const AltKey &alt_key); - VESPA_DLL_LOCAL vespalib::string as_string(uint32_t idx) const; + VESPA_DLL_LOCAL std::string as_string(uint32_t idx) const; VESPA_DLL_LOCAL void copy(uint32_t idx); VESPA_DLL_LOCAL void reclaim(uint32_t idx); }; @@ -134,7 +134,7 @@ class SharedStringRepo { ~SharedStringRepo(); string_id resolve(std::string_view str); - vespalib::string as_string(string_id id); + std::string as_string(string_id id); string_id copy(string_id id); void reclaim(string_id id); @@ -174,7 +174,7 @@ class SharedStringRepo { bool operator!=(const Handle &rhs) const noexcept { return (_id != rhs._id); } [[nodiscard]] string_id id() const noexcept { return _id; } [[nodiscard]] uint32_t hash() const noexcept { return _id.hash(); } - [[nodiscard]] vespalib::string as_string() const { return _repo.as_string(_id); } + [[nodiscard]] std::string as_string() const { return _repo.as_string(_id); } static Handle handle_from_id(string_id weak_id) { return Handle(weak_id); } static Handle handle_from_number(int64_t value) { if ((value < 0) || (value > FAST_ID_MAX)) { @@ -182,7 +182,7 @@ class SharedStringRepo { } return Handle(string_id(value + 1)); } - static vespalib::string string_from_id(string_id weak_id) { return _repo.as_string(weak_id); } + static std::string string_from_id(string_id weak_id) { return _repo.as_string(weak_id); } ~Handle() { _repo.reclaim(_id); } }; diff --git a/vespalib/src/vespa/vespalib/util/signalhandler.cpp b/vespalib/src/vespa/vespalib/util/signalhandler.cpp index b6a8c4f735f4..f9971663883d 100644 --- a/vespalib/src/vespa/vespalib/util/signalhandler.cpp +++ b/vespalib/src/vespa/vespalib/util/signalhandler.cpp @@ -184,7 +184,7 @@ SignalHandler::enable_cross_thread_stack_tracing() * 4. Caller exits poll-loop and assembles a complete stack trace from the frame * addresses in the shared buffer, all demangled and shiny. */ -string +std::string SignalHandler::get_cross_thread_stack_trace(pthread_t thread_id) { if (!_shared_backtrace_data._signal_is_hooked) { diff --git a/vespalib/src/vespa/vespalib/util/signalhandler.h b/vespalib/src/vespa/vespalib/util/signalhandler.h index b3c6ec1e5c7c..fcd68f32d886 100644 --- a/vespalib/src/vespa/vespalib/util/signalhandler.h +++ b/vespalib/src/vespa/vespalib/util/signalhandler.h @@ -1,11 +1,11 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include +#include #include +#include #include -#include -#include namespace vespalib { @@ -142,7 +142,7 @@ class SignalHandler * Due to potentially heavy internal synchronization overhead, this is not a function * that should be used in any kind of hot code path. Intended for debugging purposes. */ - static string get_cross_thread_stack_trace(pthread_t thread_id); + static std::string get_cross_thread_stack_trace(pthread_t thread_id); static void shutdown(); }; diff --git a/vespalib/src/vespa/vespalib/util/static_string.h b/vespalib/src/vespa/vespalib/util/static_string.h index 89eaba13fa10..582b9462ad50 100644 --- a/vespalib/src/vespa/vespalib/util/static_string.h +++ b/vespalib/src/vespa/vespalib/util/static_string.h @@ -2,8 +2,8 @@ #pragma once +#include #include -#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/string_escape.cpp b/vespalib/src/vespa/vespalib/util/string_escape.cpp index 5487598a564a..f181c56275e2 100644 --- a/vespalib/src/vespa/vespalib/util/string_escape.cpp +++ b/vespalib/src/vespa/vespalib/util/string_escape.cpp @@ -41,7 +41,7 @@ void do_write_xml_content_escaped(StreamT& out, std::string_view str) { } -vespalib::string xml_attribute_escaped(std::string_view str) { +std::string xml_attribute_escaped(std::string_view str) { vespalib::asciistream ost; for (const char s : str) { if (s == '"' || s == '\'' || s == '\n' @@ -62,7 +62,7 @@ vespalib::string xml_attribute_escaped(std::string_view str) { return ost.str(); } -vespalib::string xml_content_escaped(std::string_view str) { +std::string xml_content_escaped(std::string_view str) { vespalib::asciistream out; do_write_xml_content_escaped(out, str); return out.str(); diff --git a/vespalib/src/vespa/vespalib/util/string_escape.h b/vespalib/src/vespa/vespalib/util/string_escape.h index bc394e8d216e..922d3585f3e6 100644 --- a/vespalib/src/vespa/vespalib/util/string_escape.h +++ b/vespalib/src/vespa/vespalib/util/string_escape.h @@ -2,8 +2,8 @@ #pragma once #include -#include #include +#include namespace vespalib { @@ -12,14 +12,14 @@ namespace vespalib { * - all control chars < char value 32 * - <, >, &, " and ' */ -[[nodiscard]] vespalib::string xml_attribute_escaped(std::string_view s); +[[nodiscard]] std::string xml_attribute_escaped(std::string_view s); /** * Returns input string but where the following characters are escaped: * - all control chars < char value 32, _except_ linebreak * - <, > and & */ -[[nodiscard]] vespalib::string xml_content_escaped(std::string_view s); +[[nodiscard]] std::string xml_content_escaped(std::string_view s); void write_xml_content_escaped(vespalib::asciistream& out, std::string_view s); void write_xml_content_escaped(std::ostream& out, std::string_view s); diff --git a/vespalib/src/vespa/vespalib/util/string_hash.cpp b/vespalib/src/vespa/vespalib/util/string_hash.cpp index ecc1d1c969e7..f57ce89f95bf 100644 --- a/vespalib/src/vespa/vespalib/util/string_hash.cpp +++ b/vespalib/src/vespa/vespalib/util/string_hash.cpp @@ -2,6 +2,7 @@ #include "string_hash.h" #include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/string_hash.h b/vespalib/src/vespa/vespalib/util/string_hash.h index 7f9558fe3102..f239d081bb9d 100644 --- a/vespalib/src/vespa/vespalib/util/string_hash.h +++ b/vespalib/src/vespa/vespalib/util/string_hash.h @@ -2,7 +2,7 @@ #pragma once -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.cpp b/vespalib/src/vespa/vespalib/util/stringfmt.cpp index 8c76309d2866..635a8b8b7783 100644 --- a/vespalib/src/vespa/vespalib/util/stringfmt.cpp +++ b/vespalib/src/vespa/vespalib/util/stringfmt.cpp @@ -8,7 +8,7 @@ namespace vespalib { //----------------------------------------------------------------------------- -vespalib::string +std::string make_string_va(const char *fmt, va_list ap) { va_list ap2; @@ -21,7 +21,7 @@ make_string_va(const char *fmt, va_list ap) assert(size >= 0); if (sizeof(buffer) > static_cast(size)) { - return vespalib::string(buffer, size); + return std::string(buffer, size); } auto allocated = std::make_unique(size + 1); @@ -29,7 +29,7 @@ make_string_va(const char *fmt, va_list ap) int newLen = vsnprintf(allocated.get(), size + 1, fmt, ap2); va_end(ap2); assert(newLen == size); - return vespalib::string(allocated.get(), size); + return std::string(allocated.get(), size); } /** @@ -38,23 +38,23 @@ make_string_va(const char *fmt, va_list ap) * You must \#include * to use this utility function. * @param fmt format string - * @return formatted vespalib::string + * @return formatted std::string **/ -vespalib::string make_string(const char *fmt, ...) +std::string make_string(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vespalib::string ret = make_string_va(fmt, ap); + std::string ret = make_string_va(fmt, ap); va_end(ap); return ret; } namespace make_string_short { -vespalib::string fmt(const char *format, ...) +std::string fmt(const char *format, ...) { va_list ap; va_start(ap, format); - vespalib::string ret = make_string_va(format, ap); + std::string ret = make_string_va(format, ap); va_end(ap); return ret; } diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.h b/vespalib/src/vespa/vespalib/util/stringfmt.h index c6af468b262a..f9eb26528b7e 100644 --- a/vespalib/src/vespa/vespalib/util/stringfmt.h +++ b/vespalib/src/vespa/vespalib/util/stringfmt.h @@ -1,18 +1,18 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include +#include namespace vespalib { -extern vespalib::string make_string_va(const char *fmt, va_list ap); +extern std::string make_string_va(const char *fmt, va_list ap); -extern vespalib::string make_string(const char *fmt, ...) __attribute__ ((format (printf,1,2))); +extern std::string make_string(const char *fmt, ...) __attribute__ ((format (printf,1,2))); namespace make_string_short { -extern vespalib::string fmt(const char *format, ...) __attribute__ ((format (printf,1,2))); +extern std::string fmt(const char *format, ...) __attribute__ ((format (printf,1,2))); } // namespace vespalib::make_string_short } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/time.cpp b/vespalib/src/vespa/vespalib/util/time.cpp index f4e8dfee85eb..4ed7058987e6 100644 --- a/vespalib/src/vespa/vespalib/util/time.cpp +++ b/vespalib/src/vespa/vespalib/util/time.cpp @@ -42,7 +42,7 @@ adjustTimeoutByDetectedHz(duration timeout) { namespace { -string +std::string to_string(duration dur) { time_t timeStamp = std::chrono::duration_cast(dur).count(); struct tm timeStruct; @@ -57,12 +57,12 @@ to_string(duration dur) { } -string +std::string to_string(system_time time) { return to_string(time.time_since_epoch()); } -string +std::string to_string(file_time time) { return to_string(time.time_since_epoch()); } diff --git a/vespalib/src/vespa/vespalib/util/time.h b/vespalib/src/vespa/vespalib/util/time.h index 00287d847d63..8faf0cae0d6d 100644 --- a/vespalib/src/vespa/vespalib/util/time.h +++ b/vespalib/src/vespa/vespalib/util/time.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include #include // Guidelines: @@ -75,8 +75,8 @@ constexpr duration from_timespec(const timespec & ts) { return duration(ts.tv_sec*1000000000L + ts.tv_nsec); } -vespalib::string to_string(system_time time); -vespalib::string to_string(file_time time); +std::string to_string(system_time time); +std::string to_string(file_time time); steady_time saturated_add(steady_time time, duration diff); diff --git a/vespalib/src/vespa/vespalib/util/unwind_message.cpp b/vespalib/src/vespa/vespalib/util/unwind_message.cpp index 0fa7e1cb66e9..94dde0c8e306 100644 --- a/vespalib/src/vespa/vespalib/util/unwind_message.cpp +++ b/vespalib/src/vespa/vespalib/util/unwind_message.cpp @@ -5,7 +5,7 @@ namespace vespalib { -UnwindMessage::UnwindMessage(const vespalib::string &msg) +UnwindMessage::UnwindMessage(const std::string &msg) : _num_active(std::uncaught_exceptions()), _message(msg) { @@ -28,7 +28,7 @@ UnwindMessage unwind_msg(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vespalib::string msg = make_string_va(fmt, ap); + std::string msg = make_string_va(fmt, ap); va_end(ap); return {msg}; } diff --git a/vespalib/src/vespa/vespalib/util/unwind_message.h b/vespalib/src/vespa/vespalib/util/unwind_message.h index 95f4c03192f3..4b06d77e0856 100644 --- a/vespalib/src/vespa/vespalib/util/unwind_message.h +++ b/vespalib/src/vespa/vespalib/util/unwind_message.h @@ -14,9 +14,9 @@ namespace vespalib { class UnwindMessage { private: int _num_active; - vespalib::string _message; + std::string _message; public: - UnwindMessage(const vespalib::string &msg); + UnwindMessage(const std::string &msg); UnwindMessage(UnwindMessage &&rhs) noexcept ; UnwindMessage(const UnwindMessage &) = delete; UnwindMessage &operator=(const UnwindMessage &) = delete; diff --git a/vespalib/src/vespa/vespalib/util/vespa_dll_local.h b/vespalib/src/vespa/vespalib/util/vespa_dll_local.h new file mode 100644 index 000000000000..4b062e25122a --- /dev/null +++ b/vespalib/src/vespa/vespalib/util/vespa_dll_local.h @@ -0,0 +1,5 @@ +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#define VESPA_DLL_LOCAL __attribute__ ((visibility("hidden"))) diff --git a/vespalib/src/vespa/vespalib/util/xmlstream.cpp b/vespalib/src/vespa/vespalib/util/xmlstream.cpp index ac486ba9cd8d..7df8d6e9830b 100644 --- a/vespalib/src/vespa/vespalib/util/xmlstream.cpp +++ b/vespalib/src/vespa/vespalib/util/xmlstream.cpp @@ -399,7 +399,7 @@ XmlContentWrapper::XmlContentWrapper(const char* value, uint32_t size) using CharP = char *; -template XmlAttribute::XmlAttribute(const std::string &, vespalib::string, unsigned int); +template XmlAttribute::XmlAttribute(const std::string &, std::string, unsigned int); template XmlAttribute::XmlAttribute(const std::string &, std::string_view, unsigned int); template XmlAttribute::XmlAttribute(const std::string &, CharP, unsigned int); template XmlAttribute::XmlAttribute(const std::string &, bool, unsigned int); diff --git a/vespalog/src/vespa/log/internal.h b/vespalog/src/vespa/log/internal.h index a5efddd27bbb..e8d3f1fe51a0 100644 --- a/vespalog/src/vespa/log/internal.h +++ b/vespalog/src/vespa/log/internal.h @@ -1,9 +1,9 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include +#include namespace ns_log { diff --git a/vespalog/src/vespa/log/log_message.h b/vespalog/src/vespa/log/log_message.h index 7df3157a6b51..f97452fe0932 100644 --- a/vespalog/src/vespa/log/log_message.h +++ b/vespalog/src/vespa/log/log_message.h @@ -3,8 +3,8 @@ #pragma once #include "log.h" -#include #include +#include namespace ns_log { diff --git a/vespalog/src/vespa/log/reject-filter.h b/vespalog/src/vespa/log/reject-filter.h index f2643d2ca141..548bb301903a 100644 --- a/vespalog/src/vespa/log/reject-filter.h +++ b/vespalog/src/vespa/log/reject-filter.h @@ -3,8 +3,8 @@ #include -#include #include +#include namespace ns_log { diff --git a/vespamalloc/src/tests/doubledelete/expectsignal.cpp b/vespamalloc/src/tests/doubledelete/expectsignal.cpp index e3ed10795227..fa1ef9b724fe 100644 --- a/vespamalloc/src/tests/doubledelete/expectsignal.cpp +++ b/vespamalloc/src/tests/doubledelete/expectsignal.cpp @@ -14,7 +14,7 @@ TEST_MAIN() { fprintf(stderr, "argc=%d : Running '%s' expecting signal %d\n", argc, argv[2], retval); Process cmd(argv[2]); - for (vespalib::string line = cmd.read_line(); !(line.empty() && cmd.eof()); line = cmd.read_line()) { + for (std::string line = cmd.read_line(); !(line.empty() && cmd.eof()); line = cmd.read_line()) { fprintf(stdout, "%s\n", line.c_str()); } int exitCode = cmd.join(); diff --git a/vespamalloc/src/tests/overwrite/expectsignal.cpp b/vespamalloc/src/tests/overwrite/expectsignal.cpp index 2c725ac07846..08c58df7d03c 100644 --- a/vespamalloc/src/tests/overwrite/expectsignal.cpp +++ b/vespamalloc/src/tests/overwrite/expectsignal.cpp @@ -13,7 +13,7 @@ TEST_MAIN() { fprintf(stderr, "argc=%d : Running '%s' expecting signal %d\n", argc, argv[2], retval); Process cmd(argv[2]); - for (vespalib::string line = cmd.read_line(); !(line.empty() && cmd.eof()); line = cmd.read_line()) { + for (std::string line = cmd.read_line(); !(line.empty() && cmd.eof()); line = cmd.read_line()) { fprintf(stdout, "%s\n", line.c_str()); } int exitCode = cmd.join();