Database0.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Database0.swift
  2. // This file is part of KeePass.
  3. //
  4. // Copyright © 2019 ___ORGANIZATIONNAME___. All rights reserved.
  5. //
  6. // KeePass is free software: you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // KeePass is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with KeePass. If not, see <https://www.gnu.org/licenses/>.
  18. import Foundation
  19. import Binary
  20. import XML
  21. class Database0: Database {
  22. let document: Document
  23. required init(from input: Input) throws {
  24. var options = XML.Options()
  25. options.parserSettings.shouldTrimWhitespace = false
  26. document = try XML.Document(xml: input.bytes.data, options: options)
  27. }
  28. }
  29. extension Database0: Writable {
  30. func write(to output: Output) throws {
  31. try output.write(document.xml)
  32. }
  33. }