~ubuntu-branches/ubuntu/gutsy/ecasound2.2/gutsy

« back to all changes in this revision

Viewing changes to libecasound/eca-object-factory.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2007-04-22 01:25:44 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070422012544-lugfjb034udblalb
Tags: 2.4.5-1
* new upstream release
* build-depend on texlive
* pbuilder-test: error code changed from '-1' to '1', so update test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
730
730
/**
731
731
 * Return a string compliant with Ecasound Option Syntax (EOS)
732
732
 * describing the object 'aiod'.
 
733
 *
 
734
 * @pre direction == "i" || direction == "o"
733
735
 */
734
 
string ECA_OBJECT_FACTORY::audio_object_to_eos(const AUDIO_IO* aiod)
 
736
string ECA_OBJECT_FACTORY::audio_object_to_eos(const AUDIO_IO* aiod, const std::string& direction)
735
737
{
736
738
  MESSAGE_ITEM t;
737
 
  string direction ("i");
738
 
  if (aiod->io_mode() != AUDIO_IO::io_read) {
739
 
    direction = "o";
740
 
  }
741
739
  t << " -" << direction << ":";
742
740
  for(int n = 0; n < aiod->number_of_params(); n++) {
743
 
    // FIXME: should quote/escape possible commas and whitespace
744
 
    t << aiod->get_parameter(n + 1);
 
741
    /* step: if parameter has commas, or whitespace, quote the whole parameter */
 
742
    std::string param = aiod->get_parameter(n + 1);
 
743
    if (find(param.begin(), param.end(), ',') != param.end() ||
 
744
        find(param.begin(), param.end(), ' ') != param.end() ||
 
745
        find(param.begin(), param.end(), '\t') != param.end()) {
 
746
      param = std::string("\"") + param + std::string("\"");
 
747
    }
 
748
 
 
749
    /* step�: add processed parameter to the EOS string */
 
750
    t << param;
745
751
    if (n + 1 < aiod->number_of_params()) t << ",";
746
752
  }
747
753