openclonk/src/c4group/C4ComponentHost.h

63 lines
2.1 KiB
C
Raw Normal View History

2009-05-08 13:28:41 +00:00
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 1998-2000, 2004 Matthes Bender
* Copyright (c) 2005, 2007 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
{
public:
C4ComponentHost();
virtual ~C4ComponentHost();
const char *GetFilePath() const { return FilePath; }
void Default();
void Clear();
void Open();
const char *GetData() const { return Data.getData(); }
size_t GetDataSize() const { return Data.getLength(); }
2009-05-08 13:28:41 +00:00
virtual void Close();
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 Set(const char *szData);
bool Save(C4Group &hGroup);
2009-05-08 13:28:41 +00:00
bool GetLanguageString(const char *szLanguage, class StdStrBuf &rTarget);
bool SetLanguageString(const char *szLanguage, const char *szString);
2009-05-08 13:28:41 +00:00
void TrimSpaces();
protected:
StdCopyStrBuf Data;
bool Modified;
2009-05-08 13:28:41 +00:00
char Name[_MAX_FNAME+1];
char Filename[_MAX_FNAME+1];
char FilePath[_MAX_PATH+1];
void CopyFilePathFromGroup(const C4Group &hGroup);
#ifdef _WIN32
HWND hDialog;
void InitDialog(HWND hDlg);
friend BOOL CALLBACK ComponentDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
#endif
};
#endif