Explorer command line parser. More...
#include <explorer.h>
Public Member Functions | |
ExplorerCmd () | |
ExplorerCmd (LPCTSTR url, bool mdi) | |
bool | ParseCmdLine (LPCTSTR lpCmdLine) |
bool | EvaluateOption (LPCTSTR option) |
bool | IsValidPath () const |
Public Attributes | |
String | _path |
int | _flags |
int | _cmdShow |
bool | _mdi |
bool | _valid_path |
Explorer command line parser.
Definition at line 90 of file explorer.h.
ExplorerCmd::ExplorerCmd | ( | ) | [inline] |
Definition at line 92 of file explorer.h.
: _flags(0), _cmdShow(SW_SHOWNORMAL), _mdi(false), _valid_path(false) { }
ExplorerCmd::ExplorerCmd | ( | LPCTSTR | url, |
bool | mdi | ||
) | [inline] |
Definition at line 100 of file explorer.h.
: _path(url), _flags(0), _cmdShow(SW_SHOWNORMAL), _mdi(mdi), _valid_path(true) //@@ { }
bool ExplorerCmd::EvaluateOption | ( | LPCTSTR | option ) |
Definition at line 790 of file explorer.cpp.
References _flags, _mdi, _path, _tcsicmp, OWM_EXPLORE, OWM_ROOTED, and TEXT.
Referenced by ParseCmdLine().
{ String opt_str; // Remove quote characters, as they are evaluated at this point. for(; *option; ++option) if (*option != '"') opt_str += *option; option = opt_str; if (option[0] == '/') { ++option; // option /e for windows in explorer mode if (!_tcsicmp(option, TEXT("e"))) _flags |= OWM_EXPLORE; // option /root for rooted explorer windows else if (!_tcsicmp(option, TEXT("root"))) _flags |= OWM_ROOTED; // non-standard options: /mdi, /sdi else if (!_tcsicmp(option, TEXT("mdi"))) _mdi = true; else if (!_tcsicmp(option, TEXT("sdi"))) _mdi = false; else return false; } else { if (!_path.empty()) return false; _path = opt_str; } return true; }
bool ExplorerCmd::IsValidPath | ( | ) | const |
Definition at line 827 of file explorer.cpp.
References _path.
Referenced by MainFrameBase::Create().
{ if (!_path.empty()) { DWORD attribs = GetFileAttributes(_path); if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY)) return true; // file system path else if (*_path==':' && _path.at(1)==':') return true; // text encoded IDL } return false; }
bool ExplorerCmd::ParseCmdLine | ( | LPCTSTR | lpCmdLine ) |
Definition at line 746 of file explorer.cpp.
References EvaluateOption().
Referenced by explorer_show_frame().
{ bool ok = true; LPCTSTR b = lpCmdLine; LPCTSTR p = b; while(*b) { // remove leading space while(_istspace((unsigned)*b)) ++b; p = b; bool quote = false; // options are separated by ',' for(; *p; ++p) { if (*p == '"') // Quote characters may appear at any position in the command line. quote = !quote; else if (*p==',' && !quote) break; } if (p > b) { int l = p - b; // remove trailing space while(l>0 && _istspace((unsigned)b[l-1])) --l; if (!EvaluateOption(String(b, l))) ok = false; if (*p) ++p; b = p; } } return ok; }
Definition at line 115 of file explorer.h.
Referenced by MainFrameBase::Create(), and explorer_show_frame().
Definition at line 114 of file explorer.h.
Referenced by MainFrameBase::Create(), and EvaluateOption().
bool ExplorerCmd::_mdi |
Definition at line 116 of file explorer.h.
Referenced by MainFrameBase::Create(), EvaluateOption(), and explorer_show_frame().
Definition at line 113 of file explorer.h.
Referenced by MainFrameBase::Create(), EvaluateOption(), and IsValidPath().
Definition at line 117 of file explorer.h.
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |