.TH "sc::KeyVal" 3 "Sun Oct 4 2020" "Version 2.3.1" "MPQC" \" -*- nroff -*- .ad l .nh .SH NAME sc::KeyVal \- The \fBKeyVal\fP class is designed to simplify the process of allowing a user to specify keyword/value associations to a C++ program\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBsc::RefCount\fP\&. .PP Inherited by \fBsc::AggregateKeyVal\fP, \fBsc::AssignedKeyVal\fP, \fBsc::PrefixKeyVal\fP, and \fBsc::StringKeyVal\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum { \fBMaxKeywordLength\fP = 256 }" .br .ti -1c .RI "enum \fBKeyValError\fP { \fBOK\fP, \fBHasNoValue\fP, \fBWrongType\fP, \fBUnknownKeyword\fP, \fBOperationFailed\fP }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "int \fBexists\fP (const char *)" .br .RI "This takes as its only argument a keyword\&. " .ti -1c .RI "int \fBcount\fP (const char *=0)" .br .RI "If the value of a keyword is an array, then return its length\&. " .ti -1c .RI "\fBRef\fP< \fBKeyValValue\fP > \fBvalue\fP (const char *=0, const \fBKeyValValue\fP &def=\fBKeyValValue\fP())" .br .RI "Return the value associated with the keyword\&. " .ti -1c .RI "int \fBbooleanvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValueboolean\fP())" .br .RI "Returns the boolean value (0 = false, 1 = true) of key\&. " .ti -1c .RI "double \fBdoublevalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuedouble\fP())" .br .RI "Returns the double value of key\&. " .ti -1c .RI "float \fBfloatvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuefloat\fP())" .br .RI "Returns the float value of key\&. " .ti -1c .RI "char \fBcharvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuechar\fP())" .br .RI "Returns the char value of key\&. " .ti -1c .RI "int \fBintvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValueint\fP())" .br .RI "Returns the int value of key\&. " .ti -1c .RI "size_t \fBsizevalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuesize\fP())" .br .RI "Returns the size_t value of key\&. " .ti -1c .RI "char * \fBpcharvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuepchar\fP())" .br .RI "Returns a copy of the string representation of the key's value\&. " .ti -1c .RI "std::string \fBstringvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValuestring\fP())" .br .RI "Returns a string representation of the key's value\&. " .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBdescribedclassvalue\fP (const char *key=0, const \fBKeyValValue\fP &def=\fBKeyValValueRefDescribedClass\fP())" .br .RI "Returns a reference to an object of type \fBDescribedClass\fP\&. " .in -1c .PP .RI "\fBReading Vectors\&.\fP" .br These members correspond to the above members, but take an additional integer argument, i, which is a vector index\&. .PP This is equivalent to getting a value for a keyword named 'key:i'\&. The routines that do not take key arguments get the value for the keyword named 'i'\&. .PP .in +1c .in +1c .ti -1c .RI "int \fBexists\fP (const char *key, int i)" .br .ti -1c .RI "int \fBcount\fP (const char *key, int i)" .br .ti -1c .RI "int \fBbooleanvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValueboolean\fP())" .br .ti -1c .RI "double \fBdoublevalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuedouble\fP())" .br .ti -1c .RI "float \fBfloatvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuefloat\fP())" .br .ti -1c .RI "char \fBcharvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuechar\fP())" .br .ti -1c .RI "int \fBintvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValueint\fP())" .br .ti -1c .RI "size_t \fBsizevalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuesize\fP())" .br .ti -1c .RI "char * \fBpcharvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuepchar\fP())" .br .ti -1c .RI "std::string \fBstringvalue\fP (const char *key, int i, const \fBKeyValValue\fP &def=\fBKeyValValuestring\fP())" .br .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBdescribedclassvalue\fP (const char *key, int, const \fBKeyValValue\fP &def=\fBKeyValValueRefDescribedClass\fP())" .br .ti -1c .RI "int \fBexists\fP (int i)" .br .ti -1c .RI "int \fBcount\fP (int i)" .br .ti -1c .RI "int \fBbooleanvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValueboolean\fP())" .br .ti -1c .RI "double \fBdoublevalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuedouble\fP())" .br .ti -1c .RI "float \fBfloatvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuefloat\fP())" .br .ti -1c .RI "char \fBcharvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuechar\fP())" .br .ti -1c .RI "int \fBintvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValueint\fP())" .br .ti -1c .RI "size_t \fBsizevalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuesize\fP())" .br .ti -1c .RI "char * \fBpcharvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuepchar\fP())" .br .ti -1c .RI "std::string \fBstringvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValuestring\fP())" .br .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBdescribedclassvalue\fP (int i, const \fBKeyValValue\fP &def=\fBKeyValValueRefDescribedClass\fP())" .br .in -1c .in -1c .PP .RI "\fBReading 2D Arrays\&.\fP" .br These members correspond to the above members, but take additional integer arguments, i and j, which is an array index\&. .PP This is equivalent to getting a value for a keyword named 'key:i:j'\&. The routines that do not take key arguments get the value for the keyword named 'i:j'\&. .br .PP .in +1c .in +1c .ti -1c .RI "int \fBexists\fP (const char *, int, int)" .br .ti -1c .RI "int \fBcount\fP (const char *, int, int)" .br .ti -1c .RI "int \fBbooleanvalue\fP (const char *, int, int, const \fBKeyValValue\fP &def=\fBKeyValValueboolean\fP())" .br .ti -1c .RI "double \fBdoublevalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuedouble\fP())" .br .ti -1c .RI "float \fBfloatvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuefloat\fP())" .br .ti -1c .RI "char \fBcharvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuechar\fP())" .br .ti -1c .RI "int \fBintvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValueint\fP())" .br .ti -1c .RI "size_t \fBsizevalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuesize\fP())" .br .ti -1c .RI "char * \fBpcharvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuepchar\fP())" .br .ti -1c .RI "std::string \fBstringvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValuestring\fP())" .br .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBdescribedclassvalue\fP (const char *key, int, int, const \fBKeyValValue\fP &def=\fBKeyValValueRefDescribedClass\fP())" .br .ti -1c .RI "int \fBexists\fP (int i, int j)" .br .ti -1c .RI "int \fBcount\fP (int i, int j)" .br .ti -1c .RI "int \fBbooleanvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValueboolean\fP())" .br .ti -1c .RI "double \fBdoublevalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuedouble\fP())" .br .ti -1c .RI "float \fBfloatvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuefloat\fP())" .br .ti -1c .RI "char \fBcharvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuechar\fP())" .br .ti -1c .RI "int \fBintvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValueint\fP())" .br .ti -1c .RI "size_t \fBsizevalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuesize\fP())" .br .ti -1c .RI "char * \fBpcharvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuepchar\fP())" .br .ti -1c .RI "std::string \fBstringvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValuestring\fP())" .br .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBdescribedclassvalue\fP (int i, int j, const \fBKeyValValue\fP &def=\fBKeyValValueRefDescribedClass\fP())" .br .in -1c .in -1c .PP .RI "\fBReading 3D Arrays\&.\fP" .br These members correspond to the above members, but can be used to read in arrays with more than two dimensions\&. .PP The nindex argument is the number of indices in the array\&. It is followed by an int giving the value of each index\&. .br .PP .in +1c .in +1c .ti -1c .RI "int \fBVa_exists\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "int \fBVa_count\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "int \fBVa_booleanvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "double \fBVa_doublevalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "float \fBVa_floatvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "char \fBVa_charvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "int \fBVa_intvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "size_t \fBVa_sizevalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "char * \fBVa_pcharvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "std::string \fBVa_stringvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "\fBRef\fP< \fBDescribedClass\fP > \fBVa_describedclassvalue\fP (const char *key, int nindex,\&.\&.\&.)" .br .ti -1c .RI "KeyValError \fBerror\fP ()" .br .RI "Return the current error condition\&. " .ti -1c .RI "const char * \fBerrormsg\fP (KeyValError err)" .br .RI "Return a textual representation of err\&. " .ti -1c .RI "const char * \fBerrormsg\fP ()" .br .RI "Return a textual representation of the current error\&. " .ti -1c .RI "virtual void \fBerrortrace\fP (std::ostream &fp=\fBExEnv::err0\fP())" .br .RI "Write a message to fp describing the error\&. " .ti -1c .RI "virtual void \fBdump\fP (std::ostream &fp=\fBExEnv::err0\fP())" .br .RI "Write a message to fp describing the error\&. " .ti -1c .RI "virtual void \fBprint_unseen\fP (std::ostream &fp=\fBExEnv::out0\fP())" .br .RI "Print keywords that were never looked at, if possible\&. " .ti -1c .RI "virtual int \fBhave_unseen\fP ()" .br .RI "Return 1 if there were unseen keywords, 0 if there are none, or -1 this keyval doesn't keep track of unseen keywords\&. " .ti -1c .RI "void \fBverbose\fP (int v)" .br .RI "Control printing of assignments\&. " .ti -1c .RI "int \fBverbose\fP () const" .br .RI "Returns nonzero if assignments are printed\&. " .in -1c .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "void \fBseterror\fP (KeyValError err)" .br .RI "Set the current error condition\&. " .ti -1c .RI "void \fBseterror\fP (KeyValValue::KeyValValueError err)" .br .RI "Set the current error condition\&. " .ti -1c .RI "virtual int \fBkey_exists\fP (const char *)=0" .br .RI "Ultimately called by exists\&. " .ti -1c .RI "virtual int \fBkey_count\fP (const char *=0)" .br .RI "Ultimately called by count\&. " .ti -1c .RI "virtual \fBRef\fP< \fBKeyValValue\fP > \fBkey_value\fP (const char *, const \fBKeyValValue\fP &def)=0" .br .RI "Ultimately called by value\&. " .ti -1c .RI "virtual int \fBkey_booleanvalue\fP (const char *, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by booleanvalue\&. " .ti -1c .RI "virtual double \fBkey_doublevalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by doublevalue\&. " .ti -1c .RI "virtual float \fBkey_floatvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by floatvalue\&. " .ti -1c .RI "virtual char \fBkey_charvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by charvalue\&. " .ti -1c .RI "virtual int \fBkey_intvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by intvalue\&. " .ti -1c .RI "virtual size_t \fBkey_sizevalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by sizevalue\&. " .ti -1c .RI "virtual char * \fBkey_pcharvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by pcharvalue\&. " .ti -1c .RI "virtual std::string \fBkey_stringvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by stringvalue\&. " .ti -1c .RI "virtual \fBRef\fP< \fBDescribedClass\fP > \fBkey_describedclassvalue\fP (const char *key, const \fBKeyValValue\fP &def)" .br .RI "Ultimately called by describedclassvalue\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "int \fBverbose_\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "class \fBAggregateKeyVal\fP" .br .ti -1c .RI "class \fBPrefixKeyVal\fP" .br .in -1c .SH "Detailed Description" .PP The \fBKeyVal\fP class is designed to simplify the process of allowing a user to specify keyword/value associations to a C++ program\&. A flexible input style and ease of use for the programmer is achieved with this method\&. Keywords are represented by null terminated character arrays\&. The keywords are organized hierarchially, in a manner similar to the way that many file systems are organized\&. One character is special, ':', which is used to separate the various hierarchial labels, which are referred to as 'segments', in the keyword\&. .PP A convention for specifying arrays is provided by \fBKeyVal\fP\&. Each index of the array is given by appending a segment containing the character representation of the index\&. Thus, 'array:3:4' would be a the keyword corresponding to fourth row and fifth column of 'array', since indexing starts at zero\&. .PP To allow the \fBKeyVal\fP class to have associations that can represent data for classes, the keyword can be associated with a class as well as a value\&. This permits polymorphic data to be unambiguously represented by keyword/value associations\&. Most use of \fBKeyVal\fP need not be concerned with this\&. .SH "Member Function Documentation" .PP .SS "int sc::KeyVal::count (const char * = \fC0\fP)" .PP If the value of a keyword is an array, then return its length\&. If no arguments are given then the top level will be checked to see if it is an array and, if so, the number of elements will be counted\&. .SS "int sc::KeyVal::exists (const char *)" .PP This takes as its only argument a keyword\&. Returns 1 if the keyword has a value and 0 otherwise\&. .SS "char* sc::KeyVal::pcharvalue (const char * key = \fC0\fP, const \fBKeyValValue\fP & def = \fC\fBKeyValValuepchar\fP()\fP)" .PP Returns a copy of the string representation of the key's value\&. Storage for the copy is obtained with new\&. .SH "Author" .PP Generated automatically by Doxygen for MPQC from the source code\&.