<commit_before>//
//  MCOIMAPNamespace.m
//  mailcore2
//
//  Created by <NAME> on 3/23/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#import "MCOIMAPNamespace.h"

#include "MCIMAP.h"

#import "MCOUtils.h"

@implementation MCOIMAPNamespace {
    mailcore::IMAPNamespace * _nativeNamespace;
}

#define nativeType mailcore::IMAPNamespace

+ (void) load
{
    MCORegisterClass(self, &typeid(nativeType));
}

- (id) copyWithZone:(NSZone *)zone
{
    nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy();
    id result = [[self class] mco_objectWithMCObject:nativeObject];
    MC_SAFE_RELEASE(nativeObject);
    return [result retain];
}

+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
{
    mailcore::IMAPNamespace * ns = (mailcore::IMAPNamespace *) object;
    return [[[self alloc] initWithMCNamespace:ns] autorelease];
}

- (id) init
{
    mailcore::IMAPNamespace * ns = new mailcore::IMAPNamespace();
    self = [self initWithMCNamespace:ns];
    ns->release();
    
    return self;
}

- (id) initWithMCNamespace:(mailcore::IMAPNamespace *)ns
{
    self = [super init];
    
    _nativeNamespace = ns;
    _nativeNamespace->retain();
    
    return self;
}

- (void) dealloc
{
    MC_SAFE_RELEASE(_nativeNamespace);
    [super dealloc];
}

- (mailcore::Object *) mco_mcObject
{
    return _nativeNamespace;
}

- (NSString *) description
{
    return MCO_OBJC_BRIDGE_GET(description);
}

+ (MCOIMAPNamespace *) namespaceWithPrefix:(NSString *)prefix delimiter:(char)delimiter
{
    return MCO_TO_OBJC(mailcore::IMAPNamespace::namespaceWithPrefix([prefix mco_mcString], delimiter));
}

- (NSString *) mainPrefix
{
    return MCO_OBJC_BRIDGE_GET(mainPrefix);
}

- (char) mainDelimiter
{
    return MCO_NATIVE_INSTANCE->mainDelimiter();
}

- (NSArray *) prefixes
{
    return MCO_OBJC_BRIDGE_GET(mainPrefix);
}

- (NSString *) pathForComponents:(NSArray *)components
{
    mailcore::Array * mcComponents = MCO_FROM_OBJC(mailcore::Array, components);
    return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->pathForComponents(mcComponents));
}<commit_msg>Update MCOIMAPNamespace.mm<commit_after>//
//  MCOIMAPNamespace.m
//  mailcore2
//
//  Created by <NAME> on 3/23/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#import "MCOIMAPNamespace.h"

#include "MCIMAP.h"

#import "MCOUtils.h"

@implementation MCOIMAPNamespace {
    mailcore::IMAPNamespace * _nativeNamespace;
}

#define nativeType mailcore::IMAPNamespace

+ (void) load
{
    MCORegisterClass(self, &typeid(nativeType));
}

- (id) copyWithZone:(NSZone *)zone
{
    nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy();
    id result = [[self class] mco_objectWithMCObject:nativeObject];
    MC_SAFE_RELEASE(nativeObject);
    return [result retain];
}

+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
{
    mailcore::IMAPNamespace * ns = (mailcore::IMAPNamespace *) object;
    return [[[self alloc] initWithMCNamespace:ns] autorelease];
}

- (id) init
{
    mailcore::IMAPNamespace * ns = new mailcore::IMAPNamespace();
    self = [self initWithMCNamespace:ns];
    ns->release();
    
    return self;
}

- (id) initWithMCNamespace:(mailcore::IMAPNamespace *)ns
{
    self = [super init];
    
    _nativeNamespace = ns;
    _nativeNamespace->retain();
    
    return self;
}

- (void) dealloc
{
    MC_SAFE_RELEASE(_nativeNamespace);
    [super dealloc];
}

- (mailcore::Object *) mco_mcObject
{
    return _nativeNamespace;
}

- (NSString *) description
{
    return MCO_OBJC_BRIDGE_GET(description);
}

+ (MCOIMAPNamespace *) namespaceWithPrefix:(NSString *)prefix delimiter:(char)delimiter
{
    return MCO_TO_OBJC(mailcore::IMAPNamespace::namespaceWithPrefix([prefix mco_mcString], delimiter));
}

- (NSString *) mainPrefix
{
    return MCO_OBJC_BRIDGE_GET(mainPrefix);
}

- (char) mainDelimiter
{
    return MCO_NATIVE_INSTANCE->mainDelimiter();
}

- (NSArray *) prefixes
{
    return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->prefixes());
}

- (NSString *) pathForComponents:(NSArray *)components
{
    mailcore::Array * mcComponents = MCO_FROM_OBJC(mailcore::Array, components);
    return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->pathForComponents(mcComponents));
}
{'fraction_non_alphanumeric': 0.13521863117870722, 'fraction_numerical': 0.004752851711026616, 'mean_word_length': 4.612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '4605858', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1451, 'n_words': 253}