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


C++ Poco::icompare方法代码示例

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


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

示例1: main

int main(int argc, char** argv)
{
	if (argc < 3) return usage();
	if (strlen(argv[1]) != 3) return usage();

	std::string conv(argv[1]);

	FileInputStream fis(argv[2]);
	std::stringstream ss;
	StreamCopier::copyStream(fis, ss);
	fis.close();

	FileOutputStream fos(argv[2]);
	if (0 == icompare(conv, "u2d")) unixToDos(ss, fos);
	else if (0 == icompare(conv, "d2u")) dosToUnix(ss, fos);
	else return usage();
	fos.flush();

	return 0;
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:20,代码来源:LineEndingConverter.cpp

示例2: isCommonWord

//--------------------------------------------------------------
int testApp::isCommonWord(string _testString, vector<string> _ignoreWords){
    //returns 0 if common word is found from a given vector or list of words to Ignore, returns 1 or -1 if no word can be found
    
    vector<string>::iterator g;
    int isCommon;
    for(int i =0; i<_ignoreWords.size(); i++){
        isCommon = icompare(_testString, _ignoreWords[i]);
        if(isCommon == 0) break;
        }
        return isCommon;
}
开发者ID:ASRagab,项目名称:textoF,代码行数:12,代码来源:testApp.cpp

示例3: ClientException

const BaosIpEnumerator::Device& BaosIpEnumerator::findByAddress(const std::string& ipAddress) const
{
	for (const auto& device : devices_)
	{
		if (!icompare(getAddress(device), ipAddress))
		{
			return device;
		}
	}

	throw ClientException("Device Not Found");
}
开发者ID:weinzierl-engineering,项目名称:baos,代码行数:12,代码来源:BaosEnumerator.cpp

示例4: createNameStructs

//_________________________
 nameStruct testApp::createNameStructs(string token, vector<string> &_baseText, int flagPosition){
    //function should return nameStruct with a point, properName and appearances for sizing this can be called to create vector of structs
    
    int appearances =1;
    int sumOfLocations =0;
    ofPoint aPoint;
    for(int j = 0; j< _baseText.size(); j++){
        
        int foundToken = icompare(token, _baseText[j]);
        if(foundToken == 0){ 
            appearances ++;
            sumOfLocations +=j;
        }
    }
    aPoint.y = (float) sumOfLocations/appearances;
     if(flagPosition ==0) aPoint.x = 0.30*(float) ofGetWidth();
    if(flagPosition ==1) aPoint.x = .70*(float) ofGetWidth();
    nameStruct _theName = nameStruct(aPoint, token, appearances);
    return _theName; 
}
开发者ID:ASRagab,项目名称:textoF,代码行数:21,代码来源:testApp.cpp

示例5: testIcompare

void StringTest::testIcompare()
{
    std::string s1 = "AAA";
    std::string s2 = "aaa";
    std::string s3 = "bbb";
    std::string s4 = "cCcCc";
    std::string s5;
    assert (icompare(s1, s2) == 0);
    assert (icompare(s1, s3) < 0);
    assert (icompare(s1, s4) < 0);
    assert (icompare(s3, s1) > 0);
    assert (icompare(s4, s2) > 0);
    assert (icompare(s2, s4) < 0);
    assert (icompare(s1, s5) > 0);
    assert (icompare(s5, s4) < 0);

    std::string ss1 = "xxAAAzz";
    std::string ss2 = "YaaaX";
    std::string ss3 = "YbbbX";
    assert (icompare(ss1, 2, 3, ss2, 1, 3) == 0);
    assert (icompare(ss1, 2, 3, ss3, 1, 3) < 0);
    assert (icompare(ss1, 2, 3, ss2, 1) == 0);
    assert (icompare(ss1, 2, 3, ss3, 1) < 0);
    assert (icompare(ss1, 2, 2, ss2, 1, 3) < 0);
    assert (icompare(ss1, 2, 2, ss2, 1, 2) == 0);
    assert (icompare(ss3, 1, 3, ss1, 2, 3) > 0);

    assert (icompare(s1, s2.c_str()) == 0);
    assert (icompare(s1, s3.c_str()) < 0);
    assert (icompare(s1, s4.c_str()) < 0);
    assert (icompare(s3, s1.c_str()) > 0);
    assert (icompare(s4, s2.c_str()) > 0);
    assert (icompare(s2, s4.c_str()) < 0);
    assert (icompare(s1, s5.c_str()) > 0);
    assert (icompare(s5, s4.c_str()) < 0);

    assert (icompare(ss1, 2, 3, "aaa") == 0);
    assert (icompare(ss1, 2, 2, "aaa") < 0);
    assert (icompare(ss1, 2, 3, "AAA") == 0);
    assert (icompare(ss1, 2, 2, "bb") < 0);

    assert (icompare(ss1, 2, "aaa") > 0);
}
开发者ID:as2120,项目名称:ZPoco,代码行数:43,代码来源:StringTest.cpp

示例6: testReadWriteMultiPartStore

void MailMessageTest::testReadWriteMultiPartStore()
{
	std::string msgin(
		"Content-Type: multipart/mixed; boundary=MIME_boundary_31E8A8D61DF53389\r\n"
		"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
		"From: [email protected]\r\n"
		"Mime-Version: 1.0\r\n"
		"Subject: Test Message\r\n"
		"To: John Doe <[email protected]>\r\n"
		"\r\n"
		"--MIME_boundary_31E8A8D61DF53389\r\n"
		"Content-Disposition: inline\r\n"
		"Content-Transfer-Encoding: 8bit\r\n"
		"Content-Type: text/plain\r\n"
		"\r\n"
		"Hello World!\r\n"
		"\r\n"
		"--MIME_boundary_31E8A8D61DF53389\r\n"
		"Content-Disposition: attachment; filename=sample.dat\r\n"
		"Content-ID: abcd1234\r\n"
		"Content-Transfer-Encoding: base64\r\n"
		"Content-Type: application/octet-stream; name=sample\r\n"
		"\r\n"
		"VGhpcyBpcyBzb21lIGJpbmFyeSBkYXRhLiBSZWFsbHku\r\n"
		"--MIME_boundary_31E8A8D61DF53389--\r\n"
	);

	std::istringstream istr(msgin);
	std::ostringstream ostr;
	FilePartStoreFactory pfsf;
	MailMessage message(&pfsf);

	message.read(istr);
	
	MailMessage::PartVec::const_iterator it = message.parts().begin();
	MailMessage::PartVec::const_iterator end = message.parts().end();
	for (; it != end; ++it)
	{
		FilePartStore* fps = dynamic_cast<FilePartStore*>(it->pSource);
		if (fps && fps->filename().size())
		{
			std::string filename = fps->filename();
			assert (filename == "sample.dat");
			std::string path = fps->path();
			// for security reasons, the filesystem temporary
			// filename is not the same as attachment name
			std::size_t sz = (path.size() > filename.size()) ? filename.size() : path.size();
			assert (0 != icompare(path, path.size() - sz, sz, path));
			
			Poco::FileInputStream fis(path);
			assert (fis.good());
			std::string read;
			std::string line;
			while (std::getline(fis, line)) read += line;

			assert (!read.empty());
			assert (read == "This is some binary data. Really.");
		}
	}
	
	message.write(ostr);
	std::string msgout(ostr.str());
	assert (msgout == msgin);
}
开发者ID:alexdarling,项目名称:roadrunner,代码行数:64,代码来源:MailMessageTest.cpp


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