CommonLibSSE (powerof3)
FormTraits.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/Actor.h"
4 #include "RE/A/ActorValueInfo.h"
5 #include "RE/A/AlchemyItem.h"
6 #include "RE/A/ArrowProjectile.h"
8 #include "RE/B/BGSAction.h"
9 #include "RE/B/BGSAddonNode.h"
10 #include "RE/B/BGSApparatus.h"
11 #include "RE/B/BGSArtObject.h"
13 #include "RE/B/BGSBodyPartData.h"
14 #include "RE/B/BGSCameraPath.h"
15 #include "RE/B/BGSCameraShot.h"
16 #include "RE/B/BGSCollisionLayer.h"
17 #include "RE/B/BGSColorForm.h"
19 #include "RE/B/BGSDebris.h"
21 #include "RE/B/BGSDialogueBranch.h"
22 #include "RE/B/BGSDualCastData.h"
23 #include "RE/B/BGSEncounterZone.h"
24 #include "RE/B/BGSEquipSlot.h"
25 #include "RE/B/BGSExplosion.h"
26 #include "RE/B/BGSFootstep.h"
27 #include "RE/B/BGSFootstepSet.h"
28 #include "RE/B/BGSHazard.h"
29 #include "RE/B/BGSHeadPart.h"
30 #include "RE/B/BGSIdleMarker.h"
31 #include "RE/B/BGSImpactData.h"
32 #include "RE/B/BGSImpactDataSet.h"
33 #include "RE/B/BGSKeyword.h"
34 #include "RE/B/BGSLensFlare.h"
36 #include "RE/B/BGSListForm.h"
37 #include "RE/B/BGSLocation.h"
39 #include "RE/B/BGSMaterialObject.h"
40 #include "RE/B/BGSMaterialType.h"
41 #include "RE/B/BGSMenuIcon.h"
42 #include "RE/B/BGSMessage.h"
43 #include "RE/B/BGSMovableStatic.h"
44 #include "RE/B/BGSMovementType.h"
46 #include "RE/B/BGSMusicType.h"
47 #include "RE/B/BGSNote.h"
48 #include "RE/B/BGSOutfit.h"
49 #include "RE/B/BGSPerk.h"
50 #include "RE/B/BGSProjectile.h"
51 #include "RE/B/BGSRagdoll.h"
53 #include "RE/B/BGSRelationship.h"
55 #include "RE/B/BGSScene.h"
57 #include "RE/B/BGSSoundCategory.h"
59 #include "RE/B/BGSSoundOutput.h"
65 #include "RE/B/BGSTextureSet.h"
66 #include "RE/B/BGSVoiceType.h"
68 #include "RE/B/BarrierProjectile.h"
69 #include "RE/B/BeamProjectile.h"
70 #include "RE/C/Character.h"
71 #include "RE/C/ConeProjectile.h"
72 #include "RE/E/EffectSetting.h"
73 #include "RE/E/EnchantmentItem.h"
74 #include "RE/F/FlameProjectile.h"
75 #include "RE/G/GrenadeProjectile.h"
76 #include "RE/H/Hazard.h"
77 #include "RE/I/IngredientItem.h"
78 #include "RE/M/MissileProjectile.h"
79 #include "RE/N/NavMesh.h"
80 #include "RE/N/NavMeshInfoMap.h"
81 #include "RE/P/PlayerCharacter.h"
82 #include "RE/S/Script.h"
83 #include "RE/S/ScrollItem.h"
84 #include "RE/S/SpellItem.h"
85 #include "RE/T/TESAmmo.h"
86 #include "RE/T/TESClass.h"
87 #include "RE/T/TESClimate.h"
88 #include "RE/T/TESCombatStyle.h"
89 #include "RE/T/TESEffectShader.h"
90 #include "RE/T/TESEyes.h"
91 #include "RE/T/TESFaction.h"
92 #include "RE/T/TESFlora.h"
93 #include "RE/T/TESForm.h"
94 #include "RE/T/TESFurniture.h"
95 #include "RE/T/TESGlobal.h"
96 #include "RE/T/TESGrass.h"
97 #include "RE/T/TESIdleForm.h"
98 #include "RE/T/TESImageSpace.h"
100 #include "RE/T/TESKey.h"
101 #include "RE/T/TESLandTexture.h"
102 #include "RE/T/TESLevCharacter.h"
103 #include "RE/T/TESLevItem.h"
104 #include "RE/T/TESLevSpell.h"
105 #include "RE/T/TESLoadScreen.h"
106 #include "RE/T/TESNPC.h"
107 #include "RE/T/TESObjectACTI.h"
108 #include "RE/T/TESObjectANIO.h"
109 #include "RE/T/TESObjectARMA.h"
110 #include "RE/T/TESObjectARMO.h"
111 #include "RE/T/TESObjectBOOK.h"
112 #include "RE/T/TESObjectCELL.h"
113 #include "RE/T/TESObjectCONT.h"
114 #include "RE/T/TESObjectDOOR.h"
115 #include "RE/T/TESObjectLAND.h"
116 #include "RE/T/TESObjectLIGH.h"
117 #include "RE/T/TESObjectMISC.h"
118 #include "RE/T/TESObjectREFR.h"
119 #include "RE/T/TESObjectSTAT.h"
120 #include "RE/T/TESObjectTREE.h"
121 #include "RE/T/TESObjectWEAP.h"
122 #include "RE/T/TESPackage.h"
123 #include "RE/T/TESQuest.h"
124 #include "RE/T/TESRace.h"
125 #include "RE/T/TESRegion.h"
126 #include "RE/T/TESShout.h"
127 #include "RE/T/TESSoulGem.h"
128 #include "RE/T/TESSound.h"
129 #include "RE/T/TESTopic.h"
130 #include "RE/T/TESTopicInfo.h"
131 #include "RE/T/TESWaterForm.h"
132 #include "RE/T/TESWeather.h"
133 #include "RE/T/TESWordOfPower.h"
134 #include "RE/T/TESWorldSpace.h"
135 
136 #define SKSE_FORMTRAITS(a_elem) \
137  case a_elem::FORMTYPE: \
138  if constexpr (std::is_convertible_v<const a_elem*, const T*>) { \
139  return static_cast<const a_elem*>(this); \
140  } \
141  break
142 
143 namespace RE
144 {
145  template <class T, class>
146  T* TESForm::As() noexcept
147  {
148  return const_cast<T*>(
149  static_cast<const TESForm*>(this)->As<T>());
150  }
151 
152  template <class T, class>
153  const T* TESForm::As() const noexcept
154  {
155  switch (GetFormType()) {
286  default:
287  break;
288  }
289 
290  return nullptr;
291  }
292 }
293 
294 #undef SKSE_FORMTRAITS
#define SKSE_FORMTRAITS(a_elem)
Definition: FormTraits.h:136
Definition: ActorValueInfo.h:20
Definition: AlchemyItem.h:24
Definition: ArrowProjectile.h:10
Definition: BGSAcousticSpace.h:9
Definition: BGSAction.h:9
Definition: BGSAddonNode.h:28
Definition: BGSApparatus.h:14
Definition: BGSArtObject.h:12
Definition: BGSAssociationType.h:10
Definition: BGSBodyPartData.h:83
Definition: BGSCameraPath.h:29
Definition: BGSCameraShot.h:15
Definition: BGSCollisionLayer.h:15
Definition: BGSColorForm.h:13
Definition: BGSConstructibleObject.h:11
Definition: BGSDebris.h:42
Definition: BGSDefaultObjectManager.h:417
Definition: BGSDialogueBranch.h:10
Definition: BGSDualCastData.h:31
Definition: BGSEncounterZone.h:43
Definition: BGSEquipSlot.h:10
Definition: BGSExplosion.h:53
Definition: BGSFootstepSet.h:25
Definition: BGSFootstep.h:10
Definition: BGSHazard.h:44
Definition: BGSHeadPart.h:17
Definition: BGSIdleMarker.h:14
Definition: BGSImpactDataSet.h:13
Definition: BGSImpactData.h:16
Definition: BGSKeyword.h:10
Definition: BGSLensFlare.h:12
Definition: BGSLightingTemplate.h:11
Definition: BGSListForm.h:11
Definition: BGSLocationRefType.h:9
Definition: BGSLocation.h:68
Definition: BGSMaterialObject.h:16
Definition: BGSMaterialType.h:12
Definition: BGSMenuIcon.h:12
Definition: BGSMessage.h:17
Definition: BGSMovableStatic.h:28
Definition: BGSMovementType.h:11
Definition: BGSMusicTrackFormWrapper.h:14
Definition: BGSMusicType.h:13
Definition: BGSNote.h:19
Definition: BGSOutfit.h:11
Definition: BGSPerk.h:31
Definition: BGSProjectile.h:79
Definition: BGSRagdoll.h:15
Definition: BGSReferenceEffect.h:9
Definition: BGSRelationship.h:9
Definition: BGSReverbParameters.h:12
Definition: BGSScene.h:32
Definition: BGSShaderParticleGeometryData.h:18
Definition: BGSSoundCategory.h:14
Definition: BGSSoundDescriptorForm.h:14
Definition: BGSSoundOutput.h:12
Definition: BGSStaticCollection.h:12
Definition: BGSStoryManagerBranchNode.h:10
Definition: BGSStoryManagerEventNode.h:36
Definition: BGSStoryManagerQuestNode.h:11
Definition: BGSTalkingActivator.h:9
Definition: BGSTextureSet.h:16
Definition: BGSVoiceType.h:25
Definition: BGSVolumetricLighting.h:12
Definition: BarrierProjectile.h:10
Definition: BeamProjectile.h:16
Definition: Character.h:8
Definition: ConeProjectile.h:15
Definition: EffectSetting.h:24
Definition: EnchantmentItem.h:10
Definition: FlameProjectile.h:9
Definition: GrenadeProjectile.h:11
Definition: Hazard.h:16
Definition: IngredientItem.h:24
Definition: MissileProjectile.h:10
Definition: NavMeshInfoMap.h:19
Definition: NavMesh.h:14
Definition: Script.h:23
Definition: ScrollItem.h:19
Definition: SpellItem.h:16
Definition: TESAmmo.h:50
Definition: TESClass.h:88
Definition: TESClimate.h:13
Definition: TESCombatStyle.h:65
Definition: TESEffectShader.h:182
Definition: TESEyes.h:14
Definition: TESFaction.h:120
Definition: TESFlora.h:12
Definition: TESForm.h:36
FormType GetFormType() const noexcept
Definition: TESForm.h:290
T * As() noexcept
Definition: FormTraits.h:146
Definition: TESFurniture.h:11
Definition: TESGlobal.h:10
Definition: TESGrass.h:12
Definition: TESIdleForm.h:37
Definition: TESImageSpaceModifier.h:111
Definition: TESImageSpace.h:10
Definition: TESKey.h:9
Definition: TESLandTexture.h:17
Definition: TESLevCharacter.h:14
Definition: TESLevItem.h:12
Definition: TESLevSpell.h:12
Definition: TESLoadScreen.h:12
Definition: TESNPC.h:36
Definition: TESObjectACTI.h:22
Definition: TESObjectANIO.h:13
Definition: TESObjectARMA.h:28
Definition: TESObjectARMO.h:37
Definition: TESObjectBOOK.h:66
Definition: TESObjectCELL.h:115
Definition: TESObjectCONT.h:40
Definition: TESObjectDOOR.h:19
Definition: TESObjectLAND.h:46
Definition: TESObjectLIGH.h:68
Definition: TESObjectMISC.h:28
Definition: TESObjectREFR.h:114
Definition: TESObjectSTAT.h:30
Definition: TESObjectTREE.h:53
Definition: TESObjectWEAP.h:79
Definition: TESPackage.h:310
Definition: TESQuest.h:189
Definition: TESRace.h:146
Definition: TESRegion.h:53
Definition: TESShout.h:18
Definition: TESSoulGem.h:10
Definition: TESSound.h:9
Definition: TESTopicInfo.h:42
Definition: TESTopic.h:135
Definition: TESWaterForm.h:83
Definition: TESWeather.h:17
Definition: TESWordOfPower.h:13
Definition: TESWorldSpace.h:118
Definition: AbsorbEffect.h:6