Configuration.swift 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 1999-2101 Alibaba Group.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. //
  17. // Configuration.swift
  18. // HandyJSON
  19. //
  20. // Created by zhouzhuo on 08/01/2017.
  21. //
  22. public struct DeserializeOptions: OptionSet {
  23. public let rawValue: Int
  24. public static let caseInsensitive = DeserializeOptions(rawValue: 1 << 0)
  25. public static let defaultOptions: DeserializeOptions = []
  26. public init(rawValue: Int) {
  27. self.rawValue = rawValue
  28. }
  29. }
  30. public enum DebugMode: Int {
  31. case verbose = 0
  32. case debug = 1
  33. case error = 2
  34. case none = 3
  35. }
  36. public struct HandyJSONConfiguration {
  37. private static var _mode = DebugMode.error
  38. public static var debugMode: DebugMode {
  39. get {
  40. return _mode
  41. }
  42. set {
  43. _mode = newValue
  44. }
  45. }
  46. public static var deserializeOptions: DeserializeOptions = .defaultOptions
  47. }