<commit_before>//
//  foundation-helpers.m
//  ndnrtcTOP
//
//  Created by <NAME> on 2/13/18.
//  Copyright © 2018 UCLA REMAP. All rights reserved.
//

#include "foundation-helpers.h"

#include <Foundation/Foundation.h>
#include <string>

// this dummy class is used only in order to identify plugin bundle
@interface Dummy : NSObject
@end

@implementation Dummy
@end

const char* get_resources_path()
{
    NSBundle *bundle = [NSBundle bundleForClass:[Dummy class]];

    if (bundle == NULL) {
        return NULL;
    }
    
    NSString *respath = [bundle resourcePath];
    if (respath == NULL) {
        return NULL;
    }
    
    return [respath UTF8String];
}<commit_msg>workardound for making dummy class name unique per Xcode target<commit_after>//
//  foundation-helpers.m
//  ndnrtcTOP
//
//  Created by <NAME> on 2/13/18.
//  Copyright © 2018 UCLA REMAP. All rights reserved.
//

#include "foundation-helpers.h"

#include <Foundation/Foundation.h>
#include <string>

// Concatenate preprocessor tokens A and B without expanding macro definitions
// (however, if invoked from a macro, macro arguments are expanded).
#define PPCAT_NX(A, B) A ## B
// concatenate preprocessor tokens A and B after macro-expanding them.
#define PPCAT(A, B) PPCAT_NX(A, B)

#define DUMMY_CLASS PPCAT(Dummy_, PRODUCT_NAME)

// this dummy class is used only in order to identify plugin bundle
// the name of it is composed using unique PRODUCT_NAME variable - it
// prevents having identical obj-c classes when two modules (ndnrtcIn
// and ndnrtcOut) will be loaded simultaneously
@interface DUMMY_CLASS : NSObject
@end

@implementation DUMMY_CLASS
@end

const char* get_resources_path()
{
    NSBundle *bundle = [NSBundle bundleForClass:[DUMMY_CLASS class]];

    if (bundle == NULL) {
        return NULL;
    }
    
    NSString *respath = [bundle resourcePath];
    if (respath == NULL) {
        return NULL;
    }
    
    return [respath UTF8String];
}
{'fraction_non_alphanumeric': 0.10472279260780287, 'fraction_numerical': 0.01026694045174538, 'mean_word_length': 3.29295154185022, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5755614', 'n_tokens_mistral': 640, 'n_tokens_neox': 612, 'n_words': 210}