Beispiel #1
0
T FromStringTo(const CharType* sz)
{
    std::basic_stringstream<CharType> sstrm(sz);

    T v;
    sstrm >> v;

    return v;    
}
Beispiel #2
0
        std::pair<int32_t, int32_t> getIndelRange() const
        {
            assert(m_dataPtr);
            uint8_t *qv_aux = bam_aux_get(m_dataPtr.get(), "XW");
            int start = INDEL_NO_RANGE;
            int end = INDEL_NO_RANGE;
            char underscore;

            if (qv_aux)
            {
                std::istringstream sstrm(bam_aux2Z(qv_aux));
                sstrm >> start;
                sstrm >> underscore;
                sstrm >> end;
            }
            return std::pair<int, int>(start, end);
        }
bool BezierParser::ParseLine(const std::string& line)
{
	// if line starts with #, return true
	// if line is empty, skip
	if(line.empty()) 
	{
		::OutputDebugString("Empty\n");
		return true;
	}
	int firstNonWhitespace = line.find_first_not_of(" \t\n\r");
	int lastNonWhitespace = line.find_last_not_of(" \t\n\r");
	if(-1 == firstNonWhitespace) 
	{
		::OutputDebugString("Whitespace\n");
		return true;
	}

	// prepare a trimmed line
	std::string line_trim = line.substr(firstNonWhitespace, (lastNonWhitespace+1) - firstNonWhitespace);
	
	if(line_trim[0]=='#') 
	{
		::OutputDebugString("#\n");
		return true;
	}

	if(ParseStateNone == m_state)
	{
		// look for number 
		int int_val = -1;
		std::stringstream sstrm(line_trim);

		// try to parse the number
		bool success = sstrm >> int_val;
		if(!success)
		{ return false; }
		
		// record the integer value (not sure what it's for yet)
		m_intval = int_val;

		// advance the state
		m_state = ParseStateFoundNumber;
		
		// the number should be on its own line, so quit once we've found it; ignore everything else.
		return true;
	}