X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fcache.cpp;h=30f3fc33a67141fe996874865828a76dd5ca39eb;hb=6b84e1f5673888753cbe566c1365222ed33fd3ac;hp=57b16d118ecd01cc27f99626e89cd9a5866ca475;hpb=1ec533a7777be4dce9c8b6bbb1cbc32d38098ae4;p=builder.git diff --git a/source/cache.cpp b/source/cache.cpp index 57b16d1..30f3fc3 100644 --- a/source/cache.cpp +++ b/source/cache.cpp @@ -65,7 +65,7 @@ Cache::Cache(SourcePackage &p): void Cache::set_value(const Target *tgt, const string &k, const string &v) { - ValueList vl; + Values vl; vl.push_back(v); set_values(tgt, k, vl); } @@ -75,28 +75,28 @@ void Cache::append_value(const Target *tgt, const string &k, const string &v) Key key(tgt->get_name(), k); auto i = data.find(key); if(i==data.end()) - i = data.insert({ key, ValueList() }).first; + i = data.insert({ key, Values() }).first; i->second.push_back(v); changed = true; - package.get_builder().get_logger().log("cache", format("Updated key %s %s+ %s", tgt->get_name(), k, v)); + package.get_builder().get_logger().log("cache", "Updated key %s %s+ %s", tgt->get_name(), k, v); } -void Cache::set_values(const Target *tgt, const string &k, const ValueList &v) +void Cache::set_values(const Target *tgt, const string &k, const Values &v) { data[Key(tgt->get_name(), k)] = v; changed = true; - package.get_builder().get_logger().log("cache", format("Updated key %s %s: %s", tgt->get_name(), k, join(v.begin(), v.end()))); + package.get_builder().get_logger().log("cache", "Updated key %s %s: %s", tgt->get_name(), k, join(v.begin(), v.end())); } const string &Cache::get_value(const Target *tgt, const string &k) { - const ValueList &values = get_values(tgt, k); + const Values &values = get_values(tgt, k); if(values.empty()) throw logic_error("values.empty()"); return values.front(); } -const Cache::ValueList &Cache::get_values(const Target *tgt, const string &k) +const Cache::Values &Cache::get_values(const Target *tgt, const string &k) { return get_item(data, Key(tgt->get_name(), k)); } @@ -110,7 +110,7 @@ void Cache::load() { if(FS::Stat st = FS::stat(filename)) { - package.get_builder().get_logger().log("files", format("Reading %s", filename)); + package.get_builder().get_logger().log("files", "Reading %s", filename); IO::BufferedFile in(filename.str()); while(!in.eof()) @@ -120,10 +120,10 @@ void Cache::load() key.second = read_string(in); if(key.first.empty() || key.second.empty()) break; - ValueList &values = data[key]; + Values &values = data[key]; for(unsigned count = read_count(in); count; --count) values.push_back(read_string(in)); - package.get_builder().get_logger().log("cache", format("Loaded key %s %s: %s", key.first, key.second, join(values.begin(), values.end()))); + package.get_builder().get_logger().log("cache", "Loaded key %s %s: %s", key.first, key.second, join(values.begin(), values.end())); } mtime = st.get_modify_time(); @@ -138,7 +138,7 @@ void Cache::save() const FS::Path dir = FS::dirname(filename); if(!FS::exists(dir)) FS::mkpath(dir, 0755); - package.get_builder().get_logger().log("files", format("Writing %s", filename)); + package.get_builder().get_logger().log("files", "Writing %s", filename); IO::BufferedFile out(filename.str(), IO::M_WRITE); for(const auto &kvp: data)