[niepce] Trim tokens when they are fetched.



commit f7daad219f44c4d78d3821729c275aa05a0defbe
Author: Hubert Figuière <hub figuiere net>
Date:   Thu Jun 20 01:32:56 2013 -0400

    Trim tokens when they are fetched.

 src/fwk/toolkit/widgets/tokentextview.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/fwk/toolkit/widgets/tokentextview.cpp b/src/fwk/toolkit/widgets/tokentextview.cpp
index 0e21a09..df4942e 100644
--- a/src/fwk/toolkit/widgets/tokentextview.cpp
+++ b/src/fwk/toolkit/widgets/tokentextview.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - fwk/toolkit/widgets/tokentextview.cpp
  *
- * Copyright (C) 2012 Hubert Figuiere
+ * Copyright (C) 2012-2013 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,6 +35,11 @@ void TokenTextView::get_tokens(Tokens & tokens)
 {
     Glib::ustring t = get_buffer()->get_text();
     boost::split(tokens, t.raw(), boost::is_any_of(","));
+    // trim the tokens from whitespace
+    for_each(tokens.begin(), tokens.end(),
+             [](std::string & token) {
+                 boost::trim(token);
+             });
 }
 
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]