本文整理汇总了C++中StringList::numberOfStrings方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::numberOfStrings方法的具体用法?C++ StringList::numberOfStrings怎么用?C++ StringList::numberOfStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::numberOfStrings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInstance
BOOL CAlfrescoApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
InitCommonControls();
CWinApp::InitInstance();
AfxEnableControlContainer();
// Check if debug logging is enabled
char dbgLogName[MAX_PATH];
size_t dbgLogSize;
if ( getenv_s( &dbgLogSize, dbgLogName, sizeof( dbgLogName), "ALFDEBUG") == 0) {
// Enable debug output
Debug::openLog( dbgLogName);
// Log the application startup
DBGOUT_TS << "---------- Desktop client app started ----------" << endl;
}
// Get the application path
String appPath = __wargv[0];
int pos = appPath.lastIndexOf(PathSeperator);
if ( pos < 0) {
AfxMessageBox( L"Invalid application path", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, bad application path, " << appPath << endl;
return 1;
}
// Get the path to the folder containing the application
String folderPath = appPath.substring(0, pos);
String exeName = appPath.substring(pos + 1);
// Create a list of the command line arguments
StringList argList;
bool argSetWorkDir = false;
for ( int i = 1; i < __argc; i++) {
// Check if the argument is a path or switch
String arg = __wargv[i];
if ( arg.startsWith( "/")) {
// Check for the set working directory switch
if ( arg.equalsIgnoreCase( "/D")) {
argSetWorkDir = true;
// DEBUG
DBGOUT_TS << "/D switch specified" << endl;
}
else {
String msg = L"Invalid command line switch - ";
msg.append( arg);
AfxMessageBox( msg.data(), MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, " << msg << endl;
return 2;
}
}
else {
// Add the path to the argument list
argList.addString( arg);
}
}
// Check if the working directory should be set to the path of the first document
if ( argSetWorkDir == true) {
// Check if there are any document paths
if ( argList.numberOfStrings() == 0) {
AfxMessageBox( L"Cannot set working directory, no document paths", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, cannot set working directory, no document paths" << endl;
return 3;
}
// Get the first document path and remove the file name
String docPath = argList[0];
pos = docPath.lastIndexOf( PathSeperator);
if ( pos < 0) {
AfxMessageBox( L"Invalid document path", MB_OK | MB_ICONSTOP);
//.........这里部分代码省略.........
示例2: buildDesktopParameters
/**
* Process the command line arguments and build the parameter list for the desktop action
*
* @param alfresco AlfrescoInterface&
* @param paths StringList&
* @param actionInfo AlfrescoActionInfo&
* @param params DesktopParams&
* @return bool
*/
bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringList& paths, AlfrescoActionInfo& actionInfo,
DesktopParams& params) {
// If there are no paths then just return a success
if ( paths.numberOfStrings() == 0)
return true;
// Process the list of files and either check in the file if it is a working copy or check out
// the file
for ( unsigned int i = 0; i < paths.numberOfStrings(); i++) {
// Get the current file name
String curFile = paths.getStringAt( i);
// DEBUG
DBGOUT_TS << "Parameter: " << curFile << endl;
// Check if the path is on an Alfresco mapped drive
if ( alfresco.isMappedDrive() && curFile.startsWithIgnoreCase( alfresco.getDrivePath())) {
// Convert the path to a UNC path
String uncPath = alfresco.getRootPath();
uncPath.append( curFile.substring(3));
curFile = uncPath;
}
// Check if the path is to a file/folder, and whether it is a local path
bool copyFile = false;
DWORD attr = GetFileAttributes( curFile);
if ( attr != INVALID_FILE_ATTRIBUTES) {
// Check if the action supports the file/folder type
bool isDir = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0 ? true : false;
if ( isDir && actionInfo.supportsFolders() == false) {
AfxMessageBox(L"Action does not support folders", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support folders" << endl;
return false;
}
else if ( actionInfo.supportsFiles() == false) {
AfxMessageBox(L"Action does not support files", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support files" << endl;
return false;
}
// Get the file name from the path
StringList nameParts = FileName::splitPath( curFile);
String curName = nameParts.getStringAt( 1);
// If the path is to a file that is not on the Alfresco share the file will need to be copied,
// after checking the status of a matching file in the Alfresco folder
if ( curFile.length() >= 3 && curFile.substring(1,3).equals( L":\\") &&
(alfresco.isMappedDrive() == false || curFile.startsWithIgnoreCase( alfresco.getDrivePath()) == false)) {
// Check if the action supports local files
if ( isDir == false && actionInfo.hasAttribute(AttrClientFiles) == false) {
AfxMessageBox(L"Action does not support local files", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support local files" << endl;
return false;
}
else if ( isDir == true && actionInfo.hasAttribute(AttrClientFolders) == false) {
AfxMessageBox(L"Action does not support local folders", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support local folders" << endl;
return false;
}
// Check if there is an existing file in the Alfresco with the same name, check if the file is locked
PTR_AlfrescoFileInfo fInfo = alfresco.getFileInformation( curName);
if ( fInfo.get() != NULL) {
// There is an existing file in the Alfresco folder with the same name, check if it is locked
if ( fInfo->getLockType() != LockNone) {
AfxMessageBox( L"Cannot copy file to Alfresco folder, destination file is locked", MB_OK | MB_ICONEXCLAMATION);
DBGOUT_TS << "Error, cannot copy to Alfresco folder, destination file is locked" << endl;
return false;
}
//.........这里部分代码省略.........