Logo Search packages:      
Sourcecode: djvulibre version File versions

GIFFManager Class Reference

#include <GIFFManager.h>

Inheritance diagram for GIFFManager:

GPEnabled

List of all members.


Detailed Description

Intuitive interface to IFF files.

It's too terrible to keep reading/writing IFF files chunk after chunk using { IFFByteStream}s. This class allows you to operate with chunks as with structures or arrays without even caring about the byte streams.

Some of the examples are below: {verbatim} GP<GIFFChunk> chunk; chunk=manager1.get_chunk("BG44[2]"); manager2.add_chunk(".FORM:DJVU.BG44[-1]", chunk); {verbatim}

{ Chunk name} {itemize} Every chunk name may contain optional prefix FORM:#, LIST:#, PROP:# or CAT:#. If the prefix is omitted and the chunk happens to contain other chunks, FORM:# will be assumed. Every chunk name may be {short} or {complete}. {short} chunk names may not contain dots as they're a subchunks names with respect to a given chunk. {complete} chunk names may contain dots. But there may be or may not be the {leading dot} in the name. If the {leading dot} is present, then the name is assumed to contain the name of the top-level chunk as well. Otherwise it's treated {with respect} to the top-level chunk. You may want to use the leading dot only when you add a chunk to an empty document, since a command like manager.addChunk(".FORM:DJVU.BG44", chunk)# will create the top level chunk of the requested type (FORM:DJVU#) and will add chunk BG44# to it {automatically}. You may use {brackets} in the name to specify the chunk's position. The meaning of the number inside the brackets depends on the function you call. In most of the cases this is the number of the chunk with the given name in the parent chunk. But sometimes (as in addChunk(name, buffer, length)#) the brackets at the end of the name# actually specify the {position} of the chunk in the parent. For example, to insert INCL# chunk into DJVU# form at position #1# (make it the second) you may want to use manager.addChunk(".DJVU.INCL[1]", data, size)#. At the same time, to get 2-nd chunk with name BG44# from form DJVU# you should do smth like chunk=manager.getChunk("BG44[1]")#. Note, that here the manager will search for chunk BG44# in form DJVU# and will take the second {found} one. {itemize}

Definition at line 248 of file GIFFManager.h.


GIFFManager.h

Files #"GIFFManager.h"# and #"GIFFManager.cpp"# define more convenient interface to IFF files. You may want to use the { GIFFManager} class instead of coping with { IFFByteStream} especially when you have to insert or move chunks, which is a kind of tricky with sequential access provided by { IFFByteStream}.

You will mostly deal with { GIFFManager} class, but sometimes you may want to use { GIFFChunk}s as well thus bypassing { GIFFManager}'s interface and working with the chunks hierarchy yourself.

Interface to IFF files.

Author:
Andrei Erofeev <eaf@geocities.com> -- Initial implementation.
Version:
#
Id
GIFFManager.h,v 1.8 2003/11/07 22:08:21 leonb Exp
#

 GIFFManager (void)
void init (const GUTF8String &name)
void init (void)
void set_name (const GUTF8String &name)
 Sets the name of the top level chunk to {name}.

Public Member Functions

void add_chunk (GUTF8String name, const TArray< char > &data)
void add_chunk (GUTF8String parent_name, const GP< GIFFChunk > &chunk, int pos=-1)
void del_chunk (void)
void del_chunk (GUTF8String name)
GP< GIFFChunkget_chunk (GUTF8String name, int *position=0)
int get_chunks_number (void)
int get_chunks_number (const GUTF8String &name)
int get_count (void) const
void load_chunk (IFFByteStream &istr, GP< GIFFChunk > chunk)
void load_file (const TArray< char > &data)
void load_file (GP< ByteStream > str)
void save_file (TArray< char > &data)
void save_file (GP< ByteStream > str)
virtual ~GIFFManager (void)
 Virtual destructor.

Static Public Member Functions

static GP< GIFFManagercreate (const GUTF8String &name)
static GP< GIFFManagercreate (void)
 Default creator.

Protected Attributes

volatile int count
 The reference counter.

Static Private Member Functions

static const char * check_leading_dot (const GUTF8String &name)
static void load_file (ByteStream *)
static void save_file (ByteStream *)

Private Attributes

GP< GIFFChunktop_level

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index