Advanced Strategic Command
Classes | Macros | Typedefs | Functions | Variables
basestrm.h File Reference

The interface for the various streams that ASC offers, like file and memory streams. More...

#include <string>
#include <stdio.h>
#include <time.h>
#include <vector>
#include <list>
#include <queue>
#include <SDL.h>
#include "global.h"
#include "basestreaminterface.h"
#include "lzw.h"
#include "errors.h"
#include "simplestream.h"
#include "basetemp.h"
Include dependency graph for basestrm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RWOPS_Handler
 
class  CharBuf
 
class  StreamCompressionError
 
class  OutOfMemoryError
 
class  tbufferoverflow
 
class  tinvalidversion
 
class  dynamic_array< T >
 DEPRECATED Use containers of the C++ Standard Template Library instead! Container for managing objects of type T. More...
 
class  MemoryStreamCopy
 Buffers the complete contents of a stream in memory. More...
 
class  MemoryStreamStorage
 An in-memory storage of streamed data. More...
 
class  MemoryStream
 Reads data from or writes data to a MemoryStreamStorage This allows a completely volatile storage of data. More...
 
class  tlzwstreamcompression
 
class  CompressionStreamInterface
 
class  CompressionStreamAdapter
 
class  libbzip_compression
 
class  libbzip_decompression
 
class  tanycompression
 
class  tn_lzw_file_buf_stream
 
class  tn_c_lzw_filestream
 
struct  tcontainerindex
 
class  ContainerIndexer
 
class  tncontainerstream
 
class  tfindfile
 Searching for files. More...
 
struct  tfindfile::FileInfo
 
class  ASCIIEncodingStream
 Data written to this stream will be encoded similar to base64 and can be retrieved as a string. More...
 
class  ASCIIDecodingStream
 Reading data from an ASCII encoded String. More...
 
class  StreamCompressionFilter
 Compresses data transparently into another stream (using bzip2 compression) More...
 
class  StreamDecompressionFilter
 Deompresses data from a compressed stream (using bzip2 compression) More...
 
class  FileName
 This class handles filenames. All operations that work on filenames will be added here. More...
 

Macros

#define writedata2(a)   writedata ( &(a), sizeof(a) )
 
#define readdata2(a)   readdata ( &(a), sizeof(a) )
 

Typedefs

typedef class tncontainerstreampncontainerstream
 
typedef tn_c_lzw_filestream tnfilestream
 
typedef tnfilestreampnfilestream
 

Functions

SDL_RWops * SDL_RWFromStream (tnstream *stream)
 
ASCString listContainer ()
 
int compressrle (const void *p, void *q)
 
bool patimat (const ASCString &pat, const ASCString &str, bool forceCaseInsensitivity=false)
 checks whether the regular expression pat matches the string str . More...
 
int checkforvaliddirectory (char *dir)
 
ASCString getnextfilenumname (const ASCString &first, const ASCString &suffix, int num=-1)
 
bool exist (const ASCString &s)
 does a file s exist (wildcards allowed) More...
 
time_t get_filetime (const char *devicename)
 
void opencontainer (const char *wildcard)
 
int filesize (const char *name)
 
void addSearchPath (const ASCString &path)
 
void appendbackslash (char *String)
 
void appendbackslash (ASCString &String)
 
char * constructFileName (char *buf, int directoryLevel, const char *path, const char *filename)
 
ASCString constructFileName (int directoryLevel, const ASCString &path, ASCString filename)
 
bool directoryExist (const ASCString &path)
 
char * extractPath (char *buf, const char *filename)
 
char * extractFileName (char *buf, const char *filename)
 
ASCString extractFileName (const ASCString &filename)
 
ASCString extractFileName_withoutSuffix (const ASCString &filename)
 
int createDirectory (const char *name)
 
int getSearchPathNum ()
 
ASCString getSearchPath (int i)
 
bool isPathRelative (const ASCString &path)
 
void convertPathDelimitters (ASCString &path)
 converts path delimitters from foreign operating systems to the ones used by the current operating system. On Linux, this function converts backslashes to slashes, on Windows vice versa More...
 
template<typename C >
void writePointerContainer (const C &c, tnstream &stream)
 
template<typename BaseType >
void readPointerContainer (vector< BaseType * > &v, tnstream &stream)
 
template<typename BaseType >
void readPointerContainer (list< BaseType * > &v, tnstream &stream)
 
template<typename C >
void writeClassContainer (const C &c, tnstream &stream)
 
template<typename C >
void readClassContainer (C &c, tnstream &stream)
 
template<typename C >
void readClassContainerStaticConstructor (C &c, tnstream &stream)
 
template<>
void writeClassContainer (const vector< ASCString > &c, tnstream &stream)
 
template<>
void readClassContainer (vector< ASCString > &c, tnstream &stream)
 
template<>
void writeClassContainer (const vector< int > &c, tnstream &stream)
 
template<>
void readClassContainer (vector< int > &c, tnstream &stream)
 
template<>
void writeClassContainer (const vector< pair< int, int > > &c, tnstream &stream)
 
template<>
void readClassContainer (vector< pair< int, int > > &c, tnstream &stream)
 

Variables

const int maxFileStringSize = 10000
 
const char * asc_configurationfile
 
const int maxfilenamelength
 
const char * containermagic
 
const char * filereadmode
 
const char * filewritemode
 
const char * filereadmodetext
 
const char * filewritemodetext
 
const char pathdelimitter
 
const char * pathdelimitterstring
 

Detailed Description

The interface for the various streams that ASC offers, like file and memory streams.

Definition in file basestrm.h.

Macro Definition Documentation

#define readdata2 (   a)    readdata ( &(a), sizeof(a) )
#define writedata2 (   a)    writedata ( &(a), sizeof(a) )

Typedef Documentation

Definition at line 406 of file basestrm.h.

Definition at line 430 of file basestrm.h.

Definition at line 429 of file basestrm.h.

Function Documentation

void addSearchPath ( const ASCString path)

Definition at line 2517 of file basestrm.cpp.

References ascDirectory, constructFileName(), directoryExist(), and searchDirNum.

Referenced by initFileIO(), main(), and opencontainer().

void appendbackslash ( char *  String)
void appendbackslash ( ASCString String)

Definition at line 2602 of file basestrm.cpp.

References pathdelimitter, and pathdelimitterstring.

int checkforvaliddirectory ( char *  dir)

Definition at line 2255 of file basestrm.cpp.

References ASC_direct, closedir(), opendir(), and readdir().

int compressrle ( const void *  p,
void *  q 
)
char* constructFileName ( char *  buf,
int  directoryLevel,
const char *  path,
const char *  filename 
)
ASCString constructFileName ( int  directoryLevel,
const ASCString path,
ASCString  filename 
)

Definition at line 954 of file basestrm.cpp.

References appendbackslash(), ascDirectory, isPathRelative(), and pathdelimitter.

void convertPathDelimitters ( ASCString path)

converts path delimitters from foreign operating systems to the ones used by the current operating system. On Linux, this function converts backslashes to slashes, on Windows vice versa

Definition at line 2646 of file basestrm.cpp.

References foreignPathDelimitterString, and pathdelimitterstring.

Referenced by tfindfile::tfindfile().

int createDirectory ( const char *  name)

Definition at line 2609 of file basestrm.cpp.

Referenced by makeDirectory().

bool directoryExist ( const ASCString path)

Definition at line 2500 of file basestrm.cpp.

References closedir(), opendir(), and readdir().

Referenced by addSearchPath(), getDirectory(), and makeDirectory().

bool exist ( const ASCString s)
char* extractFileName ( char *  buf,
const char *  filename 
)
ASCString extractFileName ( const ASCString filename)

Definition at line 2579 of file basestrm.cpp.

References extractFileName().

ASCString extractFileName_withoutSuffix ( const ASCString filename)
char* extractPath ( char *  buf,
const char *  filename 
)

Definition at line 2548 of file basestrm.cpp.

References pathdelimitter.

Referenced by ContainerCollector::init(), and writegameoptions().

int filesize ( const char *  name)

Definition at line 2489 of file basestrm.cpp.

time_t get_filetime ( const char *  devicename)
ASCString getnextfilenumname ( const ASCString first,
const ASCString suffix,
int  num = -1 
)

Definition at line 2418 of file basestrm.cpp.

References tfindfile::getnextname(), and ASCString::toString().

Referenced by executeUserAction().

ASCString getSearchPath ( int  i)

Definition at line 2539 of file basestrm.cpp.

int getSearchPathNum ( )

Definition at line 2534 of file basestrm.cpp.

bool isPathRelative ( const ASCString path)
ASCString listContainer ( )

Definition at line 1052 of file basestrm.cpp.

References ContainerCollector::listContainer().

Referenced by loadAllData(), and showSearchPath().

void opencontainer ( const char *  wildcard)

Definition at line 2457 of file basestrm.cpp.

References addSearchPath(), ContainerCollector::init(), and searchDirNum.

Referenced by initFileIO().

bool patimat ( const ASCString pat,
const ASCString str,
bool  forceCaseInsensitivity = false 
)

checks whether the regular expression pat matches the string str .

This functions only understands dos/windows style wildcards: * and ?

Definition at line 2024 of file basestrm.cpp.

References patimat().

template<typename C >
void readClassContainer ( C &  c,
tnstream stream 
)
template<>
void readClassContainer ( vector< ASCString > &  c,
tnstream stream 
)
inline

Definition at line 796 of file basestrm.h.

template<>
void readClassContainer ( vector< int > &  c,
tnstream stream 
)
inline

Definition at line 817 of file basestrm.h.

template<>
void readClassContainer ( vector< pair< int, int > > &  c,
tnstream stream 
)
inline

Definition at line 840 of file basestrm.h.

template<typename C >
void readClassContainerStaticConstructor ( C &  c,
tnstream stream 
)

Definition at line 769 of file basestrm.h.

References tnstream::getLocation(), and tnstream::readInt().

Referenced by MoveUnit::readData().

template<typename BaseType >
void readPointerContainer ( vector< BaseType * > &  v,
tnstream stream 
)
template<typename BaseType >
void readPointerContainer ( list< BaseType * > &  v,
tnstream stream 
)

Definition at line 727 of file basestrm.h.

References tnstream::readInt().

SDL_RWops* SDL_RWFromStream ( tnstream stream)
template<typename C >
void writeClassContainer ( const C &  c,
tnstream stream 
)
template<>
void writeClassContainer ( const vector< ASCString > &  c,
tnstream stream 
)
inline

Definition at line 785 of file basestrm.h.

template<>
void writeClassContainer ( const vector< int > &  c,
tnstream stream 
)
inline

Definition at line 806 of file basestrm.h.

template<>
void writeClassContainer ( const vector< pair< int, int > > &  c,
tnstream stream 
)
inline

Definition at line 827 of file basestrm.h.

template<typename C >
void writePointerContainer ( const C &  c,
tnstream stream 
)

Variable Documentation

const char* asc_configurationfile

Definition at line 29 of file unix/fileio.cpp.

Referenced by ConfigurationFileLocatorCore::getConfigFileName().

const char* containermagic

Definition at line 86 of file basestrm.cpp.

Referenced by tncontainerstream::tncontainerstream().

const char* filereadmode

Definition at line 19 of file unix/fileio.cpp.

Referenced by tn_file_buf_stream::tn_file_buf_stream().

const char* filereadmodetext

Definition at line 21 of file unix/fileio.cpp.

const char* filewritemode

Definition at line 20 of file unix/fileio.cpp.

Referenced by tn_file_buf_stream::tn_file_buf_stream().

const char* filewritemodetext

Definition at line 22 of file unix/fileio.cpp.

const int maxfilenamelength

Definition at line 28 of file unix/fileio.cpp.

const int maxFileStringSize = 10000

Definition at line 62 of file basestrm.h.

Referenced by constructFileName(), get_filetime(), and ContainerCollector::init().

const char pathdelimitter
const char* pathdelimitterstring