$treeview $search $mathjax
Stratagus  2.2.7
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

src/stratagus/iolib.cpp File Reference

#include "stratagus.h"
#include "iolib.h"
#include "game.h"
#include "iocompat.h"
#include "map.h"
#include "util.h"
#include <stdarg.h>
#include <stdio.h>
#include <zlib.h>
#include <bzlib.h>

Classes

class  CFile::PImpl
class  RawFileWriter
class  GzFileWriter

Functions

iolib.cpp - Compression-IO helper functions.
static int gzseek (CFile *file, unsigned offset, int whence)
static void bzseek (BZFILE *file, unsigned offset, int)
static bool FindFileWithExtension (char *file, size_t filesize)
char * LibraryFileName (const char *file, char *buffer, size_t buffersize)
 Build libary path name.
bool CanAccessFile (const char *filename)
int ReadDataDirectory (const char *dirname, std::vector< FileList > &fl)
 Read the contents of a directory.
FileWriterCreateFileWriter (const std::string &filename)

Function Documentation

static void bzseek ( BZFILE *  file,
unsigned  offset,
int   
) [static]

Seek on compressed input. (I hope newer libs support it directly)

Parameters:
file File handle
offset Seek position
whence How to seek

bool CanAccessFile ( const char *  filename  ) 

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

Create FileWriter

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

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

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:
true if the file has been found.

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

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. This supports .gz, .bz2 and .zip.

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

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

Read the contents of a directory.

Generate a list of files within a specified directory

Parameters:
dirname Directory to read.
fl Filelist pointer.
Returns:
the number of entries added to FileList.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.