A3t::initialize

- Migrated ctor functionality over to the new initialize method, for integration
  with Context.
This commit is contained in:
Paul Beckingham 2013-09-01 13:57:24 -04:00
parent eb55c64f34
commit c3bf3b79a4
3 changed files with 15 additions and 8 deletions

View file

@ -36,12 +36,22 @@
static const int minimumMatchLength = 3; static const int minimumMatchLength = 3;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
A3t::A3t (int argc, char** argv) A3t::A3t ()
{ {
_tree = new Tree ("root"); _tree = new Tree ("root");
if (! _tree) if (! _tree)
throw std::string ("Failed to allocate memory for parse tree."); throw std::string ("Failed to allocate memory for parse tree.");
}
////////////////////////////////////////////////////////////////////////////////
A3t::~A3t ()
{
delete _tree;
}
////////////////////////////////////////////////////////////////////////////////
void A3t::initialize (int argc, char** argv)
{
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
{ {
Tree* branch = _tree->addBranch (new Tree (format ("arg{1}", i))); Tree* branch = _tree->addBranch (new Tree (format ("arg{1}", i)));
@ -51,11 +61,6 @@ A3t::A3t (int argc, char** argv)
} }
} }
////////////////////////////////////////////////////////////////////////////////
A3t::~A3t ()
{
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Tree* A3t::parse () Tree* A3t::parse ()
{ {

View file

@ -34,8 +34,9 @@
class A3t class A3t
{ {
public: public:
A3t (int, char**); A3t ();
~A3t (); ~A3t ();
void initialize (int, char**);
Tree* parse (); Tree* parse ();
void entity (const std::string&, const std::string&); void entity (const std::string&, const std::string&);
bool canonicalize (std::string&, const std::string&, const std::string&) const; bool canonicalize (std::string&, const std::string&, const std::string&) const;

View file

@ -39,7 +39,8 @@ int main (int argc, char** argv)
// Prepare the Context object. // Prepare the Context object.
A3t a3t (argc, argv); A3t a3t;
a3t.initialize (argc, argv);
// Reports. // Reports.
a3t.entity ("report", "list"); a3t.entity ("report", "list");