1 /* @include ajtagval ********************************************************** 2 ** 3 ** Handling of tag-value pairs of strings 4 ** 5 ** @author Copyright (C) 2011 Peter Rice 6 ** @version $Revision: 1.2 $ 7 ** @modified $Date: 2012/06/26 13:03:59 $ by $Author: rice $ 8 ** @@ 9 ** 10 ** This library is free software; you can redistribute it and/or 11 ** modify it under the terms of the GNU Lesser General Public 12 ** License as published by the Free Software Foundation; either 13 ** version 2.1 of the License, or (at your option) any later version. 14 ** 15 ** This library 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 GNU 18 ** Lesser General Public License for more details. 19 ** 20 ** You should have received a copy of the GNU Lesser General Public 21 ** License along with this library; if not, write to the Free Software 22 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 ** MA 02110-1301, USA. 24 ******************************************************************************/ 25 26 #ifndef AJTAGVAL_H 27 #define AJTAGVAL_H 28 29 30 31 32 /* ========================================================================= */ 33 /* ============================= include files ============================= */ 34 /* ========================================================================= */ 35 36 #include "ajdefine.h" 37 #include "ajstr.h" 38 39 AJ_BEGIN_DECLS 40 41 42 43 44 /* ========================================================================= */ 45 /* =============================== constants =============================== */ 46 /* ========================================================================= */ 47 48 49 50 51 /* ========================================================================= */ 52 /* ============================== public data ============================== */ 53 /* ========================================================================= */ 54 55 56 57 58 /* @data AjPTagval ************************************************************ 59 ** 60 ** General tag values data structure 61 ** 62 ** @alias AjSTagval 63 ** @alias AjOTagval 64 ** 65 ** @attr Tag [AjPStr] Tag name usually from a controlled internal vocabulary 66 ** @attr Value [AjPStr] Tag value 67 ** @@ 68 ******************************************************************************/ 69 70 typedef struct AjSTagval 71 { 72 AjPStr Tag; 73 AjPStr Value; 74 } AjOTagval; 75 76 #define AjPTagval AjOTagval* 77 78 79 80 81 /* ========================================================================= */ 82 /* =========================== public functions ============================ */ 83 /* ========================================================================= */ 84 85 86 87 88 /* 89 ** Prototype definitions 90 */ 91 92 AjPTagval ajTagvalNewC(const char* tag, const char* value); 93 AjPTagval ajTagvalNewS(const AjPStr tag, const AjPStr value); 94 void ajTagvalDel(AjPTagval *Ptagval); 95 const AjPStr ajTagvalGetTag(const AjPTagval tagval); 96 const AjPStr ajTagvalGetValue(const AjPTagval tagval); 97 void ajTagvalFmtLower(AjPTagval tagval); 98 void ajTagvalFmtUpper(AjPTagval tagval); 99 void ajTagvalAppendC(AjPTagval tagval, const char* txt); 100 void ajTagvalAppendS(AjPTagval tagval, const AjPStr str); 101 void ajTagvalReplaceC(AjPTagval tagval, const char* txt); 102 void ajTagvalReplaceS(AjPTagval tagval, const AjPStr str); 103 104 #define MAJTAGVALGETTAG(tagval) ((tagval) ? (tagval)->Tag : NULL) 105 #define MAJTAGVALGETVALUE(tagval) ((tagval) ? (tagval)->Value : NULL) 106 107 /* 108 ** End of prototype definitions 109 */ 110 111 #ifdef AJ_COMPILE_DEPRECATED_BOOK 112 #endif /* AJ_COMPILE_DEPRECATED_BOOK */ 113 114 #ifdef AJ_COMPILE_DEPRECATED 115 116 #endif /* AJ_COMPILE_DEPRECATED */ 117 118 119 120 121 AJ_END_DECLS 122 123 #endif /* AJTAGVAL_H */ 124