Example #1
0
bool BuildSystem::
parse(Context *context, plist::Dictionary const *dict, std::unordered_set<std::string> *seen, bool check)
{
    if (!Specification::parse(context, dict, seen, false))
        return false;

    auto unpack = plist::Keys::Unpack("BuildSystem", dict, seen);

    auto Os  = unpack.cast <plist::Array> ("Options");
    auto Ps  = unpack.cast <plist::Array> ("Properties");
    auto DPs = unpack.cast <plist::Array> ("DeletedProperties");

    if (!unpack.complete(check)) {
        fprintf(stderr, "%s", unpack.errors().c_str());
    }

    if (Os != nullptr) {
        _options = PropertyOption::vector();
        for (size_t n = 0; n < Os->count(); n++) {
            if (auto O = Os->value <plist::Dictionary> (n)) {
                PropertyOption::shared_ptr option;
                option.reset(new PropertyOption);
                if (option->parse(O)) {
                    PropertyOption::Insert(&*_options, &_optionsUsed, option);
                }
            }
        }
    }

    if (Ps != nullptr) {
        _properties = PropertyOption::vector();
        for (size_t n = 0; n < Ps->count(); n++) {
            if (auto P = Ps->value <plist::Dictionary> (n)) {
                PropertyOption::shared_ptr property;
                property.reset(new PropertyOption);
                if (property->parse(P)) {
                    PropertyOption::Insert(&*_properties, &_propertiesUsed, property);
                }
            }
        }
    }

    if (DPs != nullptr) {
        _deletedProperties = std::unordered_set<std::string>();
        for (size_t n = 0; n < DPs->count(); n++) {
            if (auto DP = DPs->value <plist::String> (n)) {
                _deletedProperties->insert(DP->value());
            }
        }
    }

    return true;
}
Example #2
0
bool BuildSettings::
parse(Context *context, plist::Dictionary const *dict, std::unordered_set<std::string> *seen, bool check)
{
    if (!Specification::parse(context, dict, seen, false))
        return false;

    auto unpack = plist::Keys::Unpack("BuildSettings", dict, seen);

    auto Os = unpack.cast <plist::Array> ("Options");

    if (!unpack.complete(check)) {
        fprintf(stderr, "%s", unpack.errorText().c_str());
    }

    if (Os != nullptr) {
        _options = PropertyOption::vector();
        for (size_t n = 0; n < Os->count(); n++) {
            if (auto O = Os->value <plist::Dictionary> (n)) {
                PropertyOption::shared_ptr option;
                option.reset(new PropertyOption);
                if (option->parse(O)) {
                    PropertyOption::Insert(&*_options, &_optionsUsed, option);
                }
            }
        }
    }

    return true;
}