| 1 | // ==================================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : ad_config.h // |
|---|
| 4 | // Purpose : Read/write editor configurations // |
|---|
| 5 | // // |
|---|
| 6 | // // |
|---|
| 7 | // Coded by Ralf Westram (coder@reallysoft.de) in May 2005 // |
|---|
| 8 | // Copyright Department of Microbiology (Technical University Munich) // |
|---|
| 9 | // // |
|---|
| 10 | // Visit our web site at: http://www.arb-home.de/ // |
|---|
| 11 | // // |
|---|
| 12 | // ==================================================================== // |
|---|
| 13 | |
|---|
| 14 | #ifndef AD_CONFIG_H |
|---|
| 15 | #define AD_CONFIG_H |
|---|
| 16 | |
|---|
| 17 | #ifndef ARBDB_BASE_H |
|---|
| 18 | #include "arbdb_base.h" |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | #define CONFIG_DATA_PATH "configuration_data" |
|---|
| 22 | #define CONFIG_ITEM "configuration" |
|---|
| 23 | |
|---|
| 24 | GBDATA *GBT_find_configuration(GBDATA *gb_main, const char *name); |
|---|
| 25 | GBDATA *GBT_create_configuration(GBDATA *gb_main, const char *name); |
|---|
| 26 | |
|---|
| 27 | void GBT_get_configuration_names(struct ConstStrArray& configNames, GBDATA *gb_main); |
|---|
| 28 | |
|---|
| 29 | struct GBT_config { |
|---|
| 30 | char *top_area; |
|---|
| 31 | char *middle_area; |
|---|
| 32 | }; |
|---|
| 33 | |
|---|
| 34 | GBT_config *GBT_load_configuration_data(GBDATA *gb_main, const char *name, GB_ERROR *error); |
|---|
| 35 | void GBT_free_configuration_data(GBT_config *data); |
|---|
| 36 | GB_ERROR GBT_save_configuration_data(GBT_config *data, GBDATA *gb_main, const char *name); |
|---|
| 37 | |
|---|
| 38 | enum GBT_CONFIG_ITEM_TYPE { |
|---|
| 39 | CI_UNKNOWN = 1, |
|---|
| 40 | CI_GROUP = 2, |
|---|
| 41 | CI_FOLDED_GROUP = 4, |
|---|
| 42 | CI_SPECIES = 8, |
|---|
| 43 | CI_SAI = 16, |
|---|
| 44 | CI_CLOSE_GROUP = 32, |
|---|
| 45 | CI_END_OF_CONFIG = 64, |
|---|
| 46 | }; |
|---|
| 47 | |
|---|
| 48 | struct GBT_config_item { |
|---|
| 49 | GBT_CONFIG_ITEM_TYPE type; |
|---|
| 50 | char *name; |
|---|
| 51 | }; |
|---|
| 52 | |
|---|
| 53 | struct GBT_config_parser { |
|---|
| 54 | char *config_string; |
|---|
| 55 | int parse_pos; |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | GBT_config_parser *GBT_start_config_parser(const char *config_string); |
|---|
| 59 | void GBT_free_config_parser(GBT_config_parser *parser); |
|---|
| 60 | |
|---|
| 61 | GB_ERROR GBT_parse_next_config_item(GBT_config_parser *parser, GBT_config_item *item); |
|---|
| 62 | void GBT_append_to_config_string(const GBT_config_item *item, struct GBS_strstruct *strstruct); |
|---|
| 63 | |
|---|
| 64 | GBT_config_item *GBT_create_config_item(); |
|---|
| 65 | void GBT_free_config_item(GBT_config_item *item); |
|---|
| 66 | |
|---|
| 67 | #if defined(DEBUG) |
|---|
| 68 | void GBT_test_config_parser(GBDATA *gb_main); |
|---|
| 69 | #endif // DEBUG |
|---|
| 70 | |
|---|
| 71 | #else |
|---|
| 72 | #error ad_config.h included twice |
|---|
| 73 | #endif // AD_CONFIG_H |
|---|
| 74 | |
|---|