-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.js
41 lines (32 loc) · 807 Bytes
/
generate.js
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
const {CppClass, cpp, qt, mName, CppSignature} = require('mugicpp')
const path = require('path')
function main() {
let c = new CppClass('Field')
let m = {
name: qt.QString,
type: qt.QString,
size: cpp.int,
primaryKey: cpp.bool,
autoincrement: cpp.bool,
index: cpp.bool,
unique: cpp.bool,
foreignKey: qt.QString
}
let d = {
type: '"INT"',
size: -1,
primaryKey: false,
autoincrement: false,
index: false,
unique: false,
foreignKey: 'QString()'
}
let s = new CppSignature
for(var n in m) {
c.member(mName(n), m[n], d[n])
}
c.constructor_({}, mName(d))
c.constructor_(s.signature(m,d))
c.write(path.join(__dirname,'src'))
}
main()