-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrprefixdelimitersquark.go
193 lines (156 loc) · 4.68 KB
/
errprefixdelimitersquark.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package errpref
import (
"fmt"
"sync"
)
type errPrefixDelimitersQuark struct {
lock *sync.Mutex
}
// empty - Receives a pointer to an instance of ErrPrefixDelimiters
// and proceeds to reset all internal member variables to their
// zero values.
//
func (ePrefDelimsQuark *errPrefixDelimitersQuark) empty(
delimiters *ErrPrefixDelimiters,
ePrefix string) (
err error) {
if ePrefDelimsQuark.lock == nil {
ePrefDelimsQuark.lock = new(sync.Mutex)
}
ePrefDelimsQuark.lock.Lock()
defer ePrefDelimsQuark.lock.Unlock()
ePrefix += "errPrefixDelimitersQuark.empty() "
if delimiters == nil {
err = fmt.Errorf("%v\n"+
"Input parameter 'delimiters' is INVALID!\n"+
"'delimiters' is a nil pointer!\n",
ePrefix)
return err
}
delimiters.inLinePrefixDelimiter = ""
delimiters.lenInLinePrefixDelimiter = 0
delimiters.newLinePrefixDelimiter = ""
delimiters.lenNewLinePrefixDelimiter = 0
delimiters.inLineContextDelimiter = ""
delimiters.lenInLineContextDelimiter = 0
delimiters.newLineContextDelimiter = ""
delimiters.lenNewLineContextDelimiter = 0
return err
}
// ptr - Returns a pointer to a new instance of errPrefixDelimitersQuark.
//
func (ePrefDelimsQuark errPrefixDelimitersQuark) ptr() *errPrefixDelimitersQuark {
if ePrefDelimsQuark.lock == nil {
ePrefDelimsQuark.lock = new(sync.Mutex)
}
ePrefDelimsQuark.lock.Lock()
defer ePrefDelimsQuark.lock.Unlock()
return &errPrefixDelimitersQuark{
lock: new(sync.Mutex),
}
}
// testValidityOfErrorPrefixInfo - Performs a diagnostic review of
// the input parameter 'delimiters', an instance of
// ErrPrefixDelimiters. The purpose of this diagnostic review is to
// determine whether this ErrPrefixDelimiters instance is valid in all
// respects.
//
//
// ----------------------------------------------------------------
//
// Input Parameters
//
// delimiters *ErrPrefixDelimiters
// - A pointer to an instance of ErrPrefixDelimiters. This object
// will be evaluated to determine whether or not it is a
// valid instance.
//
//
// ePrefix string
// - This is an error prefix which is included in all returned
// error messages. Usually, it contains the names of the calling
// method or methods. Be sure to leave a space at the end of
// 'ePrefix'.
//
//
// -----------------------------------------------------------------
//
// Return Values
//
// isValid bool
// - This returned boolean value will signal whether the input
// parameter, 'delimiters', is valid, or not. If the
// 'errPrefixDto' object contains valid data, this method
// returns 'true'. If the data is invalid, this method will
// return 'false'.
//
// err error
// - If the input parameter object, 'errPrefixDto', contains
// invalid data, a detailed error message will be returned
// identifying the invalid data item.
//
// If the input parameter object, 'errPrefixDto', is valid,
// this error parameter will be set to 'nil'.
//
func (ePrefDelimsQuark *errPrefixDelimitersQuark) testValidityOfErrPrefixDelimiters(
delimiters *ErrPrefixDelimiters,
ePrefix string) (
isValid bool,
err error) {
if ePrefDelimsQuark.lock == nil {
ePrefDelimsQuark.lock = new(sync.Mutex)
}
ePrefDelimsQuark.lock.Lock()
defer ePrefDelimsQuark.lock.Unlock()
ePrefix += "errPrefixDelimitersQuark.testValidityOfErrPrefixDelimiters() "
isValid = false
if delimiters == nil {
err = fmt.Errorf("%v\n"+
"Input parameter 'delimiters' is INVALID!\n"+
"'delimiters' is a nil pointer!\n",
ePrefix)
return isValid, err
}
delimiters.lenInLinePrefixDelimiter =
uint(len(delimiters.inLinePrefixDelimiter))
if delimiters.lenInLinePrefixDelimiter == 0 {
err =
fmt.Errorf("%v\n"+
"Error: The In Line Prefix Delimiter is an "+
"empty string!\n",
ePrefix)
return isValid, err
}
delimiters.lenNewLinePrefixDelimiter =
uint(len(delimiters.newLinePrefixDelimiter))
if delimiters.lenNewLinePrefixDelimiter == 0 {
err =
fmt.Errorf("%v\n"+
"Error: The In New Prefix Delimiter is an "+
"empty string!\n",
ePrefix)
return isValid, err
}
delimiters.lenInLineContextDelimiter =
uint(len(delimiters.inLineContextDelimiter))
if delimiters.lenInLineContextDelimiter == 0 {
err =
fmt.Errorf("%v\n"+
"Error: The In Line Context Delimiter is an "+
"empty string!\n",
ePrefix)
return isValid, err
}
delimiters.lenNewLineContextDelimiter =
uint(len(delimiters.newLineContextDelimiter))
if delimiters.lenNewLineContextDelimiter == 0 {
err =
fmt.Errorf("%v\n"+
"Error: The In New Prefix Delimiter is an "+
"empty string!\n",
ePrefix)
return isValid, err
}
isValid = true
return isValid, err
}