aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/common.hxx2
-rwxr-xr-xlibbrep/odb.sh5
-rw-r--r--libbrep/package.cxx4
-rw-r--r--libbrep/package.hxx8
-rw-r--r--libbrep/types.hxx2
-rw-r--r--mod/build-config-module.cxx2
-rw-r--r--mod/build-config-module.hxx2
-rw-r--r--mod/page.hxx6
-rw-r--r--tests/load/driver.cxx26
9 files changed, 35 insertions, 22 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 052aae1..0f92d17 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -270,7 +270,7 @@ namespace brep
// build_class_expr
//
using bpkg::build_class_expr;
- using build_class_exprs = vector<build_class_expr>;
+ using build_class_exprs = small_vector<build_class_expr, 1>;
#pragma db value(build_class_expr) definition
diff --git a/libbrep/odb.sh b/libbrep/odb.sh
index e2ba564..4172e67 100755
--- a/libbrep/odb.sh
+++ b/libbrep/odb.sh
@@ -44,7 +44,9 @@ else
fi
$odb "${inc[@]}" -d pgsql --std c++14 --generate-query \
+ --odb-epilogue '#include <libbutl/small-vector-odb.hxx>' \
--odb-epilogue '#include <libbrep/wrapper-traits.hxx>' \
+ --hxx-prologue '#include <libbutl/small-vector-odb.hxx>' \
--hxx-prologue '#include <libbrep/wrapper-traits.hxx>' \
--hxx-prologue '#include <libbrep/common-traits.hxx>' \
-DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2 \
@@ -54,6 +56,7 @@ $odb "${inc[@]}" -d pgsql --std c++14 --generate-query \
$odb "${inc[@]}" -d pgsql --std c++14 --generate-query --generate-schema \
--schema-format sql --schema-format embedded --schema-name package \
+ --odb-epilogue '#include <libbutl/small-vector-odb.hxx>' \
--odb-epilogue '#include <libbrep/wrapper-traits.hxx>' \
--hxx-prologue '#include <libbrep/package-traits.hxx>' \
--generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2 \
@@ -65,6 +68,7 @@ xxd -i <package-extra.sql >package-extra.hxx
$odb "${inc[@]}" -d pgsql --std c++14 --generate-query --generate-schema \
--schema-format sql --schema-format embedded --schema-name build \
+ --odb-epilogue '#include <libbutl/small-vector-odb.hxx>' \
--odb-epilogue '#include <libbrep/wrapper-traits.hxx>' \
--generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2 \
--include-with-brackets --include-prefix libbrep \
@@ -72,6 +76,7 @@ $odb "${inc[@]}" -d pgsql --std c++14 --generate-query --generate-schema \
build.hxx
$odb "${inc[@]}" -d pgsql --std c++14 --generate-query \
+ --odb-epilogue '#include <libbutl/small-vector-odb.hxx>' \
--odb-epilogue '#include <libbrep/wrapper-traits.hxx>' \
--generate-prepared -DLIBODB_BUILD2 -DLIBODB_PGSQL_BUILD2 \
--include-with-brackets --include-prefix libbrep \
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index b17dcc1..fe216d2 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -57,8 +57,8 @@ namespace brep
priority_type pr,
string sm,
license_alternatives_type la,
- strings tp,
- strings kw,
+ small_vector<string, 5> tp,
+ small_vector<string, 5> kw,
optional<string> ds,
optional<text_type> dt,
string ch,
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index 5e1bebd..69b25b8 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -373,8 +373,8 @@ namespace brep
priority_type,
string summary,
license_alternatives_type,
- strings topics,
- strings keywords,
+ small_vector<string, 5> topics,
+ small_vector<string, 5> keywords,
optional<string> description,
optional<text_type> description_type,
string changes,
@@ -433,8 +433,8 @@ namespace brep
priority_type priority;
string summary;
license_alternatives_type license_alternatives;
- strings topics;
- strings keywords;
+ small_vector<string, 5> topics;
+ small_vector<string, 5> keywords;
optional<string> description; // Absent if type is unknown.
optional<text_type> description_type; // Present if description is present.
string changes;
diff --git a/libbrep/types.hxx b/libbrep/types.hxx
index 2438b80..65c9791 100644
--- a/libbrep/types.hxx
+++ b/libbrep/types.hxx
@@ -26,6 +26,7 @@
#include <libbutl/path-io.mxx>
#include <libbutl/optional.mxx>
#include <libbutl/timestamp.mxx>
+#include <libbutl/small-vector.mxx>
namespace brep
{
@@ -49,6 +50,7 @@ namespace brep
using std::weak_ptr;
using std::vector;
+ using butl::small_vector; // <libbutl/small-vector.mxx>
using strings = vector<string>;
using cstrings = vector<const char*>;
diff --git a/mod/build-config-module.cxx b/mod/build-config-module.cxx
index 02bba01..d21849e 100644
--- a/mod/build-config-module.cxx
+++ b/mod/build-config-module.cxx
@@ -163,7 +163,7 @@ namespace brep
{"default"}, '+', "Default.");
bool build_config_module::
- exclude (const vector<build_class_expr>& exprs,
+ exclude (const small_vector<build_class_expr, 1>& exprs,
const vector<build_constraint>& constrs,
const build_config& cfg,
string* reason) const
diff --git a/mod/build-config-module.hxx b/mod/build-config-module.hxx
index 3ad1a83..25ddbb4 100644
--- a/mod/build-config-module.hxx
+++ b/mod/build-config-module.hxx
@@ -47,7 +47,7 @@ namespace brep
// requested.
//
bool
- exclude (const vector<bpkg::build_class_expr>&,
+ exclude (const small_vector<bpkg::build_class_expr, 1>&,
const vector<bpkg::build_constraint>&,
const bbot::build_config&,
string* reason = nullptr) const;
diff --git a/mod/page.hxx b/mod/page.hxx
index 2fc3a0b..cba8358 100644
--- a/mod/page.hxx
+++ b/mod/page.hxx
@@ -329,14 +329,16 @@ namespace brep
class TR_TOPICS
{
public:
- TR_TOPICS (const strings& ts, const dir_path& r, const string& t)
+ TR_TOPICS (const small_vector<string, 5>& ts,
+ const dir_path& r,
+ const string& t)
: topics_ (ts), root_ (r), tenant_ (t) {}
void
operator() (xml::serializer&) const;
private:
- const strings& topics_;
+ const small_vector<string, 5>& topics_;
const dir_path& root_;
const string& tenant_;
};
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 2e4dc54..1afa411 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -27,6 +27,9 @@ using namespace odb::core;
using namespace butl;
using namespace brep;
+using labels = small_vector<string, 5>;
+using req_alts = small_vector<string, 1>;
+
static const path packages ("packages.manifest");
static const path repositories ("repositories.manifest");
@@ -434,7 +437,8 @@ test_pkg_repos (const cstrings& loader_args,
package_id (tenant, package_name ("libfoo"), version ("1.2.2"))));
assert (fpv2->summary == "The Foo library");
- assert (fpv2->keywords == strings ({"c++", "foo"}));
+
+ assert (fpv2->keywords == labels ({"c++", "foo"}));
assert (!fpv2->description);
assert (fpv2->url && fpv2->url->string () == "http://www.example.com/foo/");
assert (!fpv2->package_url);
@@ -480,7 +484,7 @@ test_pkg_repos (const cstrings& loader_args,
version ("1.2.2-alpha.1"))));
assert (fpv2a->summary == "The Foo library");
- assert (fpv2a->keywords == strings ({"c++", "foo"}));
+ assert (fpv2a->keywords == labels ({"c++", "foo"}));
assert (!fpv2a->description);
assert (fpv2a->url && fpv2a->url->string () == "ftp://www.example.com/foo/");
assert (!fpv2a->package_url);
@@ -542,7 +546,7 @@ test_pkg_repos (const cstrings& loader_args,
package_id (tenant, package_name ("libfoo"), version ("1.2.3+4"))));
assert (fpv3->summary == "The Foo library");
- assert (fpv3->keywords == strings ({"c++", "foo"}));
+ assert (fpv3->keywords == labels ({"c++", "foo"}));
assert (!fpv3->description);
assert (fpv3->url && fpv3->url->string () == "http://www.example.com/foo/");
assert (!fpv3->package_url);
@@ -580,7 +584,7 @@ test_pkg_repos (const cstrings& loader_args,
package_id (tenant, package_name ("libfoo"), version ("1.2.4"))));
assert (fpv4->summary == "The Foo Library");
- assert (fpv4->keywords == strings ({"c++", "foo"}));
+ assert (fpv4->keywords == labels ({"c++", "foo"}));
assert (*fpv4->description == "Very good foo library.");
assert (fpv4->url && fpv4->url->string () == "http://www.example.com/foo/");
assert (!fpv4->package_url);
@@ -653,7 +657,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (xpv->summary == "Modern C++ XML API");
assert (xpv->keywords ==
- strings ({"c++", "xml", "parser", "serializer", "pull"}));
+ labels ({"c++", "xml", "parser", "serializer", "pull"}));
assert (!xpv->description);
assert (xpv->url &&
xpv->url->string () == "http://www.codesynthesis.com/projects/libstudxml/");
@@ -711,8 +715,8 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv5->summary == "The Foo Math Library");
assert (fpv5->topics ==
- strings ({"math library", "math API", "libbaz fork"}));
- assert (fpv5->keywords == strings ({"c++", "foo", "math", "best"}));
+ labels ({"math library", "math API", "libbaz fork"}));
+ assert (fpv5->keywords == labels ({"c++", "foo", "math", "best"}));
assert (*fpv5->description ==
"A modern C++ library with easy to use linear algebra and lot "
"of optimization\ntools.\n\nThere are over 100 functions in "
@@ -796,11 +800,11 @@ test_pkg_repos (const cstrings& loader_args,
requirements& fpvr5 (fpv5->requirements);
assert (fpvr5.size () == 4);
- assert (fpvr5[0] == strings ({"linux", "windows", "macosx"}));
+ assert (fpvr5[0] == req_alts ({"linux", "windows", "macosx"}));
assert (!fpvr5[0].conditional);
assert (fpvr5[0].comment == "Symbian support is coming.");
- assert (fpvr5[1] == strings ({"c++11"}));
+ assert (fpvr5[1] == req_alts ({"c++11"}));
assert (!fpvr5[1].conditional);
assert (fpvr5[1].comment.empty ());
@@ -809,7 +813,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpvr5[2].comment ==
"libc++ standard library if using Clang on Mac OS X.");
- assert (fpvr5[3] == strings ({"vc++ >= 12.0"}));
+ assert (fpvr5[3] == req_alts ({"vc++ >= 12.0"}));
assert (fpvr5[3].conditional);
assert (fpvr5[3].comment == "Only if using VC++ on Windows.");
@@ -831,7 +835,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (epv->upstream_version && *epv->upstream_version == "1.2.abc.15-x");
assert (epv->project == "mathLab");
assert (epv->summary == "The exponent");
- assert (epv->keywords == strings ({"mathlab", "c++", "exponent"}));
+ assert (epv->keywords == labels ({"mathlab", "c++", "exponent"}));
assert (epv->description && *epv->description ==
"The exponent math function.");
assert (epv->url && epv->url->string () == "http://exp.example.com");