Exemple #1
0
        /// <summary>
        /// Sets the boolean value of the specified attribute argument.
        ///
        /// <param name="attribute">attribute name</param>
        /// <param name="argument">argument name</param>
        /// <param name="value">bool value</param>
        /// </summary>
        public void set_attribute_bool(string attribute, string argument, bool value, SourceReference source_reference = null)
        {
            var a = get_attribute(attribute);

            if (a == null)
            {
                a = new ValaAttribute(attribute, source_reference);
                attributes.Add(a);
            }
            a.add_argument(argument, value.ToString());
        }
Exemple #2
0
        /// <summary>
        /// Sets the integer value of the specified attribute argument.
        ///
        /// <param name="attribute">attribute name</param>
        /// <param name="argument">argument name</param>
        /// <param name="value">double value</param>
        /// </summary>
        public void set_attribute_double(string attribute, string argument, double value, SourceReference source_reference = null)
        {
            var a = get_attribute(attribute);

            if (a == null)
            {
                a = new ValaAttribute(attribute, source_reference);
                attributes.Add(a);
            }

            a.add_argument(argument, value.ToString("0.00", CultureInfo.InvariantCulture));
        }
Exemple #3
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            ValaAttribute other = obj as ValaAttribute;

            if (other == null)
            {
                throw new ArgumentException("Object is not a ValaAttribute");
            }

            return(this.name.CompareTo(other.name));
        }
Exemple #4
0
        /// <summary>
        /// Sets the string value of the specified attribute argument.
        ///
        /// <param name="attribute">attribute name</param>
        /// <param name="argument">argument name</param>
        /// <param name="value">string value</param>
        /// </summary>
        public void set_attribute_string(string attribute, string argument, string value, SourceReference source_reference = null)
        {
            if (value == null)
            {
                remove_attribute_argument(attribute, argument);
                return;
            }

            var a = get_attribute(attribute);

            if (a == null)
            {
                a = new ValaAttribute(attribute, source_reference);
                attributes.Add(a);
            }
            a.add_argument(argument, "\"%s\"".printf(value));
        }