inline std::string prepend_to_path(
   const std::string& item_,
   const std::string& path_
 )
 {
   return path_.empty() ? item_ : item_ + path_separator() + path_;
 }
Beispiel #2
0
	inline
	std::string dir_str(void) const
	{
		return empty()?
			std::string():
			_p.as_string(path_separator(), true);
	}
Beispiel #3
0
bool TestReadlist::process ()
{
    TestDirWithTextFiles_facet facet (MIN_STRINGS, MAX_STRINGS, FILES_NO, o_);
    std::string fname = facet.dirname ();
    fname += path_separator ();
    fname += "*.txt";
    StrVec names;
    expand_wildcards (fname.c_str (), names);
    StrVec ll = read_lists (names);
    return true;
}
      inline std::string append_to_path(
        const std::string& item_,
        const std::string& path_
      )
      {
        const std::string sep = path_separator();

        if (path_.empty() || path_ == sep)
        {
          return item_ + path_;
        }
        else
        {
          return path_ + (ends_with(path_, sep) ? item_ + sep : sep + item_);
        }
      }
Beispiel #5
0
bool TestFileUtils :: process ()
{
    std::string fname = fixture_.dirname ();
    fname += path_separator ();
    fname += "*.txt";
    StrVec sv;
    expand_wildcards (fname.c_str (), sv);
    StrVec::iterator itr = sv.begin ();
    for (; itr != sv.end (); itr ++)
    {
        o_ << (*itr).c_str () << std::endl;
    }
    if (!sv.size ())
    {
        o_ << "No files to test reader" << std::endl;
        return false;
    }

    LineReader lr (sv.front ().c_str ());
    char* ln;
    int no = 0;
    int slen = 0;
    time_t st = time (NULL);
    while ((ln = lr.nextLine ()))
    {
        ++ no;
        slen += strlen (ln);
        //if (strlen (ln) > 100) o_ << ln;
        if (no % 100000 == 0)
        {
            int td = time (NULL) - st;
            double rd = double (slen) / (1024*1024);
            o_ << "\rline " << no << ", " << rd << " Mb, average speed " << rd / (td?td:1) << " Mb/s    " << std::flush;
        }
    }
    time_t et = time (NULL);
    lr.close ();
    return true;
}
Beispiel #6
0
	inline
	std::string str(void) const
	{
		return _p.as_string(path_separator(), false);
	}