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


C++ PathName::length方法代码示例

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


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

示例1: concatPath

void PathUtils::concatPath(Firebird::PathName& result,
		const Firebird::PathName& first,
		const Firebird::PathName& second)
{
	if (second.length() == 0)
	{
		result = first;
		return;
	}
	if (first.length() == 0)
	{
		result = second;
		return;
	}

	if (first[first.length() - 1] != dir_sep &&
		second[0] != dir_sep)
	{
		result = first + dir_sep + second;
		return;
	}
	if (first[first.length() - 1] == dir_sep &&
		second[0] == dir_sep)
	{
		result = first;
		result.append(second, 1, second.length() - 1);
		return;
	}

	result = first + second;
}
开发者ID:narolez571,项目名称:firebird,代码行数:31,代码来源:path_utils.cpp

示例2: ensureSeparator

// We don't work correctly with MBCS.
void PathUtils::ensureSeparator(Firebird::PathName& in_out)
{
	if (in_out.length() == 0)
		in_out = PathUtils::dir_sep;

	if (in_out[in_out.length() - 1] != PathUtils::dir_sep)
		in_out += PathUtils::dir_sep;
}
开发者ID:narolez571,项目名称:firebird,代码行数:9,代码来源:path_utils.cpp

示例3: getDbPathInfo

// moves DB path information (from limbo transaction) to another buffer
void getDbPathInfo(unsigned int& itemsLength, const unsigned char*& items,
	unsigned int& bufferLength, unsigned char*& buffer,
	Firebird::Array<unsigned char>& newItemsBuffer, const Firebird::PathName& dbpath)
{
	if (itemsLength && items)
	{
		const unsigned char* ptr = (const unsigned char*) memchr(items, fb_info_tra_dbpath, itemsLength);
		if (ptr)
		{
			newItemsBuffer.add(items, itemsLength);
			newItemsBuffer.remove(ptr - items);
			items = newItemsBuffer.begin();
			--itemsLength;

			unsigned int len = dbpath.length();
			if (len + 3 > bufferLength)
			{
				len = bufferLength - 3;
			}
			bufferLength -= (len + 3);
			*buffer++ = fb_info_tra_dbpath;
			*buffer++ = len;
			*buffer++ = len >> 8;
			memcpy(buffer, dbpath.c_str(), len);
			buffer += len;
		}
	}
}
开发者ID:mariuz,项目名称:firebird,代码行数:29,代码来源:utils.cpp

示例4: doctorModuleExtention

void ModuleLoader::doctorModuleExtention(Firebird::PathName& name)
{
    Firebird::PathName::size_type pos = name.rfind(".dylib");
    if (pos != Firebird::PathName::npos && pos == name.length() - 6)
        return;		// No doctoring necessary
    name += ".dylib";
}
开发者ID:narolez571,项目名称:firebird,代码行数:7,代码来源:mod_loader.cpp

示例5: doctorModuleExtension

bool ModuleLoader::doctorModuleExtension(Firebird::PathName& name, int& step)
{
	if (name.isEmpty())
		return false;

	switch (step++)
	{
	case 0: // Step 0: append missing extension
		{
			Firebird::PathName::size_type pos = name.rfind("." SHRLIB_EXT);
			if (pos != name.length() - 3)
			{
				pos = name.rfind("." SHRLIB_EXT ".");
				if (pos == Firebird::PathName::npos)
				{
					name += "." SHRLIB_EXT;
					return true;
				}
			}
			step++; // instead of break
		}
	case 1: // Step 1: insert missing prefix
		{
			Firebird::PathName::size_type pos = name.rfind('/');
			pos = (pos == Firebird::PathName::npos) ? 0 : pos + 1;
			if (name.find("lib", pos) != pos)
			{
				name.insert(pos, "lib");
				return true;
			}
		}
	}
	return false;
}
开发者ID:FirebirdSQL,项目名称:firebird,代码行数:34,代码来源:mod_loader.cpp

示例6: isRelative

bool PathUtils::isRelative(const Firebird::PathName& path)
{
	if (path.length() > 0)
	{
		char ds = path[0];
		if (path.length() > 2) {
			if (path[1] == ':' &&
				(('A' <= path[0] && path[0] <= 'Z') ||
				 ('a' <= path[0] && path[0] <= 'z')))
			{
				ds = path[2];
			}
		}
		return ds != PathUtils::dir_sep && ds != '/';
	}
	return true;
}
开发者ID:andrewleech,项目名称:firebird,代码行数:17,代码来源:path_utils.cpp

示例7: isRelative

bool PathUtils::isRelative(const Firebird::PathName& path)
{
	if (path.length() > 0)
	{
		const char ds = hasDriveLetter(path) ? path[2] : path[0];
		return ds != PathUtils::dir_sep && ds != '/';
	}
	return true;
}
开发者ID:narolez571,项目名称:firebird,代码行数:9,代码来源:path_utils.cpp

示例8: doctorModuleExtension

void ModuleLoader::doctorModuleExtension(Firebird::PathName& name)
{
	Firebird::PathName::size_type pos = name.rfind('/');
	pos = (pos == Firebird::PathName::npos) ? 0 : pos + 1;
	if (name.find("lib", pos) != pos)
	{
		name.insert(pos, "lib");
	}

	pos = name.rfind(".dylib");
	if (pos == name.length() - 6)
		return;
	name += ".dylib";
}
开发者ID:RAvenGEr,项目名称:opencvr,代码行数:14,代码来源:mod_loader.cpp

示例9: splitLastComponent

void PathUtils::splitLastComponent(Firebird::PathName& path, Firebird::PathName& file,
		const Firebird::PathName& orgPath)
{
	Firebird::PathName::size_type pos = orgPath.rfind(dir_sep);
	if (pos == Firebird::PathName::npos)
	{
		path = "";
		file = orgPath;
		return;
	}

	path.erase();
	path.append(orgPath, 0, pos);	// skip the directory separator
	file.erase();
	file.append(orgPath, pos + 1, orgPath.length() - pos - 1);
}
开发者ID:narolez571,项目名称:firebird,代码行数:16,代码来源:path_utils.cpp

示例10: splitLastComponent

void PathUtils::splitLastComponent(Firebird::PathName& path, Firebird::PathName& file,
		const Firebird::PathName& orgPath)
{
	Firebird::PathName::size_type pos = orgPath.rfind(PathUtils::dir_sep);
	if (pos == Firebird::PathName::npos)
	{
		pos = orgPath.rfind('/');	// temp hack to make it work with paths,
									// not expanded by ISC_expand_filename
		if (pos == Firebird::PathName::npos)
		{
			path = "";
			file = orgPath;
			return;
		}
	}

	path.erase();
	path.append(orgPath, 0, pos);	// skip the directory separator
	file.erase();
	file.append(orgPath, pos + 1, orgPath.length() - pos - 1);
}
开发者ID:andrewleech,项目名称:firebird,代码行数:21,代码来源:path_utils.cpp

示例11: hasDriveLetter

static bool hasDriveLetter(const Firebird::PathName& path)
{
	return path.length() > 2 && path[1] == ':' &&
		(('A' <= path[0] && path[0] <= 'Z') ||
		 ('a' <= path[0] && path[0] <= 'z'));
}
开发者ID:narolez571,项目名称:firebird,代码行数:6,代码来源:path_utils.cpp


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