____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

iolib.cpp File Reference

Compression-IO helper functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include "stratagus.h"
#include "iocompat.h"
#include "iolib.h"

Go to the source code of this file.

Classes

class  RawFileWriter
class  GzFileWriter

Functions

static int gzseek (CFile *file, unsigned offset, int whence)
static int FindFileWithExtension (char *file, size_t filesize)
char * LibraryFileName (const char *file, char *buffer, size_t buffersize)
 < Build libary path name
int ReadDataDirectory (const char *dirname, int(*filter)(char *, FileList *), std::vector< FileList > &fl)
FileWriterCreateFileWriter (const std::string &filename)


Detailed Description

Compression-IO helper functions.

Definition in file iolib.cpp.


Function Documentation

FileWriter* CreateFileWriter ( const std::string &  filename  ) 

Create FileWriter

Definition at line 592 of file iolib.cpp.

References strcasestr().

Referenced by WriteMapPresentation(), and WriteMapSetup().

static int FindFileWithExtension ( char *  file,
size_t  filesize 
) [static]

Find a file with its correct extension ("" or ".gz")

Parameters:
file The string with the file path. Upon success, the string is replaced by the full filename witht he correct extension.
filesize Size of the file buffer
Returns:
1 if the file has been found.

Definition at line 337 of file iolib.cpp.

References sprintf_s(), and strcpy_s().

Referenced by LibraryFileName().

static int gzseek ( CFile file,
unsigned  offset,
int  whence 
) [static]

Seek on compressed input. (Newer libs support it directly)

Parameters:
file File
offset Seek position
whence How to seek

Definition at line 70 of file iolib.cpp.

Referenced by CFile::seek().

char* LibraryFileName ( const char *  file,
char *  buffer,
size_t  buffersize 
)

< Build libary path name

Generate a filename into library.

Try current directory, user home directory, global directory.

Parameters:
file Filename to open.
buffer Allocated buffer for generated filename.
buffersize Size of the buffer
Returns:
Pointer to buffer.

Definition at line 364 of file iolib.cpp.

References _C_, DebugPrint, FindFileWithExtension(), sprintf_s(), StratagusLibPath, strcpy_s(), and UserDirectory.

Referenced by CclLoad(), CclLoadBuffer(), CreateGame(), CEditor::Init(), LoadCcl(), LoadGraphicPNG(), LoadPO(), LoadSample(), MenuLoop(), PlayMovie(), and PlayMusic().

int ReadDataDirectory ( const char *  dirname,
int(*)(char *, FileList *)  filter,
std::vector< FileList > &  fl 
)

Generate a list of files within a specified directory

Parameters:
dirname Directory to read.
filter Optional xdata-filter function.
fl Filelist pointer.
Returns:
the number of entries added to FileList.

Definition at line 417 of file iolib.cpp.

References int(), FileList::name, new_strdup(), strcat_s(), strcpy_s(), and FileList::type.

Referenced by CclFilteredListDirectory().


Generated on Sat Feb 21 00:28:17 2009 for Bos Wars by  doxygen 1.5.6