/[svn]/linuxsampler/trunk/src/network/lscpresultset.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpresultset.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 880 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC revision 1765 by persson, Sat Sep 6 16:44:42 2008 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 37  Line 37 
37   * ******************************************************/   * ******************************************************/
38    
39  #include "lscpresultset.h"  #include "lscpresultset.h"
40    #include <iomanip>
41    #include "../common/global_private.h"
42    
43    
44    namespace LinuxSampler {
45    
46  //Construct an empty resultset  //Construct an empty resultset
47  //Default index is -1 meaning the resultset doesn't have an index  //Default index is -1 meaning the resultset doesn't have an index
# Line 64  void LSCPResultSet::Add(String Label, St Line 69  void LSCPResultSet::Add(String Label, St
69          if (result_type != result_type_success)          if (result_type != result_type_success)
70                  throw Exception("Attempting to create illegal resultset");                  throw Exception("Attempting to create illegal resultset");
71          storage = storage + Label + ": " + Value + "\r\n";          storage = storage + Label + ": " + Value + "\r\n";
72          count++;          count = 2; // results in form of "Label: Value" should always be handled as multi line responses
73  }  }
74    
75  void LSCPResultSet::Add(String Label, const char* pValue) {  void LSCPResultSet::Add(String Label, const char* pValue) {
# Line 92  void LSCPResultSet::Add(String Label, in Line 97  void LSCPResultSet::Add(String Label, in
97  }  }
98    
99  void LSCPResultSet::Add(String Label, float Value) {  void LSCPResultSet::Add(String Label, float Value) {
100      char s[1024];      std::stringstream ss;
101      snprintf(s, 1023, "%.3f", Value);      ss.imbue(std::locale::classic());
102      Add(Label, String(s));      ss << std::fixed << std::setprecision(3) << Value;
103        Add(Label, ss.str());
104  }  }
105    
106  void LSCPResultSet::Add(String Label, bool Value) {  void LSCPResultSet::Add(String Label, bool Value) {
# Line 164  String LSCPResultSet::Produce(void) { Line 170  String LSCPResultSet::Produce(void) {
170          //Multiline results MUST end with a line with a single dot          //Multiline results MUST end with a line with a single dot
171          return storage + ".\r\n";          return storage + ".\r\n";
172  }  }
173    
174    }

Legend:
Removed from v.880  
changed lines
  Added in v.1765

  ViewVC Help
Powered by ViewVC