diff --git a/Applications/TextMate/src/AppController Menus.mm b/Applications/TextMate/src/AppController Menus.mm index ab8a325d..8c887107 100644 --- a/Applications/TextMate/src/AppController Menus.mm +++ b/Applications/TextMate/src/AppController Menus.mm @@ -37,16 +37,16 @@ OAK_DEBUG_VAR(AppController_Menus); } std::multimap ordered; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeBundle)) - ordered.emplace((*item)->name(), *item); + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeBundle)) + ordered.emplace(item->name(), item); - iterate(pair, ordered) + for(auto const& pair : ordered) { - if(pair->second->menu().empty()) + if(pair.second->menu().empty()) continue; - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:NULL keyEquivalent:@""]; - menuItem.submenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCxxString:pair->second->uuid()]]; + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:NULL keyEquivalent:@""]; + menuItem.submenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCxxString:pair.second->uuid()]]; menuItem.submenu.delegate = [BundleMenuDelegate sharedInstance]; } @@ -60,14 +60,14 @@ OAK_DEBUG_VAR(AppController_Menus); [aMenu removeAllItems]; std::multimap ordered; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeTheme)) - ordered.emplace((*item)->name(), *item); + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeTheme)) + ordered.emplace(item->name(), item); - iterate(pair, ordered) + for(auto const& pair : ordered) { - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:@selector(takeThemeUUIDFrom:) keyEquivalent:@""]; - [menuItem setKeyEquivalentCxxString:key_equivalent(pair->second)]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:pair->second->uuid()]]; + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:@selector(takeThemeUUIDFrom:) keyEquivalent:@""]; + [menuItem setKeyEquivalentCxxString:key_equivalent(pair.second)]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:pair.second->uuid()]]; } if(ordered.empty()) @@ -96,12 +96,12 @@ OAK_DEBUG_VAR(AppController_Menus); ordered.emplace(to_s(str ?: lang), lang); } - iterate(it, ordered) + for(auto const& it : ordered) { - D(DBF_AppController_Menus, bug("Add Item: %s\n", it->first.c_str());); - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:it->first] action:@selector(takeSpellingLanguageFrom:) keyEquivalent:@""]; - D(DBF_AppController_Menus, bug("Represented Object: %s\n", [it->second UTF8String]);); - menuItem.representedObject = it->second; + D(DBF_AppController_Menus, bug("Add Item: %s\n", it.first.c_str());); + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:it.first] action:@selector(takeSpellingLanguageFrom:) keyEquivalent:@""]; + D(DBF_AppController_Menus, bug("Represented Object: %s\n", [it.second UTF8String]);); + menuItem.representedObject = it.second; } } diff --git a/Applications/TextMate/src/RMateServer.cc b/Applications/TextMate/src/RMateServer.cc index cf825d18..8083ea85 100644 --- a/Applications/TextMate/src/RMateServer.cc +++ b/Applications/TextMate/src/RMateServer.cc @@ -505,9 +505,9 @@ struct socket_observer_t reactivate_callback_t reactivate_callback; std::vector documents; - iterate(record, records) + for(auto& record : records) { - std::map& args = record->arguments; + std::map& args = record.arguments; bool wait = args["wait"] == "yes"; bool writeBackOnSave = args["data-on-save"] == "yes"; bool writeBackOnClose = args["data-on-close"] == "yes"; @@ -569,7 +569,7 @@ struct socket_observer_t doc->add_callback(new save_close_callback_t(doc->path(), socket, writeBackOnSave, writeBackOnClose, token)); if(args.find("data") != args.end() && (writeBackOnSave || writeBackOnClose)) - doc->add_callback(new retain_temp_file_callback_t(record->file)); + doc->add_callback(new retain_temp_file_callback_t(record.file)); if(reActivate) reactivate_callback.watch_document(doc); diff --git a/Applications/bl/src/bl.cc b/Applications/bl/src/bl.cc index a63c0496..5b032623 100644 --- a/Applications/bl/src/bl.cc +++ b/Applications/bl/src/bl.cc @@ -70,9 +70,9 @@ static bool matches (std::string const& str, std::vector const& glo if(globs.empty()) return true; - iterate(glob, globs) + for(auto const& glob : globs) { - if(path::glob_t(*glob).does_match(str)) + if(path::glob_t(glob).does_match(str)) return true; } @@ -83,14 +83,14 @@ static std::vector filtered_bundles (std::vector res; std::set seen; - iterate(bundle, index) + for(auto const& bundle : index) { - if(matches((*bundle)->source() ? (*bundle)->source()->identifier() : NULL_STR, sourceNames) && matches(text::lowercase((*bundle)->name()), bundleNames)) + if(matches(bundle->source() ? bundle->source()->identifier() : NULL_STR, sourceNames) && matches(text::lowercase(bundle->name()), bundleNames)) { - if(seen.find((*bundle)->uuid()) == seen.end()) + if(seen.find(bundle->uuid()) == seen.end()) { - seen.insert((*bundle)->uuid()); - res.push_back(*bundle); + seen.insert(bundle->uuid()); + res.push_back(bundle); } } } @@ -172,10 +172,10 @@ int main (int argc, char const* argv[]) if(CommandsNeedingUpdatedSources.find(command) != CommandsNeedingUpdatedSources.end()) { std::vector toUpdate; - citerate(source, bundles_db::sources(installDir)) + for(auto const& source : bundles_db::sources(installDir)) { - if(!(*source)->disabled() && (*source)->needs_update()) - toUpdate.push_back(*source); + if(!source->disabled() && source->needs_update()) + toUpdate.push_back(source); } __block std::vector failedUpdate; @@ -195,20 +195,20 @@ int main (int argc, char const* argv[]) std::vector index = bundles_db::index(installDir); if(command == "list") { - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { - if(!((onlyInstalled && !(*bundle)->installed()) || (onlyUpdated && !onlyInstalled && !(*bundle)->has_update()))) - fprintf(stdout, "%s\n", short_bundle_info(*bundle, get_width()).c_str()); + if(!((onlyInstalled && !bundle->installed()) || (onlyUpdated && !onlyInstalled && !bundle->has_update()))) + fprintf(stdout, "%s\n", short_bundle_info(bundle, get_width()).c_str()); } } else if(command == "install") { std::vector toInstall; - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { - if(!(*bundle)->installed()) - toInstall.push_back(*bundle); - else fprintf(stderr, "skip ‘%s’ (%s) -- already installed\n", (*bundle)->name().c_str(), (*bundle)->origin().c_str()); + if(!bundle->installed()) + toInstall.push_back(bundle); + else fprintf(stderr, "skip ‘%s’ (%s) -- already installed\n", bundle->name().c_str(), bundle->origin().c_str()); } dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @@ -254,18 +254,18 @@ int main (int argc, char const* argv[]) } else if(command == "uninstall") { - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { - if((*bundle)->installed()) + if(bundle->installed()) { - fprintf(stderr, "Uninstalling ‘%s’...", (*bundle)->name().c_str()); - if(uninstall(*bundle, installDir)) + fprintf(stderr, "Uninstalling ‘%s’...", bundle->name().c_str()); + if(uninstall(bundle, installDir)) fprintf(stderr, "ok!\n"); else fprintf(stderr, " *** failed!\n"); } else { - fprintf(stderr, "skip ‘%s’ (%s) -- not installed\n", (*bundle)->name().c_str(), (*bundle)->origin().c_str()); + fprintf(stderr, "skip ‘%s’ (%s) -- not installed\n", bundle->name().c_str(), bundle->origin().c_str()); } } save_index(index, installDir); @@ -273,60 +273,60 @@ int main (int argc, char const* argv[]) else if(command == "show") { bool first = true; - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { if(first) first = false; else fprintf(stdout, "\n"); - fprintf(stdout, "name: %s\n", (*bundle)->name().c_str()); - fprintf(stdout, "source: %s\n", (*bundle)->source() ? (*bundle)->source()->identifier().c_str() : "«no remote source»"); - fprintf(stdout, "uuid: %s\n", to_s((*bundle)->uuid()).c_str()); + fprintf(stdout, "name: %s\n", bundle->name().c_str()); + fprintf(stdout, "source: %s\n", bundle->source() ? bundle->source()->identifier().c_str() : "«no remote source»"); + fprintf(stdout, "uuid: %s\n", to_s(bundle->uuid()).c_str()); - bool hasName = (*bundle)->contact_name() != NULL_STR; - bool hasEmail = (*bundle)->contact_email() != NULL_STR; + bool hasName = bundle->contact_name() != NULL_STR; + bool hasEmail = bundle->contact_email() != NULL_STR; char const* fmt[] = { "", "contact: %1$s\n", "contact: <%2$s>\n\0%1$s", "contact: %1$s <%2$s>\n" }; - fprintf(stdout, fmt[(hasName ? 1 : 0) + (hasEmail ? 2 : 0)], (*bundle)->contact_name().c_str(), (*bundle)->contact_email().c_str()); + fprintf(stdout, fmt[(hasName ? 1 : 0) + (hasEmail ? 2 : 0)], bundle->contact_name().c_str(), bundle->contact_email().c_str()); - if((*bundle)->url_updated()) - fprintf(stdout, "date: %s\n", to_s((*bundle)->url_updated()).c_str()); - if((*bundle)->url() != NULL_STR) - fprintf(stdout, "url: %s (%d bytes)\n", (*bundle)->url().c_str(), (*bundle)->size()); - if((*bundle)->path() != NULL_STR) - fprintf(stdout, "path: %s\n", path::with_tilde((*bundle)->path()).c_str()); - if((*bundle)->origin() != NULL_STR) - fprintf(stdout, "origin: %s\n", (*bundle)->origin().c_str()); + if(bundle->url_updated()) + fprintf(stdout, "date: %s\n", to_s(bundle->url_updated()).c_str()); + if(bundle->url() != NULL_STR) + fprintf(stdout, "url: %s (%d bytes)\n", bundle->url().c_str(), bundle->size()); + if(bundle->path() != NULL_STR) + fprintf(stdout, "path: %s\n", path::with_tilde(bundle->path()).c_str()); + if(bundle->origin() != NULL_STR) + fprintf(stdout, "origin: %s\n", bundle->origin().c_str()); - citerate(grammar, (*bundle)->grammars()) + for(auto const& grammar : bundle->grammars()) { std::vector fileTypes; - citerate(ext, (*grammar)->file_types()) - fileTypes.push_back(*ext); - if((*grammar)->mode_line() != NULL_STR) - fileTypes.push_back(text::format("/%s/", (*grammar)->mode_line().c_str())); + for(auto const& ext : grammar->file_types()) + fileTypes.push_back(ext); + if(grammar->mode_line() != NULL_STR) + fileTypes.push_back(text::format("/%s/", grammar->mode_line().c_str())); if(fileTypes.empty()) - fileTypes.push_back((*grammar)->scope()); - fprintf(stdout, "grammar: %s (%s)\n", (*grammar)->name().c_str(), text::join(fileTypes, ", ").c_str()); + fileTypes.push_back(grammar->scope()); + fprintf(stdout, "grammar: %s (%s)\n", grammar->name().c_str(), text::join(fileTypes, ", ").c_str()); } std::vector dependencies; - citerate(dependency, (*bundle)->dependencies(index)) - dependencies.push_back((*dependency)->name()); + for(auto const& dependency : bundle->dependencies(index)) + dependencies.push_back(dependency->name()); if(!dependencies.empty()) fprintf(stderr, "dependencies: %s\n", text::join(dependencies, ", ").c_str()); - if((*bundle)->description() != NULL_STR) - fprintf(stdout, "description: %s\n", textify((*bundle)->description()).c_str()); + if(bundle->description() != NULL_STR) + fprintf(stdout, "description: %s\n", textify(bundle->description()).c_str()); } } else if(command == "update") { - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { - if((*bundle)->has_update()) + if(bundle->has_update()) { - fprintf(stderr, "Updating ‘%s’...", (*bundle)->name().c_str()); - if(update(*bundle, installDir)) + fprintf(stderr, "Updating ‘%s’...", bundle->name().c_str()); + if(update(bundle, installDir)) fprintf(stderr, "ok!\n"); else fprintf(stderr, " *** failed!\n"); } @@ -336,19 +336,19 @@ int main (int argc, char const* argv[]) else if(command == "dependencies") { std::vector bundles; - citerate(bundle, filtered_bundles(index, sourceNames, bundleNames)) + for(auto const& bundle : filtered_bundles(index, sourceNames, bundleNames)) { - if(!bundleNames.empty() || (*bundle)->installed()) - bundles.push_back(*bundle); + if(!bundleNames.empty() || bundle->installed()) + bundles.push_back(bundle); } - citerate(bundle, dependencies(index, bundles, false)) - fprintf(stdout, "%s\n", short_bundle_info(*bundle, get_width()).c_str()); + for(auto const& bundle : dependencies(index, bundles, false)) + fprintf(stdout, "%s\n", short_bundle_info(bundle, get_width()).c_str()); } else if(command == "dependents") { - citerate(bundle, dependents(index, filtered_bundles(index, sourceNames, bundleNames), onlyInstalled)) - fprintf(stdout, "%s\n", short_bundle_info(*bundle, get_width()).c_str()); + for(auto const& bundle : dependents(index, filtered_bundles(index, sourceNames, bundleNames), onlyInstalled)) + fprintf(stdout, "%s\n", short_bundle_info(bundle, get_width()).c_str()); } else { diff --git a/Applications/gtm/src/gtm.cc b/Applications/gtm/src/gtm.cc index 5fec2e93..ad6cc46c 100644 --- a/Applications/gtm/src/gtm.cc +++ b/Applications/gtm/src/gtm.cc @@ -56,9 +56,9 @@ _OutputIter entity_escape (_InputIter first, _InputIter const& last, _OutputIter void parse_stdin (std::string const& grammarSelector = "text.plain", bool verbose = false) { - citerate(item, bundles::query(bundles::kFieldGrammarScope, grammarSelector, scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, grammarSelector, scope::wildcard, bundles::kItemTypeGrammar)) { - if(parse::grammar_ptr grammar = parse::parse_grammar(*item)) + if(parse::grammar_ptr grammar = parse::parse_grammar(item)) { parse::stack_ptr stack = grammar->seed(); scope::scope_t lastScope(grammarSelector); @@ -74,13 +74,13 @@ void parse_stdin (std::string const& grammarSelector = "text.plain", bool verbos bytes += strlen(buf); size_t lastPos = 0; - iterate(it, scopes) + for(auto const& it : scopes) { - entity_escape(buf + lastPos, buf + it->first, std::ostream_iterator(std::cout)); - // std::copy(buf + lastPos, buf + it->first, std::ostream_iterator(std::cout)); - std::cout << xml_difference(lastScope, it->second, "<", ">"); - lastScope = it->second; - lastPos = it->first; + entity_escape(buf + lastPos, buf + it.first, std::ostream_iterator(std::cout)); + // std::copy(buf + lastPos, buf + it.first, std::ostream_iterator(std::cout)); + std::cout << xml_difference(lastScope, it.second, "<", ">"); + lastScope = it.second; + lastPos = it.first; } entity_escape(buf + lastPos, buf + strlen(buf), std::ostream_iterator(std::cout)); // std::copy(buf + lastPos, buf + strlen(buf), std::ostream_iterator(std::cout)); diff --git a/Applications/indent/src/indent.cc b/Applications/indent/src/indent.cc index d5652c56..0a851cdb 100644 --- a/Applications/indent/src/indent.cc +++ b/Applications/indent/src/indent.cc @@ -99,11 +99,11 @@ int main (int argc, char const* argv[]) // ========== text::indent_t indent(tabSize, indentSize, softTabs); - iterate(file, files) + for(auto const& file : files) { indent::fsm_t fsm(1, 1); - std::string const str = path::content(*file); + std::string const str = path::content(file); std::string::size_type n = 0; while(n != std::string::npos) { diff --git a/Applications/scmls/src/scmls.cc b/Applications/scmls/src/scmls.cc index 8f3a1682..a29c36f1 100644 --- a/Applications/scmls/src/scmls.cc +++ b/Applications/scmls/src/scmls.cc @@ -24,8 +24,8 @@ static void usage (FILE* io = stdout) static void scmls (std::string const& dir) { - citerate(pair, scm::tracked_files(dir, ~scm::status::none)) - fprintf(stderr, "%s %s\n", to_s(pair->second).c_str(), pair->first.c_str()); + for(auto const& pair : scm::tracked_files(dir, ~scm::status::none)) + fprintf(stderr, "%s %s\n", to_s(pair.second).c_str(), pair.first.c_str()); } int main (int argc, char* const* argv) diff --git a/Frameworks/BundleEditor/src/BundleEditor.mm b/Frameworks/BundleEditor/src/BundleEditor.mm index b88c36be..09e5011d 100644 --- a/Frameworks/BundleEditor/src/BundleEditor.mm +++ b/Frameworks/BundleEditor/src/BundleEditor.mm @@ -62,10 +62,10 @@ namespace item_info_t const& info_for (bundles::kind_t kind) { - iterate(it, item_infos) + for(auto const& it : item_infos) { - if(it->kind == kind) - return *it; + if(it.kind == kind) + return it; } static item_info_t dummy; @@ -76,8 +76,8 @@ namespace static NSMutableArray* wrap_array (std::vector const& array, NSString* key) { NSMutableArray* res = [NSMutableArray array]; - iterate(str, array) - [res addObject:[NSMutableDictionary dictionaryWithObject:[NSString stringWithCxxString:*str] forKey:key]]; + for(auto const& str : array) + [res addObject:[NSMutableDictionary dictionaryWithObject:[NSString stringWithCxxString:str] forKey:key]]; return res; } @@ -98,8 +98,8 @@ namespace template void operator() (T value) const { } void operator() (std::string& str) const { str = format_string::expand(str, _variables); } - void operator() (plist::array_t& array) const { iterate(it, array) boost::apply_visitor(*this, *it); } - void operator() (plist::dictionary_t& dict) const { iterate(pair, dict) boost::apply_visitor(*this, pair->second); } + void operator() (plist::array_t& array) const { for(auto const& item : array) boost::apply_visitor(*this, item); } + void operator() (plist::dictionary_t& dict) const { for(auto const& pair : dict) boost::apply_visitor(*this, pair.second); } private: std::map const& _variables; @@ -282,11 +282,11 @@ static be::entry_ptr parent_for_column (NSBrowser* aBrowser, NSInteger aColumn, // kItemTypeMacro, kItemTypeMenu, kItemTypeMenuItemSeparator NSMenu* menu = [[NSMenu alloc] initWithTitle:@"Item Types"]; - iterate(it, item_infos) + for(auto const& it : item_infos) { static int const types = bundles::kItemTypeBundle|bundles::kItemTypeCommand|bundles::kItemTypeDragCommand|bundles::kItemTypeSnippet|bundles::kItemTypeSettings|bundles::kItemTypeGrammar|bundles::kItemTypeProxy|bundles::kItemTypeTheme; - if((it->kind & types) == it->kind) - [[menu addItemWithTitle:it->file action:NULL keyEquivalent:@""] setTag:it->kind]; + if((it.kind & types) == it.kind) + [[menu addItemWithTitle:it.file action:NULL keyEquivalent:@""] setTag:it.kind]; } NSAlert* alert = [NSAlert alertWithMessageText:@"Create New Item" defaultButton:@"Create" alternateButton:@"Cancel" otherButton:nil informativeTextWithFormat:@"Please choose what you want to create:"]; @@ -311,9 +311,9 @@ static be::entry_ptr parent_for_column (NSBrowser* aBrowser, NSInteger aColumn, bundles::item_ptr newSelectedItem; bool foundItem = false; - iterate(entry, parent_for_column(browser, [browser selectedColumn], bundles)->children()) + for(auto const& entry : parent_for_column(browser, [browser selectedColumn], bundles)->children()) { - if(bundles::item_ptr item = (*entry)->represented_item()) + if(bundles::item_ptr item = entry->represented_item()) { if(item->uuid() == bundleItem->uuid()) foundItem = true; @@ -419,11 +419,11 @@ static be::entry_ptr parent_for_column (NSBrowser* aBrowser, NSInteger aColumn, else if(info.kind == bundles::kItemTypeTheme) keys = { "gutterSettings", "settings", "colorSpaceName" }; - iterate(key, keys) + for(auto const& key : keys) { - if(plistSubset->find(*key) != plistSubset->end()) - plist[*key] = plistSubset->find(*key)->second; - else plist.erase(*key); + if(plistSubset->find(key) != plistSubset->end()) + plist[key] = plistSubset->find(key)->second; + else plist.erase(key); } } } @@ -460,18 +460,18 @@ static be::entry_ptr parent_for_column (NSBrowser* aBrowser, NSInteger aColumn, { [self commitEditing]; std::map failedToSave; - iterate(pair, changes) + for(auto const& pair : changes) { - auto item = pair->first; + auto item = pair.first; - item->set_plist(pair->second); + item->set_plist(pair.second); if(item->save()) { [[BundlesManager sharedInstance] reloadPath:[NSString stringWithCxxString:item->paths().front()]]; } else { - failedToSave.insert(*pair); + failedToSave.insert(pair); } } changes.swap(failedToSave); @@ -569,9 +569,9 @@ static be::entry_ptr parent_for_column (NSBrowser* aBrowser, NSInteger aColumn, NSMutableDictionary* oldProperties = bundleItemProperties; bundleItemProperties = someProperties; - iterate(str, BindingKeys) + for(auto const& str : BindingKeys) { - NSString* key = [NSString stringWithCxxString:*str]; + NSString* key = [NSString stringWithCxxString:str]; [oldProperties removeObserver:self forKeyPath:key]; [someProperties addObserver:self forKeyPath:key options:0 context:NULL]; } @@ -678,10 +678,10 @@ static NSMutableDictionary* DictionaryForPropertyList (plist::dictionary_t const keys = { "gutterSettings", "settings", "colorSpaceName" }; plist::dictionary_t plistSubset; - iterate(key, keys) + for(auto const& key : keys) { - if(plist.find(*key) != plist.end()) - plistSubset[*key] = plist.find(*key)->second; + if(plist.find(key) != plist.end()) + plistSubset[key] = plist.find(key)->second; } bundleItemContent = document::from_content(to_s(plistSubset, plist::kPreferSingleQuotedStrings, PlistKeySortOrder()), info.grammar); } diff --git a/Frameworks/BundleEditor/src/be_entry.cc b/Frameworks/BundleEditor/src/be_entry.cc index e7299e66..fccba9ea 100644 --- a/Frameworks/BundleEditor/src/be_entry.cc +++ b/Frameworks/BundleEditor/src/be_entry.cc @@ -34,13 +34,13 @@ namespace be return res; std::multimap directories, files; - citerate(entry, path::entries(_path)) + for(auto const& entry : path::entries(_path)) { - std::string const path = path::join(_path, (*entry)->d_name); + std::string const path = path::join(_path, entry->d_name); std::string const displayName = path::display_name(path); - if((*entry)->d_type == DT_DIR) + if(entry->d_type == DT_DIR) directories.emplace(displayName, std::make_shared(displayName, path)); - else if((*entry)->d_type == DT_REG || (*entry)->d_type == DT_LNK) + else if(entry->d_type == DT_REG || entry->d_type == DT_LNK) files.emplace(displayName, std::make_shared(displayName, path)); } @@ -62,11 +62,11 @@ namespace be std::vector entries () const { std::vector res; - citerate(item, _item->menu(true)) + for(auto const& item : _item->menu(true)) { - if((*item)->kind() == bundles::kItemTypeMenu) - res.push_back(std::make_shared((*item)->name(), *item)); - else res.push_back(std::make_shared(*item)); + if(item->kind() == bundles::kItemTypeMenu) + res.push_back(std::make_shared(item->name(), item)); + else res.push_back(std::make_shared(item)); } return res; } @@ -79,12 +79,12 @@ namespace be std::vector entries () const { std::multimap ordered; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, _kind, _bundle->uuid(), false, true)) - ordered.emplace((*item)->name(), *item); + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, _kind, _bundle->uuid(), false, true)) + ordered.emplace(item->name(), item); std::vector res; - iterate(pair, ordered) - res.push_back(std::make_shared(pair->second)); + for(auto const& pair : ordered) + res.push_back(std::make_shared(pair.second)); return res; } @@ -100,15 +100,15 @@ namespace be std::vector entries () const { std::multimap ordered; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeMenuTypes, _bundle->uuid(), false, true)) + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeMenuTypes, _bundle->uuid(), false, true)) { - if((*item)->hidden_from_user()) - ordered.emplace((*item)->name(), *item); + if(item->hidden_from_user()) + ordered.emplace(item->name(), item); } std::vector res; - iterate(pair, ordered) - res.push_back(std::make_shared(pair->second)); + for(auto const& pair : ordered) + res.push_back(std::make_shared(pair.second)); return res; } @@ -142,12 +142,12 @@ namespace be std::vector entries () const { std::multimap ordered; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeBundle, oak::uuid_t(), false, true)) - ordered.emplace((*item)->name(), *item); + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeBundle, oak::uuid_t(), false, true)) + ordered.emplace(item->name(), item); std::vector res; - iterate(pair, ordered) - res.push_back(std::make_shared(pair->second)); + for(auto const& pair : ordered) + res.push_back(std::make_shared(pair.second)); return res; } }; diff --git a/Frameworks/BundleMenu/src/BundleMenu.mm b/Frameworks/BundleMenu/src/BundleMenu.mm index a9b78c22..53dad533 100644 --- a/Frameworks/BundleMenu/src/BundleMenu.mm +++ b/Frameworks/BundleMenu/src/BundleMenu.mm @@ -21,23 +21,23 @@ static std::vector filtered_menu (bundles::item_ptr menuItem, std::set* includedItems) { std::vector res; - citerate(item, menuItem->menu()) + for(auto const& item : menuItem->menu()) { - if((*item)->kind() == bundles::kItemTypeMenuItemSeparator) + if(item->kind() == bundles::kItemTypeMenuItemSeparator) { - res.push_back(*item); + res.push_back(item); } - else if((*item)->kind() == bundles::kItemTypeMenu) + else if(item->kind() == bundles::kItemTypeMenu) { res.push_back(bundles::item_t::menu_item_separator()); - std::vector const& tmp = filtered_menu(*item, includedItems); + std::vector const& tmp = filtered_menu(item, includedItems); res.insert(res.end(), tmp.begin(), tmp.end()); res.push_back(bundles::item_t::menu_item_separator()); } - else if(includedItems->find(*item) != includedItems->end()) + else if(includedItems->find(item) != includedItems->end()) { - res.push_back(*item); - includedItems->erase(*item); + res.push_back(item); + includedItems->erase(item); } } return res; @@ -46,32 +46,32 @@ static std::vector filtered_menu (bundles::item_ptr menuItem, void OakAddBundlesToMenu (std::vector const& items, bool setKeys, NSMenu* menu, SEL menuAction) { bool onlyGrammars = true; - iterate(item, items) - onlyGrammars = onlyGrammars && (*item)->kind() == bundles::kItemTypeGrammar; + for(auto const& item : items) + onlyGrammars = onlyGrammars && item->kind() == bundles::kItemTypeGrammar; if(onlyGrammars) { std::multimap ordering; - iterate(item, items) - ordering.emplace((*item)->name(), *item); + for(auto const& item : items) + ordering.emplace(item->name(), item); - iterate(pair, ordering) + for(auto const& pair : ordering) { - NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:menuAction keyEquivalent:@""]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:pair->second->uuid()]]; + NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:menuAction keyEquivalent:@""]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:pair.second->uuid()]]; if(setKeys) { - [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(pair->second)]; - [menuItem setTabTriggerCxxString:pair->second->value_for_field(bundles::kFieldTabTrigger)]; + [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(pair.second)]; + [menuItem setTabTriggerCxxString:pair.second->value_for_field(bundles::kFieldTabTrigger)]; } } } else { std::multimap byBundle; - iterate(item, items) - byBundle.emplace((*item)->bundle(), *item); + for(auto const& item : items) + byBundle.emplace(item->bundle(), item); std::multimap, text::less_t> menus; while(!byBundle.empty()) @@ -85,24 +85,24 @@ void OakAddBundlesToMenu (std::vector const& items, bool setK std::vector menuItems = filtered_menu(bundle, &includedItems); std::multimap ordering; - iterate(item, includedItems) - ordering.emplace((*item)->name(), *item); + for(auto const& item : includedItems) + ordering.emplace(item->name(), item); std::transform(ordering.begin(), ordering.end(), back_inserter(menuItems), [](std::pair const& p){ return p.second; }); menus.emplace(bundle->name(), menuItems); } bool showBundleHeadings = menus.size() > 1; - iterate(pair, menus) + for(auto const& pair : menus) { if(showBundleHeadings) - [menu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:NULL keyEquivalent:@""]; + [menu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:NULL keyEquivalent:@""]; bool suppressSeparator = true; bool pendingSeparator = false; - iterate(item, pair->second) + for(auto const& item : pair.second) { - if((*item)->kind() == bundles::kItemTypeMenuItemSeparator) + if(item->kind() == bundles::kItemTypeMenuItemSeparator) { if(!suppressSeparator) pendingSeparator = true; @@ -113,13 +113,13 @@ void OakAddBundlesToMenu (std::vector const& items, bool setK [menu addItem:[NSMenuItem separatorItem]]; pendingSeparator = false; - NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:(*item)->name()] action:menuAction keyEquivalent:@""]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:(*item)->uuid()]]; + NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:item->name()] action:menuAction keyEquivalent:@""]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:item->uuid()]]; if(setKeys) { - [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(*item)]; - [menuItem setTabTriggerCxxString:(*item)->value_for_field(bundles::kFieldTabTrigger)]; + [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(item)]; + [menuItem setTabTriggerCxxString:item->value_for_field(bundles::kFieldTabTrigger)]; } if(showBundleHeadings) diff --git a/Frameworks/BundleMenu/src/BundleMenuDelegate.mm b/Frameworks/BundleMenu/src/BundleMenuDelegate.mm index 724f6dde..76b0671e 100644 --- a/Frameworks/BundleMenu/src/BundleMenuDelegate.mm +++ b/Frameworks/BundleMenu/src/BundleMenuDelegate.mm @@ -37,15 +37,15 @@ OAK_DEBUG_VAR(BundleMenu); if(!umbrellaItem) return; - citerate(item, umbrellaItem->menu()) + for(auto const& item : umbrellaItem->menu()) { - switch((*item)->kind()) + switch(item->kind()) { case bundles::kItemTypeMenu: { - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:(*item)->name()] action:NULL keyEquivalent:@""]; + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:item->name()] action:NULL keyEquivalent:@""]; - menuItem.submenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCxxString:(*item)->uuid()]]; + menuItem.submenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCxxString:item->uuid()]]; menuItem.submenu.delegate = [BundleMenuDelegate sharedInstance]; } break; @@ -56,24 +56,24 @@ OAK_DEBUG_VAR(BundleMenu); case bundles::kItemTypeProxy: { - auto const items = bundles::items_for_proxy(*item, scope); + auto const items = bundles::items_for_proxy(item, scope); OakAddBundlesToMenu(items, true, aMenu, @selector(performBundleItemWithUUIDStringFrom:)); if(items.empty()) { - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:(*item)->name()] action:@selector(nop:) keyEquivalent:@""]; - [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(*item)]; - [menuItem setTabTriggerCxxString:(*item)->value_for_field(bundles::kFieldTabTrigger)]; + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:item->name()] action:@selector(nop:) keyEquivalent:@""]; + [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(item)]; + [menuItem setTabTriggerCxxString:item->value_for_field(bundles::kFieldTabTrigger)]; } } break; default: { - NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:(*item)->name()] action:@selector(performBundleItemWithUUIDStringFrom:) keyEquivalent:@""]; - [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(*item)]; - [menuItem setTabTriggerCxxString:(*item)->value_for_field(bundles::kFieldTabTrigger)]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:(*item)->uuid()]]; + NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithCxxString:item->name()] action:@selector(performBundleItemWithUUIDStringFrom:) keyEquivalent:@""]; + [menuItem setInactiveKeyEquivalentCxxString:key_equivalent(item)]; + [menuItem setTabTriggerCxxString:item->value_for_field(bundles::kFieldTabTrigger)]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:item->uuid()]]; } break; } diff --git a/Frameworks/BundlesManager/src/BundlesManager.mm b/Frameworks/BundlesManager/src/BundlesManager.mm index f9b97977..c9f3def2 100644 --- a/Frameworks/BundlesManager/src/BundlesManager.mm +++ b/Frameworks/BundlesManager/src/BundlesManager.mm @@ -464,8 +464,8 @@ namespace if(plist::dictionary_t const* dictionary = boost::get(&pair.second)) { plist::array_t settings; - iterate(settingsPair, *dictionary) - settings.push_back(settingsPair->first); + for(auto const& settingsPair : *dictionary) + settings.push_back(settingsPair.first); res.emplace(pair.first, settings); } } diff --git a/Frameworks/BundlesManager/src/InstallBundleItems.mm b/Frameworks/BundlesManager/src/InstallBundleItems.mm index 4f12ecbc..dfb73a37 100644 --- a/Frameworks/BundlesManager/src/InstallBundleItems.mm +++ b/Frameworks/BundlesManager/src/InstallBundleItems.mm @@ -10,10 +10,10 @@ static std::map installed_items () { std::map res; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeAny, oak::uuid_t(), false, true)) + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeAny, oak::uuid_t(), false, true)) { - citerate(path, (*item)->paths()) - res.emplace(*path, *item); + for(auto const& path : item->paths()) + res.emplace(path, item); } return res; } @@ -65,52 +65,52 @@ void InstallBundleItems (NSArray* itemPaths) } } - iterate(info, delta) + for(auto const& info : delta) { - char const* type = info->is_bundle ? "bundle" : "bundle item"; - std::string const name = path::name(path::strip_extension(info->path)); + char const* type = info.is_bundle ? "bundle" : "bundle item"; + std::string const name = path::name(path::strip_extension(info.path)); std::string const title = text::format("The %s “%s” could not be installed because it is in delta format.", type, name.c_str()); NSRunAlertPanel([NSString stringWithCxxString:title], @"Contact the author of this %s to get a properly exported version.", @"OK", nil, nil, type); } - iterate(info, malformed) + for(auto const& info : malformed) { - char const* type = info->is_bundle ? "bundle" : "bundle item"; - std::string const name = path::name(path::strip_extension(info->path)); + char const* type = info.is_bundle ? "bundle" : "bundle item"; + std::string const name = path::name(path::strip_extension(info.path)); std::string const title = text::format("The %s “%s” could not be installed because it is malformed.", type, name.c_str()); NSRunAlertPanel([NSString stringWithCxxString:title], @"The %s lacks mandatory keys in its property list file.", @"OK", nil, nil, type); } - iterate(info, installed) + for(auto const& info : installed) { - char const* type = info->is_bundle ? "bundle" : "bundle item"; - std::string const name = info->name; + char const* type = info.is_bundle ? "bundle" : "bundle item"; + std::string const name = info.name; std::string const title = text::format("The %s “%s” is already installed.", type, name.c_str()); int choice = NSRunAlertPanel([NSString stringWithCxxString:title], @"You can edit the installed %s to inspect it.", @"OK", @"Edit", nil, type); if(choice == NSAlertAlternateReturn) // "Edit" - [NSApp sendAction:@selector(editBundleItemWithUUIDString:) to:nil from:[NSString stringWithCxxString:info->uuid]]; + [NSApp sendAction:@selector(editBundleItemWithUUIDString:) to:nil from:[NSString stringWithCxxString:info.uuid]]; } std::set pathsToReload; - iterate(info, toInstall) + for(auto const& info : toInstall) { - if(info->is_bundle) + if(info.is_bundle) { - int choice = NSRunAlertPanel([NSString stringWithFormat:@"Would you like to install the “%@” bundle?", [NSString stringWithCxxString:info->name]], @"Installing a bundle adds new functionality to TextMate.", @"Install", @"Cancel", nil); + int choice = NSRunAlertPanel([NSString stringWithFormat:@"Would you like to install the “%@” bundle?", [NSString stringWithCxxString:info.name]], @"Installing a bundle adds new functionality to TextMate.", @"Install", @"Cancel", nil); if(choice == NSAlertDefaultReturn) // "Install" { std::string const installDir = path::join(path::home(), "Library/Application Support/Avian/Pristine Copy/Bundles"); if(path::make_dir(installDir)) { - std::string const installPath = path::unique(path::join(installDir, path::name(info->path))); - if(path::copy(info->path, installPath)) + std::string const installPath = path::unique(path::join(installDir, path::name(info.path))); + if(path::copy(info.path, installPath)) { pathsToReload.insert(installDir); fprintf(stderr, "installed bundle at: %s\n", installPath.c_str()); continue; } } - fprintf(stderr, "failed to install bundle: %s\n", info->path.c_str()); + fprintf(stderr, "failed to install bundle: %s\n", info.path.c_str()); } } else @@ -133,19 +133,19 @@ void InstallBundleItems (NSArray* itemPaths) if(bundle->local() || bundle->save()) { std::string dest = path::parent(bundle->paths().front()); - iterate(iter, DirectoryMap) + for(auto const& iter : DirectoryMap) { - if(path::extension(info->path) == iter->extension) + if(path::extension(info.path) == iter.extension) { - dest = path::join(dest, iter->directory); + dest = path::join(dest, iter.directory); if(path::make_dir(dest)) { - dest = path::join(dest, path::name(info->path)); + dest = path::join(dest, path::name(info.path)); pathsToReload.insert(dest); dest = path::unique(dest); - if(path::copy(info->path, dest)) + if(path::copy(info.path, dest)) break; - else fprintf(stderr, "error: copy(‘%s’, ‘%s’)\n", info->path.c_str(), dest.c_str()); + else fprintf(stderr, "error: copy(‘%s’, ‘%s’)\n", info.path.c_str(), dest.c_str()); } else { diff --git a/Frameworks/CrashReporter/src/find_reports.cc b/Frameworks/CrashReporter/src/find_reports.cc index 27fc6168..b417a29b 100644 --- a/Frameworks/CrashReporter/src/find_reports.cc +++ b/Frameworks/CrashReporter/src/find_reports.cc @@ -28,13 +28,13 @@ std::map find_reports (std::string const& process) }; std::map res; - iterate(location, locations) + for(auto const& location : locations) { - citerate(entry, path::entries(*location)) + for(auto const& entry : path::entries(location)) { - std::string file((*entry)->d_name); - if((*entry)->d_type == DT_REG && file.find(process) == 0) - res.emplace(parse_date(file, process + "_%F-\x25H\x25M%S"), path::join(*location, (*entry)->d_name)); + std::string file(entry->d_name); + if(entry->d_type == DT_REG && file.find(process) == 0) + res.emplace(parse_date(file, process + "_%F-\x25H\x25M%S"), path::join(location, entry->d_name)); } } return res; diff --git a/Frameworks/DocumentWindow/src/DocumentController.mm b/Frameworks/DocumentWindow/src/DocumentController.mm index c73777bb..cf14f7e7 100644 --- a/Frameworks/DocumentWindow/src/DocumentController.mm +++ b/Frameworks/DocumentWindow/src/DocumentController.mm @@ -876,9 +876,9 @@ namespace } NSMutableIndexSet* indexSet = [NSMutableIndexSet indexSet]; - iterate(pair, ranked) + for(auto const& pair : ranked) { - [indexSet addIndex:pair->second]; + [indexSet addIndex:pair.second]; if([indexSet count] == excessTabs) break; } @@ -1184,14 +1184,14 @@ namespace { std::string const path = to_s(_documentPath); std::vector revPath; - citerate(token, text::tokenize(path.begin(), path.end(), '/')) + for(auto const& token : text::tokenize(path.begin(), path.end(), '/')) { - std::string tmp = *token; - citerate(subtoken, text::tokenize(tmp.begin(), tmp.end(), '.')) + std::string tmp = token; + for(auto const& subtoken : text::tokenize(tmp.begin(), tmp.end(), '.')) { - if((*subtoken).empty()) + if(subtoken.empty()) continue; - revPath.push_back(*subtoken); + revPath.push_back(subtoken); std::replace(revPath.back().begin(), revPath.back().end(), ' ', '_'); } } @@ -2032,10 +2032,10 @@ namespace if(customCandidate != NULL_STR && customCandidate != documentPath && (std::find_if(_documents.begin(), _documents.end(), [&customCandidate](document::document_ptr const& doc){ return customCandidate == doc->path(); }) != _documents.end() || path::exists(customCandidate))) return [self openItems:@[ @{ @"path" : [NSString stringWithCxxString:customCandidate] } ] closingOtherTabs:NO]; - citerate(entry, path::entries(documentDir)) + for(auto const& entry : path::entries(documentDir)) { - std::string const name = (*entry)->d_name; - if((*entry)->d_type == DT_REG && documentBase == path::strip_extensions(name) && path::extensions(name) != "") + std::string const name = entry->d_name; + if(entry->d_type == DT_REG && documentBase == path::strip_extensions(name) && path::extensions(name) != "") { std::string const content = path::content(path::join(documentDir, name)); if(utf8::is_valid(content.data(), content.data() + content.size())) @@ -2047,10 +2047,10 @@ namespace path::glob_t const binaryGlob(settings.get(kSettingsBinaryKey, "")); std::vector v; - iterate(path, candidates) + for(auto const& path : candidates) { - if(*path == documentPath || !binaryGlob.does_match(*path) && !excludeGlob.does_match(*path)) - v.push_back(*path); + if(path == documentPath || !binaryGlob.does_match(path) && !excludeGlob.does_match(path)) + v.push_back(path); } if(v.size() == 1) @@ -2508,10 +2508,10 @@ static NSUInteger DisableSessionSavingCount = 0; if(candidate.projectPath) { std::string const projectPath = to_s(candidate.projectPath); - iterate(parent, parents) + for(auto const& parent : parents) { - if(path::is_child(*parent, projectPath)) - candidates.emplace(parent->size() - projectPath.size(), candidate); + if(path::is_child(parent, projectPath)) + candidates.emplace(parent.size() - projectPath.size(), candidate); } } } diff --git a/Frameworks/DocumentWindow/src/DocumentSaveHelper.mm b/Frameworks/DocumentWindow/src/DocumentSaveHelper.mm index 55df6e43..9dee21fb 100644 --- a/Frameworks/DocumentWindow/src/DocumentSaveHelper.mm +++ b/Frameworks/DocumentWindow/src/DocumentSaveHelper.mm @@ -18,9 +18,9 @@ OAK_DEBUG_VAR(DocumentController_SaveHelper); NSString* DefaultSaveNameForDocument (document::document_ptr const& aDocument) { - citerate(item, bundles::query(bundles::kFieldGrammarScope, aDocument->file_type())) + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, aDocument->file_type())) { - std::string const& ext = (*item)->value_for_field(bundles::kFieldGrammarExtension); + std::string const& ext = item->value_for_field(bundles::kFieldGrammarExtension); if(ext != NULL_STR) return [NSString stringWithCxxString:aDocument->display_name() + "." + ext]; } diff --git a/Frameworks/DocumentWindow/src/FileTypeDialog.mm b/Frameworks/DocumentWindow/src/FileTypeDialog.mm index 87adaa5d..45efd6c4 100644 --- a/Frameworks/DocumentWindow/src/FileTypeDialog.mm +++ b/Frameworks/DocumentWindow/src/FileTypeDialog.mm @@ -33,13 +33,13 @@ namespace static NSArray* wrap (std::set const& array) { NSMutableArray* res = [NSMutableArray array]; - iterate(info, array) + for(auto const& info : array) { NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: - [NSString stringWithCxxString:info->name], @"name", - [NSString stringWithCxxString:info->scope], @"scope", - [NSString stringWithCxxString:info->uuid], @"uuid", - [NSString stringWithCxxString:info->bundle_uuid], @"bundleUUID", + [NSString stringWithCxxString:info.name], @"name", + [NSString stringWithCxxString:info.scope], @"scope", + [NSString stringWithCxxString:info.uuid], @"uuid", + [NSString stringWithCxxString:info.bundle_uuid], @"bundleUUID", nil]; [res addObject:dictionary]; } @@ -85,10 +85,10 @@ static bool is_installed (oak::uuid_t const& uuid) { std::set recommended, installed, all; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) { - if((*item)->value_for_field(bundles::kFieldGrammarScope) != NULL_STR) - installed.insert(grammar_info_t((*item)->name(), (*item)->value_for_field(bundles::kFieldGrammarScope), (*item)->uuid(), (*item)->bundle_uuid())); + if(item->value_for_field(bundles::kFieldGrammarScope) != NULL_STR) + installed.insert(grammar_info_t(item->name(), item->value_for_field(bundles::kFieldGrammarScope), item->uuid(), item->bundle_uuid())); } all = installed; @@ -96,22 +96,22 @@ static bool is_installed (oak::uuid_t const& uuid) // Exclude uninstalled grammars when offline if(network::can_reach_host(REST_API)) { - citerate(bundle, bundles_db::index()) + for(auto const& bundle : bundles_db::index()) { - citerate(grammar, (*bundle)->grammars()) + for(auto const& grammar : bundle->grammars()) { - grammar_info_t info((*grammar)->name(), (*grammar)->scope(), (*grammar)->uuid(), (*bundle)->uuid()); + grammar_info_t info(grammar->name(), grammar->scope(), grammar->uuid(), bundle->uuid()); all.insert(info); - if((*grammar)->mode_line() != NULL_STR && regexp::search((*grammar)->mode_line(), firstLine)) + if(grammar->mode_line() != NULL_STR && regexp::search(grammar->mode_line(), firstLine)) { recommended.insert(info); } else { - iterate(ext, (*grammar)->file_types()) + for(auto const& ext : grammar->file_types()) { - if(path::rank(to_s(self.path), *ext)) + if(path::rank(to_s(self.path), ext)) recommended.insert(info); } } @@ -119,10 +119,10 @@ static bool is_installed (oak::uuid_t const& uuid) } } - iterate(info, all) + for(auto const& info : all) { - if(info->scope == "text.plain") - recommended.insert(*info); + if(info.scope == "text.plain") + recommended.insert(info); } @@ -203,9 +203,9 @@ static bool is_installed (oak::uuid_t const& uuid) return aCompletionHandler(self.fileType); } - citerate(bundle, bundles_db::index()) + for(auto const& bundle : bundles_db::index()) { - if(bundleUUID == (*bundle)->uuid()) + if(bundleUUID == bundle->uuid()) { [installingBundleActivityTextField bind:NSValueBinding toObject:[BundlesManager sharedInstance] withKeyPath:@"activityText" options:nil]; [installingBundleProgressIndicator bind:NSValueBinding toObject:[BundlesManager sharedInstance] withKeyPath:@"progress" options:nil]; @@ -214,7 +214,7 @@ static bool is_installed (oak::uuid_t const& uuid) OakShowSheetForWindow(installingBundleWindow, aWindow, ^(NSInteger returnCode){ }); - [[BundlesManager sharedInstance] installBundle:*bundle completionHandler:^(BOOL success){ + [[BundlesManager sharedInstance] installBundle:bundle completionHandler:^(BOOL success){ [installingBundleProgressIndicator stopAnimation:self]; [installingBundleProgressIndicator unbind:NSValueBinding]; [installingBundleActivityTextField unbind:NSValueBinding]; diff --git a/Frameworks/Find/src/FFDocumentSearch.mm b/Frameworks/Find/src/FFDocumentSearch.mm index e138c365..2a213bd5 100644 --- a/Frameworks/Find/src/FFDocumentSearch.mm +++ b/Frameworks/Find/src/FFDocumentSearch.mm @@ -343,15 +343,15 @@ OAK_DEBUG_VAR(Find_FolderSearch); if(!matches.empty()) { [self willChangeValueForKey:@"countOfMatches"]; - iterate(pair, matches) + for(auto const& pair : matches) { - NSString* uuid = [NSString stringWithCxxString:pair->first->identifier()]; + NSString* uuid = [NSString stringWithCxxString:pair.first->identifier()]; if(![matchInfo objectForKey:uuid]) { [matchInfo setObject:[NSMutableArray array] forKey:uuid]; - [matchingDocuments addObject:[[FFMatch alloc] initWithDocument:pair->first]]; + [matchingDocuments addObject:[[FFMatch alloc] initWithDocument:pair.first]]; } - FFMatch* match = [[FFMatch alloc] initWithMatch:pair->second]; + FFMatch* match = [[FFMatch alloc] initWithMatch:pair.second]; [[matchInfo objectForKey:uuid] addObject:match]; if(match.match.binary) [replacementMatchesToSkip addObject:match]; diff --git a/Frameworks/Find/src/FFFilePathCell.mm b/Frameworks/Find/src/FFFilePathCell.mm index 86dc6550..d87f94ce 100644 --- a/Frameworks/Find/src/FFFilePathCell.mm +++ b/Frameworks/Find/src/FFFilePathCell.mm @@ -57,8 +57,8 @@ static NSAttributedString* PathComponentString (std::string const& path, std::st { std::vector components; std::string str = path::relative_to(path, base); - citerate(component, text::tokenize(str.begin(), str.end(), '/')) - components.push_back(*component); + for(auto const& component : text::tokenize(str.begin(), str.end(), '/')) + components.push_back(component); if(components.front() == "") components.front() = path::display_name("/"); components.back() = ""; diff --git a/Frameworks/Find/src/scan_path.cc b/Frameworks/Find/src/scan_path.cc index 32ef7df5..63002427 100644 --- a/Frameworks/Find/src/scan_path.cc +++ b/Frameworks/Find/src/scan_path.cc @@ -160,8 +160,8 @@ namespace find if(search.path == find::folder_scan_settings_t::open_files) { - citerate(doc, document::scanner_t::open_documents()) - scan_document(*doc); + for(auto const& doc : document::scanner_t::open_documents()) + scan_document(doc); is_running_flag = false; return; } @@ -174,10 +174,10 @@ namespace find isRunning = scanner.is_running(); std::vector const& documents = scanner.accept_documents(); - iterate(doc, documents) + for(auto const& doc : documents) { - if(!should_stop_flag && (*doc)->path() != NULL_STR) - scan_document(*doc); + if(!should_stop_flag && doc->path() != NULL_STR) + scan_document(doc); } if(should_stop_flag || !isRunning) @@ -260,11 +260,11 @@ namespace find { bool binary = !utf8.is_valid(); pthread_mutex_lock(&mutex); - iterate(it, ranges) + for(auto const& it : ranges) { - text::pos_t from(nl.line_for_offset(it->from), nl.col_for_offset(it->from)); - text::pos_t to(nl.line_for_offset(it->to), nl.col_for_offset(it->to)); - matches.push_back(std::make_pair(document, match_t(document, it->from, it->to, text::range_t(from, to), it->captures, nl.bol_for_offset(it->from), nl.eol_for_offset(it->to), binary))); + text::pos_t from(nl.line_for_offset(it.from), nl.col_for_offset(it.from)); + text::pos_t to(nl.line_for_offset(it.to), nl.col_for_offset(it.to)); + matches.push_back(std::make_pair(document, match_t(document, it.from, it.to, text::range_t(from, to), it.captures, nl.bol_for_offset(it.from), nl.eol_for_offset(it.to), binary))); } pthread_mutex_unlock(&mutex); } diff --git a/Frameworks/HTMLOutput/src/HTMLOutput.mm b/Frameworks/HTMLOutput/src/HTMLOutput.mm index 289298ba..00321222 100644 --- a/Frameworks/HTMLOutput/src/HTMLOutput.mm +++ b/Frameworks/HTMLOutput/src/HTMLOutput.mm @@ -17,14 +17,14 @@ namespace std::lock_guard lock(_lock); std::vector toDelete; - iterate(record, _records) + for(auto const& record : _records) { - if(record->second.done && record->second.stop) - toDelete.push_back(record->first); + if(record.second.done && record.second.stop) + toDelete.push_back(record.first); } - iterate(key, toDelete) - _records.erase(*key); + for(auto const& key : toDelete) + _records.erase(key); return _records.emplace(_next_key++, (record_t){ processId, std::string(), false, nil, false }).first->first; } diff --git a/Frameworks/OakAppKit/src/OakControl.mm b/Frameworks/OakAppKit/src/OakControl.mm index 03fcf2b0..5a7cda37 100644 --- a/Frameworks/OakAppKit/src/OakControl.mm +++ b/Frameworks/OakAppKit/src/OakControl.mm @@ -96,40 +96,40 @@ OAK_DEBUG_VAR(OakControl); - (void)setLayers:(std::vector const&)aLayout { // Remove views that are no longer in the layout - iterate(oldLayer, layout) + for(auto const& oldLayer : layout) { - if(oldLayer->view) + if(oldLayer.view) { BOOL found = NO; - iterate(newLayer, aLayout) + for(auto const& newLayer : aLayout) { - if(newLayer->view == oldLayer->view) + if(newLayer.view == oldLayer.view) { found = YES; break; } } if(!found) - [oldLayer->view removeFromSuperview]; + [oldLayer.view removeFromSuperview]; } } // TODO this triggers a redraw — may want to consider if we can delta update… layout = aLayout; NSRect coveredRect = NSZeroRect; - iterate(layer, layout) + for(auto const& layer : layout) { - if(layer->color || layer->image && layer->requisite == layer_t::no_requisite) - coveredRect = NSUnionRect(coveredRect, layer->rect); - if(NSView* view = layer->view) + if(layer.color || layer.image && layer.requisite == layer_t::no_requisite) + coveredRect = NSUnionRect(coveredRect, layer.rect); + if(NSView* view = layer.view) { if([view superview] != self) [view removeFromSuperview]; - NSRect viewFrame = layer->rect; + NSRect viewFrame = layer.rect; if(view.frame.size.height > 0) viewFrame.size.height = view.frame.size.height; - viewFrame.origin.x += layer->content_offset.x; - viewFrame.origin.y += layer->content_offset.y; + viewFrame.origin.x += layer.content_offset.x; + viewFrame.origin.y += layer.content_offset.y; [view setFrame:viewFrame]; [self addSubview:view]; } @@ -151,10 +151,10 @@ OAK_DEBUG_VAR(OakControl); - (NSInteger)tagForLayerContainingPoint:(NSPoint)aPoint { NSInteger res = NSNotFound; - iterate(it, layout) + for(auto const& it : layout) { - if(NSMouseInRect(aPoint, it->rect, [self isFlipped])) - res = it->tag; + if(NSMouseInRect(aPoint, it.rect, [self isFlipped])) + res = it.tag; } return res; } @@ -162,24 +162,24 @@ OAK_DEBUG_VAR(OakControl); - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)event { // This code is copy/paste from mouseDown: and should ideally be de-duplicated. - layer_t* clickLayer = NULL; - layer_t* dragLayer = NULL; - uint32_t state = [self currentState] | layer_t::mouse_clicked | layer_t::mouse_dragged | layer_t::mouse_down | layer_t::menu_gesture; - NSPoint mousePos = [self convertPoint:[event locationInWindow] fromView:nil]; + layer_t const* clickLayer = NULL; + layer_t const* dragLayer = NULL; + uint32_t state = [self currentState] | layer_t::mouse_clicked | layer_t::mouse_dragged | layer_t::mouse_down | layer_t::menu_gesture; + NSPoint mousePos = [self convertPoint:[event locationInWindow] fromView:nil]; - iterate(it, layout) + for(auto const& it : layout) { - if(!it->action || it->requisite != (state & it->requisite_mask) || !NSMouseInRect(mousePos, it->rect, [self isFlipped])) + if(!it.action || it.requisite != (state & it.requisite_mask) || !NSMouseInRect(mousePos, it.rect, [self isFlipped])) continue; - if(it->requisite & it->requisite_mask & (layer_t::mouse_clicked | layer_t::mouse_down | layer_t::menu_gesture | layer_t::mouse_double_clicked)) + if(it.requisite & it.requisite_mask & (layer_t::mouse_clicked | layer_t::mouse_down | layer_t::menu_gesture | layer_t::mouse_double_clicked)) { - clickLayer = &*it; + clickLayer = ⁢ dragLayer = NULL; // we ignore all drag layers “behind” the click-layer, for example the close button of a tab is a click-layer, behind it is the bigger (draggable) tab, but we want to ignore that when clicking (and dragging) the close button } - if([event clickCount] == 1 && (it->requisite & it->requisite_mask & layer_t::mouse_dragged)) - dragLayer = &*it; + if([event clickCount] == 1 && (it.requisite & it.requisite_mask & layer_t::mouse_dragged)) + dragLayer = ⁢ } return dragLayer || clickLayer && clickLayer->prevent_window_ordering; @@ -240,17 +240,17 @@ OAK_DEBUG_VAR(OakControl); NSPoint mousePos = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil]; uint32_t state = [self currentState]; - iterate(it, layout) + for(auto const& it : layout) { - if(NSEqualRects(NSIntersectionRect(aRect, it->rect), NSZeroRect)) + if(NSEqualRects(NSIntersectionRect(aRect, it.rect), NSZeroRect)) continue; // if we are in a mouseDown: then use the location from that first press for all but the clicked layer (so moving mouse while holding left mouse button doesn’t update layer states) uint32_t mouseState = 0; if(!mouseTrackingDisabled) { - bool isInLayer = NSMouseInRect(mousePos, it->rect, [self isFlipped]); - bool clickedLayer = NSMouseInRect(mouseDownPos, it->rect, [self isFlipped]); + bool isInLayer = NSMouseInRect(mousePos, it.rect, [self isFlipped]); + bool clickedLayer = NSMouseInRect(mouseDownPos, it.rect, [self isFlipped]); if(isInLayer) mouseState |= layer_t::mouse_inside; @@ -259,8 +259,8 @@ OAK_DEBUG_VAR(OakControl); mouseState |= layer_t::mouse_clicked|layer_t::menu_gesture; } - if(((state | mouseState) & it->requisite_mask) == it->requisite) - [self drawLayer:*it]; + if(((state | mouseState) & it.requisite_mask) == it.requisite) + [self drawLayer:it]; } } @@ -284,27 +284,27 @@ OAK_DEBUG_VAR(OakControl); { D(DBF_OakControl, bug("\n");); - layer_t* clickLayer = NULL; - layer_t* dragLayer = NULL; - uint32_t state = [self currentState] | layer_t::mouse_clicked | layer_t::mouse_dragged | layer_t::mouse_down | layer_t::menu_gesture; - mouseDownPos = [self convertPoint:[event locationInWindow] fromView:nil]; + layer_t const* clickLayer = NULL; + layer_t const* dragLayer = NULL; + uint32_t state = [self currentState] | layer_t::mouse_clicked | layer_t::mouse_dragged | layer_t::mouse_down | layer_t::menu_gesture; + mouseDownPos = [self convertPoint:[event locationInWindow] fromView:nil]; if([event clickCount] == 2) state |= layer_t::mouse_double_clicked; - iterate(it, layout) + for(auto const& it : layout) { - if(!it->action || it->requisite != (state & it->requisite_mask) || !NSMouseInRect(mouseDownPos, it->rect, [self isFlipped])) + if(!it.action || it.requisite != (state & it.requisite_mask) || !NSMouseInRect(mouseDownPos, it.rect, [self isFlipped])) continue; - if(it->requisite & it->requisite_mask & (layer_t::mouse_clicked | layer_t::mouse_down | layer_t::menu_gesture | layer_t::mouse_double_clicked)) + if(it.requisite & it.requisite_mask & (layer_t::mouse_clicked | layer_t::mouse_down | layer_t::menu_gesture | layer_t::mouse_double_clicked)) { - clickLayer = &*it; + clickLayer = ⁢ dragLayer = NULL; // we ignore all drag layers “behind” the click-layer, for example the close button of a tab is a click-layer, behind it is the bigger (draggable) tab, but we want to ignore that when clicking (and dragging) the close button } - if([event clickCount] == 1 && (it->requisite & it->requisite_mask & layer_t::mouse_dragged)) - dragLayer = &*it; + if([event clickCount] == 1 && (it.requisite & it.requisite_mask & layer_t::mouse_dragged)) + dragLayer = ⁢ } if(!clickLayer && !dragLayer) @@ -396,22 +396,22 @@ struct rect_cmp_t return; std::map, rect_cmp_t> trackedLayers; - iterate(it, layout) + for(auto const& it : layout) { - if(it->requisite & layer_t::mouse_inside || it->requisite_mask & layer_t::mouse_inside) - trackedLayers[it->rect].push_back(*it); + if(it.requisite & layer_t::mouse_inside || it.requisite_mask & layer_t::mouse_inside) + trackedLayers[it.rect].push_back(it); - if(it->tool_tip) - [self addToolTipRect:it->rect owner:it->tool_tip userData:NULL]; + if(it.tool_tip) + [self addToolTipRect:it.rect owner:it.tool_tip userData:NULL]; } - iterate(it, trackedLayers) + for(auto const& it : trackedLayers) { NSTrackingAreaOptions trackingOptions = NSTrackingMouseEnteredAndExited; - iterate(layer, it->second) + for(auto const& layer : it.second) { - if(!(layer->requisite & layer_t::window_key)) + if(!(layer.requisite & layer_t::window_key)) { trackingOptions |= NSTrackingActiveAlways; break; @@ -421,7 +421,7 @@ struct rect_cmp_t if(!(trackingOptions & NSTrackingActiveAlways)) trackingOptions |= NSTrackingActiveInKeyWindow; - [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:it->first options:trackingOptions owner:self userInfo:nil]]; + [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:it.first options:trackingOptions owner:self userInfo:nil]]; } } diff --git a/Frameworks/OakAppKit/src/OakEncodingPopUpButton.mm b/Frameworks/OakAppKit/src/OakEncodingPopUpButton.mm index efbee970..35ae06d2 100644 --- a/Frameworks/OakAppKit/src/OakEncodingPopUpButton.mm +++ b/Frameworks/OakAppKit/src/OakEncodingPopUpButton.mm @@ -33,10 +33,10 @@ namespace // encoding_list plist::array_t encodings; if(plist::get_key_path(plist::load(path), "encodings", encodings)) { - iterate(item, encodings) + for(auto const& item : encodings) { std::string name, code; - if(plist::get_key_path(*item, "name", name) && plist::get_key_path(*item, "code", code)) + if(plist::get_key_path(item, "name", name) && plist::get_key_path(item, "code", code)) res.emplace_back(name, code); } } @@ -59,13 +59,13 @@ namespace // PopulateMenu{Flat,Hierarchical} static NSMenuItem* PopulateMenuFlat (NSMenu* menu, std::vector const& items, id target, SEL action, std::string const& selected) { NSMenuItem* res = nil; - iterate(item, items) + for(auto const& item : items) { - NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:item->group + " – " + item->title] action:action keyEquivalent:@""]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:item->represented_object]]; + NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:item.group + " – " + item.title] action:action keyEquivalent:@""]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:item.represented_object]]; [menuItem setTarget:target]; - if(item->represented_object == selected) + if(item.represented_object == selected) res = menuItem; } return res; @@ -75,21 +75,21 @@ namespace // PopulateMenu{Flat,Hierarchical} { std::string groupName = NULL_STR; NSMenu* menu = nil; - iterate(item, items) + for(auto const& item : items) { - if(groupName != item->group) + if(groupName != item.group) { - groupName = item->group; + groupName = item.group; menu = [NSMenu new]; [menu setAutoenablesItems:NO]; [[containingMenu addItemWithTitle:[NSString stringWithCxxString:groupName] action:NULL keyEquivalent:@""] setSubmenu:menu]; } - NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:item->title] action:action keyEquivalent:@""]; - [menuItem setRepresentedObject:[NSString stringWithCxxString:item->represented_object]]; + NSMenuItem* menuItem = [menu addItemWithTitle:[NSString stringWithCxxString:item.title] action:action keyEquivalent:@""]; + [menuItem setRepresentedObject:[NSString stringWithCxxString:item.represented_object]]; [menuItem setTarget:target]; - if(selected == item->represented_object) + if(selected == item.represented_object) [menuItem setState:NSOnState]; } } @@ -130,16 +130,16 @@ namespace // PopulateMenu{Flat,Hierarchical} { std::vector items; std::string currentEncodingsTitle = to_s(self.encoding); - citerate(charset, encoding_list()) + for(auto const& charset : encoding_list()) { - if([self.availableEncodings containsObject:[NSString stringWithCxxString:charset->code()]]) + if([self.availableEncodings containsObject:[NSString stringWithCxxString:charset.code()]]) { - auto v = text::split(charset->name(), " – "); + auto v = text::split(charset.name(), " – "); if(v.size() == 2) { - items.push_back(menu_item_t(v.front(), v.back(), charset->code())); - if(to_s(self.encoding) == charset->code()) - currentEncodingsTitle = charset->name(); + items.push_back(menu_item_t(v.front(), v.back(), charset.code())); + if(to_s(self.encoding) == charset.code()) + currentEncodingsTitle = charset.name(); } } } @@ -272,13 +272,13 @@ namespace // PopulateMenu{Flat,Hierarchical} enabledEncodings.insert(to_s(encoding)); encodings = [NSMutableArray new]; - citerate(charset, encoding_list()) + for(auto const& charset : encoding_list()) { - bool enabled = enabledEncodings.find(charset->code()) != enabledEncodings.end(); + bool enabled = enabledEncodings.find(charset.code()) != enabledEncodings.end(); id item = [NSMutableDictionary dictionaryWithObjectsAndKeys: @(enabled), @"enabled", - [NSString stringWithCxxString:charset->name()], @"name", - [NSString stringWithCxxString:charset->code()], @"charset", + [NSString stringWithCxxString:charset.name()], @"name", + [NSString stringWithCxxString:charset.code()], @"charset", nil]; [encodings addObject:item]; } diff --git a/Frameworks/OakAppKit/src/OakOpenWithMenu.mm b/Frameworks/OakAppKit/src/OakOpenWithMenu.mm index 167f0b31..6de9a293 100644 --- a/Frameworks/OakAppKit/src/OakOpenWithMenu.mm +++ b/Frameworks/OakAppKit/src/OakOpenWithMenu.mm @@ -42,17 +42,17 @@ static std::vector< std::pair > ApplicationURLsForPaths (NSSe } NSURL* defaultApplicationURL = defaultApplicationURLs.count == 1 ? defaultApplicationURLs.anyObject : nil; - iterate(appIter, apps) + for(auto const& appIter : apps) { - riterate(versIter, appIter->second) + riterate(versIter, appIter.second) { - NSString* appName = [NSString stringWithCxxString:appIter->first]; + NSString* appName = [NSString stringWithCxxString:appIter.first]; NSURL* appURL = versIter->second; if([defaultApplicationURL isEqual:appURL]) appName = [NSString stringWithFormat:@"%@ (default)", appName]; - if(appIter->second.size() > 1) // we have more than one version + if(appIter.second.size() > 1) // we have more than one version appName = [NSString stringWithFormat:@"%@ (%@)", appName, [NSString stringWithCxxString:versIter->first]]; res.insert(([defaultApplicationURL isEqual:appURL] ? res.begin() : res.end()), std::make_pair(appName, appURL)); @@ -91,14 +91,14 @@ static std::vector< std::pair > ApplicationURLsForPaths (NSSe return; } - iterate(app, appURLs) + for(auto const& app : appURLs) { - NSMenuItem* menuItem = [menu addItemWithTitle:app->first action:@selector(openWith:) keyEquivalent:@""]; + NSMenuItem* menuItem = [menu addItemWithTitle:app.first action:@selector(openWith:) keyEquivalent:@""]; [menuItem setTarget:self]; - [menuItem setRepresentedObject:app->second]; + [menuItem setRepresentedObject:app.second]; NSImage* image = nil; - if([app->second getResourceValue:&image forKey:NSURLEffectiveIconKey error:NULL] || (image = [[NSWorkspace sharedWorkspace] iconForFile:[app->second path]])) + if([app.second getResourceValue:&image forKey:NSURLEffectiveIconKey error:NULL] || (image = [[NSWorkspace sharedWorkspace] iconForFile:[app.second path]])) { image = [image copy]; image.size = NSMakeSize(16, 16); diff --git a/Frameworks/OakAppKit/src/OakPasteboard.mm b/Frameworks/OakAppKit/src/OakPasteboard.mm index b16e88d9..4bd1bc55 100644 --- a/Frameworks/OakAppKit/src/OakPasteboard.mm +++ b/Frameworks/OakAppKit/src/OakPasteboard.mm @@ -130,8 +130,8 @@ namespace private: static void callback (CFRunLoopObserverRef observer, CFRunLoopActivity activity, void* info) { - iterate(it, idle_callback()._pasteboards) - [*it checkForExternalPasteboardChanges]; + for(auto const& it : idle_callback()._pasteboards) + [it checkForExternalPasteboardChanges]; } bool _running; diff --git a/Frameworks/OakAppKit/src/OakTabBarView.mm b/Frameworks/OakAppKit/src/OakTabBarView.mm index dcce9cae..5967169c 100644 --- a/Frameworks/OakAppKit/src/OakTabBarView.mm +++ b/Frameworks/OakAppKit/src/OakTabBarView.mm @@ -113,21 +113,21 @@ std::vector layout_metrics_t::layers_for (std::string const& layer_id, if(l == layers.end()) return res; - iterate(it, l->second) + for(auto const& it : l->second) { - if((it->layer.requisite_mask & tab_bar_requisites::all) != layer_t::no_requisite) // layer is testing on OTBV requisite flags + if((it.layer.requisite_mask & tab_bar_requisites::all) != layer_t::no_requisite) // layer is testing on OTBV requisite flags { - if((it->layer.requisite & tab_bar_requisites::all) != (requisiteFilter & it->layer.requisite_mask)) + if((it.layer.requisite & tab_bar_requisites::all) != (requisiteFilter & it.layer.requisite_mask)) continue; } - if(it->padding.size() != 4) + if(it.padding.size() != 4) continue; CGFloat values[4] = { }; for(size_t i = 0; i < sizeofA(values); ++i) { - std::string const& str = it->padding[i]; + std::string const& str = it.padding[i]; switch(str.empty() ? '\0' : str[0]) { case 'W': values[i] = CGRectGetWidth(rect) + strtod(str.substr(1).c_str(), NULL); break; @@ -136,13 +136,13 @@ std::vector layout_metrics_t::layers_for (std::string const& layer_id, } } - res.push_back(it->layer); + res.push_back(it.layer); res.back().requisite &= ~tab_bar_requisites::all; res.back().requisite_mask &= ~tab_bar_requisites::all; - if(it->has_label) + if(it.has_label) res.back().text = label; - if(it->has_tool_tip) + if(it.has_tool_tip) res.back().tool_tip = toolTip; res.back().tag = tag; res.back().rect = CGRectMake(CGRectGetMinX(rect) + values[0], CGRectGetMinY(rect) + values[2], values[1]-values[0] + 1, values[3]-values[2] + 1); @@ -559,10 +559,10 @@ layout_metrics_t::raw_layer_t layout_metrics_t::parse_layer (NSDictionary* item) for(NSUInteger tabIndex = 0; tabIndex < tabTitles.count; ++tabIndex) { double width = WidthOfText([tabTitles safeObjectAtIndex:tabIndex]); - citerate(it, metrics->layers_for([self layerNameForTabIndex:tabIndex], CGRectZero, tabIndex, @"LabelPlaceholder")) + for(auto const& it : metrics->layers_for([self layerNameForTabIndex:tabIndex], CGRectZero, tabIndex, @"LabelPlaceholder")) { - if(it->text) - width -= it->rect.size.width - 1; + if(it.text) + width -= it.rect.size.width - 1; } width = oak::cap(metrics->minTabSize, width, metrics->maxTabSize); tabSizes.push_back(width); @@ -607,8 +607,8 @@ layout_metrics_t::raw_layer_t layout_metrics_t::parse_layer (NSDictionary* item) numberOfTabs = maxNumberOfTabs ?: 1; tabSizes.resize(numberOfTabs); totalWidth = 0; - iterate(it, tabSizes) - totalWidth += *it; + for(auto const& it : tabSizes) + totalWidth += it; } double fat = totalWidth - (numberOfTabs * metrics->minTabSize); @@ -737,10 +737,10 @@ layout_metrics_t::raw_layer_t layout_metrics_t::parse_layer (NSDictionary* item) NSRect tabRect = tabRects[overflowTab]; NSRect rect; uint32_t state = [self currentState] | layer_t::mouse_inside | layer_t::mouse_clicked; - citerate(it, metrics->layers_for([self layerNameForTabIndex:overflowTab], tabRect, overflowTab, [tabTitles objectAtIndex:overflowTab], nil, [self filterForTabIndex:overflowTab] | tab_bar_requisites::overflow)) + for(auto const& it : metrics->layers_for([self layerNameForTabIndex:overflowTab], tabRect, overflowTab, [tabTitles objectAtIndex:overflowTab], nil, [self filterForTabIndex:overflowTab] | tab_bar_requisites::overflow)) { - if((state & it->requisite_mask) == it->requisite) - rect = it->rect; + if((state & it.requisite_mask) == it.requisite) + rect = it.rect; } rect.origin.y -= 6; //shift menu down slightly to base of tab [[self overflowTabMenu] popUpMenuPositioningItem:nil atLocation:(rect.origin) inView:self]; @@ -880,10 +880,10 @@ layout_metrics_t::raw_layer_t layout_metrics_t::parse_layer (NSDictionary* item) [image lockFocus]; uint32_t state = [self currentState] | layer_t::mouse_inside | layer_t::mouse_down; - citerate(it, metrics->layers_for([self layerNameForTabIndex:draggedTab], (NSRect){NSZeroPoint, tabRect.size}, draggedTab, [tabTitles objectAtIndex:draggedTab], nil, [self filterForTabIndex:draggedTab] | tab_bar_requisites::dragged)) + for(auto const& it : metrics->layers_for([self layerNameForTabIndex:draggedTab], (NSRect){NSZeroPoint, tabRect.size}, draggedTab, [tabTitles objectAtIndex:draggedTab], nil, [self filterForTabIndex:draggedTab] | tab_bar_requisites::dragged)) { - if((state & it->requisite_mask) == it->requisite) - [self drawLayer:*it]; + if((state & it.requisite_mask) == it.requisite) + [self drawLayer:it]; } [image unlockFocus]; diff --git a/Frameworks/OakDebug/src/OakDebugMenu.mm b/Frameworks/OakDebug/src/OakDebugMenu.mm index 07a00e2b..e7d2b5c6 100644 --- a/Frameworks/OakDebug/src/OakDebugMenu.mm +++ b/Frameworks/OakDebug/src/OakDebugMenu.mm @@ -68,10 +68,10 @@ namespace OakDebugBaseClass::registry()[[[menuItem representedObject] UTF8String]] ^= true; NSMutableArray* debugEnabled = [NSMutableArray array]; - iterate(it, OakDebugBaseClass::registry()) + for(auto const& it : OakDebugBaseClass::registry()) { - if(it->second) - [debugEnabled addObject:@(it->first.c_str())]; + if(it.second) + [debugEnabled addObject:@(it.first.c_str())]; } [[NSUserDefaults standardUserDefaults] setObject:debugEnabled forKey:@"OakDebug Enabled"]; } @@ -116,14 +116,14 @@ namespace std::vector sectionNames = OakDebugBaseClass::sectionNames();; NSMenu* submenu = nil; - iterate(it, OakDebugBaseClass::registry()) + for(auto const& it : OakDebugBaseClass::registry()) { - std::string const& sectionName = OakDebugBaseClass::sectionName(it->first); + std::string const& sectionName = OakDebugBaseClass::sectionName(it.first); NSMenuItem* item; if(oak::contains(sectionNames.begin(), sectionNames.end(), sectionName)) { NSString* section = @(sectionName.c_str()); - NSString* title = sectionName.size() == it->first.size() ? @"Base" : @(it->first.substr(sectionName.size() + 1).c_str()); + NSString* title = sectionName.size() == it.first.size() ? @"Base" : @(it.first.substr(sectionName.size() + 1).c_str()); if(![[submenu title] isEqualToString:section]) { submenu = [[NSMenu alloc] initWithTitle:section]; @@ -133,11 +133,11 @@ namespace } else { - item = [aMenu addItemWithTitle:@(it->first.c_str()) action:@selector(toggleDebugOption:) keyEquivalent:@""]; + item = [aMenu addItemWithTitle:@(it.first.c_str()) action:@selector(toggleDebugOption:) keyEquivalent:@""]; } - [item setRepresentedObject:@(it->first.c_str())]; + [item setRepresentedObject:@(it.first.c_str())]; [item setTarget:self]; - [item setState:it->second ? NSOnState : NSOffState]; + [item setState:it.second ? NSOnState : NSOffState]; } } diff --git a/Frameworks/OakDebug/src/OakWatchLeaks.cc b/Frameworks/OakDebug/src/OakWatchLeaks.cc index e94ad2dd..0088ec4b 100644 --- a/Frameworks/OakDebug/src/OakWatchLeaks.cc +++ b/Frameworks/OakDebug/src/OakWatchLeaks.cc @@ -26,10 +26,10 @@ namespace { ~helper_t () { - citerate(it, get_counts().counts) + for(auto const& it : get_counts().counts) { - if(it->second != 0) - bug("%4zd: %s\n", it->second, it->first.c_str()); + if(it.second != 0) + bug("%4zd: %s\n", it.second, it.first.c_str()); } } diff --git a/Frameworks/OakFileBrowser/src/OakFileBrowser.mm b/Frameworks/OakFileBrowser/src/OakFileBrowser.mm index b18dd835..f431e4e2 100644 --- a/Frameworks/OakFileBrowser/src/OakFileBrowser.mm +++ b/Frameworks/OakFileBrowser/src/OakFileBrowser.mm @@ -411,8 +411,8 @@ static NSMutableSet* SymmetricDifference (NSMutableSet* aSet, NSMutableSet* anot if(!selection.empty()) { std::vector quoted; - iterate(path, selection) - quoted.push_back(format_string::replace(*path, "\\A(?m:.*)\\z", "'${0/'/'\\''/}'")); + for(auto const& path : selection) + quoted.push_back(format_string::replace(path, "\\A(?m:.*)\\z", "'${0/'/'\\''/}'")); env["TM_SELECTED_FILE"] = selection.back(); env["TM_SELECTED_FILES"] = text::join(quoted, " "); } @@ -940,8 +940,8 @@ static NSMutableSet* SymmetricDifference (NSMutableSet* aSet, NSMutableSet* anot [aMenu addItem:[NSMenuItem separatorItem]]; std::multimap sorted; - iterate(item, items) - sorted.emplace((*item)->name(), *item); + for(auto const& item : items) + sorted.emplace(item->name(), item); for(auto pair : sorted) [[aMenu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:@selector(executeBundleCommand:) keyEquivalent:@""] setRepresentedObject:[NSString stringWithCxxString:pair.second->uuid()]]; diff --git a/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm index ea39ac05..d2c5ac7a 100644 --- a/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm @@ -277,8 +277,8 @@ private: } NSMutableArray* lostItems = [NSMutableArray array]; - iterate(pair, existingItems) - add_item_and_children(pair->second, lostItems); + for(auto const& pair : existingItems) + add_item_and_children(pair.second, lostItems); [dataSource lostItems:lostItems]; [dataSource setLastModified:buf.st_mtimespec forPath:dir]; diff --git a/Frameworks/OakFileBrowser/src/io/FSSCMDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSSCMDataSource.mm index fbc8df00..2274301c 100644 --- a/Frameworks/OakFileBrowser/src/io/FSSCMDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSSCMDataSource.mm @@ -23,12 +23,12 @@ static NSURL* URLAppend (NSURL* base, NSString* relativePath) static NSArray* convert (std::vector const& paths, std::string const& wcPath, NSUInteger options, bool hideSCMBadge = false) { NSMutableArray* res = [NSMutableArray array]; - iterate(path, paths) + for(auto const& path : paths) { - FSItem* item = [FSItem itemWithURL:[NSURL fileURLWithPath:[NSString stringWithCxxString:*path]]]; - item.target = [NSURL fileURLWithPath:[NSString stringWithCxxString:*path]]; - item.labelIndex = path::label_index(*path); - item.toolTip = [NSString stringWithCxxString:path::relative_to(*path, wcPath)]; + FSItem* item = [FSItem itemWithURL:[NSURL fileURLWithPath:[NSString stringWithCxxString:path]]]; + item.target = [NSURL fileURLWithPath:[NSString stringWithCxxString:path]]; + item.labelIndex = path::label_index(path); + item.toolTip = [NSString stringWithCxxString:path::relative_to(path, wcPath)]; item.leaf = YES; if(hideSCMBadge) diff --git a/Frameworks/OakFileBrowser/src/io/FSSearchDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSSearchDataSource.mm index ff9d1fad..a40b9f29 100644 --- a/Frameworks/OakFileBrowser/src/io/FSSearchDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSSearchDataSource.mm @@ -63,9 +63,9 @@ namespace if(plist::get_key_path(savedSearch, "RawQueryDict.SearchScopes", scopes)) { std::vector searchScopes; - iterate(it, scopes) + for(auto const& it : scopes) { - if(std::string const* str = boost::get(&*it)) + if(std::string const* str = boost::get(&it)) { D(DBF_FileBrowser_Spotlight, bug("scope ‘%s’\n", str->c_str());); searchScopes.push_back(*str); @@ -89,8 +89,8 @@ namespace if((self = [super init])) { NSMutableArray* results = [NSMutableArray new]; - citerate(item, execute_saved_search([[anURL path] fileSystemRepresentation])) - [results addObject:[FSItem itemWithURL:[NSURL fileURLWithPath:CFBridgingRelease(MDItemCopyAttribute(*item, kMDItemPath)) isDirectory:NO]]]; + for(auto const& item : execute_saved_search([[anURL path] fileSystemRepresentation])) + [results addObject:[FSItem itemWithURL:[NSURL fileURLWithPath:CFBridgingRelease(MDItemCopyAttribute(item, kMDItemPath)) isDirectory:NO]]]; self.rootItem = [FSItem itemWithURL:anURL]; self.rootItem.icon = [OakFileIconImage fileIconImageWithPath:[anURL path] size:NSMakeSize(16, 16)]; diff --git a/Frameworks/OakFileBrowser/src/io/FSVolumesDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSVolumesDataSource.mm index 9475a873..9eecb6f0 100644 --- a/Frameworks/OakFileBrowser/src/io/FSVolumesDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSVolumesDataSource.mm @@ -9,9 +9,9 @@ - (NSArray*)volumeList { NSMutableArray* volumes = [NSMutableArray new]; - citerate(volume, path::volumes()) + for(auto const& volume : path::volumes()) { - NSURL* url = [NSURL fileURLWithPath:[NSString stringWithCxxString:*volume] isDirectory:YES]; + NSURL* url = [NSURL fileURLWithPath:[NSString stringWithCxxString:volume] isDirectory:YES]; FSItem* item = [FSItem itemWithURL:url]; item.target = url; item.leaf = YES; diff --git a/Frameworks/OakFilterList/src/datasources/BundleItemChooser.mm b/Frameworks/OakFilterList/src/datasources/BundleItemChooser.mm index 5e00cdb5..87f4f6d6 100644 --- a/Frameworks/OakFilterList/src/datasources/BundleItemChooser.mm +++ b/Frameworks/OakFilterList/src/datasources/BundleItemChooser.mm @@ -311,8 +311,8 @@ static std::vector relevant_items_in_scope (search::type sear kindMask = bundles::kItemTypeTheme; std::map sorted; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope, kindMask, oak::uuid_t(), false)) - sorted.emplace(full_name_with_selection(*item, hasSelection), *item); + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope, kindMask, oak::uuid_t(), false)) + sorted.emplace(full_name_with_selection(item, hasSelection), item); std::vector res; std::transform(sorted.begin(), sorted.end(), back_inserter(res), [](std::pair const& p){ return p.second; }); @@ -352,8 +352,8 @@ static std::vector relevant_items_in_scope (search::type sear searchType = newType; all_items = relevant_items_in_scope(searchType, scope::wildcard, hasSelection); - citerate(item, relevant_items_in_scope(searchType, scope, hasSelection)) - items_filtered_by_scope.insert((*item)->uuid()); + for(auto const& item : relevant_items_in_scope(searchType, scope, hasSelection)) + items_filtered_by_scope.insert(item->uuid()); [[NSNotificationCenter defaultCenter] postNotificationName:FLDataSourceItemsDidChangeNotification object:self]; } } @@ -463,8 +463,8 @@ static std::vector relevant_items_in_scope (search::type sear } NSMutableArray* items = [NSMutableArray array]; - iterate(it, rankedItems) - [items addObject:it->second]; + for(auto const& it : rankedItems) + [items addObject:it.second]; return items; } diff --git a/Frameworks/OakFilterList/src/highlight_ranges.mm b/Frameworks/OakFilterList/src/highlight_ranges.mm index e3c08381..8aaead21 100644 --- a/Frameworks/OakFilterList/src/highlight_ranges.mm +++ b/Frameworks/OakFilterList/src/highlight_ranges.mm @@ -19,11 +19,11 @@ NSAttributedString* AttributedStringWithMarkedUpRanges (std::string const& in, s } size_t from = 0; - iterate(it, ranges) + for(auto const& it : ranges) { - [res appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithCxxString:std::string(text.begin() + from, text.begin() + it->first)] attributes:nil]]; - [res appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithCxxString:std::string(text.begin() + it->first, text.begin() + it->second)] attributes:highlightAttrs]]; - from = it->second; + [res appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithCxxString:std::string(text.begin() + from, text.begin() + it.first)] attributes:nil]]; + [res appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithCxxString:std::string(text.begin() + it.first, text.begin() + it.second)] attributes:highlightAttrs]]; + from = it.second; } if(from < text.size()) [res appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithCxxString:std::string(text.begin() + from, text.end())] attributes:nil]]; diff --git a/Frameworks/OakTextView/src/GutterView.mm b/Frameworks/OakTextView/src/GutterView.mm index 1e8c3ad8..defac4ba 100644 --- a/Frameworks/OakTextView/src/GutterView.mm +++ b/Frameworks/OakTextView/src/GutterView.mm @@ -95,10 +95,10 @@ struct data_source_t - (void)dealloc { D(DBF_GutterView, bug("\n");); - iterate(it, columnDataSources) + for(auto const& it : columnDataSources) { - if(it->datasource) - [[NSNotificationCenter defaultCenter] removeObserver:self name:GVColumnDataSourceDidChange object:it->datasource]; + if(it.datasource) + [[NSNotificationCenter defaultCenter] removeObserver:self name:GVColumnDataSourceDidChange object:it.datasource]; } [[NSNotificationCenter defaultCenter] removeObserver:self]; } @@ -108,9 +108,9 @@ struct data_source_t backgroundRects.clear(); borderRects.clear(); - citerate(range, text::selection_t(highlightedRange)) + for(auto const& range : text::selection_t(highlightedRange)) { - auto from = range->min(), to = range->max(); + auto from = range.min(), to = range.max(); CGFloat firstY = [self.delegate lineFragmentForLine:from.line column:from.column].firstY; auto fragment = [self.delegate lineFragmentForLine:to.line column:to.column]; CGFloat lastY = to.column == 0 && from.line != to.line ? fragment.firstY : fragment.lastY; @@ -138,8 +138,8 @@ struct data_source_t OakRectSymmetricDifference(oldBackgroundRects, backgroundRects, back_inserter(refreshRects)); OakRectSymmetricDifference(oldBorderRects, borderRects, back_inserter(refreshRects)); - iterate(rect, refreshRects) - [self setNeedsDisplayInRect:*rect]; + for(auto const& rect : refreshRects) + [self setNeedsDisplayInRect:rect]; } - (void)setPartnerView:(NSView*)aView @@ -206,10 +206,10 @@ struct data_source_t - (data_source_t*)columnWithIdentifier:(std::string const&)identifier { - iterate(it, columnDataSources) + for(auto& it : columnDataSources) { - if(it->identifier == identifier) - return &(*it); + if(it.identifier == identifier) + return ⁢ } ASSERT(false); return NULL; @@ -218,10 +218,10 @@ struct data_source_t - (std::vector)visibleColumnDataSources { std::vector visibleColumnDataSources; - iterate(it, columnDataSources) + for(auto const& it : columnDataSources) { - if([self visibilityForColumnWithIdentifier:[NSString stringWithCxxString:it->identifier]]) - visibleColumnDataSources.push_back(*it); + if([self visibilityForColumnWithIdentifier:[NSString stringWithCxxString:it.identifier]]) + visibleColumnDataSources.push_back(it); } return visibleColumnDataSources; } @@ -322,12 +322,12 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel [self setupSelectionRects]; [self.selectionBackgroundColor set]; - iterate(rect, backgroundRects) - NSRectFillUsingOperation(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); + for(auto const& rect : backgroundRects) + NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); [self.selectionBorderColor set]; - iterate(rect, borderRects) - NSRectFillUsingOperation(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); + for(auto const& rect : borderRects) + NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); std::pair prevLine(NSNotFound, 0); for(CGFloat y = NSMinY(aRect); y < NSMaxY(aRect); ) @@ -338,13 +338,13 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel prevLine = std::make_pair(record.lineNumber, record.softlineOffset); BOOL selectedRow = NO; - iterate(rect, backgroundRects) - selectedRow = selectedRow || NSIntersectsRect(*rect, NSMakeRect(0, record.firstY, CGRectGetWidth(self.frame), record.lastY - record.firstY)); + for(auto const& rect : backgroundRects) + selectedRow = selectedRow || NSIntersectsRect(rect, NSMakeRect(0, record.firstY, CGRectGetWidth(self.frame), record.lastY - record.firstY)); - citerate(dataSource, [self visibleColumnDataSources]) + for(auto const& dataSource : [self visibleColumnDataSources]) { - NSRect columnRect = NSMakeRect(dataSource->x0, record.firstY, dataSource->width, record.lastY - record.firstY); - if(dataSource->identifier == GVLineNumbersColumnIdentifier.UTF8String) + NSRect columnRect = NSMakeRect(dataSource.x0, record.firstY, dataSource.width, record.lastY - record.firstY); + if(dataSource.identifier == GVLineNumbersColumnIdentifier.UTF8String) { NSColor* textColor = selectedRow ? self.selectionForegroundColor : self.foregroundColor; DrawText(record.softlineOffset == 0 ? std::to_string(record.lineNumber + 1) : "·", columnRect, NSMinY(columnRect) + record.baseline, self.lineNumberFont, textColor); @@ -361,7 +361,7 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel else if(isHoveringRect) [self.iconHoverColor set]; else [self.iconColor set]; - NSImage* image = [self imageForColumn:dataSource->identifier atLine:record.lineNumber hovering:isHoveringRect && NSEqualPoints(mouseDownAtPoint, NSMakePoint(-1, -1)) pressed:isHoveringRect && isDownInRect]; + NSImage* image = [self imageForColumn:dataSource.identifier atLine:record.lineNumber hovering:isHoveringRect && NSEqualPoints(mouseDownAtPoint, NSMakePoint(-1, -1)) pressed:isHoveringRect && isDownInRect]; if([image size].height > 0 && [image size].width > 0) { // The placement of the center of image is aligned with the center of the capHeight. @@ -398,18 +398,18 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel static const CGFloat columnPadding = 1; CGFloat currentX = 0, totalWidth = 0; - iterate(it, columnDataSources) + for(auto& it : columnDataSources) { - it->x0 = currentX; - if([self visibilityForColumnWithIdentifier:[NSString stringWithCxxString:it->identifier]]) + it.x0 = currentX; + if([self visibilityForColumnWithIdentifier:[NSString stringWithCxxString:it.identifier]]) { - it->width = [self widthForColumnWithIdentifier:it->identifier]; - totalWidth += it->width + columnPadding; - currentX += it->width + columnPadding; + it.width = [self widthForColumnWithIdentifier:it.identifier]; + totalWidth += it.width + columnPadding; + currentX += it.width + columnPadding; } else { - it->width = 0; + it.width = 0; } } @@ -435,12 +435,12 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel GVLineRecord record = [self.delegate lineRecordForPosition:aPoint.y]; if(record.lineNumber != NSNotFound && record.softlineOffset == 0) { - citerate(dataSource, [self visibleColumnDataSources]) + for(auto const& dataSource : [self visibleColumnDataSources]) { - if(dataSource->identifier == [GVLineNumbersColumnIdentifier UTF8String]) + if(dataSource.identifier == [GVLineNumbersColumnIdentifier UTF8String]) continue; - NSRect columnRect = NSMakeRect(dataSource->x0, record.firstY, dataSource->width, record.lastY - record.firstY); + NSRect columnRect = NSMakeRect(dataSource.x0, record.firstY, dataSource.width, record.lastY - record.firstY); if(NSPointInRect(aPoint, columnRect)) return columnRect; } @@ -468,11 +468,11 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel if(NSEqualRects(columnRect, [self columnRectForPoint:mouseHoveringAtPoint])) { GVLineRecord record = [self.delegate lineRecordForPosition:mouseDownAtPoint.y]; - citerate(dataSource, [self visibleColumnDataSources]) + for(auto const& dataSource : [self visibleColumnDataSources]) { - NSRect columnRect = NSMakeRect(dataSource->x0, record.firstY, dataSource->width, record.lastY - record.firstY); + NSRect columnRect = NSMakeRect(dataSource.x0, record.firstY, dataSource.width, record.lastY - record.firstY); if(NSPointInRect(mouseDownAtPoint, columnRect)) - [dataSource->delegate userDidClickColumnWithIdentifier:[NSString stringWithCxxString:dataSource->identifier] atLine:record.lineNumber]; + [dataSource.delegate userDidClickColumnWithIdentifier:[NSString stringWithCxxString:dataSource.identifier] atLine:record.lineNumber]; } } else diff --git a/Frameworks/OakTextView/src/OakDocumentView.mm b/Frameworks/OakTextView/src/OakDocumentView.mm index 318099bc..4d036a02 100644 --- a/Frameworks/OakTextView/src/OakDocumentView.mm +++ b/Frameworks/OakTextView/src/OakDocumentView.mm @@ -79,8 +79,8 @@ struct document_view_callback_t : document::document_t::callback_t } else if(event == did_change_file_type) { - citerate(item, bundles::query(bundles::kFieldGrammarScope, document->file_type())) - self.statusBar.grammarName = [NSString stringWithCxxString:(*item)->name()]; + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, document->file_type())) + self.statusBar.grammarName = [NSString stringWithCxxString:item->name()]; } else if(event == did_change_indent_settings) { @@ -318,8 +318,8 @@ private: document->add_callback(callback); document->show(); - citerate(item, bundles::query(bundles::kFieldGrammarScope, document->file_type())) - statusBar.grammarName = [NSString stringWithCxxString:(*item)->name()]; + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, document->file_type())) + statusBar.grammarName = [NSString stringWithCxxString:item->name()]; statusBar.tabSize = document->buffer().indent().tab_size(); statusBar.softTabs = document->buffer().indent().soft_tabs(); } @@ -744,11 +744,11 @@ static std::string const kSearchmarkType = "search"; { ng::buffer_t& buf = document->buffer(); std::map const& marks = buf.get_marks(0, buf.size(), kBookmarkType); - iterate(pair, marks) + for(auto const& pair : marks) { - size_t n = buf.convert(pair->first).line; + size_t n = buf.convert(pair.first).line; NSMenuItem* item = [aMenu addItemWithTitle:[NSString stringWithCxxString:text::pad(n+1, 4) + ": " + buf.substr(buf.begin(n), buf.eol(n))] action:@selector(takeBookmarkFrom:) keyEquivalent:@""]; - [item setRepresentedObject:[NSString stringWithCxxString:buf.convert(pair->first)]]; + [item setRepresentedObject:[NSString stringWithCxxString:buf.convert(pair.first)]]; } if(!marks.empty()) @@ -766,10 +766,10 @@ static std::string const kSearchmarkType = "search"; { ng::buffer_t& buf = document->buffer(); std::map const& marks = buf.get_marks(buf.begin(lineNumber), buf.eol(lineNumber), kBookmarkType); - iterate(pair, marks) + for(auto const& pair : marks) { - if(pair->second == kBookmarkType) - return buf.remove_mark(buf.begin(lineNumber) + pair->first, pair->second); + if(pair.second == kBookmarkType) + return buf.remove_mark(buf.begin(lineNumber) + pair.first, pair.second); } buf.set_mark(buf.begin(lineNumber), kBookmarkType); } @@ -793,10 +793,10 @@ static std::string const kSearchmarkType = "search"; std::vector toRemove; std::map const& marks = buf.get_marks(buf.begin(lineNumber), buf.eol(lineNumber), kBookmarkType); - iterate(pair, marks) + for(auto const& pair : marks) { - if(pair->second == kBookmarkType) - toRemove.push_back(buf.begin(lineNumber) + pair->first); + if(pair.second == kBookmarkType) + toRemove.push_back(buf.begin(lineNumber) + pair.first); } if(toRemove.empty()) @@ -805,8 +805,8 @@ static std::string const kSearchmarkType = "search"; } else { - iterate(index, toRemove) - buf.remove_mark(*index, kBookmarkType); + for(auto const& index : toRemove) + buf.remove_mark(index, kBookmarkType); } [[NSNotificationCenter defaultCenter] postNotificationName:GVColumnDataSourceDidChange object:self]; } diff --git a/Frameworks/OakTextView/src/OakPasteboardWrapper.mm b/Frameworks/OakTextView/src/OakPasteboardWrapper.mm index ac50278f..2c57101d 100644 --- a/Frameworks/OakTextView/src/OakPasteboardWrapper.mm +++ b/Frameworks/OakTextView/src/OakPasteboardWrapper.mm @@ -20,8 +20,8 @@ static clipboard_t::entry_ptr to_entry (OakPasteboardEntry* src, BOOL includeFin std::map map; plist::dictionary_t const& plist = plist::convert((__bridge CFDictionaryRef)src.options); - iterate(pair, plist) - plist::get_key_path(plist, pair->first, map[pair->first]); + for(auto const& pair : plist) + plist::get_key_path(plist, pair.first, map[pair.first]); if(includeFindOptions) { diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index f07d3e23..4a48b36d 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -366,8 +366,8 @@ static std::vector items_for_tab_expansion (ng::buffer_t cons static ng::ranges_t merge (ng::ranges_t lhs, ng::ranges_t const& rhs) { - iterate(range, rhs) - lhs.push_back(*range); + for(auto const& range : rhs) + lhs.push_back(range); return lhs; } @@ -410,10 +410,10 @@ struct refresh_helper_t { if(_revision == _document->buffer().revision()) { - citerate(range, ng::highlight_ranges_for_movement(_document->buffer(), _selection, _editor->ranges())) + for(auto const& range : ng::highlight_ranges_for_movement(_document->buffer(), _selection, _editor->ranges())) { NSRect imageRect; - NSImage* image = [_self imageForRanges:*range imageRect:&imageRect]; + NSImage* image = [_self imageForRanges:range imageRect:&imageRect]; imageRect = [_self convertRect:imageRect toView:nil]; imageRect.origin = [[_self window] convertBaseToScreen:imageRect.origin]; OakShowPopOutAnimation(imageRect, image); @@ -434,12 +434,12 @@ struct refresh_helper_t [_self setFrameSize:newSize]; NSView* gutterView = find_gutter_view([[_self enclosingScrollView] superview]); - iterate(rect, damagedRects) + for(auto const& rect : damagedRects) { - [_self setNeedsDisplayInRect:*rect]; + [_self setNeedsDisplayInRect:rect]; if(gutterView) { - NSRect r = *rect; + NSRect r = rect; r.origin.x = 0; r.size.width = NSWidth([gutterView frame]); [gutterView setNeedsDisplayInRect:r]; @@ -493,8 +493,8 @@ void buffer_refresh_callback_t::did_replace (size_t, size_t, std::string const&) static std::string shell_quote (std::vector paths) { - iterate(it, paths) - *it = format_string::replace(*it, ".+", "'${0/'/'\\''/g}'"); + for(auto& it : paths) + it = format_string::replace(it, ".+", "'${0/'/'\\''/g}'"); return text::join(paths, " "); } @@ -569,12 +569,12 @@ static std::string shell_quote (std::vector paths) - (NSImage*)imageForRanges:(ng::ranges_t const&)ranges imageRect:(NSRect*)outRect { NSRect srcRect = NSZeroRect, visibleRect = [self visibleRect]; - citerate(range, ranges) - srcRect = NSUnionRect(srcRect, NSIntersectionRect(visibleRect, layout->rect_for_range(range->min().index, range->max().index))); + for(auto const& range : ranges) + srcRect = NSUnionRect(srcRect, NSIntersectionRect(visibleRect, layout->rect_for_range(range.min().index, range.max().index))); NSBezierPath* clip = [NSBezierPath bezierPath]; - citerate(rect, layout->rects_for_ranges(ranges)) - [clip appendBezierPath:[NSBezierPath bezierPathWithRect:NSOffsetRect(*rect, -NSMinX(srcRect), -NSMinY(srcRect))]]; + for(auto const& rect : layout->rects_for_ranges(ranges)) + [clip appendBezierPath:[NSBezierPath bezierPathWithRect:NSOffsetRect(rect, -NSMinX(srcRect), -NSMinY(srcRect))]]; NSImage* image = [[NSImage alloc] initWithSize:NSMakeSize(std::max(NSWidth(srcRect), 1), std::max(NSHeight(srcRect), 1))]; [image setFlipped:[self isFlipped]]; @@ -601,14 +601,14 @@ static std::string shell_quote (std::vector paths) if(ranges.empty()) return; - iterate(range, ranges) - layout->remove_enclosing_folds(range->min().index, range->max().index); + for(auto const& range : ranges) + layout->remove_enclosing_folds(range.min().index, range.max().index); [self ensureSelectionIsInVisibleArea:self]; - citerate(range, ranges) + for(auto const& range : ranges) { NSRect imageRect; - NSImage* image = [self imageForRanges:*range imageRect:&imageRect]; + NSImage* image = [self imageForRanges:range imageRect:&imageRect]; imageRect = [self convertRect:imageRect toView:nil]; imageRect.origin = [[self window] convertBaseToScreen:imageRect.origin]; OakShowPopOutAnimation(imageRect, image); @@ -641,8 +641,8 @@ static std::string shell_quote (std::vector paths) { ng::ranges_t ranges = convert(document->buffer(), document->selection()); editor->set_selections(ranges); - iterate(range, ranges) - layout->remove_enclosing_folds(range->min().index, range->max().index); + for(auto const& range : ranges) + layout->remove_enclosing_folds(range.min().index, range.max().index); [self ensureSelectionIsInVisibleArea:self]; [self updateSelection]; @@ -709,8 +709,8 @@ static std::string shell_quote (std::vector paths) { ng::ranges_t ranges = convert(document->buffer(), document->selection()); editor->set_selections(ranges); - iterate(range, ranges) - layout->remove_enclosing_folds(range->min().index, range->max().index); + for(auto const& range : ranges) + layout->remove_enclosing_folds(range.min().index, range.max().index); } [self reflectDocumentSize]; @@ -769,8 +769,8 @@ static std::string shell_quote (std::vector paths) if(window != self.window) return; - citerate(item, bundles::query(bundles::kFieldSemanticClass, "callback.document.will-save", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) - [self performBundleItem:*item]; + for(auto const& item : bundles::query(bundles::kFieldSemanticClass, "callback.document.will-save", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) + [self performBundleItem:item]; if(document && layout) { @@ -785,8 +785,8 @@ static std::string shell_quote (std::vector paths) if(window != self.window) return; - citerate(item, bundles::query(bundles::kFieldSemanticClass, "callback.document.did-save", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) - [self performBundleItem:*item]; + for(auto const& item : bundles::query(bundles::kFieldSemanticClass, "callback.document.did-save", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) + [self performBundleItem:item]; } - (void)reflectDocumentSize @@ -1044,13 +1044,13 @@ doScroll: pendingMarkedRanges = markedRanges; ng::ranges_t sel; - citerate(range, editor->ranges()) + for(auto const& range : editor->ranges()) { - std::string const str = document->buffer().substr(range->min().index, range->max().index); + std::string const str = document->buffer().substr(range.min().index, range.max().index); char const* base = str.data(); size_t from = utf16::advance(base, aRange.location, base + str.size()) - base; size_t to = utf16::advance(base, aRange.location + aRange.length, base + str.size()) - base; - sel.push_back(ng::range_t(range->min() + from, range->min() + to)); + sel.push_back(ng::range_t(range.min() + from, range.min() + to)); } editor->set_selections(sel); } @@ -1221,8 +1221,8 @@ doScroll: } HANDLE_ATTR(SelectedTextRanges) { ng::ranges_t const ranges = editor->ranges(); NSMutableArray* nsRanges = [NSMutableArray arrayWithCapacity:ranges.size()]; - iterate(range, ranges) - [nsRanges addObject:[NSValue valueWithRange:[self nsRangeForRange:(*range)]]]; + for(auto const& range : ranges) + [nsRanges addObject:[NSValue valueWithRange:[self nsRangeForRange:range]]]; ret = nsRanges; } HANDLE_ATTR(VisibleCharacterRange) { NSRect visibleRect = [self visibleRect]; @@ -1622,14 +1622,14 @@ doScroll: - (void)applicationDidBecomeActiveNotification:(NSNotification*)aNotification { - citerate(item, bundles::query(bundles::kFieldSemanticClass, "callback.application.did-activate", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) - [self performBundleItem:*item]; + for(auto const& item : bundles::query(bundles::kFieldSemanticClass, "callback.application.did-activate", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) + [self performBundleItem:item]; } - (void)applicationDidResignActiveNotification:(NSNotification*)aNotification { - citerate(item, bundles::query(bundles::kFieldSemanticClass, "callback.application.did-deactivate", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) - [self performBundleItem:*item]; + for(auto const& item : bundles::query(bundles::kFieldSemanticClass, "callback.application.did-deactivate", [self scopeContext], bundles::kItemTypeMost, oak::uuid_t(), false)) + [self performBundleItem:item]; } // ============ @@ -1644,8 +1644,8 @@ static plist::any_t normalize_potential_dictionary (plist::any_t const& action) if(plist::dictionary_t const* dict = boost::get(&action)) { plist::dictionary_t res; - citerate(pair, *dict) - res.emplace(ns::normalize_event_string(pair->first), normalize_potential_dictionary(pair->second)); + for(auto const& pair : *dict) + res.emplace(ns::normalize_event_string(pair.first), normalize_potential_dictionary(pair.second)); return res; } return action; @@ -1679,17 +1679,17 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac "/System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict", }; - iterate(path, KeyBindingLocations) + for(auto const& path : KeyBindingLocations) { - citerate(pair, plist::load(*path)) - KeyBindings.emplace(ns::normalize_event_string(pair->first), normalize_potential_dictionary(pair->second)); + for(auto const& pair : plist::load(path)) + KeyBindings.emplace(ns::normalize_event_string(pair.first), normalize_potential_dictionary(pair.second)); } action_to_key_t actionToKey; - iterate(pair, KeyBindings) + for(auto const& pair : KeyBindings) { - if(std::string const* selector = boost::get(&pair->second)) - actionToKey.emplace(*selector, pair->first); + if(std::string const* selector = boost::get(&pair.second)) + actionToKey.emplace(*selector, pair.first); } update_menu_key_equivalents([NSApp mainMenu], actionToKey); @@ -1722,8 +1722,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac { std::vector v; ng::ranges_t const ranges = ng::dissect_columnar(document->buffer(), editor->ranges()); - iterate(range, ranges) - v.push_back(document->buffer().substr(range->min().index, range->max().index)); + for(auto const& range : ranges) + v.push_back(document->buffer().substr(range.min().index, range.max().index)); [pboard declareTypes:@[ NSStringPboardType ] owner:nil]; res = [pboard setString:[NSString stringWithCxxString:text::join(v, "\n")] forType:NSStringPboardType]; @@ -1756,9 +1756,9 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac { KeyEventContext = &KeyBindings; std::vector selectors; - iterate(it, *actions) + for(auto const& it : *actions) { - if(std::string const* selector = boost::get(&*it)) + if(std::string const* selector = boost::get(&it)) selectors.push_back(*selector); } @@ -2329,8 +2329,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac else { std::set alreadySelected; - citerate(range, editor->ranges()) - alreadySelected.insert(*range); + for(auto const& range : editor->ranges()) + alreadySelected.insert(range); ng::ranges_t newSelection; for(auto range : res) @@ -2441,8 +2441,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac self.liveSearchString = [searchField string]; ng::ranges_t res; - citerate(pair, ng::find(document->buffer(), liveSearchAnchor, to_s(liveSearchString), find::ignore_case|find::ignore_whitespace|find::wrap_around)) - res.push_back(pair->first); + for(auto const& pair : ng::find(document->buffer(), liveSearchAnchor, to_s(liveSearchString), find::ignore_case|find::ignore_whitespace|find::wrap_around)) + res.push_back(pair.first); [self setLiveSearchRanges:res]; } @@ -2465,8 +2465,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac if(self.liveSearchView) { ng::ranges_t tmp; - citerate(pair, ng::find(document->buffer(), ng::move(document->buffer(), liveSearchRanges.empty() ? liveSearchAnchor : liveSearchRanges, kSelectionMoveToEndOfSelection), to_s(liveSearchString), find::ignore_case|find::ignore_whitespace)) - tmp.push_back(pair->first); + for(auto const& pair : ng::find(document->buffer(), ng::move(document->buffer(), liveSearchRanges.empty() ? liveSearchAnchor : liveSearchRanges, kSelectionMoveToEndOfSelection), to_s(liveSearchString), find::ignore_case|find::ignore_whitespace)) + tmp.push_back(pair.first); [self setLiveSearchRanges:tmp]; if(!tmp.empty()) liveSearchAnchor = ng::move(document->buffer(), tmp, kSelectionMoveToBeginOfSelection); @@ -2482,8 +2482,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac if(self.liveSearchView) { ng::ranges_t tmp; - citerate(pair, ng::find(document->buffer(), ng::move(document->buffer(), liveSearchRanges.empty() ? liveSearchAnchor : liveSearchRanges, kSelectionMoveToBeginOfSelection), to_s(liveSearchString), find::backwards|find::ignore_case|find::ignore_whitespace)) - tmp.push_back(pair->first); + for(auto const& pair : ng::find(document->buffer(), ng::move(document->buffer(), liveSearchRanges.empty() ? liveSearchAnchor : liveSearchRanges, kSelectionMoveToBeginOfSelection), to_s(liveSearchString), find::backwards|find::ignore_case|find::ignore_whitespace)) + tmp.push_back(pair.first); [self setLiveSearchRanges:tmp]; if(!tmp.empty()) liveSearchAnchor = ng::move(document->buffer(), tmp, kSelectionMoveToBeginOfSelection); @@ -2957,8 +2957,8 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; AUTO_REFRESH; ng::ranges_t ranges = convert(document->buffer(), to_s(aSelectionString)); editor->set_selections(ranges); - iterate(range, ranges) - layout->remove_enclosing_folds(range->min().index, range->max().index); + for(auto const& range : ranges) + layout->remove_enclosing_folds(range.min().index, range.max().index); } - (NSString*)selectionString @@ -2969,17 +2969,17 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; - (void)updateSelection { text::selection_t ranges, withoutCarry; - citerate(range, editor->ranges()) + for(auto const& range : editor->ranges()) { - text::pos_t from = document->buffer().convert(range->first.index); - text::pos_t to = document->buffer().convert(range->last.index); - if(!range->freehanded && !range->columnar) - withoutCarry.push_back(text::range_t(from, to, range->columnar)); - from.offset = range->first.carry; - to.offset = range->last.carry; - if(range->freehanded || range->columnar) - withoutCarry.push_back(text::range_t(from, to, range->columnar)); - ranges.push_back(text::range_t(from, to, range->columnar)); + text::pos_t from = document->buffer().convert(range.first.index); + text::pos_t to = document->buffer().convert(range.last.index); + if(!range.freehanded && !range.columnar) + withoutCarry.push_back(text::range_t(from, to, range.columnar)); + from.offset = range.first.carry; + to.offset = range.last.carry; + if(range.freehanded || range.columnar) + withoutCarry.push_back(text::range_t(from, to, range.columnar)); + ranges.push_back(text::range_t(from, to, range.columnar)); } document->set_selection(ranges); @@ -3167,11 +3167,11 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; scope::context_t scope = [self scopeContext]; for(NSString* path in someFiles) { - citerate(item, bundles::drag_commands_for_path(to_s(path), scope)) + for(auto const& item : bundles::drag_commands_for_path(to_s(path), scope)) { - D(DBF_OakTextView_DragNDrop, bug("handler: %s\n", (*item)->full_name().c_str());); - handlerToFiles[(*item)->uuid()].push_back(to_s(path)); - allHandlers.insert(*item); + D(DBF_OakTextView_DragNDrop, bug("handler: %s\n", item->full_name().c_str());); + handlerToFiles[item->uuid()].push_back(to_s(path)); + allHandlers.insert(item); } } @@ -3257,8 +3257,8 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; - (BOOL)isPointInSelection:(NSPoint)aPoint { BOOL res = NO; - citerate(rect, layout->rects_for_ranges(editor->ranges(), kRectsIncludeSelections)) - res = res || CGRectContainsPoint(*rect, aPoint); + for(auto const& rect : layout->rects_for_ranges(editor->ranges(), kRectsIncludeSelections)) + res = res || CGRectContainsPoint(rect, aPoint); return res; } @@ -3441,10 +3441,10 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; { bool didToggle = false; ng::ranges_t newSel; - citerate(cur, s) + for(auto const& cur : s) { - if(*cur != range.last()) - newSel.push_back(*cur); + if(cur != range.last()) + newSel.push_back(cur); else didToggle = true; } s = newSel; @@ -3495,8 +3495,8 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; [image unlockFocus]; std::vector v; - iterate(range, ranges) - v.push_back(document->buffer().substr(range->min().index, range->max().index)); + for(auto const& range : ranges) + v.push_back(document->buffer().substr(range.min().index, range.max().index)); NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; [pboard declareTypes:@[ NSStringPboardType ] owner:self]; diff --git a/Frameworks/Preferences/src/BundlesPreferences.mm b/Frameworks/Preferences/src/BundlesPreferences.mm index b79be131..cb64fc98 100644 --- a/Frameworks/Preferences/src/BundlesPreferences.mm +++ b/Frameworks/Preferences/src/BundlesPreferences.mm @@ -91,8 +91,8 @@ static std::string textify (std::string str) NSMutableArray* res = [NSMutableArray array]; if(groupNumber == 0) { - iterate(category, categories) - [res addObject:[NSString stringWithCxxString:*category]]; + for(auto const& category : categories) + [res addObject:[NSString stringWithCxxString:category]]; } return res; } diff --git a/Frameworks/Preferences/src/FilesPreferences.mm b/Frameworks/Preferences/src/FilesPreferences.mm index 60638da9..e57c7e15 100644 --- a/Frameworks/Preferences/src/FilesPreferences.mm +++ b/Frameworks/Preferences/src/FilesPreferences.mm @@ -53,10 +53,10 @@ [unknownDocumentTypesMenu addItem:[NSMenuItem separatorItem]]; std::multimap grammars; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) { - if(!(*item)->hidden_from_user()) - grammars.emplace((*item)->name(), *item); + if(!item->hidden_from_user()) + grammars.emplace(item->name(), item); } if(!grammars.empty()) @@ -64,20 +64,20 @@ std::string const defaultNewFileType = settings_t::raw_get(kSettingsFileTypeKey, "attr.untitled"); std::string const defaultUnknownFileType = settings_t::raw_get(kSettingsFileTypeKey, "attr.file.unknown-type"); - iterate(pair, grammars) + for(auto const& pair : grammars) { - std::string const& fileType = pair->second->value_for_field(bundles::kFieldGrammarScope); + std::string const& fileType = pair.second->value_for_field(bundles::kFieldGrammarScope); if(fileType == NULL_STR) continue; - NSMenuItem* item = [newDocumentTypesMenu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:@selector(selectNewFileType:) keyEquivalent:@""]; + NSMenuItem* item = [newDocumentTypesMenu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:@selector(selectNewFileType:) keyEquivalent:@""]; [item setRepresentedObject:[NSString stringWithCxxString:fileType]]; [item setTarget:self]; if(fileType == defaultNewFileType) [newDocumentTypesPopUp selectItem:item]; - item = [unknownDocumentTypesMenu addItemWithTitle:[NSString stringWithCxxString:pair->first] action:@selector(selectUnknownFileType:) keyEquivalent:@""]; + item = [unknownDocumentTypesMenu addItemWithTitle:[NSString stringWithCxxString:pair.first] action:@selector(selectUnknownFileType:) keyEquivalent:@""]; [item setRepresentedObject:[NSString stringWithCxxString:fileType]]; [item setTarget:self]; diff --git a/Frameworks/SoftwareUpdate/src/sw_update.cc b/Frameworks/SoftwareUpdate/src/sw_update.cc index ccd3aaa3..2523906d 100644 --- a/Frameworks/SoftwareUpdate/src/sw_update.cc +++ b/Frameworks/SoftwareUpdate/src/sw_update.cc @@ -73,10 +73,10 @@ static bool rm_file (std::string const& path, AuthorizationRef& auth) static bool rm_dir (std::string const& path, AuthorizationRef& auth) { - citerate(it, path::entries(path)) + for(auto const& it : path::entries(path)) { - std::string const& newPath = path::join(path, (*it)->d_name); - if((*it)->d_type == DT_DIR) + std::string const& newPath = path::join(path, it->d_name); + if(it->d_type == DT_DIR) { if(!rm_dir(newPath, auth)) return false; diff --git a/Frameworks/authorization/src/connection.h b/Frameworks/authorization/src/connection.h index 489310bb..53f0488c 100644 --- a/Frameworks/authorization/src/connection.h +++ b/Frameworks/authorization/src/connection.h @@ -30,8 +30,8 @@ struct PUBLIC connection_t connection_t& operator<< (T const& container) { *this << container.size(); - iterate(value, container) - *this << *value; + for(auto const& value : container) + *this << value; return *this; } diff --git a/Frameworks/buffer/src/buffer.cc b/Frameworks/buffer/src/buffer.cc index 35e9a8c2..b0d0660b 100644 --- a/Frameworks/buffer/src/buffer.cc +++ b/Frameworks/buffer/src/buffer.cc @@ -162,8 +162,8 @@ namespace ng _hardlines.set(from + i, true); } - iterate(hook, _meta_data) - (*hook)->replace(this, from, to, str); + for(auto const& hook : _meta_data) + hook->replace(this, from, to, str); _callbacks(&callback_t::did_replace, from, to, str); return from + str.size(); diff --git a/Frameworks/buffer/src/buffer.h b/Frameworks/buffer/src/buffer.h index 4ce73e5e..c17d99b5 100644 --- a/Frameworks/buffer/src/buffer.h +++ b/Frameworks/buffer/src/buffer.h @@ -149,8 +149,8 @@ namespace ng private: void did_parse (size_t first, size_t last) { - iterate(hook, _meta_data) - (*hook)->did_parse(this, first, last); + for(auto const& hook : _meta_data) + hook->did_parse(this, first, last); _callbacks(&callback_t::did_parse, first, last); } diff --git a/Frameworks/buffer/src/marks.cc b/Frameworks/buffer/src/marks.cc index c50662c2..e51cb16b 100644 --- a/Frameworks/buffer/src/marks.cc +++ b/Frameworks/buffer/src/marks.cc @@ -5,13 +5,13 @@ namespace ng { void marks_t::replace (buffer_t* buffer, size_t from, size_t to, std::string const& str) { - iterate(m, _marks) + for(auto& m : _marks) { - tree_t::iterator it = m->second.upper_bound(to); - std::string preserveMark = it != m->second.begin() && from < (--it)->first && it->first <= to ? it->second : NULL_STR; - m->second.replace(from, to, str.size(), false); + tree_t::iterator it = m.second.upper_bound(to); + std::string preserveMark = it != m.second.begin() && from < (--it)->first && it->first <= to ? it->second : NULL_STR; + m.second.replace(from, to, str.size(), false); if(preserveMark != NULL_STR) - m->second.set(from + str.size(), preserveMark); + m.second.set(from + str.size(), preserveMark); } } @@ -74,9 +74,9 @@ namespace ng if(markType == NULL_STR) { - iterate(m, _marks) + for(auto const& m : _marks) { - foreach(it, m->second.lower_bound(from), m->second.upper_bound(to)) + foreach(it, m.second.lower_bound(from), m.second.upper_bound(to)) res[it->first - from] = it->second; } } diff --git a/Frameworks/buffer/src/pairs.cc b/Frameworks/buffer/src/pairs.cc index 980a4065..46314925 100644 --- a/Frameworks/buffer/src/pairs.cc +++ b/Frameworks/buffer/src/pairs.cc @@ -24,14 +24,14 @@ namespace ng if(!ranksToRemove.empty()) { std::set indicesToRemove; - iterate(it, _pairs) + for(auto const& it : _pairs) { - if(ranksToRemove.find(it->second) != ranksToRemove.end()) - indicesToRemove.insert(it->first); + if(ranksToRemove.find(it.second) != ranksToRemove.end()) + indicesToRemove.insert(it.first); } - iterate(index, indicesToRemove) - _pairs.remove(*index); + for(auto const& index : indicesToRemove) + _pairs.remove(index); } } _pairs.replace(from, to, str.size()); @@ -72,11 +72,11 @@ namespace ng ASSERT(_pairs.find(index) != _pairs.end()); size_t rank = _pairs.find(index)->second; D(DBF_Buffer_Pairs, bug("%zu, rank %zu\n", index, rank);); - iterate(it, _pairs) + for(auto const& it : _pairs) { - D(DBF_Buffer_Pairs, bug("%zd, rank %zu → %s\n", it->first, it->second, BSTR((it->second & ~1) == (rank & ~1) && it->second != rank));); - if((it->second & ~1) == (rank & ~1) && it->second != rank) - return it->first; + D(DBF_Buffer_Pairs, bug("%zd, rank %zu → %s\n", it.first, it.second, BSTR((it.second & ~1) == (rank & ~1) && it.second != rank));); + if((it.second & ~1) == (rank & ~1) && it.second != rank) + return it.first; } ASSERT(false); return index; diff --git a/Frameworks/buffer/src/parsing.cc b/Frameworks/buffer/src/parsing.cc index 1d1b659e..f9f39435 100644 --- a/Frameworks/buffer/src/parsing.cc +++ b/Frameworks/buffer/src/parsing.cc @@ -105,10 +105,10 @@ namespace ng D(DBF_Buffer_Parsing, bug("did parse %zu-%zu (revision %zu), at EOL %s\n", range.first, range.second, revision(), BSTR(atEOF));); _scopes.remove(_scopes.lower_bound(range.first), atEOF ? _scopes.end() : _scopes.lower_bound(range.second)); - iterate(pair, newScopes) + for(auto const& pair : newScopes) { - if(range.first + pair->first < range.second || atEOF) - _scopes.set(range.first + pair->first, pair->second); + if(range.first + pair.first < range.second || atEOF) + _scopes.set(range.first + pair.first, pair.second); } _dirty.remove(_dirty.lower_bound(range.first), atEOF ? _dirty.end() : _dirty.lower_bound(range.second)); diff --git a/Frameworks/buffer/src/spelling.cc b/Frameworks/buffer/src/spelling.cc index 0ad1c34e..f459ad37 100644 --- a/Frameworks/buffer/src/spelling.cc +++ b/Frameworks/buffer/src/spelling.cc @@ -73,15 +73,15 @@ namespace ng if(fromIter != toIter && fromIter->first >= to && fromIter->second) fromIter = toIter; _misspellings.remove(fromIter, toIter); - iterate(r, ranges) + for(auto const& r : ranges) { - std::string const& text = buffer->substr(r->first, r->second); + std::string const& text = buffer->substr(r.first, r.second); D(DBF_Buffer_Spelling, bug("check: ‘%s’ (%s)\n", text.c_str(), buffer->spelling_language().c_str());); - citerate(range, ns::spellcheck(text.data(), text.data() + text.size(), buffer->spelling_language(), buffer->spelling_tag())) + for(auto const& range : ns::spellcheck(text.data(), text.data() + text.size(), buffer->spelling_language(), buffer->spelling_tag())) { - _misspellings.set(r->first + range->first, true); - _misspellings.set(r->first + range->last, false); - D(DBF_Buffer_Spelling, bug("bad: ‘%s’\n", text.substr(range->first, range->last - range->first).c_str());); + _misspellings.set(r.first + range.first, true); + _misspellings.set(r.first + range.last, false); + D(DBF_Buffer_Spelling, bug("bad: ‘%s’\n", text.substr(range.first, range.last - range.first).c_str());); } } } diff --git a/Frameworks/buffer/src/symbols.cc b/Frameworks/buffer/src/symbols.cc index 87a81f1c..484fd0f3 100644 --- a/Frameworks/buffer/src/symbols.cc +++ b/Frameworks/buffer/src/symbols.cc @@ -69,8 +69,8 @@ namespace { static regexp::pattern_t newline("\n"); std::string res = replace(str, newline, format_string::format_string_t(" ")); - iterate(it, records) - res = replace(res, it->regexp, it->format, it->repeat); + for(auto const& it : records) + res = replace(res, it.regexp, it.format, it.repeat); res = replace(res, newline, format_string::format_string_t("↵")); return res; @@ -106,13 +106,13 @@ namespace ng all_scopes.insert(all_scopes.end(), it->second); std::map transforms; - iterate(it, all_scopes) + for(auto const& it : all_scopes) { - if(plist::is_true(bundles::value_for_setting("showInSymbolList", *it))) + if(plist::is_true(bundles::value_for_setting("showInSymbolList", it))) { - plist::any_t const& symbolTransformationValue = bundles::value_for_setting("symbolTransformation", *it); + plist::any_t const& symbolTransformationValue = bundles::value_for_setting("symbolTransformation", it); std::string const* symbolTransformation = boost::get(&symbolTransformationValue); - transforms.emplace(*it, transform_t(symbolTransformation ? *symbolTransformation : "")); + transforms.emplace(it, transform_t(symbolTransformation ? *symbolTransformation : "")); } } @@ -143,8 +143,8 @@ namespace ng std::map symbols_t::symbols (buffer_t const* buffer) const { std::map res; - iterate(it, _symbols) - res.insert(*it); + for(auto const& it : _symbols) + res.insert(it); return res; } diff --git a/Frameworks/buffer/tests/t_indexed_map.cc b/Frameworks/buffer/tests/t_indexed_map.cc index 2fdf524a..a8832c3b 100644 --- a/Frameworks/buffer/tests/t_indexed_map.cc +++ b/Frameworks/buffer/tests/t_indexed_map.cc @@ -32,8 +32,8 @@ template std::vector< std::pair > expected (value_pair(&array)[N]) { std::vector< std::pair > res; - iterate(pair, array) - res.push_back(std::make_pair(pair->first, pair->second)); + for(auto const& pair : array) + res.push_back(std::make_pair(pair.first, pair.second)); return res; } @@ -47,8 +47,8 @@ void test_basic () std::vector keys(tmp.begin(), tmp.end()); std::random_shuffle(keys.begin(), keys.end()); - iterate(key, keys) - map.set(*key, true); + for(auto const& key : keys) + map.set(key, true); std::vector sorted; std::transform(map.begin(), map.end(), back_inserter(sorted), [](std::pair const& p){ return p.first; }); @@ -62,8 +62,8 @@ void test_basic () tmp.erase(keys[i]); sorted.clear(); - iterate(pair, map) - sorted.push_back(pair->first); + for(auto const& pair : map) + sorted.push_back(pair.first); OAK_ASSERT_EQ(tmp.size(), sorted.size()); OAK_ASSERT(std::equal(tmp.begin(), tmp.end(), sorted.begin())); } @@ -71,14 +71,14 @@ void test_basic () std::sort(keys.begin(), keys.end()); sorted.clear(); - iterate(pair, map) - sorted.push_back(pair->first); + for(auto const& pair : map) + sorted.push_back(pair.first); OAK_ASSERT_EQ(keys.size(), sorted.size()); OAK_ASSERT(std::equal(keys.begin(), keys.end(), sorted.begin())); std::random_shuffle(sorted.begin(), sorted.end()); - iterate(key, sorted) - map.remove(*key); + for(auto const& key : sorted) + map.remove(key); OAK_ASSERT(map.empty()); } @@ -90,8 +90,8 @@ void test_child_count () std::next_permutation(keys.begin(), keys.end()); indexed_map_t map; - iterate(key, keys) - map.set(*key, true); + for(auto const& key : keys) + map.set(key, true); OAK_ASSERT_EQ(map.size(), 5); @@ -143,8 +143,8 @@ void test_find () std::next_permutation(keys.begin(), keys.end()); indexed_map_t map; - iterate(key, TestKeys) - map.set(*key, true); + for(auto const& key : TestKeys) + map.set(key, true); OAK_ASSERT_EQ(map.find(10-1).index(), 5); OAK_ASSERT_EQ(map.find(20-1).index(), 5); @@ -175,8 +175,8 @@ void test_lower_bound () std::next_permutation(keys.begin(), keys.end()); indexed_map_t map; - iterate(key, TestKeys) - map.set(*key, true); + for(auto const& key : TestKeys) + map.set(key, true); OAK_ASSERT_EQ(map.lower_bound(10-1).index(), 0); OAK_ASSERT_EQ(map.lower_bound(20-1).index(), 1); @@ -207,8 +207,8 @@ void test_upper_bound () std::next_permutation(keys.begin(), keys.end()); indexed_map_t map; - iterate(key, TestKeys) - map.set(*key, true); + for(auto const& key : TestKeys) + map.set(key, true); OAK_ASSERT_EQ(map.upper_bound(10-1).index(), 0); OAK_ASSERT_EQ(map.upper_bound(20-1).index(), 1); @@ -248,19 +248,19 @@ void test_preserve () void test_bind_right () { - iterate(row, TestKeys) + for(auto const& row : TestKeys) { - std::vector keys(std::begin(*row), std::end(*row)); + std::vector keys(std::begin(row), std::end(row)); do { indexed_map_t map; ssize_t pivot = 30, pad = 5; std::vector expected, actual; - iterate(key, keys) + for(auto const& key : keys) { - map.set(*key, true); - expected.push_back(*key < pivot ? *key : *key + pad); + map.set(key, true); + expected.push_back(key < pivot ? key : key + pad); } map.replace(pivot, pivot, pad, true /* bindRight */); @@ -271,25 +271,25 @@ void test_bind_right () std::next_permutation(keys.begin(), keys.end()); - } while(!std::equal(keys.begin(), keys.end(), std::begin(*row))); + } while(!std::equal(keys.begin(), keys.end(), std::begin(row))); } } void test_bind_left () { - iterate(row, TestKeys) + for(auto const& row : TestKeys) { - std::vector keys(std::begin(*row), std::end(*row)); + std::vector keys(std::begin(row), std::end(row)); do { indexed_map_t map; ssize_t pivot = 30, pad = 5; std::vector expected, actual; - iterate(key, keys) + for(auto const& key : keys) { - map.set(*key, true); - expected.push_back(*key <= pivot ? *key : *key + pad); + map.set(key, true); + expected.push_back(key <= pivot ? key : key + pad); } map.replace(pivot, pivot, pad, false /* bindRight */); @@ -300,7 +300,7 @@ void test_bind_left () std::next_permutation(keys.begin(), keys.end()); - } while(!std::equal(keys.begin(), keys.end(), std::begin(*row))); + } while(!std::equal(keys.begin(), keys.end(), std::begin(row))); } } diff --git a/Frameworks/bundles/src/item.cc b/Frameworks/bundles/src/item.cc index aa5bf7e6..ae475091 100644 --- a/Frameworks/bundles/src/item.cc +++ b/Frameworks/bundles/src/item.cc @@ -92,9 +92,9 @@ namespace bundles { if(plist::array_t const* array = boost::get(&pair.second)) { - iterate(any, *array) + for(auto const& any : *array) { - if(std::string const* str = boost::get(&*any)) + if(std::string const* str = boost::get(&any)) _fields.emplace(pair.first, *str); } } @@ -104,14 +104,14 @@ namespace bundles // initialize from a tmSettings file if(plist::dictionary_t const* dictionary = boost::get(&pair.second)) { - iterate(dictPair, *dictionary) - _fields.emplace(pair.first, dictPair->first); + for(auto const& dictPair : *dictionary) + _fields.emplace(pair.first, dictPair.first); } else if(plist::array_t const* array = boost::get(&pair.second)) { - iterate(any, *array) // initialize from cache + for(auto const& any : *array) // initialize from cache { - if(std::string const* str = boost::get(&*any)) + if(std::string const* str = boost::get(&any)) _fields.emplace(pair.first, *str); } } @@ -203,9 +203,9 @@ namespace bundles if(_kind != kItemTypeBundle) return bundle()->support_path(); - iterate(path, _paths) + for(auto const& path : _paths) { - std::string supportPath = path::join(*path, "../Support"); + std::string supportPath = path::join(path, "../Support"); if(path::exists(supportPath)) return supportPath; } @@ -254,8 +254,8 @@ namespace bundles default: { std::vector plists; - iterate(path, _paths) - plists.push_back(plist::load(*path)); + for(auto const& path : _paths) + plists.push_back(plist::load(path)); _plist = std::make_shared(plist::merge_delta(plists)); } break; diff --git a/Frameworks/bundles/src/query.cc b/Frameworks/bundles/src/query.cc index ee6d5558..feec41f4 100644 --- a/Frameworks/bundles/src/query.cc +++ b/Frameworks/bundles/src/query.cc @@ -34,12 +34,12 @@ namespace bundles return it->second; std::multimap& res = _cache[field]; - iterate(item, AllItems) + for(auto const& item : AllItems) { - if(is_deleted(*item) || is_disabled(*item)) + if(is_deleted(item) || is_disabled(item)) continue; - citerate(value, (*item)->values_for_field(field)) - res.emplace(*value, *item); + for(auto const& value : item->values_for_field(field)) + res.emplace(value, item); } return res; } @@ -49,27 +49,27 @@ namespace bundles if(_menus.empty()) { std::map< item_ptr, std::map > map; // bundle → { item_uuid → bundle_item } - iterate(item, AllItems) + for(auto const& item : AllItems) { - if((*item)->bundle()) - map[(*item)->bundle()].emplace((*item)->uuid(), *item); + if(item->bundle()) + map[item->bundle()].emplace(item->uuid(), item); } - iterate(bundle, map) + for(auto const& bundle : map) { std::set didInclude; - setup_menu(bundle->first, bundle->second, AllMenus, _menus, didInclude); + setup_menu(bundle.first, bundle.second, AllMenus, _menus, didInclude); std::multimap leftOut; - iterate(pair, bundle->second) + for(auto const& pair : bundle.second) { - item_ptr item = pair->second; + item_ptr item = pair.second; if((item->kind() & kItemTypeMenuTypes) && !item->hidden_from_user() && didInclude.find(item) == didInclude.end()) leftOut.emplace(item->name(), item); } if(!leftOut.empty()) - std::transform(leftOut.begin(), leftOut.end(), back_inserter(_menus[bundle->first->uuid()]), [](std::pair const& p){ return p.second; }); + std::transform(leftOut.begin(), leftOut.end(), back_inserter(_menus[bundle.first->uuid()]), [](std::pair const& p){ return p.second; }); } } @@ -97,9 +97,9 @@ namespace bundles if(menu != menus.end()) { std::vector& resolved = res[menuItem->uuid()]; - iterate(itemUUID, menu->second) + for(auto const& itemUUID : menu->second) { - std::map::const_iterator item = items.find(*itemUUID); + std::map::const_iterator item = items.find(itemUUID); if(item != items.end()) { didInclude.insert(item->second); @@ -109,7 +109,7 @@ namespace bundles if(item->second->kind() == kItemTypeMenu) setup_menu(item->second, items, menus, res, didInclude); } - else if(*itemUUID == item_t::menu_item_separator()->uuid()) + else if(itemUUID == item_t::menu_item_separator()->uuid()) { resolved.push_back(item_t::menu_item_separator()); } @@ -134,9 +134,9 @@ namespace bundles std::map< oak::uuid_t, std::vector >::const_iterator menu = menus.find(menuUUID); if(menu != menus.end()) { - iterate(uuid, menu->second) + for(auto const& uuid : menu->second) { - std::map::const_iterator item = items.find(*uuid); + std::map::const_iterator item = items.find(uuid); if(item == items.end()) continue; @@ -156,20 +156,20 @@ namespace bundles cache().clear(); std::map< item_ptr, std::map > map; // bundle → { item_uuid → bundle_item } - iterate(item, items) + for(auto const& item : items) { - if((*item)->bundle()) - map[(*item)->bundle()].emplace((*item)->uuid(), *item); + if(item->bundle()) + map[item->bundle()].emplace(item->uuid(), item); } - iterate(bundle, map) - setup_full_name(bundle->first->uuid(), menus, bundle->second, "", " — " + bundle->first->name()); + for(auto const& bundle : map) + setup_full_name(bundle.first->uuid(), menus, bundle.second, "", " — " + bundle.first->name()); Callbacks(&callback_t::bundles_did_change); bool res = true; - iterate(item, AllItems) - res = res && *item; + for(auto const& item : AllItems) + res = res && item; return res; } @@ -207,10 +207,10 @@ namespace bundles std::string actionClass; if(plist::get_key_path(item->plist(), "content", actionClass)) { - citerate(aClass, text::split(actionClass, "||")) + for(auto const& aClass : text::split(actionClass, "||")) { size_t oldSize = ordered.size(); - search(kFieldSemanticClass, text::trim(*aClass), scope, kind, bundle, includeDisabledItems, ordered); + search(kFieldSemanticClass, text::trim(aClass), scope, kind, bundle, includeDisabledItems, ordered); if(ordered.size() != oldSize) break; } @@ -235,17 +235,17 @@ namespace bundles static void linear_search (std::string const& field, std::string const& value, scope::context_t const& scope, int kind, oak::uuid_t const& bundle, bool includeDisabledItems, std::multimap& ordered) { - iterate(item, AllItems) + for(auto const& item : AllItems) { - if(is_deleted(*item) || !includeDisabledItems && is_disabled(*item)) + if(is_deleted(item) || !includeDisabledItems && is_disabled(item)) continue; double rank = 1.0; - if((*item)->does_match(field, value, scope, kind, bundle, &rank)) + if(item->does_match(field, value, scope, kind, bundle, &rank)) { - if((*item)->kind() == kItemTypeProxy) - resolve_proxy(*item, scope, kind, bundle, includeDisabledItems, ordered); - else ordered.emplace(rank, *item); + if(item->kind() == kItemTypeProxy) + resolve_proxy(item, scope, kind, bundle, includeDisabledItems, ordered); + else ordered.emplace(rank, item); } } } @@ -274,9 +274,9 @@ namespace bundles std::string actionClass; if(plist::get_key_path(proxyItem->plist(), "content", actionClass)) { - citerate(aClass, text::split(actionClass, "||")) + for(auto const& aClass : text::split(actionClass, "||")) { - auto const res = query(kFieldSemanticClass, text::trim(*aClass), scope, kind, bundle, filter, includeDisabledItems); + auto const res = query(kFieldSemanticClass, text::trim(aClass), scope, kind, bundle, filter, includeDisabledItems); if(!res.empty()) return res; } @@ -286,10 +286,10 @@ namespace bundles item_ptr lookup (oak::uuid_t const& uuid) { - iterate(item, AllItems) + for(auto const& item : AllItems) { - if((*item)->uuid() == uuid) - return *item; + if(item->uuid() == uuid) + return item; } return item_ptr(); } @@ -298,11 +298,11 @@ namespace bundles { std::lock_guard lock(cache().mutex()); std::vector res; - iterate(item, cache().menu(_uuid)) + for(auto const& item : cache().menu(_uuid)) { - if(is_deleted(*item) || !includeDisabledItems && is_disabled(*item)) + if(is_deleted(item) || !includeDisabledItems && is_disabled(item)) continue; - res.push_back(*item); + res.push_back(item); } return res; } @@ -345,16 +345,16 @@ namespace bundles if(sClass == NULL_STR) return res; - iterate(proxyItem, AllItems) + for(auto const& proxyItem : AllItems) { - if((*proxyItem)->kind() != kItemTypeProxy) + if(proxyItem->kind() != kItemTypeProxy) continue; std::string actionClass; - if(plist::get_key_path((*proxyItem)->plist(), "content", actionClass)) + if(plist::get_key_path(proxyItem->plist(), "content", actionClass)) { if(sClass.find(actionClass) == 0) - return key_equivalent(*proxyItem); + return key_equivalent(proxyItem); } } diff --git a/Frameworks/bundles/src/wrappers.cc b/Frameworks/bundles/src/wrappers.cc index c7917a32..f54c9cb4 100644 --- a/Frameworks/bundles/src/wrappers.cc +++ b/Frameworks/bundles/src/wrappers.cc @@ -19,9 +19,9 @@ namespace bundles static std::vector convert_locations (plist::array_t const& array) { std::vector res; - iterate(it, array) + for(auto const& it : array) { - if(std::string const* str = boost::get(&*it)) + if(std::string const* str = boost::get(&it)) res.push_back(*str); } return res; @@ -67,8 +67,8 @@ namespace bundles else { fprintf(stderr, "no PATH!!!\n"); - iterate(pair, environment) - fprintf(stderr, "%s = %s\n", pair->first.c_str(), pair->second.c_str()); + for(auto const& pair : environment) + fprintf(stderr, "%s = %s\n", pair.first.c_str(), pair.second.c_str()); } return res; } @@ -115,11 +115,11 @@ namespace bundles plist::get_key_path(item->plist(), "settings.shellVariables", variables); std::vector< std::pair > res; - iterate(it, variables) + for(auto const& it : variables) { bool disabled; std::string key, value; - if(!(plist::get_key_path(*it, "disabled", disabled) && disabled) && plist::get_key_path(*it, "name", key) && plist::get_key_path(*it, "value", value)) + if(!(plist::get_key_path(it, "disabled", disabled) && disabled) && plist::get_key_path(it, "name", key) && plist::get_key_path(it, "value", value)) res.push_back(std::make_pair(key, value)); } return res; @@ -155,8 +155,8 @@ namespace bundles std::vector tmp; std::set_difference(shouldUnset.begin(), shouldUnset.end(), didSet.begin(), didSet.end(), back_inserter(tmp)); - iterate(key, tmp) - res.erase(*key); + for(auto const& key : tmp) + res.erase(key); return res; } @@ -167,13 +167,13 @@ namespace bundles plist::any_t value_for_setting (std::string const& setting, scope::context_t const& scope, item_ptr* match) { - citerate(item, query(kFieldSettingName, setting, scope, kItemTypeSettings)) + for(auto const& item : query(kFieldSettingName, setting, scope, kItemTypeSettings)) { plist::any_t res; - if(plist::get_key_path((*item)->plist(), "settings." + setting, res)) + if(plist::get_key_path(item->plist(), "settings." + setting, res)) { if(match) - *match = *item; + *match = item; return res; } } @@ -199,12 +199,12 @@ namespace bundles std::vector grammars_for_path (std::string const& path) { std::multimap ordering; - citerate(item, query(kFieldAny, NULL_STR, scope::wildcard, kItemTypeGrammar)) + for(auto const& item : query(kFieldAny, NULL_STR, scope::wildcard, kItemTypeGrammar)) { - citerate(ext, (*item)->values_for_field(kFieldGrammarExtension)) + for(auto const& ext : item->values_for_field(kFieldGrammarExtension)) { - if(ssize_t rank = path::rank(path, *ext)) - ordering.emplace(rank, *item); + if(ssize_t rank = path::rank(path, ext)) + ordering.emplace(rank, item); } } return ordering.empty() ? std::vector() : std::vector(1, ordering.begin()->second); diff --git a/Frameworks/cf/src/cf.h b/Frameworks/cf/src/cf.h index d29d7340..af5c3fa2 100644 --- a/Frameworks/cf/src/cf.h +++ b/Frameworks/cf/src/cf.h @@ -40,8 +40,8 @@ namespace cf array_t (std::vector const& v) { CFMutableArrayRef value = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - iterate(it, v) - CFArrayAppendValue(value, cf::wrap(*it)); + for(auto const& it : v) + CFArrayAppendValue(value, cf::wrap(it)); array.reset(value, CFRelease); } operator CFArrayRef () const { return array.get(); } @@ -58,8 +58,8 @@ namespace cf dictionary_t (std::map const& map) { CFMutableDictionaryRef value = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - iterate(it, map) - CFDictionaryAddValue(value, cf::wrap(it->first).get(), cf::wrap(it->second).get()); + for(auto const& it : map) + CFDictionaryAddValue(value, cf::wrap(it.first).get(), cf::wrap(it.second).get()); dictionary.reset(value, CFRelease); } operator CFDictionaryRef () const { return dictionary.get(); } @@ -76,8 +76,8 @@ namespace cf set_t (std::set const& v) { CFMutableSetRef value = CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks); - iterate(it, v) - CFSetAddValue(value, cf::wrap(*it)); + for(auto const& it : v) + CFSetAddValue(value, cf::wrap(it)); set.reset(value, CFRelease); } operator CFSetRef () const { return set.get(); } diff --git a/Frameworks/cf/src/cgrect.h b/Frameworks/cf/src/cgrect.h index 6df34cd3..f84d726c 100644 --- a/Frameworks/cf/src/cgrect.h +++ b/Frameworks/cf/src/cgrect.h @@ -52,14 +52,14 @@ _OutputIter OakRectDifference (CGRect const& r, CGRect s, _OutputIter out) template _OutputIter OakRectDifference (std::vector const& rList, std::vector const& sList, _OutputIter out) { - iterate(r, rList) + for(auto const& r : rList) { - std::vector tList(1, *r); - iterate(s, sList) + std::vector tList(1, r); + for(auto const& s : sList) { std::vector tmp; - iterate(t, tList) - OakRectDifference(*t, *s, back_inserter(tmp)); + for(auto const& t : tList) + OakRectDifference(t, s, back_inserter(tmp)); tList.swap(tmp); } out = std::copy(tList.begin(), tList.end(), out); diff --git a/Frameworks/cf/tests/t_rect.cc b/Frameworks/cf/tests/t_rect.cc index 48f21b59..49ef37c2 100644 --- a/Frameworks/cf/tests/t_rect.cc +++ b/Frameworks/cf/tests/t_rect.cc @@ -13,8 +13,8 @@ static void set (std::vector& canvas, CGRect const& r, char m = 'x' static std::string to_str (std::vector const& rList) { std::vector canvas(3, "..."); - iterate(r, rList) - set(canvas, *r); + for(auto const& r : rList) + set(canvas, r); return text::join(canvas, ""); } diff --git a/Frameworks/command/src/process.cc b/Frameworks/command/src/process.cc index 717d164c..a0ee3b93 100644 --- a/Frameworks/command/src/process.cc +++ b/Frameworks/command/src/process.cc @@ -50,8 +50,8 @@ namespace command { ~cleanup_server_t () { - iterate(path, _paths) - unlink(path->c_str()); + for(auto const& path : _paths) + unlink(path.c_str()); } void insert (std::string const& path) { _paths.insert(path); } @@ -95,10 +95,10 @@ namespace command pid_t process_t::launch () { - iterate(it, environment) + for(auto const& it : environment) { - if(it->first.size() + it->second.size() + 2 >= ARG_MAX) - fprintf(stderr, "*** variable exceeds ARG_MAX: %s\n", it->first.c_str()); + if(it.first.size() + it.second.size() + 2 >= ARG_MAX) + fprintf(stderr, "*** variable exceeds ARG_MAX: %s\n", it.first.c_str()); } ASSERT(command.find("#!") == 0); @@ -228,11 +228,11 @@ namespace command tmp.swap(process_exit); pthread_mutex_unlock(&process_exit_mutex); - iterate(it, tmp) + for(auto const& it : tmp) { - std::map::iterator client = client_to_callback.find(it->client_key); + std::map::iterator client = client_to_callback.find(it.client_key); if(client != client_to_callback.end()) - client->second->did_exit(it->return_code); + client->second->did_exit(it.return_code); } } diff --git a/Frameworks/command/src/reader.cc b/Frameworks/command/src/reader.cc index c6380e44..bcaea9cf 100644 --- a/Frameworks/command/src/reader.cc +++ b/Frameworks/command/src/reader.cc @@ -110,18 +110,18 @@ namespace command data_received.swap(tmp); pthread_mutex_unlock(&data_received_mutex); - iterate(it, tmp) + for(auto const& it : tmp) { - // required check as we may receive a post-EOF “bytes available” with ‘it->length == 0’ - if(clients_consumed_eof.find(it->client_key) == clients_consumed_eof.end()) + // required check as we may receive a post-EOF “bytes available” with ‘it.length == 0’ + if(clients_consumed_eof.find(it.client_key) == clients_consumed_eof.end()) { - std::map::iterator client = client_to_callback.find(it->client_key); + std::map::iterator client = client_to_callback.find(it.client_key); if(client != client_to_callback.end()) - client->second->receive_data(it->bytes, it->length); - if(it->length == 0) - clients_consumed_eof.insert(it->client_key); + client->second->receive_data(it.bytes, it.length); + if(it.length == 0) + clients_consumed_eof.insert(it.client_key); } - delete it->bytes; + delete it.bytes; } } diff --git a/Frameworks/document/src/document.cc b/Frameworks/document/src/document.cc index 947163d3..afbb1521 100644 --- a/Frameworks/document/src/document.cc +++ b/Frameworks/document/src/document.cc @@ -106,9 +106,9 @@ static std::multimap parse_marks (s plist::any_t const& plist = plist::parse(str); if(plist::array_t const* array = boost::get(&plist)) { - iterate(bm, *array) + for(auto const& bm : *array) { - if(std::string const* str = boost::get(&*bm)) + if(std::string const* str = boost::get(&bm)) marks.emplace(*str, "bookmark"); } } @@ -466,9 +466,9 @@ namespace document if(plist::get_key_path(plist, "paths", paths)) { oak::date_t t = oak::date_t::now(); - iterate(path, paths) + for(auto const& path : paths) { - if(std::string const* str = boost::get(&*path)) + if(std::string const* str = boost::get(&path)) map.emplace(*str, t - (1.0 + map.size())); } } @@ -478,8 +478,8 @@ namespace document void save () const { std::map sorted; - iterate(item, map) - sorted.emplace(item->second, item->first); + for(auto const& item : map) + sorted.emplace(item.second, item.first); std::map< std::string, std::vector > plist; std::vector& paths = plist["paths"]; @@ -605,9 +605,9 @@ namespace document D(DBF_Document, bug("%s, %s\n", display_name().c_str(), _file_type.c_str());); if(_file_type != NULL_STR) { - citerate(item, bundles::query(bundles::kFieldGrammarScope, _file_type, scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, _file_type, scope::wildcard, bundles::kItemTypeGrammar)) { - _buffer->set_grammar(*item); + _buffer->set_grammar(item); break; } } @@ -1248,8 +1248,8 @@ namespace document static void copy_marks (ng::buffer_t& buf, std::multimap const& marks) { - iterate(pair, marks) - buf.set_mark(cap(buf, pair->first.from).index, pair->second.type); + for(auto const& pair : marks) + buf.set_mark(cap(buf, pair.first.from).index, pair.second.type); } void document_t::setup_marks (std::string const& src, ng::buffer_t& buf) const @@ -1270,8 +1270,8 @@ namespace document if(_buffer) { std::multimap res; - citerate(pair, _buffer->get_marks(0, _buffer->size())) - res.emplace(_buffer->convert(pair->first), pair->second); + for(auto const& pair : _buffer->get_marks(0, _buffer->size())) + res.emplace(_buffer->convert(pair.first), pair.second); return res; } return document::marks.get(_path); @@ -1304,10 +1304,10 @@ namespace document std::multimap newMarks; if(typeToClear != NULL_STR) { - iterate(it, _marks) + for(auto const& it : _marks) { - if(it->second.type != typeToClear) - newMarks.insert(*it); + if(it.second.type != typeToClear) + newMarks.insert(it); } } @@ -1321,19 +1321,19 @@ namespace document std::vector v; if(_buffer) { - citerate(pair, _buffer->get_marks(0, _buffer->size())) + for(auto const& pair : _buffer->get_marks(0, _buffer->size())) { - if(pair->second == "bookmark") - v.push_back(text::format("'%s'", std::string(_buffer->convert(pair->first)).c_str())); + if(pair.second == "bookmark") + v.push_back(text::format("'%s'", std::string(_buffer->convert(pair.first)).c_str())); } } else { load_marks(_path); - iterate(mark, _marks) + for(auto const& mark : _marks) { - if(mark->second.type == "bookmark") - v.push_back(text::format("'%s'", std::string(mark->first).c_str())); + if(mark.second.type == "bookmark") + v.push_back(text::format("'%s'", std::string(mark.first).c_str())); } } return v.empty() ? NULL_STR : "( " + text::join(v, ", ") + " )"; @@ -1351,8 +1351,8 @@ namespace document _buffer->wait_for_repair(); std::map res; - citerate(pair, _buffer->symbols()) - res.emplace(_buffer->convert(pair->first), pair->second); + for(auto const& pair : _buffer->symbols()) + res.emplace(_buffer->convert(pair.first), pair.second); return res; } @@ -1443,31 +1443,31 @@ namespace document std::vector newDirs; std::multimap files; - citerate(it, path::entries(dir)) + for(auto const& it : path::entries(dir)) { if(should_stop_flag) return; - std::string const& path = path::join(dir, (*it)->d_name); - if((*it)->d_type == DT_DIR) + std::string const& path = path::join(dir, it->d_name); + if(it->d_type == DT_DIR) { if(glob.exclude(path, path::kPathItemDirectory)) continue; - if(seen_paths.emplace(buf.st_dev, (*it)->d_ino).second) + if(seen_paths.emplace(buf.st_dev, it->d_ino).second) newDirs.push_back(path); else D(DBF_Document_Scanner, bug("skip known path: ‘%s’\n", path.c_str());); } - else if((*it)->d_type == DT_REG) + else if(it->d_type == DT_REG) { if(glob.exclude(path, path::kPathItemFile)) continue; - if(seen_paths.emplace(buf.st_dev, (*it)->d_ino).second) - files.emplace(path, inode_t(buf.st_dev, (*it)->d_ino, path)); + if(seen_paths.emplace(buf.st_dev, it->d_ino).second) + files.emplace(path, inode_t(buf.st_dev, it->d_ino, path)); else D(DBF_Document_Scanner, bug("skip known path: ‘%s’\n", path.c_str());); } - else if((*it)->d_type == DT_LNK) + else if(it->d_type == DT_LNK) { links.push_back(path); // handle later since link may point to another device plus if link is “local” and will be seen later, we reported the local path rather than this link } @@ -1478,9 +1478,9 @@ namespace document if(dirs.empty()) { - iterate(link, links) + for(auto const& link : links) { - std::string path = path::resolve(*link); + std::string path = path::resolve(link); if(lstat(path.c_str(), &buf) != -1) { if(S_ISDIR(buf.st_mode) && follow_links && seen_paths.emplace(buf.st_dev, buf.st_ino).second) @@ -1488,7 +1488,7 @@ namespace document if(glob.exclude(path, path::kPathItemDirectory)) continue; - D(DBF_Document_Scanner, bug("follow link: %s → %s\n", link->c_str(), path.c_str());); + D(DBF_Document_Scanner, bug("follow link: %s → %s\n", link.c_str(), path.c_str());); dirs.push_back(path); } else if(S_ISREG(buf.st_mode)) @@ -1503,15 +1503,15 @@ namespace document } else { - perror(text::format("lstat(“%s” → “%s”))", link->c_str(), path.c_str()).c_str()); + perror(text::format("lstat(“%s” → “%s”))", link.c_str(), path.c_str()).c_str()); } } links.clear(); } pthread_mutex_lock(&mutex); - iterate(file, files) - documents.push_back(document::create(file->first, file->second)); + for(auto const& file : files) + documents.push_back(document::create(file.first, file.second)); pthread_mutex_unlock(&mutex); } } diff --git a/Frameworks/document/src/document.h b/Frameworks/document/src/document.h index 98281975..4c3b115f 100644 --- a/Frameworks/document/src/document.h +++ b/Frameworks/document/src/document.h @@ -190,8 +190,8 @@ namespace document document::document_ptr doc = _document; _document->post_load(path, content, attributes, fileType, encoding); - iterate(cb, callbacks) - (*cb)->show_document(path, doc); + for(auto const& cb : callbacks) + cb->show_document(path, doc); } void show_error (std::string const& path, std::string const& message, oak::uuid_t const& filter) @@ -201,8 +201,8 @@ namespace document document::document_ptr doc = _document; _document->post_load(path, io::bytes_ptr(), std::map(), NULL_STR, encoding::type()); - iterate(cb, callbacks) - (*cb)->show_error(path, doc, message, filter); + for(auto const& cb : callbacks) + cb->show_error(path, doc, message, filter); } private: diff --git a/Frameworks/document/tests/t_xattr.cc b/Frameworks/document/tests/t_xattr.cc index 48a30cf3..ff68835e 100644 --- a/Frameworks/document/tests/t_xattr.cc +++ b/Frameworks/document/tests/t_xattr.cc @@ -32,7 +32,7 @@ public: TS_ASSERT_EQUALS(doc->selection(), "2:2&3:1"); // ng::ranges_t const sel = convert(doc->buffer(), doc->selection()); - // iterate(range, sel) - // fprintf(stderr, "%zu-%zu\n", range->first.index, range->last.index); + // for(auto const& range : sel) + // fprintf(stderr, "%zu-%zu\n", range.first.index, range.last.index); } }; diff --git a/Frameworks/editor/src/completion.cc b/Frameworks/editor/src/completion.cc index a195a239..da3bb5a4 100644 --- a/Frameworks/editor/src/completion.cc +++ b/Frameworks/editor/src/completion.cc @@ -10,9 +10,9 @@ template _OutputIter words_with_prefix_and_suffix (ng::buffer_t const& buffer, std::string const& prefix, std::string const& suffix, std::string const& excludeWord, _OutputIter out) { - citerate(pair, ng::find_all(buffer, prefix.size() < suffix.size() ? suffix : prefix, find::none)) + for(auto const& pair : ng::find_all(buffer, prefix.size() < suffix.size() ? suffix : prefix, find::none)) { - ng::range_t range = ng::extend(buffer, pair->first, kSelectionExtendToWord).last(); + ng::range_t range = ng::extend(buffer, pair.first, kSelectionExtendToWord).last(); size_t bow = range.min().index, eow = range.max().index; if(prefix.size() < (eow - bow) && prefix == buffer.substr(bow, bow + prefix.size()) && suffix.size() < (eow - bow) && suffix == buffer.substr(eow - suffix.size(), eow) && excludeWord != buffer.substr(bow, eow)) *out++ = std::make_pair(bow, buffer.substr(bow, eow)); @@ -145,16 +145,16 @@ namespace ng // =============================================== std::map ranked; - iterate(pair, tmp) + for(auto const& pair : tmp) { - std::string word = pair->second; + std::string word = pair.second; bool hasPrefix = prefix.empty() || (prefix.size() < word.size() && word.find(prefix) == 0); bool hasSuffix = hasPrefix && !suffix.empty() && suffix.size() < word.size() && word.find(suffix, word.size() - suffix.size()) == word.size() - suffix.size(); if(!hasPrefix || word == currentWord) continue; - ssize_t rank = bow <= pair->first ? pair->first - bow : bow - (pair->first + word.size()); + ssize_t rank = bow <= pair.first ? pair.first - bow : bow - (pair.first + word.size()); word = word.substr(prefix.size(), word.size() - prefix.size() - (hasSuffix ? suffix.size() : 0)); auto it = ranked.find(word); @@ -164,8 +164,8 @@ namespace ng } std::map ordered; - iterate(pair, ranked) - ordered.emplace(pair->second, pair->first); + for(auto const& pair : ranked) + ordered.emplace(pair.second, pair.first); std::vector res; std::transform(ordered.begin(), ordered.end(), back_inserter(res), [](std::pair const& p){ return p.second; }); @@ -199,8 +199,8 @@ namespace ng info.advance(); std::multimap insertions; - citerate(range, info.prefix_ranges()) - insertions.emplace(*range, info.current()); + for(auto const& range : info.prefix_ranges()) + insertions.emplace(range, info.current()); info.set_prefix_ranges(this->replace(insertions, true)); info.set_revision(_buffer.next_revision()); info.set_ranges(ng::move(_buffer, info.prefix_ranges(), kSelectionMoveToEndOfSelection)); @@ -216,8 +216,8 @@ namespace ng info.retreat(); std::multimap insertions; - citerate(range, info.prefix_ranges()) - insertions.emplace(*range, info.current()); + for(auto const& range : info.prefix_ranges()) + insertions.emplace(range, info.current()); info.set_prefix_ranges(this->replace(insertions, true)); info.set_revision(_buffer.next_revision()); info.set_ranges(ng::move(_buffer, info.prefix_ranges(), kSelectionMoveToEndOfSelection)); diff --git a/Frameworks/editor/src/dispatch.cc b/Frameworks/editor/src/dispatch.cc index f37061dc..5314a235 100644 --- a/Frameworks/editor/src/dispatch.cc +++ b/Frameworks/editor/src/dispatch.cc @@ -273,9 +273,9 @@ namespace ng set_find_clipboard(create_macro_clipboard(oldFindClipboard)); set_replace_clipboard(create_macro_clipboard(oldReplaceClipboard)); - iterate(command, commands) + for(auto const& command : commands) { - plist::dictionary_t dict = boost::get(*command); // TODO ASSERT this! + plist::dictionary_t dict = boost::get(command); // TODO ASSERT this! std::string sel, str; plist::dictionary_t args; if(plist::get_key_path(dict, "command", sel)) diff --git a/Frameworks/editor/src/editor.cc b/Frameworks/editor/src/editor.cc index 481b9582..31ee4497 100644 --- a/Frameworks/editor/src/editor.cc +++ b/Frameworks/editor/src/editor.cc @@ -79,9 +79,9 @@ namespace ng _OutputIter transpose_selections (buffer_t const& _buffer, ranges_t const& _selections, _OutputIter out) { ranges_t sel; - iterate(range, _selections) + for(auto const& range : _selections) { - size_t from = range->min().index, to = range->max().index; + size_t from = range.min().index, to = range.max().index; if(from == to) { text::pos_t const& pos = _buffer.convert(from); @@ -106,15 +106,15 @@ namespace ng } *out++ = std::make_pair(range_t(from, to), transform::transpose(_buffer.substr(from, to))); } - else if(range->columnar) // TODO from.line != to.line + else if(range.columnar) // TODO from.line != to.line { std::vector strings; std::vector ranges; - citerate(r, dissect_columnar(_buffer, *range)) + for(auto const& r : dissect_columnar(_buffer, range)) { - strings.push_back(_buffer.substr(r->min().index, r->max().index)); - ranges.push_back(*r); + strings.push_back(_buffer.substr(r.min().index, r.max().index)); + ranges.push_back(r); } for(size_t i = 0; i < ranges.size(); ++i) @@ -139,18 +139,18 @@ namespace ng { preserve_selection_helper_t (buffer_t& buffer, ranges_t const& marks) : _buffer(buffer) { - iterate(range, marks) + for(auto const& range : marks) { - if(range->empty()) + if(range.empty()) { - _marks.emplace_back(range->first, mark_t::kUnpairedMark); - _marks.emplace_back(range->first, mark_t::kEndMark); + _marks.emplace_back(range.first, mark_t::kUnpairedMark); + _marks.emplace_back(range.first, mark_t::kEndMark); } else { - size_t userInfo = (range->columnar ? kColumnar : 0) | (range->last < range->first ? kReversed : 0); - _marks.emplace_back(range->min(), mark_t::kBeginMark, userInfo); - _marks.emplace_back(range->max(), mark_t::kEndMark, userInfo); + size_t userInfo = (range.columnar ? kColumnar : 0) | (range.last < range.first ? kReversed : 0); + _marks.emplace_back(range.min(), mark_t::kBeginMark, userInfo); + _marks.emplace_back(range.max(), mark_t::kEndMark, userInfo); } } @@ -187,19 +187,19 @@ namespace ng void will_replace (size_t from, size_t to, std::string const& str) { - iterate(mark, _marks) + for(auto& mark : _marks) { - size_t& index = mark->position.index; + size_t& index = mark.position.index; if(oak::cap(from, index, to) == index) { - if(mark->type == mark_t::kUnpairedMark || index != from && index != to) + if(mark.type == mark_t::kUnpairedMark || index != from && index != to) { index = from + str.size() - std::min(to - index, str.size()); } else { index = from; - if(mark->type == mark_t::kEndMark) + if(mark.type == mark_t::kEndMark) index += str.size(); } } @@ -233,8 +233,8 @@ namespace ng std::multimap map (ng::buffer_t const& buffer, ng::ranges_t const& selections, F op) { std::multimap replacements; - citerate(range, dissect_columnar(buffer, selections)) - replacements.emplace(*range, op(buffer.substr(range->min().index, range->max().index))); + for(auto const& range : dissect_columnar(buffer, selections)) + replacements.emplace(range, op(buffer.substr(range.min().index, range.max().index))); return replacements; } @@ -243,10 +243,10 @@ namespace ng ranges_t res; ssize_t adjustment = 0; - iterate(p1, replacements) + for(auto const& p1 : replacements) { - range_t orgRange = p1->first.sorted(); - if(orgRange.first.index == orgRange.last.index && p1->second.empty()) + range_t orgRange = p1.first.sorted(); + if(orgRange.first.index == orgRange.last.index && p1.second.empty()) { res.push_back(orgRange + adjustment); continue; @@ -254,14 +254,14 @@ namespace ng std::string const pad = orgRange.freehanded && orgRange.first.carry ? std::string(orgRange.first.carry, ' ') : ""; orgRange.first.carry = orgRange.last.carry = 0; - ng::range_t original(orgRange.first.index + pad.size(), orgRange.first.index + pad.size() + p1->second.size()); + ng::range_t original(orgRange.first.index + pad.size(), orgRange.first.index + pad.size() + p1.second.size()); bool goodCaretMatch = false; - std::vector< std::pair > const& real = snippets.replace(orgRange.first.index, orgRange.last.index, pad + p1->second); - iterate(p2, real) + std::vector< std::pair > const& real = snippets.replace(orgRange.first.index, orgRange.last.index, pad + p1.second); + for(auto const& p2 : real) { - range_t const& range = p2->first; - std::string const& str = p2->second; + range_t const& range = p2.first; + std::string const& str = p2.second; size_t from = range.first.index + adjustment, to = range.last.index + adjustment; size_t caret = buffer.replace(from, to, str); @@ -359,8 +359,8 @@ namespace ng } std::vector v; - citerate(range, dissect_columnar(buffer, selections)) - v.push_back(buffer.substr(range->min().index, range->max().index)); + for(auto const& range : dissect_columnar(buffer, selections)) + v.push_back(buffer.substr(range.min().index, range.max().index)); bool columnar = selections.size() == 1 && selections.last().columnar; return std::make_shared(text::join(v, "\n"), indent, complete, v.size(), columnar); } @@ -459,10 +459,10 @@ namespace ng if(_snippets.empty()) return NULL_STR; ng::range_t range = _snippets.current(); - iterate(r, _selections) + for(auto const& r : _selections) { - if(placeholderSelection && range.min() <= r->min() && r->max() <= range.max()) - *placeholderSelection = ng::range_t(r->min().index - range.min().index, r->max().index - range.min().index); + if(placeholderSelection && range.min() <= r.min() && r.max() <= range.max()) + *placeholderSelection = ng::range_t(r.min().index - range.min().index, r.max().index - range.min().index); } return _buffer.substr(range.min().index, range.max().index); } @@ -472,8 +472,8 @@ namespace ng std::multimap map; map.emplace(_snippets.current(), str); ng::ranges_t res = this->replace(map, true); - iterate(range, res) - range->min().index += selectFrom; + for(auto& range : res) + range.min().index += selectFrom; _selections = res; } @@ -502,8 +502,8 @@ namespace ng size_t i = 0; std::multimap insertions; - citerate(range, dissect_columnar(buffer, selections)) - insertions.emplace(*range, words[i++ % words.size()]); + for(auto const& range : dissect_columnar(buffer, selections)) + insertions.emplace(range, words[i++ % words.size()]); return ng::move(buffer, replace_helper(buffer, snippets, insertions), kSelectionMoveToEndOfSelection); } @@ -517,21 +517,21 @@ namespace ng size_t col = visual_distance(buffer, buffer.begin(n), caret); std::multimap insertions; - citerate(line, text::tokenize(str.begin(), str.end(), '\n')) + for(auto const& line : text::tokenize(str.begin(), str.end(), '\n')) { if(n+1 < buffer.lines()) { - insertions.emplace(visual_advance(buffer, buffer.begin(n), col), *line); + insertions.emplace(visual_advance(buffer, buffer.begin(n), col), line); } else if(n < buffer.lines()) { // we special-case this to ensure we do not insert at last line with carry, as that will cause potential following insertions to have a lower index, since those will be at EOB w/o a carry index_t pos = visual_advance(buffer, buffer.begin(n), col); - insertions.emplace(index_t(pos.index), std::string(pos.carry, ' ') + *line); + insertions.emplace(index_t(pos.index), std::string(pos.carry, ' ') + line); } else { - insertions.emplace(index_t(buffer.size()), "\n" + std::string(col, ' ') + *line); + insertions.emplace(index_t(buffer.size()), "\n" + std::string(col, ' ') + line); } ++n; } @@ -541,9 +541,9 @@ namespace ng { std::multimap insertions; ng::range_t caret = dissect_columnar(buffer, selections).last(); - citerate(line, text::tokenize(str.begin(), str.end(), '\n')) + for(auto const& line : text::tokenize(str.begin(), str.end(), '\n')) { - insertions.emplace(caret, *line); + insertions.emplace(caret, line); caret = caret.max(); } return ng::move(buffer, replace_helper(buffer, snippets, insertions), kSelectionMoveToEndOfSelection); @@ -575,10 +575,10 @@ namespace ng int minIndent = INT_MAX; std::vector< std::pair > const& v = text::to_lines(str.data(), str.data() + str.size()); - iterate(it, v) + for(auto const& it : v) { - if(!text::is_blank(it->first, it->second)) - minIndent = std::min(indent::leading_whitespace(it->first, it->second, tabSize), minIndent); + if(!text::is_blank(it.first, it.second)) + minIndent = std::min(indent::leading_whitespace(it.first, it.second, tabSize), minIndent); } plist::any_t pasteBehaviorValue = bundles::value_for_setting("indentOnPaste", buffer.scope(index)); @@ -601,12 +601,12 @@ namespace ng { indent::fsm_t fsm = indent::create_fsm(buffer, line, indentSize, tabSize); auto const patterns = indent::patterns_for_scope(buffer.scope(index)); - iterate(it, v) + for(auto const& it : v) { - if(fsm.is_ignored(std::string(it->first, it->second), patterns)) + if(fsm.is_ignored(std::string(it.first, it.second), patterns)) continue; - size_t indent = fsm.scan_line(std::string(it->first, it->second), patterns); - int oldIndent = indent::leading_whitespace(it->first, it->second, tabSize); + size_t indent = fsm.scan_line(std::string(it.first, it.second), patterns); + int oldIndent = indent::leading_whitespace(it.first, it.second, tabSize); transform::shift shifter(std::max(((int)indent)-oldIndent, -minIndent), buffer.indent()); str = shifter(str); break; @@ -662,15 +662,15 @@ namespace ng _buffer.remove_callback(this); std::multimap replacements; - iterate(pair, _lines) + for(auto const& pair : _lines) { - size_t n = pair->first; + size_t n = pair.first; size_t bol = _buffer.begin(n); size_t eos = bol; std::string const line = _buffer.substr(bol, _buffer.eol(n)); int actual = indent::leading_whitespace(line.data(), line.data() + line.size(), _buffer.indent().tab_size()); - if(actual != pair->second) + if(actual != pair.second) continue; indent::fsm_t fsm = indent::create_fsm(_buffer, n, _buffer.indent().indent_size(), _buffer.indent().tab_size()); @@ -705,9 +705,9 @@ namespace ng plist::any_t typingPairs = bundles::value_for_setting("smartTypingPairs", scope); if(plist::array_t const* typingPairsArray = boost::get(&typingPairs)) { - iterate(pair, *typingPairsArray) + for(auto const& pair : *typingPairsArray) { - if(plist::array_t const* pairArray = boost::get(&*pair)) + if(plist::array_t const* pairArray = boost::get(&pair)) { if(pairArray->size() == 2) { @@ -766,17 +766,17 @@ namespace ng { std::vector v; std::multimap insertions; - citerate(range, dissect_columnar(_buffer, _selections)) + for(auto const& range : dissect_columnar(_buffer, _selections)) { - v.push_back(_buffer.substr(range->min().index, range->max().index)); - insertions.emplace(*range, ""); + v.push_back(_buffer.substr(range.min().index, range.max().index)); + insertions.emplace(range, ""); } insertions.emplace(index, text::join(v, "\n")); ranges_t sel, tmp = this->replace(insertions, selectInsertion); - iterate(range, tmp) + for(auto const& range : tmp) { - if(!range->empty()) - sel.push_back(*range); + if(!range.empty()) + sel.push_back(range); } _selections = tmp.empty() ? tmp : sel; } @@ -1228,15 +1228,15 @@ namespace ng std::string estimatedIndent = NULL_STR; std::multimap insertions; - citerate(range, dissect_columnar(buffer, selections)) + for(auto const& range : dissect_columnar(buffer, selections)) { - size_t const from = range->min().index; + size_t const from = range.min().index; size_t const firstLine = buffer.convert(from).line; std::string const& leftOfCaret = buffer.substr(buffer.begin(firstLine), from); if(smartTabEnabled && text::is_blank(leftOfCaret.data(), leftOfCaret.data() + leftOfCaret.size())) { - size_t to = range->max().index; + size_t to = range.max().index; if(estimatedIndent == NULL_STR) { @@ -1259,7 +1259,7 @@ namespace ng else { size_t col = visual_distance(buffer, buffer.begin(firstLine), from); - insertions.emplace(*range, buffer.indent().create(col)); + insertions.emplace(range, buffer.indent().create(col)); } } return ng::move(buffer, replace_helper(buffer, snippets, insertions), kSelectionMoveToEndOfSelection); @@ -1268,14 +1268,14 @@ namespace ng ng::ranges_t editor_t::insert_newline_with_indent (ng::buffer_t& buffer, ng::ranges_t const& selections, snippet_controller_t& snippets) { std::multimap insertions; - citerate(range, dissect_columnar(buffer, selections)) + for(auto const& range : dissect_columnar(buffer, selections)) { - size_t const from = range->min().index; + size_t const from = range.min().index; size_t const firstLine = buffer.convert(from).line; std::string const& leftOfCaret = buffer.substr(buffer.begin(firstLine), from); auto const patterns = indent::patterns_for_line(buffer, firstLine); - size_t to = range->max().index; + size_t to = range.max().index; size_t const lastLine = buffer.convert(to).line; std::string const& rightOfCaret = buffer.substr(to, buffer.end(lastLine)); @@ -1294,7 +1294,7 @@ namespace ng newIndent = indent::leading_whitespace(leftOfCaret.data(), leftOfCaret.data() + leftOfCaret.size(), buffer.indent().tab_size()) + existingIndent; else existingIndent = 0; - insertions.emplace(*range, existingIndent < newIndent ? "\n" + indent::create(newIndent - existingIndent, buffer.indent().tab_size(), buffer.indent().soft_tabs()) : "\n"); + insertions.emplace(range, existingIndent < newIndent ? "\n" + indent::create(newIndent - existingIndent, buffer.indent().tab_size(), buffer.indent().soft_tabs()) : "\n"); } return ng::move(buffer, replace_helper(buffer, snippets, insertions), kSelectionMoveToEndOfSelection); } @@ -1303,9 +1303,9 @@ namespace ng { ssize_t adjustment = 0; std::map clips; - citerate(range, dissect_columnar(_buffer, _selections).sorted()) + for(auto const& range : dissect_columnar(_buffer, _selections).sorted()) { - range_t r = *range + adjustment; + range_t r = range + adjustment; std::string const& str = _buffer.substr(r.min().index, r.max().index); std::multimap replacements; replacements.emplace(r, ""); @@ -1315,15 +1315,15 @@ namespace ng } std::multimap replacements; - iterate(pair, clips) + for(auto const& pair : clips) { - text::pos_t pos = _buffer.convert(pair->first); + text::pos_t pos = _buffer.convert(pair.first); int line = pos.line; - int col = visual_distance(_buffer, _buffer.begin(line), pair->first, false); + int col = visual_distance(_buffer, _buffer.begin(line), pair.first, false); line = oak::cap(0, line + deltaY, int(_buffer.lines()-1)); col = std::max(col + deltaX, 0); - replacements.emplace(visual_advance(_buffer, _buffer.begin(line), col, false), pair->second); + replacements.emplace(visual_advance(_buffer, _buffer.begin(line), col, false), pair.second); } _selections = this->replace(replacements, true); } @@ -1406,10 +1406,10 @@ namespace ng // case output_format::completion_list: // { // std::vector completions; - // citerate(line, text::tokenize(out.begin(), out.end(), '\n')) + // for(auto const& line : text::tokenize(out.begin(), out.end(), '\n')) // { - // if(!(*line).empty()) - // completions.push_back(*line); + // if(!line.empty()) + // completions.push_back(line); // } // completion(completions, selection().last()); // } @@ -1421,10 +1421,10 @@ namespace ng void editor_t::delete_tab_trigger (std::string const& str) { ranges_t ranges; - iterate(range, _selections) + for(auto const& range : _selections) { - size_t from = range->min().index; - ranges.push_back(range_t(from - std::min(str.size(), from), range->max())); + size_t from = range.min().index; + ranges.push_back(range_t(from - std::min(str.size(), from), range.max())); } _selections = apply(_buffer, ranges, _snippets, &transform::null); } @@ -1468,12 +1468,12 @@ namespace ng if(32 + range.max().index - range.min().index < ARG_MAX) { bool first = true; - citerate(r, dissect_columnar(_buffer, range)) + for(auto const& r : dissect_columnar(_buffer, range)) { if(first) map["TM_SELECTED_TEXT"] = ""; else map["TM_SELECTED_TEXT"] += "\n"; - map["TM_SELECTED_TEXT"] += _buffer.substr(r->min().index, r->max().index); + map["TM_SELECTED_TEXT"] += _buffer.substr(r.min().index, r.max().index); first = false; } } @@ -1497,14 +1497,14 @@ namespace ng ranges_t res; if(options & find::all_matches) { - citerate(pair, ng::find_all(_buffer, searchFor, options, searchOnlySelection ? _selections : ranges_t())) - res.push_back(pair->first); + for(auto const& pair : ng::find_all(_buffer, searchFor, options, searchOnlySelection ? _selections : ranges_t())) + res.push_back(pair.first); if(searchOnlySelection && res.sorted() == _selections.sorted()) { res = ranges_t(); - citerate(pair, ng::find_all(_buffer, searchFor, options, ranges_t())) - res.push_back(pair->first); + for(auto const& pair : ng::find_all(_buffer, searchFor, options, ranges_t())) + res.push_back(pair.first); } } else @@ -1528,8 +1528,8 @@ namespace ng { preserve_selection_helper_t helper(_buffer, _selections); std::multimap replacements; - citerate(pair, ng::find_all(_buffer, searchFor, options, searchOnlySelection ? _selections : ranges_t())) - replacements.emplace(pair->first, options & find::regular_expression ? format_string::expand(replaceWith, pair->second) : replaceWith); + for(auto const& pair : ng::find_all(_buffer, searchFor, options, searchOnlySelection ? _selections : ranges_t())) + replacements.emplace(pair.first, options & find::regular_expression ? format_string::expand(replaceWith, pair.second) : replaceWith); res = this->replace(replacements, true); _selections = helper.get(false); } diff --git a/Frameworks/editor/src/snippets.cc b/Frameworks/editor/src/snippets.cc index 403ce82f..1d23112c 100644 --- a/Frameworks/editor/src/snippets.cc +++ b/Frameworks/editor/src/snippets.cc @@ -16,8 +16,8 @@ namespace ng return std::vector< std::pair >(1, std::make_pair(ng::range_t(from, to), replacement)); std::vector< std::pair > res; - citerate(pair, stack.replace(snippet::range_t(from - anchor, to - anchor), replacement)) - res.push_back(std::make_pair(ng::range_t(pair->first.from.offset + anchor, pair->first.to.offset + anchor), pair->second)); + for(auto const& pair : stack.replace(snippet::range_t(from - anchor, to - anchor), replacement)) + res.push_back(std::make_pair(ng::range_t(pair.first.from.offset + anchor, pair.first.to.offset + anchor), pair.second)); return res; } diff --git a/Frameworks/editor/src/transform.cc b/Frameworks/editor/src/transform.cc index d600f1c8..2b7f18fd 100644 --- a/Frameworks/editor/src/transform.cc +++ b/Frameworks/editor/src/transform.cc @@ -29,10 +29,10 @@ static std::string justify_line (std::string const& str, size_t width, size_t ta size_t spaceCount = 0; std::string res = ""; - iterate(ch, str) + for(auto const& ch : str) { - res.insert(res.end(), 1, *ch); - if(*ch == ' ') + res.insert(res.end(), 1, ch); + if(ch == ' ') { size_t from = (extraSpaces * spaceCount + numberOfSpaces/2) / numberOfSpaces; size_t to = (extraSpaces * (spaceCount+1) + numberOfSpaces/2) / numberOfSpaces; @@ -116,10 +116,10 @@ namespace transform std::string shift::operator() (std::string const& src) const { std::string res; - citerate(it, text::to_lines(src.data(), src.data() + src.size())) + for(auto const& it : text::to_lines(src.data(), src.data() + src.size())) { - char const* from = it->first; - char const* to = it->second; + char const* from = it.first; + char const* to = it.second; if(amount > 0 && !text::is_blank(from, to)) { @@ -157,13 +157,13 @@ namespace transform size_t from = 0; std::string const unwrapped = unwrap(src); std::string const fillStr = fill_string(unwrapped); - citerate(offset, text::soft_breaks(unwrapped, wrap, tabSize, fillStr.size())) + for(auto const& offset : text::soft_breaks(unwrapped, wrap, tabSize, fillStr.size())) { - res += unwrapped.substr(from, length_excl_whitespace(unwrapped, from, *offset)); + res += unwrapped.substr(from, length_excl_whitespace(unwrapped, from, offset)); res += "\n"; - if(*offset != unwrapped.size()) + if(offset != unwrapped.size()) res += fillStr; - from = *offset; + from = offset; } res += unwrapped.substr(from, length_excl_whitespace(unwrapped, from, unwrapped.size())); return newline ? res + "\n" : res; @@ -173,15 +173,15 @@ namespace transform { std::string res; std::string const unwrapped = unwrap(src); - citerate(it, text::to_lines(unwrapped.data(), unwrapped.data() + unwrapped.size())) + for(auto const& it : text::to_lines(unwrapped.data(), unwrapped.data() + unwrapped.size())) { size_t from = 0; - std::string const str = std::string(it->first, it->second); - citerate(offset, text::soft_breaks(str, wrap, tabSize)) + std::string const str = std::string(it.first, it.second); + for(auto const& offset : text::soft_breaks(str, wrap, tabSize)) { - res += justify_line(str.substr(from, length_excl_whitespace(str, from, *offset)), wrap, tabSize); + res += justify_line(str.substr(from, length_excl_whitespace(str, from, offset)), wrap, tabSize); res += "\n"; - from = *offset; + from = offset; } res += str.substr(from, length_excl_whitespace(str, from, str.size())); } diff --git a/Frameworks/editor/src/write.cc b/Frameworks/editor/src/write.cc index a93f3719..96a7a63d 100644 --- a/Frameworks/editor/src/write.cc +++ b/Frameworks/editor/src/write.cc @@ -34,11 +34,11 @@ namespace ng { std::string str = ""; bool first = true; - citerate(range, dissect_columnar(buffer, r)) + for(auto const& range : dissect_columnar(buffer, r)) { if(!first) str += "\n"; - str += format == input_format::xml ? to_xml(buffer, range->min().index, range->max().index) : buffer.substr(range->min().index, range->max().index); + str += format == input_format::xml ? to_xml(buffer, range.min().index, range.max().index) : buffer.substr(range.min().index, range.max().index); first = false; } diff --git a/Frameworks/file/src/filter.cc b/Frameworks/file/src/filter.cc index 8cbbcdfc..e121703f 100644 --- a/Frameworks/file/src/filter.cc +++ b/Frameworks/file/src/filter.cc @@ -21,12 +21,12 @@ static std::vector binary_filters (std::string const& event, } std::multimap ordering; - citerate(item, bundles::query(bundles::kFieldSemanticClass, event, pathAttributes, bundles::kItemTypeCommand)) + for(auto const& item : bundles::query(bundles::kFieldSemanticClass, event, pathAttributes, bundles::kItemTypeCommand)) { - citerate(pattern, (*item)->values_for_field(bundles::kFieldContentMatch)) + for(auto const& pattern : item->values_for_field(bundles::kFieldContentMatch)) { - if(regexp::match_t const& m = regexp::search(*pattern, contentAsString)) - ordering.emplace(-m.end(), *item); + if(regexp::match_t const& m = regexp::search(pattern, contentAsString)) + ordering.emplace(-m.end(), item); } } return ordering.empty() ? std::vector() : std::vector(1, ordering.begin()->second); diff --git a/Frameworks/file/src/open.cc b/Frameworks/file/src/open.cc index b86fa74e..e3ab0765 100644 --- a/Frameworks/file/src/open.cc +++ b/Frameworks/file/src/open.cc @@ -324,12 +324,12 @@ namespace break; std::vector filters; - citerate(item, filter::find(_path, _content, _path_attributes, filter::kBundleEventBinaryImport)) + for(auto const& item : filter::find(_path, _content, _path_attributes, filter::kBundleEventBinaryImport)) { - if(!oak::contains(_binary_import_filters.begin(), _binary_import_filters.end(), (*item)->uuid())) + if(!oak::contains(_binary_import_filters.begin(), _binary_import_filters.end(), item->uuid())) { - filters.push_back(*item); - _binary_import_filters.push_back((*item)->uuid()); + filters.push_back(item); + _binary_import_filters.push_back(item->uuid()); break; // FIXME see next FIXME } } @@ -445,12 +445,12 @@ namespace _next_state = kStateEstimateFileType; std::vector filters; - citerate(item, filter::find(_path, _content, _path_attributes, filter::kBundleEventTextImport)) + for(auto const& item : filter::find(_path, _content, _path_attributes, filter::kBundleEventTextImport)) { - if(!oak::contains(_text_import_filters.begin(), _text_import_filters.end(), (*item)->uuid())) + if(!oak::contains(_text_import_filters.begin(), _text_import_filters.end(), item->uuid())) { - filters.push_back(*item); - _text_import_filters.push_back((*item)->uuid()); + filters.push_back(item); + _text_import_filters.push_back(item->uuid()); break; // FIXME see next FIXME } } diff --git a/Frameworks/file/src/path_info.cc b/Frameworks/file/src/path_info.cc index 7cd1eca8..ef45460b 100644 --- a/Frameworks/file/src/path_info.cc +++ b/Frameworks/file/src/path_info.cc @@ -16,14 +16,14 @@ namespace file if(path != NULL_STR) { std::vector revPath; - citerate(token, text::tokenize(path.begin(), path.end(), '/')) + for(auto const& token : text::tokenize(path.begin(), path.end(), '/')) { - std::string tmp = *token; - citerate(subtoken, text::tokenize(tmp.begin(), tmp.end(), '.')) + std::string tmp = token; + for(auto const& subtoken : text::tokenize(tmp.begin(), tmp.end(), '.')) { - if((*subtoken).empty()) + if(subtoken.empty()) continue; - revPath.push_back(*subtoken); + revPath.push_back(subtoken); std::replace(revPath.back().begin(), revPath.back().end(), ' ', '_'); } } diff --git a/Frameworks/file/src/save.cc b/Frameworks/file/src/save.cc index cb37c9c2..dfe70576 100644 --- a/Frameworks/file/src/save.cc +++ b/Frameworks/file/src/save.cc @@ -292,12 +292,12 @@ namespace _next_state = kStateConvertLineFeeds; std::vector filters; - citerate(item, filter::find(_path, _content, _path_attributes, filter::kBundleEventTextExport)) + for(auto const& item : filter::find(_path, _content, _path_attributes, filter::kBundleEventTextExport)) { - if(!oak::contains(_text_export_filters.begin(), _text_export_filters.end(), (*item)->uuid())) + if(!oak::contains(_text_export_filters.begin(), _text_export_filters.end(), item->uuid())) { - filters.push_back(*item); - _text_export_filters.push_back((*item)->uuid()); + filters.push_back(item); + _text_export_filters.push_back(item->uuid()); break; // FIXME see next FIXME } } @@ -374,12 +374,12 @@ namespace _next_state = kStateSaveContent; std::vector filters; - citerate(item, filter::find(_path, _content, _path_attributes, filter::kBundleEventBinaryExport)) + for(auto const& item : filter::find(_path, _content, _path_attributes, filter::kBundleEventBinaryExport)) { - if(!oak::contains(_binary_export_filters.begin(), _binary_export_filters.end(), (*item)->uuid())) + if(!oak::contains(_binary_export_filters.begin(), _binary_export_filters.end(), item->uuid())) { - filters.push_back(*item); - _binary_export_filters.push_back((*item)->uuid()); + filters.push_back(item); + _binary_export_filters.push_back(item->uuid()); break; // FIXME see next FIXME } } diff --git a/Frameworks/file/src/type.cc b/Frameworks/file/src/type.cc index 6012cf69..3ce06291 100644 --- a/Frameworks/file/src/type.cc +++ b/Frameworks/file/src/type.cc @@ -14,9 +14,9 @@ OAK_DEBUG_VAR(File_UserBindings); static std::string file_type_from_grammars (std::vector const& grammars) { - iterate(grammar, grammars) + for(auto const& grammar : grammars) { - std::string const& scopeName = (*grammar)->value_for_field(bundles::kFieldGrammarScope); + std::string const& scopeName = grammar->value_for_field(bundles::kFieldGrammarScope); if(scopeName != NULL_STR) return scopeName; } @@ -33,15 +33,15 @@ static size_t lines_matched_by_regexp (std::string const& pattern) size_t newlines = 1; bool esc = false; - iterate(ch, pattern) + for(auto const& ch : pattern) { - if(*ch == '\\') + if(ch == '\\') { esc = !esc; continue; } - if(esc && *ch == 'n' || *ch == '\n') + if(esc && ch == 'n' || ch == '\n') ++newlines; esc = false; } @@ -63,17 +63,17 @@ static std::string file_type_from_bytes (io::bytes_ptr const& bytes) return NULL_STR; std::multimap ordering; - citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar)) { - citerate(pattern, (*item)->values_for_field(bundles::kFieldGrammarFirstLineMatch)) + for(auto const& pattern : item->values_for_field(bundles::kFieldGrammarFirstLineMatch)) { char const* first = bytes->begin(); char const* last = bytes->end(); - if(pattern->find("(?m)") == std::string::npos) - last = first_n_lines(first, last, lines_matched_by_regexp(*pattern)); + if(pattern.find("(?m)") == std::string::npos) + last = first_n_lines(first, last, lines_matched_by_regexp(pattern)); - if(regexp::match_t const& m = regexp::search(*pattern, first, last)) - ordering.emplace(-m.end(), *item); + if(regexp::match_t const& m = regexp::search(pattern, first, last)) + ordering.emplace(-m.end(), item); } } return ordering.empty() ? NULL_STR : file_type_from_grammars(std::vector(1, ordering.begin()->second)); diff --git a/Frameworks/io/src/move_path.cc b/Frameworks/io/src/move_path.cc index 2cfdd0fa..7bf01881 100644 --- a/Frameworks/io/src/move_path.cc +++ b/Frameworks/io/src/move_path.cc @@ -25,10 +25,10 @@ static bool is_copyable_dir (std::string const& path) } bool res = true; - citerate(it, path::entries(path)) + for(auto const& it : path::entries(path)) { - std::string const& newSrc = path::join(path, (*it)->d_name); - if((*it)->d_type == DT_REG) + std::string const& newSrc = path::join(path, it->d_name); + if(it->d_type == DT_REG) { if(access(newSrc.c_str(), R_OK) != 0) { @@ -36,17 +36,17 @@ static bool is_copyable_dir (std::string const& path) res = false; } } - else if((*it)->d_type == DT_DIR) + else if(it->d_type == DT_DIR) { res = is_copyable_dir(newSrc); } - else if((*it)->d_type == DT_LNK) + else if(it->d_type == DT_LNK) { return true; } else { - D(DBF_IO_Failure, bug("unknown file type: %s (%d)\n", newSrc.c_str(), (*it)->d_type);); + D(DBF_IO_Failure, bug("unknown file type: %s (%d)\n", newSrc.c_str(), it->d_type);); res = false; } @@ -97,15 +97,15 @@ namespace path } bool res = true; - citerate(it, path::entries(src)) + for(auto const& it : path::entries(src)) { - std::string const& newSrc = path::join(src, (*it)->d_name); - std::string const& newDst = path::join(dst, (*it)->d_name); - if((*it)->d_type == DT_DIR) + std::string const& newSrc = path::join(src, it->d_name); + std::string const& newDst = path::join(dst, it->d_name); + if(it->d_type == DT_DIR) { res = path::copy(newSrc, newDst) && res; } - else if((*it)->d_type == DT_REG || (*it)->d_type == DT_LNK) + else if(it->d_type == DT_REG || it->d_type == DT_LNK) { if(copyfile(newSrc.c_str(), newDst.c_str(), NULL, COPYFILE_ALL | COPYFILE_NOFOLLOW_SRC) != 0) { @@ -115,7 +115,7 @@ namespace path } else { - D(DBF_IO_Failure, bug("skip unknown type: %s (%d)\n", newSrc.c_str(), (*it)->d_type);); + D(DBF_IO_Failure, bug("skip unknown type: %s (%d)\n", newSrc.c_str(), it->d_type);); res = false; } } @@ -178,10 +178,10 @@ namespace path static bool remove_dir (std::string const& path) { bool res = true; - citerate(it, path::entries(path)) + for(auto const& it : path::entries(path)) { - std::string const& newSrc = path::join(path, (*it)->d_name); - if((*it)->d_type == DT_DIR) + std::string const& newSrc = path::join(path, it->d_name); + if(it->d_type == DT_DIR) { res = path::remove_dir(newSrc) && res; } diff --git a/Frameworks/io/src/path.cc b/Frameworks/io/src/path.cc index e22c4b89..58034ea1 100644 --- a/Frameworks/io/src/path.cc +++ b/Frameworks/io/src/path.cc @@ -766,12 +766,12 @@ namespace path if(fd != -1) { res = true; - iterate(pair, attributes) + for(auto const& pair : attributes) { int rc = 0; - if(pair->second == NULL_STR) - rc = fremovexattr(fd, pair->first.c_str(), 0); - else rc = fsetxattr(fd, pair->first.c_str(), pair->second.data(), pair->second.size(), 0, 0); + if(pair.second == NULL_STR) + rc = fremovexattr(fd, pair.first.c_str(), 0); + else rc = fsetxattr(fd, pair.first.c_str(), pair.second.data(), pair.second.size(), 0, 0); if(rc != 0 && errno != ENOTSUP && errno != ENOATTR) { @@ -779,7 +779,7 @@ namespace path // fremovexattr() on AFP for non-existing attributes gives us EINVAL // fsetxattr() on Samba saving to ext4 via virtual machine gives us ENOENT // sshfs with ‘-o noappledouble’ will return ENOATTR or EPERM - perror((pair->second == NULL_STR ? text::format("fremovexattr(%d, \"%s\")", fd, pair->first.c_str()) : text::format("fsetxattr(%d, %s, \"%s\")", fd, pair->first.c_str(), pair->second.c_str())).c_str()); + perror((pair.second == NULL_STR ? text::format("fremovexattr(%d, \"%s\")", fd, pair.first.c_str()) : text::format("fsetxattr(%d, %s, \"%s\")", fd, pair.first.c_str(), pair.second.c_str())).c_str()); } } close(fd); @@ -847,10 +847,10 @@ namespace path { lutimes(basePath.c_str(), NULL); - citerate(entry, path::entries(basePath)) + for(auto const& entry : path::entries(basePath)) { - std::string path = path::join(basePath, (*entry)->d_name); - int type = (*entry)->d_type; + std::string path = path::join(basePath, entry->d_name); + int type = entry->d_type; if(type == DT_DIR) touch_tree(path); if(type == DT_LNK || type == DT_REG) diff --git a/Frameworks/io/tests/t_events.cc b/Frameworks/io/tests/t_events.cc index d29855c1..e7b9b969 100644 --- a/Frameworks/io/tests/t_events.cc +++ b/Frameworks/io/tests/t_events.cc @@ -44,8 +44,8 @@ struct callback_t : fs::event_callback_t if(_log) { fprintf(stderr, "observing ‘%s’\n", observedPath.c_str()); - iterate(path, _must_see) - fprintf(stderr, "\tmust see: %s\n", path::relative_to(*path, _jail.path()).c_str()); + for(auto const& path : _must_see) + fprintf(stderr, "\tmust see: %s\n", path::relative_to(path, _jail.path()).c_str()); fprintf(stderr, "starting event loop:\n"); } @@ -53,8 +53,8 @@ struct callback_t : fs::event_callback_t { if(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5, false) == kCFRunLoopRunTimedOut) { - iterate(path, _must_see) - fprintf(stderr, "*** waiting: %s\n", path::relative_to(*path, _jail.path()).c_str()); + for(auto const& path : _must_see) + fprintf(stderr, "*** waiting: %s\n", path::relative_to(path, _jail.path()).c_str()); } } diff --git a/Frameworks/layout/src/ct.cc b/Frameworks/layout/src/ct.cc index 0c035121..ed37e88a 100644 --- a/Frameworks/layout/src/ct.cc +++ b/Frameworks/layout/src/ct.cc @@ -23,10 +23,10 @@ namespace ng if(_spelling_dot) CFRelease(_spelling_dot); - iterate(pair, _folding_dots_cache) + for(auto const& pair : _folding_dots_cache) { - if(pair->second) - CFRelease(pair->second); + if(pair.second) + CFRelease(pair.second); } } @@ -168,17 +168,17 @@ namespace ct void line_t::draw_foreground (CGPoint pos, ng::context_t const& context, bool isFlipped, std::vector< std::pair > const& misspelled) const { - iterate(pair, _underlines) // Draw our own underline since CoreText does an awful job + for(auto const& pair : _underlines) // Draw our own underline since CoreText does an awful job { - CGFloat x1 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair->first.location, NULL)); - CGFloat x2 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair->first.location + pair->first.length, NULL)); - render::fill_rect(context, pair->second.get(), CGRectMake(x1, pos.y + 1, x2 - x1, 1)); + CGFloat x1 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair.first.location, NULL)); + CGFloat x2 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair.first.location + pair.first.length, NULL)); + render::fill_rect(context, pair.second.get(), CGRectMake(x1, pos.y + 1, x2 - x1, 1)); } - iterate(pair, misspelled) + for(auto const& pair : misspelled) { - CFIndex location = utf16::distance(_text.begin(), _text.begin() + pair->first); - CFIndex length = utf16::distance(_text.begin() + pair->first, _text.begin() + pair->second); + CFIndex location = utf16::distance(_text.begin(), _text.begin() + pair.first); + CFIndex length = utf16::distance(_text.begin() + pair.first, _text.begin() + pair.second); CGFloat x1 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), location, NULL)); CGFloat x2 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), location + length, NULL)); draw_spelling_dot(context, CGRectMake(x1, pos.y + 1, x2 - x1, 3), isFlipped); @@ -194,14 +194,14 @@ namespace ct void line_t::draw_background (CGPoint pos, CGFloat height, ng::context_t const& context, bool isFlipped, CGColorRef currentBackground) const { - iterate(pair, _backgrounds) + for(auto const& pair : _backgrounds) { - if(CFEqual(currentBackground, pair->second.get())) + if(CFEqual(currentBackground, pair.second.get())) continue; - CGFloat x1 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair->first.location, NULL)); - CGFloat x2 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair->first.location + pair->first.length, NULL)); - render::fill_rect(context, pair->second.get(), CGRectMake(x1, pos.y, x2 - x1, height)); + CGFloat x1 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair.first.location, NULL)); + CGFloat x2 = round(pos.x + CTLineGetOffsetForStringIndex(_line.get(), pair.first.location + pair.first.length, NULL)); + render::fill_rect(context, pair.second.get(), CGRectMake(x1, pos.y, x2 - x1, height)); } } diff --git a/Frameworks/layout/src/folds.cc b/Frameworks/layout/src/folds.cc index 24fd81b6..705ffe48 100644 --- a/Frameworks/layout/src/folds.cc +++ b/Frameworks/layout/src/folds.cc @@ -19,8 +19,8 @@ namespace ng std::string folds_t::folded_as_string () const { std::vector v; - iterate(pair, _folded) - v.push_back(text::format("(%zu,%zu)", pair->first, pair->second)); + for(auto const& pair : _folded) + v.push_back(text::format("(%zu,%zu)", pair.first, pair.second)); return v.empty() ? NULL_STR : "(" + text::join(v, ",") + ")"; } @@ -32,9 +32,9 @@ namespace ng bool validRanges = true; std::vector< std::pair > newFoldings; - iterate(pair, *array) + for(auto const& pair : *array) { - if(plist::array_t const* value = boost::get(&*pair)) + if(plist::array_t const* value = boost::get(&pair)) { int32_t const* from = value->size() == 2 ? boost::get(&(*value)[0]) : NULL; int32_t const* to = value->size() == 2 ? boost::get(&(*value)[1]) : NULL; @@ -56,9 +56,9 @@ namespace ng bool folds_t::has_folded (size_t n) const { size_t bol = _buffer.begin(n), eol = _buffer.eol(n); - iterate(pair, _folded) + for(auto const& pair : _folded) { - if(pair->first <= bol && bol <= pair->second || pair->first <= eol && eol <= pair->second) + if(pair.first <= bol && bol <= pair.second || pair.first <= eol && eol <= pair.second) return true; } return false; @@ -89,24 +89,24 @@ namespace ng std::sort(_folded.begin(), _folded.end()); std::map tmp; - iterate(pair, _folded) + for(auto const& pair : _folded) { - ++tmp[pair->first]; - --tmp[pair->second]; + ++tmp[pair.first]; + --tmp[pair.second]; } _legacy.clear(); ssize_t level = 0; - iterate(pair, tmp) + for(auto const& pair : tmp) { - if(pair->second == 0) + if(pair.second == 0) continue; - if(level == 0 && pair->second > 0) - _legacy.set(pair->first, true); - level += pair->second; + if(level == 0 && pair.second > 0) + _legacy.set(pair.first, true); + level += pair.second; if(level == 0) - _legacy.set(pair->first, false); + _legacy.set(pair.first, false); } } @@ -126,11 +126,11 @@ namespace ng bool found = false; std::vector< std::pair > res, newFoldings; - iterate(pair, _folded) + for(auto const& pair : _folded) { - if(from == pair->first && pair->second <= to || from <= pair->first && pair->second == to) + if(from == pair.first && pair.second <= to || from <= pair.first && pair.second == to) found = true; - else newFoldings.push_back(*pair); + else newFoldings.push_back(pair); } if(found) @@ -143,11 +143,11 @@ namespace ng { std::vector< std::pair > res, newFoldings; - iterate(pair, _folded) + for(auto const& pair : _folded) { - if(pair->first <= from && from < pair->second || pair->first < to && to <= pair->second) - res.push_back(*pair); - else newFoldings.push_back(*pair); + if(pair.first <= from && from < pair.second || pair.first < to && to <= pair.second) + res.push_back(pair); + else newFoldings.push_back(pair); } set_folded(newFoldings); @@ -162,16 +162,16 @@ namespace ng { size_t bol = _buffer.begin(n), eol = _buffer.eol(n); std::vector< std::pair > newFoldings; - iterate(pair, _folded) + for(auto const& pair : _folded) { - if(oak::cap(pair->first, bol, pair->second) == bol || oak::cap(pair->first, eol, pair->second) == eol) + if(oak::cap(pair.first, bol, pair.second) == bol || oak::cap(pair.first, eol, pair.second) == eol) { if(res.first == res.second) - res = *pair; + res = pair; } - else if(!recursive || !(res.first <= pair->first && pair->second <= res.second)) + else if(!recursive || !(res.first <= pair.first && pair.second <= res.second)) { - newFoldings.push_back(*pair); + newFoldings.push_back(pair); } } set_folded(newFoldings); @@ -183,10 +183,10 @@ namespace ng { if(recursive) { - citerate(pair, foldable_ranges()) + for(auto const& pair : foldable_ranges()) { - if(res.first <= pair->first && pair->second <= res.second) - fold(pair->first, pair->second); + if(res.first <= pair.first && pair.second <= res.second) + fold(pair.first, pair.second); } } else @@ -204,14 +204,14 @@ namespace ng std::vector< std::pair > const& folded = _folded; std::vector< std::pair > unfolded, canFoldAtLevel, foldedAtLevel, nestingStack; - citerate(pair, foldable_ranges()) + for(auto const& pair : foldable_ranges()) { - while(!nestingStack.empty() && nestingStack.back().second <= pair->first) + while(!nestingStack.empty() && nestingStack.back().second <= pair.first) nestingStack.pop_back(); - nestingStack.push_back(*pair); + nestingStack.push_back(pair); if(level == 0 || level == nestingStack.size()) - unfolded.push_back(*pair); + unfolded.push_back(pair); } std::sort(unfolded.begin(), unfolded.end()); @@ -220,8 +220,8 @@ namespace ng if(canFoldAtLevel.size() >= foldedAtLevel.size()) { - iterate(pair, canFoldAtLevel) - fold(pair->first, pair->second); + for(auto const& pair : canFoldAtLevel) + fold(pair.first, pair.second); return canFoldAtLevel; } @@ -239,9 +239,9 @@ namespace ng { std::vector< std::pair > newFoldings; ssize_t delta = str.size() - (to - from); - iterate(pair, _folded) + for(auto const& pair : _folded) { - ssize_t foldFrom = pair->first, foldTo = pair->second; + ssize_t foldFrom = pair.first, foldTo = pair.second; if(to <= foldFrom) newFoldings.push_back(std::make_pair(foldFrom + delta, foldTo + delta)); else if(foldFrom <= from && to <= foldTo && delta != foldFrom - foldTo) @@ -282,9 +282,9 @@ namespace ng bool folds_t::integrity () const { - iterate(info, _levels) + for(auto const& info : _levels) { - size_t pos = info->offset + info->key; + size_t pos = info.offset + info.key; if(_buffer.size() < pos || _buffer.convert(pos).column != 0) { size_t n = _buffer.convert(pos).line; @@ -346,14 +346,14 @@ namespace ng std::sort(res.begin(), res.end()); std::vector< std::pair > nestingStack, unique; - citerate(pair, res) + for(auto const& pair : res) { - while(!nestingStack.empty() && nestingStack.back().second <= pair->first) + while(!nestingStack.empty() && nestingStack.back().second <= pair.first) nestingStack.pop_back(); - if(!nestingStack.empty() && nestingStack.back().second < pair->second) + if(!nestingStack.empty() && nestingStack.back().second < pair.second) continue; - nestingStack.push_back(*pair); - unique.push_back(*pair); + nestingStack.push_back(pair); + unique.push_back(pair); } return unique; } @@ -363,10 +363,10 @@ namespace ng std::pair res(0, 0); size_t bol = _buffer.begin(n), eol = _buffer.eol(n); - citerate(pair, foldable_ranges()) + for(auto const& pair : foldable_ranges()) { - if(oak::cap(pair->first, bol, pair->second) == bol || oak::cap(pair->first, eol, pair->second) == eol) - res = *pair; + if(oak::cap(pair.first, bol, pair.second) == bol || oak::cap(pair.first, eol, pair.second) == eol) + res = pair; } return res; } @@ -395,11 +395,11 @@ namespace ng if(!didFindPatterns) // legacy — this has bad performance { - citerate(item, bundles::query(bundles::kFieldGrammarScope, to_s(buffer.scope(0, false).left), scope::wildcard, bundles::kItemTypeGrammar)) + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, to_s(buffer.scope(0, false).left), scope::wildcard, bundles::kItemTypeGrammar)) { std::string foldingStartMarker = NULL_STR, foldingStopMarker = NULL_STR; - plist::get_key_path((*item)->plist(), "foldingStartMarker", foldingStartMarker); - plist::get_key_path((*item)->plist(), "foldingStopMarker", foldingStopMarker); + plist::get_key_path(item->plist(), "foldingStartMarker", foldingStartMarker); + plist::get_key_path(item->plist(), "foldingStopMarker", foldingStopMarker); startPattern = foldingStartMarker; stopPattern = foldingStopMarker; } diff --git a/Frameworks/layout/src/layout.cc b/Frameworks/layout/src/layout.cc index aba6dc18..953f7bc7 100644 --- a/Frameworks/layout/src/layout.cc +++ b/Frameworks/layout/src/layout.cc @@ -950,9 +950,9 @@ namespace ng bool layout_t::structural_integrity () const { - iterate(row, _rows) + for(auto const& row : _rows) { - if(!row->value.structural_integrity()) + if(!row.value.structural_integrity()) return false; } return _rows.structural_integrity(); diff --git a/Frameworks/layout/src/paragraph.cc b/Frameworks/layout/src/paragraph.cc index 221733b7..c6d69d59 100644 --- a/Frameworks/layout/src/paragraph.cc +++ b/Frameworks/layout/src/paragraph.cc @@ -282,13 +282,13 @@ namespace ng ASSERT_LE(bufferOffset, from); ASSERT_LE(to, bufferOffset + length()); size_t i = bufferOffset; - iterate(node, _nodes) + for(auto& node : _nodes) { - size_t len = node->length(); + size_t len = node.length(); if(i <= from && from < i + len) { size_t last = std::min(to - i, len); - node->erase(from - i, last); + node.erase(from - i, last); from = i + last; if(to - i <= last) break; @@ -312,10 +312,10 @@ namespace ng void paragraph_t::did_update_scopes (size_t from, size_t to, ng::buffer_t const& buffer, size_t bufferOffset) { size_t i = bufferOffset; - iterate(node, _nodes) + for(auto& node : _nodes) { - node->did_update_scopes(from - i, to - i); - i += node->length(); + node.did_update_scopes(from - i, to - i); + i += node.length(); } _dirty = true; } @@ -327,11 +327,11 @@ namespace ng std::vector newNodes; bool hasFoldings = false; - iterate(node, _nodes) + for(auto const& node : _nodes) { - if(node->type() != kNodeTypeSoftBreak) - newNodes.push_back(*node); - hasFoldings = hasFoldings || node->type() == kNodeTypeFolding; + if(node.type() != kNodeTypeSoftBreak) + newNodes.push_back(node); + hasFoldings = hasFoldings || node.type() == kNodeTypeFolding; } _nodes.swap(newNodes); @@ -373,17 +373,17 @@ namespace ng } } - citerate(offset, text::soft_breaks(str, wrapColumn, tabSize, fillStrWidth)) - _nodes.insert(iterator_at(*offset), node_t(kNodeTypeSoftBreak, 0, fillStrWidth * metrics.column_width())); + for(auto const& offset : text::soft_breaks(str, wrapColumn, tabSize, fillStrWidth)) + _nodes.insert(iterator_at(offset), node_t(kNodeTypeSoftBreak, 0, fillStrWidth * metrics.column_width())); } CGFloat x = 0; size_t i = bufferOffset; - iterate(node, _nodes) + for(auto& node : _nodes) { - node->layout(x, tabSize * metrics.column_width(), theme, softWrap, wrapColumn, metrics, buffer, i, fillStr); - x += node->width(); - i += node->length(); + node.layout(x, tabSize * metrics.column_width(), theme, softWrap, wrapColumn, metrics, buffer, i, fillStr); + x += node.width(); + i += node.length(); } _dirty = false; @@ -475,11 +475,11 @@ namespace ng void paragraph_t::insert_text (size_t i, size_t len) { size_t from = 0; - iterate(node, _nodes) + for(auto& node : _nodes) { - if(from <= i && i <= from + node->length() && node->type() == kNodeTypeText) - return node->insert(i - from, len); - from += node->length(); + if(from <= i && i <= from + node.length() && node.type() == kNodeTypeText) + return node.insert(i - from, len); + from += node.length(); } _nodes.insert(iterator_at(i), node_t(kNodeTypeText, len)); } @@ -524,26 +524,26 @@ namespace ng void paragraph_t::reset_font_metrics (ct::metrics_t const& metrics) { _dirty = true; - iterate(node, _nodes) - node->reset_font_metrics(metrics); + for(auto& node : _nodes) + node.reset_font_metrics(metrics); } size_t paragraph_t::length () const { size_t res = 0; - iterate(node, _nodes) - res += node->length(); + for(auto const& node : _nodes) + res += node.length(); return res; } CGFloat paragraph_t::width () const { CGFloat x = 0, res = 0; - iterate(node, _nodes) + for(auto const& node : _nodes) { - if(node->type() == kNodeTypeSoftBreak) + if(node.type() == kNodeTypeSoftBreak) x = 0; - x += node->width(); + x += node.width(); res = std::max(x, res); } return res; @@ -677,12 +677,12 @@ namespace ng { size_t i = bufferOffset; size_t bol = i; - iterate(node, _nodes) + for(auto const& node : _nodes) { if(index < i) break; - i += node->length(); - if(node->type() == kNodeTypeSoftBreak) + i += node.length(); + if(node.type() == kNodeTypeSoftBreak) bol = i; } return bol; @@ -691,13 +691,13 @@ namespace ng size_t paragraph_t::eol (size_t index, ng::buffer_t const& buffer, size_t bufferOffset) const { size_t i = bufferOffset; - iterate(node, _nodes) + for(auto const& node : _nodes) { - if(index < i && node->type() == kNodeTypeSoftBreak) + if(index < i && node.type() == kNodeTypeSoftBreak) return i - buffer[i-1].size(); - if(index <= i && node->type() == kNodeTypeNewline) + if(index <= i && node.type() == kNodeTypeNewline) return i; - i += node->length(); + i += node.length(); } return i; } @@ -708,11 +708,11 @@ namespace ng index -= buffer[index-1].size();; size_t i = bufferOffset; - iterate(node, _nodes) + for(auto const& node : _nodes) { - if(i < index && index < i + node->length() && node->type() == kNodeTypeFolding) + if(i < index && index < i + node.length() && node.type() == kNodeTypeFolding) return i; - i += node->length(); + i += node.length(); } return index; @@ -724,11 +724,11 @@ namespace ng index += buffer[index].size(); size_t i = bufferOffset; - iterate(node, _nodes) + for(auto const& node : _nodes) { - if(i < index && index < i + node->length() && node->type() == kNodeTypeFolding) - return i + node->length(); - i += node->length(); + if(i < index && index < i + node.length() && node.type() == kNodeTypeFolding) + return i + node.length(); + i += node.length(); } return index; @@ -773,8 +773,8 @@ namespace ng if(flag) { bool intersects = false; - iterate(range, selection) - intersects = intersects || !(to + offset < range->min().index || range->max().index < from + offset); + for(auto const& range : selection) + intersects = intersects || !(to + offset < range.min().index || range.max().index < from + offset); if(!intersects) misspelled.push_back(std::make_pair(from, to)); diff --git a/Frameworks/layout/tests/gui_layout.mm b/Frameworks/layout/tests/gui_layout.mm index dbe94f01..62c4bfb1 100644 --- a/Frameworks/layout/tests/gui_layout.mm +++ b/Frameworks/layout/tests/gui_layout.mm @@ -76,8 +76,8 @@ struct refresh_t auto damagedRects = _layout.end_refresh_cycle([_self selection], [_self visibleRect]); TS_ASSERT(_layout.structural_integrity()); [_self updateFrameSize]; - iterate(rect, damagedRects) - [_self setNeedsDisplayInRect:*rect]; + for(auto const& rect : damagedRects) + [_self setNeedsDisplayInRect:rect]; if(!NSContainsRect([_self visibleRect], _layout.rect_at_index([_self selection].last().last))) [_self scrollRectToVisible:NSInsetRect(_layout.rect_at_index([_self selection].last().last), -15, -15)]; @@ -129,8 +129,8 @@ private: static buffer_refresh_callback_t cb(self); buffer.add_callback(&cb); - citerate(item, bundles::query(bundles::kFieldGrammarScope, "source.c++")) - buffer.set_grammar(*item); + for(auto const& item : bundles::query(bundles::kFieldGrammarScope, "source.c++")) + buffer.set_grammar(item); theme_ptr theme = parse_theme(bundles::lookup("71D40D9D-AE48-11D9-920A-000D93589AF6")); theme = theme->copy_with_font_name_and_size("Gill Sans", 14); @@ -195,17 +195,17 @@ private: static ng::ranges_t res; res = ng::ranges_t(); ssize_t offset = 0; - citerate(range, dissect_columnar(buffer, someRanges).sorted()) + for(auto const& range : dissect_columnar(buffer, someRanges).sorted()) { - ng::index_t from = range->min(), to = range->max(); - if(range->freehanded && from.carry) + ng::index_t from = range.min(), to = range.max(); + if(range.freehanded && from.carry) { buffer.replace(from.index + offset, from.index + offset, std::string(from.carry, ' ')); offset += from.carry; } res.push_back(buffer.replace(from.index + offset, to.index + offset, aString)); - offset += aString.size() - (range->max().index - range->min().index); + offset += aString.size() - (range.max().index - range.min().index); } return res; } diff --git a/Frameworks/layout/tests/t_basic_tree_delta.cc b/Frameworks/layout/tests/t_basic_tree_delta.cc index 638d939d..e0d16b94 100644 --- a/Frameworks/layout/tests/t_basic_tree_delta.cc +++ b/Frameworks/layout/tests/t_basic_tree_delta.cc @@ -64,8 +64,8 @@ void test_basic_tree_delta () // test primary key std::string buf = ""; - iterate(it, tree) - buf.insert(buf.size(), buffer.substr(it->offset.buffer_size, it->key.buffer_size)); + for(auto const& it : tree) + buf.insert(buf.size(), buffer.substr(it.offset.buffer_size, it.key.buffer_size)); OAK_ASSERT_EQ(buf, buffer); buf = ""; diff --git a/Frameworks/layout/tests/t_basic_tree_numeric.cc b/Frameworks/layout/tests/t_basic_tree_numeric.cc index 905c33c3..508aafc7 100644 --- a/Frameworks/layout/tests/t_basic_tree_numeric.cc +++ b/Frameworks/layout/tests/t_basic_tree_numeric.cc @@ -95,10 +95,10 @@ void test_erase () OAK_ASSERT(std::equal(tree.begin(), tree.end(), keys.begin(), &numeric_bin_comp)); std::random_shuffle(keys.begin(), keys.end()); - iterate(key, keys) + for(auto const& key : keys) { - OAK_ASSERT(tree.find(*key, &numeric_comp) != tree.end()); - tree.erase(tree.find(*key, &numeric_comp)); + OAK_ASSERT(tree.find(key, &numeric_comp) != tree.end()); + tree.erase(tree.find(key, &numeric_comp)); OAK_ASSERT(tree.structural_integrity()); } @@ -118,18 +118,18 @@ void test_search () nonExistingKeys.insert(key); } - iterate(key, existingKeys) + for(auto const& key : existingKeys) { - OAK_ASSERT(tree.find(*key, &numeric_comp) != tree.end()); - OAK_ASSERT_EQ(tree.find(*key, &numeric_comp)->key, *key); + OAK_ASSERT(tree.find(key, &numeric_comp) != tree.end()); + OAK_ASSERT_EQ(tree.find(key, &numeric_comp)->key, key); - OAK_ASSERT(tree.lower_bound(*key, &numeric_comp) != tree.end()); - OAK_ASSERT_EQ(tree.lower_bound(*key, &numeric_comp)->key, *key); + OAK_ASSERT(tree.lower_bound(key, &numeric_comp) != tree.end()); + OAK_ASSERT_EQ(tree.lower_bound(key, &numeric_comp)->key, key); - OAK_ASSERT(tree.upper_bound(*key, &numeric_comp) == ++tree.find(*key, &numeric_comp)); - if(++tree.find(*key, &numeric_comp) != tree.end()) + OAK_ASSERT(tree.upper_bound(key, &numeric_comp) == ++tree.find(key, &numeric_comp)); + if(++tree.find(key, &numeric_comp) != tree.end()) { - OAK_ASSERT_LT(*key, tree.upper_bound(*key, &numeric_comp)->key); + OAK_ASSERT_LT(key, tree.upper_bound(key, &numeric_comp)->key); } } @@ -137,25 +137,25 @@ void test_search () // = find = // ======== - iterate(key, nonExistingKeys) + for(auto const& key : nonExistingKeys) { - OAK_ASSERT(tree.find(*key, &numeric_comp) == tree.end()); + OAK_ASSERT(tree.find(key, &numeric_comp) == tree.end()); } // =============== // = lower bound = // =============== - iterate(key, nonExistingKeys) + for(auto const& key : nonExistingKeys) { - if(existingKeys.lower_bound(*key) == existingKeys.end()) + if(existingKeys.lower_bound(key) == existingKeys.end()) { - OAK_ASSERT(tree.lower_bound(*key, &numeric_comp) == tree.end()); + OAK_ASSERT(tree.lower_bound(key, &numeric_comp) == tree.end()); } else { - OAK_ASSERT_LE(*key, tree.lower_bound(*key, &numeric_comp)->key); - OAK_ASSERT_EQ(tree.lower_bound(*key, &numeric_comp)->key, *existingKeys.lower_bound(*key)); + OAK_ASSERT_LE(key, tree.lower_bound(key, &numeric_comp)->key); + OAK_ASSERT_EQ(tree.lower_bound(key, &numeric_comp)->key, *existingKeys.lower_bound(key)); } } @@ -163,16 +163,16 @@ void test_search () // = upper bound = // =============== - iterate(key, nonExistingKeys) + for(auto const& key : nonExistingKeys) { - if(existingKeys.upper_bound(*key) == existingKeys.end()) + if(existingKeys.upper_bound(key) == existingKeys.end()) { - OAK_ASSERT(tree.upper_bound(*key, &numeric_comp) == tree.end()); + OAK_ASSERT(tree.upper_bound(key, &numeric_comp) == tree.end()); } else { - OAK_ASSERT_LT(*key, tree.upper_bound(*key, &numeric_comp)->key); - OAK_ASSERT_EQ(tree.upper_bound(*key, &numeric_comp)->key, *existingKeys.upper_bound(*key)); + OAK_ASSERT_LT(key, tree.upper_bound(key, &numeric_comp)->key); + OAK_ASSERT_EQ(tree.upper_bound(key, &numeric_comp)->key, *existingKeys.upper_bound(key)); } } } diff --git a/Frameworks/layout/tests/t_basic_tree_range.cc b/Frameworks/layout/tests/t_basic_tree_range.cc index a75829d0..50faa320 100644 --- a/Frameworks/layout/tests/t_basic_tree_range.cc +++ b/Frameworks/layout/tests/t_basic_tree_range.cc @@ -97,12 +97,12 @@ void test_range_tree () std::random_shuffle(keys.begin(), keys.end()); tree_t tree; - iterate(key, keys) - set(tree, *key); + for(auto const& key : keys) + set(tree, key); std::vector fromTree; - iterate(it, tree) - fromTree.push_back(it->offset.position + it->key.position); + for(auto const& it : tree) + fromTree.push_back(it.offset.position + it.key.position); std::sort(keys.begin(), keys.end()); OAK_ASSERT_EQ(fromTree, keys); @@ -114,15 +114,15 @@ void test_range_tree () std::random_shuffle(keys.begin(), keys.end()); ssize_t pos = keys[0], distance = 200; adjust(tree, pos, distance); - iterate(key, keys) + for(auto& key : keys) { - if(pos <= *key) - *key += distance; + if(pos <= key) + key += distance; } - iterate(key, keys) + for(auto const& key : keys) { - OAK_ASSERT(tree.find(*key, &position_comp) != tree.end()); + OAK_ASSERT(tree.find(key, &position_comp) != tree.end()); } // ======================= @@ -142,7 +142,7 @@ void test_range_tree () OAK_ASSERT_EQ(tree.size(), keys.size()); std::random_shuffle(keys.begin(), keys.end()); - iterate(key, keys) - unset(tree, *key); + for(auto const& key : keys) + unset(tree, key); OAK_ASSERT(tree.empty()); } diff --git a/Frameworks/network/src/download.cc b/Frameworks/network/src/download.cc index 9d676e5e..7775d58a 100644 --- a/Frameworks/network/src/download.cc +++ b/Frameworks/network/src/download.cc @@ -79,11 +79,11 @@ namespace network char const* first = (const char*)ptr; char const* last = std::search(first, first + size * nmemb, &kCRLF[0], &kCRLF[2]); - iterate(filter, userData.request._filters) + for(auto const& filter : userData.request._filters) { - if(!(*filter)->receive_status(std::string(first, last))) + if(!filter->receive_status(std::string(first, last))) { - userData.error = text::format("%s: receiving status", (*filter)->name().c_str()); + userData.error = text::format("%s: receiving status", filter->name().c_str()); return 0; } } @@ -104,11 +104,11 @@ namespace network if(valueFirst != len) { - iterate(filter, userData.request._filters) + for(auto const& filter : userData.request._filters) { - if(!(*filter)->receive_header(text::lowercase(std::string(bytes, bytes + keyLast)), std::string(bytes + valueFirst, bytes + len))) + if(!filter->receive_header(text::lowercase(std::string(bytes, bytes + keyLast)), std::string(bytes + valueFirst, bytes + len))) { - userData.error = text::format("%s: receiving header", (*filter)->name().c_str()); + userData.error = text::format("%s: receiving header", filter->name().c_str()); return 0; } } @@ -120,11 +120,11 @@ namespace network size_t receive_data (void* ptr, size_t size, size_t nmemb, void* udata) { user_data_t& userData = *((user_data_t*)udata); - iterate(filter, userData.request._filters) + for(auto const& filter : userData.request._filters) { - if(!(*filter)->receive_data((const char*)ptr, size * nmemb)) + if(!filter->receive_data((const char*)ptr, size * nmemb)) { - userData.error = text::format("%s: receiving data", (*filter)->name().c_str()); + userData.error = text::format("%s: receiving data", filter->name().c_str()); return 0; } } @@ -133,12 +133,12 @@ namespace network long download (request_t const& request, std::string* error) { - iterate(filter, request._filters) + for(auto const& filter : request._filters) { - if(!(*filter)->setup()) + if(!filter->setup()) { if(error) - *error = text::format("%s: setup", (*filter)->name().c_str()); + *error = text::format("%s: setup", filter->name().c_str()); return 0; } } @@ -194,14 +194,14 @@ namespace network { if(res == 304) // not modified so ignore filter errors { - iterate(filter, request._filters) - (*filter)->receive_end(userData.error); + for(auto const& filter : request._filters) + filter->receive_end(userData.error); } else { - iterate(filter, request._filters) + for(auto const& filter : request._filters) { - if(!(*filter)->receive_end(userData.error)) + if(!filter->receive_end(userData.error)) { if(error) *error = userData.error; diff --git a/Frameworks/network/src/key_chain.cc b/Frameworks/network/src/key_chain.cc index 5b3129d5..79a45b8e 100644 --- a/Frameworks/network/src/key_chain.cc +++ b/Frameworks/network/src/key_chain.cc @@ -78,16 +78,16 @@ void key_chain_t::load (std::string const& path) plist::dictionary_t identities; if(plist::get_key_path(plist::load(path), "identities", identities)) { - iterate(identity, identities) + for(auto const& identity : identities) { std::string name, keyData; - if(plist::get_key_path(identity->second, "name", name) && plist::get_key_path(identity->second, "key", keyData)) + if(plist::get_key_path(identity.second, "name", name) && plist::get_key_path(identity.second, "key", keyData)) { - keys.push_back(std::make_shared(identity->first, name, keyData)); + keys.push_back(std::make_shared(identity.first, name, keyData)); } else { - fprintf(stderr, "no name/key in entry:\n%s", to_s(identity->second).c_str()); + fprintf(stderr, "no name/key in entry:\n%s", to_s(identity.second).c_str()); } } } @@ -100,12 +100,12 @@ void key_chain_t::load (std::string const& path) void key_chain_t::save (std::string const& path) const { plist::dictionary_t identities; - iterate(key, keys) + for(auto const& key : keys) { plist::dictionary_t entry; - entry.emplace("name", (*key)->name()); - entry.emplace("key", (*key)->_key_data); - identities.emplace((*key)->identity(), entry); + entry.emplace("name", key->name()); + entry.emplace("key", key->_key_data); + identities.emplace(key->identity(), entry); } plist::dictionary_t plist; @@ -121,10 +121,10 @@ void key_chain_t::add (key_t const& key) key_chain_t::key_ptr key_chain_t::find (std::string const& identity) const { - iterate(key, keys) + for(auto const& key : keys) { - if((*key)->identity() == identity && (*key)->setup()) - return *key; + if(key->identity() == identity && key->setup()) + return key; } return key_ptr(); } diff --git a/Frameworks/network/src/post.cc b/Frameworks/network/src/post.cc index c02620dd..8e31e4a3 100644 --- a/Frameworks/network/src/post.cc +++ b/Frameworks/network/src/post.cc @@ -25,23 +25,23 @@ long post_to_server (std::string const& url, std::map struct curl_httppost* formpost = NULL; struct curl_httppost* lastptr = NULL; - iterate(pair, payload) + for(auto const& pair : payload) { - if(pair->second.find('@') == 0) + if(pair.second.find('@') == 0) { curl_formadd(&formpost, &lastptr, - CURLFORM_PTRNAME, pair->first.data(), - CURLFORM_NAMELENGTH, pair->first.size(), - CURLFORM_FILE, pair->second.substr(1).c_str(), + CURLFORM_PTRNAME, pair.first.data(), + CURLFORM_NAMELENGTH, pair.first.size(), + CURLFORM_FILE, pair.second.substr(1).c_str(), CURLFORM_END); } - else if(pair->second != NULL_STR) + else if(pair.second != NULL_STR) { curl_formadd(&formpost, &lastptr, - CURLFORM_PTRNAME, pair->first.data(), - CURLFORM_NAMELENGTH, pair->first.size(), - CURLFORM_PTRCONTENTS, pair->second.data(), - CURLFORM_CONTENTSLENGTH, pair->second.size(), + CURLFORM_PTRNAME, pair.first.data(), + CURLFORM_NAMELENGTH, pair.first.size(), + CURLFORM_PTRCONTENTS, pair.second.data(), + CURLFORM_CONTENTSLENGTH, pair.second.size(), CURLFORM_END); } } diff --git a/Frameworks/ns/src/to_dictionary.mm b/Frameworks/ns/src/to_dictionary.mm index 8762c5b2..713786cf 100644 --- a/Frameworks/ns/src/to_dictionary.mm +++ b/Frameworks/ns/src/to_dictionary.mm @@ -14,9 +14,9 @@ namespace CFPropertyListRef operator() (plist::array_t const& array) const { CFMutableArrayRef res = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - iterate(it, array) + for(auto const& it : array) { - CFPropertyListRef value = boost::apply_visitor(*this, *it); + CFPropertyListRef value = boost::apply_visitor(*this, it); CFArrayAppendValue(res, value); CFRelease(value); } @@ -26,10 +26,10 @@ namespace CFPropertyListRef operator() (plist::dictionary_t const& dict) const { CFMutableDictionaryRef res = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - iterate(it, dict) + for(auto const& it : dict) { - CFPropertyListRef key = (*this)(it->first); - CFPropertyListRef value = boost::apply_visitor(*this, it->second); + CFPropertyListRef key = (*this)(it.first); + CFPropertyListRef value = boost::apply_visitor(*this, it.second); CFDictionarySetValue(res, key, value); CFRelease(key); CFRelease(value); diff --git a/Frameworks/parse/src/parse.cc b/Frameworks/parse/src/parse.cc index c1947c7b..4c8f4ee9 100644 --- a/Frameworks/parse/src/parse.cc +++ b/Frameworks/parse/src/parse.cc @@ -131,11 +131,11 @@ namespace parse { bool escape = false; std::string res; - iterate(it, ptrn) + for(auto const& it : ptrn) { - if(escape && isdigit(*it)) + if(escape && isdigit(it)) { - int i = digittoint(*it); + int i = digittoint(it); if(!m.empty(i)) escape_regexp(m.buffer() + m.begin(i), m.buffer() + m.end(i), back_inserter(res)); escape = false; @@ -144,8 +144,8 @@ namespace parse if(escape) res += '\\'; - if(!(escape = !escape && *it == '\\')) - res += *it; + if(!(escape = !escape && it == '\\')) + res += it; } D(DBF_Parser, bug("%s → %s\n", ptrn.c_str(), res.c_str());); return res; @@ -209,12 +209,12 @@ namespace parse else ++indexIter; } - iterate(it, rules) + for(auto const& it : rules) { - size_t from = it->first.first; - size_t to = it->first.first - it->first.second; + size_t from = it.first.first; + size_t to = it.first.first - it.first.second; - rule_ptr const& rule = it->second; + rule_ptr const& rule = it.second; if(rule->scope_string != NULL_STR) { std::string const scopeString = expand(rule->scope_string, m); @@ -428,8 +428,8 @@ namespace parse { DB( D(DBF_Parser, bug("offset: %zu\n", i);); - iterate(it, rules) - D(DBF_Parser, bug("\t%zu-%zu, %s\n", it->match.begin(), it->match.end(), to_s(it->rule->match_pattern).c_str());); + for(auto const& it : rules) + D(DBF_Parser, bug("\t%zu-%zu, %s\n", it.match.begin(), it.match.end(), to_s(it.rule->match_pattern).c_str());); ) ranked_match_t m = *rules.begin(); diff --git a/Frameworks/parse/tests/support.h b/Frameworks/parse/tests/support.h index 11ee8b88..90bc619e 100644 --- a/Frameworks/parse/tests/support.h +++ b/Frameworks/parse/tests/support.h @@ -37,8 +37,8 @@ static std::map scopes_for (std::string const& buf, pars std::map scopes; parserState = parse::parse(line.data(), line.data() + line.size(), parserState, scopes, i == 0); - iterate(pair, scopes) - res[i + pair->first] = pair->second; + for(auto const& pair : scopes) + res[i + pair.first] = pair.second; i = eol; } diff --git a/Frameworks/plist/src/plist.cc b/Frameworks/plist/src/plist.cc index 59968d41..0fd6bc55 100644 --- a/Frameworks/plist/src/plist.cc +++ b/Frameworks/plist/src/plist.cc @@ -166,9 +166,9 @@ namespace plist CFPropertyListRef operator() (plist::array_t const& array) const { CFMutableArrayRef res = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - iterate(it, array) + for(auto const& it : array) { - CFPropertyListRef value = boost::apply_visitor(*this, *it); + CFPropertyListRef value = boost::apply_visitor(*this, it); CFArrayAppendValue(res, value); CFRelease(value); } @@ -178,10 +178,10 @@ namespace plist CFPropertyListRef operator() (plist::dictionary_t const& dict) const { CFMutableDictionaryRef res = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - iterate(it, dict) + for(auto const& it : dict) { - CFPropertyListRef key = (*this)(it->first); - CFPropertyListRef value = boost::apply_visitor(*this, it->second); + CFPropertyListRef key = (*this)(it.first); + CFPropertyListRef value = boost::apply_visitor(*this, it.second); CFDictionarySetValue(res, key, value); CFRelease(key); CFRelease(value); diff --git a/Frameworks/plist/src/schema.h b/Frameworks/plist/src/schema.h index 90432a6c..3c21f3ac 100644 --- a/Frameworks/plist/src/schema.h +++ b/Frameworks/plist/src/schema.h @@ -37,10 +37,10 @@ namespace plist template bool schema_t::convert (plist::dictionary_t const& dict, OBJ_TYPE* dst) const { - iterate(pair, dict) + for(auto const& pair : dict) { - typename std::map::const_iterator it = _fields.find(pair->first); - if(it != _fields.end() && !it->second->handle(pair->second, dst)) + typename std::map::const_iterator it = _fields.find(pair.first); + if(it != _fields.end() && !it->second->handle(pair.second, dst)) return false; } return true; diff --git a/Frameworks/plist/src/stl.h b/Frameworks/plist/src/stl.h index 4ca60278..66279b73 100644 --- a/Frameworks/plist/src/stl.h +++ b/Frameworks/plist/src/stl.h @@ -15,8 +15,8 @@ namespace plist array_t to_plist (std::vector const& v) { array_t res; - iterate(it, v) - res.push_back(to_plist(*it)); + for(auto const& it : v) + res.push_back(to_plist(it)); return res; } @@ -24,8 +24,8 @@ namespace plist dictionary_t to_plist (std::map const& map) { dictionary_t res; - iterate(it, map) - res.emplace(it->first, to_plist(it->second)); + for(auto const& it : map) + res.emplace(it.first, to_plist(it.second)); return res; } diff --git a/Frameworks/plist/src/to_s.cc b/Frameworks/plist/src/to_s.cc index 9ee28ce4..5318e313 100644 --- a/Frameworks/plist/src/to_s.cc +++ b/Frameworks/plist/src/to_s.cc @@ -31,10 +31,10 @@ namespace { bool singleLineItems = true; bool compositeItems = false; - iterate(it, array) + for(auto const& it : array) { - singleLineItems = singleLineItems && boost::apply_visitor(*this, *it); - compositeItems = compositeItems || boost::apply_visitor(is_composite(), *it); + singleLineItems = singleLineItems && boost::apply_visitor(*this, it); + compositeItems = compositeItems || boost::apply_visitor(is_composite(), it); } return singleLineItems && (array.size() <= 1 || !compositeItems); } @@ -42,8 +42,8 @@ namespace bool operator() (plist::dictionary_t const& dict) const { bool res = dict.size() <= 1; - iterate(it, dict) - res = res && boost::apply_visitor(*this, it->second); + for(auto const& it : dict) + res = res && boost::apply_visitor(*this, it.second); return res; } }; @@ -108,11 +108,11 @@ static std::string pretty_data (std::vector const& data) { std::string res = "<"; size_t i = 3; - iterate(byte, data) + for(auto const& byte : data) { if(++i != 4 && i % 4 == 0) res.push_back(' '); - text::int_to_hex(*byte, back_inserter(res), 2); + text::int_to_hex(byte, back_inserter(res), 2); } return res + ">"; } @@ -209,7 +209,7 @@ namespace else if(fits_single_line()(array)) { size_t wrap = 0; - iterate(it, array) + for(auto const& it : array) { if(!res.empty()) res += ", "; @@ -221,7 +221,7 @@ namespace wrap = res.size(); } - res += boost::apply_visitor(pretty(flags, key_compare), *it); + res += boost::apply_visitor(pretty(flags, key_compare), it); } res = " " + res + " "; @@ -234,12 +234,12 @@ namespace } else { - iterate(it, array) + for(auto const& it : array) { if(!res.empty()) res += "\n"; res += indent_string() + '\t'; - res += boost::apply_visitor(pretty(flags, key_compare, indent+1, false), *it); + res += boost::apply_visitor(pretty(flags, key_compare, indent+1, false), it); res += ","; } res = "\n" + res + "\n" + indent_string(); @@ -265,12 +265,12 @@ namespace std::vector> values(dict.begin(), dict.end()); std::sort(values.begin(), values.end(), key_compare); - iterate(it, values) + for(auto const& it : values) { if(!res.empty()) res += indent_string(); - std::string const& key = pretty_key(it->first, flags); - std::string const& value = boost::apply_visitor(pretty(flags, key_compare, indent+1, false, true), it->second); + std::string const& key = pretty_key(it.first, flags); + std::string const& value = boost::apply_visitor(pretty(flags, key_compare, indent+1, false, true), it.second); res += text::format("\t%s = %s;\n", key.c_str(), value.c_str()); } res = (is_key ? "\n" + indent_string() : "") + res + indent_string(); diff --git a/Frameworks/regexp/src/find.cc b/Frameworks/regexp/src/find.cc index 28dc8831..4491885b 100644 --- a/Frameworks/regexp/src/find.cc +++ b/Frameworks/regexp/src/find.cc @@ -99,15 +99,15 @@ namespace find { std::vector merged = children, tmp; - iterate(newChildIter, rhs->children) + for(auto const& newChildIter : rhs->children) { - dfa_node_ptr new_node = *newChildIter; + dfa_node_ptr new_node = newChildIter; - iterate(it, merged) + for(auto& it : merged) { - if((*it)->can_merge(new_node)) + if(it->can_merge(new_node)) { - *it = (*it)->merge(new_node); + it = it->merge(new_node); new_node.reset(); break; } @@ -133,8 +133,8 @@ namespace find static void all_variations (CFStringRef src, options_t options, std::vector& out) { CFMutableStringRef strings[6]; - iterate(it, strings) - *it = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, src); + for(auto& it : strings) + it = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, src); CFStringNormalize(strings[0], kCFStringNormalizationFormC); CFStringNormalize(strings[1], kCFStringNormalizationFormC); @@ -151,14 +151,14 @@ namespace find } std::set res; - iterate(it, strings) + for(auto const& it : strings) { - res.insert(res.end(), cf::to_s(*it)); - CFRelease(*it); + res.insert(res.end(), cf::to_s(it)); + CFRelease(it); } - iterate(it, res) - out.push_back(*it); + for(auto const& it : res) + out.push_back(it); } static bool is_whitespace (uint32_t ch) @@ -186,24 +186,24 @@ namespace find if(options & backwards) { std::reverse(matrix.begin(), matrix.end()); - iterate(rowIter, matrix) + for(auto& rowIter : matrix) { - iterate(colIter, *rowIter) - std::reverse(colIter->begin(), colIter->end()); + for(auto& colIter : rowIter) + std::reverse(colIter.begin(), colIter.end()); } } riterate(rowIter, matrix) { std::vector tmp; - iterate(colIter, *rowIter) + for(auto const& colIter : *rowIter) { - dfa_node_ptr new_node = node_from_string(*colIter, children); - iterate(it, tmp) + dfa_node_ptr new_node = node_from_string(colIter, children); + for(auto& it : tmp) { - if((*it)->can_merge(new_node)) + if(it->can_merge(new_node)) { - *it = (*it)->merge(new_node); + it = it->merge(new_node); new_node.reset(); break; } @@ -247,12 +247,12 @@ namespace find } bool did_match = false; - iterate(nodeIter, *current_node) + for(auto const& nodeIter : *current_node) { - if((*nodeIter)->does_match(buf[i])) + if(nodeIter->does_match(buf[i])) { match_data.push_back(buf[i]); - current_node = &(*nodeIter)->descend(); + current_node = &nodeIter->descend(); did_match = true; break; } diff --git a/Frameworks/regexp/src/format_string.cc b/Frameworks/regexp/src/format_string.cc index 8b41d0d3..6c6c3cc6 100644 --- a/Frameworks/regexp/src/format_string.cc +++ b/Frameworks/regexp/src/format_string.cc @@ -32,8 +32,8 @@ struct expand_visitor : boost::static_visitor void traverse (parser::nodes_t const& nodes) { - iterate(it, nodes) - boost::apply_visitor(*this, *it); + for(auto const& it : nodes) + boost::apply_visitor(*this, it); } void handle_case_changes () @@ -45,12 +45,12 @@ struct expand_visitor : boost::static_visitor char const* data = res.data(); size_t prev = 0; parser::case_change::type style = parser::case_change::none; - iterate(it, case_changes) + for(auto const& it : case_changes) { - if(prev < it->first) + if(prev < it.first) { bool only_next = style == parser::case_change::upper_next || style == parser::case_change::lower_next; - char const* to = only_next ? &(diacritics::begin_of(data + prev, data + it->first) + 1) : data + it->first; + char const* to = only_next ? &(diacritics::begin_of(data + prev, data + it.first) + 1) : data + it.first; switch(style) { @@ -60,11 +60,11 @@ struct expand_visitor : boost::static_visitor case parser::case_change::upper: tmp += text::uppercase(std::string(data + prev, to)); break; case parser::case_change::lower: tmp += text::lowercase(std::string(data + prev, to)); break; } - std::copy(to, data + it->first, back_inserter(tmp)); + std::copy(to, data + it.first, back_inserter(tmp)); } - prev = it->first; - style = it->second; + prev = it.first; + style = it.second; } tmp.swap(res); } @@ -235,10 +235,10 @@ struct expand_visitor : boost::static_visitor return; std::vector all_choices; - iterate(it, v.choices) + for(auto const& it : v.choices) { expand_visitor tmp(variables, callback); - tmp.traverse(*it); + tmp.traverse(it); tmp.handle_case_changes(); all_choices.push_back(tmp.res); } diff --git a/Frameworks/regexp/src/glob.cc b/Frameworks/regexp/src/glob.cc index 73027035..7d81919b 100644 --- a/Frameworks/regexp/src/glob.cc +++ b/Frameworks/regexp/src/glob.cc @@ -42,8 +42,8 @@ namespace path _negate = glob.empty() ? false : glob[0] == '!'; std::vector expanded; - citerate(str, expand_braces(_negate ? glob.substr(1) : glob)) - expanded.push_back(format_string::replace(*str, glob_matcher, (matchDotFiles || _negate) ? glob_formater_match_dot_files : glob_formater)); + for(auto const& str : expand_braces(_negate ? glob.substr(1) : glob)) + expanded.push_back(format_string::replace(str, glob_matcher, (matchDotFiles || _negate) ? glob_formater_match_dot_files : glob_formater)); std::string ptrn = "^(.*/)?(" + text::join(expanded, "|") + ")$"; _compiled = regexp::pattern_t(ptrn); @@ -102,10 +102,10 @@ namespace path heads.push_back(""); std::vector res; - iterate(head, heads) + for(auto const& head : heads) { - iterate(tail, tails) - res.push_back(*head + node->text + *tail); + for(auto const& tail : tails) + res.push_back(head + node->text + tail); } return res; diff --git a/Frameworks/regexp/src/regexp.cc b/Frameworks/regexp/src/regexp.cc index a36555da..eddb70ce 100644 --- a/Frameworks/regexp/src/regexp.cc +++ b/Frameworks/regexp/src/regexp.cc @@ -46,9 +46,9 @@ namespace regexp pattern_t::pattern_t (std::string const& pattern, std::string const& str_options) : pattern_string(pattern) { OnigOptionType options = ONIG_OPTION_NONE; - iterate(it, str_options) + for(auto const& it : str_options) { - switch(*it) + switch(it) { case 'e': options |= ONIG_OPTION_EXTEND; break; // case 'g': options |= ONIG_OPTION_REPEAT; break; diff --git a/Frameworks/regexp/src/snippet.cc b/Frameworks/regexp/src/snippet.cc index b0fe30b9..84f8a7b5 100644 --- a/Frameworks/regexp/src/snippet.cc +++ b/Frameworks/regexp/src/snippet.cc @@ -39,35 +39,35 @@ namespace snippet buffer.replace(range.from.offset, range.size(), str); std::vector tmp; - iterate(it, fields) { tmp.push_back(&it->second->range.from); tmp.push_back(&it->second->range.to); } - iterate(it, mirrors) { tmp.push_back(&it->second->range.from); tmp.push_back(&it->second->range.to); } + for(auto const& it : fields) { tmp.push_back(&it.second->range.from); tmp.push_back(&it.second->range.to); } + for(auto const& it : mirrors) { tmp.push_back(&it.second->range.from); tmp.push_back(&it.second->range.to); } - iterate(it, tmp) + for(auto const& it : tmp) { - if(range.contains(**it)) - (*it)->offset = range.from.offset; - else if(range.from < **it) - (*it)->offset = (*it)->offset + str.size() - range.size(); + if(range.contains(*it)) + it->offset = range.from.offset; + else if(range.from < *it) + it->offset = it->offset + str.size() - range.size(); } } static oak::dependency_graph build_graph (std::map const& fields, std::multimap const& mirrors) { oak::dependency_graph graph; - iterate(field, fields) + for(auto const& field : fields) { - graph.add_node(field->first); + graph.add_node(field.first); - iterate(otherField, fields) + for(auto const& otherField : fields) { - if(field->second->range.contains(otherField->second->range)) - graph.add_edge(field->first, otherField->first); + if(field.second->range.contains(otherField.second->range)) + graph.add_edge(field.first, otherField.first); } - iterate(mirror, mirrors) + for(auto const& mirror : mirrors) { - if(field->second->range.contains(mirror->second->range)) - graph.add_edge(field->first, mirror->first); + if(field.second->range.contains(mirror.second->range)) + graph.add_edge(field.first, mirror.first); } } return graph; @@ -76,15 +76,15 @@ namespace snippet void snippet_t::update_mirrors (std::set const& forFields) { oak::dependency_graph const& graph = build_graph(fields, mirrors); - citerate(node, graph.topological_order()) + for(auto const& node : graph.topological_order()) { - if(!forFields.empty() && forFields.find(*node) == forFields.end()) + if(!forFields.empty() && forFields.find(node) == forFields.end()) continue; - std::string const& src = fields[*node]->range.to_s(text); - D(DBF_Snippet, bug("update mirrors of %zu (%s)\n", *node, src.c_str());); + std::string const& src = fields[node]->range.to_s(text); + D(DBF_Snippet, bug("update mirrors of %zu (%s)\n", node, src.c_str());); - foreach(mirror, mirrors.lower_bound(*node), mirrors.upper_bound(*node)) + foreach(mirror, mirrors.lower_bound(node), mirrors.upper_bound(node)) { std::string str = mirror->second->transform(src, variables); str = tabs_to_spaces(str, indent_info.create()); @@ -98,8 +98,8 @@ namespace snippet static void indent (std::string& buffer, std::string const& indent_string, std::map& fields, std::multimap& mirrors) { std::vector positions; - iterate(it, fields) { positions.push_back(&it->second->range.from); positions.push_back(&it->second->range.to); } - iterate(it, mirrors) { positions.push_back(&it->second->range.from); positions.push_back(&it->second->range.to); } + for(auto const& it : fields) { positions.push_back(&it.second->range.from); positions.push_back(&it.second->range.to); } + for(auto const& it : mirrors) { positions.push_back(&it.second->range.from); positions.push_back(&it.second->range.to); } char const* data = buffer.data(); size_t size = buffer.size(); @@ -111,10 +111,10 @@ namespace snippet riterate(pair, lines) { size_t offset = pair->first - data; - iterate(pos, positions) + for(auto const& pos : positions) { - if(offset <= (*pos)->offset) - (*pos)->offset += indent_string.size(); + if(offset <= pos->offset) + pos->offset += indent_string.size(); } D(DBF_Snippet, bug("indent line: %s", buffer.substr(offset, pair->second - pair->first).c_str());); buffer.insert(buffer.begin() + offset, indent_string.begin(), indent_string.end()); @@ -129,8 +129,8 @@ namespace snippet return; std::vector positions; - iterate(it, fields) { positions.push_back(&it->second->range.from); positions.push_back(&it->second->range.to); } - iterate(it, mirrors) { positions.push_back(&it->second->range.from); positions.push_back(&it->second->range.to); } + for(auto const& it : fields) { positions.push_back(&it.second->range.from); positions.push_back(&it.second->range.to); } + for(auto const& it : mirrors) { positions.push_back(&it.second->range.from); positions.push_back(&it.second->range.to); } char const* data = buffer.data(); size_t size = buffer.size(); @@ -144,16 +144,16 @@ namespace snippet std::string newBuffer; size_t lastIndex = 0; - iterate(index, tabStops) + for(auto const& index : tabStops) { - newBuffer.insert(newBuffer.end(), data + lastIndex, data + *index); + newBuffer.insert(newBuffer.end(), data + lastIndex, data + index); newBuffer.append(tabString); - lastIndex = *index + 1; + lastIndex = index + 1; } newBuffer.insert(newBuffer.end(), data + lastIndex, data + size); - iterate(pos, positions) - (*pos)->offset += (tabString.size() - 1) * std::distance(tabStops.begin(), std::lower_bound(tabStops.begin(), tabStops.end(), (*pos)->offset)); + for(auto const& pos : positions) + pos->offset += (tabString.size() - 1) * std::distance(tabStops.begin(), std::lower_bound(tabStops.begin(), tabStops.end(), pos->offset)); buffer.swap(newBuffer); D(DBF_Snippet, bug("new snippet:\n%s\n", buffer.c_str());); @@ -166,10 +166,10 @@ namespace snippet std::transform(mirrors.begin(), mirrors.end(), inserter(known_mirrors, known_mirrors.end()), [](std::pair const& p){ return p.first; }); std::vector to_move; set_difference(known_mirrors.begin(), known_mirrors.end(), known_fields.begin(), known_fields.end(), back_inserter(to_move)); - iterate(it, to_move) + for(auto const& it : to_move) { - fields.insert(*mirrors.lower_bound(*it)); - mirrors.erase(mirrors.lower_bound(*it)); + fields.insert(*mirrors.lower_bound(it)); + mirrors.erase(mirrors.lower_bound(it)); } if(fields.find(0) == fields.end()) @@ -188,11 +188,11 @@ namespace snippet std::set dirty = graph.touch(n); replacements_t updated; - citerate(node, graph.topological_order()) + for(auto const& node : graph.topological_order()) { - if(dirty.find(*node) != dirty.end()) + if(dirty.find(node) != dirty.end()) { - foreach(mirror, mirrors.lower_bound(*node), mirrors.upper_bound(*node)) + foreach(mirror, mirrors.lower_bound(node), mirrors.upper_bound(node)) updated.push_back(std::make_pair(mirror->second->range, std::string())); } } @@ -201,17 +201,17 @@ namespace snippet update_mirrors(dirty); size_t i = 0; - citerate(node, graph.topological_order()) + for(auto const& node : graph.topological_order()) { - if(dirty.find(*node) != dirty.end()) + if(dirty.find(node) != dirty.end()) { - foreach(mirror, mirrors.lower_bound(*node), mirrors.upper_bound(*node)) + foreach(mirror, mirrors.lower_bound(node), mirrors.upper_bound(node)) updated[i++].second = mirror->second->range.to_s(text); } } std::sort(updated.begin(), updated.end()); - D(DBF_Snippet, iterate(it, updated) bug("%2zu-%2zu: %s\n", it->first.from.offset, it->first.to.offset, it->second.c_str());); + D(DBF_Snippet, for(auto const& it : updated) bug("%2zu-%2zu: %s\n", it.first.from.offset, it.first.to.offset, it.second.c_str());); return updated; } @@ -242,8 +242,8 @@ namespace snippet } } - iterate(mirror, mirrors_to_remove) - mirrors.erase(*mirror); + for(auto const& mirror : mirrors_to_remove) + mirrors.erase(mirror); D(DBF_Snippet, bug("replace range %zu (%zu) - %zu (%zu) with ‘%s’\n", currentField.from.offset, currentField.from.rank, currentField.to.offset, currentField.to.rank, str.c_str());); replacements_t const& res = replace_helper(current_field, range, str); @@ -251,21 +251,21 @@ namespace snippet std::vector fields_to_remove; - iterate(field, fields) + for(auto const& field : fields) { - if(currentField.contains(field->second->range)) - fields_to_remove.push_back(field->first); + if(currentField.contains(field.second->range)) + fields_to_remove.push_back(field.first); } - iterate(field, fields_to_remove) + for(auto const& field : fields_to_remove) { - D(DBF_Snippet, bug("remove placeholder: %zu\n", *field);); - fields.erase(fields.find(*field)); - mirrors.erase(mirrors.lower_bound(*field), mirrors.upper_bound(*field)); + D(DBF_Snippet, bug("remove placeholder: %zu\n", field);); + fields.erase(fields.find(field)); + mirrors.erase(mirrors.lower_bound(field), mirrors.upper_bound(field)); } - D(DBF_Snippet, bug("Fields:\n"); iterate(field, fields) bug("\t%zu) %zu (%zu) - %zu (%zu)\n", field->first, field->second->range.from.offset, field->second->range.from.rank, field->second->range.to.offset, field->second->range.to.rank);); - D(DBF_Snippet, bug("Mirrors:\n"); iterate(mirror, mirrors) bug("\t%zu) %zu (%zu) - %zu (%zu)\n", mirror->first, mirror->second->range.from.offset, mirror->second->range.from.rank, mirror->second->range.to.offset, mirror->second->range.to.rank);); + D(DBF_Snippet, bug("Fields:\n"); for(auto const& field : fields) bug("\t%zu) %zu (%zu) - %zu (%zu)\n", field.first, field.second->range.from.offset, field.second->range.from.rank, field.second->range.to.offset, field.second->range.to.rank);); + D(DBF_Snippet, bug("Mirrors:\n"); for(auto const& mirror : mirrors) bug("\t%zu) %zu (%zu) - %zu (%zu)\n", mirror.first, mirror.second->range.from.offset, mirror.second->range.from.rank, mirror.second->range.to.offset, mirror.second->range.to.rank);); return res; } @@ -295,10 +295,10 @@ namespace snippet return res; std::vector offsets(1, 0); - iterate(record, records) - offsets.push_back(offsets.back() + record->snippet.fields[record->snippet.current_field]->range.from.offset + record->caret); + for(auto& record : records) + offsets.push_back(offsets.back() + record.snippet.fields[record.snippet.current_field]->range.from.offset + record.caret); - D(DBF_Snippet_Stack, bug("offsets:\n"); iterate(offset, offsets) bug("\t%zu\n", *offset);); + D(DBF_Snippet_Stack, bug("offsets:\n"); for(auto const& offset : offsets) bug("\t%zu\n", offset);); riterate(record, records) { @@ -310,11 +310,11 @@ namespace snippet local.from.rank = local.to.rank = s.fields[s.current_field]->range.from.rank + 1; std::vector< std::pair > prepend; - citerate(it, s.replace(local, replacement)) + for(auto const& it : s.replace(local, replacement)) { - if(it->first.from < local.from) - prepend.push_back(std::make_pair(it->first + offsets.back(), it->second)); - else res.push_back(std::make_pair(it->first + offsets.back(), it->second)); + if(it.first.from < local.from) + prepend.push_back(std::make_pair(it.first + offsets.back(), it.second)); + else res.push_back(std::make_pair(it.first + offsets.back(), it.second)); } res.insert(res.begin(), prepend.begin(), prepend.end()); diff --git a/Frameworks/scm/src/drivers/api.cc b/Frameworks/scm/src/drivers/api.cc index 45cefe5d..80785f42 100644 --- a/Frameworks/scm/src/drivers/api.cc +++ b/Frameworks/scm/src/drivers/api.cc @@ -23,20 +23,20 @@ namespace scm std::map::const_iterator pathList = variables.find("PATH"); if(pathList != variables.end()) { - citerate(path, text::tokenize(pathList->second.begin(), pathList->second.end(), ':')) - candidates.push_back(path::join(*path, name)); + for(auto const& path : text::tokenize(pathList->second.begin(), pathList->second.end(), ':')) + candidates.push_back(path::join(path, name)); } if(char const* pathList = getenv("PATH")) { - citerate(path, text::tokenize(pathList, pathList + strlen(pathList), ':')) - candidates.push_back(path::join(*path, name)); + for(auto const& path : text::tokenize(pathList, pathList + strlen(pathList), ':')) + candidates.push_back(path::join(path, name)); } - iterate(path, candidates) + for(auto const& path : candidates) { - if(path::is_executable(*path)) - return *path; + if(path::is_executable(path)) + return path; } return NULL_STR; @@ -77,13 +77,13 @@ namespace scm static driver_t* const drivers[] = { git_driver(), hg_driver(), p4_driver(), svn_driver() }; for(std::string cwd = path; cwd != "/"; cwd = path::parent(cwd)) { - iterate(driver, drivers) + for(auto const& driver : drivers) { - if(*driver && (*driver)->has_info_for_directory(cwd)) + if(driver && driver->has_info_for_directory(cwd)) { if(wcPath) *wcPath = cwd; - return *driver; + return driver; } } } diff --git a/Frameworks/scm/src/drivers/git.cc b/Frameworks/scm/src/drivers/git.cc index 3b877b6e..507dad66 100644 --- a/Frameworks/scm/src/drivers/git.cc +++ b/Frameworks/scm/src/drivers/git.cc @@ -178,8 +178,8 @@ namespace } std::vector res; - iterate(pair, tmp) - res.push_back(entry_t(_helper, base + pair->first, pair->second)); + for(auto const& pair : tmp) + res.push_back(entry_t(_helper, base + pair.first, pair.second)); return res; } }; @@ -191,9 +191,9 @@ static scm::status::type status_for (entry_t const& root) return root.status(); size_t untracked = 0, ignored = 0, tracked = 0, modified = 0, added = 0, deleted = 0, mixed = 0, conflicted = 0; - citerate(entry, root.entries()) + for(auto const& entry : root.entries()) { - switch(status_for(*entry)) + switch(status_for(entry)) { case scm::status::conflicted: ++conflicted;break; case scm::status::unversioned: ++untracked; break; @@ -226,12 +226,12 @@ static scm::status::type status_for (entry_t const& root) static void filter (scm::status_map_t& statusMap, entry_t const& root, std::string const& base) { - citerate(entry, root.entries()) + for(auto& entry : root.entries()) { - scm::status::type status = status_for(*entry); - statusMap.emplace(path::join(base, entry->path()), status); - if(entry->is_dir() && status != scm::status::ignored) - filter(statusMap, (*entry)[entry->path()], base); + scm::status::type status = status_for(entry); + statusMap.emplace(path::join(base, entry.path()), status); + if(entry.is_dir() && status != scm::status::ignored) + filter(statusMap, entry[entry.path()], base); } } diff --git a/Frameworks/scm/src/drivers/hg.cc b/Frameworks/scm/src/drivers/hg.cc index a30f0004..a31e1215 100644 --- a/Frameworks/scm/src/drivers/hg.cc +++ b/Frameworks/scm/src/drivers/hg.cc @@ -37,10 +37,10 @@ static void parse_status_output (scm::status_map_t& entries, std::string const& std::vector v = text::split(output, std::string(1, '\0')); ASSERT_EQ(v.back(), ""); v.pop_back(); - iterate(line, v) + for(auto const& line : v) { - ASSERT_EQ((*line)[1], ' '); - entries[line->substr(2)] = parse_status_flag((*line)[0]); + ASSERT_EQ(line[1], ' '); + entries[line.substr(2)] = parse_status_flag(line[0]); } } @@ -77,8 +77,8 @@ namespace scm status_map_t relativePaths, res; collect_all_paths(executable(), relativePaths, wcPath); - iterate(pair, relativePaths) - res.emplace(path::join(wcPath, pair->first), pair->second); + for(auto const& pair : relativePaths) + res.emplace(path::join(wcPath, pair.first), pair.second); return res; } }; diff --git a/Frameworks/scm/src/drivers/svn.cc b/Frameworks/scm/src/drivers/svn.cc index 81cc5faa..1ce22b3f 100644 --- a/Frameworks/scm/src/drivers/svn.cc +++ b/Frameworks/scm/src/drivers/svn.cc @@ -62,11 +62,11 @@ static void parse_status_output (scm::status_map_t& entries, std::string const& static std::map parse_info_output (std::string const& str) { std::map res; - citerate(line, text::tokenize(str.begin(), str.end(), '\n')) + for(auto const& line : text::tokenize(str.begin(), str.end(), '\n')) { - std::string::size_type n = (*line).find(':'); + std::string::size_type n = line.find(':'); if(n != std::string::npos) - res.emplace((*line).substr(0, n), (*line).substr(n+2)); + res.emplace(line.substr(0, n), line.substr(n+2)); } return res; } @@ -133,8 +133,8 @@ namespace scm status_map_t relativePaths, res; collect_all_paths(executable(), _xslt_path, relativePaths, wcPath); - iterate(pair, relativePaths) - res.emplace(path::join(wcPath, pair->first), pair->second); + for(auto const& pair : relativePaths) + res.emplace(path::join(wcPath, pair.first), pair.second); return res; } diff --git a/Frameworks/scm/src/snapshot.cc b/Frameworks/scm/src/snapshot.cc index 77695bef..c88fae38 100644 --- a/Frameworks/scm/src/snapshot.cc +++ b/Frameworks/scm/src/snapshot.cc @@ -23,15 +23,15 @@ namespace fs snapshot_t::nodes_ptr snapshot_t::collect (std::string const& dir) { auto res = std::make_shared>(); - citerate(entry, path::entries(dir)) + for(auto const& entry : path::entries(dir)) { - std::string const path = path::join(dir, (*entry)->d_name); - if((*entry)->d_type == DT_REG) - res->insert(std::make_pair((*entry)->d_ino, node_t((*entry)->d_name, node_t::kNodeTypeFile, modified(path)))); - else if((*entry)->d_type == DT_LNK) - res->insert(std::make_pair((*entry)->d_ino, node_t((*entry)->d_name, node_t::kNodeTypeLink, modified(path)))); - else if((*entry)->d_type == DT_DIR) - res->insert(std::make_pair((*entry)->d_ino, node_t((*entry)->d_name, node_t::kNodeTypeDirectory, modified(path), collect(path)))); + std::string const path = path::join(dir, entry->d_name); + if(entry->d_type == DT_REG) + res->insert(std::make_pair(entry->d_ino, node_t(entry->d_name, node_t::kNodeTypeFile, modified(path)))); + else if(entry->d_type == DT_LNK) + res->insert(std::make_pair(entry->d_ino, node_t(entry->d_name, node_t::kNodeTypeLink, modified(path)))); + else if(entry->d_type == DT_DIR) + res->insert(std::make_pair(entry->d_ino, node_t(entry->d_name, node_t::kNodeTypeDirectory, modified(path), collect(path)))); } return res; } diff --git a/Frameworks/scope/src/match.cc b/Frameworks/scope/src/match.cc index 56ecafcd..d8d1d2a3 100644 --- a/Frameworks/scope/src/match.cc +++ b/Frameworks/scope/src/match.cc @@ -111,15 +111,15 @@ namespace scope if(rank) { double r, sum = 0; - iterate(expr, expressions) + for(auto const& expr : expressions) { - expression_t::op_t op = expr->op; + expression_t::op_t op = expr.op; - bool local = expr->selector->does_match(lhs, rhs, &r); + bool local = expr.selector->does_match(lhs, rhs, &r); if(local) sum = std::max(r, sum); - if(expr->negate) + if(expr.negate) local = !local; switch(op) @@ -137,9 +137,9 @@ namespace scope return res; } - iterate(expr, expressions) + for(auto const& expr : expressions) { - expression_t::op_t op = expr->op; + expression_t::op_t op = expr.op; if(res && op == expression_t::op_or) // skip ORs when we already have a true value continue; else if(!res && op == expression_t::op_and) // skip ANDs when we have a false value @@ -147,8 +147,8 @@ namespace scope else if(!res && op == expression_t::op_minus) // skip intersection when we have a false value continue; - bool local = expr->selector->does_match(lhs, rhs, rank); - if(expr->negate) + bool local = expr.selector->does_match(lhs, rhs, rank); + if(expr.negate) local = !local; switch(op) @@ -168,9 +168,9 @@ namespace scope { bool res = false; double r, sum = 0; - iterate(composite, composites) + for(auto const& composite : composites) { - if(composite->does_match(lhs, rhs, &r)) + if(composite.does_match(lhs, rhs, &r)) { sum = std::max(r, sum); res = true; @@ -181,9 +181,9 @@ namespace scope return res; } - iterate(composite, composites) + for(auto const& composite : composites) { - if(composite->does_match(lhs, rhs, rank)) + if(composite.does_match(lhs, rhs, rank)) return true; } return false; diff --git a/Frameworks/scope/src/types.cc b/Frameworks/scope/src/types.cc index 457e9d03..33cc421f 100644 --- a/Frameworks/scope/src/types.cc +++ b/Frameworks/scope/src/types.cc @@ -10,8 +10,8 @@ namespace scope std::string join (T const& container, std::string const& sep) { std::string res = ""; - iterate(it, container) - res += (res.empty() ? "" : sep) + to_s(*it); + for(auto const& it : container) + res += (res.empty() ? "" : sep) + to_s(it); return res; } diff --git a/Frameworks/selection/src/selection.cc b/Frameworks/selection/src/selection.cc index 0771311f..9d67e291 100644 --- a/Frameworks/selection/src/selection.cc +++ b/Frameworks/selection/src/selection.cc @@ -176,8 +176,8 @@ namespace ng ranges_t convert (buffer_t const& buf, text::selection_t const& sel) { ranges_t res; - iterate(range, sel) - res.push_back(cap(buf, *range)); + for(auto const& range : sel) + res.push_back(cap(buf, range)); return sanitize(buf, res); } @@ -411,31 +411,31 @@ namespace ng bool not_empty (buffer_t const& buffer, ranges_t const& selection) { bool isEmpty = true; - iterate(range, selection) - isEmpty = isEmpty && (range->empty() || (range->columnar && count_columns(buffer, range->first) == count_columns(buffer, range->last))); + for(auto const& range : selection) + isEmpty = isEmpty && (range.empty() || (range.columnar && count_columns(buffer, range.first) == count_columns(buffer, range.last))); return !isEmpty; } bool multiline (buffer_t const& buffer, ranges_t const& selection) { bool isMultiline = false; - iterate(range, selection) - isMultiline = isMultiline || buffer.convert(range->first.index).line != buffer.convert(range->last.index).line; + for(auto const& range : selection) + isMultiline = isMultiline || buffer.convert(range.first.index).line != buffer.convert(range.last.index).line; return isMultiline; } ranges_t dissect_columnar (buffer_t const& buffer, ranges_t const& selection) { ranges_t res; - iterate(range, selection) + for(auto const& range : selection) { - if(range->columnar && !range->empty()) + if(range.columnar && !range.empty()) { - size_t colA = count_columns(buffer, range->first); - size_t colB = count_columns(buffer, range->last); + size_t colA = count_columns(buffer, range.first); + size_t colB = count_columns(buffer, range.last); - size_t lineA = buffer.convert(range->first.index).line; - size_t lineB = buffer.convert(range->last.index).line; + size_t lineA = buffer.convert(range.first.index).line; + size_t lineB = buffer.convert(range.last.index).line; size_t fromLine = std::min(lineA, lineB), fromCol = std::min(colA, colB); size_t toLine = std::max(lineA, lineB), toCol = std::max(colA, colB); @@ -448,7 +448,7 @@ namespace ng } else { - res.push_back(range_t(range->min(), range->max(), range->columnar, range->freehanded)); + res.push_back(range_t(range.min(), range.max(), range.columnar, range.freehanded)); } } return res; @@ -755,25 +755,25 @@ namespace ng bool isRightward = rightward.find(orgUnit) != rightward.end(); ranges_t res; - citerate(range, isLeftward || isRightward ? dissect_columnar(buffer, selection) : selection) + for(auto const& range : isLeftward || isRightward ? dissect_columnar(buffer, selection) : selection) { move_unit_type unit = orgUnit; - index_t index = range->last; - bool freehanded = range->freehanded; + index_t index = range.last; + bool freehanded = range.freehanded; - if(!range->empty()) + if(!range.empty()) { if(isLeftward || isRightward) { - index = isLeftward ? range->min() : range->max(); + index = isLeftward ? range.min() : range.max(); static std::set const left_right = { kSelectionMoveLeft, kSelectionMoveRight, kSelectionMoveFreehandedRight, kSelectionMoveFreehandedLeft }; if(left_right.find(unit) != left_right.end()) unit = kSelectionMoveNowhere; } - else if(!range->columnar && (unit == kSelectionMoveUp || unit == kSelectionMoveDown) && buffer.convert(range->first.index).line != buffer.convert(range->last.index).line) + else if(!range.columnar && (unit == kSelectionMoveUp || unit == kSelectionMoveDown) && buffer.convert(range.first.index).line != buffer.convert(range.last.index).line) { - index = unit == kSelectionMoveUp ? range->min() : range->max(); + index = unit == kSelectionMoveUp ? range.min() : range.max(); if(unit == kSelectionMoveDown && buffer.begin(buffer.convert(index.index).line) == index.index) unit = kSelectionMoveNowhere; } @@ -789,12 +789,12 @@ namespace ng switch(unit) { - case kSelectionMoveToBeginOfSelection: index = range->min(); break; - case kSelectionMoveToEndOfSelection: index = range->max(); break; + case kSelectionMoveToBeginOfSelection: index = range.min(); break; + case kSelectionMoveToEndOfSelection: index = range.max(); break; default: index = move(buffer, index, unit, layout); break; } - if(freehanded && orgUnit == kSelectionMoveLeft && range->empty() && buffer.convert(index.index).line + 1 == buffer.convert(range->last.index).line) + if(freehanded && orgUnit == kSelectionMoveLeft && range.empty() && buffer.convert(index.index).line + 1 == buffer.convert(range.last.index).line) freehanded = false; res.push_back(range_t(index, index, false, freehanded)); @@ -803,16 +803,16 @@ namespace ng if(res.size() > 1 && (orgUnit == kSelectionMoveUp || orgUnit == kSelectionMoveDown)) { std::set lines; - iterate(range, res) - lines.insert(buffer.convert(range->first.index).line); + for(auto const& range : res) + lines.insert(buffer.convert(range.first.index).line); if(lines.size() > 1) { index_t min(SIZE_T_MAX), max(0); - iterate(range, res) + for(auto const& range : res) { - min = std::min(min, range->min()); - max = std::max(max, range->max()); + min = std::min(min, range.min()); + max = std::max(max, range.max()); } res = orgUnit == kSelectionMoveUp ? min : max; } @@ -1021,25 +1021,25 @@ namespace ng bool shouldDissect = isColumnar && splittingUnits.find(unit) != splittingUnits.end(); ranges_t res; - citerate(range, shouldDissect ? dissect_columnar(buffer, selection) : selection) - res.push_back(extend(buffer, *range, unit, layout)); + for(auto const& range : shouldDissect ? dissect_columnar(buffer, selection) : selection) + res.push_back(extend(buffer, range, unit, layout)); return sanitize(buffer, res); } ranges_t extend_if_empty (buffer_t const& buffer, ranges_t const& selection, select_unit_type const unit, layout_movement_t const* layout) { ranges_t res; - iterate(range, selection) + for(auto const& range : selection) { - if(not_empty(buffer, *range)) + if(not_empty(buffer, range)) { - res.push_back(*range); + res.push_back(range); } else { - citerate(r, dissect_columnar(buffer, *range)) + for(auto const& r : dissect_columnar(buffer, range)) { - range_t range = extend(buffer, *r, unit, layout); + range_t range = extend(buffer, r, unit, layout); if(unit == kSelectionExtendToEndOfParagraph && range.empty()) range = extend(buffer, range, kSelectionExtendRight, layout); res.push_back(range); @@ -1075,8 +1075,8 @@ namespace ng ranges_t select_scope (buffer_t const& buffer, ranges_t const& selection, scope::selector_t const& scopeSelector) { ranges_t res; - iterate(range, selection) - res.push_back(select_scope(buffer, *range, scopeSelector)); + for(auto const& range : selection) + res.push_back(select_scope(buffer, range, scopeSelector)); return sanitize(buffer, res); } @@ -1097,9 +1097,9 @@ namespace ng else { scope::scope_t scope; - citerate(range, selection) + for(auto const& range : selection) { - scope::scope_t newScope = shared_prefix(buffer.scope(range->min().index).right, buffer.scope(range->max().index).left); + scope::scope_t newScope = shared_prefix(buffer.scope(range.min().index).right, buffer.scope(range.max().index).left); scope = scope.empty() ? newScope : shared_prefix(scope, newScope); } res = scope; @@ -1200,9 +1200,9 @@ namespace ng static bool is_subset (range_t const& range, ranges_t const& ranges) { - iterate(r, ranges) + for(auto const& r : ranges) { - if(r->min() <= range.min() && range.max() <= r->max()) + if(r.min() <= range.min() && range.max() <= r.max()) return true; } return ranges.empty(); @@ -1218,10 +1218,10 @@ namespace ng find::find_t f(searchFor, (find::options_t)(options & ~find::backwards)); ssize_t total = 0; - iterate(memory, buffer) + for(auto const& memory : buffer) { - char const* buf = (*memory).data(); - size_t len = (*memory).size(); + char const* buf = memory.data(); + size_t len = memory.size(); for(ssize_t offset = 0; offset < len; ) { @@ -1308,10 +1308,10 @@ namespace ng if(options & find::extend_selection) { ng::index_t anchor(options & find::backwards ? buffer.size() : 0); - iterate(range, selection) + for(auto const& range : selection) { - anchor = options & find::backwards ? std::min(range->min(), anchor) : std::max(range->max(), anchor); - res.emplace(*range, std::map()); + anchor = options & find::backwards ? std::min(range.min(), anchor) : std::max(range.max(), anchor); + res.emplace(range, std::map()); } if(options & find::backwards) @@ -1458,20 +1458,20 @@ namespace ng ranges_t from_string (buffer_t const& buffer, std::string const& str) { ranges_t res; - citerate(range, text::selection_t(str)) - res.push_back(range_t(index_t(buffer.convert(range->from), range->from.offset), index_t(buffer.convert(range->to), range->to.offset), range->columnar, range->from.offset || range->to.offset)); + for(auto const& range : text::selection_t(str)) + res.push_back(range_t(index_t(buffer.convert(range.from), range.from.offset), index_t(buffer.convert(range.to), range.to.offset), range.columnar, range.from.offset || range.to.offset)); return res; } std::string to_s (buffer_t const& buffer, ranges_t const& ranges) { text::selection_t res; - iterate(range, ranges) + for(auto const& range : ranges) { - text::pos_t from = buffer.convert(range->first.index), to = buffer.convert(range->last.index); - from.offset = range->freehanded ? range->first.carry : 0; - to.offset = range->freehanded ? range->last.carry : 0; - res.push_back(text::range_t(from, to, range->columnar)); + text::pos_t from = buffer.convert(range.first.index), to = buffer.convert(range.last.index); + from.offset = range.freehanded ? range.first.carry : 0; + to.offset = range.freehanded ? range.last.carry : 0; + res.push_back(text::range_t(from, to, range.columnar)); } return res; } diff --git a/Frameworks/selection/src/types.cc b/Frameworks/selection/src/types.cc index bd96c5ee..0bca915f 100644 --- a/Frameworks/selection/src/types.cc +++ b/Frameworks/selection/src/types.cc @@ -16,8 +16,8 @@ namespace ng std::string to_s (ranges_t const& ranges) { std::vector v; - iterate(range, ranges) - v.push_back(to_s(*range)); + for(auto const& range : ranges) + v.push_back(to_s(range)); return v.empty() ? "(empty)" : text::join(v, "&"); } diff --git a/Frameworks/selection/tests/t_find.cc b/Frameworks/selection/tests/t_find.cc index cc296f02..dd96989f 100644 --- a/Frameworks/selection/tests/t_find.cc +++ b/Frameworks/selection/tests/t_find.cc @@ -45,8 +45,8 @@ static std::string search (std::string const& needle, std::string haystack, find static std::string matches (ng::buffer_t const& buffer, std::string const& str, find::options_t options = find::none, ng::ranges_t const& ranges = ng::ranges_t()) { ng::ranges_t res; - citerate(pair, ng::find(buffer, ranges, str, options | (ranges.empty() ? find::all_matches : find::none))) - res.push_back(pair->first); + for(auto const& pair : ng::find(buffer, ranges, str, options | (ranges.empty() ? find::all_matches : find::none))) + res.push_back(pair.first); return to_s(buffer, res); } diff --git a/Frameworks/settings/src/volume.cc b/Frameworks/settings/src/volume.cc index 8c637c97..fac2c6e7 100644 --- a/Frameworks/settings/src/volume.cc +++ b/Frameworks/settings/src/volume.cc @@ -8,13 +8,13 @@ namespace volume std::map res; if(CFPropertyListRef cfPlist = CFPreferencesCopyAppValue(CFSTR("volumeSettings"), kCFPreferencesCurrentApplication)) { - citerate(pair, plist::convert(cfPlist)) + for(auto const& pair : plist::convert(cfPlist)) { settings_t info; - plist::get_key_path(pair->second, "extendedAttributes", info._extended_attributes); - plist::get_key_path(pair->second, "scmBadges", info._scm_badges); - plist::get_key_path(pair->second, "displayNames", info._display_names); - res.emplace(pair->first, info); + plist::get_key_path(pair.second, "extendedAttributes", info._extended_attributes); + plist::get_key_path(pair.second, "scmBadges", info._scm_badges); + plist::get_key_path(pair.second, "displayNames", info._display_names); + res.emplace(pair.first, info); } CFRelease(cfPlist); } @@ -24,10 +24,10 @@ namespace volume volume::settings_t const& settings (std::string const& path) { static std::map userSettings = settings_t::create(); - iterate(pair, userSettings) + for(auto const& pair : userSettings) { - if(path.find(pair->first) == 0) - return pair->second; + if(path.find(pair.first) == 0) + return pair.second; } static volume::settings_t defaultSettings; diff --git a/Frameworks/settings/tests/t_track_paths.cc b/Frameworks/settings/tests/t_track_paths.cc index ce7b957f..d7eeb944 100644 --- a/Frameworks/settings/tests/t_track_paths.cc +++ b/Frameworks/settings/tests/t_track_paths.cc @@ -32,8 +32,8 @@ void test_track_file () path::set_content(paths[i], ""); track_paths_t tracker; - iterate(path, paths) - tracker.add(*path); + for(auto const& path : paths) + tracker.add(path); usleep(100000); OAK_ASSERT(test_range(tracker, paths, 50, 50)); diff --git a/Frameworks/text/src/ctype.cc b/Frameworks/text/src/ctype.cc index c3d27249..8abfc1a6 100644 --- a/Frameworks/text/src/ctype.cc +++ b/Frameworks/text/src/ctype.cc @@ -7,8 +7,8 @@ static std::set east_asian_width_fixed () static uint32_t Fixed[] = { 0x1100, 0x1101, 0x1102, 0x1103, 0x1104, 0x1105, 0x1106, 0x1107, 0x1108, 0x1109, 0x110A, 0x110B, 0x110C, 0x110D, 0x110E, 0x110F, 0x1110, 0x1111, 0x1112, 0x1113, 0x1114, 0x1115, 0x1116, 0x1117, 0x1118, 0x1119, 0x111A, 0x111B, 0x111C, 0x111D, 0x111E, 0x111F, 0x1120, 0x1121, 0x1122, 0x1123, 0x1124, 0x1125, 0x1126, 0x1127, 0x1128, 0x1129, 0x112A, 0x112B, 0x112C, 0x112D, 0x112E, 0x112F, 0x1130, 0x1131, 0x1132, 0x1133, 0x1134, 0x1135, 0x1136, 0x1137, 0x1138, 0x1139, 0x113A, 0x113B, 0x113C, 0x113D, 0x113E, 0x113F, 0x1140, 0x1141, 0x1142, 0x1143, 0x1144, 0x1145, 0x1146, 0x1147, 0x1148, 0x1149, 0x114A, 0x114B, 0x114C, 0x114D, 0x114E, 0x114F, 0x1150, 0x1151, 0x1152, 0x1153, 0x1154, 0x1155, 0x1156, 0x1157, 0x1158, 0x1159, 0x115A, 0x115B, 0x115C, 0x115D, 0x115E, 0x115F, 0x11A3, 0x11A4, 0x11A5, 0x11A6, 0x11A7, 0x11FA, 0x11FB, 0x11FC, 0x11FD, 0x11FE, 0x11FF, 0x2329, 0x232A, 0x2E80, 0x2E81, 0x2E82, 0x2E83, 0x2E84, 0x2E85, 0x2E86, 0x2E87, 0x2E88, 0x2E89, 0x2E8A, 0x2E8B, 0x2E8C, 0x2E8D, 0x2E8E, 0x2E8F, 0x2E90, 0x2E91, 0x2E92, 0x2E93, 0x2E94, 0x2E95, 0x2E96, 0x2E97, 0x2E98, 0x2E99, 0x2E9B, 0x2E9C, 0x2E9D, 0x2E9E, 0x2E9F, 0x2EA0, 0x2EA1, 0x2EA2, 0x2EA3, 0x2EA4, 0x2EA5, 0x2EA6, 0x2EA7, 0x2EA8, 0x2EA9, 0x2EAA, 0x2EAB, 0x2EAC, 0x2EAD, 0x2EAE, 0x2EAF, 0x2EB0, 0x2EB1, 0x2EB2, 0x2EB3, 0x2EB4, 0x2EB5, 0x2EB6, 0x2EB7, 0x2EB8, 0x2EB9, 0x2EBA, 0x2EBB, 0x2EBC, 0x2EBD, 0x2EBE, 0x2EBF, 0x2EC0, 0x2EC1, 0x2EC2, 0x2EC3, 0x2EC4, 0x2EC5, 0x2EC6, 0x2EC7, 0x2EC8, 0x2EC9, 0x2ECA, 0x2ECB, 0x2ECC, 0x2ECD, 0x2ECE, 0x2ECF, 0x2ED0, 0x2ED1, 0x2ED2, 0x2ED3, 0x2ED4, 0x2ED5, 0x2ED6, 0x2ED7, 0x2ED8, 0x2ED9, 0x2EDA, 0x2EDB, 0x2EDC, 0x2EDD, 0x2EDE, 0x2EDF, 0x2EE0, 0x2EE1, 0x2EE2, 0x2EE3, 0x2EE4, 0x2EE5, 0x2EE6, 0x2EE7, 0x2EE8, 0x2EE9, 0x2EEA, 0x2EEB, 0x2EEC, 0x2EED, 0x2EEE, 0x2EEF, 0x2EF0, 0x2EF1, 0x2EF2, 0x2EF3, 0x2F00, 0x2F01, 0x2F02, 0x2F03, 0x2F04, 0x2F05, 0x2F06, 0x2F07, 0x2F08, 0x2F09, 0x2F0A, 0x2F0B, 0x2F0C, 0x2F0D, 0x2F0E, 0x2F0F, 0x2F10, 0x2F11, 0x2F12, 0x2F13, 0x2F14, 0x2F15, 0x2F16, 0x2F17, 0x2F18, 0x2F19, 0x2F1A, 0x2F1B, 0x2F1C, 0x2F1D, 0x2F1E, 0x2F1F, 0x2F20, 0x2F21, 0x2F22, 0x2F23, 0x2F24, 0x2F25, 0x2F26, 0x2F27, 0x2F28, 0x2F29, 0x2F2A, 0x2F2B, 0x2F2C, 0x2F2D, 0x2F2E, 0x2F2F, 0x2F30, 0x2F31, 0x2F32, 0x2F33, 0x2F34, 0x2F35, 0x2F36, 0x2F37, 0x2F38, 0x2F39, 0x2F3A, 0x2F3B, 0x2F3C, 0x2F3D, 0x2F3E, 0x2F3F, 0x2F40, 0x2F41, 0x2F42, 0x2F43, 0x2F44, 0x2F45, 0x2F46, 0x2F47, 0x2F48, 0x2F49, 0x2F4A, 0x2F4B, 0x2F4C, 0x2F4D, 0x2F4E, 0x2F4F, 0x2F50, 0x2F51, 0x2F52, 0x2F53, 0x2F54, 0x2F55, 0x2F56, 0x2F57, 0x2F58, 0x2F59, 0x2F5A, 0x2F5B, 0x2F5C, 0x2F5D, 0x2F5E, 0x2F5F, 0x2F60, 0x2F61, 0x2F62, 0x2F63, 0x2F64, 0x2F65, 0x2F66, 0x2F67, 0x2F68, 0x2F69, 0x2F6A, 0x2F6B, 0x2F6C, 0x2F6D, 0x2F6E, 0x2F6F, 0x2F70, 0x2F71, 0x2F72, 0x2F73, 0x2F74, 0x2F75, 0x2F76, 0x2F77, 0x2F78, 0x2F79, 0x2F7A, 0x2F7B, 0x2F7C, 0x2F7D, 0x2F7E, 0x2F7F, 0x2F80, 0x2F81, 0x2F82, 0x2F83, 0x2F84, 0x2F85, 0x2F86, 0x2F87, 0x2F88, 0x2F89, 0x2F8A, 0x2F8B, 0x2F8C, 0x2F8D, 0x2F8E, 0x2F8F, 0x2F90, 0x2F91, 0x2F92, 0x2F93, 0x2F94, 0x2F95, 0x2F96, 0x2F97, 0x2F98, 0x2F99, 0x2F9A, 0x2F9B, 0x2F9C, 0x2F9D, 0x2F9E, 0x2F9F, 0x2FA0, 0x2FA1, 0x2FA2, 0x2FA3, 0x2FA4, 0x2FA5, 0x2FA6, 0x2FA7, 0x2FA8, 0x2FA9, 0x2FAA, 0x2FAB, 0x2FAC, 0x2FAD, 0x2FAE, 0x2FAF, 0x2FB0, 0x2FB1, 0x2FB2, 0x2FB3, 0x2FB4, 0x2FB5, 0x2FB6, 0x2FB7, 0x2FB8, 0x2FB9, 0x2FBA, 0x2FBB, 0x2FBC, 0x2FBD, 0x2FBE, 0x2FBF, 0x2FC0, 0x2FC1, 0x2FC2, 0x2FC3, 0x2FC4, 0x2FC5, 0x2FC6, 0x2FC7, 0x2FC8, 0x2FC9, 0x2FCA, 0x2FCB, 0x2FCC, 0x2FCD, 0x2FCE, 0x2FCF, 0x2FD0, 0x2FD1, 0x2FD2, 0x2FD3, 0x2FD4, 0x2FD5, 0x2FF0, 0x2FF1, 0x2FF2, 0x2FF3, 0x2FF4, 0x2FF5, 0x2FF6, 0x2FF7, 0x2FF8, 0x2FF9, 0x2FFA, 0x2FFB, 0x3001, 0x3002, 0x3003, 0x3004, 0x3005, 0x3006, 0x3007, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, 0x300E, 0x300F, 0x3010, 0x3011, 0x3012, 0x3013, 0x3014, 0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301A, 0x301B, 0x301C, 0x301D, 0x301E, 0x301F, 0x3020, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302A, 0x302B, 0x302C, 0x302D, 0x302E, 0x302F, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x303A, 0x303B, 0x303C, 0x303D, 0x303E, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093, 0x3094, 0x3095, 0x3096, 0x3099, 0x309A, 0x309B, 0x309C, 0x309D, 0x309E, 0x309F, 0x30A0, 0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7, 0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF, 0x30B0, 0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7, 0x30B8, 0x30B9, 0x30BA, 0x30BB, 0x30BC, 0x30BD, 0x30BE, 0x30BF, 0x30C0, 0x30C1, 0x30C2, 0x30C3, 0x30C4, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D0, 0x30D1, 0x30D2, 0x30D3, 0x30D4, 0x30D5, 0x30D6, 0x30D7, 0x30D8, 0x30D9, 0x30DA, 0x30DB, 0x30DC, 0x30DD, 0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E3, 0x30E4, 0x30E5, 0x30E6, 0x30E7, 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EE, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, 0x30F7, 0x30F8, 0x30F9, 0x30FA, 0x30FB, 0x30FC, 0x30FD, 0x30FE, 0x30FF, 0x3105, 0x3106, 0x3107, 0x3108, 0x3109, 0x310A, 0x310B, 0x310C, 0x310D, 0x310E, 0x310F, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, 0x3119, 0x311A, 0x311B, 0x311C, 0x311D, 0x311E, 0x311F, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0x312A, 0x312B, 0x312C, 0x312D, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139, 0x313A, 0x313B, 0x313C, 0x313D, 0x313E, 0x313F, 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, 0x3149, 0x314A, 0x314B, 0x314C, 0x314D, 0x314E, 0x314F, 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315A, 0x315B, 0x315C, 0x315D, 0x315E, 0x315F, 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, 0x3169, 0x316A, 0x316B, 0x316C, 0x316D, 0x316E, 0x316F, 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, 0x3179, 0x317A, 0x317B, 0x317C, 0x317D, 0x317E, 0x317F, 0x3180, 0x3181, 0x3182, 0x3183, 0x3184, 0x3185, 0x3186, 0x3187, 0x3188, 0x3189, 0x318A, 0x318B, 0x318C, 0x318D, 0x318E, 0x3190, 0x3191, 0x3192, 0x3193, 0x3194, 0x3195, 0x3196, 0x3197, 0x3198, 0x3199, 0x319A, 0x319B, 0x319C, 0x319D, 0x319E, 0x319F, 0x31A0, 0x31A1, 0x31A2, 0x31A3, 0x31A4, 0x31A5, 0x31A6, 0x31A7, 0x31A8, 0x31A9, 0x31AA, 0x31AB, 0x31AC, 0x31AD, 0x31AE, 0x31AF, 0x31B0, 0x31B1, 0x31B2, 0x31B3, 0x31B4, 0x31B5, 0x31B6, 0x31B7, 0x31B8, 0x31B9, 0x31BA, 0x31C0, 0x31C1, 0x31C2, 0x31C3, 0x31C4, 0x31C5, 0x31C6, 0x31C7, 0x31C8, 0x31C9, 0x31CA, 0x31CB, 0x31CC, 0x31CD, 0x31CE, 0x31CF, 0x31D0, 0x31D1, 0x31D2, 0x31D3, 0x31D4, 0x31D5, 0x31D6, 0x31D7, 0x31D8, 0x31D9, 0x31DA, 0x31DB, 0x31DC, 0x31DD, 0x31DE, 0x31DF, 0x31E0, 0x31E1, 0x31E2, 0x31E3, 0x31F0, 0x31F1, 0x31F2, 0x31F3, 0x31F4, 0x31F5, 0x31F6, 0x31F7, 0x31F8, 0x31F9, 0x31FA, 0x31FB, 0x31FC, 0x31FD, 0x31FE, 0x31FF, 0x3200, 0x3201, 0x3202, 0x3203, 0x3204, 0x3205, 0x3206, 0x3207, 0x3208, 0x3209, 0x320A, 0x320B, 0x320C, 0x320D, 0x320E, 0x320F, 0x3210, 0x3211, 0x3212, 0x3213, 0x3214, 0x3215, 0x3216, 0x3217, 0x3218, 0x3219, 0x321A, 0x321B, 0x321C, 0x321D, 0x321E, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322A, 0x322B, 0x322C, 0x322D, 0x322E, 0x322F, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323A, 0x323B, 0x323C, 0x323D, 0x323E, 0x323F, 0x3240, 0x3241, 0x3242, 0x3243, 0x3244, 0x3245, 0x3246, 0x3247, 0x3250, 0x3251, 0x3252, 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325A, 0x325B, 0x325C, 0x325D, 0x325E, 0x325F, 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326A, 0x326B, 0x326C, 0x326D, 0x326E, 0x326F, 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327A, 0x327B, 0x327C, 0x327D, 0x327E, 0x327F, 0x3280, 0x3281, 0x3282, 0x3283, 0x3284, 0x3285, 0x3286, 0x3287, 0x3288, 0x3289, 0x328A, 0x328B, 0x328C, 0x328D, 0x328E, 0x328F, 0x3290, 0x3291, 0x3292, 0x3293, 0x3294, 0x3295, 0x3296, 0x3297, 0x3298, 0x3299, 0x329A, 0x329B, 0x329C, 0x329D, 0x329E, 0x329F, 0x32A0, 0x32A1, 0x32A2, 0x32A3, 0x32A4, 0x32A5, 0x32A6, 0x32A7, 0x32A8, 0x32A9, 0x32AA, 0x32AB, 0x32AC, 0x32AD, 0x32AE, 0x32AF, 0x32B0, 0x32B1, 0x32B2, 0x32B3, 0x32B4, 0x32B5, 0x32B6, 0x32B7, 0x32B8, 0x32B9, 0x32BA, 0x32BB, 0x32BC, 0x32BD, 0x32BE, 0x32BF, 0x32C0, 0x32C1, 0x32C2, 0x32C3, 0x32C4, 0x32C5, 0x32C6, 0x32C7, 0x32C8, 0x32C9, 0x32CA, 0x32CB, 0x32CC, 0x32CD, 0x32CE, 0x32CF, 0x32D0, 0x32D1, 0x32D2, 0x32D3, 0x32D4, 0x32D5, 0x32D6, 0x32D7, 0x32D8, 0x32D9, 0x32DA, 0x32DB, 0x32DC, 0x32DD, 0x32DE, 0x32DF, 0x32E0, 0x32E1, 0x32E2, 0x32E3, 0x32E4, 0x32E5, 0x32E6, 0x32E7, 0x32E8, 0x32E9, 0x32EA, 0x32EB, 0x32EC, 0x32ED, 0x32EE, 0x32EF, 0x32F0, 0x32F1, 0x32F2, 0x32F3, 0x32F4, 0x32F5, 0x32F6, 0x32F7, 0x32F8, 0x32F9, 0x32FA, 0x32FB, 0x32FC, 0x32FD, 0x32FE, 0x3300, 0x3301, 0x3302, 0x3303, 0x3304, 0x3305, 0x3306, 0x3307, 0x3308, 0x3309, 0x330A, 0x330B, 0x330C, 0x330D, 0x330E, 0x330F, 0x3310, 0x3311, 0x3312, 0x3313, 0x3314, 0x3315, 0x3316, 0x3317, 0x3318, 0x3319, 0x331A, 0x331B, 0x331C, 0x331D, 0x331E, 0x331F, 0x3320, 0x3321, 0x3322, 0x3323, 0x3324, 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332A, 0x332B, 0x332C, 0x332D, 0x332E, 0x332F, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333A, 0x333B, 0x333C, 0x333D, 0x333E, 0x333F, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334A, 0x334B, 0x334C, 0x334D, 0x334E, 0x334F, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335A, 0x335B, 0x335C, 0x335D, 0x335E, 0x335F, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336A, 0x336B, 0x336C, 0x336D, 0x336E, 0x336F, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337A, 0x337B, 0x337C, 0x337D, 0x337E, 0x337F, 0x3380, 0x3381, 0x3382, 0x3383, 0x3384, 0x3385, 0x3386, 0x3387, 0x3388, 0x3389, 0x338A, 0x338B, 0x338C, 0x338D, 0x338E, 0x338F, 0x3390, 0x3391, 0x3392, 0x3393, 0x3394, 0x3395, 0x3396, 0x3397, 0x3398, 0x3399, 0x339A, 0x339B, 0x339C, 0x339D, 0x339E, 0x339F, 0x33A0, 0x33A1, 0x33A2, 0x33A3, 0x33A4, 0x33A5, 0x33A6, 0x33A7, 0x33A8, 0x33A9, 0x33AA, 0x33AB, 0x33AC, 0x33AD, 0x33AE, 0x33AF, 0x33B0, 0x33B1, 0x33B2, 0x33B3, 0x33B4, 0x33B5, 0x33B6, 0x33B7, 0x33B8, 0x33B9, 0x33BA, 0x33BB, 0x33BC, 0x33BD, 0x33BE, 0x33BF, 0x33C0, 0x33C1, 0x33C2, 0x33C3, 0x33C4, 0x33C5, 0x33C6, 0x33C7, 0x33C8, 0x33C9, 0x33CA, 0x33CB, 0x33CC, 0x33CD, 0x33CE, 0x33CF, 0x33D0, 0x33D1, 0x33D2, 0x33D3, 0x33D4, 0x33D5, 0x33D6, 0x33D7, 0x33D8, 0x33D9, 0x33DA, 0x33DB, 0x33DC, 0x33DD, 0x33DE, 0x33DF, 0x33E0, 0x33E1, 0x33E2, 0x33E3, 0x33E4, 0x33E5, 0x33E6, 0x33E7, 0x33E8, 0x33E9, 0x33EA, 0x33EB, 0x33EC, 0x33ED, 0x33EE, 0x33EF, 0x33F0, 0x33F1, 0x33F2, 0x33F3, 0x33F4, 0x33F5, 0x33F6, 0x33F7, 0x33F8, 0x33F9, 0x33FA, 0x33FB, 0x33FC, 0x33FD, 0x33FE, 0x33FF, 0xA000, 0xA001, 0xA002, 0xA003, 0xA004, 0xA005, 0xA006, 0xA007, 0xA008, 0xA009, 0xA00A, 0xA00B, 0xA00C, 0xA00D, 0xA00E, 0xA00F, 0xA010, 0xA011, 0xA012, 0xA013, 0xA014, 0xA015, 0xA016, 0xA017, 0xA018, 0xA019, 0xA01A, 0xA01B, 0xA01C, 0xA01D, 0xA01E, 0xA01F, 0xA020, 0xA021, 0xA022, 0xA023, 0xA024, 0xA025, 0xA026, 0xA027, 0xA028, 0xA029, 0xA02A, 0xA02B, 0xA02C, 0xA02D, 0xA02E, 0xA02F, 0xA030, 0xA031, 0xA032, 0xA033, 0xA034, 0xA035, 0xA036, 0xA037, 0xA038, 0xA039, 0xA03A, 0xA03B, 0xA03C, 0xA03D, 0xA03E, 0xA03F, 0xA040, 0xA041, 0xA042, 0xA043, 0xA044, 0xA045, 0xA046, 0xA047, 0xA048, 0xA049, 0xA04A, 0xA04B, 0xA04C, 0xA04D, 0xA04E, 0xA04F, 0xA050, 0xA051, 0xA052, 0xA053, 0xA054, 0xA055, 0xA056, 0xA057, 0xA058, 0xA059, 0xA05A, 0xA05B, 0xA05C, 0xA05D, 0xA05E, 0xA05F, 0xA060, 0xA061, 0xA062, 0xA063, 0xA064, 0xA065, 0xA066, 0xA067, 0xA068, 0xA069, 0xA06A, 0xA06B, 0xA06C, 0xA06D, 0xA06E, 0xA06F, 0xA070, 0xA071, 0xA072, 0xA073, 0xA074, 0xA075, 0xA076, 0xA077, 0xA078, 0xA079, 0xA07A, 0xA07B, 0xA07C, 0xA07D, 0xA07E, 0xA07F, 0xA080, 0xA081, 0xA082, 0xA083, 0xA084, 0xA085, 0xA086, 0xA087, 0xA088, 0xA089, 0xA08A, 0xA08B, 0xA08C, 0xA08D, 0xA08E, 0xA08F, 0xA090, 0xA091, 0xA092, 0xA093, 0xA094, 0xA095, 0xA096, 0xA097, 0xA098, 0xA099, 0xA09A, 0xA09B, 0xA09C, 0xA09D, 0xA09E, 0xA09F, 0xA0A0, 0xA0A1, 0xA0A2, 0xA0A3, 0xA0A4, 0xA0A5, 0xA0A6, 0xA0A7, 0xA0A8, 0xA0A9, 0xA0AA, 0xA0AB, 0xA0AC, 0xA0AD, 0xA0AE, 0xA0AF, 0xA0B0, 0xA0B1, 0xA0B2, 0xA0B3, 0xA0B4, 0xA0B5, 0xA0B6, 0xA0B7, 0xA0B8, 0xA0B9, 0xA0BA, 0xA0BB, 0xA0BC, 0xA0BD, 0xA0BE, 0xA0BF, 0xA0C0, 0xA0C1, 0xA0C2, 0xA0C3, 0xA0C4, 0xA0C5, 0xA0C6, 0xA0C7, 0xA0C8, 0xA0C9, 0xA0CA, 0xA0CB, 0xA0CC, 0xA0CD, 0xA0CE, 0xA0CF, 0xA0D0, 0xA0D1, 0xA0D2, 0xA0D3, 0xA0D4, 0xA0D5, 0xA0D6, 0xA0D7, 0xA0D8, 0xA0D9, 0xA0DA, 0xA0DB, 0xA0DC, 0xA0DD, 0xA0DE, 0xA0DF, 0xA0E0, 0xA0E1, 0xA0E2, 0xA0E3, 0xA0E4, 0xA0E5, 0xA0E6, 0xA0E7, 0xA0E8, 0xA0E9, 0xA0EA, 0xA0EB, 0xA0EC, 0xA0ED, 0xA0EE, 0xA0EF, 0xA0F0, 0xA0F1, 0xA0F2, 0xA0F3, 0xA0F4, 0xA0F5, 0xA0F6, 0xA0F7, 0xA0F8, 0xA0F9, 0xA0FA, 0xA0FB, 0xA0FC, 0xA0FD, 0xA0FE, 0xA0FF, 0xA100, 0xA101, 0xA102, 0xA103, 0xA104, 0xA105, 0xA106, 0xA107, 0xA108, 0xA109, 0xA10A, 0xA10B, 0xA10C, 0xA10D, 0xA10E, 0xA10F, 0xA110, 0xA111, 0xA112, 0xA113, 0xA114, 0xA115, 0xA116, 0xA117, 0xA118, 0xA119, 0xA11A, 0xA11B, 0xA11C, 0xA11D, 0xA11E, 0xA11F, 0xA120, 0xA121, 0xA122, 0xA123, 0xA124, 0xA125, 0xA126, 0xA127, 0xA128, 0xA129, 0xA12A, 0xA12B, 0xA12C, 0xA12D, 0xA12E, 0xA12F, 0xA130, 0xA131, 0xA132, 0xA133, 0xA134, 0xA135, 0xA136, 0xA137, 0xA138, 0xA139, 0xA13A, 0xA13B, 0xA13C, 0xA13D, 0xA13E, 0xA13F, 0xA140, 0xA141, 0xA142, 0xA143, 0xA144, 0xA145, 0xA146, 0xA147, 0xA148, 0xA149, 0xA14A, 0xA14B, 0xA14C, 0xA14D, 0xA14E, 0xA14F, 0xA150, 0xA151, 0xA152, 0xA153, 0xA154, 0xA155, 0xA156, 0xA157, 0xA158, 0xA159, 0xA15A, 0xA15B, 0xA15C, 0xA15D, 0xA15E, 0xA15F, 0xA160, 0xA161, 0xA162, 0xA163, 0xA164, 0xA165, 0xA166, 0xA167, 0xA168, 0xA169, 0xA16A, 0xA16B, 0xA16C, 0xA16D, 0xA16E, 0xA16F, 0xA170, 0xA171, 0xA172, 0xA173, 0xA174, 0xA175, 0xA176, 0xA177, 0xA178, 0xA179, 0xA17A, 0xA17B, 0xA17C, 0xA17D, 0xA17E, 0xA17F, 0xA180, 0xA181, 0xA182, 0xA183, 0xA184, 0xA185, 0xA186, 0xA187, 0xA188, 0xA189, 0xA18A, 0xA18B, 0xA18C, 0xA18D, 0xA18E, 0xA18F, 0xA190, 0xA191, 0xA192, 0xA193, 0xA194, 0xA195, 0xA196, 0xA197, 0xA198, 0xA199, 0xA19A, 0xA19B, 0xA19C, 0xA19D, 0xA19E, 0xA19F, 0xA1A0, 0xA1A1, 0xA1A2, 0xA1A3, 0xA1A4, 0xA1A5, 0xA1A6, 0xA1A7, 0xA1A8, 0xA1A9, 0xA1AA, 0xA1AB, 0xA1AC, 0xA1AD, 0xA1AE, 0xA1AF, 0xA1B0, 0xA1B1, 0xA1B2, 0xA1B3, 0xA1B4, 0xA1B5, 0xA1B6, 0xA1B7, 0xA1B8, 0xA1B9, 0xA1BA, 0xA1BB, 0xA1BC, 0xA1BD, 0xA1BE, 0xA1BF, 0xA1C0, 0xA1C1, 0xA1C2, 0xA1C3, 0xA1C4, 0xA1C5, 0xA1C6, 0xA1C7, 0xA1C8, 0xA1C9, 0xA1CA, 0xA1CB, 0xA1CC, 0xA1CD, 0xA1CE, 0xA1CF, 0xA1D0, 0xA1D1, 0xA1D2, 0xA1D3, 0xA1D4, 0xA1D5, 0xA1D6, 0xA1D7, 0xA1D8, 0xA1D9, 0xA1DA, 0xA1DB, 0xA1DC, 0xA1DD, 0xA1DE, 0xA1DF, 0xA1E0, 0xA1E1, 0xA1E2, 0xA1E3, 0xA1E4, 0xA1E5, 0xA1E6, 0xA1E7, 0xA1E8, 0xA1E9, 0xA1EA, 0xA1EB, 0xA1EC, 0xA1ED, 0xA1EE, 0xA1EF, 0xA1F0, 0xA1F1, 0xA1F2, 0xA1F3, 0xA1F4, 0xA1F5, 0xA1F6, 0xA1F7, 0xA1F8, 0xA1F9, 0xA1FA, 0xA1FB, 0xA1FC, 0xA1FD, 0xA1FE, 0xA1FF, 0xA200, 0xA201, 0xA202, 0xA203, 0xA204, 0xA205, 0xA206, 0xA207, 0xA208, 0xA209, 0xA20A, 0xA20B, 0xA20C, 0xA20D, 0xA20E, 0xA20F, 0xA210, 0xA211, 0xA212, 0xA213, 0xA214, 0xA215, 0xA216, 0xA217, 0xA218, 0xA219, 0xA21A, 0xA21B, 0xA21C, 0xA21D, 0xA21E, 0xA21F, 0xA220, 0xA221, 0xA222, 0xA223, 0xA224, 0xA225, 0xA226, 0xA227, 0xA228, 0xA229, 0xA22A, 0xA22B, 0xA22C, 0xA22D, 0xA22E, 0xA22F, 0xA230, 0xA231, 0xA232, 0xA233, 0xA234, 0xA235, 0xA236, 0xA237, 0xA238, 0xA239, 0xA23A, 0xA23B, 0xA23C, 0xA23D, 0xA23E, 0xA23F, 0xA240, 0xA241, 0xA242, 0xA243, 0xA244, 0xA245, 0xA246, 0xA247, 0xA248, 0xA249, 0xA24A, 0xA24B, 0xA24C, 0xA24D, 0xA24E, 0xA24F, 0xA250, 0xA251, 0xA252, 0xA253, 0xA254, 0xA255, 0xA256, 0xA257, 0xA258, 0xA259, 0xA25A, 0xA25B, 0xA25C, 0xA25D, 0xA25E, 0xA25F, 0xA260, 0xA261, 0xA262, 0xA263, 0xA264, 0xA265, 0xA266, 0xA267, 0xA268, 0xA269, 0xA26A, 0xA26B, 0xA26C, 0xA26D, 0xA26E, 0xA26F, 0xA270, 0xA271, 0xA272, 0xA273, 0xA274, 0xA275, 0xA276, 0xA277, 0xA278, 0xA279, 0xA27A, 0xA27B, 0xA27C, 0xA27D, 0xA27E, 0xA27F, 0xA280, 0xA281, 0xA282, 0xA283, 0xA284, 0xA285, 0xA286, 0xA287, 0xA288, 0xA289, 0xA28A, 0xA28B, 0xA28C, 0xA28D, 0xA28E, 0xA28F, 0xA290, 0xA291, 0xA292, 0xA293, 0xA294, 0xA295, 0xA296, 0xA297, 0xA298, 0xA299, 0xA29A, 0xA29B, 0xA29C, 0xA29D, 0xA29E, 0xA29F, 0xA2A0, 0xA2A1, 0xA2A2, 0xA2A3, 0xA2A4, 0xA2A5, 0xA2A6, 0xA2A7, 0xA2A8, 0xA2A9, 0xA2AA, 0xA2AB, 0xA2AC, 0xA2AD, 0xA2AE, 0xA2AF, 0xA2B0, 0xA2B1, 0xA2B2, 0xA2B3, 0xA2B4, 0xA2B5, 0xA2B6, 0xA2B7, 0xA2B8, 0xA2B9, 0xA2BA, 0xA2BB, 0xA2BC, 0xA2BD, 0xA2BE, 0xA2BF, 0xA2C0, 0xA2C1, 0xA2C2, 0xA2C3, 0xA2C4, 0xA2C5, 0xA2C6, 0xA2C7, 0xA2C8, 0xA2C9, 0xA2CA, 0xA2CB, 0xA2CC, 0xA2CD, 0xA2CE, 0xA2CF, 0xA2D0, 0xA2D1, 0xA2D2, 0xA2D3, 0xA2D4, 0xA2D5, 0xA2D6, 0xA2D7, 0xA2D8, 0xA2D9, 0xA2DA, 0xA2DB, 0xA2DC, 0xA2DD, 0xA2DE, 0xA2DF, 0xA2E0, 0xA2E1, 0xA2E2, 0xA2E3, 0xA2E4, 0xA2E5, 0xA2E6, 0xA2E7, 0xA2E8, 0xA2E9, 0xA2EA, 0xA2EB, 0xA2EC, 0xA2ED, 0xA2EE, 0xA2EF, 0xA2F0, 0xA2F1, 0xA2F2, 0xA2F3, 0xA2F4, 0xA2F5, 0xA2F6, 0xA2F7, 0xA2F8, 0xA2F9, 0xA2FA, 0xA2FB, 0xA2FC, 0xA2FD, 0xA2FE, 0xA2FF, 0xA300, 0xA301, 0xA302, 0xA303, 0xA304, 0xA305, 0xA306, 0xA307, 0xA308, 0xA309, 0xA30A, 0xA30B, 0xA30C, 0xA30D, 0xA30E, 0xA30F, 0xA310, 0xA311, 0xA312, 0xA313, 0xA314, 0xA315, 0xA316, 0xA317, 0xA318, 0xA319, 0xA31A, 0xA31B, 0xA31C, 0xA31D, 0xA31E, 0xA31F, 0xA320, 0xA321, 0xA322, 0xA323, 0xA324, 0xA325, 0xA326, 0xA327, 0xA328, 0xA329, 0xA32A, 0xA32B, 0xA32C, 0xA32D, 0xA32E, 0xA32F, 0xA330, 0xA331, 0xA332, 0xA333, 0xA334, 0xA335, 0xA336, 0xA337, 0xA338, 0xA339, 0xA33A, 0xA33B, 0xA33C, 0xA33D, 0xA33E, 0xA33F, 0xA340, 0xA341, 0xA342, 0xA343, 0xA344, 0xA345, 0xA346, 0xA347, 0xA348, 0xA349, 0xA34A, 0xA34B, 0xA34C, 0xA34D, 0xA34E, 0xA34F, 0xA350, 0xA351, 0xA352, 0xA353, 0xA354, 0xA355, 0xA356, 0xA357, 0xA358, 0xA359, 0xA35A, 0xA35B, 0xA35C, 0xA35D, 0xA35E, 0xA35F, 0xA360, 0xA361, 0xA362, 0xA363, 0xA364, 0xA365, 0xA366, 0xA367, 0xA368, 0xA369, 0xA36A, 0xA36B, 0xA36C, 0xA36D, 0xA36E, 0xA36F, 0xA370, 0xA371, 0xA372, 0xA373, 0xA374, 0xA375, 0xA376, 0xA377, 0xA378, 0xA379, 0xA37A, 0xA37B, 0xA37C, 0xA37D, 0xA37E, 0xA37F, 0xA380, 0xA381, 0xA382, 0xA383, 0xA384, 0xA385, 0xA386, 0xA387, 0xA388, 0xA389, 0xA38A, 0xA38B, 0xA38C, 0xA38D, 0xA38E, 0xA38F, 0xA390, 0xA391, 0xA392, 0xA393, 0xA394, 0xA395, 0xA396, 0xA397, 0xA398, 0xA399, 0xA39A, 0xA39B, 0xA39C, 0xA39D, 0xA39E, 0xA39F, 0xA3A0, 0xA3A1, 0xA3A2, 0xA3A3, 0xA3A4, 0xA3A5, 0xA3A6, 0xA3A7, 0xA3A8, 0xA3A9, 0xA3AA, 0xA3AB, 0xA3AC, 0xA3AD, 0xA3AE, 0xA3AF, 0xA3B0, 0xA3B1, 0xA3B2, 0xA3B3, 0xA3B4, 0xA3B5, 0xA3B6, 0xA3B7, 0xA3B8, 0xA3B9, 0xA3BA, 0xA3BB, 0xA3BC, 0xA3BD, 0xA3BE, 0xA3BF, 0xA3C0, 0xA3C1, 0xA3C2, 0xA3C3, 0xA3C4, 0xA3C5, 0xA3C6, 0xA3C7, 0xA3C8, 0xA3C9, 0xA3CA, 0xA3CB, 0xA3CC, 0xA3CD, 0xA3CE, 0xA3CF, 0xA3D0, 0xA3D1, 0xA3D2, 0xA3D3, 0xA3D4, 0xA3D5, 0xA3D6, 0xA3D7, 0xA3D8, 0xA3D9, 0xA3DA, 0xA3DB, 0xA3DC, 0xA3DD, 0xA3DE, 0xA3DF, 0xA3E0, 0xA3E1, 0xA3E2, 0xA3E3, 0xA3E4, 0xA3E5, 0xA3E6, 0xA3E7, 0xA3E8, 0xA3E9, 0xA3EA, 0xA3EB, 0xA3EC, 0xA3ED, 0xA3EE, 0xA3EF, 0xA3F0, 0xA3F1, 0xA3F2, 0xA3F3, 0xA3F4, 0xA3F5, 0xA3F6, 0xA3F7, 0xA3F8, 0xA3F9, 0xA3FA, 0xA3FB, 0xA3FC, 0xA3FD, 0xA3FE, 0xA3FF, 0xA400, 0xA401, 0xA402, 0xA403, 0xA404, 0xA405, 0xA406, 0xA407, 0xA408, 0xA409, 0xA40A, 0xA40B, 0xA40C, 0xA40D, 0xA40E, 0xA40F, 0xA410, 0xA411, 0xA412, 0xA413, 0xA414, 0xA415, 0xA416, 0xA417, 0xA418, 0xA419, 0xA41A, 0xA41B, 0xA41C, 0xA41D, 0xA41E, 0xA41F, 0xA420, 0xA421, 0xA422, 0xA423, 0xA424, 0xA425, 0xA426, 0xA427, 0xA428, 0xA429, 0xA42A, 0xA42B, 0xA42C, 0xA42D, 0xA42E, 0xA42F, 0xA430, 0xA431, 0xA432, 0xA433, 0xA434, 0xA435, 0xA436, 0xA437, 0xA438, 0xA439, 0xA43A, 0xA43B, 0xA43C, 0xA43D, 0xA43E, 0xA43F, 0xA440, 0xA441, 0xA442, 0xA443, 0xA444, 0xA445, 0xA446, 0xA447, 0xA448, 0xA449, 0xA44A, 0xA44B, 0xA44C, 0xA44D, 0xA44E, 0xA44F, 0xA450, 0xA451, 0xA452, 0xA453, 0xA454, 0xA455, 0xA456, 0xA457, 0xA458, 0xA459, 0xA45A, 0xA45B, 0xA45C, 0xA45D, 0xA45E, 0xA45F, 0xA460, 0xA461, 0xA462, 0xA463, 0xA464, 0xA465, 0xA466, 0xA467, 0xA468, 0xA469, 0xA46A, 0xA46B, 0xA46C, 0xA46D, 0xA46E, 0xA46F, 0xA470, 0xA471, 0xA472, 0xA473, 0xA474, 0xA475, 0xA476, 0xA477, 0xA478, 0xA479, 0xA47A, 0xA47B, 0xA47C, 0xA47D, 0xA47E, 0xA47F, 0xA480, 0xA481, 0xA482, 0xA483, 0xA484, 0xA485, 0xA486, 0xA487, 0xA488, 0xA489, 0xA48A, 0xA48B, 0xA48C, 0xA490, 0xA491, 0xA492, 0xA493, 0xA494, 0xA495, 0xA496, 0xA497, 0xA498, 0xA499, 0xA49A, 0xA49B, 0xA49C, 0xA49D, 0xA49E, 0xA49F, 0xA4A0, 0xA4A1, 0xA4A2, 0xA4A3, 0xA4A4, 0xA4A5, 0xA4A6, 0xA4A7, 0xA4A8, 0xA4A9, 0xA4AA, 0xA4AB, 0xA4AC, 0xA4AD, 0xA4AE, 0xA4AF, 0xA4B0, 0xA4B1, 0xA4B2, 0xA4B3, 0xA4B4, 0xA4B5, 0xA4B6, 0xA4B7, 0xA4B8, 0xA4B9, 0xA4BA, 0xA4BB, 0xA4BC, 0xA4BD, 0xA4BE, 0xA4BF, 0xA4C0, 0xA4C1, 0xA4C2, 0xA4C3, 0xA4C4, 0xA4C5, 0xA4C6, 0xA960, 0xA961, 0xA962, 0xA963, 0xA964, 0xA965, 0xA966, 0xA967, 0xA968, 0xA969, 0xA96A, 0xA96B, 0xA96C, 0xA96D, 0xA96E, 0xA96F, 0xA970, 0xA971, 0xA972, 0xA973, 0xA974, 0xA975, 0xA976, 0xA977, 0xA978, 0xA979, 0xA97A, 0xA97B, 0xA97C, 0xD7B0, 0xD7B1, 0xD7B2, 0xD7B3, 0xD7B4, 0xD7B5, 0xD7B6, 0xD7B7, 0xD7B8, 0xD7B9, 0xD7BA, 0xD7BB, 0xD7BC, 0xD7BD, 0xD7BE, 0xD7BF, 0xD7C0, 0xD7C1, 0xD7C2, 0xD7C3, 0xD7C4, 0xD7C5, 0xD7C6, 0xD7CB, 0xD7CC, 0xD7CD, 0xD7CE, 0xD7CF, 0xD7D0, 0xD7D1, 0xD7D2, 0xD7D3, 0xD7D4, 0xD7D5, 0xD7D6, 0xD7D7, 0xD7D8, 0xD7D9, 0xD7DA, 0xD7DB, 0xD7DC, 0xD7DD, 0xD7DE, 0xD7DF, 0xD7E0, 0xD7E1, 0xD7E2, 0xD7E3, 0xD7E4, 0xD7E5, 0xD7E6, 0xD7E7, 0xD7E8, 0xD7E9, 0xD7EA, 0xD7EB, 0xD7EC, 0xD7ED, 0xD7EE, 0xD7EF, 0xD7F0, 0xD7F1, 0xD7F2, 0xD7F3, 0xD7F4, 0xD7F5, 0xD7F6, 0xD7F7, 0xD7F8, 0xD7F9, 0xD7FA, 0xD7FB, 0xF900, 0xF901, 0xF902, 0xF903, 0xF904, 0xF905, 0xF906, 0xF907, 0xF908, 0xF909, 0xF90A, 0xF90B, 0xF90C, 0xF90D, 0xF90E, 0xF90F, 0xF910, 0xF911, 0xF912, 0xF913, 0xF914, 0xF915, 0xF916, 0xF917, 0xF918, 0xF919, 0xF91A, 0xF91B, 0xF91C, 0xF91D, 0xF91E, 0xF91F, 0xF920, 0xF921, 0xF922, 0xF923, 0xF924, 0xF925, 0xF926, 0xF927, 0xF928, 0xF929, 0xF92A, 0xF92B, 0xF92C, 0xF92D, 0xF92E, 0xF92F, 0xF930, 0xF931, 0xF932, 0xF933, 0xF934, 0xF935, 0xF936, 0xF937, 0xF938, 0xF939, 0xF93A, 0xF93B, 0xF93C, 0xF93D, 0xF93E, 0xF93F, 0xF940, 0xF941, 0xF942, 0xF943, 0xF944, 0xF945, 0xF946, 0xF947, 0xF948, 0xF949, 0xF94A, 0xF94B, 0xF94C, 0xF94D, 0xF94E, 0xF94F, 0xF950, 0xF951, 0xF952, 0xF953, 0xF954, 0xF955, 0xF956, 0xF957, 0xF958, 0xF959, 0xF95A, 0xF95B, 0xF95C, 0xF95D, 0xF95E, 0xF95F, 0xF960, 0xF961, 0xF962, 0xF963, 0xF964, 0xF965, 0xF966, 0xF967, 0xF968, 0xF969, 0xF96A, 0xF96B, 0xF96C, 0xF96D, 0xF96E, 0xF96F, 0xF970, 0xF971, 0xF972, 0xF973, 0xF974, 0xF975, 0xF976, 0xF977, 0xF978, 0xF979, 0xF97A, 0xF97B, 0xF97C, 0xF97D, 0xF97E, 0xF97F, 0xF980, 0xF981, 0xF982, 0xF983, 0xF984, 0xF985, 0xF986, 0xF987, 0xF988, 0xF989, 0xF98A, 0xF98B, 0xF98C, 0xF98D, 0xF98E, 0xF98F, 0xF990, 0xF991, 0xF992, 0xF993, 0xF994, 0xF995, 0xF996, 0xF997, 0xF998, 0xF999, 0xF99A, 0xF99B, 0xF99C, 0xF99D, 0xF99E, 0xF99F, 0xF9A0, 0xF9A1, 0xF9A2, 0xF9A3, 0xF9A4, 0xF9A5, 0xF9A6, 0xF9A7, 0xF9A8, 0xF9A9, 0xF9AA, 0xF9AB, 0xF9AC, 0xF9AD, 0xF9AE, 0xF9AF, 0xF9B0, 0xF9B1, 0xF9B2, 0xF9B3, 0xF9B4, 0xF9B5, 0xF9B6, 0xF9B7, 0xF9B8, 0xF9B9, 0xF9BA, 0xF9BB, 0xF9BC, 0xF9BD, 0xF9BE, 0xF9BF, 0xF9C0, 0xF9C1, 0xF9C2, 0xF9C3, 0xF9C4, 0xF9C5, 0xF9C6, 0xF9C7, 0xF9C8, 0xF9C9, 0xF9CA, 0xF9CB, 0xF9CC, 0xF9CD, 0xF9CE, 0xF9CF, 0xF9D0, 0xF9D1, 0xF9D2, 0xF9D3, 0xF9D4, 0xF9D5, 0xF9D6, 0xF9D7, 0xF9D8, 0xF9D9, 0xF9DA, 0xF9DB, 0xF9DC, 0xF9DD, 0xF9DE, 0xF9DF, 0xF9E0, 0xF9E1, 0xF9E2, 0xF9E3, 0xF9E4, 0xF9E5, 0xF9E6, 0xF9E7, 0xF9E8, 0xF9E9, 0xF9EA, 0xF9EB, 0xF9EC, 0xF9ED, 0xF9EE, 0xF9EF, 0xF9F0, 0xF9F1, 0xF9F2, 0xF9F3, 0xF9F4, 0xF9F5, 0xF9F6, 0xF9F7, 0xF9F8, 0xF9F9, 0xF9FA, 0xF9FB, 0xF9FC, 0xF9FD, 0xF9FE, 0xF9FF, 0xFA00, 0xFA01, 0xFA02, 0xFA03, 0xFA04, 0xFA05, 0xFA06, 0xFA07, 0xFA08, 0xFA09, 0xFA0A, 0xFA0B, 0xFA0C, 0xFA0D, 0xFA0E, 0xFA0F, 0xFA10, 0xFA11, 0xFA12, 0xFA13, 0xFA14, 0xFA15, 0xFA16, 0xFA17, 0xFA18, 0xFA19, 0xFA1A, 0xFA1B, 0xFA1C, 0xFA1D, 0xFA1E, 0xFA1F, 0xFA20, 0xFA21, 0xFA22, 0xFA23, 0xFA24, 0xFA25, 0xFA26, 0xFA27, 0xFA28, 0xFA29, 0xFA2A, 0xFA2B, 0xFA2C, 0xFA2D, 0xFA2E, 0xFA2F, 0xFA30, 0xFA31, 0xFA32, 0xFA33, 0xFA34, 0xFA35, 0xFA36, 0xFA37, 0xFA38, 0xFA39, 0xFA3A, 0xFA3B, 0xFA3C, 0xFA3D, 0xFA3E, 0xFA3F, 0xFA40, 0xFA41, 0xFA42, 0xFA43, 0xFA44, 0xFA45, 0xFA46, 0xFA47, 0xFA48, 0xFA49, 0xFA4A, 0xFA4B, 0xFA4C, 0xFA4D, 0xFA4E, 0xFA4F, 0xFA50, 0xFA51, 0xFA52, 0xFA53, 0xFA54, 0xFA55, 0xFA56, 0xFA57, 0xFA58, 0xFA59, 0xFA5A, 0xFA5B, 0xFA5C, 0xFA5D, 0xFA5E, 0xFA5F, 0xFA60, 0xFA61, 0xFA62, 0xFA63, 0xFA64, 0xFA65, 0xFA66, 0xFA67, 0xFA68, 0xFA69, 0xFA6A, 0xFA6B, 0xFA6C, 0xFA6D, 0xFA70, 0xFA71, 0xFA72, 0xFA73, 0xFA74, 0xFA75, 0xFA76, 0xFA77, 0xFA78, 0xFA79, 0xFA7A, 0xFA7B, 0xFA7C, 0xFA7D, 0xFA7E, 0xFA7F, 0xFA80, 0xFA81, 0xFA82, 0xFA83, 0xFA84, 0xFA85, 0xFA86, 0xFA87, 0xFA88, 0xFA89, 0xFA8A, 0xFA8B, 0xFA8C, 0xFA8D, 0xFA8E, 0xFA8F, 0xFA90, 0xFA91, 0xFA92, 0xFA93, 0xFA94, 0xFA95, 0xFA96, 0xFA97, 0xFA98, 0xFA99, 0xFA9A, 0xFA9B, 0xFA9C, 0xFA9D, 0xFA9E, 0xFA9F, 0xFAA0, 0xFAA1, 0xFAA2, 0xFAA3, 0xFAA4, 0xFAA5, 0xFAA6, 0xFAA7, 0xFAA8, 0xFAA9, 0xFAAA, 0xFAAB, 0xFAAC, 0xFAAD, 0xFAAE, 0xFAAF, 0xFAB0, 0xFAB1, 0xFAB2, 0xFAB3, 0xFAB4, 0xFAB5, 0xFAB6, 0xFAB7, 0xFAB8, 0xFAB9, 0xFABA, 0xFABB, 0xFABC, 0xFABD, 0xFABE, 0xFABF, 0xFAC0, 0xFAC1, 0xFAC2, 0xFAC3, 0xFAC4, 0xFAC5, 0xFAC6, 0xFAC7, 0xFAC8, 0xFAC9, 0xFACA, 0xFACB, 0xFACC, 0xFACD, 0xFACE, 0xFACF, 0xFAD0, 0xFAD1, 0xFAD2, 0xFAD3, 0xFAD4, 0xFAD5, 0xFAD6, 0xFAD7, 0xFAD8, 0xFAD9, 0xFE10, 0xFE11, 0xFE12, 0xFE13, 0xFE14, 0xFE15, 0xFE16, 0xFE17, 0xFE18, 0xFE19, 0xFE30, 0xFE31, 0xFE32, 0xFE33, 0xFE34, 0xFE35, 0xFE36, 0xFE37, 0xFE38, 0xFE39, 0xFE3A, 0xFE3B, 0xFE3C, 0xFE3D, 0xFE3E, 0xFE3F, 0xFE40, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE45, 0xFE46, 0xFE47, 0xFE48, 0xFE49, 0xFE4A, 0xFE4B, 0xFE4C, 0xFE4D, 0xFE4E, 0xFE4F, 0xFE50, 0xFE51, 0xFE52, 0xFE54, 0xFE55, 0xFE56, 0xFE57, 0xFE58, 0xFE59, 0xFE5A, 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0xFE5F, 0xFE60, 0xFE61, 0xFE62, 0xFE63, 0xFE64, 0xFE65, 0xFE66, 0xFE68, 0xFE69, 0xFE6A, 0xFE6B, 0x1B000, 0x1B001, 0x1F200, 0x1F201, 0x1F202, 0x1F210, 0x1F211, 0x1F212, 0x1F213, 0x1F214, 0x1F215, 0x1F216, 0x1F217, 0x1F218, 0x1F219, 0x1F21A, 0x1F21B, 0x1F21C, 0x1F21D, 0x1F21E, 0x1F21F, 0x1F220, 0x1F221, 0x1F222, 0x1F223, 0x1F224, 0x1F225, 0x1F226, 0x1F227, 0x1F228, 0x1F229, 0x1F22A, 0x1F22B, 0x1F22C, 0x1F22D, 0x1F22E, 0x1F22F, 0x1F230, 0x1F231, 0x1F232, 0x1F233, 0x1F234, 0x1F235, 0x1F236, 0x1F237, 0x1F238, 0x1F239, 0x1F23A, 0x1F240, 0x1F241, 0x1F242, 0x1F243, 0x1F244, 0x1F245, 0x1F246, 0x1F247, 0x1F248, 0x1F250, 0x1F251, 0x2F800, 0x2F801, 0x2F802, 0x2F803, 0x2F804, 0x2F805, 0x2F806, 0x2F807, 0x2F808, 0x2F809, 0x2F80A, 0x2F80B, 0x2F80C, 0x2F80D, 0x2F80E, 0x2F80F, 0x2F810, 0x2F811, 0x2F812, 0x2F813, 0x2F814, 0x2F815, 0x2F816, 0x2F817, 0x2F818, 0x2F819, 0x2F81A, 0x2F81B, 0x2F81C, 0x2F81D, 0x2F81E, 0x2F81F, 0x2F820, 0x2F821, 0x2F822, 0x2F823, 0x2F824, 0x2F825, 0x2F826, 0x2F827, 0x2F828, 0x2F829, 0x2F82A, 0x2F82B, 0x2F82C, 0x2F82D, 0x2F82E, 0x2F82F, 0x2F830, 0x2F831, 0x2F832, 0x2F833, 0x2F834, 0x2F835, 0x2F836, 0x2F837, 0x2F838, 0x2F839, 0x2F83A, 0x2F83B, 0x2F83C, 0x2F83D, 0x2F83E, 0x2F83F, 0x2F840, 0x2F841, 0x2F842, 0x2F843, 0x2F844, 0x2F845, 0x2F846, 0x2F847, 0x2F848, 0x2F849, 0x2F84A, 0x2F84B, 0x2F84C, 0x2F84D, 0x2F84E, 0x2F84F, 0x2F850, 0x2F851, 0x2F852, 0x2F853, 0x2F854, 0x2F855, 0x2F856, 0x2F857, 0x2F858, 0x2F859, 0x2F85A, 0x2F85B, 0x2F85C, 0x2F85D, 0x2F85E, 0x2F85F, 0x2F860, 0x2F861, 0x2F862, 0x2F863, 0x2F864, 0x2F865, 0x2F866, 0x2F867, 0x2F868, 0x2F869, 0x2F86A, 0x2F86B, 0x2F86C, 0x2F86D, 0x2F86E, 0x2F86F, 0x2F870, 0x2F871, 0x2F872, 0x2F873, 0x2F874, 0x2F875, 0x2F876, 0x2F877, 0x2F878, 0x2F879, 0x2F87A, 0x2F87B, 0x2F87C, 0x2F87D, 0x2F87E, 0x2F87F, 0x2F880, 0x2F881, 0x2F882, 0x2F883, 0x2F884, 0x2F885, 0x2F886, 0x2F887, 0x2F888, 0x2F889, 0x2F88A, 0x2F88B, 0x2F88C, 0x2F88D, 0x2F88E, 0x2F88F, 0x2F890, 0x2F891, 0x2F892, 0x2F893, 0x2F894, 0x2F895, 0x2F896, 0x2F897, 0x2F898, 0x2F899, 0x2F89A, 0x2F89B, 0x2F89C, 0x2F89D, 0x2F89E, 0x2F89F, 0x2F8A0, 0x2F8A1, 0x2F8A2, 0x2F8A3, 0x2F8A4, 0x2F8A5, 0x2F8A6, 0x2F8A7, 0x2F8A8, 0x2F8A9, 0x2F8AA, 0x2F8AB, 0x2F8AC, 0x2F8AD, 0x2F8AE, 0x2F8AF, 0x2F8B0, 0x2F8B1, 0x2F8B2, 0x2F8B3, 0x2F8B4, 0x2F8B5, 0x2F8B6, 0x2F8B7, 0x2F8B8, 0x2F8B9, 0x2F8BA, 0x2F8BB, 0x2F8BC, 0x2F8BD, 0x2F8BE, 0x2F8BF, 0x2F8C0, 0x2F8C1, 0x2F8C2, 0x2F8C3, 0x2F8C4, 0x2F8C5, 0x2F8C6, 0x2F8C7, 0x2F8C8, 0x2F8C9, 0x2F8CA, 0x2F8CB, 0x2F8CC, 0x2F8CD, 0x2F8CE, 0x2F8CF, 0x2F8D0, 0x2F8D1, 0x2F8D2, 0x2F8D3, 0x2F8D4, 0x2F8D5, 0x2F8D6, 0x2F8D7, 0x2F8D8, 0x2F8D9, 0x2F8DA, 0x2F8DB, 0x2F8DC, 0x2F8DD, 0x2F8DE, 0x2F8DF, 0x2F8E0, 0x2F8E1, 0x2F8E2, 0x2F8E3, 0x2F8E4, 0x2F8E5, 0x2F8E6, 0x2F8E7, 0x2F8E8, 0x2F8E9, 0x2F8EA, 0x2F8EB, 0x2F8EC, 0x2F8ED, 0x2F8EE, 0x2F8EF, 0x2F8F0, 0x2F8F1, 0x2F8F2, 0x2F8F3, 0x2F8F4, 0x2F8F5, 0x2F8F6, 0x2F8F7, 0x2F8F8, 0x2F8F9, 0x2F8FA, 0x2F8FB, 0x2F8FC, 0x2F8FD, 0x2F8FE, 0x2F8FF, 0x2F900, 0x2F901, 0x2F902, 0x2F903, 0x2F904, 0x2F905, 0x2F906, 0x2F907, 0x2F908, 0x2F909, 0x2F90A, 0x2F90B, 0x2F90C, 0x2F90D, 0x2F90E, 0x2F90F, 0x2F910, 0x2F911, 0x2F912, 0x2F913, 0x2F914, 0x2F915, 0x2F916, 0x2F917, 0x2F918, 0x2F919, 0x2F91A, 0x2F91B, 0x2F91C, 0x2F91D, 0x2F91E, 0x2F91F, 0x2F920, 0x2F921, 0x2F922, 0x2F923, 0x2F924, 0x2F925, 0x2F926, 0x2F927, 0x2F928, 0x2F929, 0x2F92A, 0x2F92B, 0x2F92C, 0x2F92D, 0x2F92E, 0x2F92F, 0x2F930, 0x2F931, 0x2F932, 0x2F933, 0x2F934, 0x2F935, 0x2F936, 0x2F937, 0x2F938, 0x2F939, 0x2F93A, 0x2F93B, 0x2F93C, 0x2F93D, 0x2F93E, 0x2F93F, 0x2F940, 0x2F941, 0x2F942, 0x2F943, 0x2F944, 0x2F945, 0x2F946, 0x2F947, 0x2F948, 0x2F949, 0x2F94A, 0x2F94B, 0x2F94C, 0x2F94D, 0x2F94E, 0x2F94F, 0x2F950, 0x2F951, 0x2F952, 0x2F953, 0x2F954, 0x2F955, 0x2F956, 0x2F957, 0x2F958, 0x2F959, 0x2F95A, 0x2F95B, 0x2F95C, 0x2F95D, 0x2F95E, 0x2F95F, 0x2F960, 0x2F961, 0x2F962, 0x2F963, 0x2F964, 0x2F965, 0x2F966, 0x2F967, 0x2F968, 0x2F969, 0x2F96A, 0x2F96B, 0x2F96C, 0x2F96D, 0x2F96E, 0x2F96F, 0x2F970, 0x2F971, 0x2F972, 0x2F973, 0x2F974, 0x2F975, 0x2F976, 0x2F977, 0x2F978, 0x2F979, 0x2F97A, 0x2F97B, 0x2F97C, 0x2F97D, 0x2F97E, 0x2F97F, 0x2F980, 0x2F981, 0x2F982, 0x2F983, 0x2F984, 0x2F985, 0x2F986, 0x2F987, 0x2F988, 0x2F989, 0x2F98A, 0x2F98B, 0x2F98C, 0x2F98D, 0x2F98E, 0x2F98F, 0x2F990, 0x2F991, 0x2F992, 0x2F993, 0x2F994, 0x2F995, 0x2F996, 0x2F997, 0x2F998, 0x2F999, 0x2F99A, 0x2F99B, 0x2F99C, 0x2F99D, 0x2F99E, 0x2F99F, 0x2F9A0, 0x2F9A1, 0x2F9A2, 0x2F9A3, 0x2F9A4, 0x2F9A5, 0x2F9A6, 0x2F9A7, 0x2F9A8, 0x2F9A9, 0x2F9AA, 0x2F9AB, 0x2F9AC, 0x2F9AD, 0x2F9AE, 0x2F9AF, 0x2F9B0, 0x2F9B1, 0x2F9B2, 0x2F9B3, 0x2F9B4, 0x2F9B5, 0x2F9B6, 0x2F9B7, 0x2F9B8, 0x2F9B9, 0x2F9BA, 0x2F9BB, 0x2F9BC, 0x2F9BD, 0x2F9BE, 0x2F9BF, 0x2F9C0, 0x2F9C1, 0x2F9C2, 0x2F9C3, 0x2F9C4, 0x2F9C5, 0x2F9C6, 0x2F9C7, 0x2F9C8, 0x2F9C9, 0x2F9CA, 0x2F9CB, 0x2F9CC, 0x2F9CD, 0x2F9CE, 0x2F9CF, 0x2F9D0, 0x2F9D1, 0x2F9D2, 0x2F9D3, 0x2F9D4, 0x2F9D5, 0x2F9D6, 0x2F9D7, 0x2F9D8, 0x2F9D9, 0x2F9DA, 0x2F9DB, 0x2F9DC, 0x2F9DD, 0x2F9DE, 0x2F9DF, 0x2F9E0, 0x2F9E1, 0x2F9E2, 0x2F9E3, 0x2F9E4, 0x2F9E5, 0x2F9E6, 0x2F9E7, 0x2F9E8, 0x2F9E9, 0x2F9EA, 0x2F9EB, 0x2F9EC, 0x2F9ED, 0x2F9EE, 0x2F9EF, 0x2F9F0, 0x2F9F1, 0x2F9F2, 0x2F9F3, 0x2F9F4, 0x2F9F5, 0x2F9F6, 0x2F9F7, 0x2F9F8, 0x2F9F9, 0x2F9FA, 0x2F9FB, 0x2F9FC, 0x2F9FD, 0x2F9FE, 0x2F9FF, 0x2FA00, 0x2FA01, 0x2FA02, 0x2FA03, 0x2FA04, 0x2FA05, 0x2FA06, 0x2FA07, 0x2FA08, 0x2FA09, 0x2FA0A, 0x2FA0B, 0x2FA0C, 0x2FA0D, 0x2FA0E, 0x2FA0F, 0x2FA10, 0x2FA11, 0x2FA12, 0x2FA13, 0x2FA14, 0x2FA15, 0x2FA16, 0x2FA17, 0x2FA18, 0x2FA19, 0x2FA1A, 0x2FA1B, 0x2FA1C, 0x2FA1D }; std::set res; - iterate(ch, Fixed) - res.insert(*ch); + for(auto const& ch : Fixed) + res.insert(ch); return res; } @@ -18,10 +18,10 @@ static std::map east_asian_width_ranges () static uint32_t RangeEnd[] = { 0x4DB5, 0x4DBF, 0x9FCC, 0x9FFF, 0xD7A3, 0xFA6F, 0xFAFF, 0x2A6D6, 0x2A6FF, 0x2B734, 0x2B73F, 0x2B81D, 0x2F7FF, 0x2FFFD, 0x3FFFD }; std::map res; - iterate(ch, RangeEnd) - res.emplace(*ch + 1, false); - iterate(ch, RangeBegin) - res.emplace(*ch, true); + for(auto const& ch : RangeEnd) + res.emplace(ch + 1, false); + for(auto const& ch : RangeBegin) + res.emplace(ch, true); return res; } diff --git a/Frameworks/text/src/decode.cc b/Frameworks/text/src/decode.cc index e2c713b0..7e3bca86 100644 --- a/Frameworks/text/src/decode.cc +++ b/Frameworks/text/src/decode.cc @@ -271,9 +271,9 @@ namespace decode std::string dst = ""; uint32_t value = 0, bits = 0; - iterate(it, src) + for(auto const& it : src) { - char ch = toupper(*it); + char ch = toupper(it); if('A' <= ch && ch <= 'Z') value = (value << 5) | ch-'A'; else if('2' <= ch && ch <= '7') @@ -293,10 +293,10 @@ namespace decode std::string dst = ""; uint32_t value = 0, bits = 0; - iterate(it, src) + for(auto const& it : src) { static char const Table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - uint32_t i = std::find(Table, Table + 64, *it) - Table; + uint32_t i = std::find(Table, Table + 64, it) - Table; if(i == 64) continue; value = (value << 6) | i; @@ -310,12 +310,12 @@ namespace decode std::string rot13 (std::string src) { - iterate(ch, src) + for(auto& ch : src) { - if('A' <= *ch && *ch <= 'Z') - *ch = *ch-13 >= 'A' ? *ch-13 : *ch-13+'Z'+1-'A'; - else if('a' <= *ch && *ch <= 'z') - *ch = *ch-13 >= 'a' ? *ch-13 : *ch-13+'z'+1-'a'; + if('A' <= ch && ch <= 'Z') + ch = ch-13 >= 'A' ? ch-13 : ch-13+'Z'+1-'A'; + else if('a' <= ch && ch <= 'z') + ch = ch-13 >= 'a' ? ch-13 : ch-13+'z'+1-'a'; } return src; } diff --git a/Frameworks/text/src/encode.cc b/Frameworks/text/src/encode.cc index ee27a0e1..3d90aa7c 100644 --- a/Frameworks/text/src/encode.cc +++ b/Frameworks/text/src/encode.cc @@ -6,11 +6,11 @@ namespace encode std::string url_part (std::string const& src, std::string const& excl) { std::string res = ""; - iterate(ch, src) + for(auto const& ch : src) { - if(strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()", *ch) || excl.find(*ch) != std::string::npos) - res += *ch; - else res += text::format("%%%02X", *ch); + if(strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()", ch) || excl.find(ch) != std::string::npos) + res += ch; + else res += text::format("%%%02X", ch); } return res; } diff --git a/Frameworks/text/src/format.h b/Frameworks/text/src/format.h index 84c323b2..07645bc6 100644 --- a/Frameworks/text/src/format.h +++ b/Frameworks/text/src/format.h @@ -35,12 +35,12 @@ namespace text { std::string res = ""; bool first = true; - iterate(item, items) + for(auto const& item : items) { if(first) first = false; else res += sep; - res += std::string(*item); + res += std::string(item); } return res; } diff --git a/Frameworks/text/src/ranker.cc b/Frameworks/text/src/ranker.cc index 344ed1e5..62108f2c 100644 --- a/Frameworks/text/src/ranker.cc +++ b/Frameworks/text/src/ranker.cc @@ -196,10 +196,10 @@ namespace oak std::string normalize_filter (std::string const& filter) { std::string res = ""; - citerate(ch, text::lowercase(filter)) + for(auto const& ch : text::lowercase(filter)) { - if(*ch != ' ') - res += *ch; + if(ch != ' ') + res += ch; } return res; } diff --git a/Frameworks/text/tests/t_ranker.cc b/Frameworks/text/tests/t_ranker.cc index 44fc40fa..e463908c 100644 --- a/Frameworks/text/tests/t_ranker.cc +++ b/Frameworks/text/tests/t_ranker.cc @@ -31,8 +31,8 @@ void test_ranker () }; std::multimap ranked; - iterate(file, files) - ranked.insert(std::make_pair(oak::rank("otbv", *file), *file)); + for(auto const& file : files) + ranked.insert(std::make_pair(oak::rank("otbv", file), file)); ranked.erase(0); OAK_ASSERT_EQ(ranked.size(), 2); diff --git a/Frameworks/text/tests/t_tokenize.cc b/Frameworks/text/tests/t_tokenize.cc index 7cb77857..e5408c69 100644 --- a/Frameworks/text/tests/t_tokenize.cc +++ b/Frameworks/text/tests/t_tokenize.cc @@ -3,8 +3,8 @@ static std::string replace_token (std::string const& str, char token, std::string const& replacement) { std::vector v; - citerate(component, text::tokenize(str.begin(), str.end(), token)) - v.push_back(*component); + for(auto const& component : text::tokenize(str.begin(), str.end(), token)) + v.push_back(component); return text::join(v, replacement); } diff --git a/Frameworks/text/tests/t_utf8.cc b/Frameworks/text/tests/t_utf8.cc index 368a5e3b..7868319b 100644 --- a/Frameworks/text/tests/t_utf8.cc +++ b/Frameworks/text/tests/t_utf8.cc @@ -65,8 +65,8 @@ void test_to_s () static uint32_t const chars[] = { 0x201C, 0xC6, 0x62, 0x6C, 0x65, 0x67, 0x72, 0xF8, 0x64, 0x2026, 0x201D, 0x20, 0x2014, 0x20, 0x20EF5 }; std::string str = ""; - iterate(ch, chars) - str += utf8::to_s(*ch); + for(auto const& ch : chars) + str += utf8::to_s(ch); OAK_ASSERT_EQ(str, "“Æblegrød…” — 𠻵"); } diff --git a/Frameworks/text/tests/t_wrap.cc b/Frameworks/text/tests/t_wrap.cc index 1a729200..727c6ab4 100644 --- a/Frameworks/text/tests/t_wrap.cc +++ b/Frameworks/text/tests/t_wrap.cc @@ -10,10 +10,10 @@ static std::string soft_breaks (std::string const& str) { std::string res = ""; size_t from = 0; - citerate(offset, text::soft_breaks(str, kWrapColumn, kTabSize)) + for(auto const& offset : text::soft_breaks(str, kWrapColumn, kTabSize)) { - res += str.substr(from, *offset - from) + "‸"; - from = *offset; + res += str.substr(from, offset - from) + "‸"; + from = offset; } return res + str.substr(from); } @@ -23,10 +23,10 @@ static std::string indented_wrap (std::string const& str, size_t width, size_t i std::vector lines; size_t from = 0; - citerate(offset, text::soft_breaks(str, width, kTabSize, indentWidth)) + for(auto const& offset : text::soft_breaks(str, width, kTabSize, indentWidth)) { - lines.push_back(str.substr(from, *offset - from)); - from = *offset; + lines.push_back(str.substr(from, offset - from)); + from = offset; } lines.push_back(str.substr(from)); return text::join(lines, "\n" + std::string(indentWidth, ' ')); diff --git a/Frameworks/theme/src/theme.cc b/Frameworks/theme/src/theme.cc index 401b4080..2e71fb4d 100644 --- a/Frameworks/theme/src/theme.cc +++ b/Frameworks/theme/src/theme.cc @@ -243,9 +243,9 @@ void theme_t::shared_styles_t::setup_styles () plist::array_t items; if(plist::get_key_path(_item->plist(), "settings", items)) { - iterate(it, items) + for(auto const& it : items) { - if(plist::dictionary_t const* styles = boost::get(&*it)) + if(plist::dictionary_t const* styles = boost::get(&it)) { _styles.push_back(parse_styles(*styles)); if(!_styles.back().invisibles.is_blank()) @@ -302,14 +302,14 @@ void theme_t::shared_styles_t::setup_styles () { "selectionIconsPressed", &gutter_styles_t::selectionIconsPressed }, }; - iterate(gutterKey, gutterKeys) + for(auto const& gutterKey : gutterKeys) { theme_t::color_info_t color; - if(get_key_path(gutterSettings, gutterKey->key, color)) + if(get_key_path(gutterSettings, gutterKey.key, color)) { - if(_gutter_styles.*(gutterKey->field)) - CGColorRelease(_gutter_styles.*(gutterKey->field)); - _gutter_styles.*(gutterKey->field) = CGColorRetain(OakColorCreateFromThemeColor(color, _color_space).get()); + if(_gutter_styles.*(gutterKey.field)) + CGColorRelease(_gutter_styles.*(gutterKey.field)); + _gutter_styles.*(gutterKey.field) = CGColorRetain(OakColorCreateFromThemeColor(color, _color_space).get()); } } } @@ -374,23 +374,23 @@ styles_t const& theme_t::styles_for_scope (scope::scope_t const& scope) const if(styles == _cache.end()) { std::multimap ordering; - citerate(it, global_styles(scope)) + for(auto const& it : global_styles(scope)) { double rank = 0; - if(it->scope_selector.does_match(scope, &rank)) - ordering.emplace(rank, *it); + if(it.scope_selector.does_match(scope, &rank)) + ordering.emplace(rank, it); } - iterate(it, _styles->_styles) + for(auto const& it : _styles->_styles) { double rank = 0; - if(it->scope_selector.does_match(scope, &rank)) - ordering.emplace(rank, *it); + if(it.scope_selector.does_match(scope, &rank)) + ordering.emplace(rank, it); } decomposed_style_t base(scope::selector_t(), _font_name, _font_size); - iterate(it, ordering) - base += it->second; + for(auto const& it : ordering) + base += it.second; CTFontPtr font(CTFontCreateWithName(cf::wrap(base.font_name), base.font_size, NULL), CFRelease); if(CTFontSymbolicTraits traits = (base.bold == bool_true ? kCTFontBoldTrait : 0) + (base.italic == bool_true ? kCTFontItalicTrait : 0)) diff --git a/Frameworks/updater/src/updater.cc b/Frameworks/updater/src/updater.cc index e40f19de..d638318c 100644 --- a/Frameworks/updater/src/updater.cc +++ b/Frameworks/updater/src/updater.cc @@ -49,12 +49,12 @@ namespace bundles_db plist::array_t keys; if(plist::get_key_path(plist::load(_path), "keys", keys)) { - iterate(key, keys) + for(auto const& key : keys) { std::string identity, name, publicKey; - if(plist::get_key_path(*key, "identity", identity) && plist::get_key_path(*key, "name", name) && plist::get_key_path(*key, "publicKey", publicKey)) + if(plist::get_key_path(key, "identity", identity) && plist::get_key_path(key, "name", name) && plist::get_key_path(key, "publicKey", publicKey)) res.add(key_chain_t::key_t(identity, name, publicKey)); - else fprintf(stderr, "bad public key entry:\n%s\n", to_s(*key).c_str()); + else fprintf(stderr, "bad public key entry:\n%s\n", to_s(key).c_str()); } } else @@ -103,17 +103,17 @@ namespace bundles_db plist::dictionary_t sources; if(plist::get_key_path(plist, "sources", sources)) { - iterate(source, sources) + for(auto const& source : sources) { std::string name = NULL_STR, url = NULL_STR; int32_t rank = 0; bool disabled = false; - plist::get_key_path(source->second, "name", name); - plist::get_key_path(source->second, "url", url); - plist::get_key_path(source->second, "rank", rank); - plist::get_key_path(source->second, "disabled", disabled); + plist::get_key_path(source.second, "name", name); + plist::get_key_path(source.second, "url", url); + plist::get_key_path(source.second, "rank", rank); + plist::get_key_path(source.second, "disabled", disabled); - res.push_back(std::make_shared(name, source->first, url, path::join(sources_path(installDir), source->first), rank, disabled)); + res.push_back(std::make_shared(name, source.first, url, path::join(sources_path(installDir), source.first), rank, disabled)); } } @@ -124,14 +124,14 @@ namespace bundles_db bool save_sources (std::vector const& sources, std::string const& installDir) { plist::dictionary_t dict; - iterate(source, sources) + for(auto const& source : sources) { plist::dictionary_t item; - item["name"] = (*source)->name(); - item["url"] = (*source)->url(); - item["rank"] = (*source)->rank(); - item["disabled"] = (*source)->disabled(); - dict[(*source)->identifier()] = item; + item["name"] = source->name(); + item["url"] = source->url(); + item["rank"] = source->rank(); + item["disabled"] = source->disabled(); + dict[source->identifier()] = item; } plist::dictionary_t plist; @@ -188,12 +188,12 @@ namespace bundles_db static bundle_ptr find_bundle (std::string const& scope, std::vector const& bundles) { - citerate(bundle, bundles) + for(auto const& bundle : bundles) { - citerate(grammarInfo, (*bundle)->grammars()) + for(auto const& grammarInfo : bundle->grammars()) { - if((*grammarInfo)->scope() == scope) - return *bundle; + if(grammarInfo->scope() == scope) + return bundle; } } return bundle_ptr(); @@ -201,10 +201,10 @@ namespace bundles_db static bundle_ptr find_bundle (oak::uuid_t const& uuid, std::vector const& bundles) { - citerate(bundle, bundles) + for(auto const& bundle : bundles) { - if((*bundle)->uuid() == uuid) - return *bundle; + if(bundle->uuid() == uuid) + return bundle; } return bundle_ptr(); } @@ -226,18 +226,18 @@ namespace bundles_db if(current != this) res.push_back(current); - citerate(dependency, current->_dependencies) + for(auto const& dependency : current->_dependencies) { - if(bundle_ptr bundle = (*dependency)->_uuid ? find_bundle((*dependency)->_uuid, bundles) : find_bundle((*dependency)->_grammar, bundles)) + if(bundle_ptr bundle = dependency->_uuid ? find_bundle(dependency->_uuid, bundles) : find_bundle(dependency->_grammar, bundles)) pending.push_back(bundle.get()); } } } else { - citerate(dependency, _dependencies) + for(auto const& dependency : _dependencies) { - if(bundle_ptr bundle = (*dependency)->_uuid ? find_bundle((*dependency)->_uuid, bundles) : find_bundle((*dependency)->_grammar, bundles)) + if(bundle_ptr bundle = dependency->_uuid ? find_bundle(dependency->_uuid, bundles) : find_bundle(dependency->_grammar, bundles)) res.push_back(bundle.get()); } } @@ -251,21 +251,21 @@ namespace bundles_db template _OutputIter parse_grammars_array (plist::array_t const& grammars, _OutputIter out) { - iterate(grammar, grammars) + for(auto const& grammar : grammars) { auto info = std::make_shared(); - plist::get_key_path(*grammar, "name", info->_name); - plist::get_key_path(*grammar, "scope", info->_scope); - plist::get_key_path(*grammar, "uuid", info->_uuid); - plist::get_key_path(*grammar, "firstLineMatch", info->_mode_line); + plist::get_key_path(grammar, "name", info->_name); + plist::get_key_path(grammar, "scope", info->_scope); + plist::get_key_path(grammar, "uuid", info->_uuid); + plist::get_key_path(grammar, "firstLineMatch", info->_mode_line); plist::array_t fileTypes; - if(plist::get_key_path(*grammar, "fileTypes", fileTypes)) + if(plist::get_key_path(grammar, "fileTypes", fileTypes)) { - iterate(type, fileTypes) + for(auto const& type : fileTypes) { - if(std::string const* ext = boost::get(&*type)) + if(std::string const* ext = boost::get(&type)) info->_file_types.push_back(*ext); } } @@ -279,12 +279,12 @@ namespace bundles_db template _OutputIter parse_dependencies_array (plist::array_t const& dependencies, _OutputIter out) { - iterate(dependency, dependencies) + for(auto const& dependency : dependencies) { auto info = std::make_shared(); - plist::get_key_path(*dependency, "uuid", info->_uuid); - plist::get_key_path(*dependency, "name", info->_name); - plist::get_key_path(*dependency, "grammar", info->_grammar); + plist::get_key_path(dependency, "uuid", info->_uuid); + plist::get_key_path(dependency, "name", info->_name); + plist::get_key_path(dependency, "grammar", info->_grammar); *out++ = info; } @@ -294,49 +294,49 @@ namespace bundles_db template _OutputIter parse_remote_bundle_index (source_ptr src, _OutputIter out) { - citerate(pair, plist::load(src->path())) + for(auto const& pair : plist::load(src->path())) { - if(pair->first != "bundles") + if(pair.first != "bundles") continue; - citerate(item, plist::as_array(pair->second)) + for(auto const& item : plist::as_array(pair.second)) { auto bundle = std::make_shared(); bundle->_source = src; - if(!plist::get_key_path(*item, "uuid", bundle->_uuid)) + if(!plist::get_key_path(item, "uuid", bundle->_uuid)) continue; plist::array_t versions; - if(!plist::get_key_path(*item, "versions", versions)) + if(!plist::get_key_path(item, "versions", versions)) continue; - iterate(version, versions) + for(auto const& version : versions) { - plist::get_key_path(*version, "url", bundle->_url); - plist::get_key_path(*version, "updated", bundle->_url_updated); - plist::get_key_path(*version, "size", bundle->_size); + plist::get_key_path(version, "url", bundle->_url); + plist::get_key_path(version, "updated", bundle->_url_updated); + plist::get_key_path(version, "size", bundle->_size); } - plist::get_key_path(*item, "name", bundle->_name); - plist::get_key_path(*item, "category", bundle->_category); - plist::get_key_path(*item, "html_url", bundle->_html_url); - plist::get_key_path(*item, "contactName", bundle->_contact_name); - plist::get_key_path(*item, "contactEmailRot13", bundle->_contact_email); - plist::get_key_path(*item, "description", bundle->_description); + plist::get_key_path(item, "name", bundle->_name); + plist::get_key_path(item, "category", bundle->_category); + plist::get_key_path(item, "html_url", bundle->_html_url); + plist::get_key_path(item, "contactName", bundle->_contact_name); + plist::get_key_path(item, "contactEmailRot13", bundle->_contact_email); + plist::get_key_path(item, "description", bundle->_description); if(bundle->_contact_email != NULL_STR) bundle->_contact_email = decode::rot13(bundle->_contact_email); plist::array_t grammars; - if(plist::get_key_path(*item, "grammars", grammars)) + if(plist::get_key_path(item, "grammars", grammars)) { parse_grammars_array(grammars, back_inserter(bundle->_grammars)); std::sort(bundle->_grammars.begin(), bundle->_grammars.end(), [](grammar_info_ptr lhs, grammar_info_ptr const& rhs){ return text::less_t()(lhs->name(), rhs->name()); }); } plist::array_t dependencies; - if(plist::get_key_path(*item, "dependencies", dependencies)) + if(plist::get_key_path(item, "dependencies", dependencies)) parse_dependencies_array(dependencies, back_inserter(bundle->_dependencies)); *out++ = bundle; @@ -348,8 +348,8 @@ namespace bundles_db static std::vector remote_bundles (std::string const& installDir) { std::vector res; - citerate(src, bundles_db::sources(installDir)) - parse_remote_bundle_index(*src, back_inserter(res)); + for(auto const& src : bundles_db::sources(installDir)) + parse_remote_bundle_index(src, back_inserter(res)); return res; } @@ -364,15 +364,15 @@ namespace bundles_db plist::dictionary_t const localIndexPlist = plist::load(local_index_path(installDir)); std::set actualPaths, indexedPaths; - citerate(entry, path::entries(base, "*.tm[Bb]undle")) - actualPaths.insert(path::join(base, (*entry)->d_name)); + for(auto const& entry : path::entries(base, "*.tm[Bb]undle")) + actualPaths.insert(path::join(base, entry->d_name)); - iterate(pair, localIndexPlist) + for(auto const& pair : localIndexPlist) { - citerate(item, plist::as_array(pair->second)) + for(auto const& item : plist::as_array(pair.second)) { std::string path; - if(plist::get_key_path(*item, "path", path)) + if(plist::get_key_path(item, "path", path)) indexedPaths.insert(expand_path(path, installDir)); } } @@ -383,17 +383,17 @@ namespace bundles_db std::set_difference(indexedPaths.begin(), indexedPaths.end(), actualPaths.begin(), actualPaths.end(), inserter(inIndexButNotDisk, inIndexButNotDisk.begin())); std::vector res; - iterate(pair, localIndexPlist) + for(auto const& pair : localIndexPlist) { - if(pair->first != "bundles") + if(pair.first != "bundles") continue; - citerate(item, plist::as_array(pair->second)) + for(auto const& item : plist::as_array(pair.second)) { auto bundle = std::make_shared(); - if(!plist::get_key_path(*item, "category", bundle->_category)) + if(!plist::get_key_path(item, "category", bundle->_category)) bundle->_category = "Discontinued"; - if(plist::get_key_path(*item, "source", bundle->_origin) && plist::get_key_path(*item, "name", bundle->_name) && plist::get_key_path(*item, "uuid", bundle->_uuid) && plist::get_key_path(*item, "updated", bundle->_path_updated) && plist::get_key_path(*item, "path", bundle->_path)) + if(plist::get_key_path(item, "source", bundle->_origin) && plist::get_key_path(item, "name", bundle->_name) && plist::get_key_path(item, "uuid", bundle->_uuid) && plist::get_key_path(item, "updated", bundle->_path_updated) && plist::get_key_path(item, "path", bundle->_path)) { bundle->_path = expand_path(bundle->_path, installDir); if(inIndexButNotDisk.find(bundle->_path) == inIndexButNotDisk.end()) @@ -403,18 +403,18 @@ namespace bundles_db } } - iterate(path, onDiskButNotIndex) + for(auto const& path : onDiskButNotIndex) { auto bundle = std::make_shared(); bundle->_category = "Orphaned"; - bundle->_path = *path; - bundle->_path_updated = path::get_attr(*path, kBundleAttributeUpdated); - bundle->_origin = path::get_attr(*path, kBundleAttributeOrigin); + bundle->_path = path; + bundle->_path_updated = path::get_attr(path, kBundleAttributeUpdated); + bundle->_origin = path::get_attr(path, kBundleAttributeOrigin); if(bundle->_origin == NULL_STR) bundle->_origin = "x.unknown.origin"; - plist::dictionary_t infoPlist = plist::load(path::join(*path, "info.plist")); + plist::dictionary_t infoPlist = plist::load(path::join(path, "info.plist")); if(plist::get_key_path(infoPlist, "uuid", bundle->_uuid) && plist::get_key_path(infoPlist, "name", bundle->_name)) { plist::get_key_path(infoPlist, "description", bundle->_description); @@ -436,23 +436,23 @@ namespace bundles_db std::sort(bundlesByRank.begin(), bundlesByRank.end(), [](bundle_ptr const& lhs, bundle_ptr const& rhs){ return lhs->source()->rank() > rhs->source()->rank(); }); std::map bundles; - iterate(bundle, bundlesByRank) - bundles.emplace((*bundle)->uuid(), *bundle); + for(auto const& bundle : bundlesByRank) + bundles.emplace(bundle->uuid(), bundle); - citerate(bundle, bundle_t::local_bundles(installDir)) + for(auto const& bundle : bundle_t::local_bundles(installDir)) { - std::map::iterator remote = bundles.find((*bundle)->uuid()); + std::map::iterator remote = bundles.find(bundle->uuid()); if(remote != bundles.end()) { - remote->second->_name = (*bundle)->_name; - remote->second->_path = (*bundle)->_path; - remote->second->_path_updated = (*bundle)->_path_updated; - remote->second->_origin = (*bundle)->_origin; + remote->second->_name = bundle->_name; + remote->second->_path = bundle->_path; + remote->second->_path_updated = bundle->_path_updated; + remote->second->_origin = bundle->_origin; } else { - bundles.emplace((*bundle)->uuid(), (*bundle)); - fprintf(stderr, "Bundle missing in remote index: ‘%s’ (source ‘%s’)\n", (*bundle)->name().c_str(), (*bundle)->origin().c_str()); + bundles.emplace(bundle->uuid(), bundle); + fprintf(stderr, "Bundle missing in remote index: ‘%s’ (source ‘%s’)\n", bundle->name().c_str(), bundle->origin().c_str()); } } @@ -470,18 +470,18 @@ namespace bundles_db bool save_index (std::vector const& bundles, std::string const& installDir) { plist::dictionary_t plist; - iterate(bundle, bundles) + for(auto const& bundle : bundles) { - if(!(*bundle)->installed()) + if(!bundle->installed()) continue; plist::dictionary_t dict; - dict["name"] = (*bundle)->name(); - dict["uuid"] = to_s((*bundle)->uuid()); - dict["category"] = (*bundle)->category(); - dict["path"] = path::relative_to((*bundle)->path(), local_bundle_path(installDir)); - dict["updated"] = (*bundle)->path_updated(); - dict["source"] = (*bundle)->origin(); + dict["name"] = bundle->name(); + dict["uuid"] = to_s(bundle->uuid()); + dict["category"] = bundle->category(); + dict["path"] = path::relative_to(bundle->path(), local_bundle_path(installDir)); + dict["updated"] = bundle->path_updated(); + dict["source"] = bundle->origin(); plist::dictionary_t::iterator array = plist.find("bundles"); if(array == plist.end()) @@ -578,26 +578,26 @@ namespace bundles_db std::vector dependencies (std::vector const& index, std::vector const& startBundles, bool excludeInstalledBundles, bool excludeStartBundles) { std::map bundles; - iterate(bundle, index) - bundles.emplace((*bundle)->uuid(), *bundle); + for(auto const& bundle : index) + bundles.emplace(bundle->uuid(), bundle); std::set dependencies, queue; - iterate(bundle, startBundles) - queue.insert((*bundle)->uuid()); + for(auto const& bundle : startBundles) + queue.insert(bundle->uuid()); while(!queue.empty()) { dependencies.insert(queue.begin(), queue.end()); std::set tmp; tmp.swap(queue); - iterate(uuid, tmp) + for(auto const& uuid : tmp) { - citerate(dependency, bundles[*uuid]->dependencies(index)) + for(auto const& dependency : bundles[uuid]->dependencies(index)) { - if(dependencies.find((*dependency)->uuid()) == dependencies.end()) + if(dependencies.find(dependency->uuid()) == dependencies.end()) { - dependencies.insert((*dependency)->uuid()); - queue.insert((*dependency)->uuid()); + dependencies.insert(dependency->uuid()); + queue.insert(dependency->uuid()); } } } @@ -606,16 +606,16 @@ namespace bundles_db std::set exclude; if(excludeStartBundles) { - iterate(bundle, startBundles) - exclude.insert((*bundle)->uuid()); + for(auto const& bundle : startBundles) + exclude.insert(bundle->uuid()); } if(excludeInstalledBundles) { - iterate(bundle, index) + for(auto const& bundle : index) { - if((*bundle)->installed()) - exclude.insert((*bundle)->uuid()); + if(bundle->installed()) + exclude.insert(bundle->uuid()); } } @@ -623,8 +623,8 @@ namespace bundles_db std::set_difference(dependencies.begin(), dependencies.end(), exclude.begin(), exclude.end(), back_inserter(missing)); std::vector res; - iterate(uuid, missing) - res.push_back(bundles[*uuid]); + for(auto const& uuid : missing) + res.push_back(bundles[uuid]); std::sort(res.begin(), res.end(), &bundle_name_less); return res; } @@ -633,22 +633,22 @@ namespace bundles_db { std::vector res; std::set seen; - iterate(bundle, bundles) + for(auto const& bundle : bundles) { - iterate(candidate, index) + for(auto const& candidate : index) { - if(onlyInstalledBundles && !(*candidate)->installed()) + if(onlyInstalledBundles && !candidate->installed()) continue; - if(seen.find((*candidate)->uuid()) != seen.end()) + if(seen.find(candidate->uuid()) != seen.end()) continue; - citerate(dependency, (*candidate)->dependencies(index, false)) + for(auto const& dependency : candidate->dependencies(index, false)) { - if((*bundle)->uuid() == (*dependency)->uuid()) + if(bundle->uuid() == dependency->uuid()) { - res.push_back(*candidate); - seen.insert((*candidate)->uuid()); + res.push_back(candidate); + seen.insert(candidate->uuid()); break; } } diff --git a/Shared/include/oak/basic_tree.h b/Shared/include/oak/basic_tree.h index 4f59c05b..90df2b99 100644 --- a/Shared/include/oak/basic_tree.h +++ b/Shared/include/oak/basic_tree.h @@ -410,8 +410,8 @@ namespace oak queue.push_back(current->_right); } - iterate(node, queue) - delete *node; + for(auto const& node : queue) + delete node; } void remove_node (node_t* node) diff --git a/Shared/include/oak/dependency_graph.h b/Shared/include/oak/dependency_graph.h index 8cac77aa..8b679e04 100644 --- a/Shared/include/oak/dependency_graph.h +++ b/Shared/include/oak/dependency_graph.h @@ -30,13 +30,13 @@ namespace oak res.insert(n); active.pop_back(); - iterate(it, dependencies) + for(auto const& it : dependencies) { - std::set::const_iterator node = it->second.find(n); - if(node == it->second.end() || res.find(it->first) != res.end()) + std::set::const_iterator node = it.second.find(n); + if(node == it.second.end() || res.find(it.first) != res.end()) continue; - active.push_back(it->first); + active.push_back(it.first); } } @@ -47,10 +47,10 @@ namespace oak std::vector topological_order () const { std::vector res, active; - iterate(it, dependencies) + for(auto const& it : dependencies) { - if(it->second.empty()) - active.push_back(it->first); + if(it.second.empty()) + active.push_back(it.first); } std::map< size_t, std::set > tmp = dependencies; @@ -60,15 +60,15 @@ namespace oak res.push_back(n); active.pop_back(); - iterate(it, tmp) + for(auto& it : tmp) { - std::set::const_iterator node = it->second.find(n); - if(node == it->second.end()) + std::set::const_iterator node = it.second.find(n); + if(node == it.second.end()) continue; - it->second.erase(node); - if(it->second.empty()) - active.push_back(it->first); + it.second.erase(node); + if(it.second.empty()) + active.push_back(it.first); } } diff --git a/Shared/include/oak/server.h b/Shared/include/oak/server.h index 90918c8c..612de31d 100644 --- a/Shared/include/oak/server.h +++ b/Shared/include/oak/server.h @@ -160,14 +160,14 @@ namespace oak pthread_mutex_unlock(&results_mutex); std::lock_guard lock(client_lock); - iterate(it, offload) + for(auto const& it : offload) { - typename std::map::iterator client = client_to_callback.find(it->first); + typename std::map::iterator client = client_to_callback.find(it.first); if(client != client_to_callback.end()) { T* obj = client->second; client_lock.unlock(); - obj->handle_reply(it->second); + obj->handle_reply(it.second); client_lock.lock(); } } diff --git a/Shared/include/test/cocoa.h b/Shared/include/test/cocoa.h index a7044b6a..f47e1324 100644 --- a/Shared/include/test/cocoa.h +++ b/Shared/include/test/cocoa.h @@ -8,8 +8,8 @@ static BOOL IsGUITestsEnabled (std::string const& testName) { std::set tests; std::string envVar = getenv("GUI_TESTS") ?: ""; - citerate(test, text::tokenize(envVar.begin(), envVar.end(), ' ')) - tests.insert(*test); + for(auto const& test : text::tokenize(envVar.begin(), envVar.end(), ' ')) + tests.insert(test); return tests.find("all") != tests.end() || tests.find(testName) != tests.end(); } diff --git a/Shared/include/test/web_server.h b/Shared/include/test/web_server.h index c6cc5088..ff3e4454 100644 --- a/Shared/include/test/web_server.h +++ b/Shared/include/test/web_server.h @@ -155,8 +155,8 @@ static void send_file_head (int sock, std::string const& path) headers += str; } - citerate(pair, path::attributes(path)) - headers += pair->first + ": " + pair->second + "\r\n"; + for(auto const& pair : path::attributes(path)) + headers += pair.first + ": " + pair.second + "\r\n"; close(fd); send_head(sock, 200, "OK", headers.c_str());