1 /***************************************
2 $Header: /home/amb/routino/src/RCS/tagging.h,v 1.2 2010/05/23 10:18:59 amb Exp $
4 The data types for the tagging rules.
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2010 Andrew M. Bishop
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Affero General Public License for more details.
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
25 #define TAGGING_H /*+ To stop multiple inclusions. +*/
30 /*+ A structure to contain the tagging action. +*/
31 typedef struct _TaggingAction
33 int output; /*+ A flag to indicate if the output tags or input tags are to be changed. +*/
35 char *k; /*+ The tag key (or NULL). +*/
36 char *v; /*+ The tag value (or NULL). +*/
41 /*+ A structure to contain the tagging rule. +*/
42 typedef struct _TaggingRule
44 char *k; /*+ The tag key (or NULL). +*/
45 char *v; /*+ The tag value (or NULL). +*/
47 TaggingAction *actions; /*+ The actions to take. +*/
48 int nactions; /*+ The number of actions. +*/
53 /*+ A structure to contain the list of rules and associated information. +*/
54 typedef struct _TaggingRuleList
56 TaggingRule *rules; /*+ The array of rules. +*/
57 int nrules; /*+ The number of rules. +*/
62 /*+ A structure to hold a list of tags to be processed. +*/
63 typedef struct _TagList
65 int ntags; /*+ The number of tags. +*/
67 char **k; /*+ The list of tag keys. +*/
68 char **v; /*+ The list of tag values. +*/
75 extern TaggingRuleList NodeRules;
76 extern TaggingRuleList WayRules;
77 extern TaggingRuleList RelationRules;
82 int ParseXMLTaggingRules(const char *filename);
84 TaggingRule *AppendTaggingRule(TaggingRuleList *rules,const char *k,const char *v);
85 void AppendTaggingAction(TaggingRule *rule,const char *k,const char *v,int output);
87 TagList *NewTagList(void);
88 void AppendTag(TagList *tags,const char *k,const char *v);
89 void ModifyTag(TagList *tags,const char *k,const char *v);
90 void DeleteTagList(TagList *tags);
92 TagList *ApplyTaggingRules(TaggingRuleList *rules,TagList *tags);
95 #endif /* TAGGING_H */