cWebshots::cWebshotsCollection Class Reference

#include <cWebshots.h>

List of all members.


Detailed Description

Contains a collection of cWebshotsPicture and some informations about the collection.

Definition at line 189 of file cWebshots.h.

Public Member Functions

 cWebshotsCollection (const cWebshotsCollection &source)
 Copy constructor.
 cWebshotsCollection ()
 Constructor.
cWebshotsCollectionoperator= (const cWebshotsCollection &source)
 Operator = (cWebshotsCollection).
cWebshotsCollectionoperator+= (const cWebshotsCollection &source)
 Operator += (cWebshotsCollection).
cWebshotsCollectionoperator= (const cWebshotsPicture &source)
 Operator = (cWebshotsPicture).
cWebshotsCollectionoperator+= (const cWebshotsPicture &source)
 Operator += (cWebshotsPicture).
cWebshotsPictureoperator[] (const int Index)
 Operator [] Allow to access a picture contained in the collection with myCollection[Index] instead of myCollection.Picture(Index).
const cWebshotsPictureoperator[] (const int Index) const
 Operator [].
void LoadFromFile (const string File)
 Clear the collection and load it from a file.
void LoadFromFolder (const string Path)
 Loads a collection from a folder which contains photos.txt, album.txt, and WB1 files.
void SaveToFile (const string File, Webshots_Formats Format) const
 Saves the collection into a file.
void SaveToFolder (const string Path) const
 Saves the collection into a folder (each picture in a separate WB1 file + photos.txt + album.txt).
cWebshotsPicturePicture (int Index)
 Returns a reference to the picture number Index in the collection.
const cWebshotsPicturePicture (int Index) const
 Returns a reference to the picture number Index in the collection.
cWebshotsPictureAddPicture ()
 Adds a blank picture to the collection.
cWebshotsPictureAddPicture (const cWebshotsPicture &Picture)
 Adds a picture to the collection.
void RemovePicture (const int Index)
 Removes the picture number Index from the collection.
void Clear ()
 Removes all the pictures in the collection and clear the properties.
int PictureCount () const
 Returns the number of pictures in the collection.

Public Attributes

string Title
 Title of the collection.
string Description
 Description of the collection.
string Topic
 Topic of the collection.
string ID
 ID of the collection.
bool In_Use
 Define if the collection is in use or not.
long CreateDate
 Timestamp of the creation of the collection.
long EditDate
 Timestamp of the last modification of the collection.

Private Member Functions

void LoadWBCFile (ifstream &in_file)
 Loads a WBC file.
void LoadWBZFile (ifstream &in_file)
 Loads a WBZ file.
void SaveWBCFile (ofstream &out_file) const
 Saves the collection into a WBC file.
void SaveWBZFile (ofstream &out_file) const
 Saves the collection into a WBZ file.

Private Attributes

vector< cWebshotsPicture * > Pictures
 Array that contains pointers to the pictures.

Friends

cWebshotsCollection operator+ (const cWebshotsCollection &col1, const cWebshotsCollection &col2)
 Operator +, to merge two collections together.
cWebshotsCollection operator+ (const cWebshotsPicture &pic, const cWebshotsCollection &col)
 Operator +, to merge a picture (left) and a collection (right).
cWebshotsCollection operator+ (const cWebshotsCollection &col, const cWebshotsPicture &pic)
 Operator +, to merge a collection (left) and a picture (right).
cWebshotsCollection operator+ (const cWebshotsPicture &pic1, const cWebshotsPicture &pic2)
 Operator +, to merge two pictures together.


Constructor & Destructor Documentation

cWebshots::cWebshotsCollection::cWebshotsCollection const cWebshotsCollection source  ) 
 

Copy constructor.

Parameters:
[in] source Source cWebshotsCollection

Definition at line 56 of file cWebshotsCollection.cpp.

cWebshots::cWebshotsCollection::cWebshotsCollection  ) 
 

Constructor.

Definition at line 44 of file cWebshotsCollection.cpp.

References CreateDate, EditDate, and In_Use.


Member Function Documentation

cWebshotsPicture & cWebshots::cWebshotsCollection::AddPicture const cWebshotsPicture Picture  ) 
 

Adds a picture to the collection.

Parameters:
[in] Picture Reference to the picture to add to the collection
Returns:
A reference to the picture in the collection

Definition at line 713 of file cWebshotsCollection.cpp.

References AddPicture().

cWebshotsPicture & cWebshots::cWebshotsCollection::AddPicture  ) 
 

Adds a blank picture to the collection.

Returns:
A reference to the picture in the collection

Definition at line 698 of file cWebshotsCollection.cpp.

References Pictures.

Referenced by AddPicture(), LoadFromFile(), LoadFromFolder(), LoadWBZFile(), operator+=(), and operator=().

void cWebshots::cWebshotsCollection::Clear  ) 
 

Removes all the pictures in the collection and clear the properties.

Definition at line 731 of file cWebshotsCollection.cpp.

References CreateDate, Description, EditDate, ID, In_Use, Pictures, Title, and Topic.

Referenced by LoadFromFile(), LoadFromFolder(), main(), and operator=().

void cWebshots::cWebshotsCollection::LoadFromFile const string  File  ) 
 

Clear the collection and load it from a file.

Parameters:
[in] File Complete path to the file to load
Exceptions:
Exceptions::FileSystemError Thrown if the file cannot be opened for reading
Exceptions::UnknownFormat Thrown if the format of the file is unknown

Definition at line 73 of file cWebshotsCollection.cpp.

References AddPicture(), Clear(), cWebshots::IdentifyFile(), cWebshots::JPG, cWebshots::cWebshotsPicture::LoadFromFile(), LoadWBCFile(), LoadWBZFile(), cWebshots::Unknown, cWebshots::WB1, cWebshots::WBC, and cWebshots::WBZ.

Referenced by main().

void cWebshots::cWebshotsCollection::LoadFromFolder const string  Path  ) 
 

Loads a collection from a folder which contains photos.txt, album.txt, and WB1 files.

Parameters:
[in] Path Path to the collection to load
Todo:
Handle thumbnails

Definition at line 298 of file cWebshotsCollection.cpp.

References AddPicture(), cWebshots::cWebshotsPicture::Album, cWebshots::cWebshotsTXT::Album, cWebshots::cWebshotsPicture::AlbumID, cWebshots::sPhotosTXT::caption, cWebshots::cWebshotsPicture::Caption, cWebshots::cWebshotsPicture::Category, cWebshots::cWebshotsPicture::Clear(), Clear(), cWebshots::sAlbumTXT::create_date, CreateDate, cWebshots::sPhotosTXT::credit, cWebshots::cWebshotsPicture::Credits, cWebshots::sAlbumTXT::description, Description, cWebshots::sAlbumTXT::edit_date, EditDate, cWebshots::sPhotosTXT::id, cWebshots::cWebshotsPicture::ID, cWebshots::sAlbumTXT::id, ID, cWebshots::sAlbumTXT::in_use, In_Use, cWebshots::cWebshotsTXT::Load(), cWebshots::cWebshotsPicture::LoadFromFile(), cWebshots::cWebshotsPicture::Original_Filename, cWebshots::cWebshotsTXT::Picture(), cWebshots::cWebshotsTXT::PictureCount(), cWebshots::sPhotosTXT::source, cWebshots::cWebshotsPicture::Source, cWebshots::sPhotosTXT::title, cWebshots::cWebshotsPicture::Title, cWebshots::sAlbumTXT::title, Title, Topic, cWebshots::sAlbumTXT::topic_name, and cWebshots::sPhotosTXT::url_photo.

Referenced by main().

void cWebshots::cWebshotsCollection::LoadWBCFile ifstream &  in_file  )  [private]
 

Loads a WBC file.

Parameters:
[in] in_file Reference to the stream of the file to load
Exceptions:
Exceptions::UnknownFormat Thrown if the file has an unknown format

Definition at line 122 of file cWebshotsCollection.cpp.

References cWebshots::cWebshotsPicture::AdditionDate, cWebshots::cWebshotsPicture::Album, cWebshots::cWebshotsPicture::Caption, cWebshots::cWebshotsPicture::Category, cWebshots::cWebshotsPicture::Credits, cWebshots::cWebshotsPicture::DailyDate, cWebshots::cWebshotsPicture::ID, cWebshots::cWebshotsPicture::LoadFromMemory(), cWebshots::cWebshotsPicture::Original_Filename, Pictures, cWebshots::cWebshotsPicture::Source, cWebshots::cWebshotsPicture::Title, Title, and cWebshots::WBC_File_Marker.

Referenced by LoadFromFile().

void cWebshots::cWebshotsCollection::LoadWBZFile ifstream &  in_file  )  [private]
 

Loads a WBZ file.

Parameters:
[in] in_file Reference to the stream of the file to load
Exceptions:
Exceptions::UnknownFormat Thrown if the file has an unknown format

Definition at line 206 of file cWebshotsCollection.cpp.

References AddPicture(), Description, cWebshots::GetINI(), cWebshots::IntToStr(), cWebshots::cWebshotsPicture::LoadFromMemory(), PictureCount(), Pictures, cWebshots::StrToLong(), cWebshots::WBZ_Element_Marker, and cWebshots::WBZ_File_Marker.

Referenced by LoadFromFile().

cWebshotsCollection & cWebshots::cWebshotsCollection::operator+= const cWebshotsPicture source  ) 
 

Operator += (cWebshotsPicture).

Adds the picture source to the collection.

Definition at line 816 of file cWebshotsCollection.cpp.

References AddPicture().

cWebshotsCollection & cWebshots::cWebshotsCollection::operator+= const cWebshotsCollection source  ) 
 

Operator += (cWebshotsCollection).

Adds the pictures contained in source to the collection.

Definition at line 790 of file cWebshotsCollection.cpp.

References AddPicture(), Picture(), and PictureCount().

cWebshotsCollection & cWebshots::cWebshotsCollection::operator= const cWebshotsPicture source  ) 
 

Operator = (cWebshotsPicture).

Clears the collection and adds the picture source to it.

Definition at line 804 of file cWebshotsCollection.cpp.

References AddPicture(), and Clear().

cWebshotsCollection & cWebshots::cWebshotsCollection::operator= const cWebshotsCollection source  ) 
 

Operator = (cWebshotsCollection).

Clears the collection and adds the pictures contained in source to it.

Definition at line 760 of file cWebshotsCollection.cpp.

References AddPicture(), Clear(), CreateDate, Description, EditDate, ID, In_Use, Picture(), PictureCount(), Title, and Topic.

const cWebshotsPicture & cWebshots::cWebshotsCollection::operator[] const int  Index  )  const
 

Operator [].

Used if the collection is constant. Allow to access a picture contained in the collection with myCollection[Index] instead of myCollection.Picture(Index)

Returns:
A reference to the constant picture number Index
Exceptions:
Exceptions::OutOfRange Thrown if Index is greater than the number of pictures in the collection or lower than 0

Definition at line 850 of file cWebshotsCollection.cpp.

References Pictures.

cWebshotsPicture & cWebshots::cWebshotsCollection::operator[] const int  Index  ) 
 

Operator [] Allow to access a picture contained in the collection with myCollection[Index] instead of myCollection.Picture(Index).

Returns:
A reference to the picture number Index
Exceptions:
Exceptions::OutOfRange Thrown if Index is greater than the number of pictures in the collection or lower than 0

Definition at line 831 of file cWebshotsCollection.cpp.

References Pictures.

const cWebshotsPicture & cWebshots::cWebshotsCollection::Picture int  Index  )  const
 

Returns a reference to the picture number Index in the collection.

Used if the collection is constant.

Returns:
A reference to the constant picture number Index in the collection.
Exceptions:
Exceptions::OutOfRange Thrown if Index is greater than the number of pictures in the collection or lower than 0

Definition at line 661 of file cWebshotsCollection.cpp.

References Pictures.

cWebshotsPicture & cWebshots::cWebshotsCollection::Picture int  Index  ) 
 

Returns a reference to the picture number Index in the collection.

Returns:
A reference to the picture number Index in the collection.
Exceptions:
Exceptions::OutOfRange Thrown if Index is greater than the number of pictures in the collection or lower than 0

Definition at line 643 of file cWebshotsCollection.cpp.

References Pictures.

Referenced by operator+=(), operator=(), and SaveWBZFile().

int cWebshots::cWebshotsCollection::PictureCount  )  const
 

Returns the number of pictures in the collection.

Returns:
The number of pictures in the collection

Definition at line 723 of file cWebshotsCollection.cpp.

References Pictures.

Referenced by LoadWBZFile(), main(), operator+=(), operator=(), SaveToFolder(), SaveWBCFile(), and SaveWBZFile().

void cWebshots::cWebshotsCollection::RemovePicture const int  Index  ) 
 

Removes the picture number Index from the collection.

Parameters:
[in] Index Number of the picture to remove.
Exceptions:
Exceptions::OutOfRange Thrown if Index is greater than the number of pictures in the collection or lower than 0

Definition at line 679 of file cWebshotsCollection.cpp.

References Pictures.

void cWebshots::cWebshotsCollection::SaveToFile const string  File,
Webshots_Formats  Format
const
 

Saves the collection into a file.

Parameters:
[in] File Complete path to the file
[in] Format Format in which to save the file (WBC / WBZ)
Exceptions:
Exceptions::FileSystemError Thrown if the file cannot be opened for writing

Definition at line 359 of file cWebshotsCollection.cpp.

References SaveWBCFile(), SaveWBZFile(), cWebshots::WBC, and cWebshots::WBZ.

Referenced by main().

void cWebshots::cWebshotsCollection::SaveToFolder const string  Path  )  const
 

Saves the collection into a folder (each picture in a separate WB1 file + photos.txt + album.txt).

Parameters:
[in] Path Complete path to the folder
Exceptions:
Exceptions::FileSystemError Thrown if a file cannot be opened for writing
Todo:
Handle thumbnails

Definition at line 567 of file cWebshotsCollection.cpp.

References CreateDate, Description, EditDate, ID, In_Use, PictureCount(), Title, and Topic.

Referenced by main().

void cWebshots::cWebshotsCollection::SaveWBCFile ofstream &  out_file  )  const [private]
 

Saves the collection into a WBC file.

Parameters:
[in] out_file Stream of the file to write to

Definition at line 387 of file cWebshotsCollection.cpp.

References cWebshots::sWBC_Index::Addition_TimeStamp, cWebshots::sWBC_Unit_Header::Addition_Timestamp, cWebshots::sWBC_Unit_Header::Album, cWebshots::sWBC_Unit_Header::BMP_Thumbnail_Size, cWebshots::sWBC_Unit_Header::Category, cWebshots::sWBC_Unit_Header::Credits, cWebshots::sWBC_Unit_Header::Daily_Date, cWebshots::sWBC_Unit_Header::Description, cWebshots::sWBC_Unit_Header::Extension, cWebshots::sWBC_Header::File_Marker, cWebshots::sWBC_Header::File_Title, cWebshots::sWBC_Unit_Header::Fit_To_Screen, cWebshots::sWBC_Unit_Header::Header_Size, cWebshots::sWBC_Header::Header_Size, ID, cWebshots::sWBC_Unit_Header::ID, cWebshots::sWBC_Unit_Header::JPG_File_Size, cWebshots::sWBC_Unit_Header::Original_Filename, PictureCount(), Pictures, cWebshots::sWBC_Unit_Header::Title, Title, cWebshots::sWBC_Unit_Header::Unit_Marker, cWebshots::sWBC_Index::Unit_Position, cWebshots::sWBC_Index::Unit_Size, cWebshots::sWBC_Unit_Header::Unit_Size, cWebshots::sWBC_Index::unknown, cWebshots::sWBC_Unit_Header::Unknown, cWebshots::sWBC_Header::unknown, cWebshots::sWBC_Index::unknown2, cWebshots::sWBC_Unit_Header::Unknown2, cWebshots::WBC_File_Marker, and cWebshots::WBC_Unit_Marker.

Referenced by SaveToFile().

void cWebshots::cWebshotsCollection::SaveWBZFile ofstream &  out_file  )  const [private]
 

Saves the collection into a WBZ file.

Parameters:
[in] out_file Stream of the file to write to

Definition at line 473 of file cWebshotsCollection.cpp.

References cWebshots::cWebshotsPicture::Album, cWebshots::cWebshotsPicture::AlbumID, cWebshots::cWebshotsPicture::Category, cWebshots::cWebshotsPicture::Credits, cWebshots::cWebshotsPicture::DailyDate, cWebshots::sWBZ_Header::Element_Count, cWebshots::sWBZ_Element_Header::Element_Marker, cWebshots::sWBZ_Header::File_Marker, cWebshots::sWBZ_Element_Header::File_Name, cWebshots::sWBZ_Element_Header::File_Size, cWebshots::sWBZ_Element_Header::File_Size2, cWebshots::sWBZ_Element_Header::Header_Size, cWebshots::sWBZ_Header::Header_Size, cWebshots::sWBZ_Element_Header::Header_Version, cWebshots::sWBZ_Header::Header_Version, cWebshots::cWebshotsPicture::ID, cWebshots::cWebshotsPicture::Original_Filename, Picture(), PictureCount(), cWebshots::cWebshotsPicture::PictureSize(), cWebshots::cWebshotsPicture::Source, cWebshots::cWebshotsPicture::Title, cWebshots::sWBZ_Header::unknown1, cWebshots::sWBZ_Element_Header::unknown2, cWebshots::sWBZ_Header::unknown3, cWebshots::sWBZ_Element_Header::unknown4, cWebshots::sWBZ_Header::unknown4, cWebshots::WBZ_Element_Marker, and cWebshots::WBZ_File_Marker.

Referenced by SaveToFile().


Friends And Related Function Documentation

cWebshotsCollection operator+ const cWebshotsPicture pic1,
const cWebshotsPicture pic2
[friend]
 

Operator +, to merge two pictures together.

Returns:
A collection which contains the two pictures

Definition at line 913 of file cWebshotsCollection.cpp.

cWebshotsCollection operator+ const cWebshotsCollection col,
const cWebshotsPicture pic
[friend]
 

Operator +, to merge a collection (left) and a picture (right).

Returns:
A collection which contains the pictures and the properties of the source collection plus the picture from the source picture.

Definition at line 898 of file cWebshotsCollection.cpp.

cWebshotsCollection operator+ const cWebshotsPicture pic,
const cWebshotsCollection col
[friend]
 

Operator +, to merge a picture (left) and a collection (right).

Returns:
A collection which contains the picture from the source picture plus the pictures and the properties of the source collection.

Definition at line 883 of file cWebshotsCollection.cpp.

cWebshotsCollection operator+ const cWebshotsCollection col1,
const cWebshotsCollection col2
[friend]
 

Operator +, to merge two collections together.

Returns:
A collection which contains the pictures of both source collections and the properties of the first source collection.

For example : A + B returns a collections withs pictures from A and B, and properties from A.

Definition at line 868 of file cWebshotsCollection.cpp.


Member Data Documentation

long cWebshots::cWebshotsCollection::CreateDate
 

Timestamp of the creation of the collection.

Definition at line 222 of file cWebshots.h.

Referenced by Clear(), cWebshotsCollection(), LoadFromFolder(), operator=(), and SaveToFolder().

string cWebshots::cWebshotsCollection::Description
 

Description of the collection.

Definition at line 218 of file cWebshots.h.

Referenced by Clear(), LoadFromFolder(), LoadWBZFile(), operator=(), and SaveToFolder().

long cWebshots::cWebshotsCollection::EditDate
 

Timestamp of the last modification of the collection.

Definition at line 223 of file cWebshots.h.

Referenced by Clear(), cWebshotsCollection(), LoadFromFolder(), operator=(), and SaveToFolder().

string cWebshots::cWebshotsCollection::ID
 

ID of the collection.

Definition at line 220 of file cWebshots.h.

Referenced by Clear(), LoadFromFolder(), operator=(), SaveToFolder(), and SaveWBCFile().

bool cWebshots::cWebshotsCollection::In_Use
 

Define if the collection is in use or not.

Definition at line 221 of file cWebshots.h.

Referenced by Clear(), cWebshotsCollection(), LoadFromFolder(), operator=(), and SaveToFolder().

vector<cWebshotsPicture*> cWebshots::cWebshotsCollection::Pictures [private]
 

Array that contains pointers to the pictures.

Definition at line 192 of file cWebshots.h.

Referenced by AddPicture(), Clear(), LoadWBCFile(), LoadWBZFile(), operator[](), Picture(), PictureCount(), RemovePicture(), and SaveWBCFile().

string cWebshots::cWebshotsCollection::Title
 

Title of the collection.

Definition at line 217 of file cWebshots.h.

Referenced by Clear(), LoadFromFolder(), LoadWBCFile(), main(), operator=(), SaveToFolder(), and SaveWBCFile().

string cWebshots::cWebshotsCollection::Topic
 

Topic of the collection.

Definition at line 219 of file cWebshots.h.

Referenced by Clear(), LoadFromFolder(), main(), operator=(), and SaveToFolder().


The documentation for this class was generated from the following files:
Generated on Tue Oct 25 14:36:31 2005 for cWebshots by  doxygen 1.4.5