Project

Profile

Help

Download (1.69 KB) Statistics
| Branch: | Tag: | Revision:

he / latest10 / hec / Saxon.C.API / SaxonApiException.cpp @ 6304fb8b

1 b752fdf3 O'Neil Delpratt
// 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, const char * ec, const char * sysId, int linenumber){
29 6304fb8b O'Neil Delpratt
                if(m != nullptr) {
30 b752fdf3 O'Neil Delpratt
                    message = std::string(m);
31
                } else {
32
                    message = "";
33
                }
34
35
        lineNumber = linenumber;
36
37 6304fb8b O'Neil Delpratt
        if (ec != nullptr) {
38 b752fdf3 O'Neil Delpratt
            errorCode = std::string(ec);
39
        } else {
40
            errorCode = "";
41
        }
42
43 6304fb8b O'Neil Delpratt
        if(sysId != nullptr) {
44 b752fdf3 O'Neil Delpratt
            systemId = sysId;
45
        } else {
46
            systemId = "";
47
        }
48
        }
49
50
51
52
53
    /**
54
     * A destructor.
55
     */
56 6304fb8b O'Neil Delpratt
        SaxonApiException::~SaxonApiException() noexcept {
57 b752fdf3 O'Neil Delpratt
        message.clear();
58
        errorCode.clear();
59
        systemId.clear();
60
        }
61
62
    /**
63
     * Get the error code associated with the ith exception in the vector, if there is one
64
     * @param i - ith exception in the vector
65 6304fb8b O'Neil Delpratt
     * @return the associated error code, or nullptr if no error code is available
66 b752fdf3 O'Neil Delpratt
     */
67
        const char * SaxonApiException::getErrorCode(){
68
                return errorCode.c_str();
69
        }
70
71
72
        int SaxonApiException::getLineNumber(){
73
        return lineNumber;
74
        }
75
76
77
    const char * SaxonApiException::getSystemId() {
78
        return systemId.c_str();
79
    }
80
81
        const char * SaxonApiException::getMessage(){
82
            return message.c_str();
83
84
        }