I've got the two classes below, and the "BitmapIterator" class is refusing to recognize that the "Bitmap" class exists, and I can't figure out why...
I've declared the Bitmap class prior to creating the handle, HBitmap class, and HBitmap is recognized by other classes I'm using.
I've included the header files.
I can't figure out what's going on with this BitmapIterator class... It throws a whole pile of "Bitmap is not a class or a namespace" and "syntax error: identifier HBitmap" errors.
#pragma once
#include "Color.h"
#include "BitmapIterator.h"
#include <list>
namespace BitmapGraphics
{
class Bitmap;
using HBitmap = std::shared_ptr<Bitmap>;
class Bitmap
{
public:
using ScanLine = std::list<Color>;
private:
using ScanLineCollection = std::list<ScanLine>;
public:
using ScanLineIterator = ScanLineCollection::const_iterator;
using PixelIterator = ScanLine::const_iterator;
Bitmap()=default;
Bitmap(const Bitmap&) = default;
Bitmap(Bitmap&&) noexcept = default;
Bitmap& operator=(const Bitmap&) = default;
Bitmap& operator=(Bitmap&&) = default;
~Bitmap() noexcept = default;
Bitmap(uint32_t width, uint32_t height, std::istream& sourceStream);
ScanLineIterator begin() const noexcept { return myScanLines.begin(); }
ScanLineIterator end() const noexcept { return myScanLines.end(); }
int getWidth() const noexcept { return myWidth; }
int getHeight() const noexcept { return myHeight; }
int getNumberOfPadBytes() const;
void read(std::istream& sourceStream);
void write(std::ostream& destinationStream) const;
HBitmapIterator createIterator(HBitmap hbitmap);
private:
unsigned int myWidth{ 0 };
unsigned int myHeight{ 0 };
ScanLineCollection myScanLines;
};
}
and
#pragma once
#include "IBitmapIterator.h"
#include "Bitmap.h"
#include "binary_ostream_iterator.h"
#include <list>
namespace BitmapGraphics
{
class BitmapIterator : public IBitmapIterator
{
public:
BitmapIterator() = default;
BitmapIterator(const BitmapIterator& other) = delete;
BitmapIterator(BitmapIterator&& other) = delete;
BitmapIterator& operator =(const BitmapIterator& other) = delete;
BitmapIterator& operator =(BitmapIterator&& other) = delete;
~BitmapIterator() = default;
BitmapIterator(HBitmap hbitmap);
void nextScanLine();
bool isEndOfImage() const;
void nextPixel();
bool isEndOfScanLine() const;
//void addBitmap(HBitmap hbitmap);
Color getColor() const;
int getBitmapWidth() const;
int getBitmapHeight() const;
private:
HBitmap myBitmap;
Bitmap::ScanLineIterator myScanLineIterator;
Bitmap::PixelIterator myPixelIterator;
};
}