The SimpleCxxLib package


Description:

The SimpleCxxLib package is a simple C++ library for introductory CS which is currently being used in CS101: Programming Abstractions in C++ course. This is a fork from the Stanford C++ libraries originally developed by Eric Roberts and Keith Schwarz. This unofficial modified version is written and maintained by Xue Hao(xuehao0618@outlook.com).

This package is free software: you can redistribute it and/or modify it under the terms of GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Downloads:

Download the latest version here:


Documentation:

The SimpleCxxLib package defines a set of libraries that make it easier to write programs in C++. The facilities provided by these libraries can be broken down into the following groups:

  1. Function libraries. Several of the interfaces (console.h, direction.h, error.h, filelib.h, gmath.h, random.h, simpio.h, strlib.h, thread.h) export collections of free functions instead of classes.

  2. Collection classes. Several of the classes (Graph, Grid, HashMap, HashSet, Lexicon, Map, PriorityQueue, Queue, Set, Stack, Vector) represent collections of other objects. These collections work in much the same way as the similar classes in the Standard Template Library (STL).

  3. Graphics classes. Most of the classes in the SimpleCxxLib package are used to support graphics. These classes can themselves be broken down into the following categories:
  4. Utility classes. The libraries also export several utility classes that don't fit easily into the other categories (ErrorException, Lock, Point, Sound, Thread, TokenScanner).

Additional documentation appears in the web pages for the individual classes, along with sample code.

Classes
ErrorException  This exception is thrown by calls to the error function.
G3DRect  This graphical object subclass represents a rectangular box that can be raised or lowered.
GActionEvent  This event subclass represents an action event.
GArc  This graphical object subclass represents an elliptical arc.
GButton  This interactor subclass represents an onscreen button.
GCheckBox  This interactor subclass represents an onscreen check box.
GChooser  This interactor subclass represents a selectable list.
GCompound  This graphical object subclass consists of a collection of other graphical objects.
GDimension  This class contains real-valued width and height fields.
GEvent  This class is the root of the hierarchy for all events.
GImage  This graphical object subclass represents an image from a file.
GInteractor  This abstract class is the superclass for all graphical interactors.
GKeyEvent  This event subclass represents a key event.
GLabel  This graphical object subclass represents a text string.
GLine  This graphical object subclass represents a line segment.
GMouseEvent  This event subclass represents a mouse event.
GObject  This class is the common superclass of all graphical objects that can be displayed on a graphical window.
GOval  This graphical object subclass represents an oval inscribed in a rectangular box.
GPoint  This class contains real-valued x and y fields.
GPolygon  This graphical object subclass represents a polygon bounded by line segments.
Graph<NodeType,ArcType>  This class represents a graph with the specified node and arc types.
GRect  This class represents a graphical object whose appearance consists of a rectangular box.
GRectangle  This type contains real-valued x, y, width, and height fields.
Grid<ValueType>  This class stores an indexed, two-dimensional array.
GRoundRect  This class represents a graphical object whose appearance consists of a rectangular box with rounded corners.
GSlider  This interactor subclass represents an onscreen slider.
GTextField  This interactor subclass represents a text field for entering short text strings.
GTimer  This class implements a simple interval timer that generates a GTimerEvent with a specified frequency.
GTimerEvent  This event subclass represents a timer event.
GWindow  This class represents a graphics window that supports simple graphics.
GWindowEvent  This event subclass represents a window event.
HashMap<KeyType,ValueType>  This class implements an efficient association between keys and values.
HashSet<ValueType>  This class implements an efficient abstraction for storing sets of distinct elements.
Lexicon  This class is used to represent a lexicon, or word list.
Lock  This class represents a simple lock used to control concurrency.
Map<KeyType,ValueType>  This class maintains an association between keys and values.
Point  This class represents an x-y coordinate point on a two-dimensional integer grid.
PriorityQueue<ValueType>  This class models a structure called a priority queue in which values are processed in order of priority.
Queue<ValueType>  This class models a linear structure called a queue in which values are added at one end and removed from the other.
Set<ValueType>  This class stores a collection of distinct elements.
Sound  This class encapsulates a sound file.
Stack<ValueType>  This class models a linear structure called a stack in which values are added and removed only from one end.
Thread  This class encapsulates a lightweight process running in the same address space as the creator.
TokenScanner  This class divides a string into individual tokens.
Vector<ValueType>  This class stores an ordered list of values similar to an array.
Interface files
console.h  This file redirects the cin, cout, and cerr channels to use a console window.
direction.h  This file exports an enumerated type called Direction whose elements are the four compass points: NORTH, EAST, SOUTH, and WEST.
error.h  This file defines the ErrorException class and the error function.
filelib.h  This file exports a standardized set of tools for working with files.
gevents.h  This file defines the event types used in the SimpleCxxLib graphics libraries.
ginteractors.h  This file exports a hierarchy of graphical interactors similar to those provided in the Java Swing libraries.
gmath.h  This file exports several functions for working with graphical geometry along with the mathematical constants PI and E.
gobjects.h  This file exports a hierarchy of graphical shapes based on the model developed for the ACM Java Graphics.
graph.h  This file exports a parameterized Graph class used to represent graphs, which consist of a set of nodes and a set of arcs.
grid.h  This file exports the Grid class, which offers a convenient abstraction for representing a two-dimensional array.
gtimer.h  This file defines the GTimer class, which implements a general interval timer.
gtypes.h  This file defines classes for representing points, dimensions, and rectangles.
gwindow.h  This file defines the GWindow class which supports drawing graphical objects on the screen.
hashmap.h  This file exports the HashMap class, which stores a set of key-value pairs.
hashset.h  This file exports the HashSet class, which implements an efficient abstraction for storing sets of values.
lexicon.h  This file exports the Lexicon class, which is a compact structure for storing a list of words.
map.h  This file exports the template class Map, which maintains a collection of key-value pairs.
point.h  This file exports a class representing an integer-valued x-y pair.
pqueue.h  This file exports the PriorityQueue class, a collection in which values are processed in priority order.
queue.h  This file exports the Queue class, a collection in which values are ordinarily processed in a first-in/first-out (FIFO) order.
random.h  This file exports functions for generating pseudorandom numbers.
set.h  This file exports the Set class, which implements a collection for storing a set of distinct elements.
simpio.h  This file exports a set of functions that simplify input/output operations in C++ and provide some error-checking on console input.
sound.h  This file defines a class that represents a sound.
stack.h  This file exports the Stack class, which implements a collection that processes values in a last-in/first-out (LIFO) order.
strlib.h  This file exports several useful string functions that are not included in the C++ string library.
thread.h  This file exports a simple, platform-independent thread abstraction, along with simple tools for concurrency control.
tokenscanner.h  This file exports a TokenScanner class that divides a string into individual logical units called tokens.
vector.h  This file exports the Vector class, which provides an efficient, safe, convenient replacement for the array type in C++.