本文整理汇总了C++中firebird::PathName类的典型用法代码示例。如果您正苦于以下问题:C++ PathName类的具体用法?C++ PathName怎么用?C++ PathName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PathName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LEX_init
void LEX_init( void *file)
{
/**************************************
*
* L E X _ i n i t
*
**************************************
*
* Functional description
* Initialize for lexical scanning. While we're at it, open a
* scratch trace file to keep all input.
*
**************************************/
const Firebird::PathName filename = Firebird::TempFile::create(SCRATCH);
strcpy(trace_file_name, filename.c_str());
trace_file = fopen(trace_file_name, "w+b");
if (!trace_file)
{
DDL_err(276);
/* msg 276: couldn't open scratch file */
}
input_file = (FILE*) file;
DDL_char = DDL_buffer;
dudleyGlob.DDL_token.tok_position = 0;
dudleyGlob.DDL_description = false;
dudleyGlob.DDL_line = 1;
}
示例2: extractDataFromPluginTo
void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& user_id)
{
// Add user login name
if (cliOrigUserName.hasData())
{
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: cliOrigUserName=%s\n",
cliOrigUserName.c_str()));
user_id.insertString(CNCT_login, cliOrigUserName);
}
// Add plugin name
Firebird::PathName pluginName = getPluginName();
if (pluginName.hasData())
{
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: pluginName=%s\n", pluginName.c_str()));
user_id.insertPath(CNCT_plugin_name, pluginName);
}
// Add plugin list
if (pluginList.hasData())
{
user_id.insertPath(CNCT_plugin_list, pluginList);
}
// This is specially tricky field - user_id is limited to 255 bytes per entry,
// and we have no ways to override this limit cause it can be sent to any version server.
// Therefore divide data into 254-byte parts, leaving first byte for the number of that part.
// This appears more reliable than put them in strict order.
addMultiPartConnectParameter(dataFromPlugin, user_id, CNCT_specific_data);
// Client's wirecrypt requested level
user_id.insertInt(CNCT_client_crypt, clntConfig->getWireCrypt(WC_CLIENT));
}
示例3: 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";
}
示例4: LEX_init
void LEX_init()
{
/**************************************
*
* L E X _ i n i t
*
**************************************
*
* Functional description
* Initialize for lexical scanning. While we're at it, open a
* scratch trace file to keep all input.
*
**************************************/
const Firebird::PathName filename = TempFile::create(SCRATCH);
strcpy(trace_file_name, filename.c_str());
trace_file = fopen(trace_file_name, "w+b");
#ifdef UNIX
unlink(trace_file_name);
#endif
if (!trace_file)
IBERROR(61); // Msg 61 couldn't open scratch file
QLI_token = (qli_tok*) ALLOCPV(type_tok, MAXSYMLEN);
QLI_line = (qli_line*) ALLOCPV(type_line, 0);
QLI_line->line_size = sizeof(QLI_line->line_data);
QLI_line->line_ptr = QLI_line->line_data;
QLI_line->line_type = line_stdin;
QLI_line->line_source_file = stdin;
QLI_semi = false;
input_file = stdin;
HSH_init();
}
示例5: 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;
}
}
}
示例6: 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;
}
示例7: isSymLink
bool PathUtils::isSymLink(const Firebird::PathName& path)
{
struct stat st, lst;
if (stat(path.c_str(), &st) != 0)
return false;
if (lstat(path.c_str(), &lst) != 0)
return false;
return st.st_ino != lst.st_ino;
}
示例8: splitPrefix
void PathUtils::splitPrefix(Firebird::PathName& path, Firebird::PathName& prefix)
{
prefix.erase();
while (path.hasData() && path[0] == dir_sep)
{
prefix = dir_sep;
path.erase(0, 1);
}
}
示例9: isLoadableModule
bool ModuleLoader::isLoadableModule(const Firebird::PathName& module)
{
struct stat sb;
if (-1 == stat(module.c_str(), &sb))
return false;
if ( ! (sb.st_mode & S_IFREG) ) // Make sure it is a plain file
return false;
if ( -1 == access(module.c_str(), R_OK | X_OK))
return false;
return true;
}
示例10: getCwd
void getCwd(Firebird::PathName& pn)
{
char* buffer = pn.getBuffer(MAXPATHLEN);
#if defined(WIN_NT)
_getcwd(buffer, MAXPATHLEN);
#elif defined(HAVE_GETCWD)
FB_UNUSED(getcwd(buffer, MAXPATHLEN));
#else
FB_UNUSED(getwd(buffer));
#endif
pn.recalculate_length();
}
示例11: setupFile
TempFile* TempSpace::setupFile(size_t size)
{
ISC_STATUS_ARRAY status_vector = {0};
for (size_t i = 0; i < tempDirs->getCount(); i++)
{
TempFile* file = NULL;
Firebird::PathName directory = (*tempDirs)[i];
PathUtils::ensureSeparator(directory);
for (size_t j = 0; j < tempFiles.getCount(); j++)
{
Firebird::PathName dirname, filename;
PathUtils::splitLastComponent(dirname, filename, tempFiles[j]->getName());
PathUtils::ensureSeparator(dirname);
if (!directory.compare(dirname))
{
file = tempFiles[j];
break;
}
}
try
{
if (!file)
{
file = FB_NEW(pool) TempFile(pool, filePrefix, directory);
tempFiles.add(file);
}
file->extend(size);
}
catch (const Firebird::system_error& ex)
{
ex.stuff_exception(status_vector);
continue;
}
return file;
}
// no room in all directories
Firebird::Arg::Gds status(isc_out_of_temp_space);
status.append(Firebird::Arg::StatusVector(status_vector));
iscLogStatus(NULL, status.value());
status.raise();
return NULL; // compiler silencer
}
示例12: 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";
}
示例13: renameFile
bool FileObject::renameFile(const Firebird::PathName new_filename)
{
if (append_mutex != INVALID_HANDLE_VALUE)
{
if (WaitForSingleObject(append_mutex, INFINITE) != WAIT_OBJECT_0)
system_call_failed::raise("WaitForSingleObject");
}
if (!MoveFile(filename.c_str(), new_filename.c_str()))
{
DWORD rename_err = GetLastError();
if (rename_err == ERROR_ALREADY_EXISTS || rename_err == ERROR_FILE_NOT_FOUND)
{
// Another process renames our file just now. Open it again.
reopen();
return false;
}
if (append_mutex != INVALID_HANDLE_VALUE)
ReleaseMutex(append_mutex);
fatal_exception::raiseFmt("IO error (%d) renaming file: %s",
rename_err,
filename.c_str());
}
else
reopen();
return true;
}
示例14: readenv
bool readenv(const char* env_name, Firebird::PathName& env_value)
{
Firebird::string result;
bool rc = readenv(env_name, result);
env_value.assign(result.c_str(), result.length());
return rc;
}
示例15: notifyDatabaseName
// Probably file arrived on the disk
bool notifyDatabaseName(const Firebird::PathName& file)
{
#ifdef HAVE_ID_BY_NAME
// notifyDatabaseName typically causes changes in aliasesConf()
// cause it's called only from Config created for missing database.
// Therefore always take write lock at once.
WriteLockGuard guard(aliasesConf().rwLock, "notifyDatabaseName");
DbName* db = aliasesConf().dbHash.lookup(file);
if (!db)
return true;
if (db->id)
return true;
UCharBuffer id;
os_utils::getUniqueFileId(file.c_str(), id);
if (id.hasData())
{
aliasesConf().linkId(db, id);
return true;
}
#endif
return false;
}