File size: 1,753 Bytes
24b81cb |
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
class CfgParamArray extends CfgParam
{
private ref array<ref CfgParam> m_Values;
void CfgParamArray(string param_name)
{
m_Values = new array<ref CfgParam>;
}
void ~CfgParamArray()
{
if ( m_Values != NULL )
{
Clear();
}
}
void Clear()
{
m_Values.Clear();
}
array<ref CfgParam> GetValues()
{
return m_Values;
}
CfgParam GetValue(int i)
{
return m_Values.Get(i);
}
void InsertValue(CfgParam value)
{
if ( m_Values == NULL )
{
m_Values = new array<ref CfgParam>;
}
m_Values.Insert(value);
}
bool IsParamExist(string name, int cfg_type)
{
if ( m_Values == NULL )
{
m_Values = new array<ref CfgParam>;
}
for ( int i = 0; i < m_Values.Count(); ++i )
{
CfgParam p = m_Values.Get(i);
if ( name == p.GetName() )
{
return true;
}
}
return false;
}
bool RenameParam(string name, int cfg_type, string new_name)
{
if ( m_Values == NULL )
{
m_Values = new array<ref CfgParam>;
}
for ( int i = 0; i < m_Values.Count(); ++i )
{
CfgParam p = m_Values.Get(i);
if ( name == p.GetName() )
{
p.SetName(new_name);
return true;
}
}
return false;
}
CfgParam GetValueByName(string name, int cfg_type)
{
if ( m_Values == NULL )
{
m_Values = new array<ref CfgParam>;
}
for ( int i = 0; i < m_Values.Count(); ++i )
{
CfgParam p = m_Values.Get(i);
if ( name == p.GetName() )
{
return p;
}
}
CfgParam param = CreateParam(name, cfg_type);
m_Values.Insert(param);
return param;
}
void SetParams(array<ref CfgParam> value_array)
{
m_Values = value_array;
}
bool IsValueArray()
{
return true;
}
override int GetType()
{
return CFG_TYPE_ARRAY;
}
} |