Пример #1
0
        ///////////////////////////////////////////////////////////////////////

        #region ToString Methods
        public ReturnCode ToList(
            string pattern,
            bool noCase,
            bool fullName,
            bool qualified,
            ref StringList list,
            ref Result error
            )
        {
            StringList inputList = new StringList();

            foreach (Type type in this)
            {
                if (type != null)
                {
                    inputList.Add(FormatOps.QualifiedAndOrFullName(
                                      type, fullName, qualified, false));
                }
            }

            if (list == null)
            {
                list = new StringList();
            }

            return(GenericOps <string> .FilterList(
                       inputList, list, Index.Invalid, Index.Invalid,
                       ToStringFlags.None, pattern, noCase, ref error));
        }
Пример #2
0
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode ToList(
            AliasFlags hasFlags,
            AliasFlags notHasFlags,
            bool hasAll,
            bool notHasAll,
            string pattern,
            bool noCase,
            ref StringList list,
            ref Result error
            )
        {
            StringList inputList;

            //
            // NOTE: If no flags were supplied, we do not bother filtering on
            //       them.
            //
            if ((hasFlags == AliasFlags.None) &&
                (notHasFlags == AliasFlags.None))
            {
                inputList = new StringList(this.Keys);
            }
            else
            {
                inputList = new StringList();

                foreach (KeyValuePair <string, _Wrappers.Alias> pair in this)
                {
                    IAlias alias = pair.Value as IAlias;

                    if (alias == null)
                    {
                        continue;
                    }

                    if (((hasFlags == AliasFlags.None) ||
                         FlagOps.HasFlags(
                             alias.AliasFlags, hasFlags, hasAll)) &&
                        ((notHasFlags == AliasFlags.None) ||
                         !FlagOps.HasFlags(
                             alias.AliasFlags, notHasFlags, notHasAll)))
                    {
                        inputList.Add(pair.Key);
                    }
                }
            }

            if (list == null)
            {
                list = new StringList();
            }

            return(GenericOps <string> .FilterList(
                       inputList, list, Index.Invalid, Index.Invalid,
                       ToStringFlags.None, pattern, noCase, ref error));
        }
Пример #3
0
        ///////////////////////////////////////////////////////////////////////

        public IStringList ToList(
            string pattern,
            bool empty,
            bool noCase
            )
        {
            StringPairList inputList;
            StringPairList outputList = new StringPairList();

            if (empty)
            {
                inputList = this;
            }
            else
            {
                inputList = new StringPairList();

                foreach (IPair <string> element in this)
                {
                    if (element == null)
                    {
                        continue;
                    }

                    if (String.IsNullOrEmpty(element.X) &&
                        String.IsNullOrEmpty(element.Y))
                    {
                        continue;
                    }

                    inputList.Add(element);
                }
            }

            ReturnCode code;
            Result     error = null;

            code = GenericOps <IPair <string> > .FilterList(
                inputList, outputList, Index.Invalid, Index.Invalid,
                ToStringFlags.None, pattern, noCase, ref error);

            if (code != ReturnCode.Ok)
            {
                DebugOps.Complain(code, error);

                //
                // TODO: Return null in the error case here?
                //
                outputList = null;
            }

            return(outputList);
        }
Пример #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Dead Code
#if DEAD_CODE
        private ReturnCode ToList(
            string pattern,
            bool noCase,
            ref StringList list,
            ref Result error
            )
        {
            StringList inputList = new StringList(this.Keys);

            if (list == null)
            {
                list = new StringList();
            }

            return(GenericOps <string> .FilterList(inputList, list, Index.Invalid,
                                                   Index.Invalid, ToStringFlags.None, pattern, noCase, ref error));
        }
Пример #5
0
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode ToList(
            OperatorFlags hasFlags,
            OperatorFlags notHasFlags,
            bool hasAll,
            bool notHasAll,
            string pattern,
            bool noCase,
            ref StringList list,
            ref Result error
            )
        {
            StringList inputList;

            //
            // NOTE: If no flags were supplied, we do not bother filtering on
            //       them.
            //
            if ((hasFlags == OperatorFlags.None) &&
                (notHasFlags == OperatorFlags.None))
            {
                inputList = new StringList();

                foreach (KeyValuePair <string, _Wrappers.Operator> pair in this)
                {
                    _Wrappers.Operator @operator = pair.Value;

                    if (@operator != null)
                    {
                        inputList.Add(StringList.MakeList(
                                          @operator.Lexeme.ToString(),
                                          @operator.Operands.ToString(),
                                          @operator.Flags.ToString(),
                                          pair.Key));
                    }
                }
            }
            else
            {
                inputList = new StringList();

                foreach (KeyValuePair <string, _Wrappers.Operator> pair in this)
                {
                    _Wrappers.Operator @operator = pair.Value;

                    if (@operator != null)
                    {
                        if (((hasFlags == OperatorFlags.None) ||
                             FlagOps.HasFlags(@operator.Flags,
                                              hasFlags, hasAll)) &&
                            ((notHasFlags == OperatorFlags.None) ||
                             !FlagOps.HasFlags(@operator.Flags,
                                               notHasFlags, notHasAll)))
                        {
                            inputList.Add(StringList.MakeList(
                                              @operator.Lexeme.ToString(),
                                              @operator.Operands.ToString(),
                                              @operator.Flags.ToString(),
                                              pair.Key));
                        }
                    }
                }
            }

            if (list == null)
            {
                list = new StringList();
            }

            return(GenericOps <string> .FilterList(
                       inputList, list, Index.Invalid, Index.Invalid,
                       ToStringFlags.None, pattern, noCase, ref error));
        }