common_bundle.h

Go to the documentation of this file.
00001 #ifndef COMMON_BUNDLER_DEFS
00002 #define COMMON_BUNDLER_DEFS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : common bundler definitions                                        *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2007-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00019 
00024 #include <basis/istring.h>
00025 #include <basis/set.h>
00026 #include <basis/object_base.h>
00027 
00028 // forward.
00029 class byte_filer;
00030 
00032 
00034 enum special_bundling_flags {
00035   SOURCE_EXECUTE = 0x2,  
00036   TARGET_EXECUTE = 0x4,  
00037   RECURSIVE_SRC = 0x8,  
00038   OMIT_PACKING = 0x10,  
00039   SET_VARIABLE = 0x20,  
00040   IGNORE_ERRORS = 0x40,  
00041   NO_OVERWRITE = 0x80,  
00042   QUIET_FAILURE = 0x100  
00043 };
00044 
00046 
00048 
00053 struct manifest_chunk
00054 {
00055   int _size;  
00056   istring _target;  
00057   int _flags;  
00058   istring _parms;  
00059   string_set _keywords;  
00060   byte_array _timestamp;  
00061 
00062   // note: when flags has SET_VARIABLE, the _target is the variable name to
00063   // be set and the _parms is the value to use.
00064 
00066   inline manifest_chunk(int size, const istring &target, int flags,
00067       const istring &parms, const string_set &keywords)
00068       : _size(size), _target(target), _flags(flags), _parms(parms),
00069         _keywords(keywords), _timestamp(8) {
00070     for (int i = 0; i < 8; i++) _timestamp[i] = 0;
00071   }
00072 
00073   inline manifest_chunk() : _size(0), _flags(0), _timestamp(8) {
00075     for (int i = 0; i < 8; i++) _timestamp[i] = 0;
00076   }
00077 
00078   virtual ~manifest_chunk();
00079 
00080   IMPLEMENT_CLASS_NAME("manifest_chunk");
00081 
00082   void pack(byte_array &target) const;  
00083   bool unpack(byte_array &source);  
00084 
00085   static bool read_manifest(byte_filer &bundle, manifest_chunk &to_fill);
00087 
00089   static istring read_a_string(byte_filer &bundle);
00091 
00092   static bool read_an_int(byte_filer &bundle, int &found);
00094 
00095   static bool read_an_obscured_int(byte_filer &bundle, int &found);
00097 
00098   static bool read_a_timestamp(byte_filer &bundle, byte_array &found);
00100 };
00101 
00103 
00104 #endif
00105 

Generated on Fri Nov 28 04:28:49 2008 for HOOPLE Libraries by  doxygen 1.5.1