kviewshell
DjVmDoc.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef _DJVMDOC_H
00058 #define _DJVMDOC_H
00059 #ifdef HAVE_CONFIG_H
00060 #include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065
00066
00067 #include "DjVmDir.h"
00068
00069 #ifdef HAVE_NAMESPACES
00070 namespace DJVU {
00071 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00072 }
00073 #endif
00074 #endif
00075
00076 class ByteStream;
00077 class DataPool;
00078 class GURL;
00079 class GUTF8String;
00080 class DjVmNav;
00081
00092
00117 class DjVmDoc : public GPEnabled
00118 {
00119
00120 protected:
00121 DjVmDoc(void);
00122 void init(void);
00123 public:
00125 static GP<DjVmDoc> create(void);
00135 void insert_file(
00136 ByteStream &data, DjVmDir::File::FILE_TYPE file_type,
00137 const GUTF8String &name, const GUTF8String &id,
00138 const GUTF8String &title=GUTF8String(), int pos=-1 );
00148 void insert_file(
00149 const GP<DataPool> &pool, DjVmDir::File::FILE_TYPE file_type,
00150 const GUTF8String &name, const GUTF8String &id,
00151 const GUTF8String &title=GUTF8String(), int pos=-1 );
00152
00157 void insert_file(const GP<DjVmDir::File> & f,
00158 GP<DataPool> data, int pos=-1);
00159
00164 void delete_file(const GUTF8String &id);
00165
00167 void set_djvm_nav(GP<DjVmNav> n);
00168
00171 GP<DjVmDir> get_djvm_dir(void);
00172
00176 GP<DataPool> get_data(const GUTF8String &id) const;
00177
00182 void read(ByteStream & str);
00185 void read(const GP<DataPool> & data_pool);
00199 void read(const GURL &url);
00201
00206 void write(const GP<ByteStream> &str);
00209 void write(const GP<ByteStream> &str,
00210 const GMap<GUTF8String,void *>& reserved);
00213 void write_index(const GP<ByteStream> &str);
00225 void expand(const GURL &codebase, const GUTF8String &idx_name);
00226
00229 void save_page(const GURL &codebase, const DjVmDir::File &file) const;
00230
00234 void save_page(const GURL &codebase, const DjVmDir::File &file,
00235 GMap<GUTF8String,GUTF8String> &incl) const;
00236
00239 void save_file(const GURL &codebase, const DjVmDir::File &file) const;
00240
00242 GUTF8String save_file(const GURL &codebase, const DjVmDir::File &file,
00243 GMap<GUTF8String,GUTF8String> &incl,
00244 const GP<DataPool> &pool) const;
00246 private:
00247 void save_file(const GURL &codebase, const DjVmDir::File &file,
00248 GMap<GUTF8String,GUTF8String> *incl) const;
00249 GP<DjVmDir> dir;
00250 GP<DjVmNav> nav;
00251 GPMap<GUTF8String, DataPool > data;
00252 private:
00253 static void write(ByteStream *);
00254 static void write_index(ByteStream *);
00255 };
00256
00257 inline GP<DjVmDir>
00258 DjVmDoc::get_djvm_dir(void)
00259 {
00260 return dir;
00261 }
00262
00263
00265
00266
00267
00268 #ifdef HAVE_NAMESPACES
00269 }
00270 # ifndef NOT_USING_DJVU_NAMESPACE
00271 using namespace DJVU;
00272 # endif
00273 #endif
00274 #endif