libopenraw
bititerator.h
00001 /* -*- tab-width:4; c-basic-offset:4 -*- */
00002 /*
00003  * libopenraw - bititerator.cpp
00004  *
00005  * Copyright (C) 2008 Rafael Avila de Espindola.
00006  *
00007  * This library is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library.  If not, see
00019  * <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef __BITITERATOR_H_
00023 #define __BITITERATOR_H_
00024 
00025 #include <stdint.h>
00026 #include <cstring>
00027 
00028 namespace OpenRaw {
00029 namespace Internals {
00030 
00031 class BitIterator {
00032     const uint8_t* m_p;
00033     uint32_t m_bitBuffer;
00034     uint8_t m_bitsOnBuffer;
00035     void load(size_t numBits);
00036 
00037  public:
00038     BitIterator(const void *);
00039     uint32_t get(size_t);
00040 };
00041 
00042 }
00043 }
00044 
00045 #endif