Mercurial > repos > aaronquinlan > multi_intersect
diff BEDTools-Version-2.14.3/src/utils/lineFileUtilities/lineFileUtilities.h @ 1:bec36315bd12 default tip
Deleted selected files
author | aaronquinlan |
---|---|
date | Sat, 19 Nov 2011 14:17:03 -0500 |
parents | dfcd8b6c1bda |
children |
line wrap: on
line diff
--- a/BEDTools-Version-2.14.3/src/utils/lineFileUtilities/lineFileUtilities.h Thu Nov 03 10:25:04 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#ifndef LINEFILEUTILITIES_H -#define LINEFILEUTILITIES_H - -#include <vector> -#include <string> -#include <cstring> -#include <cstdlib> -#include <sstream> - -using namespace std; - -// templated function to convert objects to strings -template <typename T> -inline -std::string ToString(const T & value) { - std::stringstream ss; - ss << value; - return ss.str(); -} - -// tokenize into a list of strings. -inline -void Tokenize(const string &str, vector<string> &elems, const string &delimiter = "\t") -{ - char* tok; - char cchars [str.size()+1]; - char* cstr = &cchars[0]; - strcpy(cstr, str.c_str()); - tok = strtok(cstr, delimiter.c_str()); - while (tok != NULL) { - elems.push_back(tok); - tok = strtok(NULL, delimiter.c_str()); - } -} - -// tokenize into a list of integers -inline -void Tokenize(const string &str, vector<int> &elems, const string &delimiter = "\t") -{ - char* tok; - char cchars [str.size()+1]; - char* cstr = &cchars[0]; - strcpy(cstr, str.c_str()); - tok = strtok(cstr, delimiter.c_str()); - while (tok != NULL) { - elems.push_back(atoi(tok)); - tok = strtok(NULL, delimiter.c_str()); - } -} - -#endif /* LINEFILEUTILITIES_H */ -