6 // -------------------------------------------------------------------------
7 std::string GetFileName( const std::string& path )
10 char* buffer = new char[ path.size( ) + 1 ];
11 std::memcpy( buffer, path.c_str( ), path.size( ) );
12 buffer[ path.size( ) ] = '\0';
13 char* tok = std::strtok( buffer, "/\\" );
14 char* ptr_fname = tok;
18 tok = std::strtok( NULL, "/\\" );
21 std::string fname( ptr_fname );
25 std::size_t pos = fname.find_last_of( "." );
26 if( pos != std::string::npos )
27 fname = fname.substr( 0, pos );
32 // -------------------------------------------------------------------------
33 int main( int argc, char* argv[] )
39 << "Usage: " << argv[ 0 ]
40 << " output_code namespace filter1 filter2 ..."
45 std::ofstream output_code( argv[ 1 ] );
49 << "Could not open file \"" << argv[ 1 ] << "\" for writing"
55 output_code << "#include <Pluma/Connector.hpp>" << std::endl;
56 for( int i = 3; i < argc; ++i )
57 output_code << "#include \"" << argv[ i ] << "\"" << std::endl;
60 << "PLUMA_CONNECTOR" << std::endl
61 << "bool connect( pluma::Host& host )" << std::endl
63 << " using namespace " << argv[ 2 ] << ";" << std::endl;
65 for( int i = 3; i < argc; ++i )
68 << GetFileName( argv[ i ] )
73 << " return( true );" << std::endl