diff --git a/devcpp/photon.dev b/devcpp/photon.dev index 4748da9..e431e25 100644 --- a/devcpp/photon.dev +++ b/devcpp/photon.dev @@ -1,7 +1,7 @@ [Project] FileName=photon.dev Name=photon -UnitCount=17 +UnitCount=20 Type=2 Ver=1 ObjFiles= @@ -20,7 +20,7 @@ ObjectOutput=..\devcpp OverrideOutput=1 OverrideOutputName=libphoton.a HostApplication= -Folders=external,external/include,external/src,include,include/util,src,src/util +Folders=include,include/util,src,src/util CommandLine= UseCustomMakefile=0 CustomMakefile= @@ -217,3 +217,33 @@ Priority=1000 OverrideBuildCmd=0 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= + diff --git a/include/Log.h b/include/Log.h index 47ff0fc..dbb61b3 100644 --- a/include/Log.h +++ b/include/Log.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // switched Log to shared_ptrs and added extra flushes // @@ -30,8 +33,8 @@ namespace photon { // Class: Log -// Log class for photon, Log passes all messages to any attached sinks, which -// can then take care of any output which is desired. +// Log class for photon, Log passes all messages to any attached , +// which can then take care of any output which is desired. class Log { @@ -55,7 +58,7 @@ public: // // Parameters: // sinkName - Name of sink to remove. - void removeSink(std::string sinkName); + void removeSink(const std::string& sinkName); // Function: removeSink // Remove a sink from the log. diff --git a/include/LogSink.h b/include/LogSink.h index 59dc05f..b8473f4 100644 --- a/include/LogSink.h +++ b/include/LogSink.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // removed getStream() (useless) // @@ -77,7 +80,7 @@ public: // // Parameters: // name_ - Name of LogSink, every LogSink should have a unique name. - LogSink(std::string name); + LogSink(const std::string& name); // Function: ~LogSink // Virtual destructor, available to make inheritance safe. @@ -93,7 +96,7 @@ public: // Parameters: // level - of log event. // 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 public: @@ -129,10 +132,10 @@ typedef shared_ptr LogSinkPtr; class ConsoleSink : public LogSink { public: - ConsoleSink(std::string name); + ConsoleSink(const std::string& name); virtual ~ConsoleSink(); - virtual void writeMessage(LogLevel level, std::string msg); + virtual void writeMessage(LogLevel level, const std::string& msg); }; // Class: TextSink @@ -146,10 +149,10 @@ public: class TextSink : public LogSink { public: - TextSink(std::string name); + TextSink(const std::string& name); virtual ~TextSink(); - virtual void writeMessage(LogLevel level, std::string msg); + virtual void writeMessage(LogLevel level, const std::string& msg); private: std::ofstream out_; }; @@ -165,10 +168,10 @@ private: class HTMLSink : public LogSink { public: - HTMLSink(std::string name); + HTMLSink(const std::string& name); virtual ~HTMLSink(); - virtual void writeMessage(LogLevel level, std::string msg); + virtual void writeMessage(LogLevel level, const std::string& msg); private: std::ofstream out_; }; diff --git a/include/exceptions.h b/include/exceptions.h index ad23ff9..a3f4ecd 100644 --- a/include/exceptions.h +++ b/include/exceptions.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // removed require // @@ -59,8 +62,8 @@ public: // description - description of why 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] - Throwable(std::string description = std::string(), - std::string file = std::string(), + Throwable(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); virtual ~Throwable() throw()=0; @@ -97,8 +100,8 @@ private: class Exception : public Throwable { public: - Exception(std::string description = std::string(), - std::string file = std::string(), + Exception(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const Exception& rhs); @@ -116,8 +119,8 @@ public: class ArgumentException : public Exception { public: - ArgumentException(std::string description = std::string(), - std::string file = std::string(), + ArgumentException(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const ArgumentException& rhs); @@ -134,8 +137,8 @@ public: class PreconditionException : public Exception { public: - PreconditionException(std::string description = std::string(), - std::string file = std::string(), + PreconditionException(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const PreconditionException& rhs); @@ -154,8 +157,8 @@ class RangeException : public Exception { public: RangeException() throw(); - RangeException(std::string description = std::string(), - std::string file = std::string(), + RangeException(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const RangeException& rhs); @@ -174,8 +177,8 @@ class ResourceException : public Exception { public: ResourceException() throw(); - ResourceException(std::string description = std::string(), - std::string file = std::string(), + ResourceException(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const ResourceException& rhs); @@ -205,8 +208,8 @@ class Error : public Throwable { public: Error() throw(); - Error(std::string description = std::string(), - std::string file = std::string(), + Error(const std::string&description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const Error& rhs); @@ -224,8 +227,8 @@ class MemoryError : public Error { public: MemoryError() throw(); - MemoryError(std::string description = std::string(), - std::string file = std::string(), + MemoryError(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const MemoryError& rhs); @@ -244,8 +247,8 @@ class APIError : public Error { public: APIError() throw(); - APIError(std::string description = std::string(), - std::string file = std::string(), + APIError(const std::string& description = std::string(), + const std::string& file = std::string(), uint line=0) throw(); friend std::ostream& operator<<(std::ostream& os, const APIError& rhs); diff --git a/include/types.h b/include/types.h index 247b071..5bc2e18 100644 --- a/include/types.h +++ b/include/types.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // shared_ptr // @@ -22,6 +25,9 @@ #include +#include +#include + // Title: Basic Types namespace photon { @@ -40,6 +46,10 @@ namespace photon { // Scalar value, used throughout photon. (double or float) typedef double scalar; + // Type: StrVec + // Typedef for vector of strings, which is used all throughout photon. + typedef std::vector StrVec; + // Type: shared_ptr // Shared pointer type. (uses the boost implementation) using boost::shared_ptr; diff --git a/include/util/FileBuffer.h b/include/util/FileBuffer.h index 5d433a8..59696eb 100644 --- a/include/util/FileBuffer.h +++ b/include/util/FileBuffer.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // PhysFS initial integration // @@ -46,7 +49,7 @@ public: // // Parameters: // filename - Name of file to load. - FileBuffer(std::string filename); + FileBuffer(const std::string& filename); // Function: ~FileBuffer // Destructor, calls . @@ -60,7 +63,7 @@ public: // // Parameters: // filename - Name of file to load. - void open(std::string filename); + void open(const std::string& filename); // Function: close // Frees memory occupied by loaded data. @@ -95,7 +98,7 @@ public: // Size of currently loaded data. uint getSize() const; - // Function: eof + // Function: isEOF // Checks if internal cursor is at end of file. // // Returns: diff --git a/include/util/VersionInfo.h b/include/util/VersionInfo.h index 8d730e3..b25c670 100644 --- a/include/util/VersionInfo.h +++ b/include/util/VersionInfo.h @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // *** empty log message *** // @@ -31,32 +34,32 @@ namespace util { // Format is Major.Minor.Release [ExtraInfo]. // // Operators: -// VersionInfo < VersionInfo -// VersionInfo <= VersionInfo -// VersionInfo == VersionInfo -// VersionInfo >= VersionInfo -// VersionInfo > VersionInfo -// ostream& << VersionInfo +// - VersionInfo < VersionInfo +// - VersionInfo <= VersionInfo +// - VersionInfo == VersionInfo +// - VersionInfo >= VersionInfo +// - VersionInfo > VersionInfo +// - ostream& << VersionInfo class VersionInfo { public: // Group: Variables - // Variable: Major + // Variable: major // Major version number, should be changed when major changes take place. unsigned int major; - // Variable: Minor + // Variable: minor // Minor version number, should be changed when key features are // added/removed/changed. unsigned int minor; - // Variable: Release + // Variable: release // Release number, should be changed upon every release that isn't // signifigant enough to reflect a change in the minor versioning number. unsigned int release; - // Variable: Extra + // Variable: extra // String for holding extra data, such as a release name or special tag. std::string extra; diff --git a/src/Log.cpp b/src/Log.cpp index 603f202..f4533be 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // switched Log to shared_ptrs and added extra flushes // @@ -53,7 +56,7 @@ void Log::addSink(LogSinkPtr sink) sinks_.push_back(sink); } -void Log::removeSink(std::string sinkName) +void Log::removeSink(const std::string& sinkName) { flush(); diff --git a/src/LogSink.cpp b/src/LogSink.cpp index 84d3a4a..2dbb462 100644 --- a/src/LogSink.cpp +++ b/src/LogSink.cpp @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // removed getStream() (useless) // @@ -32,7 +35,7 @@ namespace photon //LogSink -LogSink::LogSink(std::string name) : +LogSink::LogSink(const std::string& name) : name_(name) { } @@ -48,7 +51,7 @@ std::string LogSink::getName() const //ConsoleSink -ConsoleSink::ConsoleSink(std::string name) : +ConsoleSink::ConsoleSink(const std::string& 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: ", " VERBOSE: ", @@ -70,7 +73,7 @@ void ConsoleSink::writeMessage(LogLevel level, std::string msg) //TextSink -TextSink::TextSink(std::string name) : +TextSink::TextSink(const std::string& name) : LogSink(name), out_(std::string(name+".txt").c_str()) { @@ -81,7 +84,7 @@ TextSink::~TextSink() out_.close(); } -void TextSink::writeMessage(LogLevel level, std::string msg) +void TextSink::writeMessage(LogLevel level, const std::string& msg) { static char* pre[] = { " NOTE: ", " VERBOSE: ", @@ -94,7 +97,7 @@ void TextSink::writeMessage(LogLevel level, std::string msg) //HTMLSink -HTMLSink::HTMLSink(std::string name) : +HTMLSink::HTMLSink(const std::string& name) : LogSink(name), out_(std::string(name+".html").c_str()) { @@ -118,7 +121,7 @@ HTMLSink::~HTMLSink() 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* pre[] = { " NOTE: ", diff --git a/src/exceptions.cpp b/src/exceptions.cpp index 55488f4..ab47520 100644 --- a/src/exceptions.cpp +++ b/src/exceptions.cpp @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // simplified exceptions // @@ -24,8 +27,8 @@ namespace photon { -Throwable::Throwable(std::string description, - std::string file, uint line) throw() : +Throwable::Throwable(const std::string& description, + const std::string& file, uint line) throw() : description_(description), file_(file), line_(line) {} @@ -46,40 +49,40 @@ std::string Throwable::getDesc() const throw() //exceptions// -Exception::Exception(std::string description, - std::string file, uint line) throw() : +Exception::Exception(const std::string& description, + const std::string& file, uint line) throw() : Throwable(description,file,line) {} std::ostream& operator<<(std::ostream& os, const Exception& rhs) { return os << "General exception occured: " << rhs.getDesc(); } -ArgumentException::ArgumentException(std::string description, - std::string file, uint line) throw() : +ArgumentException::ArgumentException(const std::string& description, + const std::string& file, uint line) throw() : Exception(description,file,line) {} std::ostream& operator<<(std::ostream& os, const ArgumentException& rhs) { return os << "Invalid argument exception occured. " << rhs.getDesc(); } -PreconditionException::PreconditionException(std::string description, - std::string file, uint line) throw() : +PreconditionException::PreconditionException(const std::string& description, + const std::string& file, uint line) throw() : Exception(description,file,line) {} std::ostream& operator<<(std::ostream& os, const PreconditionException& rhs) { return os << "Precondition exception occured: " << rhs.getDesc(); } -RangeException::RangeException(std::string description, - std::string file, uint line) throw() : +RangeException::RangeException(const std::string& description, + const std::string& file, uint line) throw() : Exception(description,file,line) {} std::ostream& operator<<(std::ostream& os, const RangeException& rhs) { return os << "Out-of-range exception: " << rhs.getDesc(); } -ResourceException::ResourceException(std::string description, - std::string file, uint line) throw() : +ResourceException::ResourceException(const std::string& description, + const std::string& file, uint line) throw() : Exception(description,file,line) {} std::ostream& operator<<(std::ostream& os, const ResourceException& rhs) { @@ -88,23 +91,24 @@ std::ostream& operator<<(std::ostream& os, const ResourceException& rhs) //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) {} std::ostream& operator<<(std::ostream& os, const Error& rhs) { return os << "General error occured: " << rhs.getDesc(); } -MemoryError::MemoryError(std::string description, - std::string file, uint line) throw() : +MemoryError::MemoryError(const std::string& description, + const std::string& file, uint line) throw() : Error(description,file,line) {} std::ostream& operator<<(std::ostream& os, const MemoryError& rhs) { return os << "Memory error occured: " << rhs.getDesc(); } -APIError::APIError(std::string description, - std::string file, uint line) throw() : +APIError::APIError(const std::string& description, + const std::string& file, uint line) throw() : Error(description,file,line) {} std::ostream& operator<<(std::ostream& os, const APIError& rhs) { diff --git a/src/util/FileBuffer.cpp b/src/util/FileBuffer.cpp index 4aa0fd6..bc3af09 100644 --- a/src/util/FileBuffer.cpp +++ b/src/util/FileBuffer.cpp @@ -5,10 +5,13 @@ // James Turk (jpt2433@rit.edu) // // 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: // $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 // 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()) ) {} FileBuffer::~FileBuffer() {} -void FileBuffer::open(std::string filename) +void FileBuffer::open(const std::string& filename) { file_ = PHYSFS_openRead(filename.c_str()); }