MIDAS
Loading...
Searching...
No Matches
Param Class Reference

Public Member Functions

 Param ()
 
 ~Param ()
 
void initparam ()
 
void setparam (const char *param, const char *value)
 
void freeparam ()
 
void printparam ()
 
const char * getparam (const char *param)
 
std::string xgetparam (const char *param)
 
BOOL isparam (const char *param)
 
void unsetparam (const char *param)
 

Public Attributes

char _param [MAX_PARAM][PARAM_LENGTH]
 
char * _value [MAX_PARAM]
 
char _text [TEXT_SIZE]
 

Detailed Description

Definition at line 731 of file mhttpd.cxx.

Constructor & Destructor Documentation

◆ Param()

Param::Param ( )
inline

Definition at line 739 of file mhttpd.cxx.

740 {
741 initparam();
742 }
void initparam()
Definition mhttpd.cxx:749
Here is the call graph for this function:

◆ ~Param()

Param::~Param ( )
inline

Definition at line 744 of file mhttpd.cxx.

745 {
746 freeparam();
747 }
void freeparam()
Definition mhttpd.cxx:786
Here is the call graph for this function:

Member Function Documentation

◆ freeparam()

void Param::freeparam ( )
inline

Definition at line 786 of file mhttpd.cxx.

787 {
788 int i;
789
790 for (i=0 ; i<MAX_PARAM ; i++)
791 if (_value[i] != NULL) {
792 free(_value[i]);
793 _value[i] = NULL;
794 }
795 }
char * _value[MAX_PARAM]
Definition mhttpd.cxx:735
INT i
Definition mdump.cxx:32
#define MAX_PARAM
Definition mhttpd.cxx:727
Here is the caller graph for this function:

◆ getparam()

const char * Param::getparam ( const char *  param)
inline

Definition at line 806 of file mhttpd.cxx.

807 {
808 int i;
809
810 if (equal_ustring(param, "text"))
811 return _text;
812
813 for (i = 0; i < MAX_PARAM && _param[i][0]; i++)
815 break;
816
817 if (i == MAX_PARAM)
818 return NULL;
819
820 if (_value[i] == NULL)
821 return "";
822
823 return _value[i];
824 }
char _param[MAX_PARAM][PARAM_LENGTH]
Definition mhttpd.cxx:734
char _text[TEXT_SIZE]
Definition mhttpd.cxx:736
BOOL equal_ustring(const char *str1, const char *str2)
Definition odb.cxx:3285
char param[10][256]
Definition mana.cxx:250
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initparam()

void Param::initparam ( )
inline

Definition at line 749 of file mhttpd.cxx.

750 {
751 memset(_param, 0, sizeof(_param));
752 memset(_value, 0, sizeof(_value));
753 _text[0] = 0;
754 }
Here is the caller graph for this function:

◆ isparam()

BOOL Param::isparam ( const char *  param)
inline

Definition at line 835 of file mhttpd.cxx.

836 {
837 int i;
838
839 for (i = 0; i < MAX_PARAM && _param[i][0]; i++)
841 break;
842
843 if (i < MAX_PARAM && _param[i][0])
844 return TRUE;
845
846 return FALSE;
847 }
#define FALSE
Definition cfortran.h:309
#define TRUE
Definition midas.h:182
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printparam()

void Param::printparam ( )
inline

Definition at line 797 of file mhttpd.cxx.

798 {
799 int i;
800
801 for (i = 0; i < MAX_PARAM && _param[i][0]; i++) {
802 printf("param %d name [%s] value [%s]\n", i, _param[i], _value[i]);;
803 }
804 }

◆ setparam()

void Param::setparam ( const char *  param,
const char *  value 
)
inline

Definition at line 756 of file mhttpd.cxx.

757 {
758 int i;
759
760 if (equal_ustring(param, "text")) {
761 if (strlen(value) >= TEXT_SIZE)
762 printf("Error: parameter value too big\n");
763
764 mstrlcpy(_text, value, TEXT_SIZE);
765 _text[TEXT_SIZE - 1] = 0;
766 return;
767 }
768
769 for (i = 0; i < MAX_PARAM; i++)
770 if (_param[i][0] == 0)
771 break;
772
773 if (i < MAX_PARAM) {
774 mstrlcpy(_param[i], param, PARAM_LENGTH);
775
776 int size = strlen(value)+1;
777 _value[i] = (char*)malloc(size);
778 mstrlcpy(_value[i], value, size);
779 _value[i][strlen(value)] = 0;
780
781 } else {
782 printf("Error: parameter array too small\n");
783 }
784 }
#define PARAM_LENGTH
Definition mhttpd.cxx:728
#define TEXT_SIZE
Definition mhttpd.cxx:729
double value[100]
Definition odbhist.cxx:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsetparam()

void Param::unsetparam ( const char *  param)
inline

Definition at line 849 of file mhttpd.cxx.

850 {
851 int i;
852
853 for (i = 0; i < MAX_PARAM; i++)
855 break;
856
857 if (i < MAX_PARAM) {
858 _param[i][0] = 0;
859 _value[i][0] = 0;
860 }
861 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xgetparam()

std::string Param::xgetparam ( const char *  param)
inline

Definition at line 826 of file mhttpd.cxx.

827 {
828 const char* s = getparam(param);
829 if (s)
830 return s;
831 else
832 return "";
833 }
const char * getparam(const char *param)
Definition mhttpd.cxx:806
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _param

char Param::_param[MAX_PARAM][PARAM_LENGTH]

Definition at line 734 of file mhttpd.cxx.

◆ _text

char Param::_text[TEXT_SIZE]

Definition at line 736 of file mhttpd.cxx.

◆ _value

char* Param::_value[MAX_PARAM]

Definition at line 735 of file mhttpd.cxx.


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