MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::ReaderWriterSet::Handler Class Reference

#include <ReaderWriterSet.hpp>

+ Collaboration diagram for moab::ReaderWriterSet::Handler:

Public Member Functions

 Handler (reader_factory_t read_f, writer_factory_t write_f, const char *name, const char *desc, const char *const *ext, int num_ext)
const std::string & name () const
const std::string & description () const
void get_extensions (std::vector< std::string > &list_out) const
bool have_reader () const
bool have_writer () const
ReaderIfacemake_reader (Interface *iface) const
WriterIfacemake_writer (Interface *iface) const
bool reads_extension (const char *ext) const
bool writes_extension (const char *ext) const
bool operator== (const char *name) const

Private Attributes

reader_factory_t mReader
writer_factory_t mWriter
std::string mName
std::string mDescription
std::vector< std::string > mExtensions

Friends

class ReaderWriterSet

Detailed Description

Definition at line 103 of file ReaderWriterSet.hpp.


Constructor & Destructor Documentation

moab::ReaderWriterSet::Handler::Handler ( reader_factory_t  read_f,
writer_factory_t  write_f,
const char *  name,
const char *  desc,
const char *const *  ext,
int  num_ext 
)

Definition at line 248 of file ReaderWriterSet.cpp.

References mExtensions.

    : mReader( read_f ), mWriter( write_f ), mName( nm ), mDescription( desc ), mExtensions( num_ext )
{
    for( int i = 0; i < num_ext; ++i )
        mExtensions[i] = ext[i];
}

Member Function Documentation

const std::string& moab::ReaderWriterSet::Handler::description ( ) const [inline]

Definition at line 120 of file ReaderWriterSet.hpp.

References mDescription.

        {
            return mDescription;
        }
void moab::ReaderWriterSet::Handler::get_extensions ( std::vector< std::string > &  list_out) const [inline]

Definition at line 124 of file ReaderWriterSet.hpp.

References mExtensions.

        {
            list_out = mExtensions;
        }

Definition at line 129 of file ReaderWriterSet.hpp.

References mReader.

Referenced by make_reader().

        {
            return NULL != mReader;
        }

Definition at line 133 of file ReaderWriterSet.hpp.

References mWriter.

Referenced by make_writer().

        {
            return NULL != mWriter;
        }

Definition at line 138 of file ReaderWriterSet.hpp.

References have_reader(), and mReader.

        {
            return have_reader() ? mReader( iface ) : NULL;
        }

Definition at line 143 of file ReaderWriterSet.hpp.

References have_writer(), and mWriter.

        {
            return have_writer() ? mWriter( iface ) : NULL;
        }
const std::string& moab::ReaderWriterSet::Handler::name ( ) const [inline]

Definition at line 116 of file ReaderWriterSet.hpp.

References mName.

        {
            return mName;
        }
bool moab::ReaderWriterSet::Handler::operator== ( const char *  name) const

Definition at line 325 of file ReaderWriterSet.cpp.

{
    // do case-insensitive comparison
    std::string::const_iterator siter = mName.begin();
    for( ; *nm; ++nm, ++siter )
        if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) ) return false;
    return *nm == '\0';
}
bool moab::ReaderWriterSet::Handler::reads_extension ( const char *  ext) const

Definition at line 292 of file ReaderWriterSet.cpp.

{
    if( !have_reader() ) return false;

    std::vector< std::string >::const_iterator siter;
    for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
        if( !( *siter ).compare( ext ) )
            return true;
        else if( 0 == strcasecmp( siter->c_str(), ext ) )
            return true;

    return false;
}
bool moab::ReaderWriterSet::Handler::writes_extension ( const char *  ext) const

Definition at line 306 of file ReaderWriterSet.cpp.

{
    if( !have_writer() ) return false;

    std::vector< std::string >::const_iterator siter;
    for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
        if( !( *siter ).compare( ext ) )
            return true;
        else if( 0 == strcasecmp( siter->c_str(), ext ) )
            return true;

    return false;
}

Friends And Related Function Documentation

friend class ReaderWriterSet [friend]

Definition at line 106 of file ReaderWriterSet.hpp.


Member Data Documentation

Definition at line 157 of file ReaderWriterSet.hpp.

Referenced by description().

std::vector< std::string > moab::ReaderWriterSet::Handler::mExtensions [private]

Definition at line 158 of file ReaderWriterSet.hpp.

Referenced by get_extensions(), and Handler().

Definition at line 157 of file ReaderWriterSet.hpp.

Referenced by name().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines