File: FunctionArgs.qml

package info (click to toggle)
doxyqml 0.5.3-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 412 kB
  • sloc: python: 1,349; cpp: 165; makefile: 9; sh: 8
file content (121 lines) | stat: -rw-r--r-- 2,839 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * Header bla
 */
import QtQuick 1.1

/**
 * A very simple item
 */
Item {
    /**
     * The 'foo' property
     */
    property int foo

    signal clicked(int x, int y)

    signal activated

    /**
     * Do something with arg1 and arg2
     * @param type:string arg1 first argument
     * @param type:int arg2 second argument
     */
    function doSomething(arg1, arg2) {
        console.log("arg1=" + arg1);
    }

    /**
     * A badly documented function. Missing one argument and documenting a
     * non-existing document
     * @param type:string foo first argument
     * @param type:int baz this argument does not exist
     */
    function badlyDocumented(foo, bar) {
    }

    property string escaped: "a string \n \" \t with escaped chars"
    property string block: "a string with some block {({ ] } chars"

    /**
     * Compute the arg^2
     * @return type:int the result
     */
    function square(arg) {
        return arg * arg;
    }

    /**
     * Function with int default parameter
     * @param type:int arg A parameter with a defaultvalue
     * @return type:int the result
     */
    function intDefaultParameter(arg = 0) {
        return arg;
    }

    /**
     * Function with string default parameter
     * @param type:string arg A parameter with a default value
     * @return type:string the result
     */
    function stringDefaultParameter(arg = "hello") {
        return arg;
    }

    /**
     * Function with property as default parameter
     * @param type:int arg A parameter with a default value
     * @return type:int the result
     */
    function propDefaultParameter(arg = foo) {
        return arg;
    }

    /**
     * Function that takes a pointer type parameter
     * @param type:QObject* arg A pointer to an object derived from a QObject type
     */
    function handleAnObject(arg) {
      arg.aMethod()
    }

    /// One-line comment
    function refresh() {
    }

    /// Function that takes an empty object as default value for a parameter
    function objectDefaultParam(arg = {}) {
        return arg
    }

    /// Function that has arguments and a spread argument
    function argumentsWithSpread(arg1, arg2 = {}, ...args) {
      return arg1;
    }

    /// Function that has only spread arguments
    function onlySpread(...args) {
    }

    /// Function that takes an empty array as default value for a parameter
    function arrayDefaultParam(arg = []) {
        return arg
    }

    /// Default values can now be expressions
    function complicatedDefaultValue(area = 10.0 * 20.0) {}

    /// Function with arguments
    function typedFunction(a: int, arg: var, item: Item) {}

    /// Private function
    function __privateFunction() {}

    Item {
    }

    Item {}

    property /* foo */ int /* bar */ weirdProperty /* baz */ : /* foo */ 12
}