#pragma once
#ifndef C4D_FILE_RE_INL_
#define C4D_FILE_RE_INL_
//=================================================================================================
//  c4d_file.inl
//  Created: 10.14.2012   4:24
//  Remotion (C) 2012 - All Rights Reserved
//=================================================================================================

// #include "ge_math.h"
// #include "c4d_file.h"
// #include "c4d_memory.h"
// #include "c4d_basecontainer.h"
// #include "c4d_basebitmap.h"
// #include "c4d_basechannel.h"
// #include "c4d_general.h"

//#define FnCall(fnc) (this->*C4DOS.Fn->fnc)
//#define FlCall(fnc) (this->*RE_C4DOS.Fl->fnc)
//#define HfCall(fnc) (this->*RE_C4DOS.Hf->fnc)

//Filename
#define FnCall(fnc, ...) C4DOS.Fn->fnc(this,##__VA_ARGS__) 
//BaseFile, AESFile
#define FlCall(fnc, ...) C4DOS.Fl->fnc(this,##__VA_ARGS__) 
//HyperFile
#define HfCall(fnc, ...) C4DOS.Hf->fnc(this,##__VA_ARGS__) 
//BrowseVolumes, BrowseFiles
#define BfCall(fnc, ...) C4DOS.Bf->fnc(this,##__VA_ARGS__) 

#if 0 //def	__C4D_NO_NEW_DELETE__
void* inline Filename::operator new(size_t,const std::nothrow_t&,int line,const CHAR *file) throw()
{
	return C4DOS.Fn->Alloc();
}

void inline Filename::operator delete(void* del,int line, const CHAR *file)
{
	C4DOS.Fn->Free((Filename*)del);
}

void inline Filename::operator delete(void* del)
{
	C4DOS.Fn->Free((Filename*)del);
}
#endif

#if 1  ///Filename  OK
inline Filename::Filename(void)  //ok
{
	//GeDebugOut(" Filename(%p) >> ",this);
	C4DOS.Fn->Init(this);
	//GeDebugOut(" Filename(%p) << ",this);
}

inline Filename::Filename(const CHAR *string)  //ok
{
	//GeDebugOut(" Filename(%p,const CHAR *string)  %p ",this,C4DOS.Fn->Init);
	C4DOS.Fn->Init(this);
	//GeDebugOut("<<<Init");
	C4DOS.Fn->SetCString(this,string);
	//GeDebugOut("<<<SetCString");
}

inline Filename::Filename(const String &string)
{
	//GeDebugOut(" Filename(%p,const String &string %p)  %p ",this,&string,C4DOS.Fn->Init);
	C4DOS.Fn->Init(this);
	//GeDebugOut("SetString>>>");
	C4DOS.Fn->SetString(this,&string);  
	//GeDebugOut("<<<SetString");
}

inline Filename::Filename(const Filename &src)
{
	C4DOS.Fn->Init(this);	
	C4DOS.Fn->CopyTo(&src,this);
}

inline Filename::~Filename(void) ///crash !!!
{
	//GeDebugOut(" ~Filename(%p) >> ",this );
	C4DOS.Fn->Flush(this);
	//GeDebugOut(" ~Filename(%p) << ",this );
}

void inline Filename::CopyTo(Filename *dst) const
{
	C4DOS.Fn->CopyTo(this,dst);
}

Bool inline Filename::FileSelect(FILESELECTTYPE type, FILESELECT flags, const String &title, const String &force_suffix)
{
	return FnCall(FileSelect,type,flags,title,force_suffix);
}

void inline Filename::SetIpConnection(IpConnection *ipc)
{
	FnCall(SetIpConnection, ipc);//Remo: 26.09.2012
}

inline IpConnection* Filename::GetIpConnection() const
{
	return FnCall(GetIpConnection);//Remo: 26.09.2012
}

Bool inline Filename::Content(void) const
{
	return C4DOS.Fn->Content(this);
}

inline String Filename::GetString(void) const ///crash !!!
{
	//GeDebugOut(" GetString(%p) ",this );
	return C4DOS.Fn->GetString(this);
}

void inline Filename::SetString(const String &str)
{
	C4DOS.Fn->SetString(this,&str);
}

const Filename inline Filename::GetDirectory(void) const
{
	return C4DOS.Fn->GetDirectory(this);
}

const Filename inline Filename::GetFile(void) const
{
	return C4DOS.Fn->GetFile(this);
}

String inline Filename::GetFileString(void) const
{
	return GetFile().GetString();
}

void inline Filename::ClearSuffix(void)
{
	C4DOS.Fn->ClearSuffix(this);
}

void inline Filename::ClearSuffixComplete(void)
{
	C4DOS.Fn->ClearSuffixComplete(this);
}

void inline Filename::SetSuffix(const String &str)
{
	C4DOS.Fn->SetSuffix(this,&str);
}

Bool inline Filename::CheckSuffix(const String &str) const
{
	return C4DOS.Fn->CheckSuffix(this,&str);
}

String inline Filename::GetSuffix(void) const
{
	return C4DOS.Fn->GetSuffix(this);
}

void inline Filename::SetDirectory(const Filename &str)
{
	C4DOS.Fn->SetDirectory(this,&str);
}

void inline Filename::SetFile(const Filename &str)
{
	C4DOS.Fn->SetFile(this,&str);
}

inline const Filename&  Filename::operator = (const Filename &cs)
{
	C4DOS.Fn->CopyTo(&cs,this);
	return *this;
}

inline const Filename operator + (const Filename &Str1,const Filename &Str2)
{
	Filename fn = Str1;
	C4DOS.Fn->Add(&fn,&Str2);
	return fn;
}

inline const Filename& Filename::operator += (const Filename &Str)
{
	C4DOS.Fn->Add(this,&Str);
	return *this;
}

Bool inline Filename::operator == (const Filename &Str) const
{
	return C4DOS.Fn->Compare(this,&Str);
}

Bool inline Filename::operator != (const Filename &Str) const
{
	return !C4DOS.Fn->Compare(this,&Str);
}

void inline Filename::SetMemoryReadMode(void *adr, VLONG size)
{
	C4DOS.Fn->SetMemoryReadMode(this, adr, size);
}

void inline Filename::SetMemoryWriteMode(MemoryFileStruct *mfs)
{
	C4DOS.Fn->SetMemoryWriteMode(this, mfs);
}
#endif ///Filename

#if 1  ///MemoryFileStruct
MemoryFileStruct* MemoryFileStruct::Alloc()
{
	return C4DOS.Fn->MemoryFileStructAlloc();
}

void MemoryFileStruct::Free(MemoryFileStruct *&mfs)
{
	C4DOS.Fn->MemoryFileStructFree(mfs);
}

void MemoryFileStruct::GetData(void *&data, VLONG &size, Bool release)
{
	C4DOS.Fn->MemoryFileStructGetData(this, data, size, release);
}
#endif   ///MemoryFileStruct

#if 1 ///BaseFile
BaseFile *BaseFile::Alloc(void)
{
	return C4DOS.Fl->Alloc();
}

void BaseFile::Free(BaseFile *&fl)
{
	C4DOS.Fl->Free(fl);
	fl=NULL;
}

Bool BaseFile::Open(const Filename &name, FILEOPEN mode, FILEDIALOG error_dialog, BYTEORDER order, LONG type, LONG creator)
{
	return FlCall(Open, name,mode,error_dialog,order,type,creator);
}

Bool BaseFile::Close(void)
{
	return FlCall(Close );
}

void BaseFile::SetOrder(BYTEORDER order)
{
	FlCall(SetOrder, order);
}

VLONG BaseFile::ReadBytes(void *data, VLONG len, Bool just_try_it)
{
	return FlCall(ReadBytes, data,len,just_try_it);
}

Bool BaseFile::WriteBytes(const void *data, VLONG len)
{
	return FlCall(WriteBytes, data,len);
}

VLONG BaseFile::TryReadBytes(void *data, VLONG len)
{
	return FlCall(ReadBytes, data,len,TRUE);
}

Bool BaseFile::Seek(LLONG pos, FILESEEK mode)
{
	return FlCall(Seek, pos,mode);
}

LLONG BaseFile::GetPosition()
{
	return FlCall(GetPosition );
}

LLONG BaseFile::GetLength() 
{
	return FlCall(GetLength );
}

FILEERROR BaseFile::GetError() const
{
	return FlCall(GetError );
}

void BaseFile::SetError(FILEERROR error)
{
	FlCall(SetError, error);
}

Bool BaseFile::ReadChar (CHAR *v)
{
	return FlCall(ReadChar, v);
}

Bool BaseFile::ReadUChar(UCHAR *v)
{
	return FlCall(ReadUChar, v);
}

Bool BaseFile::ReadWord (SWORD *v)
{
	return FlCall(ReadWord, v);
}

Bool BaseFile::ReadUWord(UWORD *v)
{
	return FlCall(ReadUWord, v);
}

Bool BaseFile::ReadLong (LONG  *v)
{
	return FlCall(ReadLong, v);
}

Bool BaseFile::ReadULong(ULONG *v)
{
	return FlCall(ReadULong, v);
}

Bool BaseFile::ReadLLong(LLONG *v)
{
	return FlCall(ReadLLong, v);
}

Bool BaseFile::ReadLULong(LULONG *v)
{
	return FlCall(ReadLULong, v);
}

Bool BaseFile::ReadLReal(LReal *v)
{
	return FlCall(ReadLReal, v);
}

Bool BaseFile::ReadSReal(SReal *v)
{
	return FlCall(ReadSReal, v);
}

Bool BaseFile::ReadSVector(SVector *v)
{
	return ReadSReal(&v->x) && ReadSReal(&v->y) && ReadSReal(&v->z);
}

Bool BaseFile::WriteSVector(const SVector &v)
{
	return WriteSReal(v.x) && WriteSReal(v.y) && WriteSReal(v.z);
}

Bool BaseFile::ReadLVector(LVector *v)
{
	return ReadLReal(&v->x) && ReadLReal(&v->y) && ReadLReal(&v->z);
}

Bool BaseFile::WriteLVector(const LVector &v)
{
	return WriteLReal(v.x) && WriteLReal(v.y) && WriteLReal(v.z);
}

Bool BaseFile::ReadSMatrix(SMatrix *v)
{
	return ReadSVector(&v->off) && ReadSVector(&v->v1) && ReadSVector(&v->v2) && ReadSVector(&v->v3);
}

Bool BaseFile::WriteSMatrix(const SMatrix &v)
{
	return WriteSVector(v.off) && WriteSVector(v.v1) && WriteSVector(v.v2) && WriteSVector(v.v3);
}

Bool BaseFile::ReadLMatrix(LMatrix *v)
{
	return ReadLVector(&v->off) && ReadLVector(&v->v1) && ReadLVector(&v->v2) && ReadLVector(&v->v3);
}

Bool BaseFile::WriteLMatrix(const LMatrix &v)
{
	return WriteLVector(v.off) && WriteLVector(v.v1) && WriteLVector(v.v2) && WriteLVector(v.v3);
}

Bool BaseFile::ReadString(String *v)
{
	LONG  len=0;
	CHAR	*c = NULL;

	if (!ReadLong(&len)) return FALSE;
	if (!len) { *v=String(); return TRUE; }

	c = GeAllocType(CHAR,len);
	if (!c)
	{
		SetError(FILEERROR_OUTOFMEMORY);
		return FALSE;
	}
	if (!ReadBytes(c,len))
	{
		GeFree(c);
		return FALSE;
	}

	v->SetCString(c,len-1);
	GeFree(c);

	return TRUE;
}

Bool BaseFile::ReadFilename(Filename *v)
{
	String str;
	if (!ReadString(&str)) return FALSE;
	v->SetString(str);
	return TRUE;
}

Bool BaseFile::ReadBool(Bool *v)
{
	CHAR c;
	if (!ReadChar(&c)) return FALSE;
	*v = c!=0;
	return TRUE;
}

Bool BaseFile::WriteBool(Bool v)
{
	return WriteChar(CHAR(v!=0));
}

Bool BaseFile::WriteString(const String &v)
{
	Bool ok;
	LONG len  = v.GetCStringLen()+1;
	CHAR *mem = GeAllocType(CHAR,len);
	if (!mem)
	{
		SetError(FILEERROR_OUTOFMEMORY);
		return FALSE;
	}

	v.GetCString(mem,len);
	ok = WriteLong(len) && WriteBytes(mem,len);
	GeFree(mem);

	return ok;
}

Bool BaseFile::WriteFilename(const Filename &v)
{
	return WriteString(v.GetString());
}

Bool BaseFile::WriteChar (CHAR v)
{
	return FlCall(WriteChar, v);
}

Bool BaseFile::WriteUChar(UCHAR v)
{
	return FlCall(WriteUChar, v);
}

Bool BaseFile::WriteWord (SWORD v)
{
	return FlCall(WriteWord, v);
}

Bool BaseFile::WriteUWord(UWORD v)
{
	return FlCall(WriteUWord, v);
}

Bool BaseFile::WriteLong (LONG v)
{
	return FlCall(WriteLong, v);
}

Bool BaseFile::WriteLLong(LLONG v)
{
	return FlCall(WriteLLong, v);
}

Bool BaseFile::WriteULong(ULONG v)
{
	return FlCall(WriteULong, v);
}

Bool BaseFile::WriteLULong(LULONG v)
{
	return FlCall(WriteLULong, v);
}

Bool BaseFile::WriteLReal(LReal v)
{
	return FlCall(WriteLReal, v);
}

Bool BaseFile::WriteSReal(SReal v)
{
	return FlCall(WriteSReal, v);
}

#endif /// BaseFile


#if 0 ///AESFile

AESFile *AESFile::Alloc(void)
{
	return C4DOS.Fl->AESAlloc();
}

void AESFile::Free(AESFile *&fl)
{
	C4DOS.Fl->Free((BaseFile*)fl);
	fl=NULL;
}

Bool AESFile::Open(const Filename &name, const char* key, LONG keylen, LONG blocksize, ULONG aes_flags, FILEOPEN mode, FILEDIALOG error_dialog, BYTEORDER order, LONG type, LONG creator)
{
	return FlCall(AESOpen, name,key,keylen,blocksize,aes_flags,mode,error_dialog,order,type,creator);
}

Bool AESFile::CheckEncryption(const Filename& encrypt, const Filename& decrypt, const char* key, LONG keylen, LONG blocksize)
{
	return C4DOS.Fl->AESCheckEncryption(encrypt, decrypt, key, keylen, blocksize);
}
#endif /// AESFile


#if 0 ///BrowseVolumes

BrowseVolumes *BrowseVolumes::Alloc()
{
	return C4DOS.Bf->BvAlloc();
}

void BrowseVolumes::Init(void)
{
	BfCall(BvInit);
	//(this->*RE_C4DOS.Bf->BvInit)();
}

void BrowseVolumes::Free(BrowseVolumes *&bf)
{
	C4DOS.Bf->BvFree(bf);
	bf=NULL;
}

Bool BrowseVolumes::GetNext(void)
{
	return BfCall(BvGetNext);
	//return (this->*C4DOS.Bf->BvGetNext)();
}

Filename BrowseVolumes::GetFilename(void)
{
	return BfCall(BvGetFilename);
	//return (this->*C4DOS.Bf->BvGetFilename)();
}

String	BrowseVolumes::GetVolumeName( LONG *out_flags )
{
	return BfCall(BvGetVolumeName, out_flags );
	//return (this->*C4DOS.Bf->BvGetVolumeName)( out_flags );
}
#endif /// BrowseVolumes

#if 0 ///BrowseFiles

BrowseFiles *BrowseFiles::Alloc()
{
	return C4DOS.Bf->Alloc(NULL,0);
}

void BrowseFiles::Init(const Filename &directory, LONG flags)
{
	C4DOS.Bf->Init(this,&directory,flags);
}

void BrowseFiles::Free(BrowseFiles *&bf)
{
	C4DOS.Bf->Free(bf);
	bf=NULL;
}

Bool BrowseFiles::GetNext(void)
{
	return BfCall(GetNext );
	//return (this->*C4DOS.Bf->GetNext)();
}

LLONG BrowseFiles::GetSize(void)
{
	return BfCall(GetSize );
	//return (this->*C4DOS.Bf->GetSize)();
}

Bool BrowseFiles::IsDir(void)
{
	return BfCall(IsDir );
	//return (this->*C4DOS.Bf->IsDir)();
}

Bool BrowseFiles::IsHidden(void)
{
	return BfCall(IsHidden );
	//return (this->*C4DOS.Bf->IsHidden)();
}

Bool BrowseFiles::IsReadOnly(void)
{
	return BfCall(IsReadOnly );
	//return (this->*C4DOS.Bf->IsReadOnly)();
}

Bool BrowseFiles::IsBundle(void)
{
	return BfCall(IsBundle );
	//return (this->*C4DOS.Bf->IsBundle)();
}

void BrowseFiles::GetFileTime(LONG mode, LocalFileTime *out)
{
	BfCall(GetFileTime ,mode,out);
	//(this->*C4DOS.Bf->GetFileTime)(mode,out);
}

Filename BrowseFiles::GetFilename(void)
{
	return BfCall(GetFilename );
	//return (this->*C4DOS.Bf->GetFilename)();
}
#endif ///BrowseFiles


#if 1  ///global 
Bool GeGetFileTime(const Filename &name, LONG mode, LocalFileTime *out)
{
	return C4DOS.Ge->GetFileTime(name,mode,out);
}

Bool GeSetFileTime(const Filename &name, LONG mode, const LocalFileTime *in)
{
	return C4DOS.Ge->SetFileTime(name,mode,in);
}

void GeGetCurrentTime(LocalFileTime *out)
{
	C4DOS.Ge->GetCurrentTime(out);
}

Bool GeFExist(const Filename &name, Bool isdir)
{
	return C4DOS.Ge->FExist(&name,isdir);
}

Bool GeSearchFile(const Filename &directory, const Filename &name, Filename *found)
{
	return C4DOS.Ge->SearchFile(&directory,&name,found);
}

Bool GeFKill(const Filename &name, LONG flags)
{
	return C4DOS.Ge->FKill(&name,flags);
}

Bool GeFCopyFile(const Filename &source, const Filename &dest, LONG flags)
{
	return C4DOS.Ge->FCopyFile(&source,&dest,flags);
}

Bool GeFRename(const Filename &source, const Filename &dest)
{
	return C4DOS.Ge->FRename(&source,&dest);
}

Bool GeFMove(const Filename &source, const Filename &dest)
{
	return C4DOS.Ge->FMove(source,dest);
}

Bool GeFCreateDir(const Filename &name)
{
	return C4DOS.Ge->FCreateDir(&name);
}

Bool GeFCreateDirRec(const Filename &fn)
{
	Filename parent = fn.GetDirectory();

	if (!parent.Content()) return FALSE;

	if (!GeFExist(parent,TRUE))
	{
		if (!GeFCreateDirRec(parent))
			return FALSE;
	}

	if (!GeFExist(fn,TRUE))
	{
		if (!GeFCreateDir(fn))
		{
			return FALSE;
		}
	}
	return TRUE;
}

Bool GeExecuteFile(const Filename &path)
{
	return C4DOS.Ge->ExecuteFile(&path);
}

Bool GeExecuteProgram(const Filename &program, const Filename &img)
{
	return C4DOS.Ge->ExecuteProgram(&program,&img);
}

Bool GeExecuteProgramEx(const Filename &program, const String *args, LONG argcnt, GeExecuteProgramExCallback callback, void *userdata)
{
	return C4DOS.Ge->GeExecuteProgramEx(program,args,argcnt,callback,userdata);
}

Bool GeFGetDiskFreeSpace(const Filename &vol, LULONG &freecaller, LULONG &total, LULONG &freespace)
{
	return C4DOS.Ge->GeFGetDiskFreeSpace(vol, freecaller, total, freespace);
}

ULONG GeFGetAttributes(const Filename &name)
{
	return C4DOS.Ge->GeFGetAttributes(&name);
}

Bool GeFSetAttributes(const Filename &name, ULONG flags, ULONG mask)
{
	return C4DOS.Ge->GeFSetAttributes(&name, flags, mask);
}

const Filename GeGetStartupPath(void)
{
	return C4DOS.Ge->GetStartupPath();
}

const Filename GeGetStartupApplication(void)
{
	return C4DOS.Ge->GetStartupApplication();
}

Bool RequestFileFromServer(const Filename &fn, Filename &res)
{
	return C4DOS.Ge->RequestFileFromServer(fn,res);
}

const Filename GeGetPluginPath(void)
{
	extern Filename *path_storage;

	return path_storage ? path_storage->GetDirectory() : Filename();
}

const Filename GeGetC4DPath(LONG whichpath)
{
	return C4DOS.Ge->GetC4DPath(whichpath);
}

const Filename GeGetStartupWritePath(void)
{
	return GeGetC4DPath(C4D_PATH_STARTUPWRITE);
}
#endif  ///global 

#if 0 ///FileMonitor
Bool	FileMonitor::WatchFolder( const Filename &folder, FileMonitorCallback callback, void *userdata )
{
	return C4DOS.Ge->WatchFolder( folder, callback, userdata );
}

Bool	FileMonitor::DontWatchFolder( const Filename &folder, FileMonitorCallback callback, void *userdata )
{
	return C4DOS.Ge->DontWatchFolder( folder, callback, userdata );
};

Bool	FileMonitor::WatchFile( const Filename &file, FileMonitorCallback callback, void *userdata )
{
	return C4DOS.Ge->WatchFile( file, callback, userdata );
}

Bool	FileMonitor::DontWatchFile( const Filename &file, FileMonitorCallback callback, void *userdata )
{
	return C4DOS.Ge->DontWatchFile( file, callback, userdata );
};
#endif ///FileMonitor


#if 0 ///HyperFile

HyperFile *HyperFile::Alloc(void)
{
	return C4DOS.Hf->AllocHF();
}

void HyperFile::Free(HyperFile *&fl)
{
	C4DOS.Hf->FreeHF(fl);
	fl=NULL;
}

Bool HyperFile::Open(LONG ident, const Filename &filename, FILEOPEN mode, FILEDIALOG error_mode)
{
	return HfCall(Open, ident,filename,mode,error_mode);
}

Bool HyperFile::Close()
{
	return HfCall(Close );
}

BaseDocument* HyperFile::GetDocument() const
{
	return HfCall(GetDocument );
}

Bool HyperFile::ReadChar (CHAR *v)
{
	return HfCall(ReadChar, v);
}

Bool HyperFile::ReadUChar(UCHAR *v)
{
	return HfCall(ReadUChar, v);
}

Bool HyperFile::ReadWord (SWORD  *v)
{
	return HfCall(ReadWord, v);
}

Bool HyperFile::ReadUWord(UWORD *v)
{
	return HfCall(ReadUWord, v);
}

Bool HyperFile::ReadLong (LONG  *v)
{
	return HfCall(ReadLong, v);
}

Bool HyperFile::ReadULong(ULONG *v)
{
	return HfCall(ReadULong, v);
}

Bool HyperFile::ReadLLong(LLONG *v)
{
	return HfCall(ReadLLong, v);
}

Bool HyperFile::ReadLULong(LULONG *v)
{
	return HfCall(ReadLULong, v);
}

Bool HyperFile::ReadReal (Real  *v)
{
	return HfCall(ReadReal, v);
}

Bool HyperFile::ReadLReal(LReal *v)
{
	return HfCall(ReadLReal, v);
}

Bool HyperFile::ReadSReal(SReal *v)
{
	return HfCall(ReadSReal, v);
}

Bool HyperFile::ReadBool(Bool *v)
{
	return HfCall(ReadBool, v);
}

Bool HyperFile::ReadTime(BaseTime *v)
{
	return HfCall(ReadTime, v);
}

Bool HyperFile::ReadVector(Vector *v)
{
	return HfCall(ReadVector, v);
}

Bool HyperFile::ReadLVector(LVector *v)
{
	return HfCall(ReadLVector, v);
}

Bool HyperFile::ReadSVector(SVector *v)
{
	return HfCall(ReadSVector, v);
}

Bool HyperFile::ReadMatrix(Matrix *v)
{
	return HfCall(ReadMatrix, v);
}

Bool HyperFile::ReadLMatrix(LMatrix *v)
{
	return HfCall(ReadLMatrix, v);
}

Bool HyperFile::ReadSMatrix(SMatrix *v)
{
	return HfCall(ReadSMatrix, v);
}

Bool HyperFile::ReadString(String *v)
{
	return HfCall(ReadString, v);
}

Bool HyperFile::ReadFilename(Filename *v)
{
	return HfCall(ReadFilename, v);
}

Bool HyperFile::ReadGeData(GeData *v)
{
	return C4DOS.Hf->ReadGeData(this,*v);
}

Bool HyperFile::ReadContainer(BaseContainer *v, Bool flush)
{
	return HfCall(ReadContainer, v,flush);
}

Bool HyperFile::ReadMemory(void **data, VLONG *size)
{
	return HfCall(ReadMemory, data,size);
}

Bool HyperFile::ReadImage(BaseBitmap *v)
{
	return HfCall(ReadImage, v);
}

Bool HyperFile::ReadChannel(BaseChannel *bc)
{
	return bc && C4DOS.Ba->ReadData(this,bc);
}

Bool HyperFile::ReadChannelConvert(GeListNode *node, LONG link_id)
{
	return C4DOS.Ba->ReadDataConvert(node,link_id,this);
}

Bool HyperFile::WriteChannel(BaseChannel *bc)
{
	if (!bc) return FALSE;
	C4DOS.Ba->WriteData(this,bc);
	return TRUE;
}

Bool HyperFile::WriteChar (CHAR v)
{
	return HfCall(WriteChar, v);
}

Bool HyperFile::WriteUChar(UCHAR v)
{
	return HfCall(WriteUChar, v);
}

Bool HyperFile::WriteWord (SWORD v)
{
	return HfCall(WriteWord, v);
}

Bool HyperFile::WriteUWord(UWORD v)
{
	return HfCall(WriteUWord, v);
}

Bool HyperFile::WriteLong (LONG v)
{
	return HfCall(WriteLong, v);
}

Bool HyperFile::WriteULong(ULONG v)
{
	return HfCall(WriteULong, v);
}

Bool HyperFile::WriteLLong(LLONG v)
{
	return HfCall(WriteLLong, v);
}

Bool HyperFile::WriteLULong(LULONG v)
{
	return HfCall(WriteLULong, v);
}

Bool HyperFile::WriteReal(Real v)
{
	return HfCall(WriteReal, v);
}

Bool HyperFile::WriteSReal(SReal v)
{
	return HfCall(WriteSReal, v);
}

Bool HyperFile::WriteLReal(LReal v)
{
	return HfCall(WriteLReal, v);
}

Bool HyperFile::WriteBool(Bool v)
{
	return HfCall(WriteBool, v);
}

Bool HyperFile::WriteTime(const BaseTime &v)
{
	return HfCall(WriteTime, v);
}

Bool HyperFile::WriteVector(const Vector &v)
{
	return HfCall(WriteVector, v);
}

Bool HyperFile::WriteSVector(const SVector &v)
{
	return HfCall(WriteSVector, v);
}

Bool HyperFile::WriteLVector(const LVector &v)
{
	return HfCall(WriteLVector, v);
}

Bool HyperFile::WriteMatrix(const Matrix &v)
{
	return HfCall(WriteMatrix, v);
}

Bool HyperFile::WriteSMatrix(const SMatrix &v)
{
	return HfCall(WriteSMatrix, v);
}

Bool HyperFile::WriteLMatrix(const LMatrix &v)
{
	return HfCall(WriteLMatrix, v);
}

Bool HyperFile::WriteString(const String &v)
{
	return HfCall(WriteString, v);
}

Bool HyperFile::WriteFilename(const Filename &v)
{
	return HfCall(WriteFilename, v);
}

Bool HyperFile::WriteImage(BaseBitmap *v, LONG format, BaseContainer *data, SAVEBIT savebits)
{
	return HfCall(WriteImage, v,format,data,savebits);
}

Bool HyperFile::WriteContainer(const BaseContainer &v)
{
	return HfCall(WriteContainer, v);
}

Bool HyperFile::WriteGeData(const GeData &v)
{
	return C4DOS.Hf->WriteGeData(this,v);
}

Bool HyperFile::WriteArray(const void *data, HYPERFILEARRAY datatype, LONG structure_increment, LONG count)
{
	return HfCall(WriteArray, data,datatype,structure_increment,count);
}

Bool HyperFile::ReadArray(void *data, HYPERFILEARRAY datatype, LONG structure_increment, LONG count)
{
	return HfCall(ReadArray, data,datatype,structure_increment,count);
}

Bool HyperFile::WriteMemory(const void *data, VLONG count)
{
	return HfCall(WriteMemory, data,count);
}

FILEERROR HyperFile::GetError() const
{
	return HfCall(GetError );
}

void HyperFile::SetError(FILEERROR err)
{
	HfCall(SetError, err);
}

Bool HyperFile::ReadValueHeader(HYPERFILEVALUE *h)
{
	return HfCall(ReadValueHeader, h);
}

Bool HyperFile::SkipValue(HYPERFILEVALUE h)
{
	return HfCall(SkipValue, h);
}

Bool HyperFile::WriteChunkStart(LONG id, LONG level)
{
	return HfCall(WriteChunkStart, id,level);
}

Bool HyperFile::WriteChunkEnd(void)
{
	return HfCall(WriteChunkEnd );
}

Bool HyperFile::ReadChunkStart(LONG *id, LONG *level)
{
	return HfCall(ReadChunkStart, id,level);
}

Bool HyperFile::ReadChunkEnd(void)
{
	return HfCall(ReadChunkEnd );
}

Bool HyperFile::SkipToEndChunk(void)
{
	return HfCall(SkipToEndChunk );
}

LONG HyperFile::GetFileVersion() const
{
	return HfCall(GetFileVersion );
}

FILEERROR ReadHyperFile(BaseDocument *doc, GeListNode *node, const Filename &filename, LONG ident, String *warning_string)
{
	return C4DOS.Hf->ReadFile(doc,node,filename,ident,warning_string);
}

FILEERROR WriteHyperFile(BaseDocument *doc, GeListNode *node, const Filename &filename, LONG ident)
{
	return C4DOS.Hf->WriteFile(doc,node,filename,ident);
}
#endif  ///HyperFile

#if 1  ///global 
String DateToString(const LocalFileTime &t, Bool date_only)
{
	return C4DOS.Ge->DateToString(t,date_only);
}

Bool ShowInFinder(const Filename &fn, Bool open)
{
	return C4DOS.Ge->ShowInFinder(fn,open);
}

#endif



#endif //C4D_FILE_RE_INL_

