Project

Profile

Help

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

he / src / main / c / Saxon.C.API / SaxonApiException.cpp @ 01d6fdb6

1
// SaxonApiException.cpp : Defines the exported functions for the DLL application.
2
//
3

    
4
#include "SaxonApiException.h"
5

    
6

    
7
#ifdef MEM_DEBUG
8
#define new new(__FILE__, __LINE__)
9
#endif
10

    
11
  const char * SaxonApiException::what () {
12
        return message.c_str();
13
  }
14

    
15
  SaxonApiException::SaxonApiException(){
16
            message = "";
17
            lineNumber = -1;
18
            errorCode = "";
19
            systemId = "";
20
    }
21

    
22

    
23
        SaxonApiException::SaxonApiException(const SaxonApiException &ex){
24
                message = ex.message;
25
                lineNumber = ex.lineNumber;
26
                errorCode = ex.errorCode;
27
                systemId = ex.systemId;
28
        }
29

    
30

    
31
SaxonApiException::SaxonApiException(const char * m){
32
    if(m != nullptr) {
33
        message = std::string(m);
34
    } else {
35
        message = "";
36
    }
37

    
38
    lineNumber = -1;
39
    errorCode = "";
40
    systemId = "";
41

    
42
}
43

    
44

    
45
        SaxonApiException::SaxonApiException(const char * m, const char * ec, const char * sysId, int linenumber){
46
                if(m != nullptr) {
47
                    message = std::string(m);
48
                } else {
49
                    message = "";
50
                }
51

    
52
        lineNumber = linenumber;
53

    
54
        if (ec != nullptr) {
55
            errorCode = std::string(ec);
56
        } else {
57
            errorCode = "";
58
        }
59

    
60
        if(sysId != nullptr) {
61
            systemId = sysId;
62
        } else {
63
            systemId = "";
64
        }
65
        }
66

    
67

    
68

    
69

    
70
    /**
71
     * A destructor.
72
     */
73
        SaxonApiException::~SaxonApiException() noexcept {
74
            std::cerr<<"SaxonApiException destructor called"<<std::endl;
75
        message.clear();
76
        errorCode.clear();
77
        systemId.clear();
78
        }
79

    
80
    /**
81
     * Get the error code associated with the ith exception in the vector, if there is one
82
     * @param i - ith exception in the vector
83
     * @return the associated error code, or nullptr if no error code is available
84
     */
85
        const char * SaxonApiException::getErrorCode(){
86
                return errorCode.c_str();
87
        }
88

    
89

    
90
        int SaxonApiException::getLineNumber(){
91
        return lineNumber;
92
        }
93

    
94

    
95
    const char * SaxonApiException::getSystemId() {
96
        return systemId.c_str();
97
    }
98

    
99
        const char * SaxonApiException::getMessage(){
100
            return message.c_str();
101

    
102
        }
(5-5/56)