changeset 121:7c3e1bc51080

* RFE 1497743: Adjust layer text file format to allow copy/paste into Excel Use \t as the default separator for text file export, and remove the leading space from RealTime::toString values
author Chris Cannam
date Thu, 08 Jun 2006 11:12:47 +0000
parents e388730429b5
children c1de4b4e9c29
files base/RealTime.cpp base/RealTime.h
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/base/RealTime.cpp	Mon May 22 10:46:43 2006 +0000
+++ b/base/RealTime.cpp	Thu Jun 08 11:12:47 2006 +0000
@@ -102,7 +102,7 @@
 }
 
 std::string
-RealTime::toString() const
+RealTime::toString(bool align) const
 {
     std::stringstream out;
     out << *this;
@@ -113,6 +113,11 @@
 
     std::string s = out.str();
 
+    if (!align && *this >= RealTime::zeroTime) {
+        // remove leading " "
+        s = s.substr(1, s.length() - 1);
+    }
+
     // remove trailing R
     return s.substr(0, s.length() - 1);
 }
--- a/base/RealTime.h	Mon May 22 10:46:43 2006 +0000
+++ b/base/RealTime.h	Thu Jun 08 11:12:47 2006 +0000
@@ -21,10 +21,10 @@
 #ifndef _REAL_TIME_H_
 #define _REAL_TIME_H_
 
-#include "vamp-sdk/RealTime.h"
-using Vamp::RealTime;
+//#include "vamp-sdk/RealTime.h"
+//using Vamp::RealTime;
 
-#ifdef NOT_DEFINED
+//#ifdef NOT_DEFINED
 
 #include <iostream>
 #include <string>
@@ -104,9 +104,11 @@
     double operator/(const RealTime &r) const;
 
     // Return a human-readable debug-type string to full precision
-    // (probably not a format to show to a user directly)
+    // (probably not a format to show to a user directly).  If align
+    // is true, prepend " " to the start of positive values so that
+    // they line up with negative ones (which start with "-").
     // 
-    std::string toString() const;
+    std::string toString(bool align = false) const;
 
     // Return a user-readable string to the nearest millisecond
     // in a form like HH:MM:SS.mmm
@@ -123,6 +125,6 @@
 
 std::ostream &operator<<(std::ostream &out, const RealTime &rt);
 
-#endif
+//#endif
     
 #endif