OpenClonk
C4UpdatePackageCore Class Reference

#include <C4Update.h>

Inheritance diagram for C4UpdatePackageCore:
[legend]

Public Member Functions

void CompileFunc (StdCompiler *pComp)
 
bool Load (C4Group &hGroup)
 
bool Save (C4Group &hGroup)
 

Public Attributes

int32_t RequireVersion [4] = { 0, 0, 0, 0 }
 
char Name [C4MaxName+1] = { 0 }
 
char DestPath [_MAX_PATH_LEN] = { 0 }
 
int32_t GrpUpdate = 0
 
int32_t UpGrpCnt = 0
 
uint32_t GrpChks1 [C4UP_MaxUpGrpCnt] = { 0 }
 
uint32_t GrpChks2 = 0
 

Detailed Description

Definition at line 25 of file C4Update.h.

Member Function Documentation

◆ CompileFunc()

void C4UpdatePackageCore::CompileFunc ( StdCompiler pComp)

Definition at line 230 of file C4Update.cpp.

231 {
232  pComp->Value(mkNamingAdapt(toC4CArr(RequireVersion), "RequireVersion"));
233  pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", ""));
234  pComp->Value(mkNamingAdapt(toC4CStr(DestPath), "DestPath", ""));
235  pComp->Value(mkNamingAdapt(GrpUpdate, "GrpUpdate", 0));
236  pComp->Value(mkNamingAdapt(UpGrpCnt, "TargetCount", 0));
237  pComp->Value(mkNamingAdapt(toC4CArrU(GrpChks1), "GrpChks1"));
238  pComp->Value(mkNamingAdapt(GrpChks2, "GrpChks2", 0u));
239 }
#define toC4CArr(rArr)
Definition: StdAdaptors.h:28
#define toC4CArrU(rArr)
Definition: StdAdaptors.h:29
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
#define toC4CStr(szString)
Definition: StdAdaptors.h:24
int32_t UpGrpCnt
Definition: C4Update.h:32
int32_t GrpUpdate
Definition: C4Update.h:31
int32_t RequireVersion[4]
Definition: C4Update.h:28
char Name[C4MaxName+1]
Definition: C4Update.h:29
uint32_t GrpChks2
Definition: C4Update.h:33
char DestPath[_MAX_PATH_LEN]
Definition: C4Update.h:30
uint32_t GrpChks1[C4UP_MaxUpGrpCnt]
Definition: C4Update.h:33
void Value(const T &rStruct)
Definition: StdCompiler.h:161

References DestPath, GrpChks1, GrpChks2, GrpUpdate, mkNamingAdapt(), Name, RequireVersion, toC4CArr, toC4CArrU, toC4CStr, UpGrpCnt, and StdCompiler::Value().

Here is the call graph for this function:

◆ Load()

bool C4UpdatePackageCore::Load ( C4Group hGroup)

Definition at line 241 of file C4Update.cpp.

242 {
243  // Load from group
244  StdStrBuf Source;
245  if (!hGroup.LoadEntryString(C4CFN_UpdateCore,&Source))
246  return false;
247  try
248  {
249  // Compile data
250  CompileFromBuf<StdCompilerINIRead>(mkNamingAdapt(*this, "Update"), Source);
251  }
252  catch (StdCompiler::Exception *pExc)
253  {
254  delete pExc;
255  return false;
256  }
257  return true;
258 }
#define C4CFN_UpdateCore
Definition: C4Components.h:50
bool LoadEntryString(const char *entry_name, StdStrBuf *buffer)
Definition: C4Group.cpp:2430

References C4CFN_UpdateCore, C4Group::LoadEntryString(), and mkNamingAdapt().

Referenced by C4UpdatePackage::MakeUpdate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Save()

bool C4UpdatePackageCore::Save ( C4Group hGroup)

Definition at line 260 of file C4Update.cpp.

261 {
262  try
263  {
264  // decompile data
265  StdStrBuf Core = DecompileToBuf<StdCompilerINIWrite>(mkNamingAdapt(*this, "Update"));
266  char *stupid_buffer = new char[Core.getLength() + 1];
267  memcpy(stupid_buffer, Core.getMData(), Core.getLength() + 1);
268  // add to group
269  return hGroup.Add(C4CFN_UpdateCore, stupid_buffer, Core.getLength(), false, true);
270  }
271  catch (StdCompiler::Exception * pExc)
272  {
273  delete pExc;
274  return false;
275  }
276 }
bool Add(const char *filename, const char *entry_name)
Definition: C4Group.cpp:1621
char * getMData()
Definition: StdBuf.h:443
size_t getLength() const
Definition: StdBuf.h:445

References C4Group::Add(), C4CFN_UpdateCore, StdStrBuf::getLength(), StdStrBuf::getMData(), and mkNamingAdapt().

Referenced by C4UpdatePackage::MakeUpdate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ DestPath

char C4UpdatePackageCore::DestPath[_MAX_PATH_LEN] = { 0 }

◆ GrpChks1

uint32_t C4UpdatePackageCore::GrpChks1[C4UP_MaxUpGrpCnt] = { 0 }

◆ GrpChks2

uint32_t C4UpdatePackageCore::GrpChks2 = 0

◆ GrpUpdate

int32_t C4UpdatePackageCore::GrpUpdate = 0

◆ Name

char C4UpdatePackageCore::Name[C4MaxName+1] = { 0 }

◆ RequireVersion

int32_t C4UpdatePackageCore::RequireVersion[4] = { 0, 0, 0, 0 }

Definition at line 28 of file C4Update.h.

Referenced by C4Group_ApplyUpdate(), C4UpdatePackage::Check(), and CompileFunc().

◆ UpGrpCnt

int32_t C4UpdatePackageCore::UpGrpCnt = 0

The documentation for this class was generated from the following files: