本文整理汇总了C++中VFolder类的典型用法代码示例。如果您正苦于以下问题:C++ VFolder类的具体用法?C++ VFolder怎么用?C++ VFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VFolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RetainFolder
VFile *VProcess::RetainFile( EFolderKind inPrimarySelector, const VString& inFileName, EFolderKind inSecondarySelector) const
{
VFile *file = NULL;
VFolder *parent = RetainFolder( inPrimarySelector);
if (testAssert( parent != NULL))
{
file = new VFile( *parent, inFileName);
if ( (file != NULL) && !file->Exists())
ReleaseRefCountable( &file);
}
ReleaseRefCountable( &parent);
if ( (file == NULL) && (inSecondarySelector != 0) )
{
parent = RetainFolder( inSecondarySelector);
if ( (parent != NULL) && parent->Exists())
{
file = new VFile( *parent, inFileName);
if ( (file != NULL) && !file->Exists())
ReleaseRefCountable( &file);
}
ReleaseRefCountable( &parent);
}
return file;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:27,代码来源:VProcess.cpp
示例2: RetainParentFolder
VError VFolder::CreateRecursive(bool inMakeWritableByAll)
{
VError err = VE_OK;
if ( !fFolder.Exists( true) )
{
VFolder *parent = RetainParentFolder();
if ( parent )
{
err = parent->CreateRecursive(inMakeWritableByAll);
parent->Release();
if ( err == VE_OK )
{
err = Create();
#if !VERSION_LINUX
if ((err == VE_OK) && inMakeWritableByAll)
{
err = MakeWritableByAll();
}
#endif
}
}
else
{
err = Create();
#if !VERSION_LINUX
if ((err == VE_OK) && inMakeWritableByAll)
{
err = MakeWritableByAll();
}
#endif
}
}
return err;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:34,代码来源:VFolder.cpp
示例3: VFolder
VFolder* VRIAServerSolution::RetainFolder() const
{
VFolder *folder = NULL;
if (fDesignSolution != NULL)
{
VProjectItem *item = fDesignSolution->GetSolutionFileProjectItem();
if (item != NULL)
{
VFilePath path;
item->GetFilePath( path);
path = path.ToFolder();
if (path.IsFolder())
{
folder = new VFolder( path);
if (folder != NULL && !folder->Exists())
{
folder->Release();
folder = NULL;
}
}
}
}
return folder;
}
开发者ID:rajeshpillai,项目名称:core-Wakanda,代码行数:25,代码来源:VRIAServerSolution.cpp
示例4: VFolder
VError VArchiveStream::AddFolder( VFilePath &inFileFolder )
{
VError result = VE_STREAM_CANNOT_FIND_SOURCE;
VFolder *folder = new VFolder(inFileFolder);
result = AddFolder( folder );
folder->Release();
return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:8,代码来源:VArchiveStream.cpp
示例5: StartWatchingForChanges
VError XMacFileSystemNotification::StartWatchingForChanges( const VFolder &inFolder, VFileSystemNotifier::EventKind inKindFilter, VFileSystemNotifier::IEventHandler *inHandler, sLONG inLatency )
{
// We need to get the folder's path into an array for us to pass along to the OS call.
VString posixPathString;
inFolder.GetPath( posixPathString, FPS_POSIX);
VStringConvertBuffer buffer( posixPathString, VTC_UTF_8);
std::string posixPath( buffer.GetCPointer());
CFStringRef pathRef = posixPathString.MAC_RetainCFStringCopy();
CFArrayRef pathArray = CFArrayCreate( NULL, (const void **)&pathRef, 1, NULL );
FSEventStreamContext context = { 0 };
// The latency the user passed us is expressed in milliseconds, but the OS call requires the latency to be
// expressed in seconds.
CFTimeInterval latency = (inLatency / 1000.0);
// Now we can make our change data object
XMacChangeData *data = new XMacChangeData( inFolder.GetPath(), posixPath, inKindFilter, VTask::GetCurrent(), inHandler, this);
context.info = data;
data->fStreamRef = FSEventStreamCreate( NULL, &FSEventCallback, &context, pathArray, kFSEventStreamEventIdSinceNow, latency, kFSEventStreamCreateFlagNone );
if (data->fStreamRef == NULL)
{
CFRelease( pathArray );
CFRelease( pathRef );
ReleaseRefCountable( &data);
return MAKE_NATIVE_VERROR( errno );
}
// We also need to take an initial snapshot of the directory for us to compare again
CreateDirectorySnapshot( posixPath, data->fSnapshot, true );
// Now we can add the data object we just made to our list
fOwner->PushChangeData( data);
// Next, we can schedule this to run on the main event loop
FSEventStreamScheduleWithRunLoop( data->fStreamRef, CFRunLoopGetMain(), kCFRunLoopDefaultMode );
CFRelease( pathArray );
CFRelease( pathRef );
// Now that we've scheduled the stream to run on a helper thread, all that is left is to
// start executing the stream
VError err;
if (FSEventStreamStart( data->fStreamRef ))
{
err = VE_OK;
}
else
{
err = MAKE_NATIVE_VERROR( errno );
}
ReleaseRefCountable( &data);
return err;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:57,代码来源:XMacFileSystemNotification.cpp
示例6: srcNewFolder
VError VProjectItemFolder::_MoveTo(const VFolder& srcFolder, VFolder& destFolder)
{
VError err = VE_OK;
if (!destFolder.Exists())
err = destFolder.CreateRecursive();
else
err = VE_UNKNOWN_ERROR; // TO DO ce n'est pas vrai : mais c'est pour le moment : 011008
// que faire : ecraser, fusionner, on attends les specs !
if (err == VE_OK)
{
for (VFolderIterator it_folder(&srcFolder, FI_WANT_FOLDERS | FI_WANT_INVISIBLES); it_folder.IsValid() && err == VE_OK; ++it_folder)
{
VFolder srcNewFolder(it_folder.Current()->GetPath());
VString srcNewFolderName;
srcNewFolder.GetName(srcNewFolderName);
VString destNewFolderPath;
destFolder.GetPath(destNewFolderPath);
destNewFolderPath += srcNewFolderName;
destNewFolderPath += FOLDER_SEPARATOR;
VFolder destNewFolder(destNewFolderPath);
err = _MoveTo(srcNewFolder, destNewFolder);
}
for (VFileIterator it_file(&srcFolder, FI_WANT_FILES | FI_WANT_INVISIBLES); it_file.IsValid() && err == VE_OK; ++it_file)
{
VFile srcNewFile(it_file.Current()->GetPath());
VString srcNewFileName;
srcNewFile.GetName(srcNewFileName);
VString destNewFilePath;
destFolder.GetPath(destNewFilePath);
destNewFilePath += srcNewFileName;
VFile destNewFile(destNewFilePath);
VProjectItemFile projectItemFile;
VURL srcURL = VURL(srcNewFile.GetPath());
VURL destURL = VURL(destNewFile.GetPath());
projectItemFile.MoveTo(srcURL, destURL);
}
}
if (err == VE_OK)
{
err = srcFolder.Delete(true);
}
return err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:52,代码来源:VProjectItemBehaviour.cpp
示例7: newPath
VError XWinFolder::Move( const VFolder& inNewParent, VFolder** outFolder ) const
{
XBOX::VString name;
VFilePath newPath( inNewParent.GetPath() );
DWORD winErr;
if (newPath.IsValid())
{
VString name;
fOwner->GetName(name);
newPath.ToSubFolder(name);
XWinFullPath oldWinPath( fOwner->GetPath() );
XWinFullPath newWinPath( newPath );
winErr = ::MoveFileW( oldWinPath, newWinPath) ? 0 : ::GetLastError();
}
else
{
winErr = ERROR_INVALID_NAME;
}
if (outFolder)
{
*outFolder = (winErr == 0) ? new VFolder( newPath) : NULL;
}
return MAKE_NATIVE_VERROR( winErr);
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:29,代码来源:XWinFolder.cpp
示例8: RetainFolder
VError VProjectItemFolder::GetModificationTime( VTime& outModificationTime) const
{
VError err = VE_OK;
VFolder *folder = RetainFolder();
if (folder != NULL)
{
err = folder->GetTimeAttributes( &outModificationTime, NULL, NULL);
ReleaseRefCountable( &folder);
}
else
{
err = VE_FOLDER_NOT_FOUND;
}
return err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:17,代码来源:VProjectItemBehaviour.cpp
示例9:
VFolder::VFolder( const VFolder& inParentFolder, const VString& inFolderName)
{
fPath = inParentFolder.GetPath();
xbox_assert( fPath.IsFolder());
fPath.ToSubFolder( inFolderName);
xbox_assert( fPath.IsFolder());
fFolder.Init( this);
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:8,代码来源:VFolder.cpp
示例10: errThrow
VError VFolder::CopyTo( const VFolder& inDestinationFolder, VFolder **outFolder, FileCopyOptions inOptions) const
{
VError err = VE_OK;
VFolder *folder = NULL;
if (IsSameFolder( &inDestinationFolder) || inDestinationFolder.GetPath().IsChildOf( GetPath()))
{
StThrowFileError errThrow( this, VE_CANNOT_COPY_ON_ITSELF);
errThrow->SetString( "destination", inDestinationFolder.GetPath().GetPath());
err = errThrow.GetError();
}
else
{
VString name;
GetName( name);
folder = new VFolder( inDestinationFolder, name);
if (folder != NULL)
{
if ( ( (inOptions & FCP_Overwrite) != 0) && folder->Exists() )
err = folder->Delete( true);
if (err == VE_OK)
err = CopyContentsTo( *folder, inOptions);
}
else
{
err = VE_MEMORY_FULL;
}
}
if (outFolder != NULL)
{
*outFolder = folder;
folder = NULL;
}
ReleaseRefCountable( &folder);
return err;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:40,代码来源:VFolder.cpp
示例11: StartWatchingForChanges
VError XWinFileSystemNotification::StartWatchingForChanges( const VFolder &inFolder, VFileSystemNotifier::EventKind inKindFilter, VFileSystemNotifier::IEventHandler *inHandler, sLONG inLatency )
{
VString path;
inFolder.GetPath( path );
VError err = VE_OK;
// Now that we know we need to care about this folder, let's see if we can create an entry for it. First,
// we will try to open a handle to the folder.
HANDLE hFolder = ::CreateFileW( path.GetCPointer(), FILE_LIST_DIRECTORY | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL );
if (hFolder == INVALID_HANDLE_VALUE)
{
// We were unable to open the folder, so we need to bail out
return MAKE_NATIVE_VERROR( ::GetLastError() );
}
// launch our task if not already there
LaunchTaskIfNecessary();
// Now that we've opened the folder handle, we can add an entry to our watch list
XWinChangeData *data = new XWinChangeData( inFolder.GetPath(), inKindFilter, VTask::GetCurrent(), inHandler, this);
data->fFolderHandle = hFolder;
data->fLatency = inLatency;
data->fOverlapped.hEvent = ::CreateEvent( NULL, true, false, NULL );
data->fTimer = NULL;
if (inLatency)
data->fTimer = ::CreateWaitableTimer( NULL, FALSE, NULL );
// Add the new data to our list of things to watch for
fOwner->PushChangeData( data );
WatchForChanges( data );
ReleaseRefCountable( &data);
return VE_OK;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:38,代码来源:XWinFileSystemNotification.cpp
示例12: if
VError VFolder::CopyContentsTo( const VFolder& inDestinationFolder, FileCopyOptions inOptions) const
{
VError err = VE_OK;
if (!inDestinationFolder.Exists())
{
// this easy case should be handled by system implementation
err = inDestinationFolder.Create();
}
else if (IsSameFolder( &inDestinationFolder) || inDestinationFolder.GetPath().IsChildOf( GetPath()))
{
StThrowFileError errThrow( this, VE_CANNOT_COPY_ON_ITSELF);
errThrow->SetString( "destination", inDestinationFolder.GetPath().GetPath());
err = errThrow.GetError();
}
if (err == VE_OK)
{
bool ok = true;
for( VFolderIterator folderIterator( this, FI_WANT_FOLDERS | FI_WANT_INVISIBLES) ; folderIterator.IsValid() && ok ; ++folderIterator)
{
VError err2 = folderIterator->CopyTo( inDestinationFolder, NULL, inOptions);
if (err == VE_OK)
err = err2;
ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0);
}
for( VFileIterator fileIterator( this, FI_WANT_FILES | FI_WANT_INVISIBLES) ; fileIterator.IsValid() && ok ; ++fileIterator)
{
VError err2 = fileIterator->CopyTo( inDestinationFolder, NULL, inOptions);
if (err == VE_OK)
err = err2;
ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0);
}
}
return err;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:38,代码来源:VFolder.cpp
示例13: folder
XBOX::VError VProjectItemFolder::Rename( const XBOX::VString& inNewName)
{
if (fOwner == NULL)
return VE_FOLDER_CANNOT_RENAME;
VFilePath path;
if (!fOwner->GetFilePath( path))
return VE_FOLDER_CANNOT_RENAME;
VFolder *newFolder = NULL;
VFolder folder( path);
VError err = folder.Rename( inNewName, &newFolder);
if (err == VE_OK && newFolder != NULL)
{
VString folderName;
newFolder->GetName( folderName);
fOwner->SetName( folderName); // sc 26/09/2011, WAK0073011
fOwner->SetDisplayName( folderName);
if (fOwner->HasRelativePath())
{
folderName += FOLDER_SEPARATOR;
fOwner->SetRelativePath( folderName);
}
else
{
VFilePath path;
newFolder->GetPath( path);
fOwner->SetURL( VURL( path));
}
}
if (err != VE_OK)
err = VE_FOLDER_CANNOT_RENAME;
return err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:38,代码来源:VProjectItemBehaviour.cpp
示例14: fCallBack
VError VArchiveUnStream::ProceedFile()
{
VError result = VE_OK;
bool userAbort = false;
uLONG8 partialByteCount = 0;
if ( fCallBack )
fCallBack(CB_OpenProgress,partialByteCount,fTotalByteCount,userAbort);
VFileDesc *fileDesc = NULL;
VSize bufferSize = 1024*1024;
char *buffer = new char[bufferSize];
for ( uLONG i = 0; i < fFileCatalog.size() && result == VE_OK; i++ )
{
fileDesc = NULL;
if ( fStream->GetLong() == 'Fdat' )
{
if ( fFileCatalog[i]->GetExtractFlag() )
{
VFolder *parentFolder = fFileCatalog[i]->GetFile()->RetainParentFolder();
if ( parentFolder )
{
result = parentFolder->CreateRecursive();
parentFolder->Release();
}
if ( result == VE_OK )
{
result = fFileCatalog[i]->GetFile()->Open( FA_SHARED, &fileDesc, FO_CreateIfNotFound);
#if VERSIONMAC
fFileCatalog[i]->GetFile()->MAC_SetKind(fFileCatalog[i]->GetKind());
fFileCatalog[i]->GetFile()->MAC_SetCreator(fFileCatalog[i]->GetCreator());
#endif
}
}
if ( result == VE_OK )
{
result = _ExtractFile( fFileCatalog[i], fileDesc, buffer, bufferSize, partialByteCount );
delete fileDesc;
}
if ( result == VE_OK )
{
fileDesc = NULL;
if ( fStream->GetLong() == 'Frez' )
{
if ( fFileCatalog[i]->GetExtractFlag() )
{
#if VERSIONMAC
result = fFileCatalog[i]->GetFile()->Open( FA_SHARED, &fileDesc, FO_OpenResourceFork);
#endif
}
if ( result == VE_OK )
{
result = _ExtractFile( fFileCatalog[i], fileDesc, buffer, bufferSize, partialByteCount );
delete fileDesc;
}
}
else
{
result = VE_STREAM_BAD_SIGNATURE;
}
}
}
else
{
result = VE_STREAM_BAD_SIGNATURE;
}
}
delete[] buffer;
if ( fCallBack )
fCallBack(CB_CloseProgress,partialByteCount,fTotalByteCount,userAbort);
return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:74,代码来源:VArchiveStream.cpp
示例15: slash
//ACI0078887 23rd Nov 2012, O.R., always specify folder used for computing relative path of entry in TOC
VError VArchiveStream::_WriteCatalog( const VFile* inFile, const XBOX::VFilePath& inSourceFolder,const VString &inExtraInfo, uLONG8 &ioTotalByteCount )
{
VString fileInfo;
VStr8 slash("/");
VStr8 extra("::");
VStr8 folderSep(XBOX::FOLDER_SEPARATOR);
VError result = VE_INVALID_PARAMETER;
XBOX::VString savedExtraInfo = inExtraInfo;
//ACI0078887 23rd Nov 2012, O.R., compute relative path using the specified source folder
//don't assume that extra info carries relative folder info
//ACI0078887 23rd Nov 2012, O.R., compute relative path using the specified source folder
//don't assume that extra info carries relative folder info
if (savedExtraInfo == PRESERVE_PARENT_OPTION)
{
//this is a bogus extra info that we use internally so we need to clear it so that it is not saved into
//the archive.
//This options means that the file will have to be restored in with its parent directory preserved.
savedExtraInfo.Clear();
VFolder *folder = inFile->RetainParentFolder();
VString fileName;
folder->GetName(fileInfo);
// folder name can be a drive letter like Z:
fileInfo.Exchange( (UniChar) ':', (UniChar) '_');
inFile->GetName(fileName);
fileInfo += slash;
fileInfo += fileName;
fileInfo.Insert( slash, 1 );
folder->Release();
result = VE_OK;
}
else
{
if(testAssert(inFile->GetPath().GetRelativePath(inSourceFolder,fileInfo)))
{
result = VE_OK;
fileInfo.Insert( FOLDER_SEPARATOR, 1);
}
}
if(result == VE_OK)
{
fileInfo.Exchange(folderSep ,slash, 1, 255);
if ( fileInfo.GetUniChar(1) == '/' )
fileInfo.Insert( '.', 1 );
fileInfo += extra;
fileInfo += savedExtraInfo;
result = fStream->PutLong('file');
if ( result == VE_OK )
{
result = fileInfo.WriteToStream(fStream);
}
if ( result == VE_OK )
{
sLONG8 fileSize = 0;
inFile->GetSize(&fileSize);
fStream->PutLong8(fileSize);
ioTotalByteCount += fileSize;
#if VERSIONWIN || VERSION_LINUX
/* rez file size */
fStream->PutLong8(0);
/* no file kind or creator under Windows */
fStream->PutLong(0); /* kind */
fStream->PutLong(0); /* creator */
#elif VERSIONMAC
inFile->GetResourceForkSize(&fileSize);
fStream->PutLong8(fileSize);
ioTotalByteCount += fileSize;
OsType osType;
inFile->MAC_GetKind( &osType );
result = fStream->PutLong( osType );
inFile->MAC_GetCreator( &osType );
result = fStream->PutLong( osType );
#endif
}
}
return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:82,代码来源:VArchiveStream.cpp
示例16: switch
VFolder *VProcess::RetainProductSystemFolder( ESystemFolderKind inSelector, bool inCreateFolderIfNotFound) const
{
VFolder *folder = NULL;
bool allUsers;
bool useProductSubFolder;
ESystemFolderKind currentUserFolder;
switch( inSelector)
{
case eFK_UserDocuments:
case eFK_Temporary:
allUsers = true;
useProductSubFolder = true;
break;
case eFK_CommonPreferences:
currentUserFolder = eFK_UserPreferences;
allUsers = true;
useProductSubFolder = true;
break;
case eFK_CommonApplicationData:
currentUserFolder = eFK_UserApplicationData;
allUsers = true;
useProductSubFolder = true;
break;
case eFK_CommonCache:
currentUserFolder = eFK_UserCache;
allUsers = true;
useProductSubFolder = true;
break;
case eFK_UserPreferences:
case eFK_UserApplicationData:
case eFK_UserCache:
allUsers = false;
useProductSubFolder = true;
break;
default:
allUsers = false;
useProductSubFolder = false;
break;
}
if (useProductSubFolder)
{
VFolder *parent = VFolder::RetainSystemFolder( inSelector, inCreateFolderIfNotFound);
if (parent != NULL)
{
VError err;
VString folderName;
GetProductName( folderName);
// accepte un alias
VString aliasName( folderName);
#if VERSIONWIN
aliasName += ".lnk";
#endif
VFile aliasFile( *parent, aliasName);
if (aliasFile.Exists() && aliasFile.IsAliasFile())
{
VFilePath target;
err = aliasFile.ResolveAlias( target);
if ( (err == VE_OK) && target.IsFolder() )
{
folder = new VFolder( target);
}
}
if (folder == NULL)
{
folder = new VFolder( *parent, folderName);
}
if (!folder->Exists())
{
if (inCreateFolderIfNotFound)
{
if (allUsers)
{
// drop errors if we can retry in current user home directory
StErrorContextInstaller context( false);
err = folder->CreateRecursive( allUsers);
}
else
{
err = folder->CreateRecursive( allUsers);
}
if (err != VE_OK)
{
ReleaseRefCountable( &folder);
// si on nous a demande de creer dans "all users", on ressaie dans le dossier de l'utilisateur courant
if (allUsers)
{
folder = RetainProductSystemFolder( currentUserFolder, inCreateFolderIfNotFound);
}
}
//.........这里部分代码省略.........
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:101,代码来源:VProcess.cpp
示例17: CFRelease
/*
static
*/
DialectCode VComponentManager::GetLocalizationLanguage(VFolder * inLocalizationResourcesFolder,bool inGotoResourceFolder)
{
DialectCode sResult = XBOX::DC_NONE; // sc 19/05/2008 was XBOX::DC_ENGLISH_US
VFolder * localizationResourcesFolder = NULL;
if(testAssert(inLocalizationResourcesFolder != NULL && inLocalizationResourcesFolder->Exists()))
{
if (inGotoResourceFolder)
{
XBOX::VFilePath componentOrPluginFolderPath = inLocalizationResourcesFolder->GetPath();
componentOrPluginFolderPath.ToSubFolder(CVSTR("Contents")).ToSubFolder(CVSTR("Resources"));
localizationResourcesFolder = new XBOX::VFolder(componentOrPluginFolderPath);
}
else
{
localizationResourcesFolder = inLocalizationResourcesFolder;
localizationResourcesFolder->Retain();
}
bool englishFolderDetected = false;
XBOX::DialectCode dialectCode = XBOX::DC_NONE;
//Detect what is the favorite language of the OS/App
#if VERSIONWIN
LCID lcid = ::GetUserDefaultLCID();
XBOX::DialectCode currentDialectCode = (XBOX::DialectCode)LANGIDFROMLCID(lcid);
#elif VERSION_LINUX
//jmo - Be coherent with code in VIntlMgr.cpp
XBOX::DialectCode currentDialectCode=XBOX::DC_ENGLISH_US; // Postponed Linux Implementation !
#else
CFBundleRef bundle = ::CFBundleGetMainBundle();
XBOX::DialectCode currentDialectCode = XBOX::DC_ENGLISH_US;
if ( bundle != nil ){
CFArrayRef array_ref = ::CFBundleCopyBundleLocalizations(bundle);
if (array_ref != nil){
CFArrayRef usedLanguages = ::CFBundleCopyPreferredLocalizationsFromArray(array_ref);
CFStringRef cfPrimaryLanguage = (CFStringRef)CFArrayGetValueAtIndex(usedLanguages, 0);
XBOX::VString xboxPrimaryLanguage;
xboxPrimaryLanguage.MAC_FromCFString(cfPrimaryLanguage);
::CFRelease(usedLanguages);
if(!XBOX::VIntlMgr::GetDialectCodeWithISOLanguageName(xboxPrimaryLanguage, currentDialectCode))
if(!XBOX::VIntlMgr::GetDialectCodeWithRFC3066BisLanguageCode(xboxPrimaryLanguage, currentDialectCode))
currentDialectCode = XBOX::DC_ENGLISH_US;
CFRelease(array_ref);
}
}
#endif
//Try to see if we have this language. If not, take english
for ( XBOX::VFolderIterator folderIter( localizationResourcesFolder ); folderIter.IsValid() && currentDialectCode != dialectCode ; ++folderIter )
{
XBOX::VString folderName;
folderIter->GetName(folderName);
uLONG posStr = folderName.Find(CVSTR(".lproj"), 1, false);
if ( posStr > 0 )
{
folderName.Remove(posStr, folderName.GetLength() - posStr + 1);
if( XBOX::VIntlMgr::GetDialectCodeWithRFC3066BisLanguageCode(folderName, dialectCode ) || XBOX::VIntlMgr::GetDialectCodeWithISOLanguageName(folderName, dialectCode)){
if(dialectCode == XBOX::DC_ENGLISH_US)
englishFolderDetected = true;
if(currentDialectCode == dialectCode)
sResult = dialectCode;
}
}
}
if ( sResult == XBOX::DC_NONE ){
if ( englishFolderDetected )
sResult = XBOX::DC_ENGLISH_US;
else
sResult = dialectCode;
}
ReleaseRefCountable(&localizationResourcesFolder);
}
return sResult;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:85,代码来源:VComponentManager.cpp
示例18: JSValueGetType
VValueSingle *JS4D::ValueToVValue( ContextRef inContext, ValueRef inValue, ValueRef *outException)
{
if (inValue == NULL)
return NULL;
VValueSingle *value;
JSType type = JSValueGetType( inContext, inValue);
switch( type)
{
case kJSTypeUndefined:
case kJSTypeNull:
value = NULL; //new VEmpty;
break;
case kJSTypeBoolean:
value = new VBoolean( JSValueToBoolean( inContext, inValue));
break;
case kJSTypeNumber:
value = new VReal( JSValueToNumber( inContext, inValue, outException));
break;
case kJSTypeString:
{
JSStringRef jsString = JSValueToStringCopy( inContext, inValue, outException);
if (jsString != NULL)
{
VString *s = new VString;
size_t length = JSStringGetLength( jsString);
UniChar *p = (s != NULL) ? s->GetCPointerForWrite( length) : NULL;
if (p != NULL)
{
::memcpy( p, JSStringGetCharactersPtr( jsString), length * sizeof( UniChar));
s->Validate( length);
value = s;
}
else
{
delete s;
value = NULL;
}
JSStringRelease( jsString);
}
else
{
value = NULL;
}
break;
}
case kJSTypeObject:
{
if (ValueIsInstanceOf( inContext, inValue, CVSTR( "Date"), outException))
{
VTime *time = new VTime;
if (time != NULL)
{
JSObjectRef dateObject = JSValueToObject( inContext, inValue, outException);
DateObjectToVTime( inContext, dateObject, *time, outException);
value = time;
}
else
{
value = NULL;
}
}
else if (JSValueIsObjectOfClass( inContext, inValue, VJSFolderIterator::Class()))
{
value = NULL;
JS4DFolderIterator* container = static_cast<JS4DFolderIterator*>(JSObjectGetPrivate( JSValueToObject( inContext, inValue, outException) ));
if (testAssert( container != NULL))
{
VFolder* folder = container->GetFolder();
if (folder != NULL)
{
VString *s = new VString;
if (s != NULL)
folder->GetPath( *s, FPS_POSIX);
value = s;
}
}
}
else if (JSValueIsObjectOfClass( inContext, inValue, VJSFileIterator::Class()))
{
value = NULL;
JS4DFileIterator* container = static_cast<JS4DFileIterator*>(JSObjectGetPrivate( JSValueToObject( inContext, inValue, outException) ));
if (testAssert( container != NULL))
{
VFile* file = container->GetFile();
if (file != NULL)
{
VString *s = new VString;
if (s != NULL)
file->GetPath( *s, FPS_POSIX);
value = s;
}
}
}
else if (JSValueIsObjectOfClass( inContext, inValue, VJSBlob::Class()))
{
//.........这里部分代码省略.........
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:101,代码来源:JS4D.cpp
示例19: sizeof
VError XWinFolder::RetainSystemFolder( ESystemFolderKind inFolderKind, bool inCreateFolder, VFolder **outFolder )
{
VString folderPath;
UniChar path[4096];
size_t maxLength = sizeof( path)/sizeof( UniChar);
path[maxLength-2]=0;
VFolder* sysFolder = NULL;
DWORD winErr = ERROR_PATH_NOT_FOUND;
switch( inFolderKind)
{
case eFK_Executable:
{
DWORD pathLength = ::GetModuleFileNameW( NULL, path, (DWORD) maxLength);
if (testAssert( pathLength != 0 && !path[maxLength-2]))
{
folderPath.FromUniCString( path );
VFile exeFile( folderPath );
sysFolder = exeFile.RetainParentFolder();
winErr = 0;
}
break;
}
case eFK_Temporary:
{
DWORD length = ::GetTempPathW( (DWORD) maxLength, path);
if ( (length > 0) && (length <= maxLength) && !path[maxLength-2])
{
DWORD size = ::GetLongPathNameW( path, NULL, 0);
if (size > 0)
{
UniChar *p = folderPath.GetCPointerForWrite( size-1);
if (p != NULL)
{
DWORD result = ::GetLongPathNameW( path, p, size);
if (result == 0)
winErr = GetLastError();
else
winErr = 0;
folderPath.Validate( result);
sysFolder = new VFolder( folderPath );
}
}
}
break;
}
default:
{
int type;
switch( inFolderKind)
{
case eFK_UserDocuments: type = CSIDL_PERSONAL; break;
case eFK_CommonPreferences: type = CSIDL_COMMON_APPDATA; break;
case eFK_UserPreferences: type = CSIDL_APPDATA; break;
case eFK_CommonApplicationData: type = CSIDL_COMMON_APPDATA; break;
case eFK_UserApplicationData: type = CSIDL_APPDATA; break;
case eFK_CommonCache: type = CSIDL_COMMON_APPDATA; break;
case eFK_UserCache: type = CSIDL_LOCAL_APPDATA; break;
default: xbox_assert( false); type = CSIDL_APPDATA; break;
}
HRESULT result = ::SHGetFolderPathW( NULL, type, NULL, SHGFP_TYPE_CURRENT, path);
if ( result == S_OK || result == S_FALSE ) // S_FALSE means The CSIDL is valid, but the folder does not exist.
{
folderPath.FromUniCString( path);
if (folderPath[folderPath.GetLength()-1] != FOLDER_SEPARATOR)
folderPath += FOLDER_SEPARATOR;
sysFolder = new VFolder( folderPath );
winErr = 0;
}
break;
}
}
if ( (sysFolder != NULL) && !sysFolder->Exists() )
{
if (inCreateFolder)
{
if (sysFolder->CreateRecursive() != VE_OK)
ReleaseRefCountable( &sysFolder);
}
else
{
ReleaseRefCountable( &sysFolder);
}
}
*outFolder = sysFolder;
return MAKE_NATIVE_VERROR( winErr);
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:90,代码来源:XWinFolder.cpp
示例20: _ExplainTTRFormat_V1
//.........这里部分代码省略.........
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r\r", eCLEntryKind_Unknown);
doc.AppendPrintf("[%d]\r", eCLEntryKind_Start);
doc += "The log starts. Quoted (start/end) entry, with misc. infos between the start and the end.\r";
doc.AppendPrintf("[%d]s [tab] current time [tab] taskID [tab] version [cr]\r", eCLEntryKind_Start);
doc.AppendPrintf("struct [tab] path to host database structure file [cr]\r");
doc.AppendPrintf("data [tab] path to host database data file [cr]\r");
doc.AppendPrintf("[%d]e\r\r", eCLEntryKind_Start);
doc.AppendPrintf("[%d]\r", eCLEntryKind_Stop);
doc += "The log ends\r";
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r\r", eCLEntryKind_Stop);
doc.AppendPrintf("[%d]\r", eCLEntryKind_Comment);
doc += "A comment added by the developer. Comments are always quoted with start and end, a \\r is added at beginning and end.\r";
doc.AppendPrintf("[%d]start [tab] ellapsed second since log started [tab] taskID [cr] the comment [cr] [%d]end [tab] time [tab] taskID [tab] 0 (the milliseconds)\r\r", eCLEntryKind_Comment);
doc.AppendPrintf("[%d]\r", eCLEntryKind_NeedsBytes);
doc += "Any source asks memory to the cache manager\r";
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] needed bytes (very large int.)\r", eCLEntryKind_NeedsBytes);
doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);
doc.AppendPrintf("[%d]\r", eCLEntryKind_CallNeedsBytes);
doc += "Memory manager asks memory to the cache manager: not enough space in the cache to allocate memory. The cache manager will try to free unused objects, to flush, etc...\r";
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] needed bytes (very large int.)\r", eCLEntryKind_CallNeedsBytes);
doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);
doc.AppendPrintf("[%d], [%d], [%d], [%d], [%d], [%d], [%d]\r", eCLEntryKind_FlushFromLanguage,
eCLEntryKind_FlushFromMenuCommand,
eCLEntryKind_FlushFromScheduler,
eCLEntryKind_FlushFromBackup,
eCLEntryKind_FlushFromNeedsBytes,
eCLEntryKind_FlushFromRemote,
eCLEntryKind_FlushFromUnknown);
doc += "Action at the origin of a flush. All the 'FlushFrom...' share the same format.\r";
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] task name [tab] process 4D num [tab] isWaitUntilDone (1 = yes, 0 = no, -1 = unknown) [tab] isEmptyCache (1 = yes, 0 = no, -1 = unknown)\r", eCLEntryKind_CallNeedsBytes);
doc.AppendPrintf("Note: may be followed by [%d]\r", eCLEntryKind_MemStats);
doc.AppendPrintf("Note: [%d] means a flush was requested from the remote, but we don't have the exact origin (does a client called FLUSH BUFFERS explicitely? ...)\r\r", eCLEntryKind_FlushFromRemote);
doc.AppendPrintf("[%d]\r", eCLEntryKind_Flush);
doc += "Flush (we are inside the Flush Manager)\r";
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID\r", eCLEntryKind_Flush);
doc.AppendPrintf("Note: may be followed by [%d]\r\r", eCLEntryKind_MemStats);
doc.AppendPrintf("[%d]\r", eCLEntryKind_MemStats);
doc += "The memory statistics. Level of stats is a bit field, to get specific stats, add the following values:\r";
doc.AppendPrintf("Mini stats (default value): %d\r", eCLDumpStats_Mini);
doc.AppendPrintf("Objects: %d\r", eCLDumpStats_Objects);
doc.AppendPrintf("Blocks: %d\r", eCLDumpStats_Blocks);
doc.AppendPrintf("SmallBlocks: %d\r", eCLDumpStats_SmallBlocks);
doc.AppendPrintf("BigBlocks: %d\r", eCLDumpStats_BigBlocks);
doc.AppendPrintf("OtherBlocks: %d\r", eCLDumpStats_OtherBlocks);
doc.AppendPrintf("All: %d\r", eCLDumpStats_All);
doc.AppendPrintf("[%d] [tab] ellapsed second since log started [tab] taskID [tab] origin of the stats (a log entry number) [cr] the stats\r", eCLEntryKind_MemStats);
doc += "the stats themselves are in xml:\r";
doc += "Main tag: <mem_stats level=\"stat level\" size=\"total amount of memory\" used=\"amount ofused memory\">\r";
doc += "Then come the details:\r";
doc += "<system phys=\"physical memory size\" free=\"free memory size\" app_used_phys=\"physical used by app\" used_virtual=\"virtual meory used\" />\r";
doc += "Allocations blocks: <alloc count=\"number of virtual allocations\" tot=\"total allocated\" />\r";
doc += "Then come the detailed stats, depending on the level. Note: infos are the same as the one found in GET CACHE STATISTIC.";
doc += ", the xml uses some abbreviations to reduce a bit the size: bb = \"big blocks\", sb = \"small blocks\", ob = \"other blocks\"\r";
doc += "Example of log:\r";
doc += "<mem_stats level=\"1\" tid=\"13\" tname=\"P_1\" pnum=\"5\" size=\"10704570434977792\" used=\"2306663092733982407\">\r";
doc += "<system phys=\"2143993856\" free=\"1\" app_used_phys=\"2882306048\" used_virtual=\"0\"/>";
doc += "<alloc count=\"2\" tot=\"104857600\"/>";
doc += "<stats free=\"102365184\" nb_bb=\"165\" used_bb=\"163\" free_bb=\"2\" nb_pages=\"104\" nb_sb=\"4411\" used_sb=\"4401\" free_sb=\"10\" biggest_block=\"70124512\" biggest_free_block=\"70124512\" nb_obj=\"3852\"/>";
doc += "</mem_stats>\r\r";
VFolder *userDocsFolder = VFolder::RetainSystemFolder(eFK_UserDocuments, false);
if(userDocsFolder != NULL)
{
VFile logDoc(*userDocsFolder, CVSTR("cache_log_doc_v1.txt"));
VError err = VE_OK;
if(logDoc.Exists())
err = logDoc.Delete();
err = logDoc.Create();
if(err == VE_OK)
{
VFileStream logDocDump(&logDoc);
err = logDocDump.OpenWriting();
if(err == VE_OK)
{
logDocDump.PutText(doc);
}
if(err == VE_OK)
err = logDocDump.CloseWriting();
}
userDocsFolder->Release();
}
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:101,代码来源:VCacheLog.cpp
注:本文中的VFolder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论