can you call C++ methods from Smalltalk
This commit is contained in:
parent
e39a923b23
commit
3366099dbe
|
@ -22,31 +22,25 @@ static NSArray *BuildAllowedFileTypes( const std::vector<std::string>& filterLis
|
||||||
// NSMutableArray *buildFilterList = NSMutableArray::alloc()->init();
|
// NSMutableArray *buildFilterList = NSMutableArray::alloc()->init();
|
||||||
NSMutableArray *buildFilterList = [[NSMutableArray alloc] init];
|
NSMutableArray *buildFilterList = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
char typebuf[NFD_MAX_STRLEN] = {0};
|
String typebuf;
|
||||||
|
for (std::string& i: filterList) {
|
||||||
size_t filterListLen = strlen(filterList);
|
typebuf="";
|
||||||
char *p_typebuf = typebuf;
|
for (char& j: i) {
|
||||||
for ( size_t i = 0; i < filterListLen+1; ++i )
|
if (j==' ' || j==',' || j ==';') {
|
||||||
{
|
|
||||||
if ( filterList[i] == ',' || filterList[i] == ';' || filterList[i] == '\0' )
|
|
||||||
{
|
|
||||||
if (filterList[i] != '\0')
|
|
||||||
++p_typebuf;
|
|
||||||
*p_typebuf = '\0';
|
|
||||||
|
|
||||||
// or this: NSString::stringWithUTF8String(typebuf);
|
// or this: NSString::stringWithUTF8String(typebuf);
|
||||||
// buildFilterList->addObject(thisType);
|
// buildFilterList->addObject(thisType);
|
||||||
// really? did you have to make this mess?!
|
// really? did you have to make this mess?!
|
||||||
NSString *thisType = [NSString stringWithUTF8String: typebuf];
|
NSString *thisType = [NSString stringWithUTF8String: [typebuf c_str]];
|
||||||
[buildFilterList addObject:thisType];
|
[buildFilterList addObject:thisType];
|
||||||
p_typebuf = typebuf;
|
typebuf="";
|
||||||
*p_typebuf = '\0';
|
} else if (j!='.' && j!='*') {
|
||||||
|
typebuf+=j;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
if (!typebuf.empty()) {
|
||||||
*p_typebuf = filterList[i];
|
// I don't think this will work, but come on...
|
||||||
++p_typebuf;
|
NSString *thisType = [NSString stringWithUTF8String: [typebuf c_str]];
|
||||||
|
[buildFilterList addObject:thisType];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +52,7 @@ static NSArray *BuildAllowedFileTypes( const std::vector<std::string>& filterLis
|
||||||
|
|
||||||
static void AddFilterListToDialog( NSSavePanel *dialog, const std::vector<std::string>& filterList )
|
static void AddFilterListToDialog( NSSavePanel *dialog, const std::vector<std::string>& filterList )
|
||||||
{
|
{
|
||||||
if ( !filterList || strlen(filterList) == 0 )
|
if ( filterList.size()&1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSArray *allowedFileTypes = BuildAllowedFileTypes( filterList );
|
NSArray *allowedFileTypes = BuildAllowedFileTypes( filterList );
|
||||||
|
|
Loading…
Reference in New Issue