最近捣鼓一个开源的c程序,查看一个结构体,一层套一层的结构把人看的眼都晕了
多亏c++支持对象替代了c的结构体遍地跑
一下截取一部分大家欣赏下
typedef struct {
char *setname; /**< result set ID (input) */
int replace_set; /**< replace set indicator (input) */
int num_bases; /**< number of databases (input) */
char **basenames; /**< databases to search (input) */
Z_ReferenceId *referenceId;/**< reference ID (input) */
Z_Query *query; /**< query structure (input) */
ODR stream; /**< encode stream (input) */
ODR decode; /**< decode stream (input) */
ODR print; /**< print stream (input) */
bend_association association; /**< GFS association / session (input) */
Odr_int hits; /**< hits (output) */
int errcode; /**< Diagnostic code / 0 for no error (output) */
char *errstring; /**< Additional info (output) */
Z_OtherInformation *search_info; /**< extra search info result (output) */
char *srw_sortKeys; /**< SRU sortKeys info (input) */
char *srw_setname; /**< SRU generated resultsetID (output) */
int *srw_setnameIdleTime; /**< SRU result set idle time (output) */
int estimated_hit_count; /**< 1=estimated hits; 0=exact (output) */
int partial_resultset; /**< 1=partial results; 0=full (output)*/
Z_SRW_extra_arg *extra_args; /**< SRU extra request parameters (input) */
char *extra_response_data; /**< SRW extra XML response (output) */
Z_OtherInformation *search_input; /**< extra search info request (input) */
Odr_int present_number; /**< piggyback present number (>0) (input) */
} bend_search_rr;
struct Z_Query {
int which;
union {
void *type_0;
Z_RPNQuery *type_1;
Odr_oct *type_2;
Odr_oct *type_100;
Z_RPNQuery *type_101;
Odr_oct *type_102;
Z_External *type_104;
#define Z_Query_type_0 1
#define Z_Query_type_1 2
#define Z_Query_type_2 3
#define Z_Query_type_100 4
#define Z_Query_type_101 5
#define Z_Query_type_102 6
#define Z_Query_type_104 7
} u;
};
struct Z_RPNQuery {
Z_AttributeSetId *attributeSetId;
Z_RPNStructure *RPNStructure;
};
struct Z_RPNStructure {
int which;
union {
Z_Operand *simple;
Z_Complex *complex;
#define Z_RPNStructure_simple 1
#define Z_RPNStructure_complex 2
} u;
};
struct Z_Operand {
int which;
union {
Z_AttributesPlusTerm *attributesPlusTerm;
Z_ResultSetId *resultSetId;
Z_ResultSetPlusAttributes *resultAttr;
#define Z_Operand_APT 1
#define Z_Operand_resultSetId 2
#define Z_Operand_resultAttr 3
} u;
};
struct Z_Complex {
Z_RPNStructure *s1;
Z_RPNStructure *s2;
Z_Operator *roperator;
};
struct Z_AttributesPlusTerm {
Z_AttributeList *attributes;
Z_Term *term;
};
struct Z_AttributeList {
int num_attributes;
Z_AttributeElement **attributes;
};
struct Z_AttributeElement {
Z_AttributeSetId *attributeSet; /* OPT */
Odr_int *attributeType;
int which;
union {
Odr_int *numeric;
Z_ComplexAttribute *complex;
#define Z_AttributeValue_numeric 1
#define Z_AttributeValue_complex 2
} value;
};
struct Z_Term {
int which;
union {
Odr_oct *general;
Odr_int *numeric;
Z_InternationalString *characterString;
Odr_oid *oid;
char *dateTime;
Z_External *external;
Z_IntUnit *integerAndUnit;
Odr_null *null;
#define Z_Term_general 1
#define Z_Term_numeric 2
#define Z_Term_characterString 3
#define Z_Term_oid 4
#define Z_Term_dateTime 5
#define Z_Term_external 6
#define Z_Term_integerAndUnit 7
#define Z_Term_null 8
} u;
};
struct Z_AttributeElement {
Z_AttributeSetId *attributeSet; /* OPT */
Odr_int *attributeType;
int which;
union {
Odr_int *numeric;
Z_ComplexAttribute *complex;
#define Z_AttributeValue_numeric 1
#define Z_AttributeValue_complex 2
} value;
};
struct Z_ComplexAttribute {
int num_list;
Z_StringOrNumeric **list;
int num_semanticAction;
Odr_int **semanticAction; /* OPT */
};
struct Z_StringOrNumeric {
int which;
union {
Z_InternationalString *string;
Odr_int *numeric;
#define Z_StringOrNumeric_string 1
#define Z_StringOrNumeric_numeric 2
} u;
};
typedef __int64 nmem_int_t;
typedef nmem_int_t Odr_int;