Changeset 1023 for trunk/lib


Ignore:
Timestamp:
Jan 11, 2010, 12:15:47 AM (12 years ago)
Author:
Peter Johansson
Message:

added new cmd option 'anchor-format'. refs #279

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.cc

    r1017 r1023  
    307307        }
    308308        else if (lhs == "image_format") {
    309           if (rhs!="none" && rhs!="png" && rhs!="svg" && rhs!="pdf") {
    310             throw Config_error(line, "unknown format: " + rhs);
    311           }
    312           image_anchor_format_ = rhs;
     309          try {
     310            image_anchor_format(rhs);
     311          }
     312          catch (std::runtime_error e) {
     313            throw Config_error(line,
     314                               "unknown format: " + rhs + "\n" + e.what());
     315          }
    313316        }
    314317      }
    315318    }
    316319    validate_dictionary();
     320  }
     321
     322
     323  void Configuration::image_anchor_format(const std::string& format)
     324  {
     325    if (format!="none" && format!="pdf" && format!="png" && format!="svg") {
     326      std::ostringstream oss;
     327      oss << "Valid arguments are:\n"
     328          << "  - `none'\n"
     329          << "  - `pdf'\n"
     330          << "  - `png'\n"
     331          << "  - `svg'";
     332      throw std::runtime_error(oss.str());
     333    }
     334    image_anchor_format_ = format;
    317335  }
    318336
  • trunk/lib/Configuration.h

    r1017 r1023  
    7676     */
    7777    const std::string& image_anchor_format(void) const;
     78
     79    /**
     80       \brief set image_anchor_format
     81     */
     82    void image_anchor_format(const std::string&);
    7883
    7984    /**
Note: See TracChangeset for help on using the changeset viewer.