File: StructGeneratorInterface.php

package info (click to toggle)
dpp 10.1.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,972 kB
  • sloc: cpp: 48,486; ansic: 7,991; php: 1,293; python: 80; sh: 60; makefile: 15
file content (75 lines) | stat: -rw-r--r-- 2,403 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
<?php

namespace Dpp;

/**
 * Represents a header/cpp generator used to auto-generate cpp/.h files.
 */
interface StructGeneratorInterface
{
    /**
     * Generate the start of the header file
     *
     * @return string header content
     */
    public function generateHeaderStart(): string;

    /**
     * Generate the start of the cpp file
     *
     * @return string cpp content
     */
    public function generateCppStart(): string;

    /**
     * Check if the script should run and re-generate content or not
     *
     * @return string true if the script should run, false to exit
     */
    public function checkForchanges(): bool;

    /**
     * Generate header definition for a function
     *
     * @param string $returnType Return type of function
     * @param string $currentFunction Current function name
     * @param string $parameters Current function parameters with default values
     * @param string $noDefaults Current function parameters without default values
     * @param string $parameterNames Parameter names only
     * @return string header content to append
     */
    public function generateHeaderDef(string $returnType, string $currentFunction, string $parameters, string $noDefaults, string $parameterTypes, string $parameterNames): string;

    /**
     * Generate cpp definition for a function
     *
     * @param string $returnType Return type of function
     * @param string $currentFunction Current function name
     * @param string $parameters Current function parameters with default values
     * @param string $noDefaults Current function parameters without default values
     * @param string $parameterNames Parameter names only
     * @return string cpp content to append
     */
    public function generateCppDef(string $returnType, string $currentFunction, string $parameters, string $noDefaults, string $parameterTypes, string $parameterNames): string;
    
    /**
     * Return comment lines to add to each header definition
     *
     * @return array Comment lines to add
     */
    public function getCommentArray(): array;

    /**
     * Save the .h file
     *
     * @param string $content Content to save
     */
    public function saveHeader(string $content): void;

    /**
     * Save the .cpp file
     *
     * @param string $cppcontent Content to save
     */
    public function saveCpp(string $cppcontent): void;
};