Ejemplo n.º 1
0
 // ===================================================================
 // INFORMATION GATHERING FUNCTIONS
 // -------------------------------------------------------------------
 /// Builds a class field description..
 ///
 /// @param port The visual script port representing the variable.
 /// @param codeBlock The code block that contains this code.
 /// @param accessType THe Access property of the field.
 /// @param scopeType The Scope property of the field.
 /// @return The newly created variable defintion.
 ///
 public VariableDefinition(iCS_EditorObject vsObject, CodeBase parent, AccessSpecifier accessType, ScopeSpecifier scopeType)
     : base(vsObject, parent)
 {
     myAccessSpecifier = accessType;
     myScopeSpecifier  = scopeType;
     myRuntimeType     = vsObject.RuntimeType;
 }
Ejemplo n.º 2
0
 // ===================================================================
 // INFORMATION GATHERING FUNCTIONS
 // -------------------------------------------------------------------
 /// Builds a _class_ specific code context object.
 ///
 /// @param associatedObjects VS objects associated with this code context.
 /// @return The newly created class definition.
 ///
 public ClassDefinition(iCS_EditorObject typeNode, CodeBase parent, Type baseClass,
                        AccessSpecifier accessType, ScopeSpecifier scopeType)
     : base(typeNode, parent)
 {
     myBaseClass       = baseClass;
     myAccessSpecifier = accessType;
     myScopeSpecifier  = scopeType;
     // Add fields
     AddChildConstructorsAsFields();
     AddPublicInterfaces();
     // Add functions
     AddChildFunctions();
 }
Ejemplo n.º 3
0
        // ===================================================================
        // PROPERTIES
        // -------------------------------------------------------------------

        // ===================================================================
        // INFORMATION GATHERING FUNCTIONS
        // -------------------------------------------------------------------
        /// Builds a Function specific code context object.
        ///
        /// @param node VS objects associated with the function.
        /// @param codeBlock The code block this assignment belongs to.
        /// @return The newly created code context.
        ///
        public FunctionDefinition(iCS_EditorObject node, CodeBase parent, AccessSpecifier accessType, ScopeSpecifier scopeType)
            : base(node, parent)
        {
            myAccessSpecifier = accessType;
            myScopeSpecifier  = scopeType;

            // Build parameter list.
            BuildParameterList();

            // Build execution list.
            var generatedCode = GetFunctionBodyParts(node);

            generatedCode = SortDependencies(generatedCode);
            BuildExecutionList(generatedCode);
        }
Ejemplo n.º 4
0
        // -------------------------------------------------------------------
        /// Generate the code for a class field.
        ///
        public string GenerateVariable(int indentSize, AccessSpecifier accessType, ScopeSpecifier scopeType,
                                       Type variableType, string variableName, string initializer)
        {
            string        indent = ToIndent(indentSize);
            StringBuilder result = new StringBuilder(indent);

            if (myParent is ClassDefinition)
            {
                var port     = PortVariable;
                var portSpec = port.PortSpec;
                result.Append(ToAccessString(portSpec));
                result.Append(ToScopeString(portSpec));
            }
            result.Append(ToTypeName(variableType));
            result.Append(" ");
            result.Append(variableName);
            if (!String.IsNullOrEmpty(initializer))
            {
                result.Append("= ");
                result.Append(initializer);
            }
            result.Append(";\n");
            return(result.ToString());
        }
Ejemplo n.º 5
0
        // ===================================================================
        // FIELDS
        // -------------------------------------------------------------------

        // ===================================================================
        // INFORMATION GATHERING FUNCTIONS
        // -------------------------------------------------------------------
        /// Builds a Function specific code context object.
        ///
        /// @param node VS objects associated with the function.
        /// @return The newly created code context.
        ///
        public EventHandlerDefinition(iCS_EditorObject node, CodeBase parent, AccessSpecifier accessType, ScopeSpecifier scopeType)
            : base(node, parent, accessType, scopeType)
        {
            CreateLocalVariables();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns the meta data for all tracks in the current playlist whos attribute contains the given value.
        /// </summary>
        /// <param name="scopeSpecifier">The attribute to search for the given value.</param>
        /// <param name="token">The value to search for in the given attribute.</param>
        /// <returns>The meta data for all tracks in the current playlist whos attribute contains the given value.</returns>
        public List<MpdFile> PlaylistSearch(ScopeSpecifier scopeSpecifier, string token)
        {
            if (token == null)
            throw new ArgumentNullException("token");

              token = EscapeString(token);
              MpdResponse response = this.getConnection().Exec("playlistsearch", new string[] { this.toTag(scopeSpecifier), token });

              if (response.IsError)
            throw new MpdResponseException(response.ErrorCode, response.ErrorMessage);

              return MpdFile.buildList(response);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns all values for the given attribute found in files of the MPD where another attribute matches a given value.
        /// </summary>
        /// <param name="resultTag">The attribute whos values are returns.</param>
        /// <param name="searchTag">The attribute whos value should match a given value for the file to be included in the result.</param>
        /// <param name="searchValue">The value the searchTag attribute must match for the file to be included in the result.</param>
        /// <returns>All values found in files of the MPD for the given attribute.</returns>
        public List<string> List(ScopeSpecifier resultTag, ScopeSpecifier searchTag, string searchValue)
        {
            if (searchValue == null)
            throw new ArgumentNullException("searchValue");

              searchValue = EscapeString(searchValue);
              MpdResponse response = this.getConnection().Exec("list", new string[] { this.toTag(resultTag), this.toTag(searchTag), searchValue });

              if (response.IsError)
            throw new MpdResponseException(response.ErrorCode, response.ErrorMessage);

              return response.getValueList();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns all values found in files of the MPD for the given attribute.
        /// </summary>
        /// <param name="scopeSpecifier">The attribute who's values are requested.</param>
        /// <returns>All values found in files of the MPD for the given attribute.</returns>
        public List<string> List(ScopeSpecifier scopeSpecifier)
        {
            MpdResponse response = this.getConnection().Exec("list", new string[] { this.toTag(scopeSpecifier) });

              if (response.IsError)
            throw new MpdResponseException(response.ErrorCode, response.ErrorMessage);

              return response.getValueList();
        }
Ejemplo n.º 9
0
 private string toTag(ScopeSpecifier scopeSpecifier)
 {
     switch (scopeSpecifier) {
     default:
       throw new ArgumentException("scopeSpecifier");
     case ScopeSpecifier.Any:
       return TAG_ANY;
     case ScopeSpecifier.Filename:
       return TAG_FILENAME;
     case ScopeSpecifier.Artist:
       return TAG_ARTIST;
     case ScopeSpecifier.Album:
       return TAG_ALBUM;
     case ScopeSpecifier.Title:
       return TAG_TITLE;
     case ScopeSpecifier.Track:
       return TAG_TRACK;
     case ScopeSpecifier.Name:
       return TAG_NAME;
     case ScopeSpecifier.Genre:
       return TAG_GENRE;
     case ScopeSpecifier.Date:
       return TAG_DATE;
     case ScopeSpecifier.Composer:
       return TAG_COMPOSER;
     case ScopeSpecifier.Performer:
       return TAG_PERFORMER;
     case ScopeSpecifier.Comment:
       return TAG_COMMENT;
     case ScopeSpecifier.Disc:
       return TAG_DISC;
       }
 }