本文整理汇总了C++中astring::cat方法的典型用法代码示例。如果您正苦于以下问题:C++ astring::cat方法的具体用法?C++ astring::cat怎么用?C++ astring::cat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astring
的用法示例。
在下文中一共展示了astring::cat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
bool path_iterator::next(astring &buffer, const char *name)
{
// if none left, return FALSE to indicate we are done
if (m_index != 0 && *m_current == 0)
return false;
// copy up to the next semicolon
const char *semi = strchr(m_current, ';');
if (semi == NULL)
semi = m_current + strlen(m_current);
buffer.cpy(m_current, semi - m_current);
m_current = (*semi == 0) ? semi : semi + 1;
// append the name if we have one
if (name != NULL)
{
// compute the full pathname
if (buffer.len() > 0)
buffer.cat(PATH_SEPARATOR);
buffer.cat(name);
}
// bump the index and return TRUE
m_index++;
return true;
}
示例2: build_generic_filter
void consolewin_info::build_generic_filter(device_image_interface *img, bool is_save, astring &filter)
{
// common image types
add_filter_entry(filter, "Common image types", img->file_extensions());
// compressed
if (!is_save)
filter.cat("Compressed Images (*.zip)|*.zip|");
// all files
filter.cat("All files (*.*)|*.*|");
}
示例3: find_include_file
static bool find_include_file(astring &srcincpath, int srcrootlen, const astring &srcfile, const astring &filename)
{
// iterate over include paths and find the file
for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next)
{
// a '.' include path is specially treated
if (curpath->path == ".")
srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0]));
else
srcincpath.cpy(curpath->path);
// append the filename piecemeal to account for directories
int lastsepindex = 0;
int sepindex;
while ((sepindex = filename.chr(lastsepindex, '/')) != -1)
{
astring pathpart(filename, lastsepindex, sepindex - lastsepindex);
// handle .. by removing a chunk from the incpath
if (pathpart == "..")
{
int sepindex_part = srcincpath.rchr(0, PATH_SEPARATOR[0]);
if (sepindex_part != -1)
srcincpath.substr(0, sepindex_part);
}
// otherwise, append a path separator and the pathpart
else
srcincpath.cat(PATH_SEPARATOR).cat(pathpart);
// advance past the previous index
lastsepindex = sepindex + 1;
}
// now append the filename
srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1);
// see if we can open it
core_file *testfile;
if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE)
{
// close the file
core_fclose(testfile);
return true;
}
}
return false;
}
示例4: add_filter_entry
void consolewin_info::add_filter_entry(astring &dest, const char *description, const char *extensions)
{
// add the description
dest.cat(description);
dest.catformat(" (");
// add the extensions to the description
copy_extension_list(dest, extensions);
// add the trailing rparen and '|' character
dest.cat(")|");
// now add the extension list itself
copy_extension_list(dest, extensions);
// append a '|'
dest.cat('|');
}
示例5: copy_extension_list
void consolewin_info::copy_extension_list(astring &dest, const char *extensions)
{
// our extension lists are comma delimited; Win32 expects to see lists
// delimited by semicolons
char const *s = extensions;
while (*s)
{
// append a semicolon if not at the beginning
if (s != extensions)
dest.cat(';');
// append ".*"
dest.cat("*.");
// append the file extension
while (*s && (*s != ','))
dest.cat(*s++);
// if we found a comma, advance
while(*s == ',')
s++;
}
}
示例6: find_include_file
static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootlen, astring &srcfile, astring &dstfile, astring &filename)
{
// iterate over include paths and find the file
for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next)
{
// a '.' include path is specially treated
if (curpath->path == ".")
srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0]));
else
srcincpath.cpysubstr(srcfile, 0, srcrootlen + 1).cat(curpath->path);
// append the filename piecemeal to account for directories
int lastsepindex = 0;
int sepindex;
while ((sepindex = filename.chr(lastsepindex, '/')) != -1)
{
// handle .. by removing a chunk from the incpath
astring pathpart(filename, lastsepindex, sepindex - lastsepindex);
if (pathpart == "..")
{
sepindex = srcincpath.rchr(0, PATH_SEPARATOR[0]);
if (sepindex != -1)
srcincpath.substr(0, sepindex);
}
// otherwise, append a path separator and the pathpart
else
srcincpath.cat(PATH_SEPARATOR).cat(pathpart);
// advance past the previous index
lastsepindex = sepindex + 1;
}
// now append the filename
srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1);
// see if we can open it
core_file *testfile;
if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE)
{
// close the file
core_fclose(testfile);
// find the longest matching directory substring between the include and source file
lastsepindex = 0;
while ((sepindex = srcincpath.chr(lastsepindex, PATH_SEPARATOR[0])) != -1)
{
// get substrings up to the current directory
astring tempfile(srcfile, 0, sepindex);
astring tempinc(srcincpath, 0, sepindex);
// if we don't match, stop
if (tempfile != tempinc)
break;
lastsepindex = sepindex + 1;
}
// chop off the common parts of the paths
astring tempfile(srcfile, lastsepindex, -1);
srcincpath.substr(lastsepindex, -1).replacechr(PATH_SEPARATOR[0], '/');
// for each directory left in the filename, we need to prepend a "../"
while ((sepindex = tempfile.chr(0, PATH_SEPARATOR[0])) != -1)
{
tempfile.substr(sepindex + 1, -1);
srcincpath.ins(0, "../");
}
srcincpath.cat(".html");
// free the strings and return the include path
return true;
}
}
return false;
}