OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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+1] = { 0 }
 
int32_t GrpUpdate = 0
 
int32_t UpGrpCnt = 0
 
uint32_t GrpChks1 [C4UP_MaxUpGrpCnt] = { 0 }
 
uint32_t GrpChks2 = 0
 

Detailed Description

Definition at line 26 of file C4Update.h.

Member Function Documentation

void C4UpdatePackageCore::CompileFunc ( StdCompiler pComp)

Definition at line 230 of file C4Update.cpp.

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

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:29
char DestPath[_MAX_PATH+1]
Definition: C4Update.h:31
#define toC4CStr(szString)
Definition: StdAdaptors.h:25
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
uint32_t GrpChks2
Definition: C4Update.h:34
#define toC4CArrU(rArr)
Definition: StdAdaptors.h:30
int32_t RequireVersion[4]
Definition: C4Update.h:29
uint32_t GrpChks1[C4UP_MaxUpGrpCnt]
Definition: C4Update.h:34
int32_t GrpUpdate
Definition: C4Update.h:32
void Value(const T &rStruct)
Definition: StdCompiler.h:171
char Name[C4MaxName+1]
Definition: C4Update.h:30
int32_t UpGrpCnt
Definition: C4Update.h:33

Here is the call graph for this function:

bool C4UpdatePackageCore::Load ( C4Group hGroup)

Definition at line 241 of file C4Update.cpp.

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

Referenced by C4UpdatePackage::MakeUpdate().

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
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
bool LoadEntryString(const char *szEntryName, StdStrBuf *Buf)
Definition: C4Group.cpp:1932

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4UpdatePackageCore::Save ( C4Group hGroup)

Definition at line 260 of file C4Update.cpp.

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

Referenced by C4UpdatePackage::MakeUpdate().

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 }
#define C4CFN_UpdateCore
Definition: C4Components.h:50
char * getMData()
Definition: StdBuf.h:451
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
bool Add(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1316
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 29 of file C4Update.h.

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

int32_t C4UpdatePackageCore::UpGrpCnt = 0

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