Project

Profile

Help

How to connect?
Download (5.09 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / SaxonCXPath.h @ 9e416749

1
#ifndef SAXONCXPATH_H 
2
#define SAXONCXPATH_H
3

    
4
#include "SaxonCProcessor.h"
5

    
6

    
7
//===============================================================================================//
8

    
9
/*! <code>sxnc_value</code>. This struct is used to capture the xdmvalue and its type information.
10
 * <p/>
11
 */
12
typedef struct {
13
                jobject xdmvalue;
14
        } sxnc_value;
15

    
16
EXTERN_SAXONC
17
    /**
18
     * Create boxed Boolean value
19
     * @param val - boolean value
20
     */
21

    
22
jobject booleanValue(sxnc_environment* environi, bool);
23

    
24

    
25
    /**
26
     * Create an boxed Integer value
27
     * @param val - int value
28
     */
29

    
30
jobject integerValue(sxnc_environment* environi, int i);
31

    
32

    
33
    /**
34
     * Create an boxed Double value
35
     * @param val - double value
36
     */
37

    
38
jobject doubleValue(sxnc_environment* environi, double d);
39

    
40

    
41
    /**
42
     * Create an boxed Float value
43
     * @param val - float value
44
     */
45

    
46
jobject floatValue(sxnc_environment *environi, float f);
47

    
48

    
49
    /**
50
     * Create an boxed Long value
51
     * @param val - Long value
52
     */
53

    
54
jobject longValue(sxnc_environment *environi, long l);
55

    
56

    
57
    /**
58
     * Create an boxed String value
59
     * @param val - as char array value
60
     */
61

    
62
jobject getJavaStringValue(sxnc_environment *environi, const char *str);
63

    
64
    /**
65
     * A Constructor. Create a XdmValue based on the target type. Conversion is applied if possible
66
     * @param type - specify target type of the value  
67
     * @param val - Value to convert
68
     */
69

    
70
jobject xdmValueAsObj(sxnc_environment *environi, const char* type, const char* str);
71

    
72
    /**
73
     * A Constructor. Create a XdmValue based on the target type. Conversion is applied if possible
74
     * @param type - specify target type of the value  
75
     * @param val - Value to convert
76
     */
77

    
78
sxnc_value * xdmValue(sxnc_environment *environi, const char* type, const char* str);
79

    
80

    
81
    /**
82
     * Compile and evaluate an XPath expression, supplied as a character string, with properties and parameters required
83
     * by the XPath expression
84
     * @param cwd  - Current working directory
85
     * @param xpathStr  - A string containing the source text of the XPath expression
86
     * @param params - Parameters and properties names required by the XPath expression. This could contain the context node , source as string or file name, etc
87
     * @param values -  The values for the parameters and properties required by the XPath expression
88
    **/
89

    
90
sxnc_value * evaluate(sxnc_environment *environi, sxnc_processor ** proc, char * cwd, char * xpathStr, sxnc_parameter *parameters, sxnc_property * properties, int parLen, int propLen);
91

    
92

    
93
    /**
94
     * Evaluate the XPath expression, returning the effective boolean value of the result.
95
     *
96
     * @param cwd  - Current working directory
97
     * @param xpathStr  - A string containing the source text of the XPath expression
98
     * @param params - Parameters and properties names required by the XPath expression. This could contain the context node , source as string or file name, etc
99
     * @param values -  The values for the parameters and properties required by the XPath expression
100
     *
101
     *
102
     **/
103

    
104
bool effectiveBooleanValue(sxnc_environment* environi, sxnc_processor ** proc, char * cwd, char * xpathStr, sxnc_parameter *parameters, sxnc_property * properties, int parLen, int propLen);
105

    
106

    
107
    /**
108
     * Determine whether the item is an atomic value or a node
109
     *
110
     * @return true if the item is an atomic value, false if it is a node
111
     */
112

    
113
bool isAtomicValue(sxnc_environment *environi, sxnc_value value);
114

    
115

    
116
    /**
117
     * Get the number of items in the sequence
118
     *
119
     * @return the number of items in the value - always one
120
     */
121

    
122

    
123
int size(sxnc_environment *environi, sxnc_value val);
124

    
125

    
126
    /**
127
     * Get the n'th item in the value, counting from zero.
128
     *
129
     * @param n the item that is required, counting the first item in the sequence as item zero
130
     * @return the n'th item in the sequence making up the value, counting from zero
131
     */
132

    
133
sxnc_value * itemAt(sxnc_environment *environi, sxnc_value, int i);
134

    
135

    
136

    
137
jobject getvalue(sxnc_environment *environi, sxnc_value);
138

    
139

    
140
   /**
141
     * Get the string value of the item. For a node, this gets the string value
142
     * of the node. For an atomic value, it has the same effect as casting the value
143
     * to a string. In all cases the result is the same as applying the XPath string()
144
     * function.
145
    **/
146

    
147
const char * getStringValue(sxnc_environment *environi, sxnc_value value);
148

    
149

    
150
    /** 
151
    *Get the integer value of the item. if the XdmItem is not castable to an integer then
152
     * @param sxnc_value - Value to convert to integer
153
     * @failure_value - If the Value is not an integer then we can specify the value to return. Default is zero.
154
     *
155
    **/
156

    
157
int getIntegerValue(sxnc_environment *environi, sxnc_value value, int failure_value);
158

    
159

    
160

    
161
bool getBooleanValue(sxnc_environment *environi, sxnc_value value);
162

    
163

    
164

    
165
long getLongValue(sxnc_environment *environi, sxnc_value value,  long failureVal);
166

    
167

    
168

    
169
float getFloatValue(sxnc_environment *environi, sxnc_value value, float failureVal);
170

    
171

    
172

    
173
double getDoubleValue(sxnc_environment *environi, sxnc_value value, double failureVal);
174

    
175

    
176
EXTERN_SAXONC_END
177

    
178

    
179

    
180
#endif 
(12-12/55)