Classes | Public Member Functions

CdcFileAttrib Class Reference

This class holds the file attributes of a given file. More...

#include <DcFileAttrib.h>

List of all members.

Classes

class  CdcFileAttribInnerData

Public Member Functions

 CdcFileAttrib (const CdcString &u, const CdcString &host, bool inc)
 CdcFileAttrib ()
 Empty constructor.
 CdcFileAttrib (const CdcFileAttrib &fa)
 Copy constructor - Shallow copy one FileAttrib into the other.
virtual ~CdcFileAttrib ()
 Destructor - Free the dynamic allocated memory.
const CdcFileAttriboperator= (const CdcFileAttrib &fa)
 Assignment operator - Shallow copy one FileAttrib into the other.
bool IsFileFound () const
 This function returns True if it can find the file under the root directory of the server, otherwise it returns False.
bool IsRedirect () const
 This function returns True if the URL needs to be redirected, otherwise it returns False.
bool IsExecScript () const
 Returns True if need to execute script on this file.
bool IsNotToCache () const
 Returns True if file cannot be cached in file cacher.
CdcString GetURL () const
 Returns the file URL.
CdcString GetFullName () const
 Returns the file full path and name.
CdcString GetFileExtention () const
 Returns the file extension as it is in the URL, in lower case letters.
CdcString GetClientFileType () const
 Returns the description of the type of the file, to send to client.
CdcString GetScriptEngine () const
 Returns the file script engine associate with this file type, or empty string if none.
CdcHttpTime GetLastModified () const throw (CdcException)
 This function returns the time this file was last modified (GMT).
int GetFileSize () const throw (CdcException)
 Return the size of the file, without opening it.

Detailed Description

This class holds the file attributes of a given file.

The class DOES NOT open the file. It gets the OS file attribute from CdcFileUtil. and Beesnest file extension settings from CdcParameters.

The class gets a URL and a host name in the constructor. After constructing the object, it is a read only object.

This class uses reference counting. It gets created only once, for a given thread and URL. But then it gets passed to many objects (mostly CdcBuffresList). Unlike other reference counting classes, here the object is read only, so there is no Copy On Write. The last object that detach from this class, deletes it.

Author:
Erez Bibi
Version:
1.1

Definition at line 49 of file DcFileAttrib.h.


Constructor & Destructor Documentation

CdcFileAttrib::CdcFileAttrib ( const CdcString u,
const CdcString host,
bool  inc 
)

Definition at line 66 of file DcFileAttrib.cpp.

CdcFileAttrib::CdcFileAttrib (  ) [inline]

Empty constructor.

Definition at line 99 of file DcFileAttrib.h.

CdcFileAttrib::CdcFileAttrib ( const CdcFileAttrib fa ) [inline]

Copy constructor - Shallow copy one FileAttrib into the other.

Parameters:
faThe FileAttrib to copy.

Definition at line 107 of file DcFileAttrib.h.

virtual CdcFileAttrib::~CdcFileAttrib (  ) [inline, virtual]

Destructor - Free the dynamic allocated memory.

Definition at line 112 of file DcFileAttrib.h.


Member Function Documentation

CdcString CdcFileAttrib::GetClientFileType (  ) const [inline]

Returns the description of the type of the file, to send to client.

Returns:
(CdcString).

Definition at line 194 of file DcFileAttrib.h.

CdcString CdcFileAttrib::GetFileExtention (  ) const [inline]

Returns the file extension as it is in the URL, in lower case letters.

Returns:
(CdcString).

Definition at line 185 of file DcFileAttrib.h.

int CdcFileAttrib::GetFileSize (  ) const throw (CdcException) [inline]

Return the size of the file, without opening it.

Returns:
(int) the size of the file in bytes.
Exceptions:
(CdcException)FILE NOT FOUND if it cannot find the file under the root directory of the server

Definition at line 226 of file DcFileAttrib.h.

CdcString CdcFileAttrib::GetFullName (  ) const [inline]

Returns the file full path and name.

Definition at line 175 of file DcFileAttrib.h.

CdcHttpTime CdcFileAttrib::GetLastModified (  ) const throw (CdcException) [inline]

This function returns the time this file was last modified (GMT).

Returns:
(CdcHttpTime) The last time this file was modified.
Exceptions:
(CdcException)FILE NOT FOUND if it cannot find the file under the root directory of the server

Definition at line 215 of file DcFileAttrib.h.

CdcString CdcFileAttrib::GetScriptEngine (  ) const [inline]

Returns the file script engine associate with this file type, or empty string if none.

Definition at line 203 of file DcFileAttrib.h.

CdcString CdcFileAttrib::GetURL (  ) const [inline]

Returns the file URL.

Definition at line 168 of file DcFileAttrib.h.

bool CdcFileAttrib::IsExecScript (  ) const [inline]

Returns True if need to execute script on this file.

Definition at line 150 of file DcFileAttrib.h.

bool CdcFileAttrib::IsFileFound (  ) const [inline]

This function returns True if it can find the file under the root directory of the server, otherwise it returns False.

Returns:
(See description).

Definition at line 130 of file DcFileAttrib.h.

bool CdcFileAttrib::IsNotToCache (  ) const [inline]

Returns True if file cannot be cached in file cacher.

Definition at line 159 of file DcFileAttrib.h.

bool CdcFileAttrib::IsRedirect (  ) const [inline]

This function returns True if the URL needs to be redirected, otherwise it returns False.

For now it only redirects if the URL is of a folder and doesn't ends with '/'. Note that if Redirect is True, FileFound will be False.

Returns:
(See description).

Definition at line 143 of file DcFileAttrib.h.

const CdcFileAttrib & CdcFileAttrib::operator= ( const CdcFileAttrib fa )

Assignment operator - Shallow copy one FileAttrib into the other.

Parameters:
faThe FileAttrib to copy.
Returns:
(CdcFileAttrib&) A reference to the FileAttrib (this).

Definition at line 54 of file DcFileAttrib.cpp.


The documentation for this class was generated from the following files: