⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staffsservice.cpp

📁 Software Testing Automation Framework (STAF)的开发代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    // current line ending character(s) with the new line ending character(s)    if (currLEChar != newLEChar)        result = result.replace(currLEChar, newLEChar);    // If testFlag, convert the result to hex to verify that the line-ending    // characters were converted as expected.    if (testFlag)        return convertToHex(result.buffer(), result.length());    // Return new result in hex format    return STAFServiceResult(kSTAFOk, result);}STAFFSService::STAFFSService() : STAFService("FS"){    // COPY FILE parser setup    fCopyFileParser.addOption("COPY",                 1,        STAFCommandParser::kValueNotAllowed);    fCopyFileParser.addOption("FILE",                 1,        STAFCommandParser::kValueRequired);    fCopyFileParser.addOption("TOFILE",               1,        STAFCommandParser::kValueRequired);    fCopyFileParser.addOption("TODIRECTORY",          1,        STAFCommandParser::kValueRequired);    fCopyFileParser.addOption("TOMACHINE",            1,        STAFCommandParser::kValueRequired);    fCopyFileParser.addOption("FORMAT",               1,        STAFCommandParser::kValueRequired);    fCopyFileParser.addOption("TEXT",                 1,        STAFCommandParser::kValueNotAllowed);    // Remove comment when enabling convert/noconvert option    /*fCopyFileParser.addOption("CONVERT",              1,        STAFCommandParser::kValueNotAllowed);    fCopyFileParser.addOption("NOCONVERT",            1,        STAFCommandParser::kValueNotAllowed);*/    fCopyFileParser.addOption("FAILIFEXISTS",         1,        STAFCommandParser::kValueNotAllowed);    fCopyFileParser.addOption("FAILIFNEW",            1,        STAFCommandParser::kValueNotAllowed);    fCopyFileParser.addOptionGroup("FAILIFEXISTS FAILIFNEW", 0, 1);    fCopyFileParser.addOptionGroup("TOFILE TODIRECTORY", 0, 1);    // Remove comment when enabling convert/noconvert option    //fCopyFileParser.addOptionGroup("CONVERT NOCONVERT", 0, 1);    fCopyFileParser.addOptionNeed("FORMAT", "TEXT");    // Remove comment when enabling convert/noconvert option    //fCopyFileParser.addOptionNeed("CONVERT", "TEXT");    //fCopyFileParser.addOptionNeed("NOCONVERT", "TEXT");    fCopyFileParser.addOptionNeed("COPY", "FILE");    // COPY DIRECTORY parser setup    fCopyDirParser.addOption("COPY",                 1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("DIRECTORY",            1,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("TODIRECTORY",          1,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("TOMACHINE",            1,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("NAME",                 1,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("EXT",                  1,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("TEXTEXT",              0,        STAFCommandParser::kValueRequired);    fCopyDirParser.addOption("FORMAT",               1,        STAFCommandParser::kValueRequired);    // Remove comment when enabling convert/noconvert option    /*fCopyDirParser.addOption("CONVERT",              1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("NOCONVERT",            1,        STAFCommandParser::kValueNotAllowed);*/    fCopyDirParser.addOption("RECURSE",              1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("CASESENSITIVE",        1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("CASEINSENSITIVE",      1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("KEEPEMPTYDIRECTORIES", 1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("ONLYDIRECTORIES",      1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("IGNOREERRORS",         1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("FAILIFEXISTS",         1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOption("FAILIFNEW",            1,        STAFCommandParser::kValueNotAllowed);    fCopyDirParser.addOptionGroup("CASESENSITIVE CASEINSENSITIVE", 0, 1);    fCopyDirParser.addOptionGroup("KEEPEMPTYDIRECTORIES ONLYDIRECTORIES", 0, 1);    fCopyDirParser.addOptionGroup("FAILIFEXISTS FAILIFNEW", 0, 1);    // Remove comment when enabling convert/noconvert option    //fCopyDirParser.addOptionGroup("CONVERT NOCONVERT", 0, 1);    fCopyDirParser.addOptionNeed("FORMAT", "TEXTEXT");    // Remove comment when enabling convert/noconvert option    //fCopyDirParser.addOptionNeed("CONVERT", "TEXTEXT");    //fCopyDirParser.addOptionNeed("NOCONVERT", "TEXTEXT");    fCopyDirParser.addOptionNeed("KEEPEMPTYDIRECTORIES ONLYDIRECTORIES",                              "RECURSE");    fCopyDirParser.addOptionNeed("COPY", "DIRECTORY");    // GET parser setup    fGetParser.addOption("GET",              1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("FILE",             1,        STAFCommandParser::kValueRequired);    fGetParser.addOption("TEXT",             1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("BINARY",           1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("FORMAT",           1,        STAFCommandParser::kValueRequired);    // Note that TEST is an undocumented option that we can use for testing    // that the line ending character really got converted correctly    fGetParser.addOption("TEST",           1,     STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("ENTRY",            1,        STAFCommandParser::kValueRequired);    fGetParser.addOption("TYPE",             1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("SIZE",             1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOption("MODTIME",             1,        STAFCommandParser::kValueNotAllowed);    fGetParser.addOptionGroup("FILE ENTRY", 1, 1);    fGetParser.addOptionGroup("TEXT BINARY", 0, 1);    fGetParser.addOptionNeed("TEXT BINARY", "FILE");    fGetParser.addOptionNeed("FORMAT", "TEXT BINARY");    fGetParser.addOptionNeed("TEST", "FILE");    fGetParser.addOptionNeed("GET", "FILE ENTRY");    fGetParser.addOptionNeed("TYPE SIZE MODTIME", "ENTRY");    fGetParser.addOptionNeed("ENTRY", "TYPE SIZE MODTIME");        // LIST parser setup    fListParser.addOption(        "LIST", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "DIRECTORY", 1, STAFCommandParser::kValueRequired);    fListParser.addOption(        "NAME", 1, STAFCommandParser::kValueRequired);    fListParser.addOption(        "EXT", 1, STAFCommandParser::kValueRequired);    fListParser.addOption(        "LONG", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "DETAILS", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "SORTBYNAME", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "SORTBYSIZE", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "SORTBYMODTIME", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "CASESENSITIVE", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "CASEINSENSITIVE", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "TYPE", 1, STAFCommandParser::kValueRequired);    fListParser.addOption(        "RECURSE", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOption(        "SETTINGS", 1, STAFCommandParser::kValueNotAllowed);    fListParser.addOptionGroup("DIRECTORY SETTINGS", 1, 1);    fListParser.addOptionGroup("SORTBYNAME SORTBYSIZE SORTBYTIME", 0, 1);    fListParser.addOptionGroup("CASESENSITIVE CASEINSENSITIVE", 0, 1);    fListParser.addOptionNeed("LIST", "DIRECTORY SETTINGS");    fListParser.addOptionNeed(        "NAME EXT LONG SORTBYNAME SORTBYMODTIME TYPE RECURSE", "DIRECTORY");    fListParser.addOptionNeed("DETAILS", "LONG");    fListParser.addOptionNeed("CASESENSITIVE CASEINSENSITIVE",                              "NAME EXT SORTBYNAME");    // LIST COPYREQUESTS parser setup    fListCopyRequestsParser.addOption(        "LIST", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "COPYREQUESTS", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "INBOUND", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "OUTBOUND", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "FILE", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "DIRECTORY", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "BINARY", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "TEXT", 1, STAFCommandParser::kValueNotAllowed);    fListCopyRequestsParser.addOption(        "LONG", 1, STAFCommandParser::kValueNotAllowed);        fListCopyRequestsParser.addOptionNeed("BINARY TEXT", "FILE");    // CREATE parser setup    fCreateParser.addOption("CREATE",           1,        STAFCommandParser::kValueNotAllowed);    fCreateParser.addOption("DIRECTORY",        1,        STAFCommandParser::kValueRequired);    fCreateParser.addOption("FULLPATH",         1,        STAFCommandParser::kValueNotAllowed);    fCreateParser.addOption("FAILIFEXISTS",     1,        STAFCommandParser::kValueNotAllowed);    fCreateParser.addOptionNeed("CREATE", "DIRECTORY");    // DELETE parser setup    fDeleteParser.addOption("DELETE",           1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("ENTRY",            1,        STAFCommandParser::kValueRequired);    fDeleteParser.addOption("CHILDREN",         1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("NAME",             1,        STAFCommandParser::kValueRequired);    fDeleteParser.addOption("EXT",              1,        STAFCommandParser::kValueRequired);    fDeleteParser.addOption("TYPE",             1,        STAFCommandParser::kValueRequired);    fDeleteParser.addOption("CASESENSITIVE",    1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("CASEINSENSITIVE",  1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("RECURSE",          1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("CONFIRM",          1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOption("IGNOREERRORS",     1,        STAFCommandParser::kValueNotAllowed);    fDeleteParser.addOptionGroup("CASESENSITIVE CASEINSENSITIVE", 0, 1);    fDeleteParser.addOptionNeed("DELETE", "ENTRY");    fDeleteParser.addOptionNeed("DELETE", "CONFIRM");    fDeleteParser.addOptionNeed("NAME EXT TYPE", "CHILDREN");    fDeleteParser.addOptionNeed("CASESENSITIVE CASEINSENSITIVE", "NAME EXT");    fDeleteParser.addOptionNeed("IGNOREERRORS", "CHILDREN RECURSE");    // QUERY parser setup    fQueryParser.addOption("QUERY",            1,        STAFCommandParser::kValueNotAllowed);    fQueryParser.addOption("ENTRY",            1,        STAFCommandParser::kValueRequired);    fQueryParser.addOptionNeed("QUERY", "ENTRY");    // SET parser setup    fSetParser.addOption("SET", 1,                         STAFCommandParser::kValueNotAllowed);    fSetParser.addOption("STRICTFSCOPYTRUST", 1,                         STAFCommandParser::kValueRequired);    // set groups/needs    fSetParser.addOptionGroup("STRICTFSCOPYTRUST", 1, 1);    // Construct map-class for a LIST DIRECTORY LONG information    fListLongInfoClass = STAFMapClassDefinition::create(        "STAF/Service/FS/ListLongInfo");     fListLongInfoClass->addKey("type", "Type");    fListLongInfoClass->addKey("size", "Size");    fListLongInfoClass->addKey("lastModifiedTimestamp",                               "Modified Date-Time");    fListLongInfoClass->addKey("name", "Name");        // Construct map-class for LIST DIRECTORY LONG DETAILS information    fListDetailsInfoClass = STAFMapClassDefinition::create(        "STAF/Service/FS/ListDetailsInfo");     fListDetailsInfoClass->addKey("name", "Name");    fListDetailsInfoClass->addKey("type", "Type");    fListDetailsInfoClass->addKey("upperSize", "U-Size");    fListDetailsInfoClass->addKey("lowerSize", "L-Size");    fListDetailsInfoClass->addKey("lastModifiedTimestamp",                                  "Modified Date-Time");    // Construct map class for LIST COPYREQUESTS information    fCopyRequestClass = STAFMapClassDefinition::create(        "STAF/Service/FS/CopyRequest");    fCopyRequestClass->addKey("startTimestamp", "Start Date-Time");    fCopyRequestClass->setKeyProperty(        "timestamp", "display-short-name", "Date-Time");    fCopyRequestClass->addKey("io", "In/Out");    fCopyRequestClass->setKeyProperty(        "io", "display-short-name", "I/O");    fCopyRequestClass->addKey("machine", "Machine");    fCopyRequestClass->addKey("name", "Name");    fCopyRequestClass->addKey("type", "Type");    // Construct map class for COPYREQUESTS LONG information for a file copy    fCopyFileClass = STAFMapClassDefinition::create(        "STAF/Service/FS/CopyFile");    fCopyFileClass->addKey("startTimestamp", "Start Date-Time");    fCopyFileClass->setKeyProperty(        "timestamp", "display-short-name", "Date-Time");    fCopyFileClass->addKey("io", "In/Out");    fCopyFileClass->setKeyProperty(        "io", "display-short-name", "I/O");    fCopyFileClass->addKey("machine", "Machine");    fCopyFileClass->addKey("name", "File Name");    fCopyFileClass->addKey("type", "Type");    fCopyFileClass->addKey("mode", "Mode");    fCopyFileClass->addKey("state", "Transfer State");    // Construct map class for the state of a file copy request    fFileCopyStateClass = STAFMapClassDefinition::create(        "STAF/Service/FS/FileCopyState");    fFileCopyStateClass->addKey("fileSize", "File Size");    fFileCopyStateClass->addKey("bytesCopied", "Bytes Copied");    // Construct map class for COPYREQUESTS LONG information for a directory        fCopyDirectoryClass = STAFMapClassDefinition::create(        "STAF/Service/FS/CopyDirectory");    fCopyDirectoryClass->addKey("startTimestamp", "Start Date-Time");    fCopyDirectoryClass->setKeyProperty(        "timestamp", "display-short-name", "Date-Time");    fCopyDirectoryClass->addKey("io", "In/Out");    fCopyDirectoryClass->setKeyProperty(        "io", "display-short-name", "I/O");    fCopyDirectoryClass->addKey("machine", "Machine");    fCopyDirectoryClass->addKey("name", "Directory Name");    fCopyDirectoryClass->addKey("type", "Type");    fCopyDirectoryClass->addKey("state", "Transfer State");    // Construct map class for the state of a directory copy request    fDirectoryCopyStateClass = STAFMapClassDefinition::create(        "STAF/Service/FS/DirectoryCopyState");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -