GetLineInformation() public static method

public static GetLineInformation ( string line, Scope &scope, ParsedType &type, string &variableName, bool &isConst, bool &isVirtual, bool &isOverride, bool &isStatic, bool &isNew, bool &isAsync, string &valueToAssignTo ) : void
line string
scope Scope
type ParsedType
variableName string
isConst bool
isVirtual bool
isOverride bool
isStatic bool
isNew bool
isAsync bool
valueToAssignTo string
return void
コード例 #1
0
        public static ParsedField GetParsedField(string line)
        {
            Scope      scope;
            ParsedType type;
            string     variableName;
            bool       isConst;
            string     valueToAssignTo;
            bool       isVirtual;
            bool       isOverride;
            bool       isStatic;
            bool       isNew;
            bool       isAsync;


            ParsedMethod.GetLineInformation(line, out scope, out type, out variableName, out isConst, out isVirtual,
                                            out isOverride, out isStatic, out isNew, out isAsync, out valueToAssignTo);

            ParsedField parsedField = new ParsedField();

            parsedField.Scope           = scope;
            parsedField.Type            = type;
            parsedField.Name            = variableName;
            parsedField.IsConst         = isConst;
            parsedField.IsStatic        = isStatic;
            parsedField.ValueToAssignTo = valueToAssignTo;

            return(parsedField);
        }
コード例 #2
0
        private void CreateParsedProperty()
        {
            // For now we'll assume that all properties are on
            // the same line.  Eventually we may want to combine
            // all lines before the opening bracket

            string headerLine = mCurrentBlock[0];

            #region Get header information

            Scope      scope;
            ParsedType type;
            string     variableName;
            bool       isConst; // will always be false for properties
            string     valueToAssignTo;
            bool       isVirtual;
            bool       isOverride;
            bool       isStatic;
            bool       isNew;
            bool       isAsync;

            ParsedMethod.GetLineInformation(headerLine, out scope, out type, out variableName, out isConst, out isVirtual,
                                            out isOverride, out isStatic, out isNew, out isAsync, out valueToAssignTo);

            ParsedProperty parsedProperty = new ParsedProperty();
            parsedProperty.Scope     = scope;
            parsedProperty.Type      = type;
            parsedProperty.Name      = variableName;
            parsedProperty.IsVirtual = isVirtual;
            parsedProperty.IsStatic  = isStatic;

            #endregion

            StringBuilder getterLines = new StringBuilder();

            StringBuilder setterLines = new StringBuilder();

            bool hasGetter;
            bool hasSetter;

            bool hasAutomaticGetter;
            bool hasAutomaticSetter;

            FillGettersAndSetters(getterLines, setterLines, true, false, out hasGetter, out hasSetter, out hasAutomaticGetter, out hasAutomaticSetter);

            parsedProperty.HasAutomaticGetter = hasAutomaticGetter;
            parsedProperty.HasAutomaticSetter = hasAutomaticSetter;

            if (hasGetter)
            {
                parsedProperty.GetContents = getterLines.ToString();
            }
            else
            {
                parsedProperty.GetContents = null;
            }

            if (hasSetter)
            {
                parsedProperty.SetContents = setterLines.ToString();
            }
            else
            {
                parsedProperty.SetContents = null;
            }

            parsedProperty.Attributes.AddRange(CurrentAttributes);

            mParsedProperties.Add(parsedProperty);
        }