string references

This commit is contained in:
James Turk 2005-02-07 01:48:25 +00:00
parent 663a408ce2
commit a93ed25bcc
11 changed files with 149 additions and 81 deletions

View File

@ -1,7 +1,7 @@
[Project] [Project]
FileName=photon.dev FileName=photon.dev
Name=photon Name=photon
UnitCount=17 UnitCount=20
Type=2 Type=2
Ver=1 Ver=1
ObjFiles= ObjFiles=
@ -20,7 +20,7 @@ ObjectOutput=..\devcpp
OverrideOutput=1 OverrideOutput=1
OverrideOutputName=libphoton.a OverrideOutputName=libphoton.a
HostApplication= HostApplication=
Folders=external,external/include,external/src,include,include/util,src,src/util Folders=include,include/util,src,src/util
CommandLine= CommandLine=
UseCustomMakefile=0 UseCustomMakefile=0
CustomMakefile= CustomMakefile=
@ -217,3 +217,33 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit18]
FileName=..\include\Application.h
CompileCpp=1
Folder=include
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit19]
FileName=..\src\Application.cpp
CompileCpp=1
Folder=src
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit20]
FileName=..\include\entrypoint.h
CompileCpp=1
Folder=include
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Log.h,v 1.2 2005/02/04 08:11:54 cozman Exp $ // $Id: Log.h,v 1.3 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: Log.h,v $ // $Log: Log.h,v $
// Revision 1.3 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.2 2005/02/04 08:11:54 cozman // Revision 1.2 2005/02/04 08:11:54 cozman
// switched Log to shared_ptrs and added extra flushes // switched Log to shared_ptrs and added extra flushes
// //
@ -30,8 +33,8 @@ namespace photon
{ {
// Class: Log // Class: Log
// Log class for photon, Log passes all messages to any attached sinks, which // Log class for photon, Log passes all messages to any attached <LogSinks>,
// can then take care of any output which is desired. // which can then take care of any output which is desired.
class Log class Log
{ {
@ -55,7 +58,7 @@ public:
// //
// Parameters: // Parameters:
// sinkName - Name of sink to remove. // sinkName - Name of sink to remove.
void removeSink(std::string sinkName); void removeSink(const std::string& sinkName);
// Function: removeSink // Function: removeSink
// Remove a sink from the log. // Remove a sink from the log.

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: LogSink.h,v 1.4 2005/02/05 03:01:03 cozman Exp $ // $Id: LogSink.h,v 1.5 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: LogSink.h,v $ // $Log: LogSink.h,v $
// Revision 1.5 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.4 2005/02/05 03:01:03 cozman // Revision 1.4 2005/02/05 03:01:03 cozman
// removed getStream() (useless) // removed getStream() (useless)
// //
@ -77,7 +80,7 @@ public:
// //
// Parameters: // Parameters:
// name_ - Name of LogSink, every LogSink should have a unique name. // name_ - Name of LogSink, every LogSink should have a unique name.
LogSink(std::string name); LogSink(const std::string& name);
// Function: ~LogSink // Function: ~LogSink
// Virtual destructor, available to make inheritance safe. // Virtual destructor, available to make inheritance safe.
@ -93,7 +96,7 @@ public:
// Parameters: // Parameters:
// level - <LogLevel> of log event. // level - <LogLevel> of log event.
// msg - String describing log message. // msg - String describing log message.
virtual void writeMessage(LogLevel level, std::string msg)=0; virtual void writeMessage(LogLevel level, const std::string& msg)=0;
// Group: Accessors // Group: Accessors
public: public:
@ -129,10 +132,10 @@ typedef shared_ptr<LogSink> LogSinkPtr;
class ConsoleSink : public LogSink class ConsoleSink : public LogSink
{ {
public: public:
ConsoleSink(std::string name); ConsoleSink(const std::string& name);
virtual ~ConsoleSink(); virtual ~ConsoleSink();
virtual void writeMessage(LogLevel level, std::string msg); virtual void writeMessage(LogLevel level, const std::string& msg);
}; };
// Class: TextSink // Class: TextSink
@ -146,10 +149,10 @@ public:
class TextSink : public LogSink class TextSink : public LogSink
{ {
public: public:
TextSink(std::string name); TextSink(const std::string& name);
virtual ~TextSink(); virtual ~TextSink();
virtual void writeMessage(LogLevel level, std::string msg); virtual void writeMessage(LogLevel level, const std::string& msg);
private: private:
std::ofstream out_; std::ofstream out_;
}; };
@ -165,10 +168,10 @@ private:
class HTMLSink : public LogSink class HTMLSink : public LogSink
{ {
public: public:
HTMLSink(std::string name); HTMLSink(const std::string& name);
virtual ~HTMLSink(); virtual ~HTMLSink();
virtual void writeMessage(LogLevel level, std::string msg); virtual void writeMessage(LogLevel level, const std::string& msg);
private: private:
std::ofstream out_; std::ofstream out_;
}; };

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: exceptions.h,v 1.4 2005/02/06 21:28:47 cozman Exp $ // $Id: exceptions.h,v 1.5 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: exceptions.h,v $ // $Log: exceptions.h,v $
// Revision 1.5 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.4 2005/02/06 21:28:47 cozman // Revision 1.4 2005/02/06 21:28:47 cozman
// removed require // removed require
// //
@ -59,8 +62,8 @@ public:
// description - description of why exception was thrown [default: empty] // description - description of why exception was thrown [default: empty]
// file - name of file where exception was thrown [default: empty] // file - name of file where exception was thrown [default: empty]
// line - line in file where exception was thrown [default: 0] // line - line in file where exception was thrown [default: 0]
Throwable(std::string description = std::string(), Throwable(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
virtual ~Throwable() throw()=0; virtual ~Throwable() throw()=0;
@ -97,8 +100,8 @@ private:
class Exception : public Throwable class Exception : public Throwable
{ {
public: public:
Exception(std::string description = std::string(), Exception(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const Exception& rhs); const Exception& rhs);
@ -116,8 +119,8 @@ public:
class ArgumentException : public Exception class ArgumentException : public Exception
{ {
public: public:
ArgumentException(std::string description = std::string(), ArgumentException(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const ArgumentException& rhs); const ArgumentException& rhs);
@ -134,8 +137,8 @@ public:
class PreconditionException : public Exception class PreconditionException : public Exception
{ {
public: public:
PreconditionException(std::string description = std::string(), PreconditionException(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const PreconditionException& rhs); const PreconditionException& rhs);
@ -154,8 +157,8 @@ class RangeException : public Exception
{ {
public: public:
RangeException() throw(); RangeException() throw();
RangeException(std::string description = std::string(), RangeException(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const RangeException& rhs); const RangeException& rhs);
@ -174,8 +177,8 @@ class ResourceException : public Exception
{ {
public: public:
ResourceException() throw(); ResourceException() throw();
ResourceException(std::string description = std::string(), ResourceException(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const ResourceException& rhs); const ResourceException& rhs);
@ -205,8 +208,8 @@ class Error : public Throwable
{ {
public: public:
Error() throw(); Error() throw();
Error(std::string description = std::string(), Error(const std::string&description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const Error& rhs); const Error& rhs);
@ -224,8 +227,8 @@ class MemoryError : public Error
{ {
public: public:
MemoryError() throw(); MemoryError() throw();
MemoryError(std::string description = std::string(), MemoryError(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const MemoryError& rhs); const MemoryError& rhs);
@ -244,8 +247,8 @@ class APIError : public Error
{ {
public: public:
APIError() throw(); APIError() throw();
APIError(std::string description = std::string(), APIError(const std::string& description = std::string(),
std::string file = std::string(), const std::string& file = std::string(),
uint line=0) throw(); uint line=0) throw();
friend std::ostream& operator<<(std::ostream& os, friend std::ostream& operator<<(std::ostream& os,
const APIError& rhs); const APIError& rhs);

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: types.h,v 1.2 2005/02/04 08:12:14 cozman Exp $ // $Id: types.h,v 1.3 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: types.h,v $ // $Log: types.h,v $
// Revision 1.3 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.2 2005/02/04 08:12:14 cozman // Revision 1.2 2005/02/04 08:12:14 cozman
// shared_ptr // shared_ptr
// //
@ -22,6 +25,9 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <string>
#include <vector>
// Title: Basic Types // Title: Basic Types
namespace photon { namespace photon {
@ -40,6 +46,10 @@ namespace photon {
// Scalar value, used throughout photon. (double or float) // Scalar value, used throughout photon. (double or float)
typedef double scalar; typedef double scalar;
// Type: StrVec
// Typedef for vector of strings, which is used all throughout photon.
typedef std::vector<std::string> StrVec;
// Type: shared_ptr // Type: shared_ptr
// Shared pointer type. (uses the boost implementation) // Shared pointer type. (uses the boost implementation)
using boost::shared_ptr; using boost::shared_ptr;

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: FileBuffer.h,v 1.1 2005/02/06 21:30:10 cozman Exp $ // $Id: FileBuffer.h,v 1.2 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: FileBuffer.h,v $ // $Log: FileBuffer.h,v $
// Revision 1.2 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.1 2005/02/06 21:30:10 cozman // Revision 1.1 2005/02/06 21:30:10 cozman
// PhysFS initial integration // PhysFS initial integration
// //
@ -46,7 +49,7 @@ public:
// //
// Parameters: // Parameters:
// filename - Name of file to load. // filename - Name of file to load.
FileBuffer(std::string filename); FileBuffer(const std::string& filename);
// Function: ~FileBuffer // Function: ~FileBuffer
// Destructor, calls <close>. // Destructor, calls <close>.
@ -60,7 +63,7 @@ public:
// //
// Parameters: // Parameters:
// filename - Name of file to load. // filename - Name of file to load.
void open(std::string filename); void open(const std::string& filename);
// Function: close // Function: close
// Frees memory occupied by loaded data. // Frees memory occupied by loaded data.
@ -95,7 +98,7 @@ public:
// Size of currently loaded data. // Size of currently loaded data.
uint getSize() const; uint getSize() const;
// Function: eof // Function: isEOF
// Checks if internal cursor is at end of file. // Checks if internal cursor is at end of file.
// //
// Returns: // Returns:

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: VersionInfo.h,v 1.2 2005/02/05 02:57:07 cozman Exp $ // $Id: VersionInfo.h,v 1.3 2005/02/07 01:48:26 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: VersionInfo.h,v $ // $Log: VersionInfo.h,v $
// Revision 1.3 2005/02/07 01:48:26 cozman
// string references
//
// Revision 1.2 2005/02/05 02:57:07 cozman // Revision 1.2 2005/02/05 02:57:07 cozman
// *** empty log message *** // *** empty log message ***
// //
@ -31,32 +34,32 @@ namespace util {
// Format is Major.Minor.Release [ExtraInfo]. // Format is Major.Minor.Release [ExtraInfo].
// //
// Operators: // Operators:
// VersionInfo < VersionInfo // - VersionInfo < VersionInfo
// VersionInfo <= VersionInfo // - VersionInfo <= VersionInfo
// VersionInfo == VersionInfo // - VersionInfo == VersionInfo
// VersionInfo >= VersionInfo // - VersionInfo >= VersionInfo
// VersionInfo > VersionInfo // - VersionInfo > VersionInfo
// ostream& << VersionInfo // - ostream& << VersionInfo
class VersionInfo class VersionInfo
{ {
public: public:
// Group: Variables // Group: Variables
// Variable: Major // Variable: major
// Major version number, should be changed when major changes take place. // Major version number, should be changed when major changes take place.
unsigned int major; unsigned int major;
// Variable: Minor // Variable: minor
// Minor version number, should be changed when key features are // Minor version number, should be changed when key features are
// added/removed/changed. // added/removed/changed.
unsigned int minor; unsigned int minor;
// Variable: Release // Variable: release
// Release number, should be changed upon every release that isn't // Release number, should be changed upon every release that isn't
// signifigant enough to reflect a change in the minor versioning number. // signifigant enough to reflect a change in the minor versioning number.
unsigned int release; unsigned int release;
// Variable: Extra // Variable: extra
// String for holding extra data, such as a release name or special tag. // String for holding extra data, such as a release name or special tag.
std::string extra; std::string extra;

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: Log.cpp,v 1.2 2005/02/04 08:11:54 cozman Exp $ // $Id: Log.cpp,v 1.3 2005/02/07 01:48:27 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: Log.cpp,v $ // $Log: Log.cpp,v $
// Revision 1.3 2005/02/07 01:48:27 cozman
// string references
//
// Revision 1.2 2005/02/04 08:11:54 cozman // Revision 1.2 2005/02/04 08:11:54 cozman
// switched Log to shared_ptrs and added extra flushes // switched Log to shared_ptrs and added extra flushes
// //
@ -53,7 +56,7 @@ void Log::addSink(LogSinkPtr sink)
sinks_.push_back(sink); sinks_.push_back(sink);
} }
void Log::removeSink(std::string sinkName) void Log::removeSink(const std::string& sinkName)
{ {
flush(); flush();

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: LogSink.cpp,v 1.4 2005/02/05 03:01:04 cozman Exp $ // $Id: LogSink.cpp,v 1.5 2005/02/07 01:48:27 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: LogSink.cpp,v $ // $Log: LogSink.cpp,v $
// Revision 1.5 2005/02/07 01:48:27 cozman
// string references
//
// Revision 1.4 2005/02/05 03:01:04 cozman // Revision 1.4 2005/02/05 03:01:04 cozman
// removed getStream() (useless) // removed getStream() (useless)
// //
@ -32,7 +35,7 @@ namespace photon
//LogSink //LogSink
LogSink::LogSink(std::string name) : LogSink::LogSink(const std::string& name) :
name_(name) name_(name)
{ {
} }
@ -48,7 +51,7 @@ std::string LogSink::getName() const
//ConsoleSink //ConsoleSink
ConsoleSink::ConsoleSink(std::string name) : ConsoleSink::ConsoleSink(const std::string& name) :
LogSink(name) LogSink(name)
{ {
} }
@ -57,7 +60,7 @@ ConsoleSink::~ConsoleSink()
{ {
} }
void ConsoleSink::writeMessage(LogLevel level, std::string msg) void ConsoleSink::writeMessage(LogLevel level, const std::string& msg)
{ {
static char* pre[] = { " NOTE: ", static char* pre[] = { " NOTE: ",
" VERBOSE: ", " VERBOSE: ",
@ -70,7 +73,7 @@ void ConsoleSink::writeMessage(LogLevel level, std::string msg)
//TextSink //TextSink
TextSink::TextSink(std::string name) : TextSink::TextSink(const std::string& name) :
LogSink(name), LogSink(name),
out_(std::string(name+".txt").c_str()) out_(std::string(name+".txt").c_str())
{ {
@ -81,7 +84,7 @@ TextSink::~TextSink()
out_.close(); out_.close();
} }
void TextSink::writeMessage(LogLevel level, std::string msg) void TextSink::writeMessage(LogLevel level, const std::string& msg)
{ {
static char* pre[] = { " NOTE: ", static char* pre[] = { " NOTE: ",
" VERBOSE: ", " VERBOSE: ",
@ -94,7 +97,7 @@ void TextSink::writeMessage(LogLevel level, std::string msg)
//HTMLSink //HTMLSink
HTMLSink::HTMLSink(std::string name) : HTMLSink::HTMLSink(const std::string& name) :
LogSink(name), LogSink(name),
out_(std::string(name+".html").c_str()) out_(std::string(name+".html").c_str())
{ {
@ -118,7 +121,7 @@ HTMLSink::~HTMLSink()
out_.close(); out_.close();
} }
void HTMLSink::writeMessage(LogLevel level, std::string msg) void HTMLSink::writeMessage(LogLevel level, const std::string& msg)
{ {
static char* css[] = {"note","verbose","warning","error","critical"}; static char* css[] = {"note","verbose","warning","error","critical"};
static char* pre[] = { " NOTE: ", static char* pre[] = { " NOTE: ",

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: exceptions.cpp,v 1.2 2005/01/31 15:44:38 cozman Exp $ // $Id: exceptions.cpp,v 1.3 2005/02/07 01:48:27 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: exceptions.cpp,v $ // $Log: exceptions.cpp,v $
// Revision 1.3 2005/02/07 01:48:27 cozman
// string references
//
// Revision 1.2 2005/01/31 15:44:38 cozman // Revision 1.2 2005/01/31 15:44:38 cozman
// simplified exceptions // simplified exceptions
// //
@ -24,8 +27,8 @@
namespace photon namespace photon
{ {
Throwable::Throwable(std::string description, Throwable::Throwable(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
description_(description), file_(file), line_(line) description_(description), file_(file), line_(line)
{} {}
@ -46,40 +49,40 @@ std::string Throwable::getDesc() const throw()
//exceptions// //exceptions//
Exception::Exception(std::string description, Exception::Exception(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Throwable(description,file,line) {} Throwable(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const Exception& rhs) std::ostream& operator<<(std::ostream& os, const Exception& rhs)
{ {
return os << "General exception occured: " << rhs.getDesc(); return os << "General exception occured: " << rhs.getDesc();
} }
ArgumentException::ArgumentException(std::string description, ArgumentException::ArgumentException(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Exception(description,file,line) {} Exception(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const ArgumentException& rhs) std::ostream& operator<<(std::ostream& os, const ArgumentException& rhs)
{ {
return os << "Invalid argument exception occured. " << rhs.getDesc(); return os << "Invalid argument exception occured. " << rhs.getDesc();
} }
PreconditionException::PreconditionException(std::string description, PreconditionException::PreconditionException(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Exception(description,file,line) {} Exception(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const PreconditionException& rhs) std::ostream& operator<<(std::ostream& os, const PreconditionException& rhs)
{ {
return os << "Precondition exception occured: " << rhs.getDesc(); return os << "Precondition exception occured: " << rhs.getDesc();
} }
RangeException::RangeException(std::string description, RangeException::RangeException(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Exception(description,file,line) {} Exception(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const RangeException& rhs) std::ostream& operator<<(std::ostream& os, const RangeException& rhs)
{ {
return os << "Out-of-range exception: " << rhs.getDesc(); return os << "Out-of-range exception: " << rhs.getDesc();
} }
ResourceException::ResourceException(std::string description, ResourceException::ResourceException(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Exception(description,file,line) {} Exception(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const ResourceException& rhs) std::ostream& operator<<(std::ostream& os, const ResourceException& rhs)
{ {
@ -88,23 +91,24 @@ std::ostream& operator<<(std::ostream& os, const ResourceException& rhs)
//errors// //errors//
Error::Error(std::string description, std::string file, uint line) throw() : Error::Error(const std::string& description,
const std::string& file, uint line) throw() :
Throwable(description,file,line) {} Throwable(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const Error& rhs) std::ostream& operator<<(std::ostream& os, const Error& rhs)
{ {
return os << "General error occured: " << rhs.getDesc(); return os << "General error occured: " << rhs.getDesc();
} }
MemoryError::MemoryError(std::string description, MemoryError::MemoryError(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Error(description,file,line) {} Error(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const MemoryError& rhs) std::ostream& operator<<(std::ostream& os, const MemoryError& rhs)
{ {
return os << "Memory error occured: " << rhs.getDesc(); return os << "Memory error occured: " << rhs.getDesc();
} }
APIError::APIError(std::string description, APIError::APIError(const std::string& description,
std::string file, uint line) throw() : const std::string& file, uint line) throw() :
Error(description,file,line) {} Error(description,file,line) {}
std::ostream& operator<<(std::ostream& os, const APIError& rhs) std::ostream& operator<<(std::ostream& os, const APIError& rhs)
{ {

View File

@ -5,10 +5,13 @@
// James Turk (jpt2433@rit.edu) // James Turk (jpt2433@rit.edu)
// //
// Version: // Version:
// $Id: FileBuffer.cpp,v 1.1 2005/02/06 21:30:10 cozman Exp $ // $Id: FileBuffer.cpp,v 1.2 2005/02/07 01:48:27 cozman Exp $
// //
// Revisions: // Revisions:
// $Log: FileBuffer.cpp,v $ // $Log: FileBuffer.cpp,v $
// Revision 1.2 2005/02/07 01:48:27 cozman
// string references
//
// Revision 1.1 2005/02/06 21:30:10 cozman // Revision 1.1 2005/02/06 21:30:10 cozman
// PhysFS initial integration // PhysFS initial integration
// //
@ -28,14 +31,14 @@ FileBuffer::FileBuffer() :
{} {}
FileBuffer::FileBuffer(std::string filename) : FileBuffer::FileBuffer(const std::string& filename) :
file_( PHYSFS_openRead(filename.c_str()) ) file_( PHYSFS_openRead(filename.c_str()) )
{} {}
FileBuffer::~FileBuffer() FileBuffer::~FileBuffer()
{} {}
void FileBuffer::open(std::string filename) void FileBuffer::open(const std::string& filename)
{ {
file_ = PHYSFS_openRead(filename.c_str()); file_ = PHYSFS_openRead(filename.c_str());
} }