diff options
author | Your Name <you@example.com> | 2021-08-17 08:56:06 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-08-17 08:56:06 -0400 |
commit | 8a6b5564c0fc37e6e556d04e17ddba86d4bd3dc1 (patch) | |
tree | 238d013eb3cfe2dc170a52dec3bfcd72a1e468ca /src/settings.cc | |
parent | 8c884838ced928d29a8436be8b2808766c5a1e53 (diff) | |
download | annotator-8a6b5564c0fc37e6e556d04e17ddba86d4bd3dc1.tar.gz annotator-8a6b5564c0fc37e6e556d04e17ddba86d4bd3dc1.tar.bz2 annotator-8a6b5564c0fc37e6e556d04e17ddba86d4bd3dc1.zip |
Started work on bounding boxes
Diffstat (limited to 'src/settings.cc')
-rw-r--r-- | src/settings.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/settings.cc b/src/settings.cc index d19acde..7004e1d 100644 --- a/src/settings.cc +++ b/src/settings.cc @@ -5,9 +5,9 @@ #include <stdexcept> namespace settings { - std::vector<std::string> getLabels() { + std::vector<std::string> readVector(std::string heading) { cfg_opt_t opts[] = { - CFG_STR_LIST("labels", NULL, CFGF_NONE), + CFG_STR_LIST(heading.c_str(), NULL, CFGF_NONE), CFG_END() }; cfg_t *cfg = cfg_init(opts, CFGF_IGNORE_UNKNOWN); @@ -17,12 +17,21 @@ namespace settings { try { std::vector<std::string> ret; std::size_t i; - for(i = 0; i < cfg_size(cfg, "labels"); i++) { - ret.push_back(cfg_getnstr(cfg, "labels", i)); + for(i = 0; i < cfg_size(cfg, heading.c_str()); i++) { + ret.push_back(cfg_getnstr(cfg, heading.c_str(), i)); } return ret; } catch(std::exception& e) { - throw std::runtime_error("Cannot find 'labels' in configuration file"); + throw std::runtime_error("Cannot find '" + heading + "' in configuration file"); } } + + std::vector<std::string> getLabels() { + return readVector("labels"); + } + + std::vector<std::string> getRectangleLabels() { + return readVector("rectangles"); + } } + |