Changeset 996 for trunk


Ignore:
Timestamp:
Dec 28, 2009, 4:57:06 AM (12 years ago)
Author:
Peter Johansson
Message:

refs #279. Added support for anchor_image format in Configuration class and extended test of Configuration.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.cc

    r995 r996  
    122122    return str=="true" || str=="True" || str=="TRUE" ||
    123123      str=="yes" || str=="Yes" || str=="YES";
     124  }
     125
     126
     127  const std::string& Configuration::image_anchor_format(void) const
     128  {
     129    return image_anchor_format_;
    124130  }
    125131
     
    294300          }
    295301          image_format_ = rhs;
     302        }
     303        else if (lhs == "image_format") {
     304          if (rhs!="none" && rhs!="png" && rhs!="svg" && rhs!="pdf") {
     305            throw Config_error(line, "unknown format: " + rhs);
     306          }
     307          image_anchor_format_ = rhs;
    296308        }
    297309      }
     
    438450    dictionary_ = VectorPair(1, std::make_pair("*.in", "$1"));
    439451    image_format_ = "png";
     452    image_anchor_format_ = "png";
    440453  }
    441454
     
    501514       << "[image]\n"
    502515       << "format = " << conf.image_format() << "\n";
     516    os << "anchor_format = " << conf.image_anchor_format() << "\n";
    503517
    504518
  • trunk/lib/Configuration.h

    r986 r996  
    7070    ///
    7171    const std::map<std::string, Alias>& copyright_alias(void) const;
     72
     73    /**
     74       \return pdf, png, none, or svg
     75     */
     76    const std::string& image_anchor_format(void) const;
    7277
    7378    /**
     
    148153
    149154    VectorPair dictionary_;
     155    std::string image_anchor_format_;
    150156    std::string image_format_;
    151157    std::string trac_root_;
  • trunk/test/config_test.cc

    r978 r996  
    2828namespace svndigest{
    2929  void test_codon(test::Suite&);
     30  void test_read_write(test::Suite&);
    3031}} // end of namespace svndigest and theplu
    3132
     
    3738
    3839  test_codon(suite);
     40  test_read_write(suite);
    3941                                                                               
    4042  if (suite.ok()) {
     
    6769  }
    6870 
     71  void test_read_write(test::Suite& suite)
     72  {
     73    Configuration& config = Configuration::instance();
     74    std::stringstream ss;
     75    ss << config;
     76    config.load(ss);
     77    std::stringstream ss2;
     78    ss2 << config;
     79    if (ss2.str() != ss.str()) {
     80      suite.out() << "error: configuration output not equal\n";
     81      suite.out() << "defalt output:\n" << ss.str() << "\n";
     82      suite.out() << "second output:\n" << ss2.str() << "\n";
     83      suite.add(false);
     84    }
     85  }
     86
    6987}} // end of namespace svndigest and theplu
Note: See TracChangeset for help on using the changeset viewer.