CMS 3D CMS Logo

lat::ZipUtils Struct Reference

Useful tools in various places, but scoped into our classes. More...

#include <Iguana/Utilities/classlib/zip/ZipUtils.h>

Inheritance diagram for lat::ZipUtils:

lat::BZConstants lat::CPIOConstants lat::TarConstants lat::ZConstants lat::BZCompressor lat::BZDecompressor lat::BZIPInputStream lat::BZIPOutputStream lat::CPIOInputStream lat::CPIOMember lat::CPIOOutputStream lat::TarInputStream lat::TarMember lat::TarOutputStream lat::GZIPInputStream lat::ZCompressor lat::ZDecompressor lat::ZipArchive lat::ZipInputStream lat::ZipMember lat::ZOutputStream

List of all members.

Public Types

enum  { OPEN_READ = 1 }
enum  { OPEN_WRITE = 2 }

Static Protected Member Functions

static bool extract (IOInput *input, void *buffer, IOSize size, IOSize n)
static unsigned get (const void *buffer, IOSize bytes)
 Read a bytes-long little-endian integer value from buffer.
static unsigned getHex (const void *buffer, IOSize bytes)
static unsigned getOctal (const void *buffer, IOSize bytes)
 Read a bytes-long ASCII-octal integer value from buffer.
static void put (void *buffer, IOSize bytes, unsigned value)
 Write value into buffer as bytes-long integer in little-endian byte order.
static void putHex (void *buffer, IOSize bytes, unsigned value)
static void putOctal (void *buffer, IOSize bytes, unsigned value, bool null=true)
 Write value into buffer as bytes-long integer in ASCII octal.


Detailed Description

Useful tools in various places, but scoped into our classes.

Definition at line 21 of file ZipUtils.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
OPEN_READ 

Definition at line 24 of file ZipUtils.h.

00024 { OPEN_READ                     = 1 };

anonymous enum

Enumerator:
OPEN_WRITE 

Definition at line 25 of file ZipUtils.h.

00025 { OPEN_WRITE                    = 2 };


Member Function Documentation

static bool lat::ZipUtils::extract ( IOInput input,
void buffer,
IOSize  size,
IOSize  n 
) [static, protected]

unsigned lat::ZipUtils::get ( const void buffer,
IOSize  bytes 
) [inline, static, protected]

Read a bytes-long little-endian integer value from buffer.

Definition at line 50 of file ZipUtils.h.

References value.

00051 {
00052     const unsigned char *buf = static_cast<const unsigned char *> (buffer);
00053     unsigned value = 0;
00054     for (unsigned shift = 0; bytes; shift += 8, --bytes, ++buf)
00055         value += *buf << shift;
00056 
00057     return value;
00058 }

static unsigned lat::ZipUtils::getHex ( const void buffer,
IOSize  bytes 
) [static, protected]

unsigned lat::ZipUtils::getOctal ( const void buffer,
IOSize  bytes 
) [inline, static, protected]

Read a bytes-long ASCII-octal integer value from buffer.

Definition at line 62 of file ZipUtils.h.

References value.

00063 {
00064     const unsigned char *buf = static_cast<const unsigned char *> (buffer);
00065     unsigned value = 0;
00066     for ( ; bytes && *buf >= '0' && *buf <= '7'; --bytes, ++buf)
00067         value = (value << 3) + (*buf - '0');
00068 
00069     return value;
00070 }

void lat::ZipUtils::put ( void buffer,
IOSize  bytes,
unsigned  value 
) [inline, static, protected]

Write value into buffer as bytes-long integer in little-endian byte order.

Definition at line 75 of file ZipUtils.h.

00076 {
00077     unsigned char *buf = static_cast<unsigned char *> (buffer);
00078     for ( ; bytes; value >>= 8, --bytes, ++buf)
00079         *buf = value & 0xff;
00080 }

static void lat::ZipUtils::putHex ( void buffer,
IOSize  bytes,
unsigned  value 
) [static, protected]

void lat::ZipUtils::putOctal ( void buffer,
IOSize  bytes,
unsigned  value,
bool  null = true 
) [inline, static, protected]

Write value into buffer as bytes-long integer in ASCII octal.

Definition at line 85 of file ZipUtils.h.

00087 {
00088     unsigned char *buf = static_cast<unsigned char *> (buffer);
00089     if (null)
00090         buf [--bytes] = '\0';
00091 
00092     for (; bytes; value >>= 3)
00093         buf [--bytes] = (value & 7) + '0';
00094 }


The documentation for this struct was generated from the following file:
Generated on Tue Jun 9 18:48:45 2009 for CMSSW by  doxygen 1.5.4