void config_cache_transaction::add_defines_map_diff(preproc_map& new_map) { if(get_state() == ACTIVE) { preproc_map temp; std::set_difference(new_map.begin(), new_map.end(), active_map_.begin(), active_map_.end(), std::insert_iterator<preproc_map>(temp,temp.begin()), &compare_define); for(const preproc_map::value_type &def : temp) { insert_to_active(def); } temp.swap(new_map); } else if (get_state() == LOCKED) { new_map.clear(); } }
void config_cache::write_file(std::string file_path, const preproc_map& defines) { if(defines.empty()) { if(filesystem::file_exists(file_path)) { filesystem::delete_directory(file_path); } return; } filesystem::scoped_ostream stream = filesystem::ostream_file(file_path); config_writer writer(*stream, true, game_config::cache_compression_level); // Write all defines to stream. for(const preproc_map::value_type& define : defines) { define.second.write(writer, define.first); } }
void config_cache::write_file(std::string path, const preproc_map& defines_map) { if (defines_map.empty()) { if (file_exists(path)) { delete_directory(path); } return; } scoped_ostream stream = ostream_file(path); const bool gzip = true; config_writer writer(*stream, gzip, game_config::cache_compression_level); // write all defines to stream BOOST_FOREACH(const preproc_map::value_type &define, defines_map) { define.second.write(writer, define.first); }