tagging release
[dasher.git] / Src / MacOSX / DasherUtil.mm
blob5ffb38d530e083c710afc80aebd81d3b30e0070b
1 //
2 //  DasherUtil.mm
3 //  Dasher
4 //
5 //  Created by Doug Dickinson on Sun Jun 01 2003.
6 //  Copyright (c) 2003 Doug Dickinson (dasher@DressTheMonkey.plus.com). All rights reserved.
7 //
9 #import "DasherUtil.h"
11 #include "libdasher.h"
13 NSString *NSStringFromStdString(const std::string& aString)
15   // inside DasherCore, std::string is used as a container for a string of UTF-8 bytes, so
16   // we can just get the raw bytes (with c_str()) and shove them into an NSString.
17   return [NSString stringWithUTF8String:aString.c_str()];
20 std::string StdStringFromNSString(NSString *aString)
22   char *result = NULL;
24   if (aString && [aString length]) {
25     result = [aString UTF8String];
26   } else {
27     result = "";
28   }
30   return result;
33 void importTrainingFile(NSString *aFileName)
35   dasher_train_file([aFileName cString]);