'Classic' CCA c++ binding (ccaffeine-only) 0.5.7
Public Member Functions | List of all members
esi::Argv Class Reference

Simplest string container interface, ala C's argv. More...

#include <ArgvInterface.h>

Public Member Functions

virtual ~Argv ()
 Default destructor.
 
virtual const char * get (int index) CLASSIC_CCA_PURE
 
virtual int getArgCount () CLASSIC_CCA_PURE
 
virtual void appendArg (const char *arg) CLASSIC_CCA_PURE
 Copy the arg given into the next slot in the argv.
 

Detailed Description

Simplest string container interface, ala C's argv.

A little iterator interface interface around arrays of strings, whereever tbey may be fetched from an ESI interface. In particular: Exists because we want a simple, abstract alternative to the STL. Implementors are free to use the STL underneath this interface if they so choose.

 An example of its use:
 SomeConcreteArgvImpl argvimpl;
     // perhaps the argv class from the reference implementation.
 esi::Argv *argvi = dynamic_cast<esi::Argv *>(&argvimpl);
 esi_int err;
 err = object->getRunTimeModels(argvi, char *msg);
 if (!err) {
                const char *arg;
                      for (i = 0; (arg = argvi->get(i)) != 0; i++) {
                                      do.something(arg);
                                            }
                        delete argvi;
  }
  argvi = 0;

  And inside the getRunTimeModels call, a set of calls on
        argvi->appendArg(rtmodelName[i]);
  occurs, filling in the answers.

This pattern keeps creation/management of all the memory associated with the Argv in the scope of the caller or internal to the Argv itself.

Constructor & Destructor Documentation

◆ ~Argv()

virtual esi::Argv::~Argv ( )
inlinevirtual

Default destructor.

41{}

Member Function Documentation

◆ get()

virtual const char * esi::Argv::get ( int  index)
virtual
Returns
the ith element of argv (not to be modified) if exists. returns 0 otherwise.

◆ getArgCount()

virtual int esi::Argv::getArgCount ( )
virtual
Returns
the current number of strings. This number obviously changes when appendArg

◆ appendArg()

virtual void esi::Argv::appendArg ( const char *  arg)
virtual

Copy the arg given into the next slot in the argv.


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