Merging undo branch into trunk. It compiles and works for limited tests. Keep
[ardour.git] / libs / ardour / utils.cc
index 2d9fccf9d74691c289f52171b9b5c1c5dd8768d3..78e5572a3ddb20aa994a3fe6de687d488f9ab672 100644 (file)
@@ -42,6 +42,7 @@
 
 using namespace ARDOUR;
 using namespace std;
+using namespace PBD;
 
 void
 elapsed_time_to_str (char *buf, uint32_t seconds)
@@ -185,15 +186,6 @@ touch_file (string path)
        return 1;
 }
 
-uint32_t long
-get_uid()
-{
-       struct timeval tv;
-       gettimeofday(&tv, 0);
-
-       return (uint32_t long) tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
 string
 placement_as_string (Placement p)
 {
@@ -261,3 +253,21 @@ path_expand (string path)
 #endif
 }
 
+#ifdef HAVE_COREAUDIO
+string 
+CFStringRefToStdString(CFStringRef stringRef)
+{
+       CFIndex size = 
+               CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef) , 
+               kCFStringEncodingUTF8);
+           char *buf = new char[size];
+       
+       std::string result;
+
+       if(CFStringGetCString(stringRef, buf, size, kCFStringEncodingUTF8)) {
+           result = buf;
+       }
+       delete [] buf;
+       return result;
+}
+#endif // HAVE_COREAUDIO