Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

BitString.h

Go to the documentation of this file.
00001 /* 00002 * steghide 0.5.1 - a steganography program 00003 * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at> 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #ifndef SH_BITSTRING_H 00022 #define SH_BITSTRING_H 00023 00024 #include <vector> 00025 #include <string> 00026 00027 #include "AUtils.h" 00028 #include "common.h" 00029 00042 class BitString { 00043 public: 00047 BitString (EmbValue arity = 2) ; 00048 00052 BitString (const BitString& bs) ; 00053 00057 BitString (const unsigned long l) ; 00058 00062 BitString (const std::vector<BYTE>& d) ; 00063 00067 BitString (const std::string& d) ; 00068 00069 void setArity (EmbValue arity) ; 00070 00071 EmbValue getArity (void) const 00072 { return Arity ; } ; 00073 00077 UWORD32 getLength (void) const 00078 { return Length ; } ; 00079 00083 UWORD32 getNAryLength (void) const 00084 { return AUtils::div_roundup<UWORD32> (Length, ArityNBits) ; } ; 00085 00089 BitString& clear (void) ; 00090 00094 BitString& append (const BIT v) ; 00095 00101 BitString& append (const BYTE v, const unsigned short n = 8) ; 00102 00108 BitString& append (const UWORD16 v, const unsigned short n = 16) ; 00109 00115 BitString& append (const UWORD32 v, const unsigned short n = 32) ; 00116 00120 BitString& append (const std::string& v) ; 00121 00125 BitString& append (const std::vector<BYTE>& v) ; 00126 00131 BitString& append (const BitString& v) ; 00132 00138 BitString& setBit (unsigned long i, BIT v) ; 00139 00146 BitString getBits (const unsigned long s, const unsigned long l) const ; 00147 00156 BitString cutBits (const unsigned long s, const unsigned long l) ; 00157 00164 UWORD32 getValue (const unsigned long s, const unsigned short l) const ; 00165 00172 const std::vector<BYTE>& getBytes (void) const ; 00173 00180 BitString& truncate (const unsigned long s, const unsigned long e) ; 00181 00187 BitString& pad (const unsigned long mult, const BIT v) ; 00188 00193 BitString& padRandom (const unsigned long mult) ; 00194 00200 BYTE getNAry (unsigned long p) const ; 00201 00206 void appendNAry (BYTE v) ; 00207 00208 #ifdef USE_ZLIB 00216 BitString& compress (int level) ; 00217 00231 BitString& uncompress (unsigned long idestlen) ; 00232 #endif // def USE_ZLIB 00233 00237 BIT operator[] (const unsigned long i) const ; 00238 00243 BitString& operator^= (const BitString &v) ; 00244 00249 bool operator== (const BitString& v) const ; 00250 00255 bool operator!= (const BitString& v) const ; 00256 00257 void print (unsigned short spc = 0) const ; 00258 #ifdef DEBUG 00259 void printDebug (unsigned short level, unsigned short spc = 0) const ; 00260 #endif 00261 00262 private: 00264 UWORD32 Length ; 00266 EmbValue Arity ; 00268 unsigned short ArityNBits ; 00270 std::vector<BYTE> Data ; 00271 00272 void _append (BIT v) ; 00273 00277 void clearUnused (void) ; 00278 } ; 00279 00280 #endif // ndef SH_BITSTRING_H

Generated on Fri Jul 16 19:41:20 2004 for steghide by doxygen 1.3.7