本文整理汇总了C++中poco::regularexpression::MatchVec::size方法的典型用法代码示例。如果您正苦于以下问题:C++ MatchVec::size方法的具体用法?C++ MatchVec::size怎么用?C++ MatchVec::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::regularexpression::MatchVec
的用法示例。
在下文中一共展示了MatchVec::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setType
void WindowFunction::setType(const std::string &type)
{
//parse the input
Poco::RegularExpression::MatchVec matches;
Poco::RegularExpression("^\\s*(\\w+)\\s*(\\((.*)\\))?\\s*$").match(type, 0, matches);
if (matches.empty()) throw Pothos::InvalidArgumentException("WindowFunction("+type+")", "cant parse window type");
//parse the args
Poco::JSON::Array::Ptr args(new Poco::JSON::Array());
if (matches.size() > 3)
{
auto argsStr = type.substr(matches[3].offset, matches[3].length);
Poco::JSON::Parser p; p.parse("["+argsStr+"]");
args = p.getHandler()->asVar().extract<Poco::JSON::Array::Ptr>();
}
//check input
auto name = Poco::toLower(type.substr(matches[1].offset, matches[1].length));
if (name == "kaiser")
{
if (args->size() != 1) throw Pothos::InvalidArgumentException("WindowFunction("+type+")", "expects format: kaiser(beta)");
}
else if (args->size() != 0) throw Pothos::InvalidArgumentException("WindowFunction("+type+")", name + " takes no arguments");
//bind window function
if (name == "rectangular") _calc = &rectangular;
else if (name == "hann") _calc = &hann;
else if (name == "hamming") _calc = &hamming;
else if (name == "blackman") _calc = &blackman;
else if (name == "bartlett") _calc = &bartlett;
else if (name == "flattop") _calc = &flattop;
else if (name == "kaiser") _calc = std::bind(&kaiser, std::placeholders::_1, std::placeholders::_2, args->getElement<double>(0));
else throw Pothos::InvalidArgumentException("WindowFunction::setType("+type+")", "unknown window name");
this->reload();
}
示例2: readRectangularMasks
/// Read rectangular masks from a config file string
/// @param line :: line (string) from the config file
void EQSANSLoad::readRectangularMasks(const std::string& line)
{
// Looking for rectangular mask
// Rectangular mask = 7, 0; 7, 255
Poco::RegularExpression re_key("rectangular mask", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression re_key_alt("elliptical mask", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression::Match match;
if (re_key.match(line, 0, match) || re_key_alt.match(line, 0, match))
{
Poco::RegularExpression re_sig("=[ ]*([0-9]+)[ ]*[ ,][ ]*([0-9]+)[ ]*[ ;,][ ]*([0-9]+)[ ]*[ ,][ ]*([0-9]+)");
if (re_sig.match(line, 0, match))
{
Poco::RegularExpression::MatchVec posVec;
re_sig.match(line, 0, posVec);
if (posVec.size()==5)
{
for (int i=0; i<4; i++)
{
std::string num_str = line.substr(posVec[i+1].offset, posVec[i+1].length);
m_mask_as_string = m_mask_as_string + " " + num_str;
}
m_mask_as_string += ",";
}
}
}
}
示例3: readSourceSlitSize
/// Read the source slit sizes from a config file string
/// @param line :: line (string) from the config file
void EQSANSLoad::readSourceSlitSize(const std::string& line)
{
Poco::RegularExpression re_key("wheel", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression::Match match;
if (re_key.match(line, 0, match))
{
Poco::RegularExpression re_sig("([1-8]) wheel[ ]*([1-3])[ \\t]*=[ \\t]*(\\w+)");
if (re_sig.match(line, 0, match))
{
Poco::RegularExpression::MatchVec posVec;
re_sig.match(line, 0, posVec);
if (posVec.size()==2)
{
std::string num_str = line.substr(posVec[1].offset, posVec[1].length);
int slit_number = 0;
Poco::NumberParser::tryParse(num_str, slit_number);
slit_number--;
num_str = line.substr(posVec[2].offset, posVec[2].length);
int wheel_number = 0;
Poco::NumberParser::tryParse(num_str, wheel_number);
wheel_number--;
num_str = line.substr(posVec[3].offset, posVec[3].length);
Poco::RegularExpression re_size("\\w*?([0-9]+)mm");
int slit_size = 0;
re_size.match(num_str, 0, posVec);
if (posVec.size()==2)
{
num_str = line.substr(posVec[1].offset, posVec[1].length);
Poco::NumberParser::tryParse(num_str, slit_size);
}
m_slit_positions[wheel_number][slit_number] = slit_size;
}
}
}
}
示例4: singleInfo
bool singleInfo(const std::string & subject, std::string & info)
{
Poco::RegularExpression rg1("^([0-9]{5}) ([0-9]{14}) .+^RE .{28} ([0-9/,]{2}) ([0-9/,]{5}) .+^SP ([0-9/,]{4})",
Poco::RegularExpression::RE_MULTILINE| Poco::RegularExpression::RE_DOTALL| Poco::RegularExpression::RE_NEWLINE_ANYCRLF);
Poco::RegularExpression::MatchVec matchs;
int m = rg1.match(subject,0,matchs);
if(6 != m) return false;
//std::cout<<m<<matchs.size()<<"\n"<<subject<<std::endl;
//std::cin>>info;
std::vector< std::string > record;
std::vector< bool > lossrecord(5, false);
for(size_t i=1; i!=matchs.size(); i++)
{
record.push_back( subject.substr(matchs[i].offset, matchs[i].length) );
lossrecord[i-1] = std::string::npos != record[i-1].find('/');
}
if(lossrecord[3] && lossrecord[4] )//ͬʱȱ²â
{
return false;
}
for(size_t i=2; i<5; i++)
{
if(lossrecord[i])
{
record[i] = "99999";
}
else if( std::string::npos != record[i].find(',') )
{
record[i] = "1";
}
else if(i>2)
{
record[i] += '0';
}
}
for(size_t i=0; i<record.size(); i++)
{
info += record[i] + ' ';
}
info[info.size()-1] = '\n';
return true;
}
示例5: readModeratorPosition
/// Read the moderator position from a config file string
/// @param line :: line (string) from the config file
void EQSANSLoad::readModeratorPosition(const std::string& line)
{
Poco::RegularExpression re_key("sample location", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression::Match match;
if (re_key.match(line, 0, match))
{
Poco::RegularExpression re_sig("=[ ]*([0-9]+)");
if (re_sig.match(line, 0, match))
{
Poco::RegularExpression::MatchVec posVec;
re_sig.match(line, 0, posVec);
if (posVec.size()==2)
{
std::string num_str = line.substr(posVec[1].offset, posVec[1].length);
Poco::NumberParser::tryParseFloat(num_str, m_moderator_position);
m_moderator_position = -m_moderator_position/1000.0;
}
}
}
}
示例6: readBeamCenter
/// Read the beam center from a config file string
/// @param line :: line (string) from the config file
void EQSANSLoad::readBeamCenter(const std::string& line)
{
Poco::RegularExpression re_key("spectrum center", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression::Match match;
if (re_key.match(line, 0, match))
{
Poco::RegularExpression re_sig("=[ ]*([0-9]+.[0-9]*)[ ]*[ ,][ ]*([0-9]+.[0-9]+)");
if (re_sig.match(line, 0, match))
{
Poco::RegularExpression::MatchVec posVec;
re_sig.match(line, 0, posVec);
if (posVec.size()==3)
{
std::string num_str = line.substr(posVec[1].offset, posVec[1].length);
Poco::NumberParser::tryParseFloat(num_str, m_center_x);
num_str = line.substr(posVec[2].offset, posVec[2].length);
Poco::NumberParser::tryParseFloat(num_str, m_center_y);
}
}
}
}
示例7: readTOFcuts
/// Read the TOF cuts from a config file string
/// @param line :: line (string) from the config file
void EQSANSLoad::readTOFcuts(const std::string& line)
{
Poco::RegularExpression re_key("tof edge discard", Poco::RegularExpression::RE_CASELESS);
Poco::RegularExpression::Match match;
if (re_key.match(line, 0, match))
{
Poco::RegularExpression re_sig("=[ ]*([0-9]+)[ ]*[ ,][ ]*([0-9]+)");
if (re_sig.match(line, 0, match))
{
Poco::RegularExpression::MatchVec posVec;
re_sig.match(line, 0, posVec);
if (posVec.size()==3)
{
std::string num_str = line.substr(posVec[1].offset, posVec[1].length);
Poco::NumberParser::tryParseFloat(num_str, m_low_TOF_cut);
num_str = line.substr(posVec[2].offset, posVec[2].length);
Poco::NumberParser::tryParseFloat(num_str, m_high_TOF_cut);
}
}
}
}