vValue::Registry::Registration Class Reference

#include <vRegistry.h>

Collaboration diagram for vValue::Registry::Registration:

Collaboration graph
[legend]

List of all members.

Public Types

typedef void(* fptr )()

Public Member Functions

 Registration (std::vector< tString > flags, tString fname, int argc, fptr ctor)
 Registration (const char *flags, const char *fname, int argc, fptr ctor)
Expr::Baseuse (arglist)
bool match (std::vector< tString > flags, tString fname, int argc)

Private Attributes

std::vector< tStringm_flags
tString m_fname
int m_argc
fptr m_ctor


Detailed Description

Definition at line 49 of file vRegistry.h.


Member Typedef Documentation

typedef void(* vValue::Registry::Registration::fptr)()


Constructor & Destructor Documentation

vValue::Registry::Registration::Registration ( std::vector< tString flags,
tString  fname,
int  argc,
fptr  ctor 
)

Definition at line 34 of file vRegistry.cpp.

References vValue::Registry::Registry::reg(), and Registry::theRegistry().

00034                                                                                       :
00035         m_flags(flags),
00036         m_fname(fname),
00037         m_argc(argc),
00038         m_ctor(ctor)
00039 {
00040     Registry::theRegistry().reg(this);
00041 }

Here is the call graph for this function:

vValue::Registry::Registration::Registration ( const char *  flags,
const char *  fname,
int  argc,
fptr  ctor 
)

Definition at line 43 of file vRegistry.cpp.

References m_flags, vValue::Registry::Registry::reg(), and Registry::theRegistry().

00043                                                                                    :
00044         m_fname(fname),
00045         m_argc(argc),
00046         m_ctor(ctor)
00047 {
00048     m_flags.clear();
00049     for (
00050         const char *ptr = flags, *ep;
00051         ptr;
00052         ptr = (ep[0] == '\0') ? 0 : (ep + 1)
00053     )
00054     {
00055         ep = strchr(ptr, '\n');
00056         if (!ep)
00057             ep = ptr + strlen(ptr);
00058         std::string s(ptr, ep - ptr);
00059         m_flags.push_back(s);
00060     }
00061     Registry::theRegistry().reg(this);
00062 }

Here is the call graph for this function:


Member Function Documentation

Expr::Base * vValue::Registry::Registration::use ( arglist  args  ) 

Definition at line 66 of file vRegistry.cpp.

References m_ctor.

00066                               {
00067     switch (args.size()) {
00068     case 0:     return ((ctor::a0*)m_ctor)();
00069     case 1:     return ((ctor::a1*)m_ctor)(args[0]);
00070     case 2:     return ((ctor::a2*)m_ctor)(args[0], args[1]);
00071     case 3:     return ((ctor::a3*)m_ctor)(args[0], args[1], args[2]);
00072     case 4:     return ((ctor::a4*)m_ctor)(args[0], args[1], args[2], args[3]);
00073     case 5:     return ((ctor::a5*)m_ctor)(args[0], args[1], args[2], args[3], args[4]);
00074     }
00075     throw("Unimplemented # of args");
00076 }

bool vValue::Registry::Registration::match ( std::vector< tString flags,
tString  fname,
int  argc 
)

Definition at line 79 of file vRegistry.cpp.

References tString::Compare(), m_argc, m_fname, and tString::SubStr().

00080 {
00081     if (fname.Compare(m_fname, true))
00082         return false;
00083     for (std::vector<tString>::iterator i = flags.begin(); i != flags.end(); ++i)
00084     {
00085         bool flagmatch = (flags[0] == "!");
00086         tString flag = *i;
00087         if (flagmatch)
00088             flag = flag.SubStr(1);
00089         if (!flag.Compare(*i, true))
00090             flagmatch = !flagmatch;
00091         if (!flagmatch)
00092             return false;
00093     }
00094     if (argc != m_argc)
00095         return false;
00096     return true;
00097 }

Here is the call graph for this function:


Member Data Documentation

std::vector<tString> vValue::Registry::Registration::m_flags [private]

Definition at line 53 of file vRegistry.h.

Referenced by Registration().

tString vValue::Registry::Registration::m_fname [private]

Definition at line 54 of file vRegistry.h.

Referenced by match().

int vValue::Registry::Registration::m_argc [private]

Definition at line 55 of file vRegistry.h.

Referenced by match().

fptr vValue::Registry::Registration::m_ctor [private]

Definition at line 56 of file vRegistry.h.

Referenced by use().


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 00:05:59 2008 for Armagetron Advanced by  doxygen 1.5.4