Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

bitparser.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                       bitparser.h  -  Bit stream parser
00003                              -------------------
00004     begin                : Mon Feb 18 2002
00005     copyright            : (C) 2002 by David Holm
00006     email                : david@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, bitparser.h
00020 
00021  The Initial Developer of the Original Code is David Holm
00022  Portions created by David Holm are Copyright (C) 2002
00023  David holm. All Rights Reserved.
00024 
00025  Contributors: Mattias Jansson (mattias@realityrift.com)
00026 
00027  ***************************************************************************/
00028 
00029 
00030 #ifndef __NEBITPARSER_H
00031 #define __NEBITPARSER_H
00032 
00033 
00034 #include "base.h"
00035 
00036 
00043 namespace NeoEngine
00044 {
00045 
00046 
00054 class NEOENGINE_API BitParser
00055 {
00056     protected:
00057     
00059         uint8_t                                      *m_pucBase;
00060 
00062         uint8_t                                      *m_pucBits;
00063         
00065         uint8_t                                       m_ucBitOffset;
00066         
00068         uint64_t                                      m_ulByteOffset;
00069                 
00070         
00071     public:
00072         
00077                                                       BitParser( uint8_t *pucBitstream = 0 ) : m_pucBase( pucBitstream ), m_pucBits( pucBitstream ), m_ucBitOffset(0), m_ulByteOffset(0) {}
00078         
00081         virtual                                      ~BitParser();
00082 
00088         virtual uint32_t                              ReadBits( int32_t iBits );
00089         
00093         virtual void                                  Align();
00094 
00100         virtual void                                  Seek( int32_t iBits, int32_t iMode );
00101         
00106         virtual void                                  SetPointer( uint8_t *pucBitstream );
00107         
00111         uint64_t                                      GetByteOffset() { return m_ulByteOffset; }
00112 
00116         uint64_t                                      GetBitOffset() { return( ( m_ulByteOffset * 8 ) + m_ucBitOffset ); }
00117 };
00118 
00119 
00120 };
00121 
00122 
00123 #endif
00124 

Generated on Wed Jan 21 14:21:06 2004 for NeoEngine by doxygen 1.3.5