• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xoofx / CppAst.NET / 9148471389

19 May 2024 02:45PM UTC coverage: 79.192% (+1.3%) from 77.88%
9148471389

push

github

xoofx
Remove equality operator on CppElement

1046 of 1667 branches covered (62.75%)

Branch coverage included in aggregate %.

1 of 2 new or added lines in 1 file covered. (50.0%)

7 existing lines in 7 files now uncovered.

4499 of 5335 relevant lines covered (84.33%)

2300.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/src/CppAst/CppFunctionType.cs
1
// Copyright (c) Alexandre Mutel. All rights reserved.
2
// Licensed under the BSD-Clause 2 license.
3
// See license.txt file in the project root for full license information.
4

5
using System;
6
using System.Collections.Generic;
7
using System.Text;
8

9
namespace CppAst
10
{
11
    /// <summary>
12
    /// A C++ function type (e.g `void (*)(int arg1, int arg2)`)
13
    /// </summary>
14
    public sealed class CppFunctionType : CppTypeDeclaration
15
    {
16
        /// <summary>
17
        /// Constructor of a function type.
18
        /// </summary>
19
        /// <param name="returnType">Return type of this function type.</param>
20
        public CppFunctionType(CppType returnType) : base(CppTypeKind.Function)
16✔
21
        {
22
            ReturnType = returnType ?? throw new ArgumentNullException(nameof(returnType));
16!
23
            Parameters = new CppContainerList<CppParameter>(this);
16✔
24
        }
16✔
25

26
        /// <summary>
27
        /// Gets or sets the calling convention of this function type.
28
        /// </summary>
29
        public CppCallingConvention CallingConvention { get; set; }
30

31
        /// <summary>
32
        /// Gets or sets the return type of this function type.
33
        /// </summary>
34
        public CppType ReturnType { get; set; }
35

36
        /// <summary>
37
        /// Gets a list of the parameters.
38
        /// </summary>
39
        public CppContainerList<CppParameter> Parameters { get; }
40

41
        /// <inheritdoc />
42
        public override int SizeOf
43
        {
44
            get => 0;
×
45

46
            set => throw new InvalidOperationException("This type does not support SizeOf");
×
47
        }
48

49
        /// <inheritdoc />
UNCOV
50
        public override IEnumerable<ICppDeclaration> Children() => Parameters;
×
51

52
        /// <inheritdoc />
53
        public override CppType GetCanonicalType() => this;
2✔
54

55
        /// <inheritdoc />
56
        public override string ToString()
57
        {
58
            var builder = new StringBuilder();
×
59
            builder.Append(ReturnType.GetDisplayName());
×
60
            builder.Append(" ");
×
61
            builder.Append("(*)(");
×
62
            for (var i = 0; i < Parameters.Count; i++)
×
63
            {
64
                var param = Parameters[i];
×
65
                if (i > 0) builder.Append(", ");
×
66
                builder.Append(param);
×
67
            }
68

69
            builder.Append(")");
×
70
            return builder.ToString();
×
71
        }
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc