本文整理汇总了C++中FXString::before方法的典型用法代码示例。如果您正苦于以下问题:C++ FXString::before方法的具体用法?C++ FXString::before怎么用?C++ FXString::before使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FXString
的用法示例。
在下文中一共展示了FXString::before方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: existCommand
// Check if the specified command can be found in exec path
FXbool existCommand(FXString cmd)
{
struct stat linfo;
// If first character is '/' then cmd is an absolute path
if (cmd[0]==PATHSEPCHAR)
{
// Check if command exists
if (!cmd.empty() && (lstatrep(cmd.text(),&linfo)==0))
return TRUE;
}
// Simple command name or relative path
else
{
// Get exec path
FXString execpath=FXSystem::getExecPath();
if(execpath != "")
{
FXString path;
for(FXint i=0;;i++)
{
// Obtain path component
path=execpath.section(':',i);
if(path=="")
break;
// Form command absolute path
path += PATHSEPSTRING + cmd.before(' ');
// Check if command exists
if (!path.empty() && (lstatrep(path.text(),&linfo)==0))
return TRUE;
}
}
}
return FALSE;
}
示例2: throw
FXString
MFXUtils::getDocumentName(const FXString &filename) throw() {
FXString file = FXPath::name(filename);
return file.before('.');
}
示例3: runcmd
// Launch a command and initiate a startup notification
int runcmd(FXString cmd, FXString cmdname, FXString dir, FXString startdir, FXbool usesn = true, FXString snexcepts = "")
{
int ret;
// Change to current directory
ret = chdir(dir.text());
if (ret < 0)
{
int errcode = errno;
if (errcode)
{
fprintf(stderr, _("Error: Can't enter folder %s: %s"), dir.text(), strerror(errcode));
}
else
{
fprintf(stderr, _("Error: Can't enter folder %s"), dir.text());
}
return(-1);
}
// Get rid of possible command options
cmdname = cmdname.before(' ');
// Check if command is in the startup notification exception list
FXbool startup_notify = true;
if (snexcepts != "")
{
FXString entry;
for (int i = 0; ; i++)
{
entry = snexcepts.section(':', i);
if (streq(entry.text(), ""))
{
break;
}
if (streq(entry.text(), cmdname.text()))
{
startup_notify = false;
break;
}
}
}
// Run command with startup notification
if (usesn && startup_notify)
{
Display* xdisplay;
SnDisplay* display;
SnLauncherContext* context;
Time timestamp;
// Open display
xdisplay = XOpenDisplay(NULL);
if (xdisplay == NULL)
{
fprintf(stderr, _("Error: Can't open display\n"));
ret = chdir(startdir.text());
if (ret < 0)
{
int errcode = errno;
if (errcode)
{
fprintf(stderr, _("Error: Can't enter folder %s: %s"), startdir.text(), strerror(errcode));
}
else
{
fprintf(stderr, _("Error: Can't enter folder %s"), startdir.text());
}
}
return(-1);
}
// Message displayed in the task bar (if any)
FXString message;
message.format(_("Start of %s"), cmdname.text());
// Initiate launcher context
display = sn_display_new(xdisplay, NULL, NULL);
context = sn_launcher_context_new(display, DefaultScreen(xdisplay));
sn_launcher_context_set_name(context, message.text());
sn_launcher_context_set_binary_name(context, cmdname.text());
sn_launcher_context_set_description(context, message.text());
sn_launcher_context_set_icon_name(context, cmdname.text());
timestamp = gettimestamp();
sn_launcher_context_initiate(context, "Xfe", cmd.text(), timestamp);
// Run command in background
cmd += " &";
static pid_t child_pid = 0;
switch ((child_pid = fork()))
{
case -1:
fprintf(stderr, _("Error: Fork failed: %s\n"), strerror(errno));
break;
case 0: // Child
sn_launcher_context_setup_child_process(context);
//.........这里部分代码省略.........