Project

Profile

Help

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

he / src / main / c / Saxon.C.API / SaxonApiException.cpp @ 03fcd3f9

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

    
4
#include "SaxonApiException.h"
5

    
6

    
7

    
8
  const char * SaxonApiException::what () {
9
        return message.c_str();
10
  }
11

    
12
  SaxonApiException::SaxonApiException(){
13
            message = "";
14
            lineNumber = -1;
15
            errorCode = "";
16
            systemId = "";
17
    }
18

    
19

    
20
        SaxonApiException::SaxonApiException(const SaxonApiException &ex){
21
                message = ex.message;
22
                lineNumber = ex.lineNumber;
23
                errorCode = ex.errorCode;
24
                systemId = ex.systemId;
25
        }
26

    
27

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

    
35
    lineNumber = -1;
36
    errorCode = "";
37
    systemId = "";
38

    
39
}
40

    
41

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

    
49
        lineNumber = linenumber;
50

    
51
        if (ec != nullptr) {
52
            errorCode = std::string(ec);
53
        } else {
54
            errorCode = "";
55
        }
56

    
57
        if(sysId != nullptr) {
58
            systemId = sysId;
59
        } else {
60
            systemId = "";
61
        }
62
        }
63

    
64

    
65

    
66

    
67
    /**
68
     * A destructor.
69
     */
70
        SaxonApiException::~SaxonApiException() noexcept {
71
        message.clear();
72
        errorCode.clear();
73
        systemId.clear();
74
        }
75

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

    
85

    
86
        int SaxonApiException::getLineNumber(){
87
        return lineNumber;
88
        }
89

    
90

    
91
    const char * SaxonApiException::getSystemId() {
92
        return systemId.c_str();
93
    }
94

    
95
        const char * SaxonApiException::getMessage(){
96
            return message.c_str();
97

    
98
        }
(5-5/55)