Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
Types.c
Go to the documentation of this file.
1
6
14string String(string s)
15{
16 return s;
17}
18
31proto native vector Vector(float x, float y, float z);
32
34class Class
35{
49 proto native external bool IsInherited(typename type);
50
52 proto native external int GetSizeOf();
53
67 proto native owned external string ClassName();
68
82 proto native external typename Type();
83
84 proto external string ToString();
85
87 [Obsolete("Will be removed")]
88 proto native external int GetRefCount();
89
106 proto static Class Cast(Class from);
107
109 private proto static void SafeCastType(out typename type, out Class to, Class from);
110}
111
112class Managed
113{
115 proto external ref Managed Clone();
116}
117
123class ScriptAndConfig: Managed
124{
125}
126
128class pointer
129{
130 proto string ToString();
131}
132
134class global_pointer: pointer
135{
136}
137
139class handle64: pointer
140{
141}
142
143class func
144{
146 private proto void SetInstance(Managed inst);
147}
148
150class TypeID: handle64
151{
152}
153
154class array<Class T>: Managed
155{
160 proto native int Count();
161
165 proto native bool IsEmpty();
166
171 proto native void Clear();
172
182 proto native void Compact();
183
185 proto void Set(int n, T value);
186
192 proto int Find(T value);
193
198 proto bool Contains(T value);
199
203 proto T Get(int n);
204
210 proto int Insert(T value);
211
219 proto int InsertAt(T value, int index);
220
250 void InsertAll(notnull array<T> from)
251 {
252 for ( int i = 0; i < from.Count(); i++ )
253 {
254 Insert( from.Get(i) );
255 }
256 }
257
263 proto native void Remove(int index);
264
269 proto native void RemoveOrdered(int index);
270
276 proto native void Resize(int newSize);
277
282 proto native void Reserve(int newSize);
283
288 proto native void Swap(notnull array<T> other);
289
291 proto native void Sort(bool reverse = false);
292
294 proto native bool IsIndexValid(int index);
295
300 proto int Copy(notnull array<T> from);
301
302 proto int Init(T init[]);
303
309 proto bool RemoveItem(T value);
310
315 proto bool RemoveItemOrdered(T value);
316
327 void Debug()
328 {
329 PrintFormat( "Array count: %1", Count());
330
331 for ( int i = 0; i < Count(); i++ )
332 {
333 T item = Get(i);
334
335 PrintFormat("[%1] => %2", i, string.ToString(item));
336 }
337 }
338
351 {
352 if ( Count() > 0 )
353 {
354 return Math.RandomInt(0, Count());
355 }
356
357 return -1;
358 }
359
372 {
373 return Get(GetRandomIndex());
374 }
375
376 void SwapItems(int item1_index, int item2_index)
377 {
378 T item1 = Get(item1_index);
379 Set(item1_index, Get(item2_index));
380 Set(item2_index, item1);
381 }
382}
383
384//force these to compile so we can link C++ methods to them
385typedef array<string> TStringArray;
386typedef array<float> TFloatArray;
387typedef array<int> TIntArray;
388typedef array<bool> TBoolArray;
389typedef array<Class> TClassArray;
390typedef array<Managed> TManagedArray;
391typedef array<ref Managed> TManagedRefArray;
392typedef array<vector> TVectorArray;
393typedef array<pointer> TPointerArray;
394typedef array<ResourceName> TResourceNameArray;
395
396class set<Class T>: Managed
397{
398 proto native int Count();
402 proto native bool IsEmpty();
407 proto native void Clear();
416 proto native void Compact();
421 proto native void Reserve(int newSize);
427 proto int Find(T value);
432 proto bool Contains(T value);
433 proto T Get(int n);
439 proto bool Insert(T value);
444 proto native void Remove(int index);
445
450 proto bool RemoveItem(T value);
451
453 proto native bool IsIndexValid(int index);
454
455 proto int Copy(set<T> from);
456 proto native void Swap(set<T> other);
457 proto int Init(T init[]);
458}
459
460//force these to compile so we can link C++ methods to them
461typedef set<string> TStringSet;
462typedef set<float> TFloatSet;
463typedef set<int> TIntSet;
464typedef set<Class> TClassSet;
465typedef set<Managed> TManagedSet;
466typedef set<ref Managed> TManagedRefSet;
467typedef set<pointer> TPointerSet;
468
469typedef int MapIterator;
470
485class map<Class TKey,Class TValue>: Managed
486{
490 proto native int Count();
491
495 proto native bool IsEmpty();
496
498 proto native void Clear();
499
505 proto TValue Get(TKey key);
512 proto bool Find(TKey key, out TValue val);
519 proto TValue GetElement(int index);
526 proto TKey GetKey(int i);
531 proto void Set(TKey key, TValue value);
532 /*
533 Removes element with given `key`.
534 \return `true` if element was removed.
535 */
536 proto bool Remove(TKey key);
543 proto bool Take(TKey key, out TValue value);
550 proto bool RemoveElement(int i);
552 proto bool Contains(TKey key);
558 proto bool Insert(TKey key, TValue value);
559 proto int Copy(map<TKey,TValue> from);
560
561 [Obsolete("Use SCR_MapHelper.ReplaceKey")]
562 bool ReplaceKey(TKey old_key, TKey new_key)
563 {
564 if (Contains(old_key))
565 {
566 Set(new_key, Get(old_key));
567 Remove(old_key);
568 return true;
569 }
570 return false;
571 }
572
573 [Obsolete("Use SCR_MapHelper.GetKeyByValue")]
574 TKey GetKeyByValue(TValue value)
575 {
576 TKey ret;
577 for (int i = 0; i < Count(); i++)
578 {
579 if (GetElement(i) == value)
580 {
581 ret = GetKey(i);
582 break;
583 }
584 }
585
586 return ret;
587 }
588
589 proto native MapIterator Begin();
590 proto native MapIterator End();
591 proto native MapIterator Next(MapIterator it);
592 proto TKey GetIteratorKey(MapIterator it);
593 proto TValue GetIteratorElement(MapIterator it);
594}
595
604
613
622
631
640
649
override void Init()
EDamageType type
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
class SCR_MapHelperT< Class T, Class U > T
SCR_WorkshopAddonPresetAddonMeta Copy()
proto native external Type()
proto native owned external string ClassName()
proto native external int GetRefCount()
Get actual count of references holding this instance. If instance is not managed, zero is returned.
proto native external int GetSizeOf()
Get actual size of instance including size of all referenced objects.
proto native external bool IsInherited(typename type)
Super root of all classes in Enforce script.
Definition Types.c:35
Definition Math.c:13
Script representation for C++ RTTI types.
Definition Types.c:151
Plain C++ pointer, no weak pointers, no memory management. Safe to store outside local scope.
Definition Types.c:135
Definition Types.c:486
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
proto native void Reserve(int newSize)
map< Managed, int > TManagedIntMap
Definition Types.c:633
map< int, pointer > TIntPointerMap
Definition Types.c:602
map< pointer, ref Managed > TPointerManagedRefMap
Definition Types.c:628
map< Managed, Class > TManagedClassMap
Definition Types.c:635
void SwapItems(int item1_index, int item2_index)
Definition Types.c:376
map< pointer, pointer > TPointerPointerMap
Definition Types.c:629
set< int > TIntSet
Definition Types.c:463
map< Class, pointer > TClassPointerMap
Definition Types.c:620
array< float > TFloatArray
Definition Types.c:386
set< Class > TClassSet
Definition Types.c:464
proto int Find(T value)
proto void Set(int n, T value)
Sets n-th element to given value.
map< Class, vector > TClassVectorMap
Definition Types.c:621
proto int Insert(T value)
map< string, pointer > TStringPointerMap
Definition Types.c:611
array< pointer > TPointerArray
Definition Types.c:393
set< Class T > TStringSet
map< ref Managed, Managed > TManagedRefManagedMap
Definition Types.c:645
map< Managed, pointer > TManagedPointerMap
Definition Types.c:638
proto bool RemoveItem(T value)
array< string > TStringArray
Definition Types.c:385
proto bool RemoveItemOrdered(T value)
class Class Clone()
Return shallow copy of object, or null if it is not allowed (not public constructor).
proto native void RemoveOrdered(int index)
map< int, Class > TIntClassMap
Definition Types.c:599
map< Class, float > TClassFloatMap
Definition Types.c:614
map< string, vector > TStringVectorMap
Definition Types.c:612
map< int, string > TIntStringMap
Definition Types.c:598
proto native void Swap(notnull array< T > other)
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
array< Managed > TManagedArray
Definition Types.c:390
map< ref Managed, vector > TManagedRefVectorMap
Definition Types.c:648
proto native void Compact()
int MapIterator
Definition Types.c:469
map< ref Managed, float > TManagedRefFloatMap
Definition Types.c:641
proto native bool IsIndexValid(int index)
Returns whether provided element index of array is valid.
array< vector > TVectorArray
Definition Types.c:392
array< ref Managed > TManagedRefArray
Definition Types.c:391
proto bool Contains(T value)
map< ref Managed, ref Managed > TManagedRefManagedRefMap
Definition Types.c:646
map< ref Managed, pointer > TManagedRefPointerMap
Definition Types.c:647
proto native vector Vector(float x, float y, float z)
array< int > TIntArray
Definition Types.c:387
map< pointer, string > TPointerStringMap
Definition Types.c:625
map< Class, Class > TClassClassMap
Definition Types.c:617
proto native void Sort(bool reverse=false)
Sorts elements of array, depends on underlying type.
array< Class > TClassArray
Definition Types.c:389
map< Class, int > TClassIntMap
Definition Types.c:615
proto int InsertAt(T value, int index)
set< float > TFloatSet
Definition Types.c:462
map< pointer, float > TPointerFloatMap
Definition Types.c:623
T GetRandomElement()
Definition Types.c:371
string String(string s)
Definition Types.c:14
map< pointer, vector > TPointerVectorMap
Definition Types.c:630
map< string, int > TStringIntMap
Definition Types.c:606
set< ref Managed > TManagedRefSet
Definition Types.c:466
map< pointer, int > TPointerIntMap
Definition Types.c:624
proto native void Clear()
Remove all calls from list.
proto native bool IsEmpty()
proto native void Resize(int newSize)
map< ref Managed, string > TManagedRefStringMap
Definition Types.c:643
map< Class, ref Managed > TClassManagedRefMap
Definition Types.c:619
map< Managed, Managed > TManagedManagedMap
Definition Types.c:636
proto T Get(int n)
map< pointer, Managed > TPointerManagedMap
Definition Types.c:627
map< Managed, ref Managed > TManagedManagedRefMap
Definition Types.c:637
map< string, ref Managed > TStringManagedRefMap
Definition Types.c:610
map< string, string > TStringStringMap
Definition Types.c:607
map< pointer, Class > TPointerClassMap
Definition Types.c:626
array< bool > TBoolArray
Definition Types.c:388
map< Class, string > TClassStringMap
Definition Types.c:616
map< int, int > TIntIntMap
Definition Types.c:597
global_pointer pointer SetInstance(Managed inst)
Plain 64bit data, no weak pointers, no memory management.
map< string, float > TStringFloatMap
Definition Types.c:605
map< ref Managed, int > TManagedRefIntMap
Definition Types.c:642
set< pointer > TPointerSet
Definition Types.c:467
proto native void Remove(int index)
void InsertAll(notnull array< T > from)
Definition Types.c:250
map< string, Class > TStringClassMap
Definition Types.c:608
map< int, Managed > TIntManagedMap
Definition Types.c:600
map< Managed, float > TManagedFloatMap
Definition Types.c:632
void Debug()
Definition Types.c:327
TypeID handle64 Count()
int GetRandomIndex()
Definition Types.c:350
map TIntFloatMap
array< ResourceName > TResourceNameArray
Definition Types.c:394
map< int, vector > TIntVectorMap
Definition Types.c:603
set< Managed > TManagedSet
Definition Types.c:465
map< int, ref Managed > TIntManagedRefMap
Definition Types.c:601
map< ref Managed, Class > TManagedRefClassMap
Definition Types.c:644
map< Managed, string > TManagedStringMap
Definition Types.c:634
map< Managed, vector > TManagedVectorMap
Definition Types.c:639
map< string, Managed > TStringManagedMap
Definition Types.c:609
map< Class, Managed > TClassManagedMap
Definition Types.c:618