DayZ 1.24
Loading...
Searching...
No Matches
UniversalTemperatureSource.c File Reference

Go to the source code of this file.

Classes

class  UniversalTemperatureSourceSettings
 
class  UniversalTemperatureSource
 original Timer deletes m_params which is unwanted More...
 
class  UniversalTemperatureSourceDebug
 

Functions

void UniversalTemperatureSourceDebug ()
 keeps first iteration of parsed data from the m_Data
 
void AddHeader (string header)
 
void Add (string name, string value)
 
void Commit ()
 
int PairsCount ()
 
string GetHeader ()
 
string GetName (int pIndex)
 
string GetValue (int pIndex)
 
array< stringParseData ()
 
void ParseKeyPairs ()
 
void Debug ()
 

Variables

class UniversalTemperatureSourceSettings m_Temperature = 0
 
const string DELIMITER_KEYPAIR = ":"
 
string m_Header
 
string m_Data
 
ref array< stringm_Names
 
ref array< stringm_Values
 names parsed from m_Pairs
 
ref array< stringm_Pairs
 values parsed from m_Pairs
 

Function Documentation

◆ Add()

void Add ( string name,
string value )

Definition at line 208 of file UniversalTemperatureSource.c.

209 {
210 m_Data = string.Format("%1%2:%3%4", m_Data, name, value, DELIMITER_DATA);
211 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
static proto string Format(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)
Gets n-th character from string.

References string::Format(), m_Data, and name.

◆ AddHeader()

void AddHeader ( string header)

Definition at line 203 of file UniversalTemperatureSource.c.

204 {
206 }

References m_Header.

◆ Commit()

void Commit ( )

Definition at line 213 of file UniversalTemperatureSource.c.

214 {
215 m_Pairs = ParseData();
217 }
ref array< string > m_Pairs
values parsed from m_Pairs
array< string > ParseData()
void ParseKeyPairs()

References m_Pairs, ParseData(), and ParseKeyPairs().

◆ Debug()

void Debug ( )
protected

Definition at line 279 of file UniversalTemperatureSource.c.

280 {
281 for (int i = 0; i < m_Names.Count(); i++)
282 Debug.Log(string.Format("%1: %2", m_Names.Get(i), m_Values.Get(i)), "UniversalTemperatureSourceDebug");
283 }
ref array< string > m_Names
ref array< string > m_Values
names parsed from m_Pairs
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133

References Debug::Log(), m_Names, and m_Values.

◆ GetHeader()

string GetHeader ( )

Definition at line 224 of file UniversalTemperatureSource.c.

225 {
226 return m_Header;
227 }

References m_Header.

◆ GetName()

string GetName ( int pIndex)

Definition at line 229 of file UniversalTemperatureSource.c.

230 {
231 if (m_Names.Count() - 1 < pIndex)
232 {
233 Debug.Log(string.Format("GetName index: %1 from data of length: %2", pIndex, m_Names.Count()), "UniversalTemperatureSourceDebug");
234 return "";
235 }
236
237 return m_Names.Get(pIndex);
238 }

References Debug::Log(), and m_Names.

◆ GetValue()

string GetValue ( int pIndex)

Definition at line 240 of file UniversalTemperatureSource.c.

241 {
242 if (m_Values.Count() - 1 < pIndex)
243 {
244 Debug.Log(string.Format("GetValue index: %1 from data of length: %2", pIndex, m_Values.Count()), "UniversalTemperatureSourceDebug");
245 return "";
246 }
247
248 return m_Values.Get(pIndex);
249 }

References Debug::Log(), and m_Values.

◆ PairsCount()

int PairsCount ( )

Definition at line 219 of file UniversalTemperatureSource.c.

220 {
221 return m_Pairs.Count();
222 }

References m_Pairs.

◆ ParseData()

array< string > ParseData ( )
protected

Definition at line 251 of file UniversalTemperatureSource.c.

252 {
253
255 if (m_Data)
257
258 return parsed;
259 }
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Definition EnString.c:396

References m_Data, and string::Split().

Referenced by Commit().

◆ ParseKeyPairs()

void ParseKeyPairs ( )
protected

Definition at line 261 of file UniversalTemperatureSource.c.

262 {
263 m_Names.Clear();
264 m_Values.Clear();
265
266 if (m_Pairs)
267 {
268 for (int i = 0; i < m_Pairs.Count(); i++)
269 {
271
272 m_Pairs.Get(i).Split(DELIMITER_KEYPAIR, keypair);
273 m_Names.Insert(keypair[0]);
274 m_Values.Insert(keypair[1]);
275 }
276 }
277 }
const string DELIMITER_KEYPAIR

References DELIMITER_KEYPAIR, m_Names, m_Pairs, and m_Values.

Referenced by Commit().

◆ UniversalTemperatureSourceDebug()

void UniversalTemperatureSourceDebug ( )

keeps first iteration of parsed data from the m_Data

Definition at line 194 of file UniversalTemperatureSource.c.

195 {
196 m_Header = "";
197 m_Data = "";
198 m_Pairs = new array<string>();
199 m_Names = new array<string>();
200 m_Values = new array<string>();
201 }

References m_Data, m_Header, m_Names, m_Pairs, and m_Values.

Variable Documentation

◆ DELIMITER_KEYPAIR

const string DELIMITER_KEYPAIR = ":"

Definition at line 186 of file UniversalTemperatureSource.c.

Referenced by ParseKeyPairs().

◆ m_Data

◆ m_Header

string m_Header

◆ m_Names

◆ m_Pairs

ref array<string> m_Pairs

values parsed from m_Pairs

Definition at line 192 of file UniversalTemperatureSource.c.

Referenced by Commit(), PairsCount(), ParseKeyPairs(), and UniversalTemperatureSourceDebug().

◆ m_Temperature

◆ m_Values