-
-
Save rhololkeolke/5434204 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ExampleClass.h" | |
namespace example | |
{ | |
ExampleClass::ExampleClass() : | |
x_(0), | |
y_(0) | |
{} | |
ExampleClass::~ExampleClass() | |
{} | |
/** | |
* \bug y gets the value in x, but x doesn't get the value in y | |
*/ | |
void ExampleClass::swap(int& x, int& y) | |
{ | |
y = x; | |
x = y; | |
} | |
/** | |
* \todo Implement me! | |
*/ | |
int ExampleClass::add(int x, int y) | |
{ | |
return 0; | |
} | |
void ExampleClass::add(int x, int y, int& z) | |
{ | |
z = x + y; | |
} | |
int ExampleClass::add() | |
{ | |
return x_ + y_; | |
} | |
void ExampleClass::add(int& z) | |
{ | |
z = x_ + y_; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Now see what it looks like with Documentation | |
#ifndef EXAMPLE_CLASS_H_ | |
#define EXAMPLE_CLASS_H_ | |
/** | |
* \brief The example namespace contains all classes and variables used in the example package | |
* | |
* This package is meant to illustrate doxygen with C++ code | |
*/ | |
namespace example | |
{ | |
/** | |
* \brief This class demonstrates documenting a class and its members | |
*/ | |
class ExampleClass | |
{ | |
public: | |
/** | |
* \brief initializes x and y to 0 | |
*/ | |
ExampleClass(); | |
~ExampleClass(); | |
/** | |
* \brief swaps x and y | |
* | |
* the value of x is put into y and the value of y is put into x. | |
* This is passed by reference to eliminate the need to return 2 variables | |
* | |
* \param [in,out] x value to swap with value in y | |
* \param [in,out] y value to swap with value in x | |
* | |
*/ | |
void swap(int& x, int& y); | |
/** | |
* \brief add x and y | |
* | |
* passes by value x and y and returns their addition | |
* | |
* \param [in] x value to add to y | |
* \param [in] y value to add to x | |
* | |
* \returns the addition of x and y parameters | |
*/ | |
int add(int x, int y); | |
/** | |
* \brief adds x and y | |
* | |
* stores the addition result in z | |
* | |
* \param [in] x value to add to y | |
* \param [in] y value to add to x | |
* \param [out] z stores result of addition of x and y parameters | |
*/ | |
void add(int x, int y, int& z); | |
/** | |
* \brief adds member variables x_ and y_ | |
* | |
* \returns the result of the addition of x_ and y_ | |
*/ | |
int add(); | |
/** | |
* \brief adds member variables x_ and y_ | |
* | |
* stores the result in z | |
* | |
* \param [out] z stores result of addition of member variables x_ and y_ | |
*/ | |
void add(int& z); | |
private: | |
int x_; //!< integer used in addition example functions. Added to y_ | |
int y_; //!< integer used in addition example functions. Added to x_ | |
}; | |
} | |
#endif // EXAMPLE_CLASS_H_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment