Exemplo n.º 1
0
 internal static bool TryConstruct(IEnumerable <string> pFlags, out cFetchableFlagList rFlags)
 {
     if (pFlags == null)
     {
         rFlags = null; return(false);
     }
     foreach (var lFlag in pFlags)
     {
         if (!ZIsValidFlag(lFlag))
         {
             rFlags = null; return(false);
         }
     }
     rFlags = new cFetchableFlagList(new List <string>(pFlags.Distinct(StringComparer.InvariantCultureIgnoreCase)));
     return(true);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a filter that is the logical AND of the two specified filters.
        /// </summary>
        /// <param name="pA"></param>
        /// <param name="pB"></param>
        /// <returns></returns>
        public static cFilter operator &(cFilter pA, cFilter pB)
        {
            if (pA == null)
            {
                throw new ArgumentNullException(nameof(pA));
            }
            if (pB == null)
            {
                throw new ArgumentNullException(nameof(pB));
            }

            if (pA is cFilterFlagsContain lFCA && pB is cFilterFlagsContain lFCB)
            {
                cFetchableFlagList lFlags = new cFetchableFlagList();
                lFlags.Add(lFCA.Flags);
                lFlags.Add(lFCB.Flags);
                return(new cFilterFlagsContain(lFlags));
            }

            List <cFilter> lItems = new List <cFilter>();

            if (pA is cFilterAnd lAA)
            {
                lItems.AddRange(lAA.Terms);
            }
            else
            {
                lItems.Add(pA);
            }

            if (pB is cFilterAnd lAB)
            {
                lItems.AddRange(lAB.Terms);
            }
            else
            {
                lItems.Add(pB);
            }

            return(new cFilterAnd(lItems));
        }
Exemplo n.º 3
0
 /// <inheritdoc cref="cFetchableFlags(cFetchableFlagList)"/>
 public cFetchableFlagList(cFetchableFlagList pFlags) : base(new List <string>(pFlags))
 {
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initialises a new instance with a copy of the specified list.
 /// </summary>
 /// <param name="pFlags"></param>
 public cFetchableFlags(cFetchableFlagList pFlags) : base(pFlags)
 {
 }