Example #1
0
        public void AddTag(string codepoint, string tag)
        {
            /* Make sure this tag doesn't already exist. Why not use a set?
            * Because the user might care about the order of their tags. */
            if (CodepointToTags.ContainsKey(codepoint))
            {
                string upperTag = tag.ToUpper();
                foreach (string existingTag in CodepointToTags[codepoint])
                {
                    if (upperTag == existingTag.ToUpper())
                    {
                        return;
                    }
                }
            }

            if (!TagToCodepoints.ContainsKey(tag))
            {
                TagToCodepoints[tag] = new List <string>();
            }
            TagToCodepoints[tag].Add(codepoint);

            if (!CodepointToTags.ContainsKey(codepoint))
            {
                CodepointToTags[codepoint] = new List <string>();
            }
            CodepointToTags[codepoint].Add(tag);
        }
Example #2
0
 public IEnumerable <string> GetCodepoints(string tag)
 {
     if (TagToCodepoints.ContainsKey(tag))
     {
         return(TagToCodepoints[tag]);
     }
     else
     {
         return(Enumerable.Empty <string>());
     }
 }
Example #3
0
        public void RemoveTag(string codepoint, string tag)
        {
            if (TagToCodepoints.ContainsKey(tag))
            {
                TagToCodepoints[tag].Remove(codepoint);
            }

            if (CodepointToTags.ContainsKey(codepoint))
            {
                CodepointToTags[codepoint].Remove(tag);
            }
        }