/* * path_style.cc -- ePiX's class for path styles. * * This file is part of ePiX, a C++ library for creating high-quality * figures in LaTeX * * Version 1.1.18 * Last Change: September 15, 2007 */ /* * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 * Andrew D. Hwang * Department of Mathematics and Computer Science * College of the Holy Cross * Worcester, MA, 01610-2395, USA */ /* * ePiX is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ePiX is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public * License for more details. * * You should have received a copy of the GNU General Public License * along with ePiX; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "constants.h" #include "functions.h" // for snip_to #include "utils.h" // for get_chars #include "path_style.h" namespace ePiX { // true if arg is a string of ch static bool __epix_all_one_char(const std::string& arg, const char ch) { return arg.find_first_not_of(ch) == std::string::npos; } // convert string of dashes, spaces, and periods to a vector of breakpoints static std::vector __epix_get_breakpts(const std::string& pattern) { std::vector value; // Assume solid on anomalous input if (pattern.size() == 0 || __epix_all_one_char(pattern, '-') || __epix_all_one_char(pattern, ' ')) { value.push_back(0); value.push_back(1); return value; } // else const unsigned int sz(pattern.size()); // not zero const double dt(1.0/sz); for (unsigned int i=0; i path_state::breakpts() const { return m_breakpoints; } bool path_state::is_solid() const { return m_solid; } path_state& the_path_style() { static path_state* the_path_state(new path_state()); return *the_path_state; } } // end of namespace