Changeset 16033 for gsdl


Ignore:
Timestamp:
2008-06-17T13:39:03+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Filled out the new parse_classifier_options() function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/src/recpt/dynamicclassifieraction.cpp

    r16032 r16033  
    183183{
    184184  text_tmap classifier_options;
    185 
    186   // The metadata element to classify by should be left after all the options have been parsed off
    187   classifier_options["metadata_element_name"] = classifier_specification;
    188185  classifier_options["current_position"] = args["dcn"];
     186
     187  // Split the classifier specification string by spaces
     188  text_tlist classifier_specification_parts;
     189  splitchar (classifier_specification.begin(), classifier_specification.end(), ' ', classifier_specification_parts);
     190
     191  // The metadata element to classify by should be the first value
     192  classifier_options["metadata_element_name"] = classifier_specification_parts.front();
     193  classifier_specification_parts.pop_front();
     194
     195  // Parse options from the remainder of the classifier specification
     196  while (!classifier_specification_parts.empty())
     197  {
     198    // Parse the option name
     199    text_t classifier_option_name = classifier_specification_parts.front();
     200    classifier_specification_parts.pop_front();
     201
     202    // Check if the option has a value (it may just be a flag, in which case we use "1" as the value)
     203    text_t classifier_option_value = "1";
     204    if (!classifier_specification_parts.empty() && !starts_with(classifier_specification_parts.front(), "-"))
     205    {
     206      classifier_option_value = classifier_specification_parts.front();
     207      classifier_specification_parts.pop_front();
     208    }
     209
     210    // Record the option
     211    classifier_options[classifier_option_name] = classifier_option_value;
     212  }
    189213
    190214  return classifier_options;
Note: See TracChangeset for help on using the changeset viewer.