Fix doc generation
This commit is contained in:
parent
1e8ccfea2b
commit
b3ad6134d9
4 changed files with 25 additions and 25 deletions
|
|
@ -42,6 +42,9 @@ proc newVariant*(dict: Dictionary): Variant {.inline.} =
|
|||
new(result, variantFinalizer)
|
||||
initGodotVariant(result.godotVariant[], dict.godotDictionary)
|
||||
|
||||
proc asDictionary*(self: Variant): Dictionary {.inline.} =
|
||||
newDictionary(self.godotVariant[].asGodotDictionary())
|
||||
|
||||
proc contains*(self: Dictionary; key: Variant): bool {.inline.}=
|
||||
self.godotDictionary.contains(key.godotVariant[])
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ template definePoolArrayBase(T, GodotT, DataT, fieldName, newProcName,
|
|||
new(result, poolArrayFinalizer)
|
||||
result.fieldName = arr
|
||||
|
||||
proc hash*(arr: T): Hash =
|
||||
for item in arr.fieldName.items():
|
||||
result = result !&
|
||||
(when type(item) is GodotString: ($item).hash() else: item.hash())
|
||||
result = !$result
|
||||
|
||||
template definePoolArray(T, GodotT, DataT, fieldName, newProcName, initProcName;
|
||||
noData = false) =
|
||||
|
||||
|
|
@ -86,11 +92,6 @@ template definePoolArray(T, GodotT, DataT, fieldName, newProcName, initProcName;
|
|||
for pair in arr.fieldName.mpairs:
|
||||
yield (pair[0].int, pair[1])
|
||||
|
||||
proc hash*(arr: T): Hash =
|
||||
for item in arr.items():
|
||||
result = result !& item.hash()
|
||||
result = !$result
|
||||
|
||||
definePoolArrayBase(PoolByteArray, GodotPoolByteArray, uint8,
|
||||
godotPoolByteArray, newPoolByteArray,
|
||||
initGodotPoolByteArray)
|
||||
|
|
@ -164,8 +165,3 @@ iterator items*(arr: PoolStringArray): string =
|
|||
iterator pairs*(arr: PoolStringArray): tuple[key: int, val: string] =
|
||||
for i in 0..<arr.len:
|
||||
yield (i, arr[i])
|
||||
|
||||
proc hash*(arr: PoolStringArray): Hash =
|
||||
for s in arr:
|
||||
result = result !& s.hash()
|
||||
result = !$result
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import tables, hashes
|
|||
|
||||
import godotcoretypes
|
||||
import internal.godotinternaltypes, internal.godotvariants,
|
||||
internal.godotstrings
|
||||
internal.godotstrings, internal.godotdictionaries,
|
||||
internal.godotarrays
|
||||
|
||||
type
|
||||
Variant* = ref object
|
||||
|
|
@ -140,11 +141,7 @@ proc newVariant*(obj: ptr GodotObject): Variant {.inline.} =
|
|||
new(result, variantFinalizer)
|
||||
initGodotVariant(result.godotVariant, obj)
|
||||
|
||||
import arrays, poolarrays, dictionaries
|
||||
|
||||
proc newVariant*(arr: Array): Variant {.inline.} =
|
||||
new(result, variantFinalizer)
|
||||
initGodotVariant(result.godotVariant, arr.godotArray[])
|
||||
import poolarrays
|
||||
|
||||
proc newVariant*(pba: PoolByteArray): Variant {.inline.} =
|
||||
new(result, variantFinalizer)
|
||||
|
|
@ -228,12 +225,6 @@ proc asRID*(self: Variant): RID {.inline.} =
|
|||
proc asGodotObject*(self: Variant): ptr GodotObject {.inline.} =
|
||||
self.godotVariant.asGodotObject()
|
||||
|
||||
proc asDictionary*(self: Variant): Dictionary {.inline.} =
|
||||
newDictionary(self.godotVariant.asGodotDictionary())
|
||||
|
||||
proc asArray*(self: Variant): Array {.inline.} =
|
||||
newArray(self.godotVariant.asGodotArray())
|
||||
|
||||
proc asPoolByteArray*(self: Variant): PoolByteArray {.inline.} =
|
||||
newPoolByteArray(self.godotVariant.asGodotPoolByteArray())
|
||||
|
||||
|
|
@ -277,8 +268,8 @@ proc hash*(self: Variant): Hash =
|
|||
of VariantType.NodePath: self.asNodePath().hash()
|
||||
of VariantType.RID: self.asRID().hash()
|
||||
of VariantType.Object: self.asGodotObject().objectHash()
|
||||
of VariantType.Dictionary: self.asDictionary().hash()
|
||||
of VariantType.Array: self.asArray().hash()
|
||||
of VariantType.Dictionary: hash(self.godotVariant.asGodotDictionary().godotHash())
|
||||
of VariantType.Array: hash(self.godotVariant.asGodotArray().godotHash())
|
||||
of VariantType.PoolByteArray: self.asPoolByteArray().hash()
|
||||
of VariantType.PoolIntArray: self.asPoolIntArray().hash()
|
||||
of VariantType.PoolRealArray: self.asPoolRealArray().hash()
|
||||
|
|
@ -287,6 +278,15 @@ proc hash*(self: Variant): Hash =
|
|||
of VariantType.PoolVector3Array: self.asPoolVector3Array().hash()
|
||||
of VariantType.PoolColorArray: self.asPoolColorArray().hash()
|
||||
|
||||
import arrays
|
||||
|
||||
proc newVariant*(arr: Array): Variant {.inline.} =
|
||||
new(result, variantFinalizer)
|
||||
initGodotVariant(result.godotVariant, arr.godotArray[])
|
||||
|
||||
proc asArray*(self: Variant): Array {.inline.} =
|
||||
newArray(self.godotVariant.asGodotArray())
|
||||
|
||||
proc hasMethod*(self: Variant; meth: string): bool =
|
||||
var s = meth.toGodotString()
|
||||
result = self.godotVariant.hasMethod(s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue