Rogue Wave Tools.h++ Brief Overview

Tools.h++ Basic Features
Some Supported Compilers
Some Interesting Classes
Naming Conventions
Examples
Conclusions
Back to Software Technology Overview
Tools.h++ Basic Features ------------------------ De-facto industry standard C++ class library - included with many compilers by vendors Portable Supports single, multibyte, and wide character sets The Library includes: Collection classes ( generic and Smalltalk-like ) Template based classes Persistent store Internationalization support Multi-thread safe Back To Rogue Wave Overview Some Supported Compilers ------------------------ MS-DOS, WINDOWS, WINDOWS NT: - Borland C++ V3.0 or greater - Microsoft C/C++ V7.0 - Microsoft Visual C++ OS/2: - Borland C++ V3.1 or greater UNIX: - Sun C++ V2.1 or greater Back To Rogue Wave Tools.h++ Overview Some Interesting Classes ------------------------ Class RWCollectable
Class RWCString
Class RWFile
RWCollectableString RWSlistCollectables RWSlistCollectablesIterator RWSlistCollectablesQueue RWTimer Back To Rogue Wave Tools.h++ Overview
Class RWCollectable ------------------- Used with persistence machinery Declares virtual functions - default definitions are customizable To make an object: - define a default constructor - add macro RWDECLARE_COLLECTABLE - add macro RWDEFINE_COLLECTABLE - define virtual functions as needed Objects inherit virtual destructor Back To Rogue Wave Tools.h++ Overview
Class RWCString --------------- Processes strings - similar to the standard C string.h file Handles memory management - hard to delete something twice or not at all Code Slice: RWCStrings The following code reads in two RWCStrings, concatenates them, converts to upper case, then sends the results to cout: RWCString s1, s1; cin >> s1 >> s2; cout << toUpper(s1+s2); Back To Rogue Wave Tools.h++ Overview
Class RWFile ------------ Encapsulates the standard C file operations for binary read and write Supports const modifier Ports to MS-DOS Constructor opens binary file with mode : RWFile(const char* filename, const char* mode = 0); Destructor closes the file Code Slice: RWFile /* The following code creates an RWFile with filename "my.file", reads an int (if file is not empty), increments the int, and writes it back to the file: */ #include int main() { RWFile file("my.file"); // construct the RWFile if ( file.Exists() ) { // file exist with read/write permission? int i = 0; if ( !file.IsEmpty() ) fil.Read(i);// read an int if file not empty i++; file.SeekToBegin(); file.Write(i); // rewrite the integer } return 0; } Back To Rogue Wave Tools.h++ Overview
Naming Conventions ------------------ Class names begin with "RW": RWHashDictionary Function names: compareTo( ) No underline characters Generic global names ensure compatibility with other class libraries Back To Rogue Wave Tools.h++ Overview
Examples -------- Virtual Function IsA( ) Returns a "class ID" - unique number that identifies object's class Syntax: virtual RWClassID isA( ) const; Example: RWCollectableString phoenix; phoenix.isA( ) == __RWCOLLECTABLESTRING evaluates true Clumsy VS Elegant Code int main(int argc, char* argv[]) int main(int argc, char* argv[]) { { char buffer[120]; fstream fstr(argv[1]); fstream fstr(argv([1]); RWCString line; RWCString line; while (fstr.readline(buf, sizeof(buf)) while (line.readLine(fstr)) { { line = buf; cout << line; cout << line; } } return 1; return 1; } } Back To Rogue Wave Tools.h++ Overview
Conclusions: ------------ Rogue Wave Tools.h++ Robust C++ library Industry tested and accepted as de-facto standard Used internationally Strong documentation Reliable vendor support Reasonable learning curve Back To Rogue Wave Tools.h++ Overview