Path::Path(const Path &from_prefix, const Path &from_suffix) : _is_segment(from_prefix._is_segment) , _components(from_prefix._components) { //::std::cout << "\nCONCAT CONSTRUCT: " << from_prefix.toString() << " " << from_suffix.toString(); for (constPathIterator it = from_suffix.begin(); it != from_suffix.end(); ++it) { //::std::cout << "APPENDING: " << *it << "\n"; if (it->compare("..") == 0) { if (_components.size() > 0) { _components.pop_back(); } else if (_is_segment) { _components.push_back(*it); } else { throw ::std::invalid_argument("Path segment \"" + from_suffix.toString() + "\" cannot be appended to path \"" + from_prefix.toString() + "\"."); } } else if (it->compare(".") == 0) { /* skip */ } else { _components.push_back(*it); } } }
bool Path::isWildcard() const { for (constPathIterator it = begin(); it != end(); ++it) { if ((it->compare("*") == 0) || (it->compare("**") == 0)) { return true; } } return false; }