示例#1
0
MPxFileTranslator::MFileKind OxDnaTranslator::identifyFile (const MFileObject& file, const char *buffer, short size) const {
    const MString filename(file.resolvedFullName().toLowerCase());

    if (filename.rindexW("." HELIX_OXDNA_CONF_FILE_TYPE) == int(filename.length()) - int(strlen(HELIX_OXDNA_CONF_FILE_TYPE)) - 1 ||
            filename.rindexW("." HELIX_OXDNA_TOP_FILE_TYPE) == int(filename.length()) - int(strlen(HELIX_OXDNA_TOP_FILE_TYPE)) - 1)
        return MPxFileTranslator::kIsMyFileType;
    else
        return MPxFileTranslator::kNotMyFileType;
}
示例#2
0
/*
 * Helper method for obtaining the two filenames.
 */
void get_filenames(const MFileObject& file, MString & topology_filename, MString & configuration_filename, MString & vhelix_filename) {
    const MString filename(file.fullName());

    int extension = filename.rindexW("." HELIX_OXDNA_CONF_FILE_TYPE);

    if (extension != int(filename.length()) - int(strlen(HELIX_OXDNA_CONF_FILE_TYPE)) - 1) {
        extension = filename.rindexW("." HELIX_OXDNA_TOP_FILE_TYPE);

        if (extension != int(filename.length()) - int(strlen(HELIX_OXDNA_TOP_FILE_TYPE)) - 1)
            extension = -1;
    }

    const MString stripped_filename(filename.asChar(), extension != -1 ? extension : filename.length());
    configuration_filename = stripped_filename + "." HELIX_OXDNA_CONF_FILE_TYPE;
    topology_filename = stripped_filename + "." HELIX_OXDNA_TOP_FILE_TYPE;
    vhelix_filename = stripped_filename + "." HELIX_OXDNA_VHELIX_FILE_TYPE;
}