当前位置: 首页>>代码示例>>C++>>正文


C++ MatchVec::empty方法代码示例

本文整理汇总了C++中poco::regularexpression::MatchVec::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ MatchVec::empty方法的具体用法?C++ MatchVec::empty怎么用?C++ MatchVec::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poco::regularexpression::MatchVec的用法示例。


在下文中一共展示了MatchVec::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkProgramInfoLog

//--------------------------------------------------------------
void ofShader::checkProgramInfoLog(GLuint program) {
	GLsizei infoLength;
	glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLength);
	if (infoLength > 1) {
		GLchar* infoBuffer = new GLchar[infoLength];
		glGetProgramInfoLog(program, infoLength, &infoLength, infoBuffer);
		string msg = "ofShader: program reports:\n";
#ifdef TARGET_RASPBERRYPI
		if (shaderSource.find(GL_FRAGMENT_SHADER) != shaderSource.end()) {
			Poco::RegularExpression re(",.line.([^\\)]*)");
			Poco::RegularExpression::MatchVec matches;
			string infoString = (infoBuffer != NULL) ? string(infoBuffer): "";
			re.match(infoString, 0, matches);
			ofBuffer buf = shaderSource[GL_FRAGMENT_SHADER];
			ofBuffer::Line line = buf.getLines().begin();
			if (!matches.empty()){
			int  offendingLineNumber = ofToInt(infoString.substr(matches[1].offset, matches[1].length));
				ostringstream msg;
				msg << "ofShader: " + nameForType(GL_FRAGMENT_SHADER) + ", offending line " << offendingLineNumber << " :"<< endl;
				for(int i=0; line != buf.getLines().end(); line++, i++ ){
					string s = *line;
					if ( i >= offendingLineNumber -3 && i < offendingLineNumber + 2 ){
						msg << "\t" << setw(5) << (i+1) << "\t" << s << endl;
					}
				}
				ofLogError("ofShader") << msg.str();
			}
		}
#endif
		ofLogError("ofShader", msg + infoBuffer);
		delete [] infoBuffer;
	}
}
开发者ID:archerlulu,项目名称:openFrameworks,代码行数:34,代码来源:ofShader.cpp

示例2: checkShaderInfoLog

//--------------------------------------------------------------
void ofShader::checkShaderInfoLog(GLuint shader, GLenum type, ofLogLevel logLevel) {
	GLsizei infoLength;
	glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLength);
	if (infoLength > 1) {
		GLchar* infoBuffer = new GLchar[infoLength];
		glGetShaderInfoLog(shader, infoLength, &infoLength, infoBuffer);
		ofLog(logLevel, "ofShader: %s shader reports:\n%s", nameForType(type).c_str(), infoBuffer);
		if (shaderSource.find(type) != shaderSource.end()) {
			// The following regexp should match shader compiler error messages by Nvidia and ATI.
			// Unfortunately, each vendor's driver formats error messages slightly different.
			Poco::RegularExpression re("^.*[(:]{1}(\\d+)[:)]{1}.*");
			Poco::RegularExpression::MatchVec matches;
			string infoString = (infoBuffer != NULL) ? string(infoBuffer): "";
			re.match(infoString, 0, matches);
			ofBuffer buf = shaderSource[type];
			ofBuffer::Line line = buf.getLines().begin();
			if (!matches.empty()){
			int  offendingLineNumber = ofToInt(infoString.substr(matches[1].offset, matches[1].length));
				ostringstream msg;
				msg << "ofShader: " + nameForType(type) + ", offending line " << offendingLineNumber << " :"<< endl;
				for(int i=0; line != buf.getLines().end(); line++, i++ ){
					string s = *line;
					if ( i >= offendingLineNumber -3 && i < offendingLineNumber + 2 ){
						msg << "\t" << setw(5) << (i+1) << "\t" << s << endl;
					}
				}
				ofLog(logLevel) << msg.str();
			}
		}
		delete [] infoBuffer;
	}
}
开发者ID:archerlulu,项目名称:openFrameworks,代码行数:33,代码来源:ofShader.cpp

示例3: 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();
}
开发者ID:m0x72,项目名称:pothos,代码行数:35,代码来源:WindowFunction.cpp

示例4: determineAnimated

void ofxTPSpriteData::determineAnimated() {
    Poco::RegularExpression reg("((?:(?![\\d]*[.].*$)[\\w\\s])+)([\\d]*)([.].*)$");
//    int match(const std::string& subject, Match& mtch, int options = 0) const;
    Poco::RegularExpression::MatchVec matches;
    int numberOfMatches = reg.match(name, 0, matches);
    if(!matches.empty()){
        if(matches[0].length != 0) {
            if (matches[2].length > 0) {
                if (matches[1].length > 0) {
                    animationName = name.substr(matches[1].offset, matches[1].length);
                    if(animationName.substr(animationName.size()-1, animationName.size()) == "_") {
                        animationName = animationName.substr(0, animationName.size()-1);
                    }
                }
                bAnimated = true;
                frame = ofToInt(name.substr(matches[2].offset, matches[2].length));
            } else {
                bAnimated = false;
            }
        }
        else {
            ofLog(OF_LOG_ERROR, "ERROR: Filename format not recognised for " + name);
        }
    } else {
        // Make sure not to Trim names in Texture Packer! if you debug your way here!
        bAnimated = false;
    }
//---------- CP-11 version
/** 
    if (reg.match(name, matches)) {
        if (subStrings.length(2) > 0) {
            if (subStrings.length(1) > 0) {
                animationName = subStrings[1];
            }
            isAnimated = true;
            frame = ofToInt(subStrings[2]);
        } else {
            isAnimated = false;
        }
    } else {
        ofLog(OF_LOG_ERROR, "ERROR: Filename format not recognised for " + name);
    }

    smatch subStrings;
    regex expression ("((?:(?![\\d]*[.].*$)[\\w\\s])+)([\\d]*)([.].*)$");
    
    if (regex_match(name, subStrings, expression)) {
        if (subStrings.length(2) > 0) {
            if (subStrings.length(1) > 0) {
                animationName = subStrings[1];
            }
            isAnimated = true;
            frame = ofToInt(subStrings[2]);
        } else {
            isAnimated = false;
        }
    } else {
        ofLog(OF_LOG_ERROR, "ERROR: Filename format not recognised for " + name);
    }
*/

}
开发者ID:daitomanabe,项目名称:ofxTexturePacker,代码行数:62,代码来源:ofxTPSpriteData.cpp


注:本文中的poco::regularexpression::MatchVec::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。