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


C++ StringParser::setServer方法代码示例

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


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

示例1: backupIncremental

ErrorCode _CCONV FSBase::backupIncremental(const char * path, unsigned * amountChanged)
{
	if (path == nullptr)
		return INVALIDARG;

	StringParser otherParser;
	if (!otherParser.initialize(path))
		otherParser.setServer(path);
	if (otherParser.getServer().empty())
		return INVALIDARG;

	if (!createDir(otherParser.getServer()))
		return FAILEDTOGETWINDIR;
	fstream file;
	string data;
	ErrorCode retVal = getLogFileData(otherParser.getServer(), file, data);
	if (failed(retVal))
		return retVal;
	PathTimeLog log(parser.getServer(), data);
	if (log.isCorrupted())
		return LOG_CORRUPTED;
	unsigned amountBackup = 0;
	retVal = backupAux(parser.getServer(), otherParser.getServer(), &log.getLastBackupTime(), amountBackup);
	if (failed(retVal))
		return retVal;
	replaceRecordInData(parser.getServer(), log.getNowTime(), data);
	retVal = setLogFileData(otherParser.getServer(), file, data);
	if (amountChanged != nullptr)
		*amountChanged = amountBackup;
	return retVal;
}
开发者ID:skapix,项目名称:storage,代码行数:31,代码来源:FSStorage.cpp

示例2: backupFull

ErrorCode _CCONV FSBase::backupFull(const char * path, unsigned * amountChanged)
{
	if (path == nullptr)
		return INVALIDARG;
	StringParser otherParser;
	if (!otherParser.initialize(path))
		otherParser.setServer(path);
	if (otherParser.getServer().empty())
		return INVALIDARG;
	if (!createDir(otherParser.getServer()))
		return FAILEDTOGETWINDIR;
	unsigned amountBackup = 0;
	ErrorCode res = backupAux(parser.getServer(), otherParser.getServer(), NULL, amountBackup);
	if (amountChanged != nullptr)
		*amountChanged = amountBackup;
	return res;
}
开发者ID:skapix,项目名称:storage,代码行数:17,代码来源:FSStorage.cpp

示例3: makeLogRecord

//storage,db,table, params[bcp ~ storage/table], elapsed_time, comment([local,global],[hierarhy],[amount backuped])
//params for export files ~ amount of exported files
void makeLogRecord(const char * init, const char * params, const unsigned indexStorage, const char method,
	const double time_elapsed, const char * comment)
{
	if (indexStorage > 6) return;
	const char * methodNames[] = { "FSStorage", "SMBStorage", "FTPStorage", "MsSQLStorage",
		"PostgreSQLStorage", "SQLiteStorage", "MongoDB" };
	string rel_path = methodNames[indexStorage];
	if (!createDir(rel_path))
	{
		cout << "Can't create dir";
		return;
	}
	string method_name, method_params;
	switch (tolower(method))
	{
	case 'a':
		method_name = "add";
		method_params = d_makeWithQuotes(string(params));
		break;
	case 'g':
		method_name = "get";
		method_params = d_makeWithQuotes(string(params));
		break;
	case 'e':
		method_name = "export";
		method_params = d_makeWithQuotes(string(comment));
		comment = nullptr;
		break;
	case 'f':
	case 'i':
	{
		method_name = tolower(method) == 'f' ? "backupFull" : "backupIncremental";
		StringParser parser(params);
		method_params = mergeServerDbTable(parser);
		break;
	}
	default:
		cout << "Can't log unknown method";
		return;
	}
	StringParser parser;
	//for FSStorage
	if (!parser.initialize(init))
		parser.setServer(init);
	//1 column: storage/db/table
	string new_record = mergeServerDbTable(parser) + ',';
	//2 column: params
	new_record += method_params + ',';
	//3 column: time
	string s_time(30,'\0');
	sprintf_s(&s_time[0], 30, "%f", time_elapsed);
	s_time.resize(s_time.find('\0'));
	new_record += s_time;
	//4 column[opt]: comment
	if (comment != nullptr && strlen(comment)>0)
	{
		new_record += ',' + string(comment);
	}

	rel_path = makePathFile(rel_path, method_name + ".csv");
	ofstream f(rel_path, ofstream::app | ofstream::out);
	if (!f.is_open())
	{
		cout << "Can't create/open log file" << endl;
		return;
	}
	f.write(new_record.data(), new_record.size());
	f << endl;

}
开发者ID:skapix,项目名称:storage,代码行数:72,代码来源:func.cpp


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