160916893Sopenharmony_ci/*
260916893Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
360916893Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
460916893Sopenharmony_ci * you may not use this file except in compliance with the License.
560916893Sopenharmony_ci * You may obtain a copy of the License at
660916893Sopenharmony_ci *
760916893Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
860916893Sopenharmony_ci *
960916893Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1060916893Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1160916893Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1260916893Sopenharmony_ci * See the License for the specific language governing permissions and
1360916893Sopenharmony_ci * limitations under the License.
1460916893Sopenharmony_ci */
1560916893Sopenharmony_ci
1660916893Sopenharmony_ci#include "plural_rules.h"
1760916893Sopenharmony_ci
1860916893Sopenharmony_ciusing namespace OHOS::I18N;
1960916893Sopenharmony_ci
2060916893Sopenharmony_ciPluralRules::PluralRules(std::string *rules, const int rulesLength, const int *ruleSize, const int sizesLength)
2160916893Sopenharmony_ci{
2260916893Sopenharmony_ci    if ((rules != nullptr) && (ruleSize != nullptr) &&
2360916893Sopenharmony_ci        (rulesLength > PluralRuleType::OTHER) && (sizesLength > PluralRuleType::OTHER)) {
2460916893Sopenharmony_ci        mZeroRule = rules[PluralRuleType::ZERO];
2560916893Sopenharmony_ci        mZeroRuleSize = ruleSize[PluralRuleType::ZERO];
2660916893Sopenharmony_ci        mOneRule = rules[PluralRuleType::ONE];
2760916893Sopenharmony_ci        mOneRuleSize = ruleSize[PluralRuleType::ONE];
2860916893Sopenharmony_ci        mTwoRule = rules[PluralRuleType::TWO];
2960916893Sopenharmony_ci        mTwoRuleSize = ruleSize[PluralRuleType::TWO];
3060916893Sopenharmony_ci        mFewRule = rules[PluralRuleType::FEW];
3160916893Sopenharmony_ci        mFewRuleSize = ruleSize[PluralRuleType::FEW];
3260916893Sopenharmony_ci        mManyRule = rules[PluralRuleType::MANY];
3360916893Sopenharmony_ci        mManyRuleSize = ruleSize[PluralRuleType::MANY];
3460916893Sopenharmony_ci        mOtherRule = rules[PluralRuleType::OTHER];
3560916893Sopenharmony_ci        mOtherRuleSize = ruleSize[PluralRuleType::OTHER];
3660916893Sopenharmony_ci    }
3760916893Sopenharmony_ci}
3860916893Sopenharmony_ci
3960916893Sopenharmony_ciPluralRules::~PluralRules() {}