File: Writer.cpp

package info (click to toggle)
ausaxs 1.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 72,592 kB
  • sloc: cpp: 49,853; ansic: 6,901; python: 730; makefile: 18
file content (21 lines) | stat: -rw-r--r-- 870 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: LGPL-3.0-or-later
// Author: Kristian Lytje

#include <io/Writer.h>
#include <io/detail/structure/PDBWriter.h>
#include <io/File.h>
#include <utility/Exceptions.h>
#include <utility/StringUtils.h>

using namespace ausaxs;

void io::Writer::write(const io::pdb::PDBStructure& s, const io::File& path) {
    auto ext = utility::to_lowercase(path.extension());
    if (ext == ".xml") { // .xml PDBStructure
        throw except::invalid_argument("PDBStructure::construct_writer: .xml input PDBStructures are not supported.");
    } else if (ext == ".pdb") { // .pdb PDBStructure
        io::detail::pdb::write(s, path);
    } else { // anything else - we cannot handle this
        throw except::invalid_argument("PDBStructure::construct_writer: Unsupported extension \"" + path.extension() + "\" of input file \"" + path.str() + "\".");
    }
}