2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2009-06-05 13:41:20 +00:00
|
|
|
* Copyright (c) 1998-2000, 2004 Matthes Bender
|
2010-12-23 00:01:24 +00:00
|
|
|
* Copyright (c) 2005, 2007, 2009 Günther Brammer
|
2009-05-08 13:28:41 +00:00
|
|
|
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
|
|
|
*
|
|
|
|
* Portions might be copyrighted by other authors who have contributed
|
|
|
|
* to OpenClonk.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
* See isc_license.txt for full license and disclaimer.
|
|
|
|
*
|
|
|
|
* "Clonk" is a registered trademark of Matthes Bender.
|
|
|
|
* See clonk_trademark_license.txt for full license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Holds a single text file component from a group */
|
|
|
|
|
|
|
|
#ifndef INC_C4ComponentHost
|
|
|
|
#define INC_C4ComponentHost
|
|
|
|
|
|
|
|
#include "C4GroupSet.h"
|
|
|
|
|
|
|
|
class C4ComponentHost
|
2010-03-28 17:58:21 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
C4ComponentHost();
|
|
|
|
virtual ~C4ComponentHost();
|
|
|
|
const char *GetFilePath() const { return FilePath; }
|
|
|
|
void Default();
|
|
|
|
void Clear();
|
|
|
|
const char *GetData() const { return Data.getData(); }
|
|
|
|
size_t GetDataSize() const { return Data.getLength(); }
|
|
|
|
bool Load(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
|
|
|
bool Load(const char *szName, C4GroupSet &hGroupSet, const char *szFilename, const char *szLanguage=NULL);
|
|
|
|
bool LoadEx(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
|
|
|
bool LoadAppend(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
|
|
|
bool GetLanguageString(const char *szLanguage, class StdStrBuf &rTarget);
|
|
|
|
protected:
|
2010-09-04 20:41:59 +00:00
|
|
|
// The component host's Data has changed. This callback can be used by
|
|
|
|
// derived classes to reload internal structures.
|
|
|
|
virtual void OnLoad() {}
|
|
|
|
|
2010-03-28 17:58:21 +00:00
|
|
|
StdCopyStrBuf Data;
|
|
|
|
char Name[_MAX_FNAME+1];
|
|
|
|
char Filename[_MAX_FNAME+1];
|
|
|
|
char FilePath[_MAX_PATH+1];
|
|
|
|
void CopyFilePathFromGroup(const C4Group &hGroup);
|
|
|
|
};
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
#endif
|