Recommit because something is strange. The changes are that memory allocated in _construct is deallocated when the CmdLine obj is destroyed

This commit is contained in:
macbishop 2004-09-20 17:05:15 +00:00
parent 6c06e31bb2
commit 4362a50705

View File

@ -93,6 +93,9 @@ class CmdLine
*/ */
XorHandler _xorHandler; XorHandler _xorHandler;
std::list<Arg*> _argDeleteOnExitList;
std::list<Visitor*> _visitorDeleteOnExitList;
/** /**
* Checks whether a name/flag string matches entirely matches * Checks whether a name/flag string matches entirely matches
* the Arg::blankChar. Used when multiple switches are combined * the Arg::blankChar. Used when multiple switches are combined
@ -122,6 +125,16 @@ class CmdLine
*/ */
void _constructor(); void _constructor();
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Arg* ptr);
/**
* Perform a delete ptr; operation on ptr when this object is deleted.
*/
void deleteOnExit(Visitor* ptr);
public: public:
/** /**
@ -151,6 +164,9 @@ class CmdLine
CmdLine(const std::string& message, CmdLine(const std::string& message,
const char delimiter = ' ', const char delimiter = ' ',
const std::string& version = "none" ); const std::string& version = "none" );
///Deletes any resources allocated by a CmdLine object
~CmdLine();
/** /**
* Adds an argument to the list of arguments to be parsed. * Adds an argument to the list of arguments to be parsed.