本文整理汇总了C++中ExState类的典型用法代码示例。如果您正苦于以下问题:C++ ExState类的具体用法?C++ ExState怎么用?C++ ExState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SysShowHelp
int EView::SysShowHelp(ExState& State, const char *word) {
char file[MAXPATH] = "";
char cmd[1024];
if (State.GetStrParam(this, file, sizeof(file) - 1) == 0)
if (MView->Win->GetStr("Help file",
sizeof(file) - 1, file, HIST_DEFAULT) == 0) return 0;
char wordAsk[64] = "";
if (word == 0) {
if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0)
if (MView->Win->GetStr("Keyword",
sizeof(wordAsk) - 1, wordAsk,
HIST_DEFAULT) == 0) return 0;
word = wordAsk;
}
sprintf(cmd, "%s %s %s", HelpCommand, file, word);
if (system(cmd) != 0) {
Msg(S_ERROR, "Failed to start view.exe!");
return 0;
}
return 1;
}
示例2: SearchReplace
int EBuffer::SearchReplace(ExState &State, const char *aString, const char *aReplaceString, int Options) {
char find[MAXSEARCH+1] = "";
char replace[MAXSEARCH+1] = "";
int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE;
if (aString)
strcpy(find, aString);
else
if (State.GetStrParam(View, find, sizeof(find)) == 0)
if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0;
if (strlen(find) == 0) return 0;
if (aReplaceString)
strcpy(replace, aReplaceString);
else
if (State.GetStrParam(View, replace, sizeof(replace)) == 0)
if (View->MView->Win->GetStr("Replace", sizeof(replace), replace, HIST_SEARCH) == 0) return 0;
LSearch.ok = 0;
strcpy(LSearch.strSearch, find);
strcpy(LSearch.strReplace, replace);
LSearch.Options = Case | (Options & ~SEARCH_NCASE) | SEARCH_ALL | SEARCH_REPLACE;
LSearch.ok = 1;
if (Find(LSearch) == 0) return 0;
return 1;
}
示例3: name
//-----------------------------------------------------------------------------
void ExState::onExit( QEvent* e )
{
// Print out the state we are exiting and it's parents
#ifdef _EX_FSM_PRINT_INFO_
QString state = name();
ExState* parent = qobject_cast<ExState*>( parentState() );
while ( parent != 0 )
{
state = parent->name() + "->" + state;
parent = qobject_cast<ExState*>( parent->parentState() );
}
LOG_D("ExState") << prefix() << " <<< Exiting state: '" << state << "'";
#endif
QState::onExit(e);
Q_FOREACH(ExEvent* const & savedEvent, static_cast<ExStatePrivate*>(m_pImpl)->m_savedEvents)
{
#ifdef _EX_FSM_PRINT_INFO_
LOG_D("ExState") << prefix() << " - " << name() << ": Post saved event: '" << savedEvent->name() << "'";
#endif
static_cast<ExStateMachine*>(machine())->putEvent(savedEvent);
}
static_cast<ExStatePrivate*>(m_pImpl)->m_savedEvents.clear();
}
示例4: Compile
int EView::Compile(ExState &State) {
static char Cmd[256] = "";
char Command[256] = "";
if (CompilerMsgs != 0 && CompilerMsgs->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
if (State.GetStrParam(this, Command, sizeof(Command)) == 0) {
if (Model->GetContext() == CONTEXT_FILE) {
EBuffer *B = (EBuffer *)Model;
if (BFS(B, BFS_CompileCommand) != 0)
strcpy(Cmd, BFS(B, BFS_CompileCommand));
}
if (Cmd[0] == 0)
strcpy(Cmd, CompileCommand);
if (MView->Win->GetStr("Compile", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0;
strcpy(Command, Cmd);
} else {
if (MView->Win->GetStr("Compile", sizeof(Command), Command, HIST_COMPILE) == 0) return 0;
}
return Compile(Command);
}
示例5: Search
int EBuffer::Search(ExState &State, const char *aString, int Options, int /*CanResume*/) {
char find[MAXSEARCH+1] = "";
int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE;
int Next = 0;
int erc = 0;
//int Changed;
if (aString)
strcpy(find, aString);
else
if (State.GetStrParam(View, find, sizeof(find)) == 0)
if ((erc = View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH)) == 0) return 0;
if (strlen(find) == 0) return 0;
if (erc == 2)
Case ^= SEARCH_NCASE;
//if (Changed == 0 && CanResume)
// Next |= SEARCH_NEXT;
LSearch.ok = 0;
strcpy(LSearch.strSearch, find);
LSearch.Options = Case | Next | (Options & ~SEARCH_NCASE);
LSearch.ok = 1;
if (Find(LSearch) == 0) return 0;
return 1;
}
示例6: DirOpen
int EView::DirOpen(ExState &State) {
char Path[MAXPATH];
if (State.GetStrParam(this, Path, sizeof(Path)) == 0)
if (GetDefaultDirectory(Model, Path, sizeof(Path)) == 0)
return 0;
return OpenDir(Path);
}
示例7: SetPrintDevice
int EView::SetPrintDevice(ExState &State) {
char Dev[MAXPATH];
strcpy(Dev, PrintDevice);
if (State.GetStrParam(this, Dev, sizeof(Dev)) == 0)
if (MView->Win->GetStr("Print to", sizeof(Dev), Dev, HIST_SETUP) == 0) return 0;
strcpy(PrintDevice, Dev);
return 1;
}
示例8: RunSvnDiff
int EView::RunSvnDiff(ExState &State) {
char Options[128] = "";
if (SvnDiffView != 0 && SvnDiffView->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
State.GetStrParam(this, Options, sizeof(Options));
return SvnDiff(Options);
}
示例9: RunCvsCommit
int EView::RunCvsCommit(ExState &State) {
char Options[128] = "";
if (CvsView != 0 && CvsView->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
State.GetStrParam(this, Options, sizeof(Options));
return CvsCommit(Options);
}
示例10: GotoGlobalBookmark
int EView::GotoGlobalBookmark(ExState &State) {
char name[256] = "";
if (State.GetStrParam(this, name, sizeof(name)) == 0)
if (MView->Win->GetStr("Goto Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0;
if (markIndex.view(this, name) == 0) {
Msg(S_ERROR, "Error locating global bookmark %s.", name);
return 0;
}
return 1;
}
示例11: FileOpenInMode
int EView::FileOpenInMode(ExState &State) {
char Mode[32] = "";
char FName[MAXPATH];
if (State.GetStrParam(this, Mode, sizeof(Mode)) == 0)
if (MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) != 1) return 0;
if (FindMode(Mode) == 0) {
MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid mode '%s'", Mode);
return 0;
}
if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0)
return 0;
if (State.GetStrParam(this, FName, sizeof(FName)) == 0)
if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0;
if (IsDirectory(FName))
return OpenDir(FName);
if (strlen(FName) == 0) return 0;
return MultiFileLoad(0, FName, Mode, this);
}
示例12: FileOpen
int EView::FileOpen(ExState &State) {
char FName[MAXPATH];
if (State.GetStrParam(this, FName, sizeof(FName)) == 0) {
if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0)
return 0;
if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0;
}
if (strlen(FName) == 0) return 0;
if (IsDirectory(FName))
return OpenDir(FName);
return MultiFileLoad(0, FName, NULL, this);
}
示例13: CvsCommit
int EView::CvsCommit(ExState &State) {
static char Opts[128] = "";
char Options[128] = "";
if (CvsView != 0 && CvsView->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
if (State.GetStrParam(this, Options, sizeof(Options)) == 0) {
if (MView->Win->GetStr("CVS commit options", sizeof(Opts), Opts, HIST_CVSCOMMIT) == 0) return 0;
strcpy(Options, Opts);
} else {
if (MView->Win->GetStr("CVS commit options", sizeof(Options), Options, HIST_CVSCOMMIT) == 0) return 0;
}
return CvsCommit(Options);
}
示例14: SvnDiff
int EView::SvnDiff(ExState &State) {
static char Opts[128] = "";
char Options[128] = "";
if (SvnDiffView != 0 && SvnDiffView->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
if (State.GetStrParam(this, Options, sizeof(Options)) == 0) {
if (MView->Win->GetStr("SVN diff options", sizeof(Opts), Opts, HIST_SVNDIFF) == 0) return 0;
strcpy(Options, Opts);
} else {
if (MView->Win->GetStr("SVN diff options", sizeof(Options), Options, HIST_SVNDIFF) == 0) return 0;
}
return SvnDiff(Options);
}
示例15: RunCompiler
int EView::RunCompiler(ExState &State) {
char Command[256] = "";
if (CompilerMsgs != 0 && CompilerMsgs->Running) {
Msg(S_INFO, "Already running...");
return 0;
}
if (State.GetStrParam(this, Command, sizeof(Command)) == 0) {
if (Model->GetContext() == CONTEXT_FILE) {
EBuffer *B = (EBuffer *)Model;
if (BFS(B, BFS_CompileCommand) != 0)
strcpy(Command, BFS(B, BFS_CompileCommand));
}
if (Command[0] == 0)
strcpy(Command, CompileCommand);
}
return Compile(Command);
}