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


C++ string::size方法代码示例

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


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

示例1: Handler

//
// Handler
//
INT_32 FnTruncate::Handler(CDT            * aArguments,
                           const UINT_32    iArgNum,
                           CDT            & oCDTRetVal,
                           Logger         & oLogger)
{
	if (iArgNum == 2)
	{
		const UINT_32       iMaxLen = UINT_32(aArguments[0].GetInt());
		const STLW::string   sData   = aArguments[1].GetString();

		if (sData.size() > iMaxLen) { oCDTRetVal = STLW::string(sData, 0, iMaxLen); }
		else                        { oCDTRetVal = sData;                          }

		return 0;
	}
	else if (iArgNum == 3)
	{
		const UINT_32  iMaxLen = UINT_32(aArguments[1].GetInt());
		STLW::string    sData   = aArguments[2].GetString();

		if (sData.size() > iMaxLen)
		{
			sData = STLW::string(sData, 0, iMaxLen);
			sData.append(aArguments[0].GetString());
		}

		oCDTRetVal = sData;
		return 0;
	}

	oLogger.Emerg("Usage: TRUNCATE(x, offest[, addon])");
return -1;
}
开发者ID:Azq2,项目名称:ctpp2,代码行数:36,代码来源:FnTruncate.cpp

示例2: CDT

// CTPP2
CTPP2::CTPP2(unsigned int arg_stack_size, unsigned int code_stack_size, unsigned int steps_limit, unsigned int max_functions,
             STLW::string src_charset, STLW::string dst_charset) {
    try {
        params = new CDT(CDT::HASH_VAL);
        syscalls = new SyscallFactory(max_functions);
        STDLibInitializer::InitLibrary(*syscalls);
        vm = new VM(syscalls, arg_stack_size, code_stack_size, steps_limit);

        int i = 0;
        while (functions[i])
            bind(functions[i++]());

        if (src_charset.size() && dst_charset.size()) {
            charset.src = src_charset;
            charset.dst = dst_charset;
            charset.convert = true;
        } else {
            // Конвертирование не требуется
            charset.convert = false;
        }
    } catch (...) {
        cpp_free(params);
        if (syscalls) {
            STDLibInitializer::DestroyLibrary(*syscalls);
            cpp_free(syscalls);
        }
        cpp_free(vm);
    }
}
开发者ID:Azq2,项目名称:php-ctpp2,代码行数:30,代码来源:ctpp2.cpp

示例3: main

int main(void)
{

	CDT oArgs;
	oArgs.PushBack(101.5);
	oArgs.PushBack(101.4);

	STLW::string sResult;
	FormatString("_%0.2f_", sResult, oArgs);

	fwrite(sResult.c_str(), sResult.size(), 1, stdout);

	// make valgrind happy
	fclose(stdin);
	fclose(stdout);
	fclose(stderr);

return EX_OK;
}
开发者ID:Azq2,项目名称:ctpp2,代码行数:19,代码来源:CTPP2DTOA.cpp

示例4: FmtString

//
// String
//
static void FmtString(StringBuffer   & oBuffer,
                      const CDT      & oCurrentArgument,
                      const UINT_32    iFmtFlags,
                      const INT_32     iWidth,
                      const INT_32     iMaxChars,
                      CHAR_8           chPadSymbol)
{
	const STLW::string sTMP    = oCurrentArgument.GetString();

	INT_32 iFormatSize = sTMP.size();
	if (iFormatSize > iMaxChars && iMaxChars > 0) { iFormatSize = iMaxChars; }

	if (iFmtFlags & F_LEFT_ALIGN)
	{
		oBuffer.Append(sTMP.data(), iFormatSize);
		if (iWidth > iFormatSize) { oBuffer.Append(iWidth - iFormatSize, chPadSymbol); }
	}
	else
	{
		if (iWidth > iFormatSize) { oBuffer.Append(iWidth - iFormatSize, chPadSymbol); }
		oBuffer.Append(sTMP.data(), iFormatSize);
	}
}
开发者ID:androidsoft,项目名称:kiwix_mirror,代码行数:26,代码来源:CTPP2Sprintf.cpp

示例5: main

int main(int argc, char ** argv)
{
	const char * szConfigFile = NULL;
	if (argc == 1)
	{
		fprintf(stderr, "Global config not given, ");
		szConfigFile = getenv("CAS_GLOBAL_CONFIG");
		if (szConfigFile != NULL)
		{
			fprintf(stderr, " using %s from ENVIRONMENT", szConfigFile);
		}
		else
		{
			szConfigFile = CAS_GLOBAL_CONFIG_FILE;
			fprintf(stderr, " using %s as DEFAULT\n", szConfigFile);
		}
	}
	else if (argc == 2) { szConfigFile = argv[1]; }
	else { fprintf(stderr, "usage: %s [global-config.xml]\n", argv[0]); return EX_USAGE; }

	FILE * F = fopen(szConfigFile, "rb");
	if (F == NULL) { fprintf(stderr, "ERROR: Cannot open `%s` for reading: %s\n", szConfigFile, strerror(errno)); return EX_SOFTWARE; }

	// Store path to file as include directory
	CCHAR_P szTMP = szConfigFile + strlen(szConfigFile);
	while (szTMP != szConfigFile && *szTMP != '/' && *szTMP != '\\') { --szTMP; }

	STLW::vector<STLW::string> vIncludeDirs;
	if (szTMP != szConfigFile) { vIncludeDirs.push_back(STLW::string(szConfigFile, (szTMP - szConfigFile))); }

	try
	{
		ASGlobalConfig oGlobalConfig;
		ASGlobalConfigHandler oHandler(oGlobalConfig, vIncludeDirs);
		ASXMLParser oParser(&oHandler);
		if (oParser.ParseFile(F) == -1)
		{
			fprintf(stderr, "ERROR: In file %s: %s\n", szConfigFile, oHandler.GetError().c_str());
			return EX_CONFIG;
		}
		fclose(F);

		fprintf(stdout, "  Libexec dirs:\n");
		UINT_32 iI = 0;
		for(; iI < oGlobalConfig.libexec_dirs.size(); ++iI)
		{
			fprintf(stdout, "      %s\n", oGlobalConfig.libexec_dirs[iI].c_str());
		}
		fprintf(stdout, "\n  Modules:\n");
		for(iI = 0; iI < oGlobalConfig.modules_list.size(); ++iI)
		{

			fprintf(stdout, "      Name:         %s\n"
			                "      Type:         %s\n",
			                                            oGlobalConfig.modules_list[iI].name.c_str(),
			                                            oGlobalConfig.modules_list[iI].moduletype.c_str());

			STLW::string sTMP = CheckFile(oGlobalConfig.libexec_dirs, oGlobalConfig.modules_list[iI].library);
			if (sTMP.size() == 0)
			{
				fprintf(stdout, "      *** ERROR: Cannot find Library file: %s\n", oGlobalConfig.modules_list[iI].library.c_str());
			}
			else
			{
				fprintf(stdout, "      Library file: %s\n", CheckFile(oGlobalConfig.libexec_dirs, oGlobalConfig.modules_list[iI].library).c_str());
			}
			STLW::string sData = Dump(oGlobalConfig.modules_list[iI].configuration);
			if (!sData.empty() && sData != "\"\"\n") { fprintf(stdout, "      Configuration: %s\n", sData.c_str()); }
			// TBD
			fprintf(stdout, "\n");
		}
	}
        catch(STLW::exception &e) { fprintf(stderr, "ERROR: %s\n", e.what()); return EX_SOFTWARE; }
        catch(...)                { fprintf(stderr, "ERROR: Ouch!\n"); return EX_SOFTWARE; }

	fclose(stdin);
	fclose(stdout);
	fclose(stderr);

return EX_OK;
}
开发者ID:a-lunkov,项目名称:cas,代码行数:81,代码来源:ASGlobalConfigParser.cpp

示例6: oLogger

// Thread function
static void * ThreadFunction(void * pContext)
{
	ThreadContext * pThreadContext = (ThreadContext *)pContext;

	pthread_mutex_lock(&(pThreadContext -> output_mutex));
	fprintf(stderr, "Initilalizing...\n");
	pthread_mutex_unlock(&(pThreadContext -> output_mutex));

	// Create per-thread VM instance

	// Syscall factory
	SyscallFactory * pSyscallFactory = new SyscallFactory(pThreadContext -> max_handlers);
	// Init standard library
	STDLibInitializer::InitLibrary(*pSyscallFactory);
	// Virtual machine
	VM * pVM = new VM(pSyscallFactory);
	// Okay, all done with thread-specific

	// Fill data
	CDT oData;
	oData["hello"] = "Hello, World!";

	pthread_mutex_lock(&(pThreadContext -> output_mutex));
	fprintf(stderr, "Okay, ready to work\n");
	pthread_mutex_unlock(&(pThreadContext -> output_mutex));

	FileLogger oLogger(stderr);

	// Perform some work
	const VMMemoryCore * pVMMemoryCore = NULL;
	for (UINT_32 iCount = 0; iCount < MAX_ITERATIONS; ++iCount)
	{
		STLW::string sResult;
		StringOutputCollector  oDataCollector(sResult);

		// Get template, thread-safe
		pthread_mutex_lock(&(pThreadContext -> template_mutex));
		STLW::map<STLW::string, VMFileLoader *>::iterator itLoader = pThreadContext -> templates.find("hello.ct2");
		if (itLoader == pThreadContext -> templates.end())
		{
			continue;
		}

		pVMMemoryCore = itLoader -> second -> GetCore();
		pthread_mutex_unlock(&(pThreadContext -> template_mutex));

		// Run VM
		pVM -> Init(pVMMemoryCore, &oDataCollector, &oLogger);
		UINT_32 iIP = 0;
		pVM -> Run(pVMMemoryCore, &oDataCollector, iIP, oData, &oLogger);

		// All done, print results
		pthread_mutex_lock(&(pThreadContext -> output_mutex));
		fwrite(sResult.c_str(), sResult.size(), 1, stdout);
		pthread_mutex_unlock(&(pThreadContext -> output_mutex));
	}

	delete pVM;
	delete pSyscallFactory;

return NULL;
}
开发者ID:Azq2,项目名称:ctpp2,代码行数:63,代码来源:CTPP2MT.cpp

示例7: Handler

//
// Handler
//
INT_32 FnMBTruncate::Handler(CDT            * aArguments,
                             const UINT_32    iArgNum,
                             CDT            & oCDTRetVal,
                             Logger         & oLogger)
{
	if (iArgNum == 2)
	{
		const UINT_32       iMaxLen = UINT_32(aArguments[0].GetInt());
		const STLW::string  sData   = aArguments[1].GetString();

		CCHAR_P  szStart  = sData.data();
		CCHAR_P  szEnd    = sData.data() + sData.size();
		INT_32   iPos     = 0;
		UINT_32  iCharPos = 0;
		for(;;)
		{
			INT_32 iCharLen = utf_charlen(szStart + iPos, szEnd);
			if (iCharLen == -3) { break; }

			// Check character length
			if (iCharLen < 0) { iCharLen = 1; }
			// Skip errors
			else              { ++iCharPos;   }
			iPos += iCharLen;

			if (iCharPos >= iMaxLen) { break; }
		}

		if (iCharPos == iMaxLen) { oCDTRetVal = STLW::string(sData, 0, iPos); }
		else                     { oCDTRetVal = sData;                       }

		return 0;
	}
	else if (iArgNum == 3)
	{
		const UINT_32  iMaxLen = UINT_32(aArguments[1].GetInt());
		STLW::string   sData   = aArguments[2].GetString();

		CCHAR_P  szStart  = sData.data();
		CCHAR_P  szEnd    = sData.data() + sData.size();
		INT_32   iPos     = 0;
		UINT_32  iCharPos = 0;
		for(;;)
		{
			INT_32 iCharLen = utf_charlen(szStart + iPos, szEnd);

			if (iCharLen == -3) { break; }

			// Check character length
			if (iCharLen < 0) { iCharLen = 1; }
			// Skip errors
			else              { ++iCharPos;   }
			iPos += iCharLen;

			if (iCharPos >= iMaxLen) { break; }
		}
		if (iCharPos >= iMaxLen)
		{
			sData = STLW::string(sData, 0, iPos);
			sData.append(aArguments[0].GetString());
		}

		oCDTRetVal = sData;
		return 0;
	}

	oLogger.Emerg("Usage: MB_TRUNCATE(data, offset) or MB_TRUNCATE(data, offset, add_on)");
return -1;
}
开发者ID:androidsoft,项目名称:kiwix_mirror,代码行数:72,代码来源:FnMBTruncate.cpp

示例8: FormatString

INT_32 FormatString(const STLW::string & sFormatString, STLW::string & sResult, const CDT & oArgs)
{
	using namespace CTPP;
	StringBuffer oBuffer(sResult);

	CCHAR_P sPos = sFormatString.data();
	CCHAR_P sEnd = sFormatString.data() + sFormatString.size();
	CCHAR_P sEndSave = sPos;

	UINT_32 iPos = 0;
	for(;;)
	{
		INT_32   iWidth            = -1;
		INT_32   iPrecision        = -1;
		CHAR_8   chPadSymbol       = ' ';
		UINT_32  iFmtFlags         = 0;
		eFmtLengths   oFmtLengths  = F_NONE;
		eParserState  oParserState = C_INITIAL_STATE;
		// Find "%" at start of token
		while(sPos != sEnd)
		{
			if (*sPos == '%')
			{
				oParserState = C_START_FOUND;
				break;
			}
			++sPos;
		}
		oBuffer.Append(sEndSave, sPos);

		if (oParserState == C_START_FOUND)
		{
			++sPos;
			// Check end of string
			if (sPos == sEnd) { return -1; }

			bool bEndCycle = false;
			while (!bEndCycle)
			{
				// Flags
				switch(*sPos)
				{
					// '-' Left-justify within the given field width; Right justification is the default (see width sub-specifier).
					case '-':
						iFmtFlags |= F_LEFT_ALIGN;
						++sPos;
						break;

					// '+' Forces to preceed the result with a plus or minus sign (+ or -) even for positive numbers.
					//     By default, only negative numbers are preceded with a - sign.
					case '+':
						iFmtFlags |= F_FORCE_SIGN;
						iFmtFlags &= ~F_SIGN_SPACE;
						++sPos;
						break;

					// ' ' (space) If no sign is going to be written, a blank space is inserted before the value.
					case ' ':
						iFmtFlags |= F_SIGN_SPACE;
						iFmtFlags &= ~F_FORCE_SIGN;
						++sPos;
						break;

					// '#' Used with o, x or X specifiers the value is preceeded with 0, 0x or 0X respectively for values different than zero.
					//     Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow.
					//     By default, if no digits follow, no decimal point is written.
					//     Used with g or G the result is the same as with e or E but trailing zeros are not removed.
					case '#':
						iFmtFlags |= F_HASH_SIGN;
						++sPos;
						break;

					// '0' Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier).
					case '0':
						chPadSymbol = '0';
						++sPos;
						break;

					default:
						bEndCycle = true;
						break;
				}

				// Check end of string
				if (sPos == sEnd) { return -1; }
			}

			/* Width
			 * number  Minimum number of characters to be printed. If the value to be printed is shorter than this number,
			 *         the result is padded with blank spaces. The value is not truncated even if the result is larger.
			 */
			if (*sPos > '0' && *sPos <= '9')
			{
				iWidth = 0;
				while (sPos != sEnd && (*sPos >= '0' && *sPos <= '9'))
				{
					iWidth = iWidth * 10 + *sPos - '0';
					++sPos;
				}
			}
//.........这里部分代码省略.........
开发者ID:androidsoft,项目名称:kiwix_mirror,代码行数:101,代码来源:CTPP2Sprintf.cpp

示例9: Handler

//
// Handler
//
INT_32 FnMBSubstring::Handler(CDT            * aArguments,
                              const UINT_32    iArgNum,
                              CDT            & oCDTRetVal,
                              Logger         & oLogger)
{
	// Check number of parameters
	if (iArgNum == 0) { oCDTRetVal = ""; return 0; }

	// substr('foobar', 2) -> 'obar'
	if (iArgNum == 2)
	{
		const UINT_32       iOffset = UINT_32(aArguments[0].GetInt());
		const STLW::string  sResult = aArguments[1].GetString();

		CCHAR_P  szStart  = sResult.data();
		CCHAR_P  szEnd    = sResult.data() + sResult.size();
		INT_32   iPos     = 0;
		UINT_32  iCharPos = 0;
		for(;;)
		{
			INT_32 iCharLen = utf_charlen(szStart + iPos, szEnd);

			if (iCharLen == -3) { break; }

			// Check character length
			if (iCharLen < 0) { iCharLen = 1; }
			// Skip errors
			else              { ++iCharPos;   }
			iPos += iCharLen;

			if (iCharPos >= iOffset) { break; }
		}

		if (iCharPos < iOffset) { oCDTRetVal = ""; }
		else                    { oCDTRetVal = sResult.substr(iPos); }

		return 0;
	}
	// substr('foobar', 2, 3) -> 'oba'
	if (iArgNum == 3)
	{
		const UINT_32       iBytes  = UINT_32(aArguments[0].GetInt());
		const UINT_32       iOffset = UINT_32(aArguments[1].GetInt());
		const STLW::string  sResult = aArguments[2].GetString();

		CCHAR_P  szStart  = sResult.data();
		CCHAR_P  szEnd    = sResult.data() + sResult.size();
		INT_32   iPos     = 0;
		UINT_32  iCharOffset = 0;
		UINT_32  iCharPos = 0;
		for(;;)
		{
			INT_32 iCharLen = utf_charlen(szStart + iPos, szEnd);

			if (iCharLen == -3) { break; }

			// Check character length
			if (iCharLen < 0) { iCharLen = 1; }
			// Skip errors
			else              { ++iCharPos;   }
			iPos += iCharLen;

			if (iCharPos == iOffset)          { iCharOffset = iPos; }

			if (iCharPos == iOffset + iBytes) { break; }
		}

		if (sResult.size() < iCharOffset) { oCDTRetVal = ""; }
		else                              { oCDTRetVal = sResult.substr(iCharOffset, iPos - iCharOffset); }

		return 0;
	}
	// substr('foobar', 2, 3, '1234567') -> 'fo1234567r'
	if (iArgNum == 4)
	{
		STLW::string        sReplacement = aArguments[0].GetString();
		const UINT_32       iBytes       = UINT_32(aArguments[1].GetInt());
		const UINT_32       iOffset      = UINT_32(aArguments[2].GetInt());
		const STLW::string  sTMP         = aArguments[3].GetString();

		CCHAR_P  szStart  = sTMP.data();
		CCHAR_P  szEnd    = sTMP.data() + sTMP.size();
		UINT_32  iPos     = 0;
		UINT_32  iCharOffset = 0;
		UINT_32  iCharPos = 0;
		for(;;)
		{
			INT_32 iCharLen = utf_charlen(szStart + iPos, szEnd);

			if (iCharLen == -3) { break; }

			// Check character length
			if (iCharLen < 0) { iCharLen = 1; }
			// Skip errors
			else              { ++iCharPos;   }
			iPos += iCharLen;

//.........这里部分代码省略.........
开发者ID:Azq2,项目名称:ctpp2,代码行数:101,代码来源:FnMBSubstring.cpp

示例10: LoadModule

//
// Load modules
//
INT_32 MainProcess::LoadModule(const STLW::string                & sModuleType,
                               const STLW::string                & sModuleName,
                               const STLW::string                & sLibrary,
                               const STLW::string                & sDriver,
                               const VariantNC                   & oModuleConfig,
                               const STLW::vector<STLW::string>  & vLibexecDirs,
                               Logger                            & oLogger)
{
	oLogger.Info("Opening `%s/%s` from library `%s`", sModuleType.c_str(), sModuleName.c_str(), sLibrary.c_str());
	STLW::string sFullpath;
	INT_32 iRC = FindFile(vLibexecDirs, sLibrary, sFullpath);
	if (iRC == -1)
	{
		STLW::string sDirList;
		STLW::vector<STLW::string>::const_iterator itvLibexecDirs = vLibexecDirs.begin();
		for (;;)
		{
			sDirList += "`" + *itvLibexecDirs + "` ";
			++itvLibexecDirs;
			if (itvLibexecDirs == vLibexecDirs.end()) { break; }
			sDirList += ", ";
		}
		oLogger.Emerg("Can't find library `%s` in LibexecDirs(%s) ", sLibrary.c_str(), sDirList.c_str());
		return -1;
	}
	oLogger.Info("Library `%s` found here: `%s`", sLibrary.c_str(), sFullpath.c_str());

	Object * pObject = oGlobalContext.loader.GetObject(sFullpath.c_str(), sDriver.c_str());
	if (pObject == NULL)
	{
		oLogger.Emerg("Can't load object `%s` from file `%s`", sDriver.c_str(), sFullpath.c_str());
		return -1;
	}

	// Check type of object
	const STLW::string sObjectType = pObject -> GetObjectType();
	if (Unicode::CompareIgnoreCase(sObjectType.data(), sObjectType.size(), sModuleType.data(), sModuleType.size()) != 0)
	{
		oLogger.Emerg("Need type `%s`, but object `%s` loaded from file `%s` has type `%s`", sModuleType.c_str(), pObject -> GetObjectName(), sFullpath.c_str(), pObject -> GetObjectType());
		delete pObject;
		return -1;
	}

	oLogger.Info("Object `%s` with type `%s` loaded from file `%s`", pObject -> GetObjectName(), pObject -> GetObjectType(), sFullpath.c_str());

	// Initialize module
	iRC = static_cast<Module *>(pObject) -> InitModule(oGlobalContext, oModuleConfig, oSigHandler, oLogger);
	if (iRC != 0)
	{
		oLogger.Emerg("Can't initialize module `%s` from file `%s`", sModuleName.c_str(), sFullpath.c_str());
		delete pObject;
		return -1;
	}

	const STLW::string sFullName = sModuleType + '/' + sModuleName;
	vModules.push_back(sFullName);
	// Store object in factory
	if(oGlobalContext.factory.AddObject(sFullName, pObject) == NULL)
	{
		oLogger.Emerg("Can't add module `%s` from file `%s`", sModuleName.c_str(), sFullpath.c_str());
		static_cast<Module *>(pObject) -> DestroyModule(oGlobalContext, oSigHandler, oLogger);
		delete pObject;
		return -1;
	}

return 0;
}
开发者ID:CommunicoPublic,项目名称:iris,代码行数:70,代码来源:MainProcess.cpp

示例11: InitModule

//
// Initialize module
//
INT_32 FileLogger::InitModule(IRIS::GlobalContext    & oGlobalContext,
                              const IRIS::VariantNC  & oConfig,
                              IRIS::SignalHandler    & oSigHandler,
                              IRIS::Logger           & oLogger)
{
	using namespace IRIS;

	// Re-open log files
	oSigHandler.RegisterHandler(SIGHUP,  &oLoggerSignalHandler);
	oSigHandler.RegisterHandler(SIGUSR1, &oLoggerSignalHandler);
	oSigHandler.RegisterHandler(SIGUSR2, &oLoggerSignalHandler);

	STLW::string sTMP = oConfig["LogLevel"].Str();

	static CCHAR_P  aPriorities[] = { "emerg", "alert", "crit", "error", "warn", "notice", "info", "debug", NULL };
	static LogPriority::LogPriorities oPriorities[] = { LogPriority::LOG_EMERG,   LogPriority::LOG_ALERT,
	                                                    LogPriority::LOG_CRIT,    LogPriority::LOG_ERROR,
	                                                    LogPriority::LOG_WARNING, LogPriority::LOG_NOTICE,
	                                                    LogPriority::LOG_INFO,    LogPriority::LOG_DEBUG };

	oActualPriority = oBasePriority = LogPriority::LOG_DEBUG;
	CCHAR_P      * aPriority = aPriorities;
	IRIS::LogPriority::LogPriorities  * oPriority = oPriorities;
	while (*aPriority != NULL)
	{
		if (Unicode::CompareIgnoreCase(sTMP.data(), sTMP.size(), *aPriority, strlen(*aPriority)) == 0)
		{
			oActualPriority = oBasePriority = *oPriority;
			break;
		}
		++aPriority;
		++oPriority;
	}

	iErrorLogBufferSize = iCustomLogBufferSize = -1;

	sErrorLogFormat.assign(oConfig["ErrorLogFormat"]);
	if (sErrorLogFormat.empty())
	{
		oLogger.Emerg("Configuration is broken: parameter %s/%s/ErrorLogFormat not set", GetObjectType(), GetObjectName());
		return -1;
	}

	sErrorLogFile.assign(oConfig["ErrorLog"]);
	if (sErrorLogFile.empty())
	{
		oLogger.Emerg("Configuration is broken: parameter %s/%s/ErrorLog not set", GetObjectType(), GetObjectName());
		return -1;
	}

	sCustomLogFormat.assign(oConfig["CustomLogFormat"]);
	if (sCustomLogFormat.empty())
	{
		oLogger.Emerg("Configuration is broken: parameter %s/%s/CustomLogFormat not set", GetObjectType(), GetObjectName());
		return -1;
	}

	sCustomLogFile.assign(oConfig["CustomLog"]);
	if (sCustomLogFile.empty())
	{
		oLogger.Emerg("Configuration is broken: parameter `%s/%s/CustomLog` not set", GetObjectType(), GetObjectName());
		return -1;
	}

	// Error log permissions
	char * pEnd = NULL;
	iErrorLogPerms = strtol(oConfig["ErrorLogPerms"].Str().c_str(), &pEnd, 8);
	if (iErrorLogPerms == 0) { oLogger.Info("Parameter `%s/%s/ErrorLogPerms` not set", GetObjectType(), GetObjectName()); }

	// User and group
	ConfigHelper::State oConfRC = ConfigHelper::ParseUserGroup(oConfig["ErrorLogOwner"],
	                                                           sErrorLogUser,
	                                                           iErrorLogUID,
	                                                           sErrorLogGroup,
	                                                           iErrorLogGID);
	switch(oConfRC)
	{
		case ConfigHelper::NOT_NEED:
			oLogger.Info("Parameter `%s/%s/ErrorLogOwner` is useful only if Iris starting from root user", GetObjectType(), GetObjectName());
			break;

		case ConfigHelper::CONFIG_ERROR:
			oLogger.Info("Parameter `%s/%s/ErrorLogOwner` not set", GetObjectType(), GetObjectName());
			break;

		case ConfigHelper::NO_SUCH_USER:
			oLogger.Emerg("Parameter `%s/%s/ErrorLogOwner`: no such user: `%s`", GetObjectType(), GetObjectName(), sErrorLogUser.c_str());
			return -1;

		case ConfigHelper::NO_SUCH_GROUP:
			oLogger.Emerg("Parameter `%s/%s/ErrorLogOwner`: no such group: `%s`", GetObjectType(), GetObjectName(), sErrorLogGroup.c_str());
			return -1;
		default:
			;;
	}

	// Buffer size for error log
//.........这里部分代码省略.........
开发者ID:CommunicoPublic,项目名称:iris,代码行数:101,代码来源:IrisFileLogger.cpp

示例12: operator

//
// Compare two strings ingnore case
//
bool NoCaseCmp::operator()(const STLW::string oX, const STLW::string & oY) const
{
	return Unicode::CompareIgnoreCase(oX.data(), oX.size(), oY.data(), oY.size()) < 0;
}
开发者ID:CommunicoPublic,项目名称:iris,代码行数:7,代码来源:Variant.cpp


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