From 9e8a4944e50fab432012878c66e1bdac20649f76 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 7 Jun 2007 19:56:20 +0000 Subject: The Stream Filter archetecture is finished, it's actually much cooler than I had anticipated, and much cleaner. I'll have to add some documentation to it, because it's not really obvious how any of it fits together from the outset, although I have to say that the bzip2 test program is the easiest general bzip2 compression program I've ever made...it just goes :) Decompression in Bu::BZip2 isn't finished yet, but that's ok, it's coming soon. --- src/old/paramproc.h | 153 ---------------------------------------------------- 1 file changed, 153 deletions(-) delete mode 100644 src/old/paramproc.h (limited to 'src/old/paramproc.h') diff --git a/src/old/paramproc.h b/src/old/paramproc.h deleted file mode 100644 index d857193..0000000 --- a/src/old/paramproc.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef PARAM_PROC_H -#define PARAM_PROC_H - -#include -#include -#include -#include "staticstring.h" - -class ParamProc -{ -public: - class ParamPtr - { - public: - ParamPtr(); - ParamPtr( std::string *str ); - ParamPtr( uint64_t *uint64 ); - ParamPtr( uint32_t *uint32 ); - ParamPtr( uint16_t *uint16 ); - ParamPtr( uint8_t *uint8 ); - ParamPtr( int64_t *int64 ); - ParamPtr( int32_t *int32 ); - ParamPtr( int16_t *int16 ); - ParamPtr( int8_t *int8 ); - ParamPtr( float *float32 ); - ParamPtr( double *float64 ); - ParamPtr( long double *float96 ); - ParamPtr( bool *bln ); - - enum - { - vtunset, - vtstr, - vtuint64, - vtuint32, - vtuint16, - vtuint8, - vtint64, - vtint32, - vtint16, - vtint8, - vtfloat32, - vtfloat64, - vtfloat96, - vtbln, - }; - ParamPtr &operator=( ParamPtr &ptr ); - ParamPtr &operator=( const char *str ); - - bool isSet(); - - private: - int type; - union - { - std::string *str; - uint64_t *uint64; - uint32_t *uint32; - uint16_t *uint16; - uint8_t *uint8; - int64_t *int64; - int32_t *int32; - int16_t *int16; - int8_t *int8; - float *float32; - double *float64; - long double *float96; - bool *bln; - } val; - }; - - typedef int (ParamProc::*Proc)( int, char *[] ); - - typedef struct ArgSpec - { - uint8_t nFlags; - StaticString sWord; - char cChar; - Proc proc; - ParamProc::ParamPtr val; - StaticString sExtra; - StaticString sDesc; - StaticString sValue; - } ArgSpec; - -public: - ParamProc(); - virtual ~ParamProc(); - - void addParam( const char *lpWord, char cChar, Proc proc, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( const char *lpWord, char cChar, Proc proc, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( const char *lpWord, char cChar, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - - void addParam( const char *lpWord, Proc proc, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( const char *lpWord, Proc proc, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( const char *lpWord, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - - void addParam( char cChar, Proc proc, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( char cChar, Proc proc, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - void addParam( char cChar, ParamPtr val, - const char *lpDesc=NULL, const char *lpExtra=NULL, - const char *lpValue=NULL - ); - - void process( int argc, char *argv[] ); - void addHelpBanner( const char *sHelpBanner ); - -private: - ArgSpec *checkWord( const char *arg ); - ArgSpec *checkLetr( const char arg ); - -public: - virtual int cmdParam( int argc, char *argv[] ); - virtual int unknownParam( int argc, char *argv[] ); - virtual int help( int argc, char *argv[] ); - -private: - typedef struct Banner - { - StaticString sBanner; - ArgSpec *pBefore; - } Banner; - std::list lBan; - std::list lArg; -}; - -#define mkproc( cls ) static_cast(&cls) - -#endif -- cgit v1.2.3