Project

Profile

Help

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

he / src / main / c / Saxon.C.API / XdmMap.h @ 03fcd3f9

1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2020 Saxonica Limited.
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7

    
8
#ifndef SAXON_XDM_MAP_h
9
#define SAXON_XDM_MAP_h
10

    
11

    
12
#include "XdmFunctionItem.h"
13
#include <string>
14

    
15
#include <stdlib.h>
16
#include <string.h>
17
#include <map>
18
#include <set>
19

    
20
class XdmMap : public XdmFunctionItem {
21

    
22
public:
23

    
24
    XdmMap();
25

    
26
    XdmMap(const XdmMap &d);
27

    
28

    
29
    virtual ~XdmMap(){
30
        //std::cerr<<"destructor called for XdmMap"<<std::endl;
31

    
32
    }
33

    
34
    XdmMap(jobject);
35

    
36
    XdmMap(std::map<XdmAtomicValue *, XdmValue*> value);
37

    
38
    int mapSize();
39

    
40
    XdmValue * get(XdmAtomicValue* key);
41

    
42
    XdmValue * get(const char * key);
43

    
44
    XdmValue * get(int key);
45

    
46
    XdmValue * get(double key);
47

    
48
    XdmValue *  get(long key);
49

    
50
    XdmMap * put(XdmAtomicValue * key, XdmValue * value);
51

    
52
    XdmMap * remove(XdmAtomicValue* key);
53

    
54
    std::set<XdmAtomicValue*> keySet();
55

    
56
    //std::map<XdmAtomicValue*, XdmValue*> asMap();
57

    
58
    bool isEmpty();
59

    
60
    bool containsKey(XdmAtomicValue* key);
61

    
62
    std::list<XdmValue*> values();
63

    
64
    /**
65
     * Determine whether the item is a function or some other type of item
66
     *
67
     * @return true if the item is a Xdm function item, false if it is an atomic value or a function (including maps and arrays)
68
     */
69
    bool isFunction(){
70
        return true;
71
    }
72

    
73
        /**
74
        * Get the type of the object
75
        */
76
        XDM_TYPE getType() {
77
                return XDM_FUNCTION_ITEM;
78
        }
79

    
80

    
81
private:
82

    
83

    
84
    std::string fname;
85
    std::map<XdmAtomicValue *, XdmValue*> data;
86
    int arity;
87

    
88
};
89

    
90

    
91

    
92

    
93
#endif
(32-32/55)