proj home

Files   Classes   Functions   Hierarchy  

pathtoggle Class Reference

#include <rpnfunc.h>

Inheritance diagram for pathtoggle:
Collaboration diagram for pathtoggle:

List of all members.

Public Member Functions

 pathtoggle ()
 pathtoggle (deque< rpnbase * > &ds, bool const evaluate=true)
 ~pathtoggle ()
rpnbasecopy () const
string const name () const
void visit (deque< rpnbase * > &ds, rpnstring &path)
void visit (deque< rpnbase * > &ds, rpnprogram &path)
void eval (deque< rpnbase * > &ds)


Detailed Description

Definition at line 548 of file rpnfunc.h.


Constructor & Destructor Documentation

pathtoggle::pathtoggle (  )  [inline]

Definition at line 552 of file rpnfunc.h.

Referenced by copy().

00552 {}

pathtoggle::pathtoggle ( deque< rpnbase * > &  ds,
bool const   evaluate = true 
)

Definition at line 1385 of file rpnfunc.cpp.

References eval().

01386 {
01387   if (evaluate)
01388     eval(ds);
01389   else
01390     ds.push_front(this);
01391 }

pathtoggle::~pathtoggle (  )  [inline]

Definition at line 554 of file rpnfunc.h.

00554 {}


Member Function Documentation

rpnbase * pathtoggle::copy (  )  const [virtual]

Reimplemented from rpnfunction.

Definition at line 1393 of file rpnfunc.cpp.

References pathtoggle().

01394 {
01395   return new pathtoggle();
01396 }

void pathtoggle::eval ( deque< rpnbase * > &  ds  )  [virtual]

Reimplemented from rpnfunction.

Definition at line 1398 of file rpnfunc.cpp.

References rpnbase::accept(), and rpnbase::dec().

Referenced by pathtoggle().

01399 {
01400   if (!ds.empty())
01401     ds[0]->accept(ds,*this);
01402 
01403   dec();
01404 }

string const pathtoggle::name (  )  const [inline, virtual]

Reimplemented from rpnfunction.

Definition at line 557 of file rpnfunc.h.

00557 { return string("path!"); }

void pathtoggle::visit ( deque< rpnbase * > &  ds,
rpnprogram path 
) [virtual]

Reimplemented from rpnfunction.

Definition at line 1428 of file rpnfunc.cpp.

References rpnbase::dec(), and rpnstring::str.

01429 {
01430   rpnbase* x0 = ds.front();
01431 
01432   rpnstring* s = new rpnstring();
01433 
01434   vector<string> v;
01435   pathstuff().convert(v,path);
01436   pathstuff().convert(s->str,v);
01437 
01438   ds.pop_front();
01439 
01440   ds.push_front(s);
01441 
01442   x0->dec();
01443 }

void pathtoggle::visit ( deque< rpnbase * > &  ds,
rpnstring path 
) [virtual]

Reimplemented from rpnfunction.

Definition at line 1406 of file rpnfunc.cpp.

References rpnbase::dec(), and rpnstring::str.

01407 {
01408   rpnbase* x0 = ds.front();
01409   ds.pop_front();
01410 
01411   if (path.str.empty())
01412   {
01413     x0->dec();
01414     return;
01415   }
01416   
01417   rpnprogram* p = new rpnprogram();
01418 
01419   vector<string> v;
01420   pathstuff().convert(v,path.str);
01421   pathstuff().convert(*p,v);
01422 
01423   ds.push_front(p);
01424 
01425   x0->dec();
01426 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:08 2011 for Chelton Evans Source by  doxygen 1.5.8