indent classes, align by spaces
This commit is contained in:
@@ -32,51 +32,51 @@
|
||||
|
||||
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 ){
|
||||
}
|
||||
const char* getModuleName() const {
|
||||
return m_moduleName.c_str();
|
||||
}
|
||||
filetype_t getType() const {
|
||||
return filetype_t( m_name.c_str(), m_pattern.c_str(), m_can_load, m_can_save, m_can_import );
|
||||
}
|
||||
private:
|
||||
CopiedString m_moduleName;
|
||||
CopiedString m_name;
|
||||
CopiedString m_pattern;
|
||||
public:
|
||||
bool m_can_load;
|
||||
bool m_can_import;
|
||||
bool m_can_save;
|
||||
};
|
||||
typedef std::vector<filetype_copy_t> filetype_list_t;
|
||||
std::map<CopiedString, filetype_list_t> m_typelists;
|
||||
public:
|
||||
RadiantFileTypeRegistry(){
|
||||
addType( "*", "*", filetype_t( "All Files", "*.*" ) );
|
||||
}
|
||||
void addType( const char* moduleType, const char* moduleName, filetype_t type ){
|
||||
m_typelists[moduleType].push_back( filetype_copy_t( moduleName, type ) );
|
||||
}
|
||||
void getTypeList( const char* moduleType, IFileTypeList* typelist, bool want_load, bool want_import, bool want_save ){
|
||||
filetype_list_t& list_ref = m_typelists[moduleType];
|
||||
for ( filetype_list_t::iterator i = list_ref.begin(); i != list_ref.end(); ++i )
|
||||
struct filetype_copy_t
|
||||
{
|
||||
if ( want_load && !( *i ).m_can_load ) {
|
||||
return;
|
||||
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 ){
|
||||
}
|
||||
if ( want_import && !( *i ).m_can_import ) {
|
||||
return;
|
||||
const char* getModuleName() const {
|
||||
return m_moduleName.c_str();
|
||||
}
|
||||
if ( want_save && !( *i ).m_can_save ) {
|
||||
return;
|
||||
filetype_t getType() const {
|
||||
return filetype_t( m_name.c_str(), m_pattern.c_str(), m_can_load, m_can_save, m_can_import );
|
||||
}
|
||||
private:
|
||||
CopiedString m_moduleName;
|
||||
CopiedString m_name;
|
||||
CopiedString m_pattern;
|
||||
public:
|
||||
bool m_can_load;
|
||||
bool m_can_import;
|
||||
bool m_can_save;
|
||||
};
|
||||
typedef std::vector<filetype_copy_t> filetype_list_t;
|
||||
std::map<CopiedString, filetype_list_t> m_typelists;
|
||||
public:
|
||||
RadiantFileTypeRegistry(){
|
||||
addType( "*", "*", filetype_t( "All Files", "*.*" ) );
|
||||
}
|
||||
void addType( const char* moduleType, const char* moduleName, filetype_t type ){
|
||||
m_typelists[moduleType].push_back( filetype_copy_t( moduleName, type ) );
|
||||
}
|
||||
void getTypeList( const char* moduleType, IFileTypeList* typelist, bool want_load, bool want_import, bool want_save ){
|
||||
filetype_list_t& list_ref = m_typelists[moduleType];
|
||||
for ( filetype_list_t::iterator i = list_ref.begin(); i != list_ref.end(); ++i )
|
||||
{
|
||||
if ( want_load && !( *i ).m_can_load ) {
|
||||
return;
|
||||
}
|
||||
if ( want_import && !( *i ).m_can_import ) {
|
||||
return;
|
||||
}
|
||||
if ( want_save && !( *i ).m_can_save ) {
|
||||
return;
|
||||
}
|
||||
typelist->addType( ( *i ).getModuleName(), ( *i ).getType() );
|
||||
}
|
||||
typelist->addType( ( *i ).getModuleName(), ( *i ).getType() );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static RadiantFileTypeRegistry g_patterns;
|
||||
@@ -88,25 +88,25 @@ IFileTypeRegistry* GetFileTypeRegistry(){
|
||||
const char* findModuleName( IFileTypeRegistry* registry, const char* moduleType, const char* extension ){
|
||||
class SearchFileTypeList : public IFileTypeList
|
||||
{
|
||||
char m_pattern[128];
|
||||
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';
|
||||
}
|
||||
void addType( const char* moduleName, filetype_t type ){
|
||||
if ( extension_equal( m_pattern, type.pattern ) ) {
|
||||
m_moduleName = moduleName;
|
||||
char m_pattern[128];
|
||||
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';
|
||||
}
|
||||
void addType( const char* moduleName, filetype_t type ){
|
||||
if ( extension_equal( m_pattern, type.pattern ) ) {
|
||||
m_moduleName = moduleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* getModuleName(){
|
||||
return m_moduleName;
|
||||
}
|
||||
const char* getModuleName(){
|
||||
return m_moduleName;
|
||||
}
|
||||
} search( extension );
|
||||
registry->getTypeList( moduleType, &search );
|
||||
return search.getModuleName();
|
||||
@@ -118,17 +118,17 @@ public:
|
||||
|
||||
class FiletypesAPI
|
||||
{
|
||||
IFileTypeRegistry* m_filetypes;
|
||||
IFileTypeRegistry* m_filetypes;
|
||||
public:
|
||||
typedef IFileTypeRegistry Type;
|
||||
STRING_CONSTANT( Name, "*" );
|
||||
typedef IFileTypeRegistry Type;
|
||||
STRING_CONSTANT( Name, "*" );
|
||||
|
||||
FiletypesAPI(){
|
||||
m_filetypes = GetFileTypeRegistry();
|
||||
}
|
||||
IFileTypeRegistry* getTable(){
|
||||
return m_filetypes;
|
||||
}
|
||||
FiletypesAPI(){
|
||||
m_filetypes = GetFileTypeRegistry();
|
||||
}
|
||||
IFileTypeRegistry* getTable(){
|
||||
return m_filetypes;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<FiletypesAPI> FiletypesModule;
|
||||
|
||||
Reference in New Issue
Block a user