mirror of
https://github.com/textmate/textmate.git
synced 2026-01-22 21:27:56 -05:00
Minor speed improvement in creating bundle index
This commit is contained in:
@@ -72,64 +72,70 @@ namespace bundles
|
||||
_required_bundles.clear();
|
||||
_required_executables.clear();
|
||||
|
||||
plist::get_key_path(plist, kFieldIsDisabled, _disabled);
|
||||
plist::get_key_path(plist, kFieldIsDeleted, _deleted);
|
||||
plist::get_key_path(plist, kFieldHideFromUser, _hidden_from_user);
|
||||
|
||||
iterate(pair, plist)
|
||||
for(auto const& pair : plist)
|
||||
{
|
||||
static std::set<std::string> const stringKeys = { kFieldName, kFieldKeyEquivalent, kFieldTabTrigger, kFieldScopeSelector, kFieldSemanticClass, kFieldContentMatch, kFieldGrammarFirstLineMatch, kFieldGrammarScope, kFieldGrammarInjectionSelector };
|
||||
static std::set<std::string> const arrayKeys = { kFieldDropExtension, kFieldGrammarExtension };
|
||||
|
||||
if(pair->first == kFieldScopeSelector)
|
||||
if(pair.first == kFieldScopeSelector)
|
||||
{
|
||||
if(std::string const* str = boost::get<std::string>(&pair->second))
|
||||
if(std::string const* str = boost::get<std::string>(&pair.second))
|
||||
_scope_selector = *str;
|
||||
}
|
||||
else if(stringKeys.find(pair->first) != stringKeys.end())
|
||||
else if(stringKeys.find(pair.first) != stringKeys.end())
|
||||
{
|
||||
if(std::string const* str = boost::get<std::string>(&pair->second))
|
||||
_fields.insert(std::make_pair(pair->first, *str));
|
||||
if(std::string const* str = boost::get<std::string>(&pair.second))
|
||||
_fields.insert(std::make_pair(pair.first, *str));
|
||||
}
|
||||
else if(arrayKeys.find(pair->first) != arrayKeys.end())
|
||||
else if(arrayKeys.find(pair.first) != arrayKeys.end())
|
||||
{
|
||||
if(plist::array_t const* array = boost::get<plist::array_t>(&pair->second))
|
||||
if(plist::array_t const* array = boost::get<plist::array_t>(&pair.second))
|
||||
{
|
||||
iterate(any, *array)
|
||||
{
|
||||
if(std::string const* str = boost::get<std::string>(&*any))
|
||||
_fields.insert(std::make_pair(pair->first, *str));
|
||||
_fields.insert(std::make_pair(pair.first, *str));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pair->first == kFieldSettingName)
|
||||
else if(pair.first == kFieldSettingName)
|
||||
{
|
||||
// initialize from a tmSettings file
|
||||
if(plist::dictionary_t const* dictionary = boost::get<plist::dictionary_t>(&pair->second))
|
||||
if(plist::dictionary_t const* dictionary = boost::get<plist::dictionary_t>(&pair.second))
|
||||
{
|
||||
iterate(dictPair, *dictionary)
|
||||
_fields.insert(std::make_pair(pair->first, dictPair->first));
|
||||
_fields.insert(std::make_pair(pair.first, dictPair->first));
|
||||
}
|
||||
else if(plist::array_t const* array = boost::get<plist::array_t>(&pair->second))
|
||||
else if(plist::array_t const* array = boost::get<plist::array_t>(&pair.second))
|
||||
{
|
||||
iterate(any, *array) // initialize from cache
|
||||
{
|
||||
if(std::string const* str = boost::get<std::string>(&*any))
|
||||
_fields.insert(std::make_pair(pair->first, *str));
|
||||
_fields.insert(std::make_pair(pair.first, *str));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plist::array_t require;
|
||||
if(plist::get_key_path(plist, kFieldRequiredItems, require))
|
||||
{
|
||||
iterate(it, require)
|
||||
else if(pair.first == kFieldIsDisabled)
|
||||
{
|
||||
std::string name;
|
||||
oak::uuid_t uuid;
|
||||
if(plist::get_key_path(*it, kFieldName, name) && plist::get_key_path(*it, kFieldUUID, uuid))
|
||||
_required_bundles.emplace_back(name, uuid);
|
||||
_disabled = plist::is_true(pair.second);
|
||||
}
|
||||
else if(pair.first == kFieldIsDeleted)
|
||||
{
|
||||
_deleted = plist::is_true(pair.second);
|
||||
}
|
||||
else if(pair.first == kFieldHideFromUser)
|
||||
{
|
||||
_hidden_from_user = plist::is_true(pair.second);
|
||||
}
|
||||
else if(pair.first == kFieldRequiredItems && boost::get<plist::array_t>(&pair.second))
|
||||
{
|
||||
for(auto const& dict : boost::get<plist::array_t>(pair.second))
|
||||
{
|
||||
std::string name;
|
||||
oak::uuid_t uuid;
|
||||
if(plist::get_key_path(dict, kFieldName, name) && plist::get_key_path(dict, kFieldUUID, uuid))
|
||||
_required_bundles.emplace_back(name, uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user