Changeset 1015 for trunk/lib


Ignore:
Timestamp:
Jan 9, 2010, 3:16:03 PM (12 years ago)
Author:
Peter Johansson
Message:

closes #438. adding an option --format

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.cc

    r1011 r1015  
    297297      else if (section == "image") {
    298298        if (lhs == "format") {
    299           if (rhs!="none" && rhs!="png" && rhs!="svg") {
    300             throw Config_error(line, "unknown format: " + rhs);
     299          try {
     300            image_format(rhs);
    301301          }
    302           image_format_ = rhs;
     302          catch (std::runtime_error e) {
     303            throw Config_error(line,
     304                               "unknown format: " + rhs + "\n" + e.what());
     305          }
    303306        }
    304307        else if (lhs == "image_format") {
     
    311314    }
    312315    validate_dictionary();
     316  }
     317
     318
     319  void Configuration::image_format(const std::string& format)
     320  {
     321    if (format!="none" && format!="png" && format!="svg") {
     322      std::ostringstream oss;
     323      oss << "Valid arguments are:\n"
     324          << "  - `none'\n"
     325          << "  - `png'\n"
     326          << "  - `svg'";
     327      throw std::runtime_error(oss.str());
     328    }
     329    image_format_ = format;
    313330  }
    314331
  • trunk/lib/Configuration.h

    r996 r1015  
    8080     */
    8181    const std::string& image_format(void) const;
     82
     83    /**
     84       \brief set image_format
     85     */
     86    void image_format(const std::string&);
    8287
    8388    ///
Note: See TracChangeset for help on using the changeset viewer.