예제 #1
0
 /// <summary>
 /// Determines if an operator will be reflected.
 /// </summary>
 /// <param name="nrOperator">The operator to test.</param>
 /// <returns>
 /// <c>True</c> if the operator should be reflected.
 /// </returns>
 public bool Reflect(NROperator nrOperator)
 {
     return(IsUnsafePointer(nrOperator.Type.Name) || HasUnsafeParameters(nrOperator.Parameters) ? false : filter.Reflect(nrOperator));
 }
예제 #2
0
 /// <summary>
 /// Determines if an operator will be reflected.
 /// </summary>
 /// <param name="nrOperator">The operator to test.</param>
 /// <returns>
 /// <c>True</c> if the operator should be reflected.
 /// </returns>
 public bool Reflect(NROperator nrOperator)
 {
   return IsUnsafePointer(nrOperator.Type) || HasUnsafeParameters(nrOperator.Parameters) ? false : filter.Reflect(nrOperator);
 }
예제 #3
0
파일: CSharp.cs 프로젝트: nagyistge/NClass
        /// <summary>
        /// Gets the <see cref="NROperator"/> as a C# string.
        /// </summary>
        /// <param name="nrOperator">The operator to get the code for.</param>
        /// <returns>A string representing the operator.</returns>
        public static string Declaration(this NROperator nrOperator)
        {
            string accessModifier = AddSpace(nrOperator.AccessModifier.Declaration());
            string modifier       = AddSpace(nrOperator.OperationModifier.Declaration());
            string returnType     = "";

            if (nrOperator.OperatorType != OperatorType.Implicit && nrOperator.OperatorType != OperatorType.Explicit)
            {
                returnType = nrOperator.Type.Declaration() + " ";
            }

            string name;

            switch (nrOperator.OperatorType)
            {
            case OperatorType.UnaryPlus:
                name = "operator +";
                break;

            case OperatorType.UnaryNegation:
                name = "operator -";
                break;

            case OperatorType.LogicalNot:
                name = "operator !";
                break;

            case OperatorType.OnesComplement:
                name = "operator ~";
                break;

            case OperatorType.Increment:
                name = "operator ++";
                break;

            case OperatorType.Decrement:
                name = "operator --";
                break;

            case OperatorType.True:
                name = "operator true";
                break;

            case OperatorType.False:
                name = "operator false";
                break;

            case OperatorType.Addition:
                name = "operator +";
                break;

            case OperatorType.Subtraction:
                name = "operator -";
                break;

            case OperatorType.Multiply:
                name = "operator *";
                break;

            case OperatorType.Division:
                name = "operator /";
                break;

            case OperatorType.Modulus:
                name = "operator %";
                break;

            case OperatorType.BitwiseAnd:
                name = "operator &";
                break;

            case OperatorType.BitwiseOr:
                name = "operator |";
                break;

            case OperatorType.ExclusiveOr:
                name = "operator ^";
                break;

            case OperatorType.LeftShift:
                name = "operator <<";
                break;

            case OperatorType.RightShift:
                name = "operator >>";
                break;

            case OperatorType.Equality:
                name = "operator ==";
                break;

            case OperatorType.Inequality:
                name = "operator !=";
                break;

            case OperatorType.LessThan:
                name = "operator <";
                break;

            case OperatorType.GreaterThan:
                name = "operator >";
                break;

            case OperatorType.LessThanOrEqual:
                name = "operator <=";
                break;

            case OperatorType.GreaterThanOrEqual:
                name = "operator >=";
                break;

            case OperatorType.Implicit:
                name = "implicit operator " + nrOperator.Type.Declaration();
                break;

            case OperatorType.Explicit:
                name = "explicit operator " + nrOperator.Type.Declaration();
                break;

            default:
                name = nrOperator.Name;
                break;
            }
//    public static explicit operator int(OperatorTests i) { return 0; }
//    public static implicit operator long(OperatorTests i) { return 0; }
            return(String.Format("{0}{1}{2}{3}({4})", accessModifier, modifier, returnType, name,
                                 nrOperator.Parameters.Declaration()));
        }
예제 #4
0
 /// <summary>
 ///     Determines if an operator will be reflected.
 /// </summary>
 /// <param name="nrOperator">The operator to test.</param>
 /// <returns><c>True</c> if the operator should be reflected.</returns>
 public bool Reflect(NROperator nrOperator)
 {
     return(!Filter.Reflect(nrOperator));
 }
예제 #5
0
 public NROperatorDeclaration(NROperator oper)
 {
     this.oper = oper;
 }
예제 #6
0
 /// <summary>
 /// Determines if an operator will be reflected.
 /// </summary>
 /// <param name="nrOperator">The operator to test.</param>
 /// <returns>
 /// <c>True</c> if the operator should be reflected.
 /// </returns>
 public bool Reflect(NROperator nrOperator)
 {
     return(filter.Reflect(nrOperator) && CanImportParameters(nrOperator.Parameters) && CanImportTypeUsage(nrOperator.Type));
 }
예제 #7
0
 /// <summary>
 /// Determines if an operator will be reflected.
 /// </summary>
 /// <param name="nrOperator">The operator to test.</param>
 /// <returns><c>True</c> if the operator should be reflected.</returns>
 public bool Reflect(NROperator nrOperator)
 {
     return(Reflect(FilterElements.Operator, nrOperator));
 }