rtXmlKeyArray.h
Go to the documentation of this file.00001 /* 00002 * Copyright (c) 2014-2017 by Objective Systems, Inc. 00003 * 00004 * This software is furnished under a license and may be used and copied 00005 * only in accordance with the terms of such license and with the 00006 * inclusion of the above copyright notice. This software or any other 00007 * copies thereof may not be provided or otherwise made available to any 00008 * other person. No title to and ownership of the software is hereby 00009 * transferred. 00010 * 00011 * The information in this software is subject to change without notice 00012 * and should not be construed as a commitment by Objective Systems, Inc. 00013 * 00014 * PROPRIETARY NOTICE 00015 * 00016 * This software is an unpublished work subject to a confidentiality agreement 00017 * and is protected by copyright and trade secret law. Unauthorized copying, 00018 * redistribution or other use of this work is prohibited. 00019 * 00020 * The above notice of copyright on this source code product does not indicate 00021 * any actual or intended publication of such source code. 00022 * 00023 *****************************************************************************/ 00027 #ifndef _RTXMLKEYARRAY_H_ 00028 #define _RTXMLKEYARRAY_H_ 00029 00030 #include "rtxsrc/rtxContext.h" 00031 #include "rtxmlsrc/rtXmlExternDefs.h" 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 typedef enum { 00038 OSXSDString, OSXSDDecimal, 00039 OSXSDInt, OSXSDUInt 00040 } OSXSDFieldDataType; 00041 00042 /* OSXSDKeyRecord represents the values for the fields of a key */ 00043 typedef struct { 00044 /* tag: indicates the value space in which the value falls. For example, 00045 xsd:integer derives from xsd:decimal, so they fall in the same value space. 00046 Thus, tag will never be OSXSDInt. 00047 Represented using a OSXSDFieldDataType value. */ 00048 OSINT8 tag; 00049 00050 /* subTag: indicates the representation used for the value in u. 00051 When tag == OSXSDDecimal, this can be OSXSDDecimal, OSXSDInt, OSXSDUint. */ 00052 OSINT8 subTag; 00053 OSUINT16 dummy; /* alignment */ 00054 00055 union { 00056 OSINT32 int32; 00057 OSUINT32 uint32; 00058 const OSOCTET* pValue; 00059 } u; 00060 } OSXSDKeyRecord; 00061 00062 typedef struct { 00063 /* capacity: Current size of the array buffer. The actual size is always 00064 1 larger to allow for the first slot being dedicated to the new key. 00065 Thus, capacity really represents the "non dedicated" capacity. */ 00066 OSUINT32 capacity; 00067 OSUINT32 count; /* Number of keys in array */ 00068 OSUINT32 nmFields; /* Number of fields in each key */ 00069 00070 /* curField: Next value expected for fldNum parameter to rtXmlKeyArraySet* 00071 methods. First field is field 0. */ 00072 OSUINT32 curField; 00073 00074 /* data: An array of OSXSDKeyRecords. Each field value is represented as an 00075 OSXSDKeyRecord. A block of nmFields of these values forms an 00076 nmFields-tuple representing a single key. There are count many such 00077 blocks, representing count keys. 00078 The first key is reserved as the location for new keys being added ( 00079 all of the set methods update the fields for the first key). 00080 The keys from 1..count are kept in sorted order. */ 00081 OSXSDKeyRecord* data; 00082 00083 const char* name; /* Constrain name */ 00084 OSBOOL keyConstraint; /* Key or unique constraint */ 00085 OSINT8 duplicateField; /* Index of duplicated field; -1 = none */ 00086 OSINT8 absentField; /* Index of absent field; -1 = none */ 00087 } OSXSDKeyArray; 00088 00089 00100 EXTERNXML int rtXmlKeyArrayInit 00101 (OSCTXT* pctxt, OSXSDKeyArray* pArray, OSUINT32 nmFields, OSBOOL key, 00102 const char* name); 00103 00104 EXTERNXML void rtXmlKeyArrayFree 00105 (OSCTXT* pctxt, OSXSDKeyArray* pArray); 00106 00107 00108 /* rtXmlKeyArraySet* methods. 00109 * The values for each field of the key are expected to be set in order. 00110 * The implementation detects missing fields or repeated fields by watching 00111 * the sequence of fldNum values passed to each of the rtXmlKeyArraySet* 00112 * methods. 00113 */ 00114 00119 EXTERNXML void rtXmlKeyArraySetString 00120 (OSXSDKeyArray* pArray, const OSUTF8CHAR* pValue, OSUINT32 fldNum); 00121 00126 EXTERNXML void rtXmlKeyArraySetInt 00127 (OSXSDKeyArray* pArray, OSINT32 value, OSUINT32 fldNum); 00128 00133 EXTERNXML void rtXmlKeyArraySetUInt 00134 (OSXSDKeyArray* pArray, OSUINT32 value, OSUINT32 fldNum); 00135 00140 EXTERNXML void rtXmlKeyArraySetDecimal 00141 (OSXSDKeyArray* pArray, const OSREAL* value, OSUINT32 fldNum); 00142 00143 00153 EXTERNXML int rtXmlKeyArrayAdd 00154 (OSCTXT* pctxt, OSXSDKeyArray* pArray); 00155 00163 EXTERNXML int rtXmlKeyArrayContains 00164 (OSCTXT* pctxt, OSXSDKeyArray* pArray); 00165 00166 #ifdef __cplusplus 00167 } 00168 #endif 00169 00170 #endif