#include "os/path.h"
#include <vector>
#include <map>
+#include <util/buffer.h>
class RadiantFileTypeRegistry : public IFileTypeRegistry
{
struct filetype_copy_t
{
filetype_copy_t( const char* moduleName, const filetype_t other )
- : m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ), m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ){
+ : m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ), m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ) {
}
const char* getModuleName() const {
return m_moduleName.c_str();
const char* findModuleName( IFileTypeRegistry* registry, const char* moduleType, const char* extension ){
class SearchFileTypeList : public IFileTypeList
{
- char m_pattern[128];
+ u::BufferVal<128> m_pattern;
const char* m_moduleName;
public:
SearchFileTypeList( const char* ext )
: m_moduleName( "" ){
- m_pattern[0] = '*';
- m_pattern[1] = '.';
- strncpy( m_pattern + 2, ext, 125 );
- m_pattern[127] = '\0';
+ m_pattern.mut()[0] = '*';
+ m_pattern.mut()[1] = '.';
+ m_pattern.copy(ext, 2);
+ m_pattern.terminate();
}
void addType( const char* moduleName, filetype_t type ){
if ( extension_equal( m_pattern, type.pattern ) ) {