PERCEPS Examples

Here is a simple example of what PERCEPS can do. A set of simple html template files (included in the distribution) was used by PERCEPS to generate html pages from a set of three example header files listed below. Note: Some of these examples require a frame-capable browser. PERCEPS is quite capable of generating html pages without frames, but some of these example template files use frames.

View example HTML files generated by PERCEPS and the PERCEPS template files used to generate them.

Here is another example which uses the same header files but a different template (without frames) to create a completely different look.

As a final example, you can also view RTF format documentation generated from these same files by PERCEPS. The templates and for the RTF conversion are included with distribution.

See also the PERCEPS FAQ for pointers to other examples of PERCEPS in use.

Here are the header files parsed by perceps for the examples:


//! author="John Doe" // This "stray comment" isn't documented because it comes before the short // description (//:) comment for this class. This allows you to add decorations // like this /////////////////////////////////////////////////////////// // without polluting your documentation. //: An example base class // This would be a detailed description of class Base. Note that private // members are not displayed by these templates. class Base { // Note also that class description comments can now come both before and // after the class declaration, and, with the -h option, comments can include // <I><B><FONT COLOR="red">HTML Formatting!</FONT></B></I> //!italic: This is a custom comment type. You can now create as many comment //!italic: types as you like for precise output control. int private1; public : Base(int arg1); //: Class Constructor int public1(); //: A Public member function. // You can include a detailed description of this function and its // arguments. /* This is a private comment and will be ignored */ // Note that, with the autolink feature, references to // Base, Derived1, or Derived2 become links. float public2( float arg1, float arg2 ); //: Another public member // The tabulted parameter list below illustrates the use of custom // comments together with plugin filters. //!param: arg1 - Description of arg1 //!param: arg2 - Description of arg2 friend iostream & operator<< (iostream &); friend class FriendlyClass; class NestedClass { //: A class nested in class Base public: int nestedvar1; float nestedvar2; float nestedmember2( float arg1, float arg2 ); }; //: A Nested class protected : float protected1; //: A protected member int protected2, *protected3; //: Variable lists are supported float protected4( double arg1 ); };
//! author="Jane Doe" struct Derived1: public Base { //: An example derived class int private1; public: Derived1( int arg1 ) : Base(arg1) {} //: Class constructor. // Note that PERCEPS is not confused by inline functions. int public1(char * string); Base & public2() const; //: A const public member. // Note how the autolink feature has linked the function type // in this case. };
//! author="Jane Doe" template < class T > class Derived2 : public Base, public Undocumented { //: An example derived class // Note that PERCEPS understands templates and multiple inheritiance. int private1; float private2; public : Derived2( T & arg ); //: Class constructor operator T & (); Base * operator[](int); //: operator overload with autolink enum { Lions=5, Tigers, Bears }; //: An enumeration protected : int protected1; //: A protected member T protected2; };
//! author="John Doe" //: A non-member function // This feature allows docification double function(double arg) // of plain-C code as well as C++ { statements... return double; } //: A Global variable // This feature allows docification int global1; // of plain-C code as well as C++ int global2; //: Another global variable //: A global enumeration enum { lions=3,tigers,bears }; //: A type declaration typedef int mytype; //! author="Jane Doe" //: A union definition union JaneplusJohn { int jane; long john; unsigned kids; } global3, global4; //: Two globally scoped instances of JaneplusJohn //: A Macro #define ABS(x) (x>=0 ? x : -x)

Tom Bryan
Last modified: Tue Oct 23 09:03:25 EDT 2007