예제 #1
0
                /// <summary>
                ///  currencySpacing{
                ///      afterCurrency{
                ///          currencyMatch{"[:^S:]"}
                ///          insertBetween{" "}
                ///          surroundingMatch{"[:digit:]"}
                ///      }
                ///      beforeCurrency{
                ///          currencyMatch{"[:^S:]"}
                ///          insertBetween{" "}
                ///          surroundingMatch{"[:digit:]"}
                ///      }
                ///  }
                /// </summary>
                internal void ConsumeCurrencySpacingTable(ResourceKey key, ResourceValue value)
                {
                    Debug.Assert(spacingInfo != null);
                    IResourceTable spacingTypesTable = value.GetTable();

                    for (int i = 0; spacingTypesTable.GetKeyAndValue(i, key, value); ++i)
                    {
                        CurrencySpacingInfo.SpacingType type;
                        if (key.ContentEquals("beforeCurrency"))
                        {
                            type = CurrencySpacingInfo.SpacingType.Before;
                            spacingInfo.HasBeforeCurrency = true;
                        }
                        else if (key.ContentEquals("afterCurrency"))
                        {
                            type = CurrencySpacingInfo.SpacingType.After;
                            spacingInfo.HasAfterCurrency = true;
                        }
                        else
                        {
                            continue;
                        }

                        IResourceTable patternsTable = value.GetTable();
                        for (int j = 0; patternsTable.GetKeyAndValue(j, key, value); ++j)
                        {
                            CurrencySpacingInfo.SpacingPattern pattern;
                            if (key.ContentEquals("currencyMatch"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.CurrencyMatch;
                            }
                            else if (key.ContentEquals("surroundingMatch"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.SurroundingMatch;
                            }
                            else if (key.ContentEquals("insertBetween"))
                            {
                                pattern = CurrencySpacingInfo.SpacingPattern.InsertBetween;
                            }
                            else
                            {
                                continue;
                            }

                            spacingInfo.SetSymbolIfNull(type, pattern, value.GetString());
                        }
                    }
                }
예제 #2
0
                private void ConsumeTopTable(ResourceKey key, ResourceValue value)
                {
                    IResourceTable table = value.GetTable();

                    for (int i = 0; table.GetKeyAndValue(i, key, value); i++)
                    {
                        if (key.ContentEquals("Currencies"))
                        {
                            ConsumeCurrenciesTable(key, value);
                        }
                        else if (key.ContentEquals("Currencies%variant"))
                        {
                            ConsumeCurrenciesVariantTable(key, value);
                        }
                        else if (key.ContentEquals("CurrencyPlurals"))
                        {
                            ConsumeCurrencyPluralsTable(key, value);
                        }
                    }
                }